larkin 0.4.19 → 0.4.21
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/agent/context-prompt.cjs +2 -2
- package/dist/agent/context-prompt.mjs +2 -2
- package/dist/agent/missed-outbound-scan.cjs +123 -0
- package/dist/agent/missed-outbound-scan.mjs +112 -0
- package/dist/feishu/host-shell.cjs +9 -0
- package/dist/feishu/host-shell.mjs +9 -0
- package/dist/feishu/message-policy.cjs +2 -0
- package/dist/feishu/message-policy.mjs +2 -0
- package/dist/runtime/pi-inline-extensions.mjs +40 -9
- package/dist/runtime/pi-subagent-injection.mjs +103 -10
- package/dist/runtime/pi-subagents.bundle.js +131 -58
- package/dist/runtime/pi-supervised-command-extension.mjs +72 -0
- package/dist/runtime/pi-supervised-command.bundle.js +4735 -0
- package/dist/runtime/pi-supervised-command.mjs +420 -0
- package/dist/setup/bot-register.mjs +53 -27
- package/dist/setup/grant-scopes.mjs +13 -4
- package/dist/setup/tenant-scope-grant.mjs +16 -0
- package/package.json +1 -1
- package/patches/@tintinweb%2Fpi-subagents@0.14.3.patch +712 -16
|
@@ -0,0 +1,4735 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// node_modules/typebox/build/system/memory/memory.mjs
|
|
18
|
+
var exports_memory = {};
|
|
19
|
+
__export(exports_memory, {
|
|
20
|
+
Update: () => Update,
|
|
21
|
+
Metrics: () => Metrics,
|
|
22
|
+
Discard: () => Discard,
|
|
23
|
+
Create: () => Create,
|
|
24
|
+
Clone: () => Clone,
|
|
25
|
+
Assign: () => Assign
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// node_modules/typebox/build/system/memory/metrics.mjs
|
|
29
|
+
var Metrics = {
|
|
30
|
+
assign: 0,
|
|
31
|
+
create: 0,
|
|
32
|
+
clone: 0,
|
|
33
|
+
discard: 0,
|
|
34
|
+
update: 0
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// node_modules/typebox/build/system/memory/assign.mjs
|
|
38
|
+
function Assign(left, right) {
|
|
39
|
+
Metrics.assign += 1;
|
|
40
|
+
return { ...left, ...right };
|
|
41
|
+
}
|
|
42
|
+
// node_modules/typebox/build/guard/guard.mjs
|
|
43
|
+
var exports_guard = {};
|
|
44
|
+
__export(exports_guard, {
|
|
45
|
+
Values: () => Values,
|
|
46
|
+
Symbols: () => Symbols,
|
|
47
|
+
ShiftLeft: () => ShiftLeft,
|
|
48
|
+
Keys: () => Keys,
|
|
49
|
+
IsValueLike: () => IsValueLike,
|
|
50
|
+
IsUnsafePropertyKey: () => IsUnsafePropertyKey,
|
|
51
|
+
IsUndefined: () => IsUndefined,
|
|
52
|
+
IsSymbol: () => IsSymbol,
|
|
53
|
+
IsString: () => IsString,
|
|
54
|
+
IsObjectNotArray: () => IsObjectNotArray,
|
|
55
|
+
IsObject: () => IsObject,
|
|
56
|
+
IsNumber: () => IsNumber,
|
|
57
|
+
IsNull: () => IsNull,
|
|
58
|
+
IsMultipleOf: () => IsMultipleOf,
|
|
59
|
+
IsMinLength: () => IsMinLength2,
|
|
60
|
+
IsMaxLength: () => IsMaxLength2,
|
|
61
|
+
IsLessThan: () => IsLessThan,
|
|
62
|
+
IsLessEqualThan: () => IsLessEqualThan,
|
|
63
|
+
IsInteger: () => IsInteger,
|
|
64
|
+
IsGreaterThan: () => IsGreaterThan,
|
|
65
|
+
IsGreaterEqualThan: () => IsGreaterEqualThan,
|
|
66
|
+
IsFunction: () => IsFunction,
|
|
67
|
+
IsEqual: () => IsEqual,
|
|
68
|
+
IsDeepEqual: () => IsDeepEqual,
|
|
69
|
+
IsConstructor: () => IsConstructor,
|
|
70
|
+
IsClassInstance: () => IsClassInstance,
|
|
71
|
+
IsBoolean: () => IsBoolean,
|
|
72
|
+
IsBigInt: () => IsBigInt,
|
|
73
|
+
IsArray: () => IsArray,
|
|
74
|
+
HasPropertyKey: () => HasPropertyKey,
|
|
75
|
+
GraphemeCount: () => GraphemeCount2,
|
|
76
|
+
EveryAll: () => EveryAll,
|
|
77
|
+
Every: () => Every,
|
|
78
|
+
EntriesRegExp: () => EntriesRegExp,
|
|
79
|
+
Entries: () => Entries
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// node_modules/typebox/build/guard/string.mjs
|
|
83
|
+
function IsBetween(value, min, max) {
|
|
84
|
+
return value >= min && value <= max;
|
|
85
|
+
}
|
|
86
|
+
function IsZeroWidthJoiner(value) {
|
|
87
|
+
return value === 8205;
|
|
88
|
+
}
|
|
89
|
+
function IsHighSurrogate(value) {
|
|
90
|
+
return IsBetween(value, 55296, 56319);
|
|
91
|
+
}
|
|
92
|
+
function IsRegionalIndicator(value) {
|
|
93
|
+
return IsBetween(value, 127462, 127487);
|
|
94
|
+
}
|
|
95
|
+
function IsVariationSelector(value) {
|
|
96
|
+
return IsBetween(value, 65024, 65039);
|
|
97
|
+
}
|
|
98
|
+
function IsCombiningMark(value) {
|
|
99
|
+
return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
|
|
100
|
+
}
|
|
101
|
+
function CodePointLength(value) {
|
|
102
|
+
return value > 65535 ? 2 : 1;
|
|
103
|
+
}
|
|
104
|
+
function ConsumeModifiers(value, index) {
|
|
105
|
+
while (index < value.length) {
|
|
106
|
+
const point = value.codePointAt(index);
|
|
107
|
+
if (IsCombiningMark(point) || IsVariationSelector(point)) {
|
|
108
|
+
index += CodePointLength(point);
|
|
109
|
+
} else {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return index;
|
|
114
|
+
}
|
|
115
|
+
function NextGraphemeClusterIndex(value, clusterStart) {
|
|
116
|
+
const startCP = value.codePointAt(clusterStart);
|
|
117
|
+
let clusterEnd = clusterStart + CodePointLength(startCP);
|
|
118
|
+
clusterEnd = ConsumeModifiers(value, clusterEnd);
|
|
119
|
+
while (clusterEnd < value.length - 1 && value[clusterEnd] === "\u200D") {
|
|
120
|
+
const nextCP = value.codePointAt(clusterEnd + 1);
|
|
121
|
+
clusterEnd += 1 + CodePointLength(nextCP);
|
|
122
|
+
clusterEnd = ConsumeModifiers(value, clusterEnd);
|
|
123
|
+
}
|
|
124
|
+
if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) {
|
|
125
|
+
clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
|
|
126
|
+
}
|
|
127
|
+
return clusterEnd;
|
|
128
|
+
}
|
|
129
|
+
function IsGraphemeCodePoint(value) {
|
|
130
|
+
return IsHighSurrogate(value) || IsCombiningMark(value) || IsVariationSelector(value) || IsZeroWidthJoiner(value);
|
|
131
|
+
}
|
|
132
|
+
function GraphemeCount(value) {
|
|
133
|
+
let count = 0;
|
|
134
|
+
let index = 0;
|
|
135
|
+
while (index < value.length) {
|
|
136
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
137
|
+
count++;
|
|
138
|
+
}
|
|
139
|
+
return count;
|
|
140
|
+
}
|
|
141
|
+
function IsMinLength(value, minLength) {
|
|
142
|
+
if (minLength === 0)
|
|
143
|
+
return true;
|
|
144
|
+
let count = 0;
|
|
145
|
+
let index = 0;
|
|
146
|
+
while (index < value.length) {
|
|
147
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
148
|
+
count++;
|
|
149
|
+
if (count >= minLength)
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
function IsMaxLength(value, maxLength) {
|
|
155
|
+
let count = 0;
|
|
156
|
+
let index = 0;
|
|
157
|
+
while (index < value.length) {
|
|
158
|
+
index = NextGraphemeClusterIndex(value, index);
|
|
159
|
+
count++;
|
|
160
|
+
if (count > maxLength)
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
function IsMinLengthFast(value, minLength) {
|
|
166
|
+
if (minLength === 0)
|
|
167
|
+
return true;
|
|
168
|
+
let index = 0;
|
|
169
|
+
while (index < value.length) {
|
|
170
|
+
if (IsGraphemeCodePoint(value.charCodeAt(index))) {
|
|
171
|
+
return IsMinLength(value, minLength);
|
|
172
|
+
}
|
|
173
|
+
index++;
|
|
174
|
+
if (index >= minLength)
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
function IsMaxLengthFast(value, maxLength) {
|
|
180
|
+
let index = 0;
|
|
181
|
+
while (index < value.length) {
|
|
182
|
+
if (IsGraphemeCodePoint(value.charCodeAt(index))) {
|
|
183
|
+
return IsMaxLength(value, maxLength);
|
|
184
|
+
}
|
|
185
|
+
index++;
|
|
186
|
+
if (index > maxLength)
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// node_modules/typebox/build/guard/guard.mjs
|
|
193
|
+
function IsArray(value) {
|
|
194
|
+
return Array.isArray(value);
|
|
195
|
+
}
|
|
196
|
+
function IsBigInt(value) {
|
|
197
|
+
return IsEqual(typeof value, "bigint");
|
|
198
|
+
}
|
|
199
|
+
function IsBoolean(value) {
|
|
200
|
+
return IsEqual(typeof value, "boolean");
|
|
201
|
+
}
|
|
202
|
+
function IsConstructor(value) {
|
|
203
|
+
if (IsUndefined(value) || !IsFunction(value))
|
|
204
|
+
return false;
|
|
205
|
+
const result = Function.prototype.toString.call(value);
|
|
206
|
+
if (/^class\s/.test(result))
|
|
207
|
+
return true;
|
|
208
|
+
if (/\[native code\]/.test(result))
|
|
209
|
+
return true;
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
function IsFunction(value) {
|
|
213
|
+
return IsEqual(typeof value, "function");
|
|
214
|
+
}
|
|
215
|
+
function IsInteger(value) {
|
|
216
|
+
return Number.isInteger(value);
|
|
217
|
+
}
|
|
218
|
+
function IsNull(value) {
|
|
219
|
+
return IsEqual(value, null);
|
|
220
|
+
}
|
|
221
|
+
function IsNumber(value) {
|
|
222
|
+
return Number.isFinite(value);
|
|
223
|
+
}
|
|
224
|
+
function IsObjectNotArray(value) {
|
|
225
|
+
return IsObject(value) && !IsArray(value);
|
|
226
|
+
}
|
|
227
|
+
function IsObject(value) {
|
|
228
|
+
return IsEqual(typeof value, "object") && !IsNull(value);
|
|
229
|
+
}
|
|
230
|
+
function IsString(value) {
|
|
231
|
+
return IsEqual(typeof value, "string");
|
|
232
|
+
}
|
|
233
|
+
function IsSymbol(value) {
|
|
234
|
+
return IsEqual(typeof value, "symbol");
|
|
235
|
+
}
|
|
236
|
+
function IsUndefined(value) {
|
|
237
|
+
return IsEqual(value, undefined);
|
|
238
|
+
}
|
|
239
|
+
function IsEqual(left, right) {
|
|
240
|
+
return left === right;
|
|
241
|
+
}
|
|
242
|
+
function IsGreaterThan(left, right) {
|
|
243
|
+
return left > right;
|
|
244
|
+
}
|
|
245
|
+
function IsLessThan(left, right) {
|
|
246
|
+
return left < right;
|
|
247
|
+
}
|
|
248
|
+
function IsLessEqualThan(left, right) {
|
|
249
|
+
return left <= right;
|
|
250
|
+
}
|
|
251
|
+
function IsGreaterEqualThan(left, right) {
|
|
252
|
+
return left >= right;
|
|
253
|
+
}
|
|
254
|
+
function IsMultipleOf(dividend, divisor) {
|
|
255
|
+
if (IsBigInt(dividend) || IsBigInt(divisor)) {
|
|
256
|
+
return BigInt(dividend) % BigInt(divisor) === 0n;
|
|
257
|
+
}
|
|
258
|
+
const tolerance = 0.0000000001;
|
|
259
|
+
if (!IsNumber(dividend))
|
|
260
|
+
return true;
|
|
261
|
+
if (IsInteger(dividend) && 1 / divisor % 1 === 0)
|
|
262
|
+
return true;
|
|
263
|
+
const mod = dividend % divisor;
|
|
264
|
+
return Math.min(Math.abs(mod), Math.abs(mod - divisor), Math.abs(mod + divisor)) < tolerance;
|
|
265
|
+
}
|
|
266
|
+
function IsClassInstance(value) {
|
|
267
|
+
if (!IsObject(value))
|
|
268
|
+
return false;
|
|
269
|
+
const proto = globalThis.Object.getPrototypeOf(value);
|
|
270
|
+
if (IsNull(proto))
|
|
271
|
+
return false;
|
|
272
|
+
return IsEqual(typeof proto.constructor, "function") && !(IsEqual(proto.constructor, globalThis.Object) || IsEqual(proto.constructor.name, "Object"));
|
|
273
|
+
}
|
|
274
|
+
function IsValueLike(value) {
|
|
275
|
+
return IsBigInt(value) || IsBoolean(value) || IsNull(value) || IsNumber(value) || IsString(value) || IsUndefined(value);
|
|
276
|
+
}
|
|
277
|
+
function GraphemeCount2(value) {
|
|
278
|
+
return GraphemeCount(value);
|
|
279
|
+
}
|
|
280
|
+
function IsMaxLength2(value, length) {
|
|
281
|
+
return IsMaxLengthFast(value, length);
|
|
282
|
+
}
|
|
283
|
+
function IsMinLength2(value, length) {
|
|
284
|
+
return IsMinLengthFast(value, length);
|
|
285
|
+
}
|
|
286
|
+
function Every(value, offset, callback) {
|
|
287
|
+
for (let index = offset;index < value.length; index++) {
|
|
288
|
+
if (!callback(value[index], index))
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
function EveryAll(value, offset, callback) {
|
|
294
|
+
let result = true;
|
|
295
|
+
for (let index = offset;index < value.length; index++) {
|
|
296
|
+
if (!callback(value[index], index))
|
|
297
|
+
result = false;
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
function ShiftLeft(array, true_, false_) {
|
|
302
|
+
return IsEqual(array.length, 0) ? false_() : true_(array[0], array.slice(1));
|
|
303
|
+
}
|
|
304
|
+
function IsUnsafePropertyKey(key) {
|
|
305
|
+
return IsEqual(key, "__proto__") || IsEqual(key, "constructor") || IsEqual(key, "prototype");
|
|
306
|
+
}
|
|
307
|
+
function HasPropertyKey(value, key) {
|
|
308
|
+
return IsUnsafePropertyKey(key) ? Object.prototype.hasOwnProperty.call(value, key) : (key in value);
|
|
309
|
+
}
|
|
310
|
+
function EntriesRegExp(value) {
|
|
311
|
+
return Keys(value).map((key) => [new RegExp(`^${key}$`), value[key]]);
|
|
312
|
+
}
|
|
313
|
+
function Entries(value) {
|
|
314
|
+
return Object.entries(value);
|
|
315
|
+
}
|
|
316
|
+
function Keys(value) {
|
|
317
|
+
return Object.getOwnPropertyNames(value);
|
|
318
|
+
}
|
|
319
|
+
function Symbols(value) {
|
|
320
|
+
return Object.getOwnPropertySymbols(value);
|
|
321
|
+
}
|
|
322
|
+
function Values(value) {
|
|
323
|
+
return Object.values(value);
|
|
324
|
+
}
|
|
325
|
+
function DeepEqualObject(left, right) {
|
|
326
|
+
if (!IsObject(right))
|
|
327
|
+
return false;
|
|
328
|
+
const keys = Keys(left);
|
|
329
|
+
return IsEqual(keys.length, Keys(right).length) && keys.every((key) => IsDeepEqual(left[key], right[key]));
|
|
330
|
+
}
|
|
331
|
+
function DeepEqualArray(left, right) {
|
|
332
|
+
return IsArray(right) && IsEqual(left.length, right.length) && left.every((_, index) => IsDeepEqual(left[index], right[index]));
|
|
333
|
+
}
|
|
334
|
+
function IsDeepEqual(left, right) {
|
|
335
|
+
return IsArray(left) ? DeepEqualArray(left, right) : IsObject(left) ? DeepEqualObject(left, right) : IsEqual(left, right);
|
|
336
|
+
}
|
|
337
|
+
// node_modules/typebox/build/guard/globals.mjs
|
|
338
|
+
var exports_globals = {};
|
|
339
|
+
__export(exports_globals, {
|
|
340
|
+
IsUint8ClampedArray: () => IsUint8ClampedArray,
|
|
341
|
+
IsUint8Array: () => IsUint8Array,
|
|
342
|
+
IsUint32Array: () => IsUint32Array,
|
|
343
|
+
IsUint16Array: () => IsUint16Array,
|
|
344
|
+
IsTypeArray: () => IsTypeArray,
|
|
345
|
+
IsString: () => IsString2,
|
|
346
|
+
IsSet: () => IsSet,
|
|
347
|
+
IsRegExp: () => IsRegExp,
|
|
348
|
+
IsNumber: () => IsNumber2,
|
|
349
|
+
IsMap: () => IsMap,
|
|
350
|
+
IsInt8Array: () => IsInt8Array,
|
|
351
|
+
IsInt32Array: () => IsInt32Array,
|
|
352
|
+
IsInt16Array: () => IsInt16Array,
|
|
353
|
+
IsFloat64Array: () => IsFloat64Array,
|
|
354
|
+
IsFloat32Array: () => IsFloat32Array,
|
|
355
|
+
IsDate: () => IsDate,
|
|
356
|
+
IsBoolean: () => IsBoolean2,
|
|
357
|
+
IsBigUint64Array: () => IsBigUint64Array,
|
|
358
|
+
IsBigInt64Array: () => IsBigInt64Array
|
|
359
|
+
});
|
|
360
|
+
function IsBoolean2(value) {
|
|
361
|
+
return value instanceof Boolean;
|
|
362
|
+
}
|
|
363
|
+
function IsNumber2(value) {
|
|
364
|
+
return value instanceof Number;
|
|
365
|
+
}
|
|
366
|
+
function IsString2(value) {
|
|
367
|
+
return value instanceof String;
|
|
368
|
+
}
|
|
369
|
+
function IsTypeArray(value) {
|
|
370
|
+
return globalThis.ArrayBuffer.isView(value);
|
|
371
|
+
}
|
|
372
|
+
function IsInt8Array(value) {
|
|
373
|
+
return value instanceof globalThis.Int8Array;
|
|
374
|
+
}
|
|
375
|
+
function IsUint8Array(value) {
|
|
376
|
+
return value instanceof globalThis.Uint8Array;
|
|
377
|
+
}
|
|
378
|
+
function IsUint8ClampedArray(value) {
|
|
379
|
+
return value instanceof globalThis.Uint8ClampedArray;
|
|
380
|
+
}
|
|
381
|
+
function IsInt16Array(value) {
|
|
382
|
+
return value instanceof globalThis.Int16Array;
|
|
383
|
+
}
|
|
384
|
+
function IsUint16Array(value) {
|
|
385
|
+
return value instanceof globalThis.Uint16Array;
|
|
386
|
+
}
|
|
387
|
+
function IsInt32Array(value) {
|
|
388
|
+
return value instanceof globalThis.Int32Array;
|
|
389
|
+
}
|
|
390
|
+
function IsUint32Array(value) {
|
|
391
|
+
return value instanceof globalThis.Uint32Array;
|
|
392
|
+
}
|
|
393
|
+
function IsFloat32Array(value) {
|
|
394
|
+
return value instanceof globalThis.Float32Array;
|
|
395
|
+
}
|
|
396
|
+
function IsFloat64Array(value) {
|
|
397
|
+
return value instanceof globalThis.Float64Array;
|
|
398
|
+
}
|
|
399
|
+
function IsBigInt64Array(value) {
|
|
400
|
+
return value instanceof globalThis.BigInt64Array;
|
|
401
|
+
}
|
|
402
|
+
function IsBigUint64Array(value) {
|
|
403
|
+
return value instanceof globalThis.BigUint64Array;
|
|
404
|
+
}
|
|
405
|
+
function IsRegExp(value) {
|
|
406
|
+
return value instanceof globalThis.RegExp;
|
|
407
|
+
}
|
|
408
|
+
function IsDate(value) {
|
|
409
|
+
return value instanceof globalThis.Date;
|
|
410
|
+
}
|
|
411
|
+
function IsSet(value) {
|
|
412
|
+
return value instanceof globalThis.Set;
|
|
413
|
+
}
|
|
414
|
+
function IsMap(value) {
|
|
415
|
+
return value instanceof globalThis.Map;
|
|
416
|
+
}
|
|
417
|
+
// node_modules/typebox/build/system/memory/clone.mjs
|
|
418
|
+
function FromClassInstance(value) {
|
|
419
|
+
return value;
|
|
420
|
+
}
|
|
421
|
+
function IsTypeObject(value) {
|
|
422
|
+
return exports_guard.HasPropertyKey(value, "~kind") || exports_guard.HasPropertyKey(value, "~unsafe");
|
|
423
|
+
}
|
|
424
|
+
function FromTypeObject(value) {
|
|
425
|
+
const result = {};
|
|
426
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
427
|
+
for (const key of Object.keys(descriptors)) {
|
|
428
|
+
if (exports_guard.IsUnsafePropertyKey(key))
|
|
429
|
+
continue;
|
|
430
|
+
const descriptor = descriptors[key];
|
|
431
|
+
if (exports_guard.HasPropertyKey(descriptor, "value")) {
|
|
432
|
+
Object.defineProperty(result, key, { ...descriptor, value: FromValue(descriptor.value) });
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function FromPlainObject(value) {
|
|
438
|
+
const result = {};
|
|
439
|
+
for (const key of exports_guard.Keys(value)) {
|
|
440
|
+
if (exports_guard.IsUnsafePropertyKey(key))
|
|
441
|
+
continue;
|
|
442
|
+
result[key] = FromValue(value[key]);
|
|
443
|
+
}
|
|
444
|
+
for (const key of exports_guard.Symbols(value)) {
|
|
445
|
+
result[key] = FromValue(value[key]);
|
|
446
|
+
}
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
function FromObject(value) {
|
|
450
|
+
return exports_guard.IsClassInstance(value) ? FromClassInstance(value) : IsTypeObject(value) ? FromTypeObject(value) : FromPlainObject(value);
|
|
451
|
+
}
|
|
452
|
+
function FromArray(value) {
|
|
453
|
+
return value.map((element) => FromValue(element));
|
|
454
|
+
}
|
|
455
|
+
function FromTypedArray(value) {
|
|
456
|
+
return value.slice();
|
|
457
|
+
}
|
|
458
|
+
function FromRegExp(value) {
|
|
459
|
+
return new RegExp(value.source, value.flags);
|
|
460
|
+
}
|
|
461
|
+
function FromMap(value) {
|
|
462
|
+
return new Map(FromValue([...value.entries()]));
|
|
463
|
+
}
|
|
464
|
+
function FromSet(value) {
|
|
465
|
+
return new Set(FromValue([...value.values()]));
|
|
466
|
+
}
|
|
467
|
+
function FromValue(value) {
|
|
468
|
+
return exports_globals.IsTypeArray(value) ? FromTypedArray(value) : exports_globals.IsRegExp(value) ? FromRegExp(value) : exports_globals.IsMap(value) ? FromMap(value) : exports_globals.IsSet(value) ? FromSet(value) : exports_guard.IsArray(value) ? FromArray(value) : exports_guard.IsObject(value) ? FromObject(value) : value;
|
|
469
|
+
}
|
|
470
|
+
function Clone(value) {
|
|
471
|
+
Metrics.clone += 1;
|
|
472
|
+
return FromValue(value);
|
|
473
|
+
}
|
|
474
|
+
// node_modules/typebox/build/system/settings/settings.mjs
|
|
475
|
+
var exports_settings = {};
|
|
476
|
+
__export(exports_settings, {
|
|
477
|
+
Set: () => Set2,
|
|
478
|
+
Reset: () => Reset,
|
|
479
|
+
Get: () => Get
|
|
480
|
+
});
|
|
481
|
+
var settings = {
|
|
482
|
+
immutableTypes: false,
|
|
483
|
+
maxErrors: 8,
|
|
484
|
+
useAcceleration: true,
|
|
485
|
+
exactOptionalPropertyTypes: false,
|
|
486
|
+
enumerableKind: false,
|
|
487
|
+
correctiveParse: false,
|
|
488
|
+
unionPrioritySort: true
|
|
489
|
+
};
|
|
490
|
+
function Reset() {
|
|
491
|
+
settings.immutableTypes = false;
|
|
492
|
+
settings.maxErrors = 8;
|
|
493
|
+
settings.useAcceleration = true;
|
|
494
|
+
settings.exactOptionalPropertyTypes = false;
|
|
495
|
+
settings.enumerableKind = false;
|
|
496
|
+
settings.correctiveParse = false;
|
|
497
|
+
settings.unionPrioritySort = true;
|
|
498
|
+
}
|
|
499
|
+
function Set2(options) {
|
|
500
|
+
for (const key of exports_guard.Keys(options)) {
|
|
501
|
+
const value = options[key];
|
|
502
|
+
if (value !== undefined) {
|
|
503
|
+
Object.defineProperty(settings, key, { value });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function Get() {
|
|
508
|
+
return settings;
|
|
509
|
+
}
|
|
510
|
+
// node_modules/typebox/build/system/memory/create.mjs
|
|
511
|
+
function MergeHidden(left, right) {
|
|
512
|
+
for (const key of Object.keys(right)) {
|
|
513
|
+
Object.defineProperty(left, key, {
|
|
514
|
+
configurable: true,
|
|
515
|
+
writable: true,
|
|
516
|
+
enumerable: false,
|
|
517
|
+
value: right[key]
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return left;
|
|
521
|
+
}
|
|
522
|
+
function Merge(left, right) {
|
|
523
|
+
return { ...left, ...right };
|
|
524
|
+
}
|
|
525
|
+
function Create(hidden, enumerable, options = {}) {
|
|
526
|
+
Metrics.create += 1;
|
|
527
|
+
const settings2 = exports_settings.Get();
|
|
528
|
+
const withOptions = Merge(enumerable, options);
|
|
529
|
+
const withHidden = settings2.enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
|
|
530
|
+
return settings2.immutableTypes ? Object.freeze(withHidden) : withHidden;
|
|
531
|
+
}
|
|
532
|
+
// node_modules/typebox/build/system/memory/discard.mjs
|
|
533
|
+
function Discard(value, propertyKeys) {
|
|
534
|
+
Metrics.discard += 1;
|
|
535
|
+
const result = {};
|
|
536
|
+
const descriptors = Object.getOwnPropertyDescriptors(Clone(value));
|
|
537
|
+
const keysToDiscard = new Set(propertyKeys);
|
|
538
|
+
for (const key of Object.keys(descriptors)) {
|
|
539
|
+
if (keysToDiscard.has(key))
|
|
540
|
+
continue;
|
|
541
|
+
Object.defineProperty(result, key, descriptors[key]);
|
|
542
|
+
}
|
|
543
|
+
return result;
|
|
544
|
+
}
|
|
545
|
+
// node_modules/typebox/build/system/memory/update.mjs
|
|
546
|
+
function Update(current, hidden, enumerable) {
|
|
547
|
+
Metrics.update += 1;
|
|
548
|
+
const settings2 = exports_settings.Get();
|
|
549
|
+
const result = Clone(current);
|
|
550
|
+
for (const key of Object.keys(hidden)) {
|
|
551
|
+
Object.defineProperty(result, key, {
|
|
552
|
+
configurable: true,
|
|
553
|
+
writable: true,
|
|
554
|
+
enumerable: settings2.enumerableKind,
|
|
555
|
+
value: hidden[key]
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
for (const key of Object.keys(enumerable)) {
|
|
559
|
+
Object.defineProperty(result, key, {
|
|
560
|
+
configurable: true,
|
|
561
|
+
enumerable: true,
|
|
562
|
+
writable: true,
|
|
563
|
+
value: enumerable[key]
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
return result;
|
|
567
|
+
}
|
|
568
|
+
// node_modules/typebox/build/type/types/schema.mjs
|
|
569
|
+
function IsKind(value, kind) {
|
|
570
|
+
return exports_guard.IsObject(value) && exports_guard.HasPropertyKey(value, "~kind") && exports_guard.IsEqual(value["~kind"], kind);
|
|
571
|
+
}
|
|
572
|
+
function IsSchema(value) {
|
|
573
|
+
return exports_guard.IsObject(value);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// node_modules/typebox/build/type/types/deferred.mjs
|
|
577
|
+
function Deferred(action, parameters, options) {
|
|
578
|
+
return exports_memory.Create({ "~kind": "Deferred" }, { type: "deferred", action, parameters, options }, {});
|
|
579
|
+
}
|
|
580
|
+
function IsDeferred(value) {
|
|
581
|
+
return IsKind(value, "Deferred");
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs
|
|
585
|
+
function AddReadonlyOperation(type) {
|
|
586
|
+
return exports_memory.Update(type, { "~readonly": true }, {});
|
|
587
|
+
}
|
|
588
|
+
function AddReadonlyAction(type, options) {
|
|
589
|
+
const result = exports_memory.Update(AddReadonlyOperation(type), {}, options);
|
|
590
|
+
return result;
|
|
591
|
+
}
|
|
592
|
+
function AddReadonlyInstantiate(context, state, type, options) {
|
|
593
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
594
|
+
return AddReadonlyAction(instantiatedType, options);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// node_modules/typebox/build/type/engine/optional/instantiate_add.mjs
|
|
598
|
+
function AddOptionalOperation(type) {
|
|
599
|
+
return exports_memory.Update(type, { "~optional": true }, {});
|
|
600
|
+
}
|
|
601
|
+
function AddOptionalAction(type, options) {
|
|
602
|
+
const result = exports_memory.Update(AddOptionalOperation(type), {}, options);
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
function AddOptionalInstantiate(context, state, type, options) {
|
|
606
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
607
|
+
return AddOptionalAction(instantiatedType, options);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// node_modules/typebox/build/type/types/array.mjs
|
|
611
|
+
function _Array_(items, options) {
|
|
612
|
+
return exports_memory.Create({ "~kind": "Array" }, { type: "array", items }, options);
|
|
613
|
+
}
|
|
614
|
+
function IsArray2(value) {
|
|
615
|
+
return IsKind(value, "Array");
|
|
616
|
+
}
|
|
617
|
+
function ArrayOptions(type) {
|
|
618
|
+
return exports_memory.Discard(type, ["~kind", "type", "items"]);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// node_modules/typebox/build/type/types/constructor.mjs
|
|
622
|
+
function Constructor(parameters, instanceType, options = {}) {
|
|
623
|
+
return exports_memory.Create({ "~kind": "Constructor" }, { type: "constructor", parameters, instanceType }, options);
|
|
624
|
+
}
|
|
625
|
+
function IsConstructor2(value) {
|
|
626
|
+
return IsKind(value, "Constructor");
|
|
627
|
+
}
|
|
628
|
+
function ConstructorOptions(type) {
|
|
629
|
+
return exports_memory.Discard(type, ["~kind", "type", "parameters", "instanceType"]);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// node_modules/typebox/build/type/types/function.mjs
|
|
633
|
+
function _Function_(parameters, returnType, options = {}) {
|
|
634
|
+
return exports_memory.Create({ ["~kind"]: "Function" }, { type: "function", parameters, returnType }, options);
|
|
635
|
+
}
|
|
636
|
+
function IsFunction2(value) {
|
|
637
|
+
return IsKind(value, "Function");
|
|
638
|
+
}
|
|
639
|
+
function FunctionOptions(type) {
|
|
640
|
+
return exports_memory.Discard(type, ["~kind", "type", "parameters", "returnType"]);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// node_modules/typebox/build/type/types/ref.mjs
|
|
644
|
+
function Ref(ref, options) {
|
|
645
|
+
return exports_memory.Create({ ["~kind"]: "Ref" }, { $ref: ref }, options);
|
|
646
|
+
}
|
|
647
|
+
function IsRef(value) {
|
|
648
|
+
return IsKind(value, "Ref");
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// node_modules/typebox/build/type/types/generic.mjs
|
|
652
|
+
function Generic(parameters, expression) {
|
|
653
|
+
return exports_memory.Create({ "~kind": "Generic" }, { type: "generic", parameters, expression });
|
|
654
|
+
}
|
|
655
|
+
function IsGeneric(value) {
|
|
656
|
+
return IsKind(value, "Generic");
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// node_modules/typebox/build/type/types/any.mjs
|
|
660
|
+
function Any(options) {
|
|
661
|
+
return exports_memory.Create({ ["~kind"]: "Any" }, {}, options);
|
|
662
|
+
}
|
|
663
|
+
function IsAny(value) {
|
|
664
|
+
return IsKind(value, "Any");
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// node_modules/typebox/build/type/types/never.mjs
|
|
668
|
+
var NeverPattern = "(?!)";
|
|
669
|
+
function Never(options) {
|
|
670
|
+
return exports_memory.Create({ "~kind": "Never" }, { not: {} }, options);
|
|
671
|
+
}
|
|
672
|
+
function IsNever(value) {
|
|
673
|
+
return IsKind(value, "Never");
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// node_modules/typebox/build/type/action/_add_optional.mjs
|
|
677
|
+
function AddOptionalDeferred(type, options = {}) {
|
|
678
|
+
return Deferred("AddOptional", [type], options);
|
|
679
|
+
}
|
|
680
|
+
function AddOptional(type, options = {}) {
|
|
681
|
+
return AddOptionalAction(type, options);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// node_modules/typebox/build/type/types/_optional.mjs
|
|
685
|
+
function Optional(type) {
|
|
686
|
+
return AddOptional(type);
|
|
687
|
+
}
|
|
688
|
+
function IsOptional(value) {
|
|
689
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "~optional");
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// node_modules/typebox/build/type/types/properties.mjs
|
|
693
|
+
function RequiredArray(properties) {
|
|
694
|
+
return exports_guard.Keys(properties).filter((key) => !IsOptional(properties[key]));
|
|
695
|
+
}
|
|
696
|
+
function PropertyKeys(properties) {
|
|
697
|
+
return exports_guard.Keys(properties);
|
|
698
|
+
}
|
|
699
|
+
function PropertyValues(properties) {
|
|
700
|
+
return exports_guard.Values(properties);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// node_modules/typebox/build/type/types/object.mjs
|
|
704
|
+
function _Object_(properties, options = {}) {
|
|
705
|
+
const requiredKeys = RequiredArray(properties);
|
|
706
|
+
const required = requiredKeys.length > 0 ? { required: requiredKeys } : {};
|
|
707
|
+
return exports_memory.Create({ "~kind": "Object" }, { type: "object", ...required, properties }, options);
|
|
708
|
+
}
|
|
709
|
+
function IsObject2(value) {
|
|
710
|
+
return IsKind(value, "Object");
|
|
711
|
+
}
|
|
712
|
+
function ObjectOptions(type) {
|
|
713
|
+
return exports_memory.Discard(type, ["~kind", "type", "properties", "required"]);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// node_modules/typebox/build/type/types/unknown.mjs
|
|
717
|
+
function Unknown(options) {
|
|
718
|
+
return exports_memory.Create({ ["~kind"]: "Unknown" }, {}, options);
|
|
719
|
+
}
|
|
720
|
+
function IsUnknown(value) {
|
|
721
|
+
return IsKind(value, "Unknown");
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// node_modules/typebox/build/type/types/cyclic.mjs
|
|
725
|
+
function Cyclic($defs, $ref, options) {
|
|
726
|
+
const defs = exports_guard.Keys($defs).reduce((result, key) => {
|
|
727
|
+
return { ...result, [key]: exports_memory.Update($defs[key], {}, { $id: key }) };
|
|
728
|
+
}, {});
|
|
729
|
+
return exports_memory.Create({ ["~kind"]: "Cyclic" }, { $defs: defs, $ref }, options);
|
|
730
|
+
}
|
|
731
|
+
function IsCyclic(value) {
|
|
732
|
+
return IsKind(value, "Cyclic");
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// node_modules/typebox/build/type/types/unsafe.mjs
|
|
736
|
+
function Unsafe(schema) {
|
|
737
|
+
return exports_memory.Update(schema, { ["~unsafe"]: null }, {});
|
|
738
|
+
}
|
|
739
|
+
function IsUnsafe(value) {
|
|
740
|
+
return exports_guard.IsObjectNotArray(value) && exports_guard.HasPropertyKey(value, "~unsafe") && exports_guard.IsNull(value["~unsafe"]);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// node_modules/typebox/build/system/arguments/arguments.mjs
|
|
744
|
+
var exports_arguments = {};
|
|
745
|
+
__export(exports_arguments, {
|
|
746
|
+
Match: () => Match
|
|
747
|
+
});
|
|
748
|
+
function Match(args, match) {
|
|
749
|
+
return match[args.length]?.(...args) ?? (() => {
|
|
750
|
+
throw Error("Invalid Arguments");
|
|
751
|
+
})();
|
|
752
|
+
}
|
|
753
|
+
// node_modules/typebox/build/type/types/infer.mjs
|
|
754
|
+
function Infer(...args) {
|
|
755
|
+
const [name, extends_] = exports_arguments.Match(args, {
|
|
756
|
+
2: (name2, extends_2) => [name2, extends_2, extends_2],
|
|
757
|
+
1: (name2) => [name2, Unknown(), Unknown()]
|
|
758
|
+
});
|
|
759
|
+
return exports_memory.Create({ ["~kind"]: "Infer" }, { type: "infer", name, extends: extends_ }, {});
|
|
760
|
+
}
|
|
761
|
+
function IsInfer(value) {
|
|
762
|
+
return IsKind(value, "Infer");
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// node_modules/typebox/build/type/types/dependent.mjs
|
|
766
|
+
function Dependent(if_, then_, else_, options = {}) {
|
|
767
|
+
return exports_memory.Create({ "~kind": "Dependent" }, { if: if_, then: then_, else: else_ }, options);
|
|
768
|
+
}
|
|
769
|
+
function IsDependent(value) {
|
|
770
|
+
return IsKind(value, "Dependent");
|
|
771
|
+
}
|
|
772
|
+
function DependentOptions(type) {
|
|
773
|
+
return exports_memory.Discard(type, ["~kind", "if", "then", "else"]);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs
|
|
777
|
+
function IsTypeScriptEnumLike(value) {
|
|
778
|
+
return exports_guard.IsObjectNotArray(value);
|
|
779
|
+
}
|
|
780
|
+
function TypeScriptEnumToEnumValues(type) {
|
|
781
|
+
const keys = exports_guard.Keys(type).filter((key) => isNaN(key));
|
|
782
|
+
return keys.reduce((result, key) => [...result, type[key]], []);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// node_modules/typebox/build/type/types/enum.mjs
|
|
786
|
+
function IsEnumValue(value) {
|
|
787
|
+
return exports_guard.IsString(value) || exports_guard.IsNumber(value);
|
|
788
|
+
}
|
|
789
|
+
function Enum(value, options) {
|
|
790
|
+
const values = IsTypeScriptEnumLike(value) ? TypeScriptEnumToEnumValues(value) : value;
|
|
791
|
+
return exports_memory.Create({ "~kind": "Enum" }, { enum: values }, options);
|
|
792
|
+
}
|
|
793
|
+
function IsEnum(value) {
|
|
794
|
+
return IsKind(value, "Enum");
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// node_modules/typebox/build/type/types/intersect.mjs
|
|
798
|
+
function Intersect(types, options = {}) {
|
|
799
|
+
return exports_memory.Create({ "~kind": "Intersect" }, { allOf: types }, options);
|
|
800
|
+
}
|
|
801
|
+
function IsIntersect(value) {
|
|
802
|
+
return IsKind(value, "Intersect");
|
|
803
|
+
}
|
|
804
|
+
function IntersectOptions(type) {
|
|
805
|
+
return exports_memory.Discard(type, ["~kind", "allOf"]);
|
|
806
|
+
}
|
|
807
|
+
// node_modules/typebox/build/system/unreachable/unreachable.mjs
|
|
808
|
+
function Unreachable() {
|
|
809
|
+
throw new Error("Unreachable");
|
|
810
|
+
}
|
|
811
|
+
// node_modules/typebox/build/system/hashing/hash.mjs
|
|
812
|
+
var ByteMarker;
|
|
813
|
+
(function(ByteMarker2) {
|
|
814
|
+
ByteMarker2[ByteMarker2["Array"] = 0] = "Array";
|
|
815
|
+
ByteMarker2[ByteMarker2["BigInt"] = 1] = "BigInt";
|
|
816
|
+
ByteMarker2[ByteMarker2["Boolean"] = 2] = "Boolean";
|
|
817
|
+
ByteMarker2[ByteMarker2["Date"] = 3] = "Date";
|
|
818
|
+
ByteMarker2[ByteMarker2["Constructor"] = 4] = "Constructor";
|
|
819
|
+
ByteMarker2[ByteMarker2["Function"] = 5] = "Function";
|
|
820
|
+
ByteMarker2[ByteMarker2["Null"] = 6] = "Null";
|
|
821
|
+
ByteMarker2[ByteMarker2["Number"] = 7] = "Number";
|
|
822
|
+
ByteMarker2[ByteMarker2["Object"] = 8] = "Object";
|
|
823
|
+
ByteMarker2[ByteMarker2["RegExp"] = 9] = "RegExp";
|
|
824
|
+
ByteMarker2[ByteMarker2["String"] = 10] = "String";
|
|
825
|
+
ByteMarker2[ByteMarker2["Symbol"] = 11] = "Symbol";
|
|
826
|
+
ByteMarker2[ByteMarker2["TypeArray"] = 12] = "TypeArray";
|
|
827
|
+
ByteMarker2[ByteMarker2["Undefined"] = 13] = "Undefined";
|
|
828
|
+
})(ByteMarker || (ByteMarker = {}));
|
|
829
|
+
var Accumulator = BigInt("14695981039346656037");
|
|
830
|
+
var [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
|
|
831
|
+
var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
|
|
832
|
+
var F64 = new Float64Array(1);
|
|
833
|
+
var F64In = new DataView(F64.buffer);
|
|
834
|
+
var F64Out = new Uint8Array(F64.buffer);
|
|
835
|
+
var encoder = new TextEncoder;
|
|
836
|
+
// node_modules/typebox/build/type/types/_codec.mjs
|
|
837
|
+
class EncodeBuilder {
|
|
838
|
+
constructor(type, decode) {
|
|
839
|
+
this.type = type;
|
|
840
|
+
this.decode = decode;
|
|
841
|
+
}
|
|
842
|
+
Encode(callback) {
|
|
843
|
+
const type = this.type;
|
|
844
|
+
const decode = IsCodec(type) ? (value) => this.decode(type["~codec"].decode(value)) : this.decode;
|
|
845
|
+
const encode = IsCodec(type) ? (value) => type["~codec"].encode(callback(value)) : callback;
|
|
846
|
+
const codec = { decode, encode };
|
|
847
|
+
return exports_memory.Update(this.type, { "~codec": codec }, {});
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
class DecodeBuilder {
|
|
852
|
+
constructor(type) {
|
|
853
|
+
this.type = type;
|
|
854
|
+
}
|
|
855
|
+
Decode(callback) {
|
|
856
|
+
return new EncodeBuilder(this.type, callback);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function Codec(type) {
|
|
860
|
+
return new DecodeBuilder(type);
|
|
861
|
+
}
|
|
862
|
+
function Decode(type, callback) {
|
|
863
|
+
return Codec(type).Decode(callback).Encode(() => {
|
|
864
|
+
throw Error("Encode not implemented");
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function Encode(type, callback) {
|
|
868
|
+
return Codec(type).Decode(() => {
|
|
869
|
+
throw Error("Decode not implemented");
|
|
870
|
+
}).Encode(callback);
|
|
871
|
+
}
|
|
872
|
+
function IsCodec(value) {
|
|
873
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "~codec") && exports_guard.IsObject(value["~codec"]) && exports_guard.HasPropertyKey(value["~codec"], "encode") && exports_guard.HasPropertyKey(value["~codec"], "decode");
|
|
874
|
+
}
|
|
875
|
+
// node_modules/typebox/build/type/types/_immutable.mjs
|
|
876
|
+
function Immutable(type) {
|
|
877
|
+
return AddImmutable(type);
|
|
878
|
+
}
|
|
879
|
+
function IsImmutable(value) {
|
|
880
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "~immutable");
|
|
881
|
+
}
|
|
882
|
+
// node_modules/typebox/build/type/action/_add_readonly.mjs
|
|
883
|
+
function AddReadonlyDeferred(type, options = {}) {
|
|
884
|
+
return Deferred("AddReadonly", [type], options);
|
|
885
|
+
}
|
|
886
|
+
function AddReadonly(type, options = {}) {
|
|
887
|
+
return AddReadonlyAction(type, options);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// node_modules/typebox/build/type/types/_readonly.mjs
|
|
891
|
+
function Readonly(type) {
|
|
892
|
+
return AddReadonly(type);
|
|
893
|
+
}
|
|
894
|
+
function IsReadonly(value) {
|
|
895
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "~readonly");
|
|
896
|
+
}
|
|
897
|
+
// node_modules/typebox/build/type/types/_refine.mjs
|
|
898
|
+
function RefineAdd(type, refinement) {
|
|
899
|
+
const refinements = IsRefine(type) ? [...type["~refine"], refinement] : [refinement];
|
|
900
|
+
return exports_memory.Update(type, { "~refine": refinements }, {});
|
|
901
|
+
}
|
|
902
|
+
function Refine(...args) {
|
|
903
|
+
const [type, check, error] = exports_arguments.Match(args, {
|
|
904
|
+
3: (type2, check2, error2) => [type2, check2, error2],
|
|
905
|
+
2: (type2, check2) => [type2, check2, () => "Refine Error"]
|
|
906
|
+
});
|
|
907
|
+
return RefineAdd(type, { check, error });
|
|
908
|
+
}
|
|
909
|
+
function IsRefinement(value) {
|
|
910
|
+
return exports_guard.IsObjectNotArray(value) && exports_guard.HasPropertyKey(value, "check") && exports_guard.HasPropertyKey(value, "error") && exports_guard.IsFunction(value.check) && exports_guard.IsFunction(value.error);
|
|
911
|
+
}
|
|
912
|
+
function IsRefine(value) {
|
|
913
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "~refine") && exports_guard.IsArray(value["~refine"]) && exports_guard.Every(value["~refine"], 0, (value2) => IsRefinement(value2));
|
|
914
|
+
}
|
|
915
|
+
// node_modules/typebox/build/type/types/bigint.mjs
|
|
916
|
+
var BigIntPattern = "-?(?:0|[1-9][0-9]*)n";
|
|
917
|
+
function BigInt2(options) {
|
|
918
|
+
return exports_memory.Create({ "~kind": "BigInt" }, { type: "bigint" }, options);
|
|
919
|
+
}
|
|
920
|
+
function IsBigInt2(value) {
|
|
921
|
+
return IsKind(value, "BigInt");
|
|
922
|
+
}
|
|
923
|
+
// node_modules/typebox/build/type/types/boolean.mjs
|
|
924
|
+
function Boolean2(options) {
|
|
925
|
+
return exports_memory.Create({ "~kind": "Boolean" }, { type: "boolean" }, options);
|
|
926
|
+
}
|
|
927
|
+
function IsBoolean3(value) {
|
|
928
|
+
return IsKind(value, "Boolean");
|
|
929
|
+
}
|
|
930
|
+
// node_modules/typebox/build/type/types/identifier.mjs
|
|
931
|
+
function Identifier(name) {
|
|
932
|
+
return exports_memory.Create({ "~kind": "Identifier" }, { name });
|
|
933
|
+
}
|
|
934
|
+
function IsIdentifier(value) {
|
|
935
|
+
return IsKind(value, "Identifier");
|
|
936
|
+
}
|
|
937
|
+
// node_modules/typebox/build/type/types/integer.mjs
|
|
938
|
+
var IntegerPattern = "-?(?:0|[1-9][0-9]*)";
|
|
939
|
+
function Integer(options) {
|
|
940
|
+
return exports_memory.Create({ "~kind": "Integer" }, { type: "integer" }, options);
|
|
941
|
+
}
|
|
942
|
+
function IsInteger2(value) {
|
|
943
|
+
return IsKind(value, "Integer");
|
|
944
|
+
}
|
|
945
|
+
// node_modules/typebox/build/type/types/literal.mjs
|
|
946
|
+
class InvalidLiteralValue extends Error {
|
|
947
|
+
constructor(value) {
|
|
948
|
+
super(`Invalid Literal value`);
|
|
949
|
+
Object.defineProperty(this, "cause", {
|
|
950
|
+
value: { value },
|
|
951
|
+
writable: false,
|
|
952
|
+
configurable: false,
|
|
953
|
+
enumerable: false
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
function LiteralTypeName(value) {
|
|
958
|
+
return exports_guard.IsBigInt(value) ? "bigint" : exports_guard.IsBoolean(value) ? "boolean" : exports_guard.IsNumber(value) ? "number" : exports_guard.IsString(value) ? "string" : (() => {
|
|
959
|
+
throw new InvalidLiteralValue(value);
|
|
960
|
+
})();
|
|
961
|
+
}
|
|
962
|
+
function Literal(value, options) {
|
|
963
|
+
return exports_memory.Create({ "~kind": "Literal" }, { type: LiteralTypeName(value), const: value }, options);
|
|
964
|
+
}
|
|
965
|
+
function IsLiteralValue(value) {
|
|
966
|
+
return exports_guard.IsBigInt(value) || exports_guard.IsBoolean(value) || exports_guard.IsNumber(value) || exports_guard.IsString(value);
|
|
967
|
+
}
|
|
968
|
+
function IsLiteralNumber(value) {
|
|
969
|
+
return IsLiteral(value) && exports_guard.IsNumber(value.const);
|
|
970
|
+
}
|
|
971
|
+
function IsLiteralString(value) {
|
|
972
|
+
return IsLiteral(value) && exports_guard.IsString(value.const);
|
|
973
|
+
}
|
|
974
|
+
function IsLiteral(value) {
|
|
975
|
+
return IsKind(value, "Literal");
|
|
976
|
+
}
|
|
977
|
+
// node_modules/typebox/build/type/types/null.mjs
|
|
978
|
+
function Null(options) {
|
|
979
|
+
return exports_memory.Create({ "~kind": "Null" }, { type: "null" }, options);
|
|
980
|
+
}
|
|
981
|
+
function IsNull2(value) {
|
|
982
|
+
return IsKind(value, "Null");
|
|
983
|
+
}
|
|
984
|
+
// node_modules/typebox/build/type/types/number.mjs
|
|
985
|
+
var NumberPattern = "-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";
|
|
986
|
+
function Number2(options) {
|
|
987
|
+
return exports_memory.Create({ "~kind": "Number" }, { type: "number" }, options);
|
|
988
|
+
}
|
|
989
|
+
function IsNumber3(value) {
|
|
990
|
+
return IsKind(value, "Number");
|
|
991
|
+
}
|
|
992
|
+
// node_modules/typebox/build/type/types/symbol.mjs
|
|
993
|
+
function Symbol2(options) {
|
|
994
|
+
return exports_memory.Create({ "~kind": "Symbol" }, { type: "symbol" }, options);
|
|
995
|
+
}
|
|
996
|
+
function IsSymbol2(value) {
|
|
997
|
+
return IsKind(value, "Symbol");
|
|
998
|
+
}
|
|
999
|
+
// node_modules/typebox/build/type/types/parameter.mjs
|
|
1000
|
+
function Parameter(...args) {
|
|
1001
|
+
const [name, extends_, equals] = exports_arguments.Match(args, {
|
|
1002
|
+
3: (name2, extends_2, equals2) => [name2, extends_2, equals2],
|
|
1003
|
+
2: (name2, extends_2) => [name2, extends_2, extends_2],
|
|
1004
|
+
1: (name2) => [name2, Unknown(), Unknown()]
|
|
1005
|
+
});
|
|
1006
|
+
return exports_memory.Create({ "~kind": "Parameter" }, { name, extends: extends_, equals }, {});
|
|
1007
|
+
}
|
|
1008
|
+
function IsParameter(value) {
|
|
1009
|
+
return IsKind(value, "Parameter");
|
|
1010
|
+
}
|
|
1011
|
+
// node_modules/typebox/build/type/types/string.mjs
|
|
1012
|
+
var StringPattern = ".*";
|
|
1013
|
+
function String2(options) {
|
|
1014
|
+
return exports_memory.Create({ "~kind": "String" }, { type: "string" }, options);
|
|
1015
|
+
}
|
|
1016
|
+
function IsString3(value) {
|
|
1017
|
+
return IsKind(value, "String");
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// node_modules/typebox/build/type/types/union.mjs
|
|
1021
|
+
function Union(anyOf, options = {}) {
|
|
1022
|
+
return exports_memory.Create({ "~kind": "Union" }, { anyOf }, options);
|
|
1023
|
+
}
|
|
1024
|
+
function IsUnion(value) {
|
|
1025
|
+
return IsKind(value, "Union");
|
|
1026
|
+
}
|
|
1027
|
+
function UnionOptions(type) {
|
|
1028
|
+
return exports_memory.Discard(type, ["~kind", "anyOf"]);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// node_modules/typebox/build/type/engine/patterns/pattern.mjs
|
|
1032
|
+
function ParsePatternIntoTypes(pattern) {
|
|
1033
|
+
const parsed = Pattern(pattern);
|
|
1034
|
+
const result = exports_guard.IsEqual(parsed.length, 2) ? parsed[0] : [];
|
|
1035
|
+
return result;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// node_modules/typebox/build/type/engine/template_literal/is_finite.mjs
|
|
1039
|
+
function FromLiteral(_value) {
|
|
1040
|
+
return true;
|
|
1041
|
+
}
|
|
1042
|
+
function FromTypesReduce(types) {
|
|
1043
|
+
return exports_guard.ShiftLeft(types, (left, right) => FromType(left) ? FromTypesReduce(right) : false, () => true);
|
|
1044
|
+
}
|
|
1045
|
+
function FromTypes(types) {
|
|
1046
|
+
const result = exports_guard.IsEqual(types.length, 0) ? false : FromTypesReduce(types);
|
|
1047
|
+
return result;
|
|
1048
|
+
}
|
|
1049
|
+
function FromType(type) {
|
|
1050
|
+
return IsUnion(type) ? FromTypes(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : false;
|
|
1051
|
+
}
|
|
1052
|
+
function IsTemplateLiteralFinite(types) {
|
|
1053
|
+
const result = FromTypes(types);
|
|
1054
|
+
return result;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
// node_modules/typebox/build/type/engine/template_literal/create.mjs
|
|
1058
|
+
function TemplateLiteralCreate(pattern) {
|
|
1059
|
+
return exports_memory.Create({ ["~kind"]: "TemplateLiteral" }, { type: "string", pattern }, {});
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// node_modules/typebox/build/type/engine/template_literal/decode.mjs
|
|
1063
|
+
function FromLiteralPush(variants, value, result = []) {
|
|
1064
|
+
return exports_guard.ShiftLeft(variants, (left, right) => FromLiteralPush(right, value, [...result, `${left}${value}`]), () => result);
|
|
1065
|
+
}
|
|
1066
|
+
function FromLiteral2(variants, value) {
|
|
1067
|
+
return exports_guard.IsEqual(variants.length, 0) ? [`${value}`] : FromLiteralPush(variants, value);
|
|
1068
|
+
}
|
|
1069
|
+
function FromUnion(variants, types, result = []) {
|
|
1070
|
+
return exports_guard.ShiftLeft(types, (left, right) => FromUnion(variants, right, [...result, ...FromType2(variants, left)]), () => result);
|
|
1071
|
+
}
|
|
1072
|
+
function FromType2(variants, type) {
|
|
1073
|
+
const result = IsUnion(type) ? FromUnion(variants, type.anyOf) : IsLiteral(type) ? FromLiteral2(variants, type.const) : Unreachable();
|
|
1074
|
+
return result;
|
|
1075
|
+
}
|
|
1076
|
+
function DecodeFromSpan(variants, types) {
|
|
1077
|
+
return exports_guard.ShiftLeft(types, (left, right) => DecodeFromSpan(FromType2(variants, left), right), () => variants);
|
|
1078
|
+
}
|
|
1079
|
+
function VariantsToLiterals(variants) {
|
|
1080
|
+
return variants.map((variant) => Literal(variant));
|
|
1081
|
+
}
|
|
1082
|
+
function DecodeTypesAsUnion(types) {
|
|
1083
|
+
const variants = DecodeFromSpan([], types);
|
|
1084
|
+
const literals = VariantsToLiterals(variants);
|
|
1085
|
+
const result = Union(literals);
|
|
1086
|
+
return result;
|
|
1087
|
+
}
|
|
1088
|
+
function DecodeTypes(types) {
|
|
1089
|
+
return exports_guard.IsEqual(types.length, 0) ? Unreachable() : exports_guard.IsEqual(types.length, 1) && IsLiteral(types[0]) ? types[0] : DecodeTypesAsUnion(types);
|
|
1090
|
+
}
|
|
1091
|
+
function TemplateLiteralDecodeUnsafe(pattern) {
|
|
1092
|
+
const types = ParsePatternIntoTypes(pattern);
|
|
1093
|
+
const result = exports_guard.IsEqual(types.length, 0) ? String2() : IsTemplateLiteralFinite(types) ? DecodeTypes(types) : TemplateLiteralCreate(pattern);
|
|
1094
|
+
return result;
|
|
1095
|
+
}
|
|
1096
|
+
function TemplateLiteralDecode(pattern) {
|
|
1097
|
+
const decoded = TemplateLiteralDecodeUnsafe(pattern);
|
|
1098
|
+
const result = IsTemplateLiteral(decoded) ? String2() : decoded;
|
|
1099
|
+
return result;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// node_modules/typebox/build/type/engine/record/record_create.mjs
|
|
1103
|
+
function CreateRecord(key, value) {
|
|
1104
|
+
const type = "object";
|
|
1105
|
+
const patternProperties = { [key]: value };
|
|
1106
|
+
return exports_memory.Create({ ["~kind"]: "Record" }, { type, patternProperties });
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
// node_modules/typebox/build/type/engine/record/from_key_any.mjs
|
|
1110
|
+
function FromAnyKey(value) {
|
|
1111
|
+
return CreateRecord(StringKey, value);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
// node_modules/typebox/build/type/engine/record/from_key_boolean.mjs
|
|
1115
|
+
function FromBooleanKey(value) {
|
|
1116
|
+
return _Object_({ true: value, false: value });
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// node_modules/typebox/build/type/types/tuple.mjs
|
|
1120
|
+
function Tuple(types, options = {}) {
|
|
1121
|
+
const [items, minItems, additionalItems] = [types, types.length, false];
|
|
1122
|
+
return exports_memory.Create({ ["~kind"]: "Tuple" }, { type: "array", additionalItems, items, minItems }, options);
|
|
1123
|
+
}
|
|
1124
|
+
function IsTuple(value) {
|
|
1125
|
+
return IsKind(value, "Tuple");
|
|
1126
|
+
}
|
|
1127
|
+
function TupleOptions(type) {
|
|
1128
|
+
return exports_memory.Discard(type, ["~kind", "type", "items", "minItems", "additionalItems"]);
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
|
|
1132
|
+
function RemoveReadonlyOperation(type) {
|
|
1133
|
+
return exports_memory.Discard(type, ["~readonly"]);
|
|
1134
|
+
}
|
|
1135
|
+
function RemoveReadonlyAction(type, options) {
|
|
1136
|
+
const result = exports_memory.Update(RemoveReadonlyOperation(type), {}, options);
|
|
1137
|
+
return result;
|
|
1138
|
+
}
|
|
1139
|
+
function RemoveReadonlyInstantiate(context, state, type, options) {
|
|
1140
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
1141
|
+
return RemoveReadonlyAction(instantiatedType, options);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// node_modules/typebox/build/type/action/_remove_readonly.mjs
|
|
1145
|
+
function RemoveReadonlyDeferred(type, options = {}) {
|
|
1146
|
+
return Deferred("RemoveReadonly", [type], options);
|
|
1147
|
+
}
|
|
1148
|
+
function RemoveReadonly(type, options = {}) {
|
|
1149
|
+
return RemoveReadonlyAction(type, options);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
// node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs
|
|
1153
|
+
function RemoveOptionalOperation(type) {
|
|
1154
|
+
return exports_memory.Discard(type, ["~optional"]);
|
|
1155
|
+
}
|
|
1156
|
+
function RemoveOptionalAction(type, options) {
|
|
1157
|
+
const result = exports_memory.Update(RemoveOptionalOperation(type), {}, options);
|
|
1158
|
+
return result;
|
|
1159
|
+
}
|
|
1160
|
+
function RemoveOptionalInstantiate(context, state, type, options) {
|
|
1161
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
1162
|
+
return RemoveOptionalAction(instantiatedType, options);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
// node_modules/typebox/build/type/action/_remove_optional.mjs
|
|
1166
|
+
function RemoveOptionalDeferred(type, options = {}) {
|
|
1167
|
+
return Deferred("RemoveOptional", [type], options);
|
|
1168
|
+
}
|
|
1169
|
+
function RemoveOptional(type, options = {}) {
|
|
1170
|
+
return RemoveOptionalAction(type, options);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// node_modules/typebox/build/type/engine/tuple/to_object.mjs
|
|
1174
|
+
function TupleElementsToProperties(types) {
|
|
1175
|
+
const result = types.reduceRight((result2, right, index) => {
|
|
1176
|
+
return { [index]: right, ...result2 };
|
|
1177
|
+
}, {});
|
|
1178
|
+
return result;
|
|
1179
|
+
}
|
|
1180
|
+
function TupleToObject(type) {
|
|
1181
|
+
const properties = TupleElementsToProperties(type.items);
|
|
1182
|
+
const result = _Object_(properties);
|
|
1183
|
+
return result;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// node_modules/typebox/build/type/engine/evaluate/composite.mjs
|
|
1187
|
+
function IsReadonlyProperty(left, right) {
|
|
1188
|
+
return IsReadonly(left) ? IsReadonly(right) ? true : false : false;
|
|
1189
|
+
}
|
|
1190
|
+
function IsOptionalProperty(left, right) {
|
|
1191
|
+
return IsOptional(left) ? IsOptional(right) ? true : false : false;
|
|
1192
|
+
}
|
|
1193
|
+
function CompositeProperty(left, right) {
|
|
1194
|
+
const isReadonly = IsReadonlyProperty(left, right);
|
|
1195
|
+
const isOptional = IsOptionalProperty(left, right);
|
|
1196
|
+
const evaluated = EvaluateIntersect([left, right]);
|
|
1197
|
+
const property = RemoveReadonly(RemoveOptional(evaluated));
|
|
1198
|
+
return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
|
|
1199
|
+
}
|
|
1200
|
+
function CompositePropertyKey(left, right, key) {
|
|
1201
|
+
return key in left ? key in right ? CompositeProperty(left[key], right[key]) : left[key] : (key in right) ? right[key] : Never();
|
|
1202
|
+
}
|
|
1203
|
+
function CompositeProperties(left, right) {
|
|
1204
|
+
const keys = new Set([...exports_guard.Keys(right), ...exports_guard.Keys(left)]);
|
|
1205
|
+
return [...keys].reduce((result, key) => {
|
|
1206
|
+
return { ...result, [key]: CompositePropertyKey(left, right, key) };
|
|
1207
|
+
}, {});
|
|
1208
|
+
}
|
|
1209
|
+
function GetProperties(type) {
|
|
1210
|
+
const result = IsObject2(type) ? type.properties : IsTuple(type) ? TupleElementsToProperties(type.items) : Unreachable();
|
|
1211
|
+
return result;
|
|
1212
|
+
}
|
|
1213
|
+
function Composite(left, right) {
|
|
1214
|
+
const leftProperties = GetProperties(left);
|
|
1215
|
+
const rightProperties = GetProperties(right);
|
|
1216
|
+
const properties = CompositeProperties(leftProperties, rightProperties);
|
|
1217
|
+
return _Object_(properties);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
// node_modules/typebox/build/type/engine/evaluate/narrow.mjs
|
|
1221
|
+
function Narrow(left, right) {
|
|
1222
|
+
const result = Compare(left, right);
|
|
1223
|
+
return exports_guard.IsEqual(result, ResultLeftInside) ? left : exports_guard.IsEqual(result, ResultRightInside) ? right : exports_guard.IsEqual(result, ResultEqual) ? right : Never();
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
// node_modules/typebox/build/type/engine/evaluate/distribute.mjs
|
|
1227
|
+
function IsObjectLike(type) {
|
|
1228
|
+
return IsObject2(type) || IsTuple(type);
|
|
1229
|
+
}
|
|
1230
|
+
function IsUnionOperand(left, right) {
|
|
1231
|
+
const isUnionLeft = IsUnion(left);
|
|
1232
|
+
const isUnionRight = IsUnion(right);
|
|
1233
|
+
const result = isUnionLeft || isUnionRight;
|
|
1234
|
+
return result;
|
|
1235
|
+
}
|
|
1236
|
+
function DistributeOperation(left, right) {
|
|
1237
|
+
const evaluatedLeft = EvaluateType(left);
|
|
1238
|
+
const evaluatedRight = EvaluateType(right);
|
|
1239
|
+
const isUnionOperand = IsUnionOperand(evaluatedLeft, evaluatedRight);
|
|
1240
|
+
const isObjectLeft = IsObjectLike(evaluatedLeft);
|
|
1241
|
+
const IsObjectRight = IsObjectLike(evaluatedRight);
|
|
1242
|
+
const result = isUnionOperand ? EvaluateIntersect([evaluatedLeft, evaluatedRight]) : isObjectLeft && IsObjectRight ? Composite(evaluatedLeft, evaluatedRight) : isObjectLeft && !IsObjectRight ? evaluatedLeft : !isObjectLeft && IsObjectRight ? evaluatedRight : Narrow(evaluatedLeft, evaluatedRight);
|
|
1243
|
+
return result;
|
|
1244
|
+
}
|
|
1245
|
+
function DistributeType(type, types, result = []) {
|
|
1246
|
+
return exports_guard.ShiftLeft(types, (left, right) => DistributeType(type, right, [...result, DistributeOperation(type, left)]), () => exports_guard.IsEqual(result.length, 0) ? [type] : result);
|
|
1247
|
+
}
|
|
1248
|
+
function DistributeUnion(types, distribution, result = []) {
|
|
1249
|
+
return exports_guard.ShiftLeft(types, (left, right) => DistributeUnion(right, distribution, [...result, ...Distribute([left], distribution)]), () => result);
|
|
1250
|
+
}
|
|
1251
|
+
function Distribute(types, result = []) {
|
|
1252
|
+
return exports_guard.ShiftLeft(types, (left, right) => IsUnion(left) ? Distribute(right, DistributeUnion(left.anyOf, result)) : Distribute(right, DistributeType(left, result)), () => result);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// node_modules/typebox/build/type/engine/exclude/operation.mjs
|
|
1256
|
+
function ExcludeType(left, right) {
|
|
1257
|
+
const check = Extends({}, left, right);
|
|
1258
|
+
const result = exports_result.IsExtendsTrueLike(check) ? [] : [left];
|
|
1259
|
+
return result;
|
|
1260
|
+
}
|
|
1261
|
+
function ExcludeUnion(types, right) {
|
|
1262
|
+
return types.reduce((result, head) => {
|
|
1263
|
+
return [...result, ...ExcludeType(head, right)];
|
|
1264
|
+
}, []);
|
|
1265
|
+
}
|
|
1266
|
+
function ExcludeOperation(left, right) {
|
|
1267
|
+
const evaluated = EvaluateType(left);
|
|
1268
|
+
const canonical = IsUnion(evaluated) ? evaluated.anyOf : [evaluated];
|
|
1269
|
+
const remaining = ExcludeUnion(canonical, right);
|
|
1270
|
+
const result = EvaluateUnion(remaining);
|
|
1271
|
+
return result;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
// node_modules/typebox/build/type/engine/evaluate/evaluate.mjs
|
|
1275
|
+
function EvaluateDependent(if_, then_, else_) {
|
|
1276
|
+
const intersect = Intersect([if_, then_]);
|
|
1277
|
+
const excluded = ExcludeOperation(else_, if_);
|
|
1278
|
+
const result = EvaluateUnion([intersect, excluded]);
|
|
1279
|
+
return result;
|
|
1280
|
+
}
|
|
1281
|
+
function EvaluateEnum(values) {
|
|
1282
|
+
const result = values.map((value) => Literal(value));
|
|
1283
|
+
return EvaluateUnion(result);
|
|
1284
|
+
}
|
|
1285
|
+
function EvaluateIntersect(types) {
|
|
1286
|
+
const distribution = Distribute(types);
|
|
1287
|
+
const broadend = Broaden(distribution);
|
|
1288
|
+
const result = EvaluateUnionFast(broadend);
|
|
1289
|
+
return result;
|
|
1290
|
+
}
|
|
1291
|
+
function EvaluateTemplateLiteral(pattern) {
|
|
1292
|
+
const evaluated = TemplateLiteralDecode(pattern);
|
|
1293
|
+
const result = EvaluateType(evaluated);
|
|
1294
|
+
return result;
|
|
1295
|
+
}
|
|
1296
|
+
function EvaluateUnion(types) {
|
|
1297
|
+
const broadend = Broaden(types);
|
|
1298
|
+
const result = EvaluateUnionFast(broadend);
|
|
1299
|
+
return result;
|
|
1300
|
+
}
|
|
1301
|
+
function EvaluateType(type) {
|
|
1302
|
+
return IsDependent(type) ? EvaluateDependent(type.if, type.then, type.else) : IsEnum(type) ? EvaluateEnum(type.enum) : IsIntersect(type) ? EvaluateIntersect(type.allOf) : IsTemplateLiteral(type) ? EvaluateTemplateLiteral(type.pattern) : IsUnion(type) ? EvaluateUnion(type.anyOf) : type;
|
|
1303
|
+
}
|
|
1304
|
+
function EvaluateUnionFast(types) {
|
|
1305
|
+
const result = exports_guard.IsEqual(types.length, 1) ? types[0] : exports_guard.IsEqual(types.length, 0) ? Never() : Union(types);
|
|
1306
|
+
return result;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
// node_modules/typebox/build/type/engine/record/from_key_enum.mjs
|
|
1310
|
+
function FromEnumKey(values, value) {
|
|
1311
|
+
const unionKey = EvaluateEnum(values);
|
|
1312
|
+
const result = FromKey(unionKey, value);
|
|
1313
|
+
return result;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// node_modules/typebox/build/type/engine/record/from_key_integer.mjs
|
|
1317
|
+
function FromIntegerKey(_key, value) {
|
|
1318
|
+
const result = CreateRecord(IntegerKey, value);
|
|
1319
|
+
return result;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// node_modules/typebox/build/type/engine/record/from_key_intersect.mjs
|
|
1323
|
+
function FromIntersectKey(types, value) {
|
|
1324
|
+
const evaluatedKey = EvaluateIntersect(types);
|
|
1325
|
+
const result = FromKey(evaluatedKey, value);
|
|
1326
|
+
return result;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// node_modules/typebox/build/type/engine/record/from_key_literal.mjs
|
|
1330
|
+
function FromLiteralKey(key, value) {
|
|
1331
|
+
return exports_guard.IsString(key) || exports_guard.IsNumber(key) ? _Object_({ [key]: value }) : exports_guard.IsEqual(key, false) ? _Object_({ false: value }) : exports_guard.IsEqual(key, true) ? _Object_({ true: value }) : _Object_({});
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// node_modules/typebox/build/type/engine/record/from_key_number.mjs
|
|
1335
|
+
function FromNumberKey(_key, value) {
|
|
1336
|
+
const result = CreateRecord(NumberKey, value);
|
|
1337
|
+
return result;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
// node_modules/typebox/build/type/engine/record/from_key_string.mjs
|
|
1341
|
+
function FromStringKey(key, value) {
|
|
1342
|
+
return exports_guard.HasPropertyKey(key, "pattern") && (exports_guard.IsString(key.pattern) || key.pattern instanceof RegExp) ? CreateRecord(key.pattern.toString(), value) : CreateRecord(StringKey, value);
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs
|
|
1346
|
+
function FromTemplateKey(pattern, value) {
|
|
1347
|
+
const types = ParsePatternIntoTypes(pattern);
|
|
1348
|
+
const finite = IsTemplateLiteralFinite(types);
|
|
1349
|
+
const result = finite ? FromKey(EvaluateTemplateLiteral(pattern), value) : CreateRecord(pattern, value);
|
|
1350
|
+
return result;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// node_modules/typebox/build/type/engine/evaluate/flatten.mjs
|
|
1354
|
+
function FlattenType(type) {
|
|
1355
|
+
const result = IsUnion(type) ? Flatten(type.anyOf) : [type];
|
|
1356
|
+
return result;
|
|
1357
|
+
}
|
|
1358
|
+
function Flatten(types) {
|
|
1359
|
+
return types.reduce((result, type) => {
|
|
1360
|
+
return [...result, ...FlattenType(type)];
|
|
1361
|
+
}, []);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// node_modules/typebox/build/type/engine/record/from_key_union.mjs
|
|
1365
|
+
function StringOrNumberCheck(types) {
|
|
1366
|
+
return types.some((type) => IsString3(type) || IsNumber3(type) || IsInteger2(type));
|
|
1367
|
+
}
|
|
1368
|
+
function TryBuildRecord(types, value) {
|
|
1369
|
+
return exports_guard.IsEqual(StringOrNumberCheck(types), true) ? CreateRecord(StringKey, value) : undefined;
|
|
1370
|
+
}
|
|
1371
|
+
function CreateProperties(types, value) {
|
|
1372
|
+
return types.reduce((result, left) => {
|
|
1373
|
+
return IsLiteral(left) && (exports_guard.IsString(left.const) || exports_guard.IsNumber(left.const)) ? { ...result, [left.const]: value } : result;
|
|
1374
|
+
}, {});
|
|
1375
|
+
}
|
|
1376
|
+
function CreateObject(types, value) {
|
|
1377
|
+
const properties = CreateProperties(types, value);
|
|
1378
|
+
const result = _Object_(properties);
|
|
1379
|
+
return result;
|
|
1380
|
+
}
|
|
1381
|
+
function FromUnionKey(types, value) {
|
|
1382
|
+
const flattened = Flatten(types);
|
|
1383
|
+
const record = TryBuildRecord(flattened, value);
|
|
1384
|
+
return IsSchema(record) ? record : CreateObject(flattened, value);
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// node_modules/typebox/build/type/engine/record/from_key.mjs
|
|
1388
|
+
function FromKey(key, value) {
|
|
1389
|
+
const result = IsAny(key) ? FromAnyKey(value) : IsBoolean3(key) ? FromBooleanKey(value) : IsEnum(key) ? FromEnumKey(key.enum, value) : IsInteger2(key) ? FromIntegerKey(key, value) : IsIntersect(key) ? FromIntersectKey(key.allOf, value) : IsLiteral(key) ? FromLiteralKey(key.const, value) : IsNumber3(key) ? FromNumberKey(key, value) : IsUnion(key) ? FromUnionKey(key.anyOf, value) : IsString3(key) ? FromStringKey(key, value) : IsTemplateLiteral(key) ? FromTemplateKey(key.pattern, value) : _Object_({});
|
|
1390
|
+
return result;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// node_modules/typebox/build/type/engine/record/instantiate.mjs
|
|
1394
|
+
function RecordAction(key, value, options) {
|
|
1395
|
+
const result = CanInstantiate([key]) ? exports_memory.Update(FromKey(key, value), {}, options) : RecordDeferred(key, value, options);
|
|
1396
|
+
return result;
|
|
1397
|
+
}
|
|
1398
|
+
function RecordInstantiate(context, state, key, value, options) {
|
|
1399
|
+
const instantiatedKey = InstantiateType(context, state, key);
|
|
1400
|
+
const instantiatedValue = InstantiateType(context, state, value);
|
|
1401
|
+
return RecordAction(instantiatedKey, instantiatedValue, options);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
// node_modules/typebox/build/type/types/record.mjs
|
|
1405
|
+
var IntegerKey = `^${IntegerPattern}$`;
|
|
1406
|
+
var NumberKey = `^${NumberPattern}$`;
|
|
1407
|
+
var StringKey = `^${StringPattern}$`;
|
|
1408
|
+
function RecordDeferred(key, value, options = {}) {
|
|
1409
|
+
return Deferred("Record", [key, value], options);
|
|
1410
|
+
}
|
|
1411
|
+
function Record(key, value, options = {}) {
|
|
1412
|
+
return RecordAction(key, value, options);
|
|
1413
|
+
}
|
|
1414
|
+
function RecordFromPattern(pattern, value) {
|
|
1415
|
+
return CreateRecord(pattern, value);
|
|
1416
|
+
}
|
|
1417
|
+
function RecordPatternToType(pattern) {
|
|
1418
|
+
const result = exports_guard.IsEqual(pattern, StringKey) ? String2() : exports_guard.IsEqual(pattern, IntegerKey) ? Integer() : exports_guard.IsEqual(pattern, NumberKey) ? Number2() : TemplateLiteralDecodeUnsafe(pattern);
|
|
1419
|
+
return result;
|
|
1420
|
+
}
|
|
1421
|
+
function RecordPattern(type) {
|
|
1422
|
+
return exports_guard.Keys(type.patternProperties)[0];
|
|
1423
|
+
}
|
|
1424
|
+
function RecordKey(type) {
|
|
1425
|
+
const pattern = RecordPattern(type);
|
|
1426
|
+
const result = RecordPatternToType(pattern);
|
|
1427
|
+
return result;
|
|
1428
|
+
}
|
|
1429
|
+
function RecordValue(type) {
|
|
1430
|
+
return type.patternProperties[RecordPattern(type)];
|
|
1431
|
+
}
|
|
1432
|
+
function IsRecord(value) {
|
|
1433
|
+
return IsKind(value, "Record");
|
|
1434
|
+
}
|
|
1435
|
+
// node_modules/typebox/build/type/types/rest.mjs
|
|
1436
|
+
function Rest(type) {
|
|
1437
|
+
return exports_memory.Create({ "~kind": "Rest" }, { type: "rest", items: type }, {});
|
|
1438
|
+
}
|
|
1439
|
+
function IsRest(value) {
|
|
1440
|
+
return IsKind(value, "Rest");
|
|
1441
|
+
}
|
|
1442
|
+
// node_modules/typebox/build/type/types/this.mjs
|
|
1443
|
+
function This(options) {
|
|
1444
|
+
return exports_memory.Create({ ["~kind"]: "This" }, { $ref: "#" }, options);
|
|
1445
|
+
}
|
|
1446
|
+
function IsThis(value) {
|
|
1447
|
+
return IsKind(value, "This");
|
|
1448
|
+
}
|
|
1449
|
+
// node_modules/typebox/build/type/types/undefined.mjs
|
|
1450
|
+
function Undefined(options) {
|
|
1451
|
+
return exports_memory.Create({ "~kind": "Undefined" }, { type: "undefined" }, options);
|
|
1452
|
+
}
|
|
1453
|
+
function IsUndefined2(value) {
|
|
1454
|
+
return IsKind(value, "Undefined");
|
|
1455
|
+
}
|
|
1456
|
+
// node_modules/typebox/build/type/types/void.mjs
|
|
1457
|
+
function Void(options) {
|
|
1458
|
+
return exports_memory.Create({ "~kind": "Void" }, { type: "void" }, options);
|
|
1459
|
+
}
|
|
1460
|
+
function IsVoid(value) {
|
|
1461
|
+
return IsKind(value, "Void");
|
|
1462
|
+
}
|
|
1463
|
+
// node_modules/typebox/build/type/script/mapping.mjs
|
|
1464
|
+
function IntrinsicOrCall(ref2, parameters) {
|
|
1465
|
+
return exports_guard.IsEqual(ref2, "Array") ? _Array_(parameters[0]) : exports_guard.IsEqual(ref2, "Capitalize") ? CapitalizeDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "ConstructorParameters") ? ConstructorParametersDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Evaluate") ? EvaluateDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Exclude") ? ExcludeDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "Extract") ? ExtractDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "Index") ? IndexDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "InstanceType") ? InstanceTypeDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Lowercase") ? LowercaseDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "NonNullable") ? NonNullableDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Omit") ? OmitDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "Parameters") ? ParametersDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Partial") ? PartialDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Pick") ? PickDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "Readonly") ? ReadonlyObjectDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "KeyOf") ? KeyOfDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Record") ? RecordDeferred(parameters[0], parameters[1]) : exports_guard.IsEqual(ref2, "Required") ? RequiredDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "ReturnType") ? ReturnTypeDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Uncapitalize") ? UncapitalizeDeferred(parameters[0]) : exports_guard.IsEqual(ref2, "Uppercase") ? UppercaseDeferred(parameters[0]) : CallConstruct(Ref(ref2), parameters);
|
|
1466
|
+
}
|
|
1467
|
+
function Unreachable2() {
|
|
1468
|
+
throw Error("Unreachable");
|
|
1469
|
+
}
|
|
1470
|
+
var DelimitedDecode = (input, result = []) => {
|
|
1471
|
+
return input.reduce((result2, left) => {
|
|
1472
|
+
return exports_guard.IsArray(left) && exports_guard.IsEqual(left.length, 2) ? [...result2, left[0]] : [...result2, left];
|
|
1473
|
+
}, []);
|
|
1474
|
+
};
|
|
1475
|
+
var Delimited = (input) => {
|
|
1476
|
+
const [left, right] = input;
|
|
1477
|
+
return DelimitedDecode([...left, ...right]);
|
|
1478
|
+
};
|
|
1479
|
+
function GenericParameterExtendsEqualsMapping(input) {
|
|
1480
|
+
return Parameter(input[0], input[2], input[4]);
|
|
1481
|
+
}
|
|
1482
|
+
function GenericParameterExtendsMapping(input) {
|
|
1483
|
+
return Parameter(input[0], input[2], input[2]);
|
|
1484
|
+
}
|
|
1485
|
+
function GenericParameterEqualsMapping(input) {
|
|
1486
|
+
return Parameter(input[0], Unknown(), input[2]);
|
|
1487
|
+
}
|
|
1488
|
+
function GenericParameterIdentifierMapping(input) {
|
|
1489
|
+
return Parameter(input, Unknown(), Unknown());
|
|
1490
|
+
}
|
|
1491
|
+
function GenericParameterMapping(input) {
|
|
1492
|
+
return input;
|
|
1493
|
+
}
|
|
1494
|
+
function GenericParameterListMapping(input) {
|
|
1495
|
+
return Delimited(input);
|
|
1496
|
+
}
|
|
1497
|
+
function GenericParametersMapping(input) {
|
|
1498
|
+
return input[1];
|
|
1499
|
+
}
|
|
1500
|
+
function GenericCallArgumentListMapping(input) {
|
|
1501
|
+
return Delimited(input);
|
|
1502
|
+
}
|
|
1503
|
+
function GenericCallArgumentsMapping(input) {
|
|
1504
|
+
return input[1];
|
|
1505
|
+
}
|
|
1506
|
+
function GenericCallMapping(input) {
|
|
1507
|
+
return IntrinsicOrCall(input[0], input[1]);
|
|
1508
|
+
}
|
|
1509
|
+
function OptionalSemiColonMapping(input) {
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1512
|
+
function KeywordStringMapping(input) {
|
|
1513
|
+
return String2();
|
|
1514
|
+
}
|
|
1515
|
+
function KeywordNumberMapping(input) {
|
|
1516
|
+
return Number2();
|
|
1517
|
+
}
|
|
1518
|
+
function KeywordBooleanMapping(input) {
|
|
1519
|
+
return Boolean2();
|
|
1520
|
+
}
|
|
1521
|
+
function KeywordUndefinedMapping(input) {
|
|
1522
|
+
return Undefined();
|
|
1523
|
+
}
|
|
1524
|
+
function KeywordNullMapping(input) {
|
|
1525
|
+
return Null();
|
|
1526
|
+
}
|
|
1527
|
+
function KeywordIntegerMapping(input) {
|
|
1528
|
+
return Integer();
|
|
1529
|
+
}
|
|
1530
|
+
function KeywordBigIntMapping(input) {
|
|
1531
|
+
return BigInt2();
|
|
1532
|
+
}
|
|
1533
|
+
function KeywordUnknownMapping(input) {
|
|
1534
|
+
return Unknown();
|
|
1535
|
+
}
|
|
1536
|
+
function KeywordAnyMapping(input) {
|
|
1537
|
+
return Any();
|
|
1538
|
+
}
|
|
1539
|
+
function KeywordObjectMapping(input) {
|
|
1540
|
+
return _Object_({});
|
|
1541
|
+
}
|
|
1542
|
+
function KeywordNeverMapping(input) {
|
|
1543
|
+
return Never();
|
|
1544
|
+
}
|
|
1545
|
+
function KeywordSymbolMapping(input) {
|
|
1546
|
+
return Symbol2();
|
|
1547
|
+
}
|
|
1548
|
+
function KeywordVoidMapping(input) {
|
|
1549
|
+
return Void();
|
|
1550
|
+
}
|
|
1551
|
+
function KeywordThisMapping(input) {
|
|
1552
|
+
return This();
|
|
1553
|
+
}
|
|
1554
|
+
function LiteralBigIntMapping(input) {
|
|
1555
|
+
return Literal(BigInt(input));
|
|
1556
|
+
}
|
|
1557
|
+
function LiteralBooleanMapping(input) {
|
|
1558
|
+
return Literal(exports_guard.IsEqual(input, "true"));
|
|
1559
|
+
}
|
|
1560
|
+
function LiteralNumberMapping(input) {
|
|
1561
|
+
return Literal(parseFloat(input));
|
|
1562
|
+
}
|
|
1563
|
+
function LiteralStringMapping(input) {
|
|
1564
|
+
return Literal(input);
|
|
1565
|
+
}
|
|
1566
|
+
function TemplateInterpolateMapping(input) {
|
|
1567
|
+
return input[1];
|
|
1568
|
+
}
|
|
1569
|
+
function TemplateSpanMapping(input) {
|
|
1570
|
+
return Literal(input);
|
|
1571
|
+
}
|
|
1572
|
+
function TemplateBodyMapping(input) {
|
|
1573
|
+
return exports_guard.IsEqual(input.length, 3) ? [input[0], input[1], ...input[2]] : [input[0]];
|
|
1574
|
+
}
|
|
1575
|
+
function TemplateLiteralTypesMapping(input) {
|
|
1576
|
+
return input[1];
|
|
1577
|
+
}
|
|
1578
|
+
function TemplateLiteralMapping(input) {
|
|
1579
|
+
return TemplateLiteralDeferred(input);
|
|
1580
|
+
}
|
|
1581
|
+
function DependentMapping(input) {
|
|
1582
|
+
return exports_guard.IsEqual(input.length, 6) ? Dependent(input[1], input[3], input[5]) : Dependent(input[1], input[3], Unknown());
|
|
1583
|
+
}
|
|
1584
|
+
function KeyOfMapping(input) {
|
|
1585
|
+
return input.length > 0;
|
|
1586
|
+
}
|
|
1587
|
+
function IndexArrayMapping(input) {
|
|
1588
|
+
return input.reduce((result, current) => {
|
|
1589
|
+
return exports_guard.IsEqual(current.length, 3) ? [...result, [current[1]]] : [...result, []];
|
|
1590
|
+
}, []);
|
|
1591
|
+
}
|
|
1592
|
+
function ExtendsMapping(input) {
|
|
1593
|
+
return exports_guard.IsEqual(input.length, 6) ? [input[1], input[3], input[5]] : [];
|
|
1594
|
+
}
|
|
1595
|
+
function BaseMapping(input) {
|
|
1596
|
+
return exports_guard.IsArray(input) && exports_guard.IsEqual(input.length, 3) ? input[1] : input;
|
|
1597
|
+
}
|
|
1598
|
+
function WithMapping(input) {
|
|
1599
|
+
return exports_guard.IsEqual(input.length, 2) ? input[1] : [];
|
|
1600
|
+
}
|
|
1601
|
+
function FactorIndexArray(Type, indexArray) {
|
|
1602
|
+
return indexArray.reduce((result, left) => {
|
|
1603
|
+
const _left = left;
|
|
1604
|
+
return exports_guard.IsEqual(_left.length, 1) ? IndexDeferred(result, _left[0]) : exports_guard.IsEqual(_left.length, 0) ? _Array_(result) : Unreachable2();
|
|
1605
|
+
}, Type);
|
|
1606
|
+
}
|
|
1607
|
+
function FactorExtends(type, extend) {
|
|
1608
|
+
return exports_guard.IsEqual(extend.length, 3) ? ConditionalDeferred(type, extend[0], extend[1], extend[2]) : type;
|
|
1609
|
+
}
|
|
1610
|
+
function FactorWith(type, withClause) {
|
|
1611
|
+
return exports_guard.IsArray(withClause) && exports_guard.IsEqual(withClause.length, 0) ? type : WithDeferred(type, withClause);
|
|
1612
|
+
}
|
|
1613
|
+
function FactorMapping(input) {
|
|
1614
|
+
const [keyOf, type, indexArray, extend, withClause] = input;
|
|
1615
|
+
return FactorWith(keyOf ? FactorExtends(KeyOfDeferred(FactorIndexArray(type, indexArray)), extend) : FactorExtends(FactorIndexArray(type, indexArray), extend), withClause);
|
|
1616
|
+
}
|
|
1617
|
+
function ExprBinaryMapping(left, rest2) {
|
|
1618
|
+
return exports_guard.IsEqual(rest2.length, 3) ? (() => {
|
|
1619
|
+
const [operator, right, next] = rest2;
|
|
1620
|
+
const Schema = ExprBinaryMapping(right, next);
|
|
1621
|
+
if (exports_guard.IsEqual(operator, "&")) {
|
|
1622
|
+
return IsIntersect(Schema) ? Intersect([left, ...Schema.allOf]) : Intersect([left, Schema]);
|
|
1623
|
+
}
|
|
1624
|
+
if (exports_guard.IsEqual(operator, "|")) {
|
|
1625
|
+
return IsUnion(Schema) ? Union([left, ...Schema.anyOf]) : Union([left, Schema]);
|
|
1626
|
+
}
|
|
1627
|
+
Unreachable2();
|
|
1628
|
+
})() : left;
|
|
1629
|
+
}
|
|
1630
|
+
function ExprTermTailMapping(input) {
|
|
1631
|
+
return input;
|
|
1632
|
+
}
|
|
1633
|
+
function ExprTermMapping(input) {
|
|
1634
|
+
const [left, rest2] = input;
|
|
1635
|
+
return ExprBinaryMapping(left, rest2);
|
|
1636
|
+
}
|
|
1637
|
+
function ExprTailMapping(input) {
|
|
1638
|
+
return input;
|
|
1639
|
+
}
|
|
1640
|
+
function ExprMapping(input) {
|
|
1641
|
+
const [left, rest2] = input;
|
|
1642
|
+
return ExprBinaryMapping(left, rest2);
|
|
1643
|
+
}
|
|
1644
|
+
function ExprReadonlyMapping(input) {
|
|
1645
|
+
return AddImmutableDeferred(input[1]);
|
|
1646
|
+
}
|
|
1647
|
+
function ExprPipeMapping(input) {
|
|
1648
|
+
return input[1];
|
|
1649
|
+
}
|
|
1650
|
+
function GenericTypeMapping(input) {
|
|
1651
|
+
return Generic(input[0], input[2]);
|
|
1652
|
+
}
|
|
1653
|
+
function InferTypeMapping(input) {
|
|
1654
|
+
return exports_guard.IsEqual(input.length, 4) ? Infer(input[1], input[3]) : exports_guard.IsEqual(input.length, 2) ? Infer(input[1], Unknown()) : Unreachable2();
|
|
1655
|
+
}
|
|
1656
|
+
function TypeMapping(input) {
|
|
1657
|
+
return input;
|
|
1658
|
+
}
|
|
1659
|
+
function PropertyKeyNumberMapping(input) {
|
|
1660
|
+
return `${input}`;
|
|
1661
|
+
}
|
|
1662
|
+
function PropertyKeyIdentMapping(input) {
|
|
1663
|
+
return input;
|
|
1664
|
+
}
|
|
1665
|
+
function PropertyKeyQuotedMapping(input) {
|
|
1666
|
+
return input;
|
|
1667
|
+
}
|
|
1668
|
+
function PropertyKeyIndexMapping(input) {
|
|
1669
|
+
return IsInteger2(input[3]) ? IntegerKey : IsNumber3(input[3]) ? NumberKey : IsSymbol2(input[3]) ? StringKey : IsString3(input[3]) ? StringKey : Unreachable2();
|
|
1670
|
+
}
|
|
1671
|
+
function PropertyKeyMapping(input) {
|
|
1672
|
+
return input;
|
|
1673
|
+
}
|
|
1674
|
+
function ReadonlyMapping(input) {
|
|
1675
|
+
return input.length > 0;
|
|
1676
|
+
}
|
|
1677
|
+
function OptionalMapping(input) {
|
|
1678
|
+
return input.length > 0;
|
|
1679
|
+
}
|
|
1680
|
+
function PropertyMapping(input) {
|
|
1681
|
+
const [isReadonly, key, isOptional, _colon, type] = input;
|
|
1682
|
+
return {
|
|
1683
|
+
[key]: isReadonly && isOptional ? AddReadonlyDeferred(AddOptionalDeferred(type)) : isReadonly && !isOptional ? AddReadonlyDeferred(type) : !isReadonly && isOptional ? AddOptionalDeferred(type) : type
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
function PropertyDelimiterMapping(input) {
|
|
1687
|
+
return input;
|
|
1688
|
+
}
|
|
1689
|
+
function PropertyListMapping(input) {
|
|
1690
|
+
return Delimited(input);
|
|
1691
|
+
}
|
|
1692
|
+
function PropertiesReduce(propertyList) {
|
|
1693
|
+
return propertyList.reduce((result, left) => {
|
|
1694
|
+
const isPatternProperties = exports_guard.HasPropertyKey(left, IntegerKey) || exports_guard.HasPropertyKey(left, NumberKey) || exports_guard.HasPropertyKey(left, StringKey);
|
|
1695
|
+
return isPatternProperties ? [result[0], exports_memory.Assign(result[1], left)] : [exports_memory.Assign(result[0], left), result[1]];
|
|
1696
|
+
}, [{}, {}]);
|
|
1697
|
+
}
|
|
1698
|
+
function PropertiesMapping(input) {
|
|
1699
|
+
return PropertiesReduce(input[1]);
|
|
1700
|
+
}
|
|
1701
|
+
function _Object_Mapping(input) {
|
|
1702
|
+
const [properties2, patternProperties] = input;
|
|
1703
|
+
const options = exports_guard.IsEqual(exports_guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
|
|
1704
|
+
return _Object_(properties2, options);
|
|
1705
|
+
}
|
|
1706
|
+
function ElementNamedMapping(input) {
|
|
1707
|
+
return exports_guard.IsEqual(input.length, 5) ? AddReadonlyDeferred(AddOptionalDeferred(input[4])) : exports_guard.IsEqual(input.length, 3) ? input[2] : exports_guard.IsEqual(input.length, 4) ? exports_guard.IsEqual(input[2], "readonly") ? AddReadonlyDeferred(input[3]) : AddOptionalDeferred(input[3]) : Unreachable2();
|
|
1708
|
+
}
|
|
1709
|
+
function ElementReadonlyOptionalMapping(input) {
|
|
1710
|
+
return AddReadonlyDeferred(AddOptionalDeferred(input[1]));
|
|
1711
|
+
}
|
|
1712
|
+
function ElementReadonlyMapping(input) {
|
|
1713
|
+
return AddReadonlyDeferred(input[1]);
|
|
1714
|
+
}
|
|
1715
|
+
function ElementOptionalMapping(input) {
|
|
1716
|
+
return AddOptionalDeferred(input[0]);
|
|
1717
|
+
}
|
|
1718
|
+
function ElementBaseMapping(input) {
|
|
1719
|
+
return input;
|
|
1720
|
+
}
|
|
1721
|
+
function ElementMapping(input) {
|
|
1722
|
+
return exports_guard.IsEqual(input.length, 2) ? Rest(input[1]) : exports_guard.IsEqual(input.length, 1) ? input[0] : Unreachable2();
|
|
1723
|
+
}
|
|
1724
|
+
function ElementListMapping(input) {
|
|
1725
|
+
return Delimited(input);
|
|
1726
|
+
}
|
|
1727
|
+
function _Tuple_Mapping(input) {
|
|
1728
|
+
return Tuple(input[1]);
|
|
1729
|
+
}
|
|
1730
|
+
function ParameterReadonlyOptionalMapping(input) {
|
|
1731
|
+
return AddReadonlyDeferred(AddOptionalDeferred(input[4]));
|
|
1732
|
+
}
|
|
1733
|
+
function ParameterReadonlyMapping(input) {
|
|
1734
|
+
return AddReadonlyDeferred(input[3]);
|
|
1735
|
+
}
|
|
1736
|
+
function ParameterOptionalMapping(input) {
|
|
1737
|
+
return AddOptionalDeferred(input[3]);
|
|
1738
|
+
}
|
|
1739
|
+
function ParameterTypeMapping(input) {
|
|
1740
|
+
return input[2];
|
|
1741
|
+
}
|
|
1742
|
+
function ParameterBaseMapping(input) {
|
|
1743
|
+
return input;
|
|
1744
|
+
}
|
|
1745
|
+
function ParameterMapping(input) {
|
|
1746
|
+
return exports_guard.IsEqual(input.length, 2) ? Rest(input[1]) : exports_guard.IsEqual(input.length, 1) ? input[0] : Unreachable2();
|
|
1747
|
+
}
|
|
1748
|
+
function ParameterListMapping(input) {
|
|
1749
|
+
return Delimited(input);
|
|
1750
|
+
}
|
|
1751
|
+
function _Function_Mapping(input) {
|
|
1752
|
+
return _Function_(input[1], input[4]);
|
|
1753
|
+
}
|
|
1754
|
+
function _Constructor_Mapping(input) {
|
|
1755
|
+
return Constructor(input[2], input[5]);
|
|
1756
|
+
}
|
|
1757
|
+
function ApplyReadonly(state, type) {
|
|
1758
|
+
return exports_guard.IsEqual(state, "remove") ? RemoveReadonlyDeferred(type) : exports_guard.IsEqual(state, "add") ? AddReadonlyDeferred(type) : type;
|
|
1759
|
+
}
|
|
1760
|
+
function MappedReadonlyMapping(input) {
|
|
1761
|
+
return exports_guard.IsEqual(input.length, 2) && exports_guard.IsEqual(input[0], "-") ? "remove" : exports_guard.IsEqual(input.length, 2) && exports_guard.IsEqual(input[0], "+") ? "add" : exports_guard.IsEqual(input.length, 1) ? "add" : "none";
|
|
1762
|
+
}
|
|
1763
|
+
function ApplyOptional(state, type) {
|
|
1764
|
+
return exports_guard.IsEqual(state, "remove") ? RemoveOptionalDeferred(type) : exports_guard.IsEqual(state, "add") ? AddOptionalDeferred(type) : type;
|
|
1765
|
+
}
|
|
1766
|
+
function MappedOptionalMapping(input) {
|
|
1767
|
+
return exports_guard.IsEqual(input.length, 2) && exports_guard.IsEqual(input[0], "-") ? "remove" : exports_guard.IsEqual(input.length, 2) && exports_guard.IsEqual(input[0], "+") ? "add" : exports_guard.IsEqual(input.length, 1) ? "add" : "none";
|
|
1768
|
+
}
|
|
1769
|
+
function MappedAsMapping(input) {
|
|
1770
|
+
return exports_guard.IsEqual(input.length, 2) ? [input[1]] : [];
|
|
1771
|
+
}
|
|
1772
|
+
function _Mapped_Mapping(input) {
|
|
1773
|
+
return exports_guard.IsArray(input[6]) && exports_guard.IsEqual(input[6].length, 1) ? MappedDeferred(Identifier(input[3]), input[5], input[6][0], ApplyReadonly(input[1], ApplyOptional(input[8], input[10]))) : MappedDeferred(Identifier(input[3]), input[5], Ref(input[3]), ApplyReadonly(input[1], ApplyOptional(input[8], input[10])));
|
|
1774
|
+
}
|
|
1775
|
+
function ReferenceMapping(input) {
|
|
1776
|
+
return Ref(input);
|
|
1777
|
+
}
|
|
1778
|
+
function WithBigIntMapping(input) {
|
|
1779
|
+
return BigInt(input);
|
|
1780
|
+
}
|
|
1781
|
+
function WithNumberMapping(input) {
|
|
1782
|
+
return parseFloat(input);
|
|
1783
|
+
}
|
|
1784
|
+
function WithBooleanMapping(input) {
|
|
1785
|
+
return exports_guard.IsEqual(input, "true");
|
|
1786
|
+
}
|
|
1787
|
+
function WithStringMapping(input) {
|
|
1788
|
+
return input;
|
|
1789
|
+
}
|
|
1790
|
+
function WithNullMapping(input) {
|
|
1791
|
+
return null;
|
|
1792
|
+
}
|
|
1793
|
+
function WithUndefinedMapping(input) {
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
function WithPropertyMapping(input) {
|
|
1797
|
+
return { [input[0]]: input[2] };
|
|
1798
|
+
}
|
|
1799
|
+
function WithPropertyListMapping(input) {
|
|
1800
|
+
return Delimited(input);
|
|
1801
|
+
}
|
|
1802
|
+
function WithObjectMappingReduce(propertyList) {
|
|
1803
|
+
return propertyList.reduce((result, left) => {
|
|
1804
|
+
return exports_memory.Assign(result, left);
|
|
1805
|
+
}, {});
|
|
1806
|
+
}
|
|
1807
|
+
function WithObjectMapping(input) {
|
|
1808
|
+
return WithObjectMappingReduce(input[1]);
|
|
1809
|
+
}
|
|
1810
|
+
function WithElementListMapping(input) {
|
|
1811
|
+
return Delimited(input);
|
|
1812
|
+
}
|
|
1813
|
+
function WithArrayMapping(input) {
|
|
1814
|
+
return input[1];
|
|
1815
|
+
}
|
|
1816
|
+
function WithValueMapping(input) {
|
|
1817
|
+
return input;
|
|
1818
|
+
}
|
|
1819
|
+
function PatternBigIntMapping(input) {
|
|
1820
|
+
return BigInt2();
|
|
1821
|
+
}
|
|
1822
|
+
function PatternStringMapping(input) {
|
|
1823
|
+
return String2();
|
|
1824
|
+
}
|
|
1825
|
+
function PatternNumberMapping(input) {
|
|
1826
|
+
return Number2();
|
|
1827
|
+
}
|
|
1828
|
+
function PatternIntegerMapping(input) {
|
|
1829
|
+
return Integer();
|
|
1830
|
+
}
|
|
1831
|
+
function PatternNeverMapping(input) {
|
|
1832
|
+
return Never();
|
|
1833
|
+
}
|
|
1834
|
+
function PatternTextMapping(input) {
|
|
1835
|
+
return Literal(input);
|
|
1836
|
+
}
|
|
1837
|
+
function PatternBaseMapping(input) {
|
|
1838
|
+
return input;
|
|
1839
|
+
}
|
|
1840
|
+
function PatternGroupMapping(input) {
|
|
1841
|
+
return Union(input[1]);
|
|
1842
|
+
}
|
|
1843
|
+
function PatternUnionMapping(input) {
|
|
1844
|
+
return input.length === 3 ? [...input[0], ...input[2]] : input.length === 1 ? [...input[0]] : [];
|
|
1845
|
+
}
|
|
1846
|
+
function PatternTermMapping(input) {
|
|
1847
|
+
return [input[0], ...input[1]];
|
|
1848
|
+
}
|
|
1849
|
+
function PatternBodyMapping(input) {
|
|
1850
|
+
return input;
|
|
1851
|
+
}
|
|
1852
|
+
function PatternMapping(input) {
|
|
1853
|
+
return input[1];
|
|
1854
|
+
}
|
|
1855
|
+
function InterfaceDeclarationHeritageListMapping(input) {
|
|
1856
|
+
return Delimited(input);
|
|
1857
|
+
}
|
|
1858
|
+
function InterfaceDeclarationHeritageMapping(input) {
|
|
1859
|
+
return exports_guard.IsEqual(input.length, 2) ? input[1] : [];
|
|
1860
|
+
}
|
|
1861
|
+
function InterfaceDeclarationGenericMapping(input) {
|
|
1862
|
+
const parameters = input[2];
|
|
1863
|
+
const heritage = input[3];
|
|
1864
|
+
const [properties2, patternProperties] = input[4];
|
|
1865
|
+
const options = exports_guard.IsEqual(exports_guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
|
|
1866
|
+
return { [input[1]]: Generic(parameters, InterfaceDeferred(heritage, properties2, options)) };
|
|
1867
|
+
}
|
|
1868
|
+
function InterfaceDeclarationMapping(input) {
|
|
1869
|
+
const heritage = input[2];
|
|
1870
|
+
const [properties2, patternProperties] = input[3];
|
|
1871
|
+
const options = exports_guard.IsEqual(exports_guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
|
|
1872
|
+
return { [input[1]]: InterfaceDeferred(heritage, properties2, options) };
|
|
1873
|
+
}
|
|
1874
|
+
function TypeAliasDeclarationGenericMapping(input) {
|
|
1875
|
+
return { [input[1]]: Generic(input[2], input[4]) };
|
|
1876
|
+
}
|
|
1877
|
+
function TypeAliasDeclarationMapping(input) {
|
|
1878
|
+
return { [input[1]]: input[3] };
|
|
1879
|
+
}
|
|
1880
|
+
function ExportKeywordMapping(input) {
|
|
1881
|
+
return null;
|
|
1882
|
+
}
|
|
1883
|
+
function ModuleDeclarationDelimiterMapping(input) {
|
|
1884
|
+
return input;
|
|
1885
|
+
}
|
|
1886
|
+
function ModuleDeclarationListMapping(input) {
|
|
1887
|
+
return PropertiesReduce(Delimited(input));
|
|
1888
|
+
}
|
|
1889
|
+
function ModuleDeclarationMapping(input) {
|
|
1890
|
+
return input[1];
|
|
1891
|
+
}
|
|
1892
|
+
function ModuleMapping(input) {
|
|
1893
|
+
const moduleDeclaration = input[0];
|
|
1894
|
+
const moduleDeclarationList = input[1];
|
|
1895
|
+
return ModuleDeferred(exports_memory.Assign(moduleDeclaration, moduleDeclarationList[0]));
|
|
1896
|
+
}
|
|
1897
|
+
function ScriptMapping(input) {
|
|
1898
|
+
return input;
|
|
1899
|
+
}
|
|
1900
|
+
// node_modules/typebox/build/type/script/token/internal/match.mjs
|
|
1901
|
+
function IsMatch(value) {
|
|
1902
|
+
return IsEqual(value.length, 2);
|
|
1903
|
+
}
|
|
1904
|
+
function Match2(input, ok, fail) {
|
|
1905
|
+
return IsMatch(input) ? ok(input[0], input[1]) : fail();
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
// node_modules/typebox/build/type/script/token/internal/take.mjs
|
|
1909
|
+
function TakeVariant(variant, input) {
|
|
1910
|
+
return IsEqual(input.indexOf(variant), 0) ? [variant, input.slice(variant.length)] : [];
|
|
1911
|
+
}
|
|
1912
|
+
function Take(variants, input) {
|
|
1913
|
+
for (let i = 0;i < variants.length; i++) {
|
|
1914
|
+
const result = TakeVariant(variants[i], input);
|
|
1915
|
+
if (IsMatch(result))
|
|
1916
|
+
return result;
|
|
1917
|
+
}
|
|
1918
|
+
return [];
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
// node_modules/typebox/build/type/script/token/internal/char.mjs
|
|
1922
|
+
function Range(start, end) {
|
|
1923
|
+
return Array.from({ length: end - start + 1 }, (_, i) => String.fromCharCode(start + i));
|
|
1924
|
+
}
|
|
1925
|
+
var Alpha = [
|
|
1926
|
+
...Range(97, 122),
|
|
1927
|
+
...Range(65, 90)
|
|
1928
|
+
];
|
|
1929
|
+
var Zero = "0";
|
|
1930
|
+
var NonZero = Range(49, 57);
|
|
1931
|
+
var Digit = [Zero, ...NonZero];
|
|
1932
|
+
var WhiteSpace = " ";
|
|
1933
|
+
var NewLine = `
|
|
1934
|
+
`;
|
|
1935
|
+
var UnderScore = "_";
|
|
1936
|
+
var Dot = ".";
|
|
1937
|
+
var DollarSign = "$";
|
|
1938
|
+
var Hyphen = "-";
|
|
1939
|
+
|
|
1940
|
+
// node_modules/typebox/build/type/script/token/internal/trim.mjs
|
|
1941
|
+
var LineComment = "//";
|
|
1942
|
+
var OpenComment = "/*";
|
|
1943
|
+
var CloseComment = "*/";
|
|
1944
|
+
function DiscardMultilineComment(input) {
|
|
1945
|
+
const index = input.indexOf(CloseComment);
|
|
1946
|
+
const result = IsEqual(index, -1) ? "" : input.slice(index + 2);
|
|
1947
|
+
return result;
|
|
1948
|
+
}
|
|
1949
|
+
function DiscardLineComment(input) {
|
|
1950
|
+
const index = input.indexOf(NewLine);
|
|
1951
|
+
const result = IsEqual(index, -1) ? "" : input.slice(index);
|
|
1952
|
+
return result;
|
|
1953
|
+
}
|
|
1954
|
+
function TrimStartUntilNewline(input) {
|
|
1955
|
+
return input.replace(/^[ \t\r\f\v]+/, "");
|
|
1956
|
+
}
|
|
1957
|
+
function TrimWhitespace(input) {
|
|
1958
|
+
const trimmed = TrimStartUntilNewline(input);
|
|
1959
|
+
return trimmed.startsWith(OpenComment) ? TrimWhitespace(DiscardMultilineComment(trimmed.slice(2))) : trimmed.startsWith(LineComment) ? TrimWhitespace(DiscardLineComment(trimmed.slice(2))) : trimmed;
|
|
1960
|
+
}
|
|
1961
|
+
function Trim(input) {
|
|
1962
|
+
const trimmed = input.trimStart();
|
|
1963
|
+
return trimmed.startsWith(OpenComment) ? Trim(DiscardMultilineComment(trimmed.slice(2))) : trimmed.startsWith(LineComment) ? Trim(DiscardLineComment(trimmed.slice(2))) : trimmed;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
// node_modules/typebox/build/type/script/token/internal/optional.mjs
|
|
1967
|
+
function Optional2(value, input) {
|
|
1968
|
+
return Match2(Take([value], input), (Optional3, Rest2) => [Optional3, Rest2], () => ["", input]);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// node_modules/typebox/build/type/script/token/internal/many.mjs
|
|
1972
|
+
function IsDiscard(discard2, input) {
|
|
1973
|
+
return discard2.includes(input);
|
|
1974
|
+
}
|
|
1975
|
+
function Many(allowed, discard2, input, result = "") {
|
|
1976
|
+
return Match2(Take(allowed, input), (Char, Rest2) => IsDiscard(discard2, Char) ? Many(allowed, discard2, Rest2, result) : Many(allowed, discard2, Rest2, `${result}${Char}`), () => [result, input]);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
// node_modules/typebox/build/type/script/token/unsigned_integer.mjs
|
|
1980
|
+
function TakeNonZero(input) {
|
|
1981
|
+
return Take(NonZero, input);
|
|
1982
|
+
}
|
|
1983
|
+
var AllowedDigits = [...Digit, UnderScore];
|
|
1984
|
+
function TakeDigits(input) {
|
|
1985
|
+
return Many(AllowedDigits, [UnderScore], input);
|
|
1986
|
+
}
|
|
1987
|
+
function TakeUnsignedInteger(input) {
|
|
1988
|
+
return Match2(Take([Zero], input), (Zero2, ZeroRest) => [Zero2, ZeroRest], () => Match2(TakeNonZero(input), (NonZero2, NonZeroRest) => Match2(TakeDigits(NonZeroRest), (Digits, DigitsRest) => [`${NonZero2}${Digits}`, DigitsRest], () => []), () => []));
|
|
1989
|
+
}
|
|
1990
|
+
function UnsignedInteger(input) {
|
|
1991
|
+
return TakeUnsignedInteger(Trim(input));
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// node_modules/typebox/build/type/script/token/integer.mjs
|
|
1995
|
+
function TakeSign(input) {
|
|
1996
|
+
return Optional2(Hyphen, input);
|
|
1997
|
+
}
|
|
1998
|
+
function TakeSignedInteger(input) {
|
|
1999
|
+
return Match2(TakeSign(input), (Sign, SignRest) => Match2(UnsignedInteger(SignRest), (UnsignedInteger2, UnsignedIntegerRest) => [`${Sign}${UnsignedInteger2}`, UnsignedIntegerRest], () => []), () => []);
|
|
2000
|
+
}
|
|
2001
|
+
function Integer2(input) {
|
|
2002
|
+
return TakeSignedInteger(Trim(input));
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
// node_modules/typebox/build/type/script/token/bigint.mjs
|
|
2006
|
+
function TakeBigInt(input) {
|
|
2007
|
+
return Match2(Integer2(input), (Integer3, IntegerRest) => Match2(Take(["n"], IntegerRest), (_N, NRest) => [`${Integer3}`, NRest], () => []), () => []);
|
|
2008
|
+
}
|
|
2009
|
+
function BigInt3(input) {
|
|
2010
|
+
return TakeBigInt(input);
|
|
2011
|
+
}
|
|
2012
|
+
// node_modules/typebox/build/type/script/token/const.mjs
|
|
2013
|
+
function TakeConst(const_, input) {
|
|
2014
|
+
return Take([const_], input);
|
|
2015
|
+
}
|
|
2016
|
+
function Const(const_, input) {
|
|
2017
|
+
return IsEqual(const_, "") ? ["", input] : const_.startsWith(NewLine) ? TakeConst(const_, TrimWhitespace(input)) : const_.startsWith(WhiteSpace) ? TakeConst(const_, input) : TakeConst(const_, Trim(input));
|
|
2018
|
+
}
|
|
2019
|
+
// node_modules/typebox/build/type/script/token/ident.mjs
|
|
2020
|
+
var Initial = [...Alpha, UnderScore, DollarSign];
|
|
2021
|
+
function TakeInitial(input) {
|
|
2022
|
+
return Take(Initial, input);
|
|
2023
|
+
}
|
|
2024
|
+
var Remaining = [...Initial, ...Digit];
|
|
2025
|
+
function TakeRemaining(input, result = "") {
|
|
2026
|
+
return Match2(Take(Remaining, input), (Remaining2, RemainingRest) => TakeRemaining(RemainingRest, `${result}${Remaining2}`), () => [result, input]);
|
|
2027
|
+
}
|
|
2028
|
+
function TakeIdent(input) {
|
|
2029
|
+
return Match2(TakeInitial(input), (Initial2, InitialRest) => Match2(TakeRemaining(InitialRest), (Remaining2, RemainingRest) => [`${Initial2}${Remaining2}`, RemainingRest], () => []), () => []);
|
|
2030
|
+
}
|
|
2031
|
+
function Ident(input) {
|
|
2032
|
+
return TakeIdent(Trim(input));
|
|
2033
|
+
}
|
|
2034
|
+
// node_modules/typebox/build/type/script/token/unsigned_number.mjs
|
|
2035
|
+
var AllowedDigits2 = [...Digit, UnderScore];
|
|
2036
|
+
function IsLeadingDot(input) {
|
|
2037
|
+
return IsMatch(Take([Dot], input));
|
|
2038
|
+
}
|
|
2039
|
+
function TakeFractional(input) {
|
|
2040
|
+
return Match2(Many(AllowedDigits2, [UnderScore], input), (Digits, DigitsRest) => IsEqual(Digits, "") ? [] : [Digits, DigitsRest], () => []);
|
|
2041
|
+
}
|
|
2042
|
+
function LeadingDot(input) {
|
|
2043
|
+
return Match2(Take([Dot], input), (Dot2, DotRest) => Match2(TakeFractional(DotRest), (Fractional, FractionalRest) => [`0${Dot2}${Fractional}`, FractionalRest], () => []), () => []);
|
|
2044
|
+
}
|
|
2045
|
+
function LeadingInteger(input) {
|
|
2046
|
+
return Match2(UnsignedInteger(input), (Integer3, IntegerRest) => Match2(Take([Dot], IntegerRest), (Dot2, DotRest) => Match2(TakeFractional(DotRest), (Fractional, FractionalRest) => [`${Integer3}${Dot2}${Fractional}`, FractionalRest], () => [`${Integer3}`, DotRest]), () => [`${Integer3}`, IntegerRest]), () => []);
|
|
2047
|
+
}
|
|
2048
|
+
function TakeUnsignedNumber(input) {
|
|
2049
|
+
return IsLeadingDot(input) ? LeadingDot(input) : LeadingInteger(input);
|
|
2050
|
+
}
|
|
2051
|
+
function UnsignedNumber(input) {
|
|
2052
|
+
return TakeUnsignedNumber(Trim(input));
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
// node_modules/typebox/build/type/script/token/number.mjs
|
|
2056
|
+
function TakeSign2(input) {
|
|
2057
|
+
return Optional2(Hyphen, input);
|
|
2058
|
+
}
|
|
2059
|
+
function TakeSignedNumber(input) {
|
|
2060
|
+
return Match2(TakeSign2(input), (Sign, SignRest) => Match2(UnsignedNumber(SignRest), (UnsignedInteger2, UnsignedIntegerRest) => [`${Sign}${UnsignedInteger2}`, UnsignedIntegerRest], () => []), () => []);
|
|
2061
|
+
}
|
|
2062
|
+
function Number3(input) {
|
|
2063
|
+
return TakeSignedNumber(Trim(input));
|
|
2064
|
+
}
|
|
2065
|
+
// node_modules/typebox/build/type/script/token/until.mjs
|
|
2066
|
+
function TakeOne(input) {
|
|
2067
|
+
const result = IsEqual(input, "") ? [] : [input.slice(0, 1), input.slice(1)];
|
|
2068
|
+
return result;
|
|
2069
|
+
}
|
|
2070
|
+
function IsInputMatchSentinal(end, input) {
|
|
2071
|
+
return ShiftLeft(end, (left, right) => input.startsWith(left) ? true : IsInputMatchSentinal(right, input), () => false);
|
|
2072
|
+
}
|
|
2073
|
+
function Until(end, input, result = "") {
|
|
2074
|
+
return Match2(TakeOne(input), (One, Rest2) => IsInputMatchSentinal(end, input) ? [result, input] : Until(end, Rest2, `${result}${One}`), () => []);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
// node_modules/typebox/build/type/script/token/span.mjs
|
|
2078
|
+
function MultiLine(start, end, input) {
|
|
2079
|
+
return Match2(Take([start], input), (_, Rest2) => Match2(Until([end], Rest2), (Until2, UntilRest) => Match2(Take([end], UntilRest), (_2, Rest3) => [`${Until2}`, Rest3], () => []), () => []), () => []);
|
|
2080
|
+
}
|
|
2081
|
+
function SingleLine(start, end, input) {
|
|
2082
|
+
return Match2(Take([start], input), (_, Rest2) => Match2(Until([NewLine, end], Rest2), (Until2, UntilRest) => Match2(Take([end], UntilRest), (_2, EndRest) => [`${Until2}`, EndRest], () => []), () => []), () => []);
|
|
2083
|
+
}
|
|
2084
|
+
function Span(start, end, multiLine, input) {
|
|
2085
|
+
return multiLine ? MultiLine(start, end, Trim(input)) : SingleLine(start, end, Trim(input));
|
|
2086
|
+
}
|
|
2087
|
+
// node_modules/typebox/build/type/script/token/string.mjs
|
|
2088
|
+
function TakeInitial2(quotes, input) {
|
|
2089
|
+
return Take(quotes, input);
|
|
2090
|
+
}
|
|
2091
|
+
function TakeSpan(quote, input) {
|
|
2092
|
+
return Span(quote, quote, false, input);
|
|
2093
|
+
}
|
|
2094
|
+
function TakeString(quotes, input) {
|
|
2095
|
+
return Match2(TakeInitial2(quotes, input), (Initial2, InitialRest) => TakeSpan(Initial2, `${Initial2}${InitialRest}`), () => []);
|
|
2096
|
+
}
|
|
2097
|
+
function String3(quotes, input) {
|
|
2098
|
+
return TakeString(quotes, Trim(input));
|
|
2099
|
+
}
|
|
2100
|
+
// node_modules/typebox/build/type/script/token/until_1.mjs
|
|
2101
|
+
function Until_1(end, input) {
|
|
2102
|
+
return Match2(Until(end, input), (Until2, UntilRest) => IsEqual(Until2, "") ? [] : [Until2, UntilRest], () => []);
|
|
2103
|
+
}
|
|
2104
|
+
// node_modules/typebox/build/type/script/parser.mjs
|
|
2105
|
+
var If = (result, left, right = () => []) => result.length === 2 ? left(result) : right();
|
|
2106
|
+
var GenericParameterExtendsEquals = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("extends", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => If(Const("=", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [GenericParameterExtendsEqualsMapping(_0), input2]);
|
|
2107
|
+
var GenericParameterExtends = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("extends", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParameterExtendsMapping(_0), input2]);
|
|
2108
|
+
var GenericParameterEquals = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("=", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParameterEqualsMapping(_0), input2]);
|
|
2109
|
+
var GenericParameterIdentifier = (input) => If(Ident(input), ([_0, input2]) => [GenericParameterIdentifierMapping(_0), input2]);
|
|
2110
|
+
var GenericParameter = (input) => If(If(GenericParameterExtendsEquals(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterExtends(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterEquals(input), ([_0, input2]) => [_0, input2], () => If(GenericParameterIdentifier(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [GenericParameterMapping(_0), input2]);
|
|
2111
|
+
var GenericParameterList_0 = (input, result = []) => If(If(GenericParameter(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => GenericParameterList_0(input2, [...result, _0]), () => [result, input]);
|
|
2112
|
+
var GenericParameterList = (input) => If(If(GenericParameterList_0(input), ([_0, input2]) => If(If(If(GenericParameter(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [GenericParameterListMapping(_0), input2]);
|
|
2113
|
+
var GenericParameters = (input) => If(If(Const("<", input), ([_0, input2]) => If(GenericParameterList(input2), ([_1, input3]) => If(Const(">", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericParametersMapping(_0), input2]);
|
|
2114
|
+
var GenericCallArgumentList_0 = (input, result = []) => If(If(Type(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => GenericCallArgumentList_0(input2, [...result, _0]), () => [result, input]);
|
|
2115
|
+
var GenericCallArgumentList = (input) => If(If(GenericCallArgumentList_0(input), ([_0, input2]) => If(If(If(Type(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [GenericCallArgumentListMapping(_0), input2]);
|
|
2116
|
+
var GenericCallArguments = (input) => If(If(Const("<", input), ([_0, input2]) => If(GenericCallArgumentList(input2), ([_1, input3]) => If(Const(">", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericCallArgumentsMapping(_0), input2]);
|
|
2117
|
+
var GenericCall = (input) => If(If(Ident(input), ([_0, input2]) => If(GenericCallArguments(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [GenericCallMapping(_0), input2]);
|
|
2118
|
+
var OptionalSemiColon = (input) => If(If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [OptionalSemiColonMapping(_0), input2]);
|
|
2119
|
+
var KeywordString = (input) => If(Const("string", input), ([_0, input2]) => [KeywordStringMapping(_0), input2]);
|
|
2120
|
+
var KeywordNumber = (input) => If(Const("number", input), ([_0, input2]) => [KeywordNumberMapping(_0), input2]);
|
|
2121
|
+
var KeywordBoolean = (input) => If(Const("boolean", input), ([_0, input2]) => [KeywordBooleanMapping(_0), input2]);
|
|
2122
|
+
var KeywordUndefined = (input) => If(Const("undefined", input), ([_0, input2]) => [KeywordUndefinedMapping(_0), input2]);
|
|
2123
|
+
var KeywordNull = (input) => If(Const("null", input), ([_0, input2]) => [KeywordNullMapping(_0), input2]);
|
|
2124
|
+
var KeywordInteger = (input) => If(Const("integer", input), ([_0, input2]) => [KeywordIntegerMapping(_0), input2]);
|
|
2125
|
+
var KeywordBigInt = (input) => If(Const("bigint", input), ([_0, input2]) => [KeywordBigIntMapping(_0), input2]);
|
|
2126
|
+
var KeywordUnknown = (input) => If(Const("unknown", input), ([_0, input2]) => [KeywordUnknownMapping(_0), input2]);
|
|
2127
|
+
var KeywordAny = (input) => If(Const("any", input), ([_0, input2]) => [KeywordAnyMapping(_0), input2]);
|
|
2128
|
+
var KeywordObject = (input) => If(Const("object", input), ([_0, input2]) => [KeywordObjectMapping(_0), input2]);
|
|
2129
|
+
var KeywordNever = (input) => If(Const("never", input), ([_0, input2]) => [KeywordNeverMapping(_0), input2]);
|
|
2130
|
+
var KeywordSymbol = (input) => If(Const("symbol", input), ([_0, input2]) => [KeywordSymbolMapping(_0), input2]);
|
|
2131
|
+
var KeywordVoid = (input) => If(Const("void", input), ([_0, input2]) => [KeywordVoidMapping(_0), input2]);
|
|
2132
|
+
var KeywordThis = (input) => If(Const("this", input), ([_0, input2]) => [KeywordThisMapping(_0), input2]);
|
|
2133
|
+
var TemplateInterpolate = (input) => If(If(Const("${", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [TemplateInterpolateMapping(_0), input2]);
|
|
2134
|
+
var TemplateSpan = (input) => If(Until(["${", "`"], input), ([_0, input2]) => [TemplateSpanMapping(_0), input2]);
|
|
2135
|
+
var TemplateBody = (input) => If(If(If(TemplateSpan(input), ([_0, input2]) => If(TemplateInterpolate(input2), ([_1, input3]) => If(TemplateBody(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(TemplateSpan(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(TemplateSpan(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [TemplateBodyMapping(_0), input2]);
|
|
2136
|
+
var TemplateLiteralTypes = (input) => If(If(Const("`", input), ([_0, input2]) => If(TemplateBody(input2), ([_1, input3]) => If(Const("`", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [TemplateLiteralTypesMapping(_0), input2]);
|
|
2137
|
+
var TemplateLiteral = (input) => If(TemplateLiteralTypes(input), ([_0, input2]) => [TemplateLiteralMapping(_0), input2]);
|
|
2138
|
+
var Dependent2 = (input) => If(If(If(Const("if", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("then", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => If(Const("else", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_0, input2], () => If(If(Const("if", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("then", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [DependentMapping(_0), input2]);
|
|
2139
|
+
var LiteralBigInt = (input) => If(BigInt3(input), ([_0, input2]) => [LiteralBigIntMapping(_0), input2]);
|
|
2140
|
+
var LiteralBoolean = (input) => If(If(Const("true", input), ([_0, input2]) => [_0, input2], () => If(Const("false", input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [LiteralBooleanMapping(_0), input2]);
|
|
2141
|
+
var LiteralNumber = (input) => If(Number3(input), ([_0, input2]) => [LiteralNumberMapping(_0), input2]);
|
|
2142
|
+
var LiteralString = (input) => If(String3(["'", '"'], input), ([_0, input2]) => [LiteralStringMapping(_0), input2]);
|
|
2143
|
+
var KeyOf = (input) => If(If(If(Const("keyof", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [KeyOfMapping(_0), input2]);
|
|
2144
|
+
var IndexArray_0 = (input, result = []) => If(If(If(Const("[", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(Const("[", input), ([_0, input2]) => If(Const("]", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => IndexArray_0(input2, [...result, _0]), () => [result, input]);
|
|
2145
|
+
var IndexArray = (input) => If(IndexArray_0(input), ([_0, input2]) => [IndexArrayMapping(_0), input2]);
|
|
2146
|
+
var Extends2 = (input) => If(If(If(Const("extends", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("?", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => If(Const(":", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExtendsMapping(_0), input2]);
|
|
2147
|
+
var Base = (input) => If(If(If(Const("(", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(KeywordString(input), ([_0, input2]) => [_0, input2], () => If(KeywordNumber(input), ([_0, input2]) => [_0, input2], () => If(KeywordBoolean(input), ([_0, input2]) => [_0, input2], () => If(KeywordUndefined(input), ([_0, input2]) => [_0, input2], () => If(KeywordNull(input), ([_0, input2]) => [_0, input2], () => If(KeywordInteger(input), ([_0, input2]) => [_0, input2], () => If(KeywordBigInt(input), ([_0, input2]) => [_0, input2], () => If(KeywordUnknown(input), ([_0, input2]) => [_0, input2], () => If(KeywordAny(input), ([_0, input2]) => [_0, input2], () => If(KeywordObject(input), ([_0, input2]) => [_0, input2], () => If(KeywordNever(input), ([_0, input2]) => [_0, input2], () => If(KeywordSymbol(input), ([_0, input2]) => [_0, input2], () => If(KeywordVoid(input), ([_0, input2]) => [_0, input2], () => If(KeywordThis(input), ([_0, input2]) => [_0, input2], () => If(LiteralBigInt(input), ([_0, input2]) => [_0, input2], () => If(LiteralBoolean(input), ([_0, input2]) => [_0, input2], () => If(LiteralNumber(input), ([_0, input2]) => [_0, input2], () => If(LiteralString(input), ([_0, input2]) => [_0, input2], () => If(TemplateLiteral(input), ([_0, input2]) => [_0, input2], () => If(Dependent2(input), ([_0, input2]) => [_0, input2], () => If(_Object_2(input), ([_0, input2]) => [_0, input2], () => If(_Tuple_(input), ([_0, input2]) => [_0, input2], () => If(_Constructor_(input), ([_0, input2]) => [_0, input2], () => If(_Function_2(input), ([_0, input2]) => [_0, input2], () => If(_Mapped_(input), ([_0, input2]) => [_0, input2], () => If(GenericCall(input), ([_0, input2]) => [_0, input2], () => If(Reference(input), ([_0, input2]) => [_0, input2], () => [])))))))))))))))))))))))))))), ([_0, input2]) => [BaseMapping(_0), input2]);
|
|
2148
|
+
var With = (input) => If(If(If(Const("with", input), ([_0, input2]) => If(WithObject(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithMapping(_0), input2]);
|
|
2149
|
+
var Factor = (input) => If(If(KeyOf(input), ([_0, input2]) => If(Base(input2), ([_1, input3]) => If(IndexArray(input3), ([_2, input4]) => If(Extends2(input4), ([_3, input5]) => If(With(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [FactorMapping(_0), input2]);
|
|
2150
|
+
var ExprTermTail = (input) => If(If(If(Const("&", input), ([_0, input2]) => If(Factor(input2), ([_1, input3]) => If(ExprTermTail(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExprTermTailMapping(_0), input2]);
|
|
2151
|
+
var ExprTerm = (input) => If(If(Factor(input), ([_0, input2]) => If(ExprTermTail(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprTermMapping(_0), input2]);
|
|
2152
|
+
var ExprTail = (input) => If(If(If(Const("|", input), ([_0, input2]) => If(ExprTerm(input2), ([_1, input3]) => If(ExprTail(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExprTailMapping(_0), input2]);
|
|
2153
|
+
var Expr = (input) => If(If(ExprTerm(input), ([_0, input2]) => If(ExprTail(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprMapping(_0), input2]);
|
|
2154
|
+
var ExprReadonly = (input) => If(If(Const("readonly", input), ([_0, input2]) => If(Expr(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprReadonlyMapping(_0), input2]);
|
|
2155
|
+
var ExprPipe = (input) => If(If(Const("|", input), ([_0, input2]) => If(Expr(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ExprPipeMapping(_0), input2]);
|
|
2156
|
+
var GenericType = (input) => If(If(GenericParameters(input), ([_0, input2]) => If(Const("=", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [GenericTypeMapping(_0), input2]);
|
|
2157
|
+
var InferType = (input) => If(If(If(Const("infer", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const("extends", input3), ([_2, input4]) => If(Expr(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Const("infer", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [InferTypeMapping(_0), input2]);
|
|
2158
|
+
var Type = (input) => If(If(InferType(input), ([_0, input2]) => [_0, input2], () => If(ExprPipe(input), ([_0, input2]) => [_0, input2], () => If(ExprReadonly(input), ([_0, input2]) => [_0, input2], () => If(Expr(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [TypeMapping(_0), input2]);
|
|
2159
|
+
var PropertyKeyNumber = (input) => If(Number3(input), ([_0, input2]) => [PropertyKeyNumberMapping(_0), input2]);
|
|
2160
|
+
var PropertyKeyIdent = (input) => If(Ident(input), ([_0, input2]) => [PropertyKeyIdentMapping(_0), input2]);
|
|
2161
|
+
var PropertyKeyQuoted = (input) => If(String3(["'", '"'], input), ([_0, input2]) => [PropertyKeyQuotedMapping(_0), input2]);
|
|
2162
|
+
var PropertyKeyIndex = (input) => If(If(Const("[", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(If(KeywordInteger(input4), ([_02, input5]) => [_02, input5], () => If(KeywordNumber(input4), ([_02, input5]) => [_02, input5], () => If(KeywordString(input4), ([_02, input5]) => [_02, input5], () => If(KeywordSymbol(input4), ([_02, input5]) => [_02, input5], () => [])))), ([_3, input5]) => If(Const("]", input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [PropertyKeyIndexMapping(_0), input2]);
|
|
2163
|
+
var PropertyKey = (input) => If(If(PropertyKeyNumber(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyIdent(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyQuoted(input), ([_0, input2]) => [_0, input2], () => If(PropertyKeyIndex(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [PropertyKeyMapping(_0), input2]);
|
|
2164
|
+
var Readonly2 = (input) => If(If(If(Const("readonly", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ReadonlyMapping(_0), input2]);
|
|
2165
|
+
var Optional3 = (input) => If(If(If(Const("?", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [OptionalMapping(_0), input2]);
|
|
2166
|
+
var Property = (input) => If(If(Readonly2(input), ([_0, input2]) => If(PropertyKey(input2), ([_1, input3]) => If(Optional3(input3), ([_2, input4]) => If(Const(":", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [PropertyMapping(_0), input2]);
|
|
2167
|
+
var PropertyDelimiter = (input) => If(If(If(Const(",", input), ([_0, input2]) => If(Const(`
|
|
2168
|
+
`, input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => If(Const(`
|
|
2169
|
+
`, input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(",", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const(`
|
|
2170
|
+
`, input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))))), ([_0, input2]) => [PropertyDelimiterMapping(_0), input2]);
|
|
2171
|
+
var PropertyList_0 = (input, result = []) => If(If(Property(input), ([_0, input2]) => If(PropertyDelimiter(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => PropertyList_0(input2, [...result, _0]), () => [result, input]);
|
|
2172
|
+
var PropertyList = (input) => If(If(PropertyList_0(input), ([_0, input2]) => If(If(If(Property(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [PropertyListMapping(_0), input2]);
|
|
2173
|
+
var Properties = (input) => If(If(Const("{", input), ([_0, input2]) => If(PropertyList(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PropertiesMapping(_0), input2]);
|
|
2174
|
+
var _Object_2 = (input) => If(Properties(input), ([_0, input2]) => [_Object_Mapping(_0), input2]);
|
|
2175
|
+
var ElementNamed = (input) => If(If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Const("readonly", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Const("readonly", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [_0, input2], () => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [ElementNamedMapping(_0), input2]);
|
|
2176
|
+
var ElementReadonlyOptional = (input) => If(If(Const("readonly", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => If(Const("?", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [ElementReadonlyOptionalMapping(_0), input2]);
|
|
2177
|
+
var ElementReadonly = (input) => If(If(Const("readonly", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ElementReadonlyMapping(_0), input2]);
|
|
2178
|
+
var ElementOptional = (input) => If(If(Type(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ElementOptionalMapping(_0), input2]);
|
|
2179
|
+
var ElementBase = (input) => If(If(ElementNamed(input), ([_0, input2]) => [_0, input2], () => If(ElementReadonlyOptional(input), ([_0, input2]) => [_0, input2], () => If(ElementReadonly(input), ([_0, input2]) => [_0, input2], () => If(ElementOptional(input), ([_0, input2]) => [_0, input2], () => If(Type(input), ([_0, input2]) => [_0, input2], () => []))))), ([_0, input2]) => [ElementBaseMapping(_0), input2]);
|
|
2180
|
+
var Element = (input) => If(If(If(Const("...", input), ([_0, input2]) => If(ElementBase(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(ElementBase(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ElementMapping(_0), input2]);
|
|
2181
|
+
var ElementList_0 = (input, result = []) => If(If(Element(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ElementList_0(input2, [...result, _0]), () => [result, input]);
|
|
2182
|
+
var ElementList = (input) => If(If(ElementList_0(input), ([_0, input2]) => If(If(If(Element(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ElementListMapping(_0), input2]);
|
|
2183
|
+
var _Tuple_ = (input) => If(If(Const("[", input), ([_0, input2]) => If(ElementList(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_Tuple_Mapping(_0), input2]);
|
|
2184
|
+
var ParameterReadonlyOptional = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Const("readonly", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [ParameterReadonlyOptionalMapping(_0), input2]);
|
|
2185
|
+
var ParameterReadonly = (input) => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Const("readonly", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [ParameterReadonlyMapping(_0), input2]);
|
|
2186
|
+
var ParameterOptional = (input) => If(If(Ident(input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => If(Const(":", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [ParameterOptionalMapping(_0), input2]);
|
|
2187
|
+
var ParameterType = (input) => If(If(Ident(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(Type(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [ParameterTypeMapping(_0), input2]);
|
|
2188
|
+
var ParameterBase = (input) => If(If(ParameterReadonlyOptional(input), ([_0, input2]) => [_0, input2], () => If(ParameterReadonly(input), ([_0, input2]) => [_0, input2], () => If(ParameterOptional(input), ([_0, input2]) => [_0, input2], () => If(ParameterType(input), ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [ParameterBaseMapping(_0), input2]);
|
|
2189
|
+
var Parameter2 = (input) => If(If(If(Const("...", input), ([_0, input2]) => If(ParameterBase(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(ParameterBase(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ParameterMapping(_0), input2]);
|
|
2190
|
+
var ParameterList_0 = (input, result = []) => If(If(Parameter2(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ParameterList_0(input2, [...result, _0]), () => [result, input]);
|
|
2191
|
+
var ParameterList = (input) => If(If(ParameterList_0(input), ([_0, input2]) => If(If(If(Parameter2(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ParameterListMapping(_0), input2]);
|
|
2192
|
+
var _Function_2 = (input) => If(If(Const("(", input), ([_0, input2]) => If(ParameterList(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => If(Const("=>", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [_Function_Mapping(_0), input2]);
|
|
2193
|
+
var _Constructor_ = (input) => If(If(Const("new", input), ([_0, input2]) => If(Const("(", input2), ([_1, input3]) => If(ParameterList(input3), ([_2, input4]) => If(Const(")", input4), ([_3, input5]) => If(Const("=>", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => [[_0, _1, _2, _3, _4, _5], input7])))))), ([_0, input2]) => [_Constructor_Mapping(_0), input2]);
|
|
2194
|
+
var MappedReadonly = (input) => If(If(If(Const("+", input), ([_0, input2]) => If(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("-", input), ([_0, input2]) => If(Const("readonly", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("readonly", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedReadonlyMapping(_0), input2]);
|
|
2195
|
+
var MappedOptional = (input) => If(If(If(Const("+", input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("-", input), ([_0, input2]) => If(Const("?", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const("?", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])))), ([_0, input2]) => [MappedOptionalMapping(_0), input2]);
|
|
2196
|
+
var MappedAs = (input) => If(If(If(Const("as", input), ([_0, input2]) => If(Type(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [MappedAsMapping(_0), input2]);
|
|
2197
|
+
var _Mapped_ = (input) => If(If(Const("{", input), ([_0, input2]) => If(MappedReadonly(input2), ([_1, input3]) => If(Const("[", input3), ([_2, input4]) => If(Ident(input4), ([_3, input5]) => If(Const("in", input5), ([_4, input6]) => If(Type(input6), ([_5, input7]) => If(MappedAs(input7), ([_6, input8]) => If(Const("]", input8), ([_7, input9]) => If(MappedOptional(input9), ([_8, input10]) => If(Const(":", input10), ([_9, input11]) => If(Type(input11), ([_10, input12]) => If(OptionalSemiColon(input12), ([_11, input13]) => If(Const("}", input13), ([_12, input14]) => [[_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12], input14]))))))))))))), ([_0, input2]) => [_Mapped_Mapping(_0), input2]);
|
|
2198
|
+
var Reference = (input) => If(Ident(input), ([_0, input2]) => [ReferenceMapping(_0), input2]);
|
|
2199
|
+
var WithBigInt = (input) => If(BigInt3(input), ([_0, input2]) => [WithBigIntMapping(_0), input2]);
|
|
2200
|
+
var WithNumber = (input) => If(Number3(input), ([_0, input2]) => [WithNumberMapping(_0), input2]);
|
|
2201
|
+
var WithBoolean = (input) => If(If(Const("true", input), ([_0, input2]) => [_0, input2], () => If(Const("false", input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [WithBooleanMapping(_0), input2]);
|
|
2202
|
+
var WithString = (input) => If(String3(['"', "'"], input), ([_0, input2]) => [WithStringMapping(_0), input2]);
|
|
2203
|
+
var WithNull = (input) => If(Const("null", input), ([_0, input2]) => [WithNullMapping(_0), input2]);
|
|
2204
|
+
var WithUndefined = (input) => If(Const("undefined", input), ([_0, input2]) => [WithUndefinedMapping(_0), input2]);
|
|
2205
|
+
var WithProperty = (input) => If(If(PropertyKey(input), ([_0, input2]) => If(Const(":", input2), ([_1, input3]) => If(WithValue(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithPropertyMapping(_0), input2]);
|
|
2206
|
+
var WithPropertyList_0 = (input, result = []) => If(If(WithProperty(input), ([_0, input2]) => If(PropertyDelimiter(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => WithPropertyList_0(input2, [...result, _0]), () => [result, input]);
|
|
2207
|
+
var WithPropertyList = (input) => If(If(WithPropertyList_0(input), ([_0, input2]) => If(If(If(WithProperty(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [WithPropertyListMapping(_0), input2]);
|
|
2208
|
+
var WithObject = (input) => If(If(Const("{", input), ([_0, input2]) => If(WithPropertyList(input2), ([_1, input3]) => If(Const("}", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithObjectMapping(_0), input2]);
|
|
2209
|
+
var WithElementList_0 = (input, result = []) => If(If(WithValue(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => WithElementList_0(input2, [...result, _0]), () => [result, input]);
|
|
2210
|
+
var WithElementList = (input) => If(If(WithElementList_0(input), ([_0, input2]) => If(If(If(WithValue(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [WithElementListMapping(_0), input2]);
|
|
2211
|
+
var WithArray = (input) => If(If(Const("[", input), ([_0, input2]) => If(WithElementList(input2), ([_1, input3]) => If(Const("]", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [WithArrayMapping(_0), input2]);
|
|
2212
|
+
var WithValue = (input) => If(If(WithBigInt(input), ([_0, input2]) => [_0, input2], () => If(WithNumber(input), ([_0, input2]) => [_0, input2], () => If(WithBoolean(input), ([_0, input2]) => [_0, input2], () => If(WithString(input), ([_0, input2]) => [_0, input2], () => If(WithNull(input), ([_0, input2]) => [_0, input2], () => If(WithUndefined(input), ([_0, input2]) => [_0, input2], () => If(WithObject(input), ([_0, input2]) => [_0, input2], () => If(WithArray(input), ([_0, input2]) => [_0, input2], () => [])))))))), ([_0, input2]) => [WithValueMapping(_0), input2]);
|
|
2213
|
+
var PatternBigInt = (input) => If(Const("-?(?:0|[1-9][0-9]*)n", input), ([_0, input2]) => [PatternBigIntMapping(_0), input2]);
|
|
2214
|
+
var PatternString = (input) => If(Const(".*", input), ([_0, input2]) => [PatternStringMapping(_0), input2]);
|
|
2215
|
+
var PatternNumber = (input) => If(Const("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?", input), ([_0, input2]) => [PatternNumberMapping(_0), input2]);
|
|
2216
|
+
var PatternInteger = (input) => If(Const("-?(?:0|[1-9][0-9]*)", input), ([_0, input2]) => [PatternIntegerMapping(_0), input2]);
|
|
2217
|
+
var PatternNever = (input) => If(Const("(?!)", input), ([_0, input2]) => [PatternNeverMapping(_0), input2]);
|
|
2218
|
+
var PatternText = (input) => If(Until_1(["-?(?:0|[1-9][0-9]*)n", ".*", "-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?", "-?(?:0|[1-9][0-9]*)", "(?!)", "(", ")", "$", "|"], input), ([_0, input2]) => [PatternTextMapping(_0), input2]);
|
|
2219
|
+
var PatternBase = (input) => If(If(PatternBigInt(input), ([_0, input2]) => [_0, input2], () => If(PatternString(input), ([_0, input2]) => [_0, input2], () => If(PatternNumber(input), ([_0, input2]) => [_0, input2], () => If(PatternInteger(input), ([_0, input2]) => [_0, input2], () => If(PatternNever(input), ([_0, input2]) => [_0, input2], () => If(PatternGroup(input), ([_0, input2]) => [_0, input2], () => If(PatternText(input), ([_0, input2]) => [_0, input2], () => []))))))), ([_0, input2]) => [PatternBaseMapping(_0), input2]);
|
|
2220
|
+
var PatternGroup = (input) => If(If(Const("(", input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => If(Const(")", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PatternGroupMapping(_0), input2]);
|
|
2221
|
+
var PatternUnion = (input) => If(If(If(PatternTerm(input), ([_0, input2]) => If(Const("|", input2), ([_1, input3]) => If(PatternUnion(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [_0, input2], () => If(If(PatternTerm(input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [PatternUnionMapping(_0), input2]);
|
|
2222
|
+
var PatternTerm = (input) => If(If(PatternBase(input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [PatternTermMapping(_0), input2]);
|
|
2223
|
+
var PatternBody = (input) => If(If(PatternUnion(input), ([_0, input2]) => [_0, input2], () => If(PatternTerm(input), ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [PatternBodyMapping(_0), input2]);
|
|
2224
|
+
var Pattern = (input) => If(If(Const("^", input), ([_0, input2]) => If(PatternBody(input2), ([_1, input3]) => If(Const("$", input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [PatternMapping(_0), input2]);
|
|
2225
|
+
var InterfaceDeclarationHeritageList_0 = (input, result = []) => If(If(Type(input), ([_0, input2]) => If(Const(",", input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => InterfaceDeclarationHeritageList_0(input2, [...result, _0]), () => [result, input]);
|
|
2226
|
+
var InterfaceDeclarationHeritageList = (input) => If(If(InterfaceDeclarationHeritageList_0(input), ([_0, input2]) => If(If(If(Type(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [InterfaceDeclarationHeritageListMapping(_0), input2]);
|
|
2227
|
+
var InterfaceDeclarationHeritage = (input) => If(If(If(Const("extends", input), ([_0, input2]) => If(InterfaceDeclarationHeritageList(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [InterfaceDeclarationHeritageMapping(_0), input2]);
|
|
2228
|
+
var InterfaceDeclarationGeneric = (input) => If(If(Const("interface", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(GenericParameters(input3), ([_2, input4]) => If(InterfaceDeclarationHeritage(input4), ([_3, input5]) => If(Properties(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [InterfaceDeclarationGenericMapping(_0), input2]);
|
|
2229
|
+
var InterfaceDeclaration = (input) => If(If(Const("interface", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(InterfaceDeclarationHeritage(input3), ([_2, input4]) => If(Properties(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [InterfaceDeclarationMapping(_0), input2]);
|
|
2230
|
+
var TypeAliasDeclarationGeneric = (input) => If(If(Const("type", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(GenericParameters(input3), ([_2, input4]) => If(Const("=", input4), ([_3, input5]) => If(Type(input5), ([_4, input6]) => [[_0, _1, _2, _3, _4], input6]))))), ([_0, input2]) => [TypeAliasDeclarationGenericMapping(_0), input2]);
|
|
2231
|
+
var TypeAliasDeclaration = (input) => If(If(Const("type", input), ([_0, input2]) => If(Ident(input2), ([_1, input3]) => If(Const("=", input3), ([_2, input4]) => If(Type(input4), ([_3, input5]) => [[_0, _1, _2, _3], input5])))), ([_0, input2]) => [TypeAliasDeclarationMapping(_0), input2]);
|
|
2232
|
+
var ExportKeyword = (input) => If(If(If(Const("export", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If([[], input], ([_0, input2]) => [_0, input2], () => [])), ([_0, input2]) => [ExportKeywordMapping(_0), input2]);
|
|
2233
|
+
var ModuleDeclarationDelimiter = (input) => If(If(If(Const(";", input), ([_0, input2]) => If(Const(`
|
|
2234
|
+
`, input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [_0, input2], () => If(If(Const(";", input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => If(If(Const(`
|
|
2235
|
+
`, input), ([_0, input2]) => [[_0], input2]), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [ModuleDeclarationDelimiterMapping(_0), input2]);
|
|
2236
|
+
var ModuleDeclarationList_0 = (input, result = []) => If(If(ModuleDeclaration(input), ([_0, input2]) => If(ModuleDeclarationDelimiter(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => ModuleDeclarationList_0(input2, [...result, _0]), () => [result, input]);
|
|
2237
|
+
var ModuleDeclarationList = (input) => If(If(ModuleDeclarationList_0(input), ([_0, input2]) => If(If(If(ModuleDeclaration(input2), ([_02, input3]) => [[_02], input3]), ([_02, input3]) => [_02, input3], () => If([[], input2], ([_02, input3]) => [_02, input3], () => [])), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ModuleDeclarationListMapping(_0), input2]);
|
|
2238
|
+
var ModuleDeclaration = (input) => If(If(ExportKeyword(input), ([_0, input2]) => If(If(InterfaceDeclarationGeneric(input2), ([_02, input3]) => [_02, input3], () => If(InterfaceDeclaration(input2), ([_02, input3]) => [_02, input3], () => If(TypeAliasDeclarationGeneric(input2), ([_02, input3]) => [_02, input3], () => If(TypeAliasDeclaration(input2), ([_02, input3]) => [_02, input3], () => [])))), ([_1, input3]) => If(OptionalSemiColon(input3), ([_2, input4]) => [[_0, _1, _2], input4]))), ([_0, input2]) => [ModuleDeclarationMapping(_0), input2]);
|
|
2239
|
+
var Module = (input) => If(If(ModuleDeclaration(input), ([_0, input2]) => If(ModuleDeclarationList(input2), ([_1, input3]) => [[_0, _1], input3])), ([_0, input2]) => [ModuleMapping(_0), input2]);
|
|
2240
|
+
var Script = (input) => If(If(Module(input), ([_0, input2]) => [_0, input2], () => If(GenericType(input), ([_0, input2]) => [_0, input2], () => If(Type(input), ([_0, input2]) => [_0, input2], () => []))), ([_0, input2]) => [ScriptMapping(_0), input2]);
|
|
2241
|
+
|
|
2242
|
+
// node_modules/typebox/build/type/engine/patterns/template.mjs
|
|
2243
|
+
function ParseTemplateIntoTypes(template) {
|
|
2244
|
+
const parsed = TemplateLiteralTypes(`\`${template}\``);
|
|
2245
|
+
const result = exports_guard.IsEqual(parsed.length, 2) ? parsed[0] : Unreachable();
|
|
2246
|
+
return result;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
// node_modules/typebox/build/type/engine/template_literal/encode.mjs
|
|
2250
|
+
function JoinString(input) {
|
|
2251
|
+
return input.join("|");
|
|
2252
|
+
}
|
|
2253
|
+
function UnwrapTemplateLiteralPattern(pattern) {
|
|
2254
|
+
return pattern.slice(1, pattern.length - 1);
|
|
2255
|
+
}
|
|
2256
|
+
function EncodeLiteral(value, right, pattern) {
|
|
2257
|
+
return EncodeTypes(right, `${pattern}${value}`);
|
|
2258
|
+
}
|
|
2259
|
+
function EncodeBigInt(right, pattern) {
|
|
2260
|
+
return EncodeTypes(right, `${pattern}${BigIntPattern}`);
|
|
2261
|
+
}
|
|
2262
|
+
function EncodeInteger(right, pattern) {
|
|
2263
|
+
return EncodeTypes(right, `${pattern}${IntegerPattern}`);
|
|
2264
|
+
}
|
|
2265
|
+
function EncodeNumber(right, pattern) {
|
|
2266
|
+
return EncodeTypes(right, `${pattern}${NumberPattern}`);
|
|
2267
|
+
}
|
|
2268
|
+
function EncodeBoolean(right, pattern) {
|
|
2269
|
+
return EncodeType(Union([Literal("false"), Literal("true")]), right, pattern);
|
|
2270
|
+
}
|
|
2271
|
+
function EncodeString(right, pattern) {
|
|
2272
|
+
return EncodeTypes(right, `${pattern}${StringPattern}`);
|
|
2273
|
+
}
|
|
2274
|
+
function EncodeTemplateLiteral(templatePattern, right, pattern) {
|
|
2275
|
+
return EncodeTypes(right, `${pattern}${UnwrapTemplateLiteralPattern(templatePattern)}`);
|
|
2276
|
+
}
|
|
2277
|
+
function EncodeTemplateLiteralDeferred(types, right, pattern) {
|
|
2278
|
+
const templateLiteral = TemplateLiteralAction(types, {});
|
|
2279
|
+
const result = EncodeType(templateLiteral, right, pattern);
|
|
2280
|
+
return result;
|
|
2281
|
+
}
|
|
2282
|
+
function EncodeEnum(values, right, pattern) {
|
|
2283
|
+
const evaluated = EvaluateEnum(values);
|
|
2284
|
+
return EncodeType(evaluated, right, pattern);
|
|
2285
|
+
}
|
|
2286
|
+
function EncodeUnion(types, right, pattern, result = []) {
|
|
2287
|
+
return exports_guard.ShiftLeft(types, (head, tail) => EncodeUnion(tail, right, pattern, [...result, EncodeType(head, [], "")]), () => EncodeTypes(right, `${pattern}(${JoinString(result)})`));
|
|
2288
|
+
}
|
|
2289
|
+
function EncodeType(type, right, pattern) {
|
|
2290
|
+
return IsEnum(type) ? EncodeEnum(type.enum, right, pattern) : IsInteger2(type) ? EncodeInteger(right, pattern) : IsLiteral(type) ? EncodeLiteral(type.const, right, pattern) : IsBigInt2(type) ? EncodeBigInt(right, pattern) : IsBoolean3(type) ? EncodeBoolean(right, pattern) : IsNumber3(type) ? EncodeNumber(right, pattern) : IsString3(type) ? EncodeString(right, pattern) : IsTemplateLiteral(type) ? EncodeTemplateLiteral(type.pattern, right, pattern) : IsTemplateLiteralDeferred(type) ? EncodeTemplateLiteralDeferred(type.parameters[0], right, pattern) : IsUnion(type) ? EncodeUnion(type.anyOf, right, pattern) : NeverPattern;
|
|
2291
|
+
}
|
|
2292
|
+
function EncodeTypes(types, pattern) {
|
|
2293
|
+
return exports_guard.ShiftLeft(types, (left, right) => EncodeType(left, right, pattern), () => pattern);
|
|
2294
|
+
}
|
|
2295
|
+
function EncodePattern(types) {
|
|
2296
|
+
const encoded = EncodeTypes(types, "");
|
|
2297
|
+
const result = `^${encoded}$`;
|
|
2298
|
+
return result;
|
|
2299
|
+
}
|
|
2300
|
+
function TemplateLiteralEncode(types) {
|
|
2301
|
+
const pattern = EncodePattern(types);
|
|
2302
|
+
const result = TemplateLiteralCreate(pattern);
|
|
2303
|
+
return result;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
// node_modules/typebox/build/type/engine/template_literal/instantiate.mjs
|
|
2307
|
+
function TemplateLiteralAction(types, options) {
|
|
2308
|
+
const result = CanInstantiate(types) ? exports_memory.Update(TemplateLiteralEncode(types), {}, options) : TemplateLiteralDeferred(types, options);
|
|
2309
|
+
return result;
|
|
2310
|
+
}
|
|
2311
|
+
function TemplateLiteralInstantiate(context, state, types, options) {
|
|
2312
|
+
const instantiatedTypes = InstantiateTypes(context, state, types);
|
|
2313
|
+
return TemplateLiteralAction(instantiatedTypes, options);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
// node_modules/typebox/build/type/types/template_literal.mjs
|
|
2317
|
+
function TemplateLiteralDeferred(types, options = {}) {
|
|
2318
|
+
return Deferred("TemplateLiteral", [types], options);
|
|
2319
|
+
}
|
|
2320
|
+
function IsTemplateLiteralDeferred(value) {
|
|
2321
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "action") && exports_guard.IsEqual(value.action, "TemplateLiteral");
|
|
2322
|
+
}
|
|
2323
|
+
function TemplateLiteralFromTypes(types) {
|
|
2324
|
+
return TemplateLiteralAction(types, {});
|
|
2325
|
+
}
|
|
2326
|
+
function TemplateLiteralFromString(template) {
|
|
2327
|
+
const types = ParseTemplateIntoTypes(template);
|
|
2328
|
+
return TemplateLiteralFromTypes(types);
|
|
2329
|
+
}
|
|
2330
|
+
function TemplateLiteral2(input, options = {}) {
|
|
2331
|
+
const type = exports_guard.IsString(input) ? TemplateLiteralFromString(input) : TemplateLiteralFromTypes(input);
|
|
2332
|
+
return exports_memory.Update(type, {}, options);
|
|
2333
|
+
}
|
|
2334
|
+
function IsTemplateLiteral(value) {
|
|
2335
|
+
return IsKind(value, "TemplateLiteral");
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
// node_modules/typebox/build/type/extends/result.mjs
|
|
2339
|
+
var exports_result = {};
|
|
2340
|
+
__export(exports_result, {
|
|
2341
|
+
Match: () => Match3,
|
|
2342
|
+
IsExtendsUnion: () => IsExtendsUnion,
|
|
2343
|
+
IsExtendsTrueLike: () => IsExtendsTrueLike,
|
|
2344
|
+
IsExtendsTrue: () => IsExtendsTrue,
|
|
2345
|
+
IsExtendsFalse: () => IsExtendsFalse,
|
|
2346
|
+
ExtendsUnion: () => ExtendsUnion,
|
|
2347
|
+
ExtendsTrue: () => ExtendsTrue,
|
|
2348
|
+
ExtendsFalse: () => ExtendsFalse
|
|
2349
|
+
});
|
|
2350
|
+
function ExtendsUnion(inferred) {
|
|
2351
|
+
return exports_memory.Create({ ["~kind"]: "ExtendsUnion" }, { inferred });
|
|
2352
|
+
}
|
|
2353
|
+
function IsExtendsUnion(value) {
|
|
2354
|
+
return exports_guard.IsObject(value) && exports_guard.HasPropertyKey(value, "~kind") && exports_guard.HasPropertyKey(value, "inferred") && exports_guard.IsEqual(value["~kind"], "ExtendsUnion") && exports_guard.IsObject(value.inferred);
|
|
2355
|
+
}
|
|
2356
|
+
function ExtendsTrue(inferred) {
|
|
2357
|
+
return exports_memory.Create({ ["~kind"]: "ExtendsTrue" }, { inferred });
|
|
2358
|
+
}
|
|
2359
|
+
function IsExtendsTrue(value) {
|
|
2360
|
+
return exports_guard.IsObject(value) && exports_guard.HasPropertyKey(value, "~kind") && exports_guard.HasPropertyKey(value, "inferred") && exports_guard.IsEqual(value["~kind"], "ExtendsTrue") && exports_guard.IsObject(value.inferred);
|
|
2361
|
+
}
|
|
2362
|
+
function ExtendsFalse() {
|
|
2363
|
+
return exports_memory.Create({ ["~kind"]: "ExtendsFalse" }, {});
|
|
2364
|
+
}
|
|
2365
|
+
function IsExtendsFalse(value) {
|
|
2366
|
+
return exports_guard.IsObject(value) && exports_guard.HasPropertyKey(value, "~kind") && exports_guard.IsEqual(value["~kind"], "ExtendsFalse");
|
|
2367
|
+
}
|
|
2368
|
+
function IsExtendsTrueLike(value) {
|
|
2369
|
+
return IsExtendsUnion(value) || IsExtendsTrue(value);
|
|
2370
|
+
}
|
|
2371
|
+
function Match3(result, true_, false_) {
|
|
2372
|
+
return IsExtendsTrueLike(result) ? true_(result.inferred) : false_();
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
// node_modules/typebox/build/type/extends/extends_right.mjs
|
|
2376
|
+
function ExtendsRightInfer(inferred, name, left, right) {
|
|
2377
|
+
return Match3(ExtendsLeft(inferred, left, right), (checkInferred) => ExtendsTrue(exports_memory.Assign(exports_memory.Assign(inferred, checkInferred), { [name]: left })), () => ExtendsFalse());
|
|
2378
|
+
}
|
|
2379
|
+
function ExtendsRightAny(inferred, _left) {
|
|
2380
|
+
return ExtendsTrue(inferred);
|
|
2381
|
+
}
|
|
2382
|
+
function ExtendsRightDependent(inferred, left, if_, then_, else_) {
|
|
2383
|
+
return Match3(ExtendsLeft(inferred, left, if_), (inferred2) => Match3(ExtendsLeft(inferred2, left, then_), (inferred3) => ExtendsTrue(inferred3), () => ExtendsFalse()), () => Match3(ExtendsLeft(inferred, left, else_), (inferred2) => ExtendsTrue(inferred2), () => ExtendsFalse()));
|
|
2384
|
+
}
|
|
2385
|
+
function ExtendsRightEnum(inferred, left, right) {
|
|
2386
|
+
const evaluated = EvaluateEnum(right);
|
|
2387
|
+
return ExtendsLeft(inferred, left, evaluated);
|
|
2388
|
+
}
|
|
2389
|
+
function ExtendsRightIntersect(inferred, left, right) {
|
|
2390
|
+
return exports_guard.ShiftLeft(right, (head, tail) => Match3(ExtendsLeft(inferred, left, head), (inferred2) => ExtendsRightIntersect(inferred2, left, tail), () => ExtendsFalse()), () => ExtendsTrue(inferred));
|
|
2391
|
+
}
|
|
2392
|
+
function ExtendsRightTemplateLiteral(inferred, left, right) {
|
|
2393
|
+
const evaluated = EvaluateTemplateLiteral(right);
|
|
2394
|
+
return ExtendsLeft(inferred, left, evaluated);
|
|
2395
|
+
}
|
|
2396
|
+
function ExtendsRightUnion(inferred, left, right) {
|
|
2397
|
+
return exports_guard.ShiftLeft(right, (head, tail) => Match3(ExtendsLeft(inferred, left, head), (inferred2) => ExtendsTrue(inferred2), () => ExtendsRightUnion(inferred, left, tail)), () => ExtendsFalse());
|
|
2398
|
+
}
|
|
2399
|
+
function ExtendsRight(inferred, left, right) {
|
|
2400
|
+
return IsAny(right) ? ExtendsRightAny(inferred, left) : IsDependent(right) ? ExtendsRightDependent(inferred, left, right.if, right.then, right.else) : IsEnum(right) ? ExtendsRightEnum(inferred, left, right.enum) : IsInfer(right) ? ExtendsRightInfer(inferred, right.name, left, right.extends) : IsIntersect(right) ? ExtendsRightIntersect(inferred, left, right.allOf) : IsTemplateLiteral(right) ? ExtendsRightTemplateLiteral(inferred, left, right.pattern) : IsUnion(right) ? ExtendsRightUnion(inferred, left, right.anyOf) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
// node_modules/typebox/build/type/extends/any.mjs
|
|
2404
|
+
function ExtendsAny(inferred, left, right) {
|
|
2405
|
+
return IsInfer(right) ? ExtendsRight(inferred, left, right) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsUnion(inferred);
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
// node_modules/typebox/build/type/extends/array.mjs
|
|
2409
|
+
function ExtendsImmutable(left, right) {
|
|
2410
|
+
const isImmutableLeft = IsImmutable(left);
|
|
2411
|
+
const isImmutableRight = IsImmutable(right);
|
|
2412
|
+
return isImmutableLeft && isImmutableRight ? true : !isImmutableLeft && isImmutableRight ? true : isImmutableLeft && !isImmutableRight ? false : true;
|
|
2413
|
+
}
|
|
2414
|
+
function ExtendsArray(inferred, arrayLeft, left, right) {
|
|
2415
|
+
return IsArray2(right) ? ExtendsImmutable(arrayLeft, right) ? ExtendsLeft(inferred, left, right.items) : ExtendsFalse() : ExtendsRight(inferred, arrayLeft, right);
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
// node_modules/typebox/build/type/extends/bigint.mjs
|
|
2419
|
+
function ExtendsBigInt(inferred, left, right) {
|
|
2420
|
+
return IsBigInt2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// node_modules/typebox/build/type/extends/boolean.mjs
|
|
2424
|
+
function ExtendsBoolean(inferred, left, right) {
|
|
2425
|
+
return IsBoolean3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
// node_modules/typebox/build/type/extends/parameters.mjs
|
|
2429
|
+
function ParameterCompare(inferred, left, leftRest, right, rightRest) {
|
|
2430
|
+
const checkLeft = IsInfer(right) ? left : right;
|
|
2431
|
+
const checkRight = IsInfer(right) ? right : left;
|
|
2432
|
+
const isLeftOptional = IsOptional(left);
|
|
2433
|
+
const isRightOptional = IsOptional(right);
|
|
2434
|
+
return !isLeftOptional && isRightOptional ? ExtendsFalse() : Match3(ExtendsLeft(inferred, checkLeft, checkRight), (inferred2) => ExtendsParameters(inferred2, leftRest, rightRest), () => ExtendsFalse());
|
|
2435
|
+
}
|
|
2436
|
+
function ParameterRight(inferred, left, leftRest, rightRest) {
|
|
2437
|
+
return exports_guard.ShiftLeft(rightRest, (head, tail) => ParameterCompare(inferred, left, leftRest, head, tail), () => IsOptional(left) ? ExtendsTrue(inferred) : ExtendsFalse());
|
|
2438
|
+
}
|
|
2439
|
+
function ParametersLeft(inferred, left, rightRest) {
|
|
2440
|
+
return exports_guard.ShiftLeft(left, (head, tail) => ParameterRight(inferred, head, tail, rightRest), () => ExtendsTrue(inferred));
|
|
2441
|
+
}
|
|
2442
|
+
function ExtendsParameters(inferred, left, right) {
|
|
2443
|
+
return ParametersLeft(inferred, left, right);
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
// node_modules/typebox/build/type/extends/return_type.mjs
|
|
2447
|
+
function ExtendsReturnType(inferred, left, right) {
|
|
2448
|
+
return IsVoid(right) ? ExtendsTrue(inferred) : ExtendsLeft(inferred, left, right);
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
// node_modules/typebox/build/type/extends/constructor.mjs
|
|
2452
|
+
function ExtendsConstructor(inferred, parameters, returnType, right) {
|
|
2453
|
+
return IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : IsConstructor2(right) ? Match3(ExtendsParameters(inferred, parameters, right["parameters"]), (inferred2) => ExtendsReturnType(inferred2, returnType, right["instanceType"]), () => ExtendsFalse()) : ExtendsFalse();
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// node_modules/typebox/build/type/extends/dependent.mjs
|
|
2457
|
+
function ExtendsDependent(inferred, if_, then_, else_, right) {
|
|
2458
|
+
return Match3(ExtendsLeft(inferred, if_, right), () => ExtendsLeft(inferred, then_, right), () => ExtendsLeft(inferred, else_, right));
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
// node_modules/typebox/build/type/extends/enum.mjs
|
|
2462
|
+
function ExtendsEnum(inferred, left, right) {
|
|
2463
|
+
const evaluated = EvaluateEnum(left);
|
|
2464
|
+
return ExtendsLeft(inferred, evaluated, right);
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
// node_modules/typebox/build/type/extends/function.mjs
|
|
2468
|
+
function ExtendsFunction(inferred, parameters, returnType, right) {
|
|
2469
|
+
return IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : IsFunction2(right) ? Match3(ExtendsParameters(inferred, parameters, right["parameters"]), (inferred2) => ExtendsReturnType(inferred2, returnType, right["returnType"]), () => ExtendsFalse()) : ExtendsFalse();
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
// node_modules/typebox/build/type/extends/integer.mjs
|
|
2473
|
+
function ExtendsInteger(inferred, left, right) {
|
|
2474
|
+
return IsInteger2(right) ? ExtendsTrue(inferred) : IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
// node_modules/typebox/build/type/extends/intersect.mjs
|
|
2478
|
+
function ExtendsIntersect(inferred, left, right) {
|
|
2479
|
+
const evaluated = EvaluateIntersect(left);
|
|
2480
|
+
return ExtendsLeft(inferred, evaluated, right);
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
// node_modules/typebox/build/type/extends/literal.mjs
|
|
2484
|
+
function ExtendsLiteralValue(inferred, left, right) {
|
|
2485
|
+
return left === right ? ExtendsTrue(inferred) : ExtendsFalse();
|
|
2486
|
+
}
|
|
2487
|
+
function ExtendsLiteralBigInt(inferred, left, right) {
|
|
2488
|
+
return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsBigInt2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
|
|
2489
|
+
}
|
|
2490
|
+
function ExtendsLiteralBoolean(inferred, left, right) {
|
|
2491
|
+
return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsBoolean3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
|
|
2492
|
+
}
|
|
2493
|
+
function ExtendsLiteralNumber(inferred, left, right) {
|
|
2494
|
+
return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
|
|
2495
|
+
}
|
|
2496
|
+
function ExtendsLiteralString(inferred, left, right) {
|
|
2497
|
+
return IsLiteral(right) ? ExtendsLiteralValue(inferred, left, right.const) : IsString3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, Literal(left), right);
|
|
2498
|
+
}
|
|
2499
|
+
function ExtendsLiteral(inferred, left, right) {
|
|
2500
|
+
return exports_guard.IsBigInt(left.const) ? ExtendsLiteralBigInt(inferred, left.const, right) : exports_guard.IsBoolean(left.const) ? ExtendsLiteralBoolean(inferred, left.const, right) : exports_guard.IsNumber(left.const) ? ExtendsLiteralNumber(inferred, left.const, right) : exports_guard.IsString(left.const) ? ExtendsLiteralString(inferred, left.const, right) : Unreachable();
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
// node_modules/typebox/build/type/extends/never.mjs
|
|
2504
|
+
function ExtendsNever(inferred, left, right) {
|
|
2505
|
+
return IsInfer(right) ? ExtendsRight(inferred, left, right) : ExtendsTrue(inferred);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
// node_modules/typebox/build/type/extends/null.mjs
|
|
2509
|
+
function ExtendsNull(inferred, left, right) {
|
|
2510
|
+
return IsNull2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
// node_modules/typebox/build/type/extends/number.mjs
|
|
2514
|
+
function ExtendsNumber(inferred, left, right) {
|
|
2515
|
+
return IsNumber3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
// node_modules/typebox/build/type/extends/object.mjs
|
|
2519
|
+
function ExtendsPropertyOptional(inferred, left, right) {
|
|
2520
|
+
return IsOptional(left) ? IsOptional(right) ? ExtendsTrue(inferred) : ExtendsFalse() : ExtendsTrue(inferred);
|
|
2521
|
+
}
|
|
2522
|
+
function ExtendsProperty(inferred, left, right) {
|
|
2523
|
+
return IsInfer(right) && IsNever(right.extends) ? ExtendsFalse() : Match3(ExtendsLeft(inferred, left, right), (inferred2) => ExtendsPropertyOptional(inferred2, left, right), () => ExtendsFalse());
|
|
2524
|
+
}
|
|
2525
|
+
function ExtractInferredProperties(keys, properties2) {
|
|
2526
|
+
return keys.reduce((result, key) => {
|
|
2527
|
+
return key in properties2 ? IsExtendsTrueLike(properties2[key]) ? { ...result, ...properties2[key].inferred } : Unreachable() : Unreachable();
|
|
2528
|
+
}, {});
|
|
2529
|
+
}
|
|
2530
|
+
function ExtendsPropertiesComparer(inferred, left, right) {
|
|
2531
|
+
const properties2 = {};
|
|
2532
|
+
for (const rightKey of exports_guard.Keys(right)) {
|
|
2533
|
+
properties2[rightKey] = rightKey in left ? ExtendsProperty({}, left[rightKey], right[rightKey]) : IsOptional(right[rightKey]) ? IsInfer(right[rightKey]) ? ExtendsTrue(exports_memory.Assign(inferred, { [right[rightKey].name]: right[rightKey].extends })) : ExtendsTrue(inferred) : ExtendsFalse();
|
|
2534
|
+
}
|
|
2535
|
+
const checked = exports_guard.Values(properties2).every((result) => IsExtendsTrueLike(result));
|
|
2536
|
+
const extracted = checked ? ExtractInferredProperties(exports_guard.Keys(properties2), properties2) : {};
|
|
2537
|
+
return checked ? ExtendsTrue(extracted) : ExtendsFalse();
|
|
2538
|
+
}
|
|
2539
|
+
function ExtendsProperties(inferred, left, right) {
|
|
2540
|
+
const compared = ExtendsPropertiesComparer(inferred, left, right);
|
|
2541
|
+
return IsExtendsTrueLike(compared) ? ExtendsTrue(exports_memory.Assign(inferred, compared.inferred)) : ExtendsFalse();
|
|
2542
|
+
}
|
|
2543
|
+
function ExtendsObjectToObject(inferred, left, right) {
|
|
2544
|
+
return ExtendsProperties(inferred, left, right);
|
|
2545
|
+
}
|
|
2546
|
+
function RecordMergeInferred(left, right) {
|
|
2547
|
+
return exports_guard.Keys(right).reduce((result, key) => {
|
|
2548
|
+
return {
|
|
2549
|
+
...result,
|
|
2550
|
+
[key]: exports_guard.HasPropertyKey(left, key) ? IsUnion(result[key]) ? Union([...result[key].anyOf, right[key]]) : Union([left[key], right[key]]) : right[key]
|
|
2551
|
+
};
|
|
2552
|
+
}, left);
|
|
2553
|
+
}
|
|
2554
|
+
function ExtendsRecordComparer(properties2, keys, type, result) {
|
|
2555
|
+
return exports_guard.ShiftLeft(keys, (left, right) => Match3(ExtendsLeft({}, properties2[left], type), (inferred) => ExtendsRecordComparer(properties2, right, type, RecordMergeInferred(result, inferred)), () => ExtendsFalse()), () => ExtendsTrue(result));
|
|
2556
|
+
}
|
|
2557
|
+
function ExtendsObjectToRecord(inferred, properties2, _pattern, value) {
|
|
2558
|
+
const keys = exports_guard.Keys(properties2);
|
|
2559
|
+
const result = ExtendsRecordComparer(properties2, keys, value, inferred);
|
|
2560
|
+
return result;
|
|
2561
|
+
}
|
|
2562
|
+
function ExtendsObject(inferred, left, right) {
|
|
2563
|
+
return IsRecord(right) ? ExtendsObjectToRecord(inferred, left, RecordPattern(right), RecordValue(right)) : IsObject2(right) ? ExtendsObjectToObject(inferred, left, right.properties) : ExtendsRight(inferred, _Object_(left), right);
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
// node_modules/typebox/build/type/extends/record.mjs
|
|
2567
|
+
function FromObject2(inferred, properties2) {
|
|
2568
|
+
return exports_guard.IsEqual(exports_guard.Keys(properties2).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
|
|
2569
|
+
}
|
|
2570
|
+
function FromRecord(inferred, _leftKey, leftValue, _rightKey, rightValue) {
|
|
2571
|
+
return ExtendsLeft(inferred, leftValue, rightValue);
|
|
2572
|
+
}
|
|
2573
|
+
function ExtendsRecord(inferred, leftPattern, leftValue, right) {
|
|
2574
|
+
return IsRecord(right) ? FromRecord(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject2(right) ? FromObject2(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
// node_modules/typebox/build/type/extends/string.mjs
|
|
2578
|
+
function ExtendsString(inferred, left, right) {
|
|
2579
|
+
return IsString3(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// node_modules/typebox/build/type/extends/symbol.mjs
|
|
2583
|
+
function ExtendsSymbol(inferred, left, right) {
|
|
2584
|
+
return IsSymbol2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
// node_modules/typebox/build/type/extends/template_literal.mjs
|
|
2588
|
+
function ExtendsTemplateLiteral(inferred, left, right) {
|
|
2589
|
+
const evaluated = EvaluateTemplateLiteral(left);
|
|
2590
|
+
return ExtendsLeft(inferred, evaluated, right);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
// node_modules/typebox/build/type/extends/inference.mjs
|
|
2594
|
+
function Inferrable(name, type) {
|
|
2595
|
+
return exports_memory.Create({ "~kind": "Inferrable" }, { name, type }, {});
|
|
2596
|
+
}
|
|
2597
|
+
function IsInferable(value) {
|
|
2598
|
+
return exports_guard.IsObject(value) && exports_guard.HasPropertyKey(value, "~kind") && exports_guard.HasPropertyKey(value, "name") && exports_guard.HasPropertyKey(value, "type") && exports_guard.IsEqual(value["~kind"], "Inferrable") && exports_guard.IsString(value.name) && exports_guard.IsObject(value.type);
|
|
2599
|
+
}
|
|
2600
|
+
function TryRestInferable(type) {
|
|
2601
|
+
return IsRest(type) ? IsInfer(type.items) ? IsArray2(type.items.extends) ? Inferrable(type.items.name, type.items.extends.items) : IsUnknown(type.items.extends) ? Inferrable(type.items.name, type.items.extends) : undefined : Unreachable() : undefined;
|
|
2602
|
+
}
|
|
2603
|
+
function TryInferable(type) {
|
|
2604
|
+
return IsInfer(type) ? Inferrable(type.name, type.extends) : undefined;
|
|
2605
|
+
}
|
|
2606
|
+
function TryInferResults(rest3, right, result = []) {
|
|
2607
|
+
return exports_guard.ShiftLeft(rest3, (head, tail) => Match3(ExtendsLeft({}, head, right), () => TryInferResults(tail, right, [...result, head]), () => {
|
|
2608
|
+
return;
|
|
2609
|
+
}), () => result);
|
|
2610
|
+
}
|
|
2611
|
+
function InferTupleResult(inferred, name, left, right) {
|
|
2612
|
+
const results = TryInferResults(left, right);
|
|
2613
|
+
return exports_guard.IsArray(results) ? ExtendsTrue(exports_memory.Assign(inferred, { [name]: Tuple(results) })) : ExtendsFalse();
|
|
2614
|
+
}
|
|
2615
|
+
function InferUnionResult(inferred, name, left, right) {
|
|
2616
|
+
const results = TryInferResults(left, right);
|
|
2617
|
+
return exports_guard.IsArray(results) ? ExtendsTrue(exports_memory.Assign(inferred, { [name]: Union(results) })) : ExtendsFalse();
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
// node_modules/typebox/build/type/extends/tuple.mjs
|
|
2621
|
+
function Reverse(types) {
|
|
2622
|
+
return [...types].reverse();
|
|
2623
|
+
}
|
|
2624
|
+
function ApplyReverse(types, reversed) {
|
|
2625
|
+
return reversed ? Reverse(types) : types;
|
|
2626
|
+
}
|
|
2627
|
+
function Reversed(types) {
|
|
2628
|
+
const first = types.length > 0 ? types[0] : undefined;
|
|
2629
|
+
const inferrable = IsSchema(first) ? TryRestInferable(first) : undefined;
|
|
2630
|
+
return IsSchema(inferrable);
|
|
2631
|
+
}
|
|
2632
|
+
function ElementsCompare(inferred, reversed, left, leftRest, right, rightRest) {
|
|
2633
|
+
return Match3(ExtendsLeft(inferred, left, right), (checkInferred) => Elements(checkInferred, reversed, leftRest, rightRest), () => ExtendsFalse());
|
|
2634
|
+
}
|
|
2635
|
+
function ElementsLeft(inferred, reversed, leftRest, right, rightRest) {
|
|
2636
|
+
const inferable = TryRestInferable(right);
|
|
2637
|
+
return IsInferable(inferable) ? InferTupleResult(inferred, inferable["name"], ApplyReverse(leftRest, reversed), inferable["type"]) : exports_guard.ShiftLeft(leftRest, (head, tail) => ElementsCompare(inferred, reversed, head, tail, right, rightRest), () => ExtendsFalse());
|
|
2638
|
+
}
|
|
2639
|
+
function ElementsRight(inferred, reversed, leftRest, rightRest) {
|
|
2640
|
+
return exports_guard.ShiftLeft(rightRest, (head, tail) => ElementsLeft(inferred, reversed, leftRest, head, tail), () => exports_guard.IsEqual(leftRest.length, 0) ? ExtendsTrue(inferred) : ExtendsFalse());
|
|
2641
|
+
}
|
|
2642
|
+
function Elements(inferred, reversed, leftRest, rightRest) {
|
|
2643
|
+
return ElementsRight(inferred, reversed, leftRest, rightRest);
|
|
2644
|
+
}
|
|
2645
|
+
function ExtendsTupleToTuple(inferred, left, right) {
|
|
2646
|
+
const instantiatedRight = InstantiateElements(inferred, State([], []), right);
|
|
2647
|
+
const reversed = Reversed(instantiatedRight);
|
|
2648
|
+
return Elements(inferred, reversed, ApplyReverse(left, reversed), ApplyReverse(instantiatedRight, reversed));
|
|
2649
|
+
}
|
|
2650
|
+
function ExtendsTupleToArray(inferred, left, right) {
|
|
2651
|
+
const inferrable = TryInferable(right);
|
|
2652
|
+
return IsInferable(inferrable) ? InferUnionResult(inferred, inferrable["name"], left, inferrable["type"]) : exports_guard.ShiftLeft(left, (head, tail) => Match3(ExtendsLeft(inferred, head, right), (inferred2) => ExtendsTupleToArray(inferred2, tail, right), () => ExtendsFalse()), () => ExtendsTrue(inferred));
|
|
2653
|
+
}
|
|
2654
|
+
function ExtendsTuple(inferred, left, right) {
|
|
2655
|
+
const instantiatedLeft = InstantiateElements(inferred, State([], []), left);
|
|
2656
|
+
return IsTuple(right) ? ExtendsTupleToTuple(inferred, instantiatedLeft, right.items) : IsArray2(right) ? ExtendsTupleToArray(inferred, instantiatedLeft, right.items) : ExtendsRight(inferred, Tuple(instantiatedLeft), right);
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
// node_modules/typebox/build/type/extends/undefined.mjs
|
|
2660
|
+
function ExtendsUndefined(inferred, left, right) {
|
|
2661
|
+
return IsVoid(right) ? ExtendsTrue(inferred) : IsUndefined2(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
// node_modules/typebox/build/type/extends/union.mjs
|
|
2665
|
+
function ExtendsUnionSome(inferred, type, unionTypes) {
|
|
2666
|
+
return exports_guard.ShiftLeft(unionTypes, (head, tail) => Match3(ExtendsLeft(inferred, type, head), (inferred2) => ExtendsTrue(inferred2), () => ExtendsUnionSome(inferred, type, tail)), () => ExtendsFalse());
|
|
2667
|
+
}
|
|
2668
|
+
function ExtendsUnionLeft(inferred, left, right) {
|
|
2669
|
+
return exports_guard.ShiftLeft(left, (head, tail) => Match3(ExtendsUnionSome(inferred, head, right), (inferred2) => ExtendsUnionLeft(inferred2, tail, right), () => ExtendsFalse()), () => ExtendsTrue(inferred));
|
|
2670
|
+
}
|
|
2671
|
+
function ExtendsUnion2(inferred, left, right) {
|
|
2672
|
+
const inferrable = TryInferable(right);
|
|
2673
|
+
return IsInferable(inferrable) ? InferUnionResult(inferred, inferrable.name, left, inferrable.type) : IsUnion(right) ? ExtendsUnionLeft(inferred, left, right.anyOf) : ExtendsUnionLeft(inferred, left, [right]);
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
// node_modules/typebox/build/type/extends/unknown.mjs
|
|
2677
|
+
function ExtendsUnknown(inferred, left, right) {
|
|
2678
|
+
return IsInfer(right) ? ExtendsRight(inferred, left, right) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
// node_modules/typebox/build/type/extends/void.mjs
|
|
2682
|
+
function ExtendsVoid(inferred, left, right) {
|
|
2683
|
+
return IsVoid(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
// node_modules/typebox/build/type/extends/extends_left.mjs
|
|
2687
|
+
function ExtendsLeft(inferred, left, right) {
|
|
2688
|
+
return IsAny(left) ? ExtendsAny(inferred, left, right) : IsArray2(left) ? ExtendsArray(inferred, left, left.items, right) : IsBigInt2(left) ? ExtendsBigInt(inferred, left, right) : IsBoolean3(left) ? ExtendsBoolean(inferred, left, right) : IsConstructor2(left) ? ExtendsConstructor(inferred, left.parameters, left.instanceType, right) : IsDependent(left) ? ExtendsDependent(inferred, left.if, left.then, left.else, right) : IsEnum(left) ? ExtendsEnum(inferred, left.enum, right) : IsFunction2(left) ? ExtendsFunction(inferred, left.parameters, left.returnType, right) : IsInteger2(left) ? ExtendsInteger(inferred, left, right) : IsIntersect(left) ? ExtendsIntersect(inferred, left.allOf, right) : IsLiteral(left) ? ExtendsLiteral(inferred, left, right) : IsNever(left) ? ExtendsNever(inferred, left, right) : IsNull2(left) ? ExtendsNull(inferred, left, right) : IsNumber3(left) ? ExtendsNumber(inferred, left, right) : IsObject2(left) ? ExtendsObject(inferred, left.properties, right) : IsRecord(left) ? ExtendsRecord(inferred, RecordPattern(left), RecordValue(left), right) : IsString3(left) ? ExtendsString(inferred, left, right) : IsSymbol2(left) ? ExtendsSymbol(inferred, left, right) : IsTemplateLiteral(left) ? ExtendsTemplateLiteral(inferred, left.pattern, right) : IsTuple(left) ? ExtendsTuple(inferred, left.items, right) : IsUndefined2(left) ? ExtendsUndefined(inferred, left, right) : IsUnion(left) ? ExtendsUnion2(inferred, left.anyOf, right) : IsUnknown(left) ? ExtendsUnknown(inferred, left, right) : IsVoid(left) ? ExtendsVoid(inferred, left, right) : ExtendsFalse();
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
// node_modules/typebox/build/type/engine/interface/instantiate.mjs
|
|
2692
|
+
function InterfaceOperation(heritage, properties2) {
|
|
2693
|
+
const result = EvaluateIntersect([...heritage, _Object_(properties2)]);
|
|
2694
|
+
return result;
|
|
2695
|
+
}
|
|
2696
|
+
function InterfaceAction(heritage, properties2, options) {
|
|
2697
|
+
const result = CanInstantiate(heritage) ? exports_memory.Update(InterfaceOperation(heritage, properties2), {}, options) : InterfaceDeferred(heritage, properties2, options);
|
|
2698
|
+
return result;
|
|
2699
|
+
}
|
|
2700
|
+
function InterfaceInstantiate(context, state, heritage, properties2, options) {
|
|
2701
|
+
const instantiatedHeritage = InstantiateTypes(context, state, heritage);
|
|
2702
|
+
const instantiatedProperties = InstantiateProperties(context, state, properties2);
|
|
2703
|
+
return InterfaceAction(instantiatedHeritage, instantiatedProperties, options);
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
// node_modules/typebox/build/type/action/interface.mjs
|
|
2707
|
+
function InterfaceDeferred(heritage, properties2, options = {}) {
|
|
2708
|
+
return Deferred("Interface", [heritage, properties2], options);
|
|
2709
|
+
}
|
|
2710
|
+
function IsInterfaceDeferred(value) {
|
|
2711
|
+
return IsSchema(value) && exports_guard.HasPropertyKey(value, "action") && exports_guard.IsEqual(value.action, "Interface");
|
|
2712
|
+
}
|
|
2713
|
+
function Interface(heritage, properties2, options = {}) {
|
|
2714
|
+
return InterfaceAction(heritage, properties2, options);
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
// node_modules/typebox/build/type/engine/cyclic/check.mjs
|
|
2718
|
+
function FromRef(stack, context, ref2) {
|
|
2719
|
+
return stack.includes(ref2) ? true : FromType3([...stack, ref2], context, context[ref2]);
|
|
2720
|
+
}
|
|
2721
|
+
function FromProperties(stack, context, properties2) {
|
|
2722
|
+
const types = PropertyValues(properties2);
|
|
2723
|
+
return FromTypes2(stack, context, types);
|
|
2724
|
+
}
|
|
2725
|
+
function FromTypes2(stack, context, types) {
|
|
2726
|
+
return exports_guard.ShiftLeft(types, (left, right) => FromType3(stack, context, left) ? true : FromTypes2(stack, context, right), () => false);
|
|
2727
|
+
}
|
|
2728
|
+
function FromType3(stack, context, type) {
|
|
2729
|
+
return IsRef(type) ? FromRef(stack, context, type.$ref) : IsArray2(type) ? FromType3(stack, context, type.items) : IsConstructor2(type) ? FromTypes2(stack, context, [...type.parameters, type.instanceType]) : IsFunction2(type) ? FromTypes2(stack, context, [...type.parameters, type.returnType]) : IsInterfaceDeferred(type) ? FromProperties(stack, context, type.parameters[1]) : IsIntersect(type) ? FromTypes2(stack, context, type.allOf) : IsObject2(type) ? FromProperties(stack, context, type.properties) : IsUnion(type) ? FromTypes2(stack, context, type.anyOf) : IsTuple(type) ? FromTypes2(stack, context, type.items) : IsRecord(type) ? FromType3(stack, context, RecordValue(type)) : false;
|
|
2730
|
+
}
|
|
2731
|
+
function CyclicCheck(stack, context, type) {
|
|
2732
|
+
const result = FromType3(stack, context, type);
|
|
2733
|
+
return result;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
// node_modules/typebox/build/type/engine/cyclic/candidates.mjs
|
|
2737
|
+
function ResolveCandidateKeys(context, keys) {
|
|
2738
|
+
return keys.reduce((result, left) => {
|
|
2739
|
+
return CyclicCheck([left], context, context[left]) ? [...result, left] : result;
|
|
2740
|
+
}, []);
|
|
2741
|
+
}
|
|
2742
|
+
function CyclicCandidates(context) {
|
|
2743
|
+
const keys = PropertyKeys(context);
|
|
2744
|
+
const result = ResolveCandidateKeys(context, keys);
|
|
2745
|
+
return result;
|
|
2746
|
+
}
|
|
2747
|
+
// node_modules/typebox/build/type/engine/cyclic/dependencies.mjs
|
|
2748
|
+
function FromRef2(context, ref2, result) {
|
|
2749
|
+
return result.includes(ref2) ? result : (ref2 in context) ? FromType4(context, context[ref2], [...result, ref2]) : Unreachable();
|
|
2750
|
+
}
|
|
2751
|
+
function FromProperties2(context, properties2, result) {
|
|
2752
|
+
const types = PropertyValues(properties2);
|
|
2753
|
+
return FromTypes3(context, types, result);
|
|
2754
|
+
}
|
|
2755
|
+
function FromTypes3(context, types, result) {
|
|
2756
|
+
return types.reduce((result2, left) => {
|
|
2757
|
+
return FromType4(context, left, result2);
|
|
2758
|
+
}, result);
|
|
2759
|
+
}
|
|
2760
|
+
function FromType4(context, type, result) {
|
|
2761
|
+
return IsRef(type) ? FromRef2(context, type.$ref, result) : IsArray2(type) ? FromType4(context, type.items, result) : IsConstructor2(type) ? FromTypes3(context, [...type.parameters, type.instanceType], result) : IsFunction2(type) ? FromTypes3(context, [...type.parameters, type.returnType], result) : IsInterfaceDeferred(type) ? FromProperties2(context, type.parameters[1], result) : IsIntersect(type) ? FromTypes3(context, type.allOf, result) : IsObject2(type) ? FromProperties2(context, type.properties, result) : IsUnion(type) ? FromTypes3(context, type.anyOf, result) : IsTuple(type) ? FromTypes3(context, type.items, result) : IsRecord(type) ? FromType4(context, RecordValue(type), result) : result;
|
|
2762
|
+
}
|
|
2763
|
+
function CyclicDependencies(context, key, type) {
|
|
2764
|
+
const result = FromType4(context, type, [key]);
|
|
2765
|
+
return result;
|
|
2766
|
+
}
|
|
2767
|
+
// node_modules/typebox/build/type/engine/cyclic/extends.mjs
|
|
2768
|
+
function FromRef3(_ref) {
|
|
2769
|
+
return Any();
|
|
2770
|
+
}
|
|
2771
|
+
function FromProperties3(properties2) {
|
|
2772
|
+
return exports_guard.Keys(properties2).reduce((result, key) => {
|
|
2773
|
+
return { ...result, [key]: FromType5(properties2[key]) };
|
|
2774
|
+
}, {});
|
|
2775
|
+
}
|
|
2776
|
+
function FromTypes4(types) {
|
|
2777
|
+
return types.reduce((result, left) => {
|
|
2778
|
+
return [...result, FromType5(left)];
|
|
2779
|
+
}, []);
|
|
2780
|
+
}
|
|
2781
|
+
function FromType5(type) {
|
|
2782
|
+
return IsRef(type) ? FromRef3(type.$ref) : IsArray2(type) ? _Array_(FromType5(type.items), ArrayOptions(type)) : IsConstructor2(type) ? Constructor(FromTypes4(type.parameters), FromType5(type.instanceType)) : IsFunction2(type) ? _Function_(FromTypes4(type.parameters), FromType5(type.returnType)) : IsIntersect(type) ? Intersect(FromTypes4(type.allOf)) : IsObject2(type) ? _Object_(FromProperties3(type.properties)) : IsRecord(type) ? Record(RecordKey(type), FromType5(RecordValue(type))) : IsUnion(type) ? Union(FromTypes4(type.anyOf)) : IsTuple(type) ? Tuple(FromTypes4(type.items)) : type;
|
|
2783
|
+
}
|
|
2784
|
+
function CyclicAnyFromParameters(defs, ref2) {
|
|
2785
|
+
return ref2 in defs ? FromType5(defs[ref2]) : Unknown();
|
|
2786
|
+
}
|
|
2787
|
+
function CyclicExtends(type) {
|
|
2788
|
+
return CyclicAnyFromParameters(type.$defs, type.$ref);
|
|
2789
|
+
}
|
|
2790
|
+
// node_modules/typebox/build/type/engine/cyclic/instantiate.mjs
|
|
2791
|
+
function CyclicInterface(context, heritage, properties2) {
|
|
2792
|
+
const instantiatedHeritage = InstantiateTypes(context, State([], []), heritage);
|
|
2793
|
+
const instantiatedProperties = InstantiateProperties({}, State([], []), properties2);
|
|
2794
|
+
const evaluatedInterface = EvaluateIntersect([...instantiatedHeritage, _Object_(instantiatedProperties)]);
|
|
2795
|
+
return evaluatedInterface;
|
|
2796
|
+
}
|
|
2797
|
+
function CyclicDefinitions(context, dependencies) {
|
|
2798
|
+
const keys = exports_guard.Keys(context).filter((key) => dependencies.includes(key));
|
|
2799
|
+
return keys.reduce((result, key) => {
|
|
2800
|
+
const type = context[key];
|
|
2801
|
+
const instantiatedType = IsInterfaceDeferred(type) ? CyclicInterface(context, type.parameters[0], type.parameters[1]) : type;
|
|
2802
|
+
return { ...result, [key]: instantiatedType };
|
|
2803
|
+
}, {});
|
|
2804
|
+
}
|
|
2805
|
+
function InstantiateCyclic(context, ref2, type) {
|
|
2806
|
+
const dependencies = CyclicDependencies(context, ref2, type);
|
|
2807
|
+
const definitions = CyclicDefinitions(context, dependencies);
|
|
2808
|
+
const result = Cyclic(definitions, ref2);
|
|
2809
|
+
return result;
|
|
2810
|
+
}
|
|
2811
|
+
// node_modules/typebox/build/type/engine/cyclic/target.mjs
|
|
2812
|
+
function Resolve(defs, ref2) {
|
|
2813
|
+
return ref2 in defs ? IsRef(defs[ref2]) ? Resolve(defs, defs[ref2].$ref) : defs[ref2] : Never();
|
|
2814
|
+
}
|
|
2815
|
+
function CyclicTarget(defs, ref2) {
|
|
2816
|
+
const result = Resolve(defs, ref2);
|
|
2817
|
+
return result;
|
|
2818
|
+
}
|
|
2819
|
+
// node_modules/typebox/build/type/extends/extends.mjs
|
|
2820
|
+
function Canonical(type) {
|
|
2821
|
+
return IsCyclic(type) ? CyclicExtends(type) : IsUnsafe(type) ? Unknown() : type;
|
|
2822
|
+
}
|
|
2823
|
+
function Extends(inferred, left, right) {
|
|
2824
|
+
const canonicalLeft = Canonical(left);
|
|
2825
|
+
const canonicalRight = Canonical(right);
|
|
2826
|
+
return ExtendsLeft(inferred, canonicalLeft, canonicalRight);
|
|
2827
|
+
}
|
|
2828
|
+
// node_modules/typebox/build/type/engine/evaluate/compare.mjs
|
|
2829
|
+
var ResultEqual = "equal";
|
|
2830
|
+
var ResultDisjoint = "disjoint";
|
|
2831
|
+
var ResultLeftInside = "left-inside";
|
|
2832
|
+
var ResultRightInside = "right-inside";
|
|
2833
|
+
function Compare(left, right) {
|
|
2834
|
+
const extendsCheck = [
|
|
2835
|
+
IsUnknown(left) ? exports_result.ExtendsFalse() : Extends({}, left, right),
|
|
2836
|
+
IsUnknown(left) ? exports_result.ExtendsTrue({}) : Extends({}, right, left)
|
|
2837
|
+
];
|
|
2838
|
+
return exports_result.IsExtendsTrueLike(extendsCheck[0]) && exports_result.IsExtendsTrueLike(extendsCheck[1]) ? ResultEqual : exports_result.IsExtendsTrueLike(extendsCheck[0]) && exports_result.IsExtendsFalse(extendsCheck[1]) ? ResultLeftInside : exports_result.IsExtendsFalse(extendsCheck[0]) && exports_result.IsExtendsTrueLike(extendsCheck[1]) ? ResultRightInside : ResultDisjoint;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
// node_modules/typebox/build/type/engine/evaluate/broaden.mjs
|
|
2842
|
+
function BroadFilter(type, types) {
|
|
2843
|
+
return types.filter((left) => {
|
|
2844
|
+
return Compare(type, left) === ResultRightInside ? false : true;
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
function IsBroadestType(type, types) {
|
|
2848
|
+
const result = types.some((left) => {
|
|
2849
|
+
const result2 = Compare(type, left);
|
|
2850
|
+
return exports_guard.IsEqual(result2, ResultLeftInside) || exports_guard.IsEqual(result2, ResultEqual);
|
|
2851
|
+
});
|
|
2852
|
+
return exports_guard.IsEqual(result, false);
|
|
2853
|
+
}
|
|
2854
|
+
function BroadenType(type, types) {
|
|
2855
|
+
const evaluated = EvaluateType(type);
|
|
2856
|
+
return IsAny(evaluated) ? [evaluated] : IsBroadestType(evaluated, types) ? [...BroadFilter(evaluated, types), evaluated] : types;
|
|
2857
|
+
}
|
|
2858
|
+
function BroadenTypes(types) {
|
|
2859
|
+
return types.reduce((result, left) => {
|
|
2860
|
+
return IsObject2(left) ? [...result, left] : IsNever(left) ? result : BroadenType(left, result);
|
|
2861
|
+
}, []);
|
|
2862
|
+
}
|
|
2863
|
+
function Broaden(types) {
|
|
2864
|
+
const broadened = BroadenTypes(types);
|
|
2865
|
+
const flattened = Flatten(broadened);
|
|
2866
|
+
return flattened;
|
|
2867
|
+
}
|
|
2868
|
+
// node_modules/typebox/build/type/engine/evaluate/instantiate.mjs
|
|
2869
|
+
function EvaluateAction(type, options) {
|
|
2870
|
+
const result = exports_memory.Update(EvaluateType(type), {}, options);
|
|
2871
|
+
return result;
|
|
2872
|
+
}
|
|
2873
|
+
function EvaluateInstantiate(context, state, type, options) {
|
|
2874
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
2875
|
+
return EvaluateAction(instantiatedType, options);
|
|
2876
|
+
}
|
|
2877
|
+
// node_modules/typebox/build/type/engine/call/distribute_arguments.mjs
|
|
2878
|
+
function CollectDistributionNames(expression, result = []) {
|
|
2879
|
+
return IsDeferred(expression) && exports_guard.IsEqual(expression.action, "Conditional") ? IsRef(expression.parameters[0]) ? CollectDistributionNames(expression.parameters[2], CollectDistributionNames(expression.parameters[3], [...result, expression.parameters[0]["$ref"]])) : CollectDistributionNames(expression.parameters[2], CollectDistributionNames(expression.parameters[3], result)) : IsDeferred(expression) && exports_guard.IsEqual(expression.action, "Mapped") ? IsDeferred(expression.parameters[1]) && exports_guard.IsEqual(expression.parameters[1].action, "KeyOf") && IsRef(expression.parameters[1].parameters[0]) ? [...result, expression.parameters[1].parameters[0]["$ref"]] : result : result;
|
|
2880
|
+
}
|
|
2881
|
+
function BuildDistributionArray(parameters, names) {
|
|
2882
|
+
return parameters.reduce((result, left) => [...result, names.includes(left.name)], []);
|
|
2883
|
+
}
|
|
2884
|
+
function ZipDistributionArray(arguments_, distributionArray, result = []) {
|
|
2885
|
+
return exports_guard.ShiftLeft(arguments_, (argumentLeft, argumentRight) => exports_guard.ShiftLeft(distributionArray, (booleanLeft, booleanRight) => ZipDistributionArray(argumentRight, booleanRight, [...result, [booleanLeft, argumentLeft]]), () => result), () => result);
|
|
2886
|
+
}
|
|
2887
|
+
function Expand(type) {
|
|
2888
|
+
return IsUnion(type) ? [...type.anyOf] : [type];
|
|
2889
|
+
}
|
|
2890
|
+
function Append(current, type) {
|
|
2891
|
+
return current.reduce((result, left) => [...result, [...left, type]], []);
|
|
2892
|
+
}
|
|
2893
|
+
function Cross(current, variants) {
|
|
2894
|
+
return variants.reduce((result, left) => {
|
|
2895
|
+
return [...result, ...Append(current, left)];
|
|
2896
|
+
}, []);
|
|
2897
|
+
}
|
|
2898
|
+
function Distribute2(zipped) {
|
|
2899
|
+
return zipped.reduce((result, left) => {
|
|
2900
|
+
return exports_guard.IsEqual(left[0], true) ? Cross(result, Expand(left[1])) : Cross(result, [left[1]]);
|
|
2901
|
+
}, [[]]);
|
|
2902
|
+
}
|
|
2903
|
+
function DistributeArguments(parameters, arguments_, expression) {
|
|
2904
|
+
const distributionNames = CollectDistributionNames(expression);
|
|
2905
|
+
const distributionArray = BuildDistributionArray(parameters, distributionNames);
|
|
2906
|
+
const zippedArguments = ZipDistributionArray(arguments_, distributionArray);
|
|
2907
|
+
return IsDeferred(expression) && exports_guard.IsEqual(expression.action, "Conditional") ? Distribute2(zippedArguments) : IsDeferred(expression) && exports_guard.IsEqual(expression.action, "Mapped") ? Distribute2(zippedArguments) : [arguments_];
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
// node_modules/typebox/build/type/engine/call/resolve_target.mjs
|
|
2911
|
+
function FromNotResolvable() {
|
|
2912
|
+
return ["(not-resolvable)", Never()];
|
|
2913
|
+
}
|
|
2914
|
+
function FromNotGeneric() {
|
|
2915
|
+
return ["(not-generic)", Never()];
|
|
2916
|
+
}
|
|
2917
|
+
function FromGeneric(name, parameters, expression) {
|
|
2918
|
+
return [name, Generic(parameters, expression)];
|
|
2919
|
+
}
|
|
2920
|
+
function FromRef4(context, ref2, arguments_) {
|
|
2921
|
+
return ref2 in context ? FromType6(context, ref2, context[ref2], arguments_) : FromNotResolvable();
|
|
2922
|
+
}
|
|
2923
|
+
function FromType6(context, name, target2, arguments_) {
|
|
2924
|
+
return IsGeneric(target2) ? FromGeneric(name, target2.parameters, target2.expression) : IsRef(target2) ? FromRef4(context, target2.$ref, arguments_) : FromNotGeneric();
|
|
2925
|
+
}
|
|
2926
|
+
function ResolveTarget(context, target2, arguments_) {
|
|
2927
|
+
return FromType6(context, "(anonymous)", target2, arguments_);
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
// node_modules/typebox/build/type/engine/call/resolve_arguments.mjs
|
|
2931
|
+
function AssertArgumentExtends(name, type, extends_) {
|
|
2932
|
+
if (IsInfer(type) || IsCall(type) || exports_result.IsExtendsTrueLike(Extends({}, type, extends_)))
|
|
2933
|
+
return;
|
|
2934
|
+
const cause = { parameter: name, expect: extends_, actual: type };
|
|
2935
|
+
throw new Error(`Argument for parameter ${name} does not satisfy constraint`, { cause });
|
|
2936
|
+
}
|
|
2937
|
+
function BindArgument(context, state, name, extends_, type) {
|
|
2938
|
+
const instantiatedArgument = InstantiateType(context, state, type);
|
|
2939
|
+
AssertArgumentExtends(name, instantiatedArgument, extends_);
|
|
2940
|
+
return exports_memory.Assign(context, { [name]: instantiatedArgument });
|
|
2941
|
+
}
|
|
2942
|
+
function BindArguments(context, state, parameterLeft, parameterRight, arguments_) {
|
|
2943
|
+
const instantiatedExtends = InstantiateType(context, state, parameterLeft.extends);
|
|
2944
|
+
const instantiatedEquals = InstantiateType(context, state, parameterLeft.equals);
|
|
2945
|
+
return exports_guard.ShiftLeft(arguments_, (left, right) => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, left), state, parameterRight, right), () => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, instantiatedEquals), state, parameterRight, []));
|
|
2946
|
+
}
|
|
2947
|
+
function BindParameters(context, state, parameters, arguments_) {
|
|
2948
|
+
return exports_guard.ShiftLeft(parameters, (left, right) => BindArguments(context, state, left, right, arguments_), () => context);
|
|
2949
|
+
}
|
|
2950
|
+
function ResolveArgumentsContext(context, state, parameters, arguments_) {
|
|
2951
|
+
return BindParameters(context, state, parameters, arguments_);
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
// node_modules/typebox/build/type/engine/call/instantiate.mjs
|
|
2955
|
+
function Peek(state) {
|
|
2956
|
+
const result = exports_guard.IsGreaterThan(state.callstack.length, 0) ? state.callstack[state.callstack.length - 1] : "";
|
|
2957
|
+
return result;
|
|
2958
|
+
}
|
|
2959
|
+
function IsTailCall(state, name) {
|
|
2960
|
+
const result = exports_guard.IsEqual(Peek(state), name);
|
|
2961
|
+
return result;
|
|
2962
|
+
}
|
|
2963
|
+
function CallDispatch(context, state, target2, parameters, expression, arguments_) {
|
|
2964
|
+
const argumentsContext = ResolveArgumentsContext(context, state, parameters, arguments_);
|
|
2965
|
+
const returnType = InstantiateType(argumentsContext, State([...state["callstack"], target2["$ref"]], state["visited"]), expression);
|
|
2966
|
+
return InstantiateType(argumentsContext, State([], []), returnType);
|
|
2967
|
+
}
|
|
2968
|
+
function CallDistributed(context, state, target2, parameters, expression, distributedArguments) {
|
|
2969
|
+
return distributedArguments.reduce((result, arguments_) => [...result, CallDispatch(context, state, target2, parameters, expression, arguments_)], []);
|
|
2970
|
+
}
|
|
2971
|
+
function CallImmediate(context, state, target2, parameters, expression, arguments_) {
|
|
2972
|
+
const distributedArguments = DistributeArguments(parameters, arguments_, expression);
|
|
2973
|
+
const returnTypes = CallDistributed(context, state, target2, parameters, expression, distributedArguments);
|
|
2974
|
+
const result = exports_guard.IsEqual(returnTypes.length, 1) ? returnTypes[0] : EvaluateUnion(returnTypes);
|
|
2975
|
+
return result;
|
|
2976
|
+
}
|
|
2977
|
+
function CallInstantiate(context, state, target2, arguments_) {
|
|
2978
|
+
const instantiatedArguments = InstantiateTypes(context, state, arguments_);
|
|
2979
|
+
const resolved = ResolveTarget(context, target2, arguments_);
|
|
2980
|
+
const name = resolved[0];
|
|
2981
|
+
const type = resolved[1];
|
|
2982
|
+
const result = IsGeneric(type) ? IsTailCall(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target2, instantiatedArguments);
|
|
2983
|
+
return result;
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
// node_modules/typebox/build/type/types/call.mjs
|
|
2987
|
+
function CallConstruct(target2, arguments_) {
|
|
2988
|
+
return exports_memory.Create({ ["~kind"]: "Call" }, { type: "call", target: target2, arguments: arguments_ }, {});
|
|
2989
|
+
}
|
|
2990
|
+
function Call(target2, arguments_) {
|
|
2991
|
+
return CallInstantiate({}, State([], []), target2, arguments_);
|
|
2992
|
+
}
|
|
2993
|
+
function IsCall(value) {
|
|
2994
|
+
return IsKind(value, "Call");
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
// node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs
|
|
2998
|
+
function RemoveImmutableOperation(type) {
|
|
2999
|
+
return exports_memory.Discard(type, ["~immutable"]);
|
|
3000
|
+
}
|
|
3001
|
+
function RemoveImmutableAction(type, options) {
|
|
3002
|
+
const result = exports_memory.Update(RemoveImmutableOperation(type), {}, options);
|
|
3003
|
+
return result;
|
|
3004
|
+
}
|
|
3005
|
+
function RemoveImmutableInstantiate(context, state, type, options) {
|
|
3006
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3007
|
+
return RemoveImmutableAction(instantiatedType, options);
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
// node_modules/typebox/build/type/engine/intrinsics/mapping.mjs
|
|
3011
|
+
function ApplyMapping(mapping, value) {
|
|
3012
|
+
return mapping(value);
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
// node_modules/typebox/build/type/engine/intrinsics/from_literal.mjs
|
|
3016
|
+
function FromLiteral3(mapping, value) {
|
|
3017
|
+
return exports_guard.IsString(value) ? Literal(ApplyMapping(mapping, value)) : Literal(value);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs
|
|
3021
|
+
function FromTemplateLiteral(mapping, pattern) {
|
|
3022
|
+
const evaluated = EvaluateTemplateLiteral(pattern);
|
|
3023
|
+
const result = FromType7(mapping, evaluated);
|
|
3024
|
+
return result;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
// node_modules/typebox/build/type/engine/intrinsics/from_union.mjs
|
|
3028
|
+
function FromUnion2(mapping, types) {
|
|
3029
|
+
const result = types.map((type) => FromType7(mapping, type));
|
|
3030
|
+
return Union(result);
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
// node_modules/typebox/build/type/engine/intrinsics/from_type.mjs
|
|
3034
|
+
function FromType7(mapping, type) {
|
|
3035
|
+
return IsLiteral(type) ? FromLiteral3(mapping, type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral(mapping, type.pattern) : IsUnion(type) ? FromUnion2(mapping, type.anyOf) : type;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// node_modules/typebox/build/type/action/capitalize.mjs
|
|
3039
|
+
function CapitalizeDeferred(type, options = {}) {
|
|
3040
|
+
return Deferred("Capitalize", [type], options);
|
|
3041
|
+
}
|
|
3042
|
+
function Capitalize(type, options = {}) {
|
|
3043
|
+
return CapitalizeAction(type, options);
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
// node_modules/typebox/build/type/action/lowercase.mjs
|
|
3047
|
+
function LowercaseDeferred(type, options = {}) {
|
|
3048
|
+
return Deferred("Lowercase", [type], options);
|
|
3049
|
+
}
|
|
3050
|
+
function Lowercase(type, options = {}) {
|
|
3051
|
+
return LowercaseAction(type, options);
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
// node_modules/typebox/build/type/action/uncapitalize.mjs
|
|
3055
|
+
function UncapitalizeDeferred(type, options = {}) {
|
|
3056
|
+
return Deferred("Uncapitalize", [type], options);
|
|
3057
|
+
}
|
|
3058
|
+
function Uncapitalize(type, options = {}) {
|
|
3059
|
+
return UncapitalizeAction(type, options);
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// node_modules/typebox/build/type/action/uppercase.mjs
|
|
3063
|
+
function UppercaseDeferred(type, options = {}) {
|
|
3064
|
+
return Deferred("Uppercase", [type], options);
|
|
3065
|
+
}
|
|
3066
|
+
function Uppercase(type, options = {}) {
|
|
3067
|
+
return UppercaseAction(type, options);
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
// node_modules/typebox/build/type/engine/intrinsics/instantiate.mjs
|
|
3071
|
+
var CapitalizeMapping = (input) => input[0].toUpperCase() + input.slice(1);
|
|
3072
|
+
var LowercaseMapping = (input) => input.toLowerCase();
|
|
3073
|
+
var UncapitalizeMapping = (input) => input[0].toLowerCase() + input.slice(1);
|
|
3074
|
+
var UppercaseMapping = (input) => input.toUpperCase();
|
|
3075
|
+
function CapitalizeAction(type, options) {
|
|
3076
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType7(CapitalizeMapping, type), {}, options) : CapitalizeDeferred(type, options);
|
|
3077
|
+
return result;
|
|
3078
|
+
}
|
|
3079
|
+
function LowercaseAction(type, options) {
|
|
3080
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType7(LowercaseMapping, type), {}, options) : LowercaseDeferred(type, options);
|
|
3081
|
+
return result;
|
|
3082
|
+
}
|
|
3083
|
+
function UncapitalizeAction(type, options) {
|
|
3084
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType7(UncapitalizeMapping, type), {}, options) : UncapitalizeDeferred(type, options);
|
|
3085
|
+
return result;
|
|
3086
|
+
}
|
|
3087
|
+
function UppercaseAction(type, options) {
|
|
3088
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType7(UppercaseMapping, type), {}, options) : UppercaseDeferred(type, options);
|
|
3089
|
+
return result;
|
|
3090
|
+
}
|
|
3091
|
+
function CapitalizeInstantiate(context, state, type, options) {
|
|
3092
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3093
|
+
return CapitalizeAction(instantiatedType, options);
|
|
3094
|
+
}
|
|
3095
|
+
function LowercaseInstantiate(context, state, type, options) {
|
|
3096
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3097
|
+
return LowercaseAction(instantiatedType, options);
|
|
3098
|
+
}
|
|
3099
|
+
function UncapitalizeInstantiate(context, state, type, options) {
|
|
3100
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3101
|
+
return UncapitalizeAction(instantiatedType, options);
|
|
3102
|
+
}
|
|
3103
|
+
function UppercaseInstantiate(context, state, type, options) {
|
|
3104
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3105
|
+
return UppercaseAction(instantiatedType, options);
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
// node_modules/typebox/build/type/action/conditional.mjs
|
|
3109
|
+
function ConditionalDeferred(left, right, true_, false_, options = {}) {
|
|
3110
|
+
return Deferred("Conditional", [left, right, true_, false_], options);
|
|
3111
|
+
}
|
|
3112
|
+
function Conditional(left, right, true_, false_, options = {}) {
|
|
3113
|
+
return ConditionalAction({}, State([], []), left, right, true_, false_, options);
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
// node_modules/typebox/build/type/engine/conditional/instantiate.mjs
|
|
3117
|
+
function ConditionalOperation(context, state, left, right, true_, false_) {
|
|
3118
|
+
const extendsResult = Extends(context, left, right);
|
|
3119
|
+
return exports_result.IsExtendsUnion(extendsResult) ? Union([InstantiateType(extendsResult.inferred, state, true_), InstantiateType(context, state, false_)]) : exports_result.IsExtendsTrue(extendsResult) ? InstantiateType(extendsResult.inferred, state, true_) : InstantiateType(context, state, false_);
|
|
3120
|
+
}
|
|
3121
|
+
function ConditionalAction(context, state, left, right, true_, false_, options) {
|
|
3122
|
+
const result = CanInstantiate([left, right]) ? exports_memory.Update(ConditionalOperation(context, state, left, right, true_, false_), {}, options) : ConditionalDeferred(left, right, true_, false_, options);
|
|
3123
|
+
return result;
|
|
3124
|
+
}
|
|
3125
|
+
function ConditionalInstantiate(context, state, left, right, true_, false_, options) {
|
|
3126
|
+
const instantiatedLeft = InstantiateType(context, state, left);
|
|
3127
|
+
const instantiatedRight = InstantiateType(context, state, right);
|
|
3128
|
+
return ConditionalAction(context, state, instantiatedLeft, instantiatedRight, true_, false_, options);
|
|
3129
|
+
}
|
|
3130
|
+
// node_modules/typebox/build/type/action/constructor_parameters.mjs
|
|
3131
|
+
function ConstructorParametersDeferred(type, options = {}) {
|
|
3132
|
+
return Deferred("ConstructorParameters", [type], options);
|
|
3133
|
+
}
|
|
3134
|
+
function ConstructorParameters(type, options = {}) {
|
|
3135
|
+
return ConstructorParametersAction(type, options);
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
// node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs
|
|
3139
|
+
function ConstructorParametersOperation(type) {
|
|
3140
|
+
const parameters = IsConstructor2(type) ? type["parameters"] : [];
|
|
3141
|
+
const instantiatedParameters = InstantiateElements({}, State([], []), parameters);
|
|
3142
|
+
const result = Tuple(instantiatedParameters);
|
|
3143
|
+
return result;
|
|
3144
|
+
}
|
|
3145
|
+
function ConstructorParametersAction(type, options) {
|
|
3146
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(ConstructorParametersOperation(type), {}, options) : ConstructorParametersDeferred(type, options);
|
|
3147
|
+
return result;
|
|
3148
|
+
}
|
|
3149
|
+
function ConstructorParametersInstantiate(context, state, type, options) {
|
|
3150
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3151
|
+
return ConstructorParametersAction(instantiatedType, options);
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
// node_modules/typebox/build/type/action/exclude.mjs
|
|
3155
|
+
function ExcludeDeferred(left, right, options = {}) {
|
|
3156
|
+
return Deferred("Exclude", [left, right], options);
|
|
3157
|
+
}
|
|
3158
|
+
function Exclude(left, right, options = {}) {
|
|
3159
|
+
return ExcludeAction(left, right, options);
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
// node_modules/typebox/build/type/engine/exclude/instantiate.mjs
|
|
3163
|
+
function ExcludeAction(left, right, options) {
|
|
3164
|
+
const result = CanInstantiate([left, right]) ? exports_memory.Update(ExcludeOperation(left, right), {}, options) : ExcludeDeferred(left, right, options);
|
|
3165
|
+
return result;
|
|
3166
|
+
}
|
|
3167
|
+
function ExcludeInstantiate(context, state, left, right, options) {
|
|
3168
|
+
const instantiatedLeft = InstantiateType(context, state, left);
|
|
3169
|
+
const instantiatedRight = InstantiateType(context, state, right);
|
|
3170
|
+
return ExcludeAction(instantiatedLeft, instantiatedRight, options);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
// node_modules/typebox/build/type/action/extract.mjs
|
|
3174
|
+
function ExtractDeferred(left, right, options = {}) {
|
|
3175
|
+
return Deferred("Extract", [left, right], options);
|
|
3176
|
+
}
|
|
3177
|
+
function Extract(left, right, options = {}) {
|
|
3178
|
+
return ExtractAction(left, right, options);
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
// node_modules/typebox/build/type/engine/extract/operation.mjs
|
|
3182
|
+
function ExtractType(left, right) {
|
|
3183
|
+
const check2 = Extends({}, left, right);
|
|
3184
|
+
const result = exports_result.IsExtendsTrueLike(check2) ? [left] : [];
|
|
3185
|
+
return result;
|
|
3186
|
+
}
|
|
3187
|
+
function ExtractUnion(types, right) {
|
|
3188
|
+
return types.reduce((result, head) => {
|
|
3189
|
+
return [...result, ...ExtractType(head, right)];
|
|
3190
|
+
}, []);
|
|
3191
|
+
}
|
|
3192
|
+
function ExtractOperation(left, right) {
|
|
3193
|
+
const evaluated = EvaluateType(left);
|
|
3194
|
+
const canonical = IsUnion(evaluated) ? evaluated.anyOf : [evaluated];
|
|
3195
|
+
const remaining = ExtractUnion(canonical, right);
|
|
3196
|
+
const result = EvaluateUnion(remaining);
|
|
3197
|
+
return result;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
// node_modules/typebox/build/type/engine/extract/instantiate.mjs
|
|
3201
|
+
function ExtractAction(left, right, options) {
|
|
3202
|
+
const result = CanInstantiate([left, right]) ? exports_memory.Update(ExtractOperation(left, right), {}, options) : ExtractDeferred(left, right, options);
|
|
3203
|
+
return result;
|
|
3204
|
+
}
|
|
3205
|
+
function ExtractInstantiate(context, state, left, right, options) {
|
|
3206
|
+
const instantiatedLeft = InstantiateType(context, state, left);
|
|
3207
|
+
const instantiatedRight = InstantiateType(context, state, right);
|
|
3208
|
+
return ExtractAction(instantiatedLeft, instantiatedRight, options);
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
// node_modules/typebox/build/type/engine/helpers/keys_to_indexer.mjs
|
|
3212
|
+
function KeysToLiterals(keys) {
|
|
3213
|
+
return keys.reduce((result, left) => {
|
|
3214
|
+
return IsLiteralValue(left) ? [...result, Literal(left)] : result;
|
|
3215
|
+
}, []);
|
|
3216
|
+
}
|
|
3217
|
+
function KeysToIndexer(keys) {
|
|
3218
|
+
const literals = KeysToLiterals(keys);
|
|
3219
|
+
const result = Union(literals);
|
|
3220
|
+
return result;
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
// node_modules/typebox/build/type/action/indexed.mjs
|
|
3224
|
+
function IndexDeferred(type, indexer, options = {}) {
|
|
3225
|
+
return Deferred("Index", [type, indexer], options);
|
|
3226
|
+
}
|
|
3227
|
+
function Index(type, indexer_or_keys, options = {}) {
|
|
3228
|
+
const indexer = exports_guard.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
|
|
3229
|
+
return IndexAction(type, indexer, options);
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
// node_modules/typebox/build/type/engine/object/from_cyclic.mjs
|
|
3233
|
+
function FromCyclic(defs, ref2) {
|
|
3234
|
+
const target2 = CyclicTarget(defs, ref2);
|
|
3235
|
+
const result = FromType8(target2);
|
|
3236
|
+
return result;
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
// node_modules/typebox/build/type/engine/object/from_dependent.mjs
|
|
3240
|
+
function FromDependent(if_, then_, else_) {
|
|
3241
|
+
const evaluated = EvaluateDependent(if_, then_, else_);
|
|
3242
|
+
const result = FromType8(evaluated);
|
|
3243
|
+
return result;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
// node_modules/typebox/build/type/engine/object/from_intersect.mjs
|
|
3247
|
+
function CollapseIntersectProperties(left, right) {
|
|
3248
|
+
const leftKeys = exports_guard.Keys(left).filter((key) => !exports_guard.HasPropertyKey(right, key));
|
|
3249
|
+
const rightKeys = exports_guard.Keys(right).filter((key) => !exports_guard.HasPropertyKey(left, key));
|
|
3250
|
+
const sharedKeys = exports_guard.Keys(left).filter((key) => exports_guard.HasPropertyKey(right, key));
|
|
3251
|
+
const leftProperties = leftKeys.reduce((result, key) => ({ ...result, [key]: left[key] }), {});
|
|
3252
|
+
const rightProperties = rightKeys.reduce((result, key) => ({ ...result, [key]: right[key] }), {});
|
|
3253
|
+
const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluateIntersect([left[key], right[key]]) }), {});
|
|
3254
|
+
const unique = exports_memory.Assign(leftProperties, rightProperties);
|
|
3255
|
+
const shared = exports_memory.Assign(unique, sharedProperties);
|
|
3256
|
+
return shared;
|
|
3257
|
+
}
|
|
3258
|
+
function FromIntersect(types) {
|
|
3259
|
+
return types.reduce((result, left) => {
|
|
3260
|
+
return CollapseIntersectProperties(result, FromType8(left));
|
|
3261
|
+
}, {});
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
// node_modules/typebox/build/type/engine/object/from_object.mjs
|
|
3265
|
+
function FromObject3(properties2) {
|
|
3266
|
+
return properties2;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
// node_modules/typebox/build/type/engine/object/from_tuple.mjs
|
|
3270
|
+
function FromTuple(types) {
|
|
3271
|
+
const object2 = TupleToObject(Tuple(types));
|
|
3272
|
+
const result = FromType8(object2);
|
|
3273
|
+
return result;
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
// node_modules/typebox/build/type/engine/object/from_union.mjs
|
|
3277
|
+
function CollapseUnionProperties(left, right) {
|
|
3278
|
+
const sharedKeys = exports_guard.Keys(left).filter((key) => (key in right));
|
|
3279
|
+
const result = sharedKeys.reduce((result2, key) => {
|
|
3280
|
+
return { ...result2, [key]: EvaluateUnion([left[key], right[key]]) };
|
|
3281
|
+
}, {});
|
|
3282
|
+
return result;
|
|
3283
|
+
}
|
|
3284
|
+
function ReduceVariants(types, result) {
|
|
3285
|
+
return exports_guard.ShiftLeft(types, (left, right) => ReduceVariants(right, CollapseUnionProperties(result, FromType8(left))), () => result);
|
|
3286
|
+
}
|
|
3287
|
+
function FromUnion3(types) {
|
|
3288
|
+
return exports_guard.ShiftLeft(types, (left, right) => ReduceVariants(right, FromType8(left)), () => Unreachable());
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
// node_modules/typebox/build/type/engine/object/from_type.mjs
|
|
3292
|
+
function FromType8(type) {
|
|
3293
|
+
return IsCyclic(type) ? FromCyclic(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion3(type.anyOf) : IsTuple(type) ? FromTuple(type.items) : IsObject2(type) ? FromObject3(type.properties) : {};
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
// node_modules/typebox/build/type/engine/object/collapse.mjs
|
|
3297
|
+
function CollapseToObject(type) {
|
|
3298
|
+
const properties2 = FromType8(type);
|
|
3299
|
+
const result = _Object_(properties2);
|
|
3300
|
+
return result;
|
|
3301
|
+
}
|
|
3302
|
+
// node_modules/typebox/build/type/engine/helpers/keys.mjs
|
|
3303
|
+
var integerKeyPattern = new RegExp("^(?:0|[1-9][0-9]*)$");
|
|
3304
|
+
function ConvertToIntegerKey(value) {
|
|
3305
|
+
const normal = `${value}`;
|
|
3306
|
+
return integerKeyPattern.test(normal) ? parseInt(normal) : value;
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
// node_modules/typebox/build/type/engine/indexed/from_array.mjs
|
|
3310
|
+
function NormalizeLiteral(value) {
|
|
3311
|
+
return Literal(ConvertToIntegerKey(value));
|
|
3312
|
+
}
|
|
3313
|
+
function NormalizeIndexerTypes(types) {
|
|
3314
|
+
return types.map((type) => NormalizeIndexer(type));
|
|
3315
|
+
}
|
|
3316
|
+
function NormalizeIndexer(type) {
|
|
3317
|
+
return IsIntersect(type) ? Intersect(NormalizeIndexerTypes(type.allOf)) : IsUnion(type) ? Union(NormalizeIndexerTypes(type.anyOf)) : IsLiteral(type) ? NormalizeLiteral(type.const) : type;
|
|
3318
|
+
}
|
|
3319
|
+
function FromArray2(type, indexer) {
|
|
3320
|
+
const normalizedIndexer = NormalizeIndexer(indexer);
|
|
3321
|
+
const check2 = Extends({}, normalizedIndexer, Number2());
|
|
3322
|
+
const result = exports_result.IsExtendsTrueLike(check2) ? type : IsLiteral(indexer) && exports_guard.IsEqual(indexer.const, "length") ? Number2() : Never();
|
|
3323
|
+
return result;
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
// node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs
|
|
3327
|
+
function FromCyclic2(defs, ref2) {
|
|
3328
|
+
const target2 = CyclicTarget(defs, ref2);
|
|
3329
|
+
const result = FromType9(target2);
|
|
3330
|
+
return result;
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
// node_modules/typebox/build/type/engine/indexable/from_dependent.mjs
|
|
3334
|
+
function FromDependent2(if_, then_, else_) {
|
|
3335
|
+
const evaluated = EvaluateDependent(if_, then_, else_);
|
|
3336
|
+
const result = FromType9(evaluated);
|
|
3337
|
+
return result;
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
// node_modules/typebox/build/type/engine/indexable/from_enum.mjs
|
|
3341
|
+
function FromEnum(values) {
|
|
3342
|
+
const evaluated = EvaluateEnum(values);
|
|
3343
|
+
const result = FromType9(evaluated);
|
|
3344
|
+
return result;
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
// node_modules/typebox/build/type/engine/indexable/from_intersect.mjs
|
|
3348
|
+
function FromIntersect2(types) {
|
|
3349
|
+
const evaluated = EvaluateIntersect(types);
|
|
3350
|
+
const result = FromType9(evaluated);
|
|
3351
|
+
return result;
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
// node_modules/typebox/build/type/engine/indexable/from_literal.mjs
|
|
3355
|
+
function FromLiteral4(value) {
|
|
3356
|
+
const result = [`${value}`];
|
|
3357
|
+
return result;
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
// node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs
|
|
3361
|
+
function FromTemplateLiteral2(pattern) {
|
|
3362
|
+
const evaluated = EvaluateTemplateLiteral(pattern);
|
|
3363
|
+
const result = FromType9(evaluated);
|
|
3364
|
+
return result;
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
// node_modules/typebox/build/type/engine/indexable/from_union.mjs
|
|
3368
|
+
function FromUnion4(types) {
|
|
3369
|
+
return types.reduce((result, left) => {
|
|
3370
|
+
return [...result, ...FromType9(left)];
|
|
3371
|
+
}, []);
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
// node_modules/typebox/build/type/engine/indexable/from_type.mjs
|
|
3375
|
+
function FromType9(type) {
|
|
3376
|
+
return IsCyclic(type) ? FromCyclic2(type.$defs, type.$ref) : IsDependent(type) ? FromDependent2(type.if, type.then, type.else) : IsEnum(type) ? FromEnum(type.enum) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsLiteral(type) ? FromLiteral4(type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral2(type.pattern) : IsUnion(type) ? FromUnion4(type.anyOf) : [];
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
// node_modules/typebox/build/type/engine/indexable/to_indexable_keys.mjs
|
|
3380
|
+
function ToIndexableKeys(type) {
|
|
3381
|
+
const result = FromType9(type);
|
|
3382
|
+
return result;
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
// node_modules/typebox/build/type/engine/this/expand_this.mjs
|
|
3386
|
+
function FromTypes5(properties2, types) {
|
|
3387
|
+
return types.map((type) => FromType10(properties2, type));
|
|
3388
|
+
}
|
|
3389
|
+
function FromType10(properties2, type) {
|
|
3390
|
+
return IsArray2(type) ? _Array_(FromType10(properties2, type.items)) : IsConstructor2(type) ? Constructor(FromTypes5(properties2, type.parameters), FromType10(properties2, type.instanceType)) : IsFunction2(type) ? _Function_(FromTypes5(properties2, type.parameters), FromType10(properties2, type.returnType)) : IsTuple(type) ? Tuple(FromTypes5(properties2, type.items)) : IsUnion(type) ? Union(FromTypes5(properties2, type.anyOf)) : IsIntersect(type) ? Intersect(FromTypes5(properties2, type.allOf)) : IsThis(type) ? _Object_(properties2) : type;
|
|
3391
|
+
}
|
|
3392
|
+
function ExpandThis(properties2, type) {
|
|
3393
|
+
const result = FromType10(properties2, type);
|
|
3394
|
+
return result;
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
// node_modules/typebox/build/type/engine/indexed/from_object.mjs
|
|
3398
|
+
function IndexProperty(properties2, key) {
|
|
3399
|
+
const selectedType = key in properties2 ? properties2[key] : Never();
|
|
3400
|
+
const result = ExpandThis(properties2, selectedType);
|
|
3401
|
+
return result;
|
|
3402
|
+
}
|
|
3403
|
+
function IndexProperties(properties2, keys) {
|
|
3404
|
+
return keys.reduce((result, left) => {
|
|
3405
|
+
return [...result, IndexProperty(properties2, left)];
|
|
3406
|
+
}, []);
|
|
3407
|
+
}
|
|
3408
|
+
function FromIndexer(properties2, indexer) {
|
|
3409
|
+
const keys = ToIndexableKeys(indexer);
|
|
3410
|
+
const variants = IndexProperties(properties2, keys);
|
|
3411
|
+
const result = EvaluateUnion(variants);
|
|
3412
|
+
return result;
|
|
3413
|
+
}
|
|
3414
|
+
var NumericKeyPattern = new RegExp(IntegerKey);
|
|
3415
|
+
function NumericKeys(keys) {
|
|
3416
|
+
const result = keys.filter((key) => NumericKeyPattern.test(key));
|
|
3417
|
+
return result;
|
|
3418
|
+
}
|
|
3419
|
+
function FromIndexerNumber(properties2) {
|
|
3420
|
+
const keys = PropertyKeys(properties2);
|
|
3421
|
+
const numericKeys = NumericKeys(keys);
|
|
3422
|
+
const variants = IndexProperties(properties2, numericKeys);
|
|
3423
|
+
const result = EvaluateUnion(variants);
|
|
3424
|
+
return result;
|
|
3425
|
+
}
|
|
3426
|
+
function FromObject4(properties2, indexer) {
|
|
3427
|
+
const result = IsNumber3(indexer) ? FromIndexerNumber(properties2) : FromIndexer(properties2, indexer);
|
|
3428
|
+
return result;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
// node_modules/typebox/build/type/engine/indexed/array_indexer.mjs
|
|
3432
|
+
function ConvertLiteral(value) {
|
|
3433
|
+
return Literal(ConvertToIntegerKey(value));
|
|
3434
|
+
}
|
|
3435
|
+
function ArrayIndexerTypes(types) {
|
|
3436
|
+
return types.map((type) => FormatArrayIndexer(type));
|
|
3437
|
+
}
|
|
3438
|
+
function FormatArrayIndexer(type) {
|
|
3439
|
+
return IsIntersect(type) ? Intersect(ArrayIndexerTypes(type.allOf)) : IsUnion(type) ? Union(ArrayIndexerTypes(type.anyOf)) : IsLiteral(type) ? ConvertLiteral(type.const) : type;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
// node_modules/typebox/build/type/engine/indexed/from_tuple.mjs
|
|
3443
|
+
function IndexElementsWithIndexer(types, indexer) {
|
|
3444
|
+
return types.reduceRight((result, right, index) => {
|
|
3445
|
+
const check2 = Extends({}, Literal(index), indexer);
|
|
3446
|
+
return exports_result.IsExtendsTrueLike(check2) ? [right, ...result] : result;
|
|
3447
|
+
}, []);
|
|
3448
|
+
}
|
|
3449
|
+
function FromTupleWithIndexer(types, indexer) {
|
|
3450
|
+
const formattedArrayIndexer = FormatArrayIndexer(indexer);
|
|
3451
|
+
const elements = IndexElementsWithIndexer(types, formattedArrayIndexer);
|
|
3452
|
+
return EvaluateUnionFast(elements);
|
|
3453
|
+
}
|
|
3454
|
+
function FromTupleWithoutIndexer(types) {
|
|
3455
|
+
return EvaluateUnionFast(types);
|
|
3456
|
+
}
|
|
3457
|
+
function FromTuple2(types, indexer) {
|
|
3458
|
+
return IsLiteral(indexer) && exports_guard.IsEqual(indexer.const, "length") ? Literal(types.length) : IsNumber3(indexer) || IsInteger2(indexer) ? FromTupleWithoutIndexer(types) : FromTupleWithIndexer(types, indexer);
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// node_modules/typebox/build/type/engine/indexed/from_type.mjs
|
|
3462
|
+
function FromType11(type, indexer) {
|
|
3463
|
+
return IsArray2(type) ? FromArray2(type.items, indexer) : IsObject2(type) ? FromObject4(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
// node_modules/typebox/build/type/engine/indexed/instantiate.mjs
|
|
3467
|
+
function NormalizeType(type) {
|
|
3468
|
+
const result = IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
|
|
3469
|
+
return result;
|
|
3470
|
+
}
|
|
3471
|
+
function IndexAction(type, indexer, options) {
|
|
3472
|
+
const result = CanInstantiate([type, indexer]) ? exports_memory.Update(FromType11(NormalizeType(type), indexer), {}, options) : IndexDeferred(type, indexer, options);
|
|
3473
|
+
return result;
|
|
3474
|
+
}
|
|
3475
|
+
function IndexInstantiate(context, state, type, indexer, options) {
|
|
3476
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3477
|
+
const instantiatedIndexer = InstantiateType(context, state, indexer);
|
|
3478
|
+
return IndexAction(instantiatedType, instantiatedIndexer, options);
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
// node_modules/typebox/build/type/action/instance_type.mjs
|
|
3482
|
+
function InstanceTypeDeferred(type, options = {}) {
|
|
3483
|
+
return Deferred("InstanceType", [type], options);
|
|
3484
|
+
}
|
|
3485
|
+
function InstanceType(type, options = {}) {
|
|
3486
|
+
return InstanceTypeAction(type, options);
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3489
|
+
// node_modules/typebox/build/type/engine/instance_type/instantiate.mjs
|
|
3490
|
+
function InstanceTypeOperation(type) {
|
|
3491
|
+
return IsConstructor2(type) ? type["instanceType"] : Never();
|
|
3492
|
+
}
|
|
3493
|
+
function InstanceTypeAction(type, options) {
|
|
3494
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(InstanceTypeOperation(type), {}, options) : InstanceTypeDeferred(type, options);
|
|
3495
|
+
return result;
|
|
3496
|
+
}
|
|
3497
|
+
function InstanceTypeInstantiate(context, state, type, options = {}) {
|
|
3498
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3499
|
+
return InstanceTypeAction(instantiatedType, options);
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
// node_modules/typebox/build/type/action/keyof.mjs
|
|
3503
|
+
function KeyOfDeferred(type, options = {}) {
|
|
3504
|
+
return Deferred("KeyOf", [type], options);
|
|
3505
|
+
}
|
|
3506
|
+
function KeyOf2(type, options = {}) {
|
|
3507
|
+
return KeyOfAction(type, options);
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
// node_modules/typebox/build/type/engine/keyof/from_any.mjs
|
|
3511
|
+
function FromAny() {
|
|
3512
|
+
return Union([Number2(), String2(), Symbol2()]);
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3515
|
+
// node_modules/typebox/build/type/engine/keyof/from_array.mjs
|
|
3516
|
+
function FromArray3(_type) {
|
|
3517
|
+
return Number2();
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
// node_modules/typebox/build/type/engine/keyof/from_object.mjs
|
|
3521
|
+
function FromPropertyKeys(keys) {
|
|
3522
|
+
const result = keys.reduce((result2, left) => {
|
|
3523
|
+
return IsLiteralValue(left) ? [...result2, Literal(ConvertToIntegerKey(left))] : Unreachable();
|
|
3524
|
+
}, []);
|
|
3525
|
+
return result;
|
|
3526
|
+
}
|
|
3527
|
+
function FromObject5(properties2) {
|
|
3528
|
+
const propertyKeys = exports_guard.Keys(properties2);
|
|
3529
|
+
const variants = FromPropertyKeys(propertyKeys);
|
|
3530
|
+
const result = EvaluateUnionFast(variants);
|
|
3531
|
+
return result;
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
// node_modules/typebox/build/type/engine/keyof/from_record.mjs
|
|
3535
|
+
function FromRecord2(type) {
|
|
3536
|
+
return RecordKey(type);
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
// node_modules/typebox/build/type/engine/keyof/from_tuple.mjs
|
|
3540
|
+
function FromTuple3(types) {
|
|
3541
|
+
const result = types.map((_, index) => Literal(index));
|
|
3542
|
+
return EvaluateUnionFast(result);
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
// node_modules/typebox/build/type/engine/keyof/from_type.mjs
|
|
3546
|
+
function FromType12(type) {
|
|
3547
|
+
return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray3(type.items) : IsObject2(type) ? FromObject5(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
// node_modules/typebox/build/type/engine/keyof/instantiate.mjs
|
|
3551
|
+
function NormalizeType2(type) {
|
|
3552
|
+
const result = IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
|
|
3553
|
+
return result;
|
|
3554
|
+
}
|
|
3555
|
+
function KeyOfAction(type, options) {
|
|
3556
|
+
return CanInstantiate([type]) ? exports_memory.Update(FromType12(NormalizeType2(type)), {}, options) : KeyOfDeferred(type, options);
|
|
3557
|
+
}
|
|
3558
|
+
function KeyOfInstantiate(context, state, type, options) {
|
|
3559
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3560
|
+
return KeyOfAction(instantiatedType, options);
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
// node_modules/typebox/build/type/action/mapped.mjs
|
|
3564
|
+
function MappedDeferred(identifier2, type, as, property, options = {}) {
|
|
3565
|
+
return Deferred("Mapped", [identifier2, type, as, property], options);
|
|
3566
|
+
}
|
|
3567
|
+
function Mapped(identifier2, type, as, property, options = {}) {
|
|
3568
|
+
return MappedAction({}, State([], []), identifier2, type, as, property, options);
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
// node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs
|
|
3572
|
+
function FromTemplateLiteral3(pattern) {
|
|
3573
|
+
const evaluated = EvaluateTemplateLiteral(pattern);
|
|
3574
|
+
const result = FromType13(evaluated);
|
|
3575
|
+
return result;
|
|
3576
|
+
}
|
|
3577
|
+
function FromUnion5(types) {
|
|
3578
|
+
return types.reduce((result, left) => {
|
|
3579
|
+
return [...result, ...FromType13(left)];
|
|
3580
|
+
}, []);
|
|
3581
|
+
}
|
|
3582
|
+
function FromEnum2(values) {
|
|
3583
|
+
const evaluated = EvaluateEnum(values);
|
|
3584
|
+
const result = FromType13(evaluated);
|
|
3585
|
+
return result;
|
|
3586
|
+
}
|
|
3587
|
+
function FromLiteral5(value) {
|
|
3588
|
+
const result = exports_guard.IsNumber(value) ? [Literal(`${value}`)] : [Literal(value)];
|
|
3589
|
+
return result;
|
|
3590
|
+
}
|
|
3591
|
+
function FromType13(type) {
|
|
3592
|
+
const result = IsEnum(type) ? FromEnum2(type.enum) : IsLiteral(type) ? FromLiteral5(type.const) : IsTemplateLiteral(type) ? FromTemplateLiteral3(type.pattern) : IsUnion(type) ? FromUnion5(type.anyOf) : [type];
|
|
3593
|
+
return result;
|
|
3594
|
+
}
|
|
3595
|
+
function MappedVariants(type) {
|
|
3596
|
+
const result = FromType13(type);
|
|
3597
|
+
return result;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
// node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs
|
|
3601
|
+
function CanonicalAs(instantiatedAs) {
|
|
3602
|
+
const result = IsTemplateLiteral(instantiatedAs) ? EvaluateTemplateLiteral(instantiatedAs.pattern) : instantiatedAs;
|
|
3603
|
+
return result;
|
|
3604
|
+
}
|
|
3605
|
+
function MappedVariant(context, state, identifier2, variant, as, property) {
|
|
3606
|
+
const variantContext = exports_memory.Assign(context, { [identifier2["name"]]: variant });
|
|
3607
|
+
const instantiatedAs = InstantiateType(variantContext, state, as);
|
|
3608
|
+
const canonicalAs = CanonicalAs(instantiatedAs);
|
|
3609
|
+
const instantiatedProperty = InstantiateType(variantContext, state, property);
|
|
3610
|
+
return IsLiteralNumber(canonicalAs) || IsLiteralString(canonicalAs) ? { [canonicalAs.const]: instantiatedProperty } : {};
|
|
3611
|
+
}
|
|
3612
|
+
function MappedProperties(context, state, identifier2, variants, as, property) {
|
|
3613
|
+
return variants.reduce((result, left) => {
|
|
3614
|
+
return [...result, MappedVariant(context, state, identifier2, left, as, property)];
|
|
3615
|
+
}, []);
|
|
3616
|
+
}
|
|
3617
|
+
function MappedObjects(properties2) {
|
|
3618
|
+
return properties2.reduce((result, left) => {
|
|
3619
|
+
return [...result, _Object_(left)];
|
|
3620
|
+
}, []);
|
|
3621
|
+
}
|
|
3622
|
+
function MappedOperation(context, state, identifier2, type, as, property) {
|
|
3623
|
+
const variants = MappedVariants(type);
|
|
3624
|
+
const mappedProperties = MappedProperties(context, state, identifier2, variants, as, property);
|
|
3625
|
+
const mappedObjects = MappedObjects(mappedProperties);
|
|
3626
|
+
const result = EvaluateIntersect(mappedObjects);
|
|
3627
|
+
return result;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
// node_modules/typebox/build/type/engine/mapped/instantiate.mjs
|
|
3631
|
+
function MappedAction(context, state, identifier2, type, as, property, options) {
|
|
3632
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(MappedOperation(context, state, identifier2, type, as, property), {}, options) : MappedDeferred(identifier2, type, as, property, options);
|
|
3633
|
+
return result;
|
|
3634
|
+
}
|
|
3635
|
+
function MappedInstantiate(context, state, identifier2, type, as, property, options) {
|
|
3636
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3637
|
+
return MappedAction(context, state, identifier2, instantiatedType, as, property, options);
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
// node_modules/typebox/build/type/engine/module/instantiate.mjs
|
|
3641
|
+
function InstantiateCyclics(context, declarations, cyclicKeys) {
|
|
3642
|
+
const declarationContext = exports_memory.Assign(context, declarations);
|
|
3643
|
+
const declarationKeys = exports_guard.Keys(declarations).filter((key) => cyclicKeys.includes(key));
|
|
3644
|
+
return declarationKeys.reduce((result, key) => {
|
|
3645
|
+
return { ...result, [key]: InstantiateCyclic(declarationContext, key, declarations[key]) };
|
|
3646
|
+
}, {});
|
|
3647
|
+
}
|
|
3648
|
+
function InstantiateNonCyclics(context, declarations, cyclicKeys) {
|
|
3649
|
+
const declarationContext = exports_memory.Assign(context, declarations);
|
|
3650
|
+
const declarationKeys = exports_guard.Keys(declarations).filter((key) => !cyclicKeys.includes(key));
|
|
3651
|
+
return declarationKeys.reduce((result, key) => {
|
|
3652
|
+
return { ...result, [key]: InstantiateType(declarationContext, State([], []), declarations[key]) };
|
|
3653
|
+
}, {});
|
|
3654
|
+
}
|
|
3655
|
+
function InstantiateModule(context, declarations, options) {
|
|
3656
|
+
const cyclicCandidates = CyclicCandidates(declarations);
|
|
3657
|
+
const instantiatedCyclics = InstantiateCyclics(context, declarations, cyclicCandidates);
|
|
3658
|
+
const instantiatedNonCyclics = InstantiateNonCyclics(context, declarations, cyclicCandidates);
|
|
3659
|
+
const instantiatedModule = { ...instantiatedCyclics, ...instantiatedNonCyclics };
|
|
3660
|
+
return exports_memory.Update(instantiatedModule, {}, options);
|
|
3661
|
+
}
|
|
3662
|
+
function ModuleInstantiate(context, _state, declarations, options) {
|
|
3663
|
+
const instantiatedModule = InstantiateModule(context, declarations, options);
|
|
3664
|
+
return instantiatedModule;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
// node_modules/typebox/build/type/action/non_nullable.mjs
|
|
3668
|
+
function NonNullableDeferred(type, options = {}) {
|
|
3669
|
+
return Deferred("NonNullable", [type], options);
|
|
3670
|
+
}
|
|
3671
|
+
function NonNullable(type, options = {}) {
|
|
3672
|
+
return NonNullableAction(type, options);
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3675
|
+
// node_modules/typebox/build/type/engine/non_nullable/instantiate.mjs
|
|
3676
|
+
function NonNullableOperation(type) {
|
|
3677
|
+
const excluded = Union([Null(), Undefined()]);
|
|
3678
|
+
return ExcludeAction(type, excluded, {});
|
|
3679
|
+
}
|
|
3680
|
+
function NonNullableAction(type, options) {
|
|
3681
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(NonNullableOperation(type), {}, options) : NonNullableDeferred(type, options);
|
|
3682
|
+
return result;
|
|
3683
|
+
}
|
|
3684
|
+
function NonNullableInstantiate(context, state, type, options) {
|
|
3685
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3686
|
+
return NonNullableAction(instantiatedType, options);
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
// node_modules/typebox/build/type/action/omit.mjs
|
|
3690
|
+
function OmitDeferred(type, indexer, options = {}) {
|
|
3691
|
+
return Deferred("Omit", [type, indexer], options);
|
|
3692
|
+
}
|
|
3693
|
+
function Omit(type, indexer_or_keys, options = {}) {
|
|
3694
|
+
const indexer = exports_guard.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
|
|
3695
|
+
return OmitAction(type, indexer, options);
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
// node_modules/typebox/build/type/engine/indexable/to_indexable.mjs
|
|
3699
|
+
function ToIndexable(type) {
|
|
3700
|
+
const collapsed = CollapseToObject(type);
|
|
3701
|
+
const result = IsObject2(collapsed) ? collapsed.properties : Unreachable();
|
|
3702
|
+
return result;
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
// node_modules/typebox/build/type/engine/omit/from_type.mjs
|
|
3706
|
+
function FromKeys(properties2, keys) {
|
|
3707
|
+
const result = exports_guard.Keys(properties2).reduce((result2, key) => {
|
|
3708
|
+
return keys.includes(key) ? result2 : { ...result2, [key]: properties2[key] };
|
|
3709
|
+
}, {});
|
|
3710
|
+
return result;
|
|
3711
|
+
}
|
|
3712
|
+
function FromType14(type, indexer) {
|
|
3713
|
+
const indexable = ToIndexable(type);
|
|
3714
|
+
const indexableKeys = ToIndexableKeys(indexer);
|
|
3715
|
+
const omitted = FromKeys(indexable, indexableKeys);
|
|
3716
|
+
const result = _Object_(omitted);
|
|
3717
|
+
return result;
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
// node_modules/typebox/build/type/engine/omit/instantiate.mjs
|
|
3721
|
+
function OmitAction(type, indexer, options) {
|
|
3722
|
+
const result = CanInstantiate([type, indexer]) ? exports_memory.Update(FromType14(type, indexer), {}, options) : OmitDeferred(type, indexer, options);
|
|
3723
|
+
return result;
|
|
3724
|
+
}
|
|
3725
|
+
function OmitInstantiate(context, state, type, indexer, options) {
|
|
3726
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3727
|
+
const instantiatedIndexer = InstantiateType(context, state, indexer);
|
|
3728
|
+
return OmitAction(instantiatedType, instantiatedIndexer, options);
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
// node_modules/typebox/build/type/action/parameters.mjs
|
|
3732
|
+
function ParametersDeferred(type, options = {}) {
|
|
3733
|
+
return Deferred("Parameters", [type], options);
|
|
3734
|
+
}
|
|
3735
|
+
function Parameters(type, options = {}) {
|
|
3736
|
+
return ParametersAction(type, options);
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
// node_modules/typebox/build/type/engine/parameters/instantiate.mjs
|
|
3740
|
+
function ParametersOperation(type) {
|
|
3741
|
+
const parameters = IsFunction2(type) ? type["parameters"] : [];
|
|
3742
|
+
const instantiatedParameters = InstantiateElements({}, State([], []), parameters);
|
|
3743
|
+
const result = Tuple(instantiatedParameters);
|
|
3744
|
+
return result;
|
|
3745
|
+
}
|
|
3746
|
+
function ParametersAction(type, options) {
|
|
3747
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(ParametersOperation(type), {}, options) : ParametersDeferred(type, options);
|
|
3748
|
+
return result;
|
|
3749
|
+
}
|
|
3750
|
+
function ParametersInstantiate(context, state, type, options) {
|
|
3751
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3752
|
+
return ParametersAction(instantiatedType, options);
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
// node_modules/typebox/build/type/action/partial.mjs
|
|
3756
|
+
function PartialDeferred(type, options = {}) {
|
|
3757
|
+
return Deferred("Partial", [type], options);
|
|
3758
|
+
}
|
|
3759
|
+
function Partial(type, options = {}) {
|
|
3760
|
+
return PartialAction(type, options);
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
// node_modules/typebox/build/type/engine/partial/from_cyclic.mjs
|
|
3764
|
+
function FromCyclic3(defs, ref2) {
|
|
3765
|
+
const target2 = CyclicTarget(defs, ref2);
|
|
3766
|
+
const partial = FromType15(target2);
|
|
3767
|
+
const result = Cyclic(exports_memory.Assign(defs, { [ref2]: partial }), ref2);
|
|
3768
|
+
return result;
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
// node_modules/typebox/build/type/engine/partial/from_dependent.mjs
|
|
3772
|
+
function FromDependent3(if_, then_, else_) {
|
|
3773
|
+
const evaluated = EvaluateDependent(if_, then_, else_);
|
|
3774
|
+
const result = FromType15(evaluated);
|
|
3775
|
+
return result;
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
// node_modules/typebox/build/type/engine/partial/from_intersect.mjs
|
|
3779
|
+
function FromIntersect3(types) {
|
|
3780
|
+
const evaluated = EvaluateIntersect(types);
|
|
3781
|
+
const result = FromType15(evaluated);
|
|
3782
|
+
return result;
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3785
|
+
// node_modules/typebox/build/type/engine/partial/from_union.mjs
|
|
3786
|
+
function FromUnion6(types) {
|
|
3787
|
+
const result = types.map((type) => FromType15(type));
|
|
3788
|
+
return Union(result);
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
// node_modules/typebox/build/type/engine/partial/from_object.mjs
|
|
3792
|
+
function FromObject6(properties2) {
|
|
3793
|
+
const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
|
|
3794
|
+
return { ...result2, [left]: AddOptional(properties2[left]) };
|
|
3795
|
+
}, {});
|
|
3796
|
+
const result = _Object_(mapped);
|
|
3797
|
+
return result;
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
// node_modules/typebox/build/type/engine/partial/from_type.mjs
|
|
3801
|
+
function FromType15(type) {
|
|
3802
|
+
return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsDependent(type) ? FromDependent3(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject2(type) ? FromObject6(type.properties) : _Object_({});
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
// node_modules/typebox/build/type/engine/partial/instantiate.mjs
|
|
3806
|
+
function PartialAction(type, options) {
|
|
3807
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType15(type), {}, options) : PartialDeferred(type, options);
|
|
3808
|
+
return result;
|
|
3809
|
+
}
|
|
3810
|
+
function PartialInstantiate(context, state, type, options) {
|
|
3811
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3812
|
+
return PartialAction(instantiatedType, options);
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
// node_modules/typebox/build/type/action/pick.mjs
|
|
3816
|
+
function PickDeferred(type, indexer, options = {}) {
|
|
3817
|
+
return Deferred("Pick", [type, indexer], options);
|
|
3818
|
+
}
|
|
3819
|
+
function Pick(type, indexer_or_keys, options = {}) {
|
|
3820
|
+
const indexer = exports_guard.IsArray(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys;
|
|
3821
|
+
return PickAction(type, indexer, options);
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
// node_modules/typebox/build/type/engine/pick/from_type.mjs
|
|
3825
|
+
function FromKeys2(properties2, keys) {
|
|
3826
|
+
const result = exports_guard.Keys(properties2).reduce((result2, key) => {
|
|
3827
|
+
return keys.includes(key) ? exports_memory.Assign(result2, { [key]: properties2[key] }) : result2;
|
|
3828
|
+
}, {});
|
|
3829
|
+
return result;
|
|
3830
|
+
}
|
|
3831
|
+
function FromType16(type, indexer) {
|
|
3832
|
+
const indexable = ToIndexable(type);
|
|
3833
|
+
const keys = ToIndexableKeys(indexer);
|
|
3834
|
+
const applied = FromKeys2(indexable, keys);
|
|
3835
|
+
const result = _Object_(applied);
|
|
3836
|
+
return result;
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
// node_modules/typebox/build/type/engine/pick/instantiate.mjs
|
|
3840
|
+
function PickAction(type, indexer, options) {
|
|
3841
|
+
const result = CanInstantiate([type, indexer]) ? exports_memory.Update(FromType16(type, indexer), {}, options) : PickDeferred(type, indexer, options);
|
|
3842
|
+
return result;
|
|
3843
|
+
}
|
|
3844
|
+
function PickInstantiate(context, state, type, indexer, options) {
|
|
3845
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3846
|
+
const instantiatedIndexer = InstantiateType(context, state, indexer);
|
|
3847
|
+
return PickAction(instantiatedType, instantiatedIndexer, options);
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
// node_modules/typebox/build/type/action/readonly_object.mjs
|
|
3851
|
+
function ReadonlyObjectDeferred(type, options = {}) {
|
|
3852
|
+
return Deferred("ReadonlyObject", [type], options);
|
|
3853
|
+
}
|
|
3854
|
+
function ReadonlyObject(type, options = {}) {
|
|
3855
|
+
return ReadonlyObjectAction(type, options);
|
|
3856
|
+
}
|
|
3857
|
+
var ReadonlyType = ReadonlyObject;
|
|
3858
|
+
|
|
3859
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_array.mjs
|
|
3860
|
+
function FromArray4(type) {
|
|
3861
|
+
const result = AddImmutable(_Array_(type));
|
|
3862
|
+
return result;
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_cyclic.mjs
|
|
3866
|
+
function FromCyclic4(defs, ref2) {
|
|
3867
|
+
const target2 = CyclicTarget(defs, ref2);
|
|
3868
|
+
const partial = FromType17(target2);
|
|
3869
|
+
const result = Cyclic(exports_memory.Assign(defs, { [ref2]: partial }), ref2);
|
|
3870
|
+
return result;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs
|
|
3874
|
+
function FromDependent4(if_, then_, else_) {
|
|
3875
|
+
const evaluated = EvaluateDependent(if_, then_, else_);
|
|
3876
|
+
const result = FromType17(evaluated);
|
|
3877
|
+
return result;
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs
|
|
3881
|
+
function FromIntersect4(types) {
|
|
3882
|
+
const evaluated = EvaluateIntersect(types);
|
|
3883
|
+
const result = FromType17(evaluated);
|
|
3884
|
+
return result;
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3887
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_object.mjs
|
|
3888
|
+
function FromObject7(properties2) {
|
|
3889
|
+
const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
|
|
3890
|
+
return { ...result2, [left]: AddReadonly(properties2[left]) };
|
|
3891
|
+
}, {});
|
|
3892
|
+
const result = _Object_(mapped);
|
|
3893
|
+
return result;
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3896
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs
|
|
3897
|
+
function FromTuple4(types) {
|
|
3898
|
+
const result = AddImmutable(Tuple(types));
|
|
3899
|
+
return result;
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_union.mjs
|
|
3903
|
+
function FromUnion7(types) {
|
|
3904
|
+
const result = types.map((type) => FromType17(type));
|
|
3905
|
+
return Union(result);
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
// node_modules/typebox/build/type/engine/readonly_object/from_type.mjs
|
|
3909
|
+
function FromType17(type) {
|
|
3910
|
+
return IsArray2(type) ? FromArray4(type.items) : IsCyclic(type) ? FromCyclic4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect4(type.allOf) : IsObject2(type) ? FromObject7(type.properties) : IsTuple(type) ? FromTuple4(type.items) : IsUnion(type) ? FromUnion7(type.anyOf) : type;
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
// node_modules/typebox/build/type/engine/readonly_object/instantiate.mjs
|
|
3914
|
+
function ReadonlyObjectAction(type, options) {
|
|
3915
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType17(type), {}, options) : ReadonlyObjectDeferred(type);
|
|
3916
|
+
return result;
|
|
3917
|
+
}
|
|
3918
|
+
function ReadonlyObjectInstantiate(context, state, type, options) {
|
|
3919
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
3920
|
+
return ReadonlyObjectAction(instantiatedType, options);
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
// node_modules/typebox/build/type/engine/ref/instantiate.mjs
|
|
3924
|
+
function RefInstantiate(context, state, type, ref2) {
|
|
3925
|
+
return state.visited.includes(ref2) ? type : (ref2 in context) ? InstantiateType(context, State(state["callstack"], [...state["visited"], ref2]), context[ref2]) : type;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
// node_modules/typebox/build/type/engine/required/from_cyclic.mjs
|
|
3929
|
+
function FromCyclic5(defs, ref2) {
|
|
3930
|
+
const target2 = CyclicTarget(defs, ref2);
|
|
3931
|
+
const partial = FromType18(target2);
|
|
3932
|
+
const result = Cyclic(exports_memory.Assign(defs, { [ref2]: partial }), ref2);
|
|
3933
|
+
return result;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
// node_modules/typebox/build/type/engine/required/from_dependent.mjs
|
|
3937
|
+
function FromDependent5(if_, then_, else_) {
|
|
3938
|
+
const evaluated = EvaluateDependent(if_, then_, else_);
|
|
3939
|
+
const result = FromType18(evaluated);
|
|
3940
|
+
return result;
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
// node_modules/typebox/build/type/engine/required/from_intersect.mjs
|
|
3944
|
+
function FromIntersect5(types) {
|
|
3945
|
+
const evaluated = EvaluateIntersect(types);
|
|
3946
|
+
const result = FromType18(evaluated);
|
|
3947
|
+
return result;
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
// node_modules/typebox/build/type/engine/required/from_union.mjs
|
|
3951
|
+
function FromUnion8(types) {
|
|
3952
|
+
const result = types.map((type) => FromType18(type));
|
|
3953
|
+
return Union(result);
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
// node_modules/typebox/build/type/engine/required/from_object.mjs
|
|
3957
|
+
function FromObject8(properties2) {
|
|
3958
|
+
const mapped = exports_guard.Keys(properties2).reduce((result2, left) => {
|
|
3959
|
+
return { ...result2, [left]: RemoveOptional(properties2[left]) };
|
|
3960
|
+
}, {});
|
|
3961
|
+
const result = _Object_(mapped);
|
|
3962
|
+
return result;
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
// node_modules/typebox/build/type/engine/required/from_type.mjs
|
|
3966
|
+
function FromType18(type) {
|
|
3967
|
+
return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent5(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject2(type) ? FromObject8(type.properties) : _Object_({});
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
// node_modules/typebox/build/type/action/required.mjs
|
|
3971
|
+
function RequiredDeferred(type, options = {}) {
|
|
3972
|
+
return Deferred("Required", [type], options);
|
|
3973
|
+
}
|
|
3974
|
+
function Required(type, options = {}) {
|
|
3975
|
+
return RequiredAction(type, options);
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3978
|
+
// node_modules/typebox/build/type/engine/required/instantiate.mjs
|
|
3979
|
+
function RequiredAction(type, options) {
|
|
3980
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(FromType18(type), {}, options) : RequiredDeferred(type, options);
|
|
3981
|
+
return result;
|
|
3982
|
+
}
|
|
3983
|
+
function RequiredInstantiate(context, state, type, options) {
|
|
3984
|
+
const instaniatedType = InstantiateType(context, state, type);
|
|
3985
|
+
return RequiredAction(instaniatedType, options);
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
// node_modules/typebox/build/type/action/return_type.mjs
|
|
3989
|
+
function ReturnTypeDeferred(type, options = {}) {
|
|
3990
|
+
return Deferred("ReturnType", [type], options);
|
|
3991
|
+
}
|
|
3992
|
+
function ReturnType(type, options = {}) {
|
|
3993
|
+
return ReturnTypeAction(type, options);
|
|
3994
|
+
}
|
|
3995
|
+
|
|
3996
|
+
// node_modules/typebox/build/type/engine/return_type/instantiate.mjs
|
|
3997
|
+
function ReturnTypeOperation(type) {
|
|
3998
|
+
return IsFunction2(type) ? type["returnType"] : Never();
|
|
3999
|
+
}
|
|
4000
|
+
function ReturnTypeAction(type, options) {
|
|
4001
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(ReturnTypeOperation(type), {}, options) : ReturnTypeDeferred(type, options);
|
|
4002
|
+
return result;
|
|
4003
|
+
}
|
|
4004
|
+
function ReturnTypeInstantiate(context, state, type, options = {}) {
|
|
4005
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
4006
|
+
return ReturnTypeAction(instantiatedType, options);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
// node_modules/typebox/build/type/action/with.mjs
|
|
4010
|
+
function WithDeferred(type, options) {
|
|
4011
|
+
return Deferred("With", [type, options], {});
|
|
4012
|
+
}
|
|
4013
|
+
function With2(type, options) {
|
|
4014
|
+
return WithAction(type, options);
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
// node_modules/typebox/build/type/engine/with/instantiate.mjs
|
|
4018
|
+
function WithAction(type, options) {
|
|
4019
|
+
const result = CanInstantiate([type]) ? exports_memory.Update(type, {}, options) : WithDeferred(type, options);
|
|
4020
|
+
return result;
|
|
4021
|
+
}
|
|
4022
|
+
function WithInstantiate(context, state, type, options) {
|
|
4023
|
+
const instaniatedType = InstantiateType(context, state, type);
|
|
4024
|
+
return WithAction(instaniatedType, options);
|
|
4025
|
+
}
|
|
4026
|
+
|
|
4027
|
+
// node_modules/typebox/build/type/engine/rest/spread.mjs
|
|
4028
|
+
function SpreadElement(type) {
|
|
4029
|
+
const result = IsRest(type) ? IsTuple(type.items) ? RestSpread(type.items.items) : IsInfer(type.items) ? [type] : IsRef(type.items) ? [type] : [Never()] : [type];
|
|
4030
|
+
return result;
|
|
4031
|
+
}
|
|
4032
|
+
function RestSpread(types) {
|
|
4033
|
+
const result = types.reduce((result2, left) => {
|
|
4034
|
+
return [...result2, ...SpreadElement(left)];
|
|
4035
|
+
}, []);
|
|
4036
|
+
return result;
|
|
4037
|
+
}
|
|
4038
|
+
// node_modules/typebox/build/type/engine/instantiate.mjs
|
|
4039
|
+
function State(callstack, visited) {
|
|
4040
|
+
return { callstack, visited };
|
|
4041
|
+
}
|
|
4042
|
+
function CanInstantiate(types) {
|
|
4043
|
+
return exports_guard.ShiftLeft(types, (left, right) => IsRef(left) ? false : CanInstantiate(right), () => true);
|
|
4044
|
+
}
|
|
4045
|
+
function InstantiateProperties(context, state, properties2) {
|
|
4046
|
+
return exports_guard.Keys(properties2).reduce((result, key) => {
|
|
4047
|
+
return { ...result, [key]: InstantiateType(context, state, properties2[key]) };
|
|
4048
|
+
}, {});
|
|
4049
|
+
}
|
|
4050
|
+
function InstantiateElements(context, state, types) {
|
|
4051
|
+
const elements = InstantiateTypes(context, state, types);
|
|
4052
|
+
const result = RestSpread(elements);
|
|
4053
|
+
return result;
|
|
4054
|
+
}
|
|
4055
|
+
function InstantiateTypes(context, state, types) {
|
|
4056
|
+
return types.map((type) => InstantiateType(context, state, type));
|
|
4057
|
+
}
|
|
4058
|
+
function WithModifiers(type, instantiatedType) {
|
|
4059
|
+
const withOptional = IsOptional(type) ? AddOptionalAction(instantiatedType, {}) : instantiatedType;
|
|
4060
|
+
const withReadonly = IsReadonly(type) ? AddReadonlyAction(withOptional, {}) : withOptional;
|
|
4061
|
+
const withImmutable = IsImmutable(type) ? AddImmutableAction(withReadonly, {}) : withReadonly;
|
|
4062
|
+
return withImmutable;
|
|
4063
|
+
}
|
|
4064
|
+
function InstantiateDeferred(context, state, action, parameters, options) {
|
|
4065
|
+
return exports_guard.IsEqual(action, "AddImmutable") ? AddImmutableInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "RemoveImmutable") ? RemoveImmutableInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "AddReadonly") ? AddReadonlyInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "RemoveReadonly") ? RemoveReadonlyInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "AddOptional") ? AddOptionalInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "RemoveOptional") ? RemoveOptionalInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Capitalize") ? CapitalizeInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Conditional") ? ConditionalInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : exports_guard.IsEqual(action, "ConstructorParameters") ? ConstructorParametersInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Evaluate") ? EvaluateInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Exclude") ? ExcludeInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "Extract") ? ExtractInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "Index") ? IndexInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "InstanceType") ? InstanceTypeInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Interface") ? InterfaceInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "KeyOf") ? KeyOfInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Lowercase") ? LowercaseInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Mapped") ? MappedInstantiate(context, state, parameters[0], parameters[1], parameters[2], parameters[3], options) : exports_guard.IsEqual(action, "Module") ? ModuleInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "NonNullable") ? NonNullableInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Pick") ? PickInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "Parameters") ? ParametersInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Partial") ? PartialInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Omit") ? OmitInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "ReadonlyObject") ? ReadonlyObjectInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Record") ? RecordInstantiate(context, state, parameters[0], parameters[1], options) : exports_guard.IsEqual(action, "Required") ? RequiredInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "ReturnType") ? ReturnTypeInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "TemplateLiteral") ? TemplateLiteralInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Uncapitalize") ? UncapitalizeInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "Uppercase") ? UppercaseInstantiate(context, state, parameters[0], options) : exports_guard.IsEqual(action, "With") ? WithInstantiate(context, state, parameters[0], parameters[1]) : Deferred(action, parameters, options);
|
|
4066
|
+
}
|
|
4067
|
+
function InstantiateImmediate(context, state, type) {
|
|
4068
|
+
const instantiatedType = IsRef(type) ? RefInstantiate(context, state, type, type.$ref) : IsArray2(type) ? _Array_(InstantiateType(context, state, type.items), ArrayOptions(type)) : IsCall(type) ? CallInstantiate(context, state, type.target, type.arguments) : IsConstructor2(type) ? Constructor(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.instanceType), ConstructorOptions(type)) : IsFunction2(type) ? _Function_(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.returnType), FunctionOptions(type)) : IsDependent(type) ? Dependent(InstantiateType(context, state, type.if), InstantiateType(context, state, type.then), InstantiateType(context, state, type.else), DependentOptions(type)) : IsIntersect(type) ? Intersect(InstantiateTypes(context, state, type.allOf), IntersectOptions(type)) : IsObject2(type) ? _Object_(InstantiateProperties(context, state, type.properties), ObjectOptions(type)) : IsRecord(type) ? RecordFromPattern(RecordPattern(type), InstantiateType(context, state, RecordValue(type))) : IsRest(type) ? Rest(InstantiateType(context, state, type.items)) : IsTuple(type) ? Tuple(InstantiateElements(context, state, type.items), TupleOptions(type)) : IsUnion(type) ? Union(InstantiateTypes(context, state, type.anyOf), UnionOptions(type)) : type;
|
|
4069
|
+
const withModifiers = WithModifiers(type, instantiatedType);
|
|
4070
|
+
return withModifiers;
|
|
4071
|
+
}
|
|
4072
|
+
function InstantiateType(context, state, type) {
|
|
4073
|
+
const result = IsDeferred(type) ? InstantiateDeferred(context, state, type.action, type.parameters, type.options) : InstantiateImmediate(context, state, type);
|
|
4074
|
+
return result;
|
|
4075
|
+
}
|
|
4076
|
+
function Instantiate(context, type) {
|
|
4077
|
+
return InstantiateType(context, State([], []), type);
|
|
4078
|
+
}
|
|
4079
|
+
|
|
4080
|
+
// node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs
|
|
4081
|
+
function AddImmutableOperation(type) {
|
|
4082
|
+
return exports_memory.Update(type, { "~immutable": true }, {});
|
|
4083
|
+
}
|
|
4084
|
+
function AddImmutableAction(type, options) {
|
|
4085
|
+
const result = exports_memory.Update(AddImmutableOperation(type), {}, options);
|
|
4086
|
+
return result;
|
|
4087
|
+
}
|
|
4088
|
+
function AddImmutableInstantiate(context, state, type, options) {
|
|
4089
|
+
const instantiatedType = InstantiateType(context, state, type);
|
|
4090
|
+
return AddImmutableAction(instantiatedType, options);
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
// node_modules/typebox/build/type/action/_add_immutable.mjs
|
|
4094
|
+
function AddImmutableDeferred(type, options = {}) {
|
|
4095
|
+
return Deferred("AddImmutable", [type], options);
|
|
4096
|
+
}
|
|
4097
|
+
function AddImmutable(type, options = {}) {
|
|
4098
|
+
return AddImmutableAction(type, options);
|
|
4099
|
+
}
|
|
4100
|
+
// node_modules/typebox/build/type/action/evaluate.mjs
|
|
4101
|
+
function EvaluateDeferred(type, options = {}) {
|
|
4102
|
+
return Deferred("Evaluate", [type], options);
|
|
4103
|
+
}
|
|
4104
|
+
function Evaluate(type, options = {}) {
|
|
4105
|
+
return EvaluateAction(type, options);
|
|
4106
|
+
}
|
|
4107
|
+
// node_modules/typebox/build/type/action/module.mjs
|
|
4108
|
+
function ModuleDeferred(declarations, options = {}) {
|
|
4109
|
+
return Deferred("Module", [declarations], options);
|
|
4110
|
+
}
|
|
4111
|
+
function Module2(declarations, options = {}) {
|
|
4112
|
+
return ModuleInstantiate({}, State([], []), declarations, options);
|
|
4113
|
+
}
|
|
4114
|
+
// node_modules/typebox/build/type/script/script.mjs
|
|
4115
|
+
function Script2(...args) {
|
|
4116
|
+
const [context, input, options] = exports_arguments.Match(args, {
|
|
4117
|
+
2: (script, options2) => exports_guard.IsString(script) ? [{}, script, options2] : [script, options2, {}],
|
|
4118
|
+
3: (context2, script, options2) => [context2, script, options2],
|
|
4119
|
+
1: (script) => [{}, script, {}]
|
|
4120
|
+
});
|
|
4121
|
+
const result = Script(input);
|
|
4122
|
+
const parsed = exports_guard.IsArray(result) && exports_guard.IsEqual(result.length, 2) ? InstantiateType(context, State([], []), result[0]) : Never();
|
|
4123
|
+
return exports_memory.Update(parsed, {}, options);
|
|
4124
|
+
}
|
|
4125
|
+
// node_modules/typebox/build/typebox.mjs
|
|
4126
|
+
var exports_typebox = {};
|
|
4127
|
+
__export(exports_typebox, {
|
|
4128
|
+
With: () => With2,
|
|
4129
|
+
Void: () => Void,
|
|
4130
|
+
Uppercase: () => Uppercase,
|
|
4131
|
+
Unsafe: () => Unsafe,
|
|
4132
|
+
Unknown: () => Unknown,
|
|
4133
|
+
Union: () => Union,
|
|
4134
|
+
Undefined: () => Undefined,
|
|
4135
|
+
Uncapitalize: () => Uncapitalize,
|
|
4136
|
+
Tuple: () => Tuple,
|
|
4137
|
+
This: () => This,
|
|
4138
|
+
TemplateLiteral: () => TemplateLiteral2,
|
|
4139
|
+
Symbol: () => Symbol2,
|
|
4140
|
+
String: () => String2,
|
|
4141
|
+
Script: () => Script2,
|
|
4142
|
+
ReturnType: () => ReturnType,
|
|
4143
|
+
Rest: () => Rest,
|
|
4144
|
+
Required: () => Required,
|
|
4145
|
+
Refine: () => Refine,
|
|
4146
|
+
Ref: () => Ref,
|
|
4147
|
+
RecordValue: () => RecordValue,
|
|
4148
|
+
RecordPattern: () => RecordPattern,
|
|
4149
|
+
RecordKey: () => RecordKey,
|
|
4150
|
+
Record: () => Record,
|
|
4151
|
+
ReadonlyType: () => ReadonlyType,
|
|
4152
|
+
ReadonlyObject: () => ReadonlyObject,
|
|
4153
|
+
Readonly: () => Readonly,
|
|
4154
|
+
Pick: () => Pick,
|
|
4155
|
+
Partial: () => Partial,
|
|
4156
|
+
Parameters: () => Parameters,
|
|
4157
|
+
Parameter: () => Parameter,
|
|
4158
|
+
Optional: () => Optional,
|
|
4159
|
+
Omit: () => Omit,
|
|
4160
|
+
Object: () => _Object_,
|
|
4161
|
+
Number: () => Number2,
|
|
4162
|
+
Null: () => Null,
|
|
4163
|
+
NonNullable: () => NonNullable,
|
|
4164
|
+
Never: () => Never,
|
|
4165
|
+
Module: () => Module2,
|
|
4166
|
+
Mapped: () => Mapped,
|
|
4167
|
+
Lowercase: () => Lowercase,
|
|
4168
|
+
Literal: () => Literal,
|
|
4169
|
+
KeyOf: () => KeyOf2,
|
|
4170
|
+
IsVoid: () => IsVoid,
|
|
4171
|
+
IsUnsafe: () => IsUnsafe,
|
|
4172
|
+
IsUnknown: () => IsUnknown,
|
|
4173
|
+
IsUnion: () => IsUnion,
|
|
4174
|
+
IsUndefined: () => IsUndefined2,
|
|
4175
|
+
IsTuple: () => IsTuple,
|
|
4176
|
+
IsThis: () => IsThis,
|
|
4177
|
+
IsTemplateLiteral: () => IsTemplateLiteral,
|
|
4178
|
+
IsSymbol: () => IsSymbol2,
|
|
4179
|
+
IsString: () => IsString3,
|
|
4180
|
+
IsSchema: () => IsSchema,
|
|
4181
|
+
IsRest: () => IsRest,
|
|
4182
|
+
IsRefine: () => IsRefine,
|
|
4183
|
+
IsRef: () => IsRef,
|
|
4184
|
+
IsRecord: () => IsRecord,
|
|
4185
|
+
IsReadonly: () => IsReadonly,
|
|
4186
|
+
IsParameter: () => IsParameter,
|
|
4187
|
+
IsOptional: () => IsOptional,
|
|
4188
|
+
IsObject: () => IsObject2,
|
|
4189
|
+
IsNumber: () => IsNumber3,
|
|
4190
|
+
IsNull: () => IsNull2,
|
|
4191
|
+
IsNever: () => IsNever,
|
|
4192
|
+
IsLiteral: () => IsLiteral,
|
|
4193
|
+
IsKind: () => IsKind,
|
|
4194
|
+
IsIntersect: () => IsIntersect,
|
|
4195
|
+
IsInteger: () => IsInteger2,
|
|
4196
|
+
IsInfer: () => IsInfer,
|
|
4197
|
+
IsImmutable: () => IsImmutable,
|
|
4198
|
+
IsIdentifier: () => IsIdentifier,
|
|
4199
|
+
IsGeneric: () => IsGeneric,
|
|
4200
|
+
IsFunction: () => IsFunction2,
|
|
4201
|
+
IsEnumValue: () => IsEnumValue,
|
|
4202
|
+
IsEnum: () => IsEnum,
|
|
4203
|
+
IsDependent: () => IsDependent,
|
|
4204
|
+
IsCyclic: () => IsCyclic,
|
|
4205
|
+
IsConstructor: () => IsConstructor2,
|
|
4206
|
+
IsCodec: () => IsCodec,
|
|
4207
|
+
IsCall: () => IsCall,
|
|
4208
|
+
IsBoolean: () => IsBoolean3,
|
|
4209
|
+
IsBigInt: () => IsBigInt2,
|
|
4210
|
+
IsArray: () => IsArray2,
|
|
4211
|
+
IsAny: () => IsAny,
|
|
4212
|
+
Intersect: () => Intersect,
|
|
4213
|
+
Interface: () => Interface,
|
|
4214
|
+
Integer: () => Integer,
|
|
4215
|
+
Instantiate: () => Instantiate,
|
|
4216
|
+
InstanceType: () => InstanceType,
|
|
4217
|
+
Infer: () => Infer,
|
|
4218
|
+
Index: () => Index,
|
|
4219
|
+
Immutable: () => Immutable,
|
|
4220
|
+
Identifier: () => Identifier,
|
|
4221
|
+
Generic: () => Generic,
|
|
4222
|
+
Function: () => _Function_,
|
|
4223
|
+
Extract: () => Extract,
|
|
4224
|
+
ExtendsResult: () => exports_result,
|
|
4225
|
+
Extends: () => Extends,
|
|
4226
|
+
Exclude: () => Exclude,
|
|
4227
|
+
Evaluate: () => Evaluate,
|
|
4228
|
+
Enum: () => Enum,
|
|
4229
|
+
EncodeBuilder: () => EncodeBuilder,
|
|
4230
|
+
Encode: () => Encode,
|
|
4231
|
+
Dependent: () => Dependent,
|
|
4232
|
+
DecodeBuilder: () => DecodeBuilder,
|
|
4233
|
+
Decode: () => Decode,
|
|
4234
|
+
Cyclic: () => Cyclic,
|
|
4235
|
+
ConstructorParameters: () => ConstructorParameters,
|
|
4236
|
+
Constructor: () => Constructor,
|
|
4237
|
+
Conditional: () => Conditional,
|
|
4238
|
+
Codec: () => Codec,
|
|
4239
|
+
Capitalize: () => Capitalize,
|
|
4240
|
+
Call: () => Call,
|
|
4241
|
+
Boolean: () => Boolean2,
|
|
4242
|
+
BigInt: () => BigInt2,
|
|
4243
|
+
Array: () => _Array_,
|
|
4244
|
+
Any: () => Any
|
|
4245
|
+
});
|
|
4246
|
+
// src/runtime/pi-supervised-command.ts
|
|
4247
|
+
import { spawn, spawnSync } from "child_process";
|
|
4248
|
+
import { randomBytes } from "crypto";
|
|
4249
|
+
import fs from "fs";
|
|
4250
|
+
import path from "path";
|
|
4251
|
+
var DEFAULT_WAIT_SECONDS = 60;
|
|
4252
|
+
var DEFAULT_LIFE_SECONDS = 600;
|
|
4253
|
+
var MAX_STREAM_BYTES = 64 * 1024;
|
|
4254
|
+
function supervisedWaitSeconds() {
|
|
4255
|
+
const raw = Number.parseInt(process.env.LARKIN_PI_SUPERVISED_WAIT_SECONDS || "", 10);
|
|
4256
|
+
if (Number.isInteger(raw) && raw > 0)
|
|
4257
|
+
return Math.min(raw, DEFAULT_WAIT_SECONDS);
|
|
4258
|
+
return DEFAULT_WAIT_SECONDS;
|
|
4259
|
+
}
|
|
4260
|
+
function supervisedLifeSeconds() {
|
|
4261
|
+
const raw = Number.parseInt(process.env.LARKIN_PI_SUPERVISED_LIFE_SECONDS || "", 10);
|
|
4262
|
+
if (Number.isInteger(raw) && raw > 0)
|
|
4263
|
+
return Math.min(raw, DEFAULT_LIFE_SECONDS);
|
|
4264
|
+
return DEFAULT_LIFE_SECONDS;
|
|
4265
|
+
}
|
|
4266
|
+
function resolveSupervisedCwd(root, requested) {
|
|
4267
|
+
if (typeof root !== "string" || root.length === 0)
|
|
4268
|
+
throw new Error("supervised cwd root is required");
|
|
4269
|
+
if (fs.lstatSync(root).isSymbolicLink())
|
|
4270
|
+
throw new Error("supervised cwd must not be a symlink");
|
|
4271
|
+
const base = fs.realpathSync(root);
|
|
4272
|
+
const target2 = requested && requested.length > 0 ? path.resolve(base, requested) : base;
|
|
4273
|
+
const relative = path.relative(base, target2);
|
|
4274
|
+
if (relative.startsWith("..") || path.isAbsolute(relative))
|
|
4275
|
+
throw new Error("supervised cwd escapes the session root");
|
|
4276
|
+
let current = base;
|
|
4277
|
+
if (relative && relative !== ".") {
|
|
4278
|
+
for (const part of relative.split(path.sep)) {
|
|
4279
|
+
if (!part || part === ".")
|
|
4280
|
+
continue;
|
|
4281
|
+
current = path.join(current, part);
|
|
4282
|
+
if (fs.lstatSync(current).isSymbolicLink())
|
|
4283
|
+
throw new Error("supervised cwd must not be a symlink");
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
const real = fs.realpathSync(current);
|
|
4287
|
+
const prefix = base.endsWith(path.sep) ? base : base + path.sep;
|
|
4288
|
+
if (real !== base && !real.startsWith(prefix))
|
|
4289
|
+
throw new Error("supervised cwd escapes the session root");
|
|
4290
|
+
if (!fs.statSync(real).isDirectory())
|
|
4291
|
+
throw new Error("supervised cwd is not a directory");
|
|
4292
|
+
return real;
|
|
4293
|
+
}
|
|
4294
|
+
function pidAlive(pid) {
|
|
4295
|
+
try {
|
|
4296
|
+
process.kill(pid, 0);
|
|
4297
|
+
return true;
|
|
4298
|
+
} catch {
|
|
4299
|
+
return false;
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
function listDescendantPids(root) {
|
|
4303
|
+
if (process.platform === "win32")
|
|
4304
|
+
return [];
|
|
4305
|
+
const found = new Set;
|
|
4306
|
+
const queue = [root];
|
|
4307
|
+
while (queue.length > 0) {
|
|
4308
|
+
const current = queue.pop();
|
|
4309
|
+
if (current === undefined)
|
|
4310
|
+
break;
|
|
4311
|
+
const listed = spawnSync("pgrep", ["-P", String(current)], { encoding: "utf8" });
|
|
4312
|
+
if (listed.status !== 0 || !listed.stdout)
|
|
4313
|
+
continue;
|
|
4314
|
+
for (const line of listed.stdout.split(/\s+/)) {
|
|
4315
|
+
const child = Number.parseInt(line, 10);
|
|
4316
|
+
if (!Number.isInteger(child) || child <= 0 || found.has(child) || child === root)
|
|
4317
|
+
continue;
|
|
4318
|
+
found.add(child);
|
|
4319
|
+
queue.push(child);
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
return [...found];
|
|
4323
|
+
}
|
|
4324
|
+
function refreshTreePids(pid, known) {
|
|
4325
|
+
known.add(pid);
|
|
4326
|
+
for (const child of listDescendantPids(pid))
|
|
4327
|
+
known.add(child);
|
|
4328
|
+
return [...known];
|
|
4329
|
+
}
|
|
4330
|
+
async function killProcessTree(pid, known = new Set([pid])) {
|
|
4331
|
+
const descendants = refreshTreePids(pid, known).filter((child) => child !== pid);
|
|
4332
|
+
if (process.platform === "win32") {
|
|
4333
|
+
const result = await new Promise((resolve) => {
|
|
4334
|
+
const child = spawn("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
|
|
4335
|
+
child.once("error", (error) => resolve({ status: null, error }));
|
|
4336
|
+
child.once("exit", (status) => resolve({ status }));
|
|
4337
|
+
});
|
|
4338
|
+
if (result.error && pidAlive(pid))
|
|
4339
|
+
throw result.error;
|
|
4340
|
+
} else {
|
|
4341
|
+
for (const child of [...descendants].reverse()) {
|
|
4342
|
+
try {
|
|
4343
|
+
process.kill(child, "SIGKILL");
|
|
4344
|
+
} catch {}
|
|
4345
|
+
}
|
|
4346
|
+
try {
|
|
4347
|
+
process.kill(-pid, "SIGKILL");
|
|
4348
|
+
} catch {
|
|
4349
|
+
try {
|
|
4350
|
+
process.kill(pid, "SIGKILL");
|
|
4351
|
+
} catch {}
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
const started = Date.now();
|
|
4355
|
+
const pending = () => pidAlive(pid) || descendants.some((child) => pidAlive(child));
|
|
4356
|
+
while (pending() && Date.now() - started < 2000) {
|
|
4357
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
4358
|
+
if (process.platform !== "win32") {
|
|
4359
|
+
for (const child of descendants) {
|
|
4360
|
+
try {
|
|
4361
|
+
process.kill(child, "SIGKILL");
|
|
4362
|
+
} catch {}
|
|
4363
|
+
}
|
|
4364
|
+
try {
|
|
4365
|
+
process.kill(pid, "SIGKILL");
|
|
4366
|
+
} catch {}
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4369
|
+
if (pending())
|
|
4370
|
+
throw new Error(`supervised process tree ${pid} still alive`);
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4373
|
+
class ByteCursor {
|
|
4374
|
+
chunks = [];
|
|
4375
|
+
dropped = 0;
|
|
4376
|
+
write(chunk) {
|
|
4377
|
+
let data = chunk;
|
|
4378
|
+
if (chunk.length > MAX_STREAM_BYTES) {
|
|
4379
|
+
this.dropped += chunk.length - MAX_STREAM_BYTES;
|
|
4380
|
+
data = chunk.subarray(chunk.length - MAX_STREAM_BYTES);
|
|
4381
|
+
}
|
|
4382
|
+
this.chunks.push(data);
|
|
4383
|
+
let total = this.chunks.reduce((n, c) => n + c.length, 0);
|
|
4384
|
+
while (total > MAX_STREAM_BYTES && this.chunks.length) {
|
|
4385
|
+
const overflow = total - MAX_STREAM_BYTES;
|
|
4386
|
+
const head = this.chunks[0];
|
|
4387
|
+
if (head.length <= overflow) {
|
|
4388
|
+
this.chunks.shift();
|
|
4389
|
+
this.dropped += head.length;
|
|
4390
|
+
total -= head.length;
|
|
4391
|
+
} else {
|
|
4392
|
+
this.chunks[0] = head.subarray(overflow);
|
|
4393
|
+
this.dropped += overflow;
|
|
4394
|
+
total -= overflow;
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
snapshot(cursor) {
|
|
4399
|
+
const joined = Buffer.concat(this.chunks);
|
|
4400
|
+
let start = Math.max(0, cursor - this.dropped);
|
|
4401
|
+
if (start < joined.length) {
|
|
4402
|
+
while (start < joined.length && (joined[start] & 192) === 128)
|
|
4403
|
+
start++;
|
|
4404
|
+
}
|
|
4405
|
+
let end = joined.length;
|
|
4406
|
+
if (end > start) {
|
|
4407
|
+
let cont = 0;
|
|
4408
|
+
let i = end;
|
|
4409
|
+
while (i > start && (joined[i - 1] & 192) === 128) {
|
|
4410
|
+
i--;
|
|
4411
|
+
cont++;
|
|
4412
|
+
}
|
|
4413
|
+
if (i > start) {
|
|
4414
|
+
const lead = joined[i - 1];
|
|
4415
|
+
const need = lead < 128 ? 1 : lead < 224 ? 2 : lead < 240 ? 3 : 4;
|
|
4416
|
+
if (cont + 1 < need)
|
|
4417
|
+
end = i - 1;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
const slice = joined.subarray(Math.min(start, end), end);
|
|
4421
|
+
return {
|
|
4422
|
+
text: slice.toString("utf8"),
|
|
4423
|
+
cursor: this.dropped + end,
|
|
4424
|
+
truncated: this.dropped > cursor || start > Math.max(0, cursor - this.dropped)
|
|
4425
|
+
};
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
var handles = new Map;
|
|
4429
|
+
var terminals = new Map;
|
|
4430
|
+
var MAX_TERMINALS = 32;
|
|
4431
|
+
function rememberTerminal(id, owner, snapshot) {
|
|
4432
|
+
terminals.set(id, { owner, snapshot });
|
|
4433
|
+
while (terminals.size > MAX_TERMINALS) {
|
|
4434
|
+
const oldest = terminals.keys().next().value;
|
|
4435
|
+
if (!oldest)
|
|
4436
|
+
break;
|
|
4437
|
+
terminals.delete(oldest);
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
4440
|
+
function notify(record3) {
|
|
4441
|
+
const waiters = record3.exitWaiters.splice(0);
|
|
4442
|
+
for (const wake of waiters)
|
|
4443
|
+
wake();
|
|
4444
|
+
}
|
|
4445
|
+
function finish(record3, status, exitCode) {
|
|
4446
|
+
if (record3.lifetimeTimer) {
|
|
4447
|
+
clearTimeout(record3.lifetimeTimer);
|
|
4448
|
+
record3.lifetimeTimer = undefined;
|
|
4449
|
+
}
|
|
4450
|
+
if (record3.treePoll) {
|
|
4451
|
+
clearInterval(record3.treePoll);
|
|
4452
|
+
record3.treePoll = undefined;
|
|
4453
|
+
}
|
|
4454
|
+
if (record3.status === "running") {
|
|
4455
|
+
record3.status = status;
|
|
4456
|
+
record3.exitCode = exitCode;
|
|
4457
|
+
}
|
|
4458
|
+
notify(record3);
|
|
4459
|
+
}
|
|
4460
|
+
function startSupervisedCommand(input) {
|
|
4461
|
+
if (typeof input.executable !== "string" || input.executable.length === 0) {
|
|
4462
|
+
throw new Error("executable must be a non-empty string");
|
|
4463
|
+
}
|
|
4464
|
+
if (!Array.isArray(input.args) || input.args.some((arg) => typeof arg !== "string")) {
|
|
4465
|
+
throw new Error("args must be a string array");
|
|
4466
|
+
}
|
|
4467
|
+
const cwd = resolveSupervisedCwd(input.cwd);
|
|
4468
|
+
const child = spawn(input.executable, input.args, {
|
|
4469
|
+
cwd,
|
|
4470
|
+
shell: false,
|
|
4471
|
+
detached: process.platform !== "win32",
|
|
4472
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
4473
|
+
windowsHide: true
|
|
4474
|
+
});
|
|
4475
|
+
let record3;
|
|
4476
|
+
child.on("error", (error) => {
|
|
4477
|
+
if (!record3)
|
|
4478
|
+
return;
|
|
4479
|
+
const current = record3;
|
|
4480
|
+
current.chain.then(async () => {
|
|
4481
|
+
await killProcessTree(current.pid, current.treePids);
|
|
4482
|
+
finish(current, "killed", null);
|
|
4483
|
+
});
|
|
4484
|
+
});
|
|
4485
|
+
if (!child.pid)
|
|
4486
|
+
throw new Error("failed to spawn supervised command");
|
|
4487
|
+
const id = randomBytes(16).toString("hex");
|
|
4488
|
+
record3 = {
|
|
4489
|
+
id,
|
|
4490
|
+
owner: input.owner,
|
|
4491
|
+
child,
|
|
4492
|
+
pid: child.pid,
|
|
4493
|
+
startedAt: Date.now(),
|
|
4494
|
+
deadlineAt: Date.now() + supervisedLifeSeconds() * 1000,
|
|
4495
|
+
stdout: new ByteCursor,
|
|
4496
|
+
stderr: new ByteCursor,
|
|
4497
|
+
stdoutCursor: 0,
|
|
4498
|
+
stderrCursor: 0,
|
|
4499
|
+
status: "running",
|
|
4500
|
+
exitCode: null,
|
|
4501
|
+
terminalConsumed: false,
|
|
4502
|
+
cancelRequested: false,
|
|
4503
|
+
exitWaiters: [],
|
|
4504
|
+
treePids: new Set([child.pid]),
|
|
4505
|
+
chain: Promise.resolve(),
|
|
4506
|
+
closed: Promise.resolve()
|
|
4507
|
+
};
|
|
4508
|
+
const started = record3;
|
|
4509
|
+
let markClosed = () => {};
|
|
4510
|
+
started.closed = new Promise((resolve) => {
|
|
4511
|
+
markClosed = resolve;
|
|
4512
|
+
});
|
|
4513
|
+
child.stdout?.on("data", (chunk) => started.stdout.write(Buffer.from(chunk)));
|
|
4514
|
+
child.stderr?.on("data", (chunk) => started.stderr.write(Buffer.from(chunk)));
|
|
4515
|
+
started.treePoll = setInterval(() => {
|
|
4516
|
+
refreshTreePids(started.pid, started.treePids);
|
|
4517
|
+
}, 50);
|
|
4518
|
+
started.treePoll.unref?.();
|
|
4519
|
+
child.once("close", (code) => {
|
|
4520
|
+
markClosed();
|
|
4521
|
+
started.chain.then(async () => {
|
|
4522
|
+
await killProcessTree(started.pid, started.treePids);
|
|
4523
|
+
finish(started, "exited", code);
|
|
4524
|
+
});
|
|
4525
|
+
});
|
|
4526
|
+
started.lifetimeTimer = setTimeout(() => {
|
|
4527
|
+
started.chain.then(async () => {
|
|
4528
|
+
if (started.status !== "running")
|
|
4529
|
+
return;
|
|
4530
|
+
await killProcessTree(started.pid, started.treePids);
|
|
4531
|
+
finish(started, "lifetime_exceeded", null);
|
|
4532
|
+
});
|
|
4533
|
+
}, supervisedLifeSeconds() * 1000);
|
|
4534
|
+
started.lifetimeTimer.unref?.();
|
|
4535
|
+
handles.set(id, started);
|
|
4536
|
+
return { handle: id, pid: started.pid };
|
|
4537
|
+
}
|
|
4538
|
+
function snapshot(record3) {
|
|
4539
|
+
const out = record3.stdout.snapshot(record3.stdoutCursor);
|
|
4540
|
+
const err = record3.stderr.snapshot(record3.stderrCursor);
|
|
4541
|
+
record3.stdoutCursor = out.cursor;
|
|
4542
|
+
record3.stderrCursor = err.cursor;
|
|
4543
|
+
return {
|
|
4544
|
+
handle: record3.id,
|
|
4545
|
+
pid: record3.pid,
|
|
4546
|
+
status: record3.status,
|
|
4547
|
+
exitCode: record3.exitCode,
|
|
4548
|
+
stdout: out.text,
|
|
4549
|
+
stderr: err.text,
|
|
4550
|
+
stdoutCursor: out.cursor,
|
|
4551
|
+
stderrCursor: err.cursor,
|
|
4552
|
+
truncated: out.truncated || err.truncated
|
|
4553
|
+
};
|
|
4554
|
+
}
|
|
4555
|
+
function requireHandle(owner, handle) {
|
|
4556
|
+
const record3 = handles.get(handle);
|
|
4557
|
+
if (!record3 || record3.owner !== owner)
|
|
4558
|
+
throw new Error("supervised handle not found");
|
|
4559
|
+
return record3;
|
|
4560
|
+
}
|
|
4561
|
+
function enqueue(record3, work) {
|
|
4562
|
+
const next = record3.chain.then(work, work);
|
|
4563
|
+
record3.chain = next.then(() => {
|
|
4564
|
+
return;
|
|
4565
|
+
}, () => {
|
|
4566
|
+
return;
|
|
4567
|
+
});
|
|
4568
|
+
return next;
|
|
4569
|
+
}
|
|
4570
|
+
async function waitSupervisedCommand(owner, handle, timeoutSeconds) {
|
|
4571
|
+
const remembered = terminals.get(handle);
|
|
4572
|
+
if (remembered && remembered.owner === owner && !handles.has(handle))
|
|
4573
|
+
return remembered.snapshot;
|
|
4574
|
+
const record3 = requireHandle(owner, handle);
|
|
4575
|
+
return enqueue(record3, async () => {
|
|
4576
|
+
const cap = supervisedWaitSeconds();
|
|
4577
|
+
const requested = typeof timeoutSeconds === "number" && timeoutSeconds > 0 ? timeoutSeconds : cap;
|
|
4578
|
+
if (requested > cap)
|
|
4579
|
+
throw new Error(`wait timeout:${requested} exceeds the ${cap}s supervised wait limit`);
|
|
4580
|
+
const remainingLife = Math.max(0, record3.deadlineAt - Date.now());
|
|
4581
|
+
const waitMs = Math.min(requested * 1000, remainingLife, cap * 1000);
|
|
4582
|
+
if (record3.status === "running" && waitMs > 0) {
|
|
4583
|
+
await new Promise((resolve) => {
|
|
4584
|
+
let done = false;
|
|
4585
|
+
const finishWait = () => {
|
|
4586
|
+
if (done)
|
|
4587
|
+
return;
|
|
4588
|
+
done = true;
|
|
4589
|
+
record3.exitWaiters = record3.exitWaiters.filter((item) => item !== finishWait);
|
|
4590
|
+
resolve();
|
|
4591
|
+
};
|
|
4592
|
+
const timer = setTimeout(finishWait, waitMs);
|
|
4593
|
+
record3.exitWaiters.push(() => {
|
|
4594
|
+
clearTimeout(timer);
|
|
4595
|
+
finishWait();
|
|
4596
|
+
});
|
|
4597
|
+
});
|
|
4598
|
+
}
|
|
4599
|
+
if (record3.status !== "running" && record3.terminalConsumed) {
|
|
4600
|
+
throw new Error("supervised terminal result already consumed");
|
|
4601
|
+
}
|
|
4602
|
+
const result = snapshot(record3);
|
|
4603
|
+
if (result.status !== "running") {
|
|
4604
|
+
record3.terminalConsumed = true;
|
|
4605
|
+
rememberTerminal(record3.id, owner, result);
|
|
4606
|
+
handles.delete(record3.id);
|
|
4607
|
+
}
|
|
4608
|
+
return result;
|
|
4609
|
+
});
|
|
4610
|
+
}
|
|
4611
|
+
async function cancelSupervisedCommand(owner, handle) {
|
|
4612
|
+
const remembered = terminals.get(handle);
|
|
4613
|
+
if (remembered && remembered.owner === owner && !handles.has(handle))
|
|
4614
|
+
return remembered.snapshot;
|
|
4615
|
+
const record3 = requireHandle(owner, handle);
|
|
4616
|
+
return enqueue(record3, async () => {
|
|
4617
|
+
record3.cancelRequested = true;
|
|
4618
|
+
notify(record3);
|
|
4619
|
+
if (record3.status === "running") {
|
|
4620
|
+
await killProcessTree(record3.pid, record3.treePids);
|
|
4621
|
+
record3.status = "killed";
|
|
4622
|
+
}
|
|
4623
|
+
if (record3.lifetimeTimer) {
|
|
4624
|
+
clearTimeout(record3.lifetimeTimer);
|
|
4625
|
+
record3.lifetimeTimer = undefined;
|
|
4626
|
+
}
|
|
4627
|
+
await record3.closed;
|
|
4628
|
+
const result = record3.terminalConsumed && remembered?.owner === owner ? remembered.snapshot : snapshot(record3);
|
|
4629
|
+
record3.terminalConsumed = true;
|
|
4630
|
+
rememberTerminal(record3.id, owner, result);
|
|
4631
|
+
handles.delete(record3.id);
|
|
4632
|
+
return result;
|
|
4633
|
+
});
|
|
4634
|
+
}
|
|
4635
|
+
async function reapSupervisedCommands(owner) {
|
|
4636
|
+
for (const [id, remembered] of terminals) {
|
|
4637
|
+
if (remembered.owner === owner)
|
|
4638
|
+
terminals.delete(id);
|
|
4639
|
+
}
|
|
4640
|
+
const owned = [...handles.values()].filter((record3) => record3.owner === owner);
|
|
4641
|
+
const errors = [];
|
|
4642
|
+
await Promise.all(owned.map(async (record3) => {
|
|
4643
|
+
try {
|
|
4644
|
+
await cancelSupervisedCommand(owner, record3.id);
|
|
4645
|
+
} catch (error) {
|
|
4646
|
+
errors.push(error);
|
|
4647
|
+
}
|
|
4648
|
+
if (record3.lifetimeTimer)
|
|
4649
|
+
clearTimeout(record3.lifetimeTimer);
|
|
4650
|
+
try {
|
|
4651
|
+
await killProcessTree(record3.pid, record3.treePids);
|
|
4652
|
+
} catch (error) {
|
|
4653
|
+
errors.push(error);
|
|
4654
|
+
}
|
|
4655
|
+
handles.delete(record3.id);
|
|
4656
|
+
}));
|
|
4657
|
+
if (errors.length > 0)
|
|
4658
|
+
throw errors[0];
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4661
|
+
// src/runtime/pi-supervised-command-extension.ts
|
|
4662
|
+
function ownerOf(ctx) {
|
|
4663
|
+
const owner = ctx?.sessionManager;
|
|
4664
|
+
if (!owner)
|
|
4665
|
+
throw new Error("supervised commands require a session");
|
|
4666
|
+
return owner;
|
|
4667
|
+
}
|
|
4668
|
+
function pi_supervised_command_extension_default(pi) {
|
|
4669
|
+
const waitCap = supervisedWaitSeconds();
|
|
4670
|
+
let waitUsedThisTurn = false;
|
|
4671
|
+
const resetWaitTurn = () => {
|
|
4672
|
+
waitUsedThisTurn = false;
|
|
4673
|
+
};
|
|
4674
|
+
pi.on("turn_end", resetWaitTurn);
|
|
4675
|
+
const reapOwner = async (_event, ctx) => {
|
|
4676
|
+
const owner = ctx?.sessionManager;
|
|
4677
|
+
if (owner)
|
|
4678
|
+
await reapSupervisedCommands(owner);
|
|
4679
|
+
};
|
|
4680
|
+
pi.on("agent_end", reapOwner);
|
|
4681
|
+
pi.on("session_shutdown", reapOwner);
|
|
4682
|
+
pi.registerTool({
|
|
4683
|
+
name: "supervised_start",
|
|
4684
|
+
label: "supervised_start",
|
|
4685
|
+
description: "Start one supervised process with executable+args (shell:false). Background-agent only. Returns a handle; use supervised_wait in <=60s slices. Do not use bash for work that must outlive 60s.",
|
|
4686
|
+
parameters: exports_typebox.Object({
|
|
4687
|
+
executable: exports_typebox.String({ description: "Executable path or name. No shell." }),
|
|
4688
|
+
args: exports_typebox.Array(exports_typebox.String(), { description: "Argument vector. No shell metacharacters are interpreted." }),
|
|
4689
|
+
cwd: exports_typebox.Optional(exports_typebox.String({ description: "Optional cwd inside the child session root. Symlinks and path escape are rejected." }))
|
|
4690
|
+
}),
|
|
4691
|
+
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
4692
|
+
const session = ctx;
|
|
4693
|
+
const root = typeof session.cwd === "string" && session.cwd.length > 0 ? session.cwd : process.cwd();
|
|
4694
|
+
const started = startSupervisedCommand({
|
|
4695
|
+
owner: ownerOf(session),
|
|
4696
|
+
executable: params.executable,
|
|
4697
|
+
args: params.args ?? [],
|
|
4698
|
+
cwd: resolveSupervisedCwd(root, params.cwd)
|
|
4699
|
+
});
|
|
4700
|
+
return { content: [{ type: "text", text: JSON.stringify(started) }], details: started };
|
|
4701
|
+
}
|
|
4702
|
+
});
|
|
4703
|
+
pi.registerTool({
|
|
4704
|
+
name: "supervised_wait",
|
|
4705
|
+
label: "supervised_wait",
|
|
4706
|
+
description: `Wait on a supervised handle for at most ${waitCap}s. Timeout returns status=running without killing the process. At most one wait per assistant turn so queued Steer is consumed before the next wait.`,
|
|
4707
|
+
parameters: exports_typebox.Object({
|
|
4708
|
+
handle: exports_typebox.String({ description: "Handle from supervised_start" }),
|
|
4709
|
+
timeout: exports_typebox.Optional(exports_typebox.Number({ description: `Wait seconds, max ${waitCap}`, maximum: waitCap, minimum: 1 }))
|
|
4710
|
+
}),
|
|
4711
|
+
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
4712
|
+
if (waitUsedThisTurn) {
|
|
4713
|
+
throw new Error("supervised_wait is limited to once per turn; return to the model so queued Steer can run first");
|
|
4714
|
+
}
|
|
4715
|
+
waitUsedThisTurn = true;
|
|
4716
|
+
const result = await waitSupervisedCommand(ownerOf(ctx), params.handle, params.timeout);
|
|
4717
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }], details: result };
|
|
4718
|
+
}
|
|
4719
|
+
});
|
|
4720
|
+
pi.registerTool({
|
|
4721
|
+
name: "supervised_cancel",
|
|
4722
|
+
label: "supervised_cancel",
|
|
4723
|
+
description: "Cancel a supervised handle and reap its process tree.",
|
|
4724
|
+
parameters: exports_typebox.Object({
|
|
4725
|
+
handle: exports_typebox.String({ description: "Handle from supervised_start" })
|
|
4726
|
+
}),
|
|
4727
|
+
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
4728
|
+
const result = await cancelSupervisedCommand(ownerOf(ctx), params.handle);
|
|
4729
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }], details: result };
|
|
4730
|
+
}
|
|
4731
|
+
});
|
|
4732
|
+
}
|
|
4733
|
+
export {
|
|
4734
|
+
pi_supervised_command_extension_default as default
|
|
4735
|
+
};
|