@spfn/monitor 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.js ADDED
@@ -0,0 +1,3344 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/server.ts
8
+ import "@spfn/monitor/config";
9
+
10
+ // src/server/routes/index.ts
11
+ import { defineRouter } from "@spfn/core/route";
12
+
13
+ // src/server/routes/admin/errors.ts
14
+ import { authenticate, requireRole } from "@spfn/auth/server";
15
+
16
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
17
+ var value_exports = {};
18
+ __export(value_exports, {
19
+ HasPropertyKey: () => HasPropertyKey,
20
+ IsArray: () => IsArray,
21
+ IsAsyncIterator: () => IsAsyncIterator,
22
+ IsBigInt: () => IsBigInt,
23
+ IsBoolean: () => IsBoolean,
24
+ IsDate: () => IsDate,
25
+ IsFunction: () => IsFunction,
26
+ IsIterator: () => IsIterator,
27
+ IsNull: () => IsNull,
28
+ IsNumber: () => IsNumber,
29
+ IsObject: () => IsObject,
30
+ IsRegExp: () => IsRegExp,
31
+ IsString: () => IsString,
32
+ IsSymbol: () => IsSymbol,
33
+ IsUint8Array: () => IsUint8Array,
34
+ IsUndefined: () => IsUndefined
35
+ });
36
+ function HasPropertyKey(value, key) {
37
+ return key in value;
38
+ }
39
+ function IsAsyncIterator(value) {
40
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
41
+ }
42
+ function IsArray(value) {
43
+ return Array.isArray(value);
44
+ }
45
+ function IsBigInt(value) {
46
+ return typeof value === "bigint";
47
+ }
48
+ function IsBoolean(value) {
49
+ return typeof value === "boolean";
50
+ }
51
+ function IsDate(value) {
52
+ return value instanceof globalThis.Date;
53
+ }
54
+ function IsFunction(value) {
55
+ return typeof value === "function";
56
+ }
57
+ function IsIterator(value) {
58
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
59
+ }
60
+ function IsNull(value) {
61
+ return value === null;
62
+ }
63
+ function IsNumber(value) {
64
+ return typeof value === "number";
65
+ }
66
+ function IsObject(value) {
67
+ return typeof value === "object" && value !== null;
68
+ }
69
+ function IsRegExp(value) {
70
+ return value instanceof globalThis.RegExp;
71
+ }
72
+ function IsString(value) {
73
+ return typeof value === "string";
74
+ }
75
+ function IsSymbol(value) {
76
+ return typeof value === "symbol";
77
+ }
78
+ function IsUint8Array(value) {
79
+ return value instanceof globalThis.Uint8Array;
80
+ }
81
+ function IsUndefined(value) {
82
+ return value === void 0;
83
+ }
84
+
85
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
86
+ function ArrayType(value) {
87
+ return value.map((value2) => Visit(value2));
88
+ }
89
+ function DateType(value) {
90
+ return new Date(value.getTime());
91
+ }
92
+ function Uint8ArrayType(value) {
93
+ return new Uint8Array(value);
94
+ }
95
+ function RegExpType(value) {
96
+ return new RegExp(value.source, value.flags);
97
+ }
98
+ function ObjectType(value) {
99
+ const result = {};
100
+ for (const key of Object.getOwnPropertyNames(value)) {
101
+ result[key] = Visit(value[key]);
102
+ }
103
+ for (const key of Object.getOwnPropertySymbols(value)) {
104
+ result[key] = Visit(value[key]);
105
+ }
106
+ return result;
107
+ }
108
+ function Visit(value) {
109
+ return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
110
+ }
111
+ function Clone(value) {
112
+ return Visit(value);
113
+ }
114
+
115
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
116
+ function CloneType(schema, options) {
117
+ return options === void 0 ? Clone(schema) : Clone({ ...options, ...schema });
118
+ }
119
+
120
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
121
+ function IsObject2(value) {
122
+ return value !== null && typeof value === "object";
123
+ }
124
+ function IsArray2(value) {
125
+ return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value);
126
+ }
127
+ function IsUndefined2(value) {
128
+ return value === void 0;
129
+ }
130
+ function IsNumber2(value) {
131
+ return typeof value === "number";
132
+ }
133
+
134
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/system/policy.mjs
135
+ var TypeSystemPolicy;
136
+ (function(TypeSystemPolicy2) {
137
+ TypeSystemPolicy2.InstanceMode = "default";
138
+ TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
139
+ TypeSystemPolicy2.AllowArrayObject = false;
140
+ TypeSystemPolicy2.AllowNaN = false;
141
+ TypeSystemPolicy2.AllowNullVoid = false;
142
+ function IsExactOptionalProperty(value, key) {
143
+ return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
144
+ }
145
+ TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
146
+ function IsObjectLike(value) {
147
+ const isObject = IsObject2(value);
148
+ return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray2(value);
149
+ }
150
+ TypeSystemPolicy2.IsObjectLike = IsObjectLike;
151
+ function IsRecordLike(value) {
152
+ return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
153
+ }
154
+ TypeSystemPolicy2.IsRecordLike = IsRecordLike;
155
+ function IsNumberLike(value) {
156
+ return TypeSystemPolicy2.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
157
+ }
158
+ TypeSystemPolicy2.IsNumberLike = IsNumberLike;
159
+ function IsVoidLike(value) {
160
+ const isUndefined = IsUndefined2(value);
161
+ return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
162
+ }
163
+ TypeSystemPolicy2.IsVoidLike = IsVoidLike;
164
+ })(TypeSystemPolicy || (TypeSystemPolicy = {}));
165
+
166
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
167
+ function ImmutableArray(value) {
168
+ return globalThis.Object.freeze(value).map((value2) => Immutable(value2));
169
+ }
170
+ function ImmutableDate(value) {
171
+ return value;
172
+ }
173
+ function ImmutableUint8Array(value) {
174
+ return value;
175
+ }
176
+ function ImmutableRegExp(value) {
177
+ return value;
178
+ }
179
+ function ImmutableObject(value) {
180
+ const result = {};
181
+ for (const key of Object.getOwnPropertyNames(value)) {
182
+ result[key] = Immutable(value[key]);
183
+ }
184
+ for (const key of Object.getOwnPropertySymbols(value)) {
185
+ result[key] = Immutable(value[key]);
186
+ }
187
+ return globalThis.Object.freeze(result);
188
+ }
189
+ function Immutable(value) {
190
+ return IsArray(value) ? ImmutableArray(value) : IsDate(value) ? ImmutableDate(value) : IsUint8Array(value) ? ImmutableUint8Array(value) : IsRegExp(value) ? ImmutableRegExp(value) : IsObject(value) ? ImmutableObject(value) : value;
191
+ }
192
+
193
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs
194
+ function CreateType(schema, options) {
195
+ const result = options !== void 0 ? { ...options, ...schema } : schema;
196
+ switch (TypeSystemPolicy.InstanceMode) {
197
+ case "freeze":
198
+ return Immutable(result);
199
+ case "clone":
200
+ return Clone(result);
201
+ default:
202
+ return result;
203
+ }
204
+ }
205
+
206
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
207
+ var TypeBoxError = class extends Error {
208
+ constructor(message) {
209
+ super(message);
210
+ }
211
+ };
212
+
213
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
214
+ var TransformKind = Symbol.for("TypeBox.Transform");
215
+ var ReadonlyKind = Symbol.for("TypeBox.Readonly");
216
+ var OptionalKind = Symbol.for("TypeBox.Optional");
217
+ var Hint = Symbol.for("TypeBox.Hint");
218
+ var Kind = Symbol.for("TypeBox.Kind");
219
+
220
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
221
+ function IsReadonly(value) {
222
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
223
+ }
224
+ function IsOptional(value) {
225
+ return IsObject(value) && value[OptionalKind] === "Optional";
226
+ }
227
+ function IsAny(value) {
228
+ return IsKindOf(value, "Any");
229
+ }
230
+ function IsArgument(value) {
231
+ return IsKindOf(value, "Argument");
232
+ }
233
+ function IsArray3(value) {
234
+ return IsKindOf(value, "Array");
235
+ }
236
+ function IsAsyncIterator2(value) {
237
+ return IsKindOf(value, "AsyncIterator");
238
+ }
239
+ function IsBigInt2(value) {
240
+ return IsKindOf(value, "BigInt");
241
+ }
242
+ function IsBoolean2(value) {
243
+ return IsKindOf(value, "Boolean");
244
+ }
245
+ function IsComputed(value) {
246
+ return IsKindOf(value, "Computed");
247
+ }
248
+ function IsConstructor(value) {
249
+ return IsKindOf(value, "Constructor");
250
+ }
251
+ function IsDate2(value) {
252
+ return IsKindOf(value, "Date");
253
+ }
254
+ function IsFunction2(value) {
255
+ return IsKindOf(value, "Function");
256
+ }
257
+ function IsInteger(value) {
258
+ return IsKindOf(value, "Integer");
259
+ }
260
+ function IsIntersect(value) {
261
+ return IsKindOf(value, "Intersect");
262
+ }
263
+ function IsIterator2(value) {
264
+ return IsKindOf(value, "Iterator");
265
+ }
266
+ function IsKindOf(value, kind) {
267
+ return IsObject(value) && Kind in value && value[Kind] === kind;
268
+ }
269
+ function IsLiteralValue(value) {
270
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
271
+ }
272
+ function IsLiteral(value) {
273
+ return IsKindOf(value, "Literal");
274
+ }
275
+ function IsMappedKey(value) {
276
+ return IsKindOf(value, "MappedKey");
277
+ }
278
+ function IsMappedResult(value) {
279
+ return IsKindOf(value, "MappedResult");
280
+ }
281
+ function IsNever(value) {
282
+ return IsKindOf(value, "Never");
283
+ }
284
+ function IsNot(value) {
285
+ return IsKindOf(value, "Not");
286
+ }
287
+ function IsNull2(value) {
288
+ return IsKindOf(value, "Null");
289
+ }
290
+ function IsNumber3(value) {
291
+ return IsKindOf(value, "Number");
292
+ }
293
+ function IsObject3(value) {
294
+ return IsKindOf(value, "Object");
295
+ }
296
+ function IsPromise(value) {
297
+ return IsKindOf(value, "Promise");
298
+ }
299
+ function IsRecord(value) {
300
+ return IsKindOf(value, "Record");
301
+ }
302
+ function IsRef(value) {
303
+ return IsKindOf(value, "Ref");
304
+ }
305
+ function IsRegExp2(value) {
306
+ return IsKindOf(value, "RegExp");
307
+ }
308
+ function IsString2(value) {
309
+ return IsKindOf(value, "String");
310
+ }
311
+ function IsSymbol2(value) {
312
+ return IsKindOf(value, "Symbol");
313
+ }
314
+ function IsTemplateLiteral(value) {
315
+ return IsKindOf(value, "TemplateLiteral");
316
+ }
317
+ function IsThis(value) {
318
+ return IsKindOf(value, "This");
319
+ }
320
+ function IsTransform(value) {
321
+ return IsObject(value) && TransformKind in value;
322
+ }
323
+ function IsTuple(value) {
324
+ return IsKindOf(value, "Tuple");
325
+ }
326
+ function IsUndefined3(value) {
327
+ return IsKindOf(value, "Undefined");
328
+ }
329
+ function IsUnion(value) {
330
+ return IsKindOf(value, "Union");
331
+ }
332
+ function IsUint8Array2(value) {
333
+ return IsKindOf(value, "Uint8Array");
334
+ }
335
+ function IsUnknown(value) {
336
+ return IsKindOf(value, "Unknown");
337
+ }
338
+ function IsUnsafe(value) {
339
+ return IsKindOf(value, "Unsafe");
340
+ }
341
+ function IsVoid(value) {
342
+ return IsKindOf(value, "Void");
343
+ }
344
+ function IsKind(value) {
345
+ return IsObject(value) && Kind in value && IsString(value[Kind]);
346
+ }
347
+ function IsSchema(value) {
348
+ return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsComputed(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber3(value) || IsObject3(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
349
+ }
350
+
351
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
352
+ var type_exports = {};
353
+ __export(type_exports, {
354
+ IsAny: () => IsAny2,
355
+ IsArgument: () => IsArgument2,
356
+ IsArray: () => IsArray4,
357
+ IsAsyncIterator: () => IsAsyncIterator3,
358
+ IsBigInt: () => IsBigInt3,
359
+ IsBoolean: () => IsBoolean3,
360
+ IsComputed: () => IsComputed2,
361
+ IsConstructor: () => IsConstructor2,
362
+ IsDate: () => IsDate3,
363
+ IsFunction: () => IsFunction3,
364
+ IsImport: () => IsImport,
365
+ IsInteger: () => IsInteger2,
366
+ IsIntersect: () => IsIntersect2,
367
+ IsIterator: () => IsIterator3,
368
+ IsKind: () => IsKind2,
369
+ IsKindOf: () => IsKindOf2,
370
+ IsLiteral: () => IsLiteral2,
371
+ IsLiteralBoolean: () => IsLiteralBoolean,
372
+ IsLiteralNumber: () => IsLiteralNumber,
373
+ IsLiteralString: () => IsLiteralString,
374
+ IsLiteralValue: () => IsLiteralValue2,
375
+ IsMappedKey: () => IsMappedKey2,
376
+ IsMappedResult: () => IsMappedResult2,
377
+ IsNever: () => IsNever2,
378
+ IsNot: () => IsNot2,
379
+ IsNull: () => IsNull3,
380
+ IsNumber: () => IsNumber4,
381
+ IsObject: () => IsObject4,
382
+ IsOptional: () => IsOptional2,
383
+ IsPromise: () => IsPromise2,
384
+ IsProperties: () => IsProperties,
385
+ IsReadonly: () => IsReadonly2,
386
+ IsRecord: () => IsRecord2,
387
+ IsRecursive: () => IsRecursive,
388
+ IsRef: () => IsRef2,
389
+ IsRegExp: () => IsRegExp3,
390
+ IsSchema: () => IsSchema2,
391
+ IsString: () => IsString3,
392
+ IsSymbol: () => IsSymbol3,
393
+ IsTemplateLiteral: () => IsTemplateLiteral2,
394
+ IsThis: () => IsThis2,
395
+ IsTransform: () => IsTransform2,
396
+ IsTuple: () => IsTuple2,
397
+ IsUint8Array: () => IsUint8Array3,
398
+ IsUndefined: () => IsUndefined4,
399
+ IsUnion: () => IsUnion2,
400
+ IsUnionLiteral: () => IsUnionLiteral,
401
+ IsUnknown: () => IsUnknown2,
402
+ IsUnsafe: () => IsUnsafe2,
403
+ IsVoid: () => IsVoid2,
404
+ TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
405
+ });
406
+ var TypeGuardUnknownTypeError = class extends TypeBoxError {
407
+ };
408
+ var KnownTypes = [
409
+ "Argument",
410
+ "Any",
411
+ "Array",
412
+ "AsyncIterator",
413
+ "BigInt",
414
+ "Boolean",
415
+ "Computed",
416
+ "Constructor",
417
+ "Date",
418
+ "Enum",
419
+ "Function",
420
+ "Integer",
421
+ "Intersect",
422
+ "Iterator",
423
+ "Literal",
424
+ "MappedKey",
425
+ "MappedResult",
426
+ "Not",
427
+ "Null",
428
+ "Number",
429
+ "Object",
430
+ "Promise",
431
+ "Record",
432
+ "Ref",
433
+ "RegExp",
434
+ "String",
435
+ "Symbol",
436
+ "TemplateLiteral",
437
+ "This",
438
+ "Tuple",
439
+ "Undefined",
440
+ "Union",
441
+ "Uint8Array",
442
+ "Unknown",
443
+ "Void"
444
+ ];
445
+ function IsPattern(value) {
446
+ try {
447
+ new RegExp(value);
448
+ return true;
449
+ } catch {
450
+ return false;
451
+ }
452
+ }
453
+ function IsControlCharacterFree(value) {
454
+ if (!IsString(value))
455
+ return false;
456
+ for (let i = 0; i < value.length; i++) {
457
+ const code = value.charCodeAt(i);
458
+ if (code >= 7 && code <= 13 || code === 27 || code === 127) {
459
+ return false;
460
+ }
461
+ }
462
+ return true;
463
+ }
464
+ function IsAdditionalProperties(value) {
465
+ return IsOptionalBoolean(value) || IsSchema2(value);
466
+ }
467
+ function IsOptionalBigInt(value) {
468
+ return IsUndefined(value) || IsBigInt(value);
469
+ }
470
+ function IsOptionalNumber(value) {
471
+ return IsUndefined(value) || IsNumber(value);
472
+ }
473
+ function IsOptionalBoolean(value) {
474
+ return IsUndefined(value) || IsBoolean(value);
475
+ }
476
+ function IsOptionalString(value) {
477
+ return IsUndefined(value) || IsString(value);
478
+ }
479
+ function IsOptionalPattern(value) {
480
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
481
+ }
482
+ function IsOptionalFormat(value) {
483
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
484
+ }
485
+ function IsOptionalSchema(value) {
486
+ return IsUndefined(value) || IsSchema2(value);
487
+ }
488
+ function IsReadonly2(value) {
489
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
490
+ }
491
+ function IsOptional2(value) {
492
+ return IsObject(value) && value[OptionalKind] === "Optional";
493
+ }
494
+ function IsAny2(value) {
495
+ return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
496
+ }
497
+ function IsArgument2(value) {
498
+ return IsKindOf2(value, "Argument") && IsNumber(value.index);
499
+ }
500
+ function IsArray4(value) {
501
+ return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
502
+ }
503
+ function IsAsyncIterator3(value) {
504
+ return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
505
+ }
506
+ function IsBigInt3(value) {
507
+ return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
508
+ }
509
+ function IsBoolean3(value) {
510
+ return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
511
+ }
512
+ function IsComputed2(value) {
513
+ return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
514
+ }
515
+ function IsConstructor2(value) {
516
+ return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
517
+ }
518
+ function IsDate3(value) {
519
+ return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
520
+ }
521
+ function IsFunction3(value) {
522
+ return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
523
+ }
524
+ function IsImport(value) {
525
+ return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
526
+ }
527
+ function IsInteger2(value) {
528
+ return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
529
+ }
530
+ function IsProperties(value) {
531
+ return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
532
+ }
533
+ function IsIntersect2(value) {
534
+ return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
535
+ }
536
+ function IsIterator3(value) {
537
+ return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
538
+ }
539
+ function IsKindOf2(value, kind) {
540
+ return IsObject(value) && Kind in value && value[Kind] === kind;
541
+ }
542
+ function IsLiteralString(value) {
543
+ return IsLiteral2(value) && IsString(value.const);
544
+ }
545
+ function IsLiteralNumber(value) {
546
+ return IsLiteral2(value) && IsNumber(value.const);
547
+ }
548
+ function IsLiteralBoolean(value) {
549
+ return IsLiteral2(value) && IsBoolean(value.const);
550
+ }
551
+ function IsLiteral2(value) {
552
+ return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
553
+ }
554
+ function IsLiteralValue2(value) {
555
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
556
+ }
557
+ function IsMappedKey2(value) {
558
+ return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
559
+ }
560
+ function IsMappedResult2(value) {
561
+ return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
562
+ }
563
+ function IsNever2(value) {
564
+ return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
565
+ }
566
+ function IsNot2(value) {
567
+ return IsKindOf2(value, "Not") && IsSchema2(value.not);
568
+ }
569
+ function IsNull3(value) {
570
+ return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
571
+ }
572
+ function IsNumber4(value) {
573
+ return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
574
+ }
575
+ function IsObject4(value) {
576
+ return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
577
+ }
578
+ function IsPromise2(value) {
579
+ return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
580
+ }
581
+ function IsRecord2(value) {
582
+ return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
583
+ const keys = Object.getOwnPropertyNames(schema.patternProperties);
584
+ return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
585
+ })(value);
586
+ }
587
+ function IsRecursive(value) {
588
+ return IsObject(value) && Hint in value && value[Hint] === "Recursive";
589
+ }
590
+ function IsRef2(value) {
591
+ return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
592
+ }
593
+ function IsRegExp3(value) {
594
+ return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
595
+ }
596
+ function IsString3(value) {
597
+ return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
598
+ }
599
+ function IsSymbol3(value) {
600
+ return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
601
+ }
602
+ function IsTemplateLiteral2(value) {
603
+ return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
604
+ }
605
+ function IsThis2(value) {
606
+ return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
607
+ }
608
+ function IsTransform2(value) {
609
+ return IsObject(value) && TransformKind in value;
610
+ }
611
+ function IsTuple2(value) {
612
+ return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
613
+ (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
614
+ }
615
+ function IsUndefined4(value) {
616
+ return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
617
+ }
618
+ function IsUnionLiteral(value) {
619
+ return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
620
+ }
621
+ function IsUnion2(value) {
622
+ return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
623
+ }
624
+ function IsUint8Array3(value) {
625
+ return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
626
+ }
627
+ function IsUnknown2(value) {
628
+ return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
629
+ }
630
+ function IsUnsafe2(value) {
631
+ return IsKindOf2(value, "Unsafe");
632
+ }
633
+ function IsVoid2(value) {
634
+ return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
635
+ }
636
+ function IsKind2(value) {
637
+ return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
638
+ }
639
+ function IsSchema2(value) {
640
+ return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed2(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber4(value) || IsObject4(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
641
+ }
642
+
643
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
644
+ var PatternBoolean = "(true|false)";
645
+ var PatternNumber = "(0|[1-9][0-9]*)";
646
+ var PatternString = "(.*)";
647
+ var PatternNever = "(?!.*)";
648
+ var PatternBooleanExact = `^${PatternBoolean}$`;
649
+ var PatternNumberExact = `^${PatternNumber}$`;
650
+ var PatternStringExact = `^${PatternString}$`;
651
+ var PatternNeverExact = `^${PatternNever}$`;
652
+
653
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
654
+ function SetIncludes(T, S) {
655
+ return T.includes(S);
656
+ }
657
+ function SetDistinct(T) {
658
+ return [...new Set(T)];
659
+ }
660
+ function SetIntersect(T, S) {
661
+ return T.filter((L) => S.includes(L));
662
+ }
663
+ function SetIntersectManyResolve(T, Init) {
664
+ return T.reduce((Acc, L) => {
665
+ return SetIntersect(Acc, L);
666
+ }, Init);
667
+ }
668
+ function SetIntersectMany(T) {
669
+ return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
670
+ }
671
+ function SetUnionMany(T) {
672
+ const Acc = [];
673
+ for (const L of T)
674
+ Acc.push(...L);
675
+ return Acc;
676
+ }
677
+
678
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
679
+ function Any(options) {
680
+ return CreateType({ [Kind]: "Any" }, options);
681
+ }
682
+
683
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
684
+ function Array2(items, options) {
685
+ return CreateType({ [Kind]: "Array", type: "array", items }, options);
686
+ }
687
+
688
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs
689
+ function Argument(index4) {
690
+ return CreateType({ [Kind]: "Argument", index: index4 });
691
+ }
692
+
693
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
694
+ function AsyncIterator(items, options) {
695
+ return CreateType({ [Kind]: "AsyncIterator", type: "AsyncIterator", items }, options);
696
+ }
697
+
698
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs
699
+ function Computed(target, parameters, options) {
700
+ return CreateType({ [Kind]: "Computed", target, parameters }, options);
701
+ }
702
+
703
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
704
+ function DiscardKey(value, key) {
705
+ const { [key]: _, ...rest } = value;
706
+ return rest;
707
+ }
708
+ function Discard(value, keys) {
709
+ return keys.reduce((acc, key) => DiscardKey(acc, key), value);
710
+ }
711
+
712
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
713
+ function Never(options) {
714
+ return CreateType({ [Kind]: "Never", not: {} }, options);
715
+ }
716
+
717
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
718
+ function MappedResult(properties) {
719
+ return CreateType({
720
+ [Kind]: "MappedResult",
721
+ properties
722
+ });
723
+ }
724
+
725
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
726
+ function Constructor(parameters, returns, options) {
727
+ return CreateType({ [Kind]: "Constructor", type: "Constructor", parameters, returns }, options);
728
+ }
729
+
730
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
731
+ function Function(parameters, returns, options) {
732
+ return CreateType({ [Kind]: "Function", type: "Function", parameters, returns }, options);
733
+ }
734
+
735
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
736
+ function UnionCreate(T, options) {
737
+ return CreateType({ [Kind]: "Union", anyOf: T }, options);
738
+ }
739
+
740
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
741
+ function IsUnionOptional(types) {
742
+ return types.some((type) => IsOptional(type));
743
+ }
744
+ function RemoveOptionalFromRest(types) {
745
+ return types.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
746
+ }
747
+ function RemoveOptionalFromType(T) {
748
+ return Discard(T, [OptionalKind]);
749
+ }
750
+ function ResolveUnion(types, options) {
751
+ const isOptional = IsUnionOptional(types);
752
+ return isOptional ? Optional(UnionCreate(RemoveOptionalFromRest(types), options)) : UnionCreate(RemoveOptionalFromRest(types), options);
753
+ }
754
+ function UnionEvaluated(T, options) {
755
+ return T.length === 1 ? CreateType(T[0], options) : T.length === 0 ? Never(options) : ResolveUnion(T, options);
756
+ }
757
+
758
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
759
+ function Union(types, options) {
760
+ return types.length === 0 ? Never(options) : types.length === 1 ? CreateType(types[0], options) : UnionCreate(types, options);
761
+ }
762
+
763
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
764
+ var TemplateLiteralParserError = class extends TypeBoxError {
765
+ };
766
+ function Unescape(pattern) {
767
+ return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
768
+ }
769
+ function IsNonEscaped(pattern, index4, char) {
770
+ return pattern[index4] === char && pattern.charCodeAt(index4 - 1) !== 92;
771
+ }
772
+ function IsOpenParen(pattern, index4) {
773
+ return IsNonEscaped(pattern, index4, "(");
774
+ }
775
+ function IsCloseParen(pattern, index4) {
776
+ return IsNonEscaped(pattern, index4, ")");
777
+ }
778
+ function IsSeparator(pattern, index4) {
779
+ return IsNonEscaped(pattern, index4, "|");
780
+ }
781
+ function IsGroup(pattern) {
782
+ if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
783
+ return false;
784
+ let count = 0;
785
+ for (let index4 = 0; index4 < pattern.length; index4++) {
786
+ if (IsOpenParen(pattern, index4))
787
+ count += 1;
788
+ if (IsCloseParen(pattern, index4))
789
+ count -= 1;
790
+ if (count === 0 && index4 !== pattern.length - 1)
791
+ return false;
792
+ }
793
+ return true;
794
+ }
795
+ function InGroup(pattern) {
796
+ return pattern.slice(1, pattern.length - 1);
797
+ }
798
+ function IsPrecedenceOr(pattern) {
799
+ let count = 0;
800
+ for (let index4 = 0; index4 < pattern.length; index4++) {
801
+ if (IsOpenParen(pattern, index4))
802
+ count += 1;
803
+ if (IsCloseParen(pattern, index4))
804
+ count -= 1;
805
+ if (IsSeparator(pattern, index4) && count === 0)
806
+ return true;
807
+ }
808
+ return false;
809
+ }
810
+ function IsPrecedenceAnd(pattern) {
811
+ for (let index4 = 0; index4 < pattern.length; index4++) {
812
+ if (IsOpenParen(pattern, index4))
813
+ return true;
814
+ }
815
+ return false;
816
+ }
817
+ function Or(pattern) {
818
+ let [count, start] = [0, 0];
819
+ const expressions = [];
820
+ for (let index4 = 0; index4 < pattern.length; index4++) {
821
+ if (IsOpenParen(pattern, index4))
822
+ count += 1;
823
+ if (IsCloseParen(pattern, index4))
824
+ count -= 1;
825
+ if (IsSeparator(pattern, index4) && count === 0) {
826
+ const range2 = pattern.slice(start, index4);
827
+ if (range2.length > 0)
828
+ expressions.push(TemplateLiteralParse(range2));
829
+ start = index4 + 1;
830
+ }
831
+ }
832
+ const range = pattern.slice(start);
833
+ if (range.length > 0)
834
+ expressions.push(TemplateLiteralParse(range));
835
+ if (expressions.length === 0)
836
+ return { type: "const", const: "" };
837
+ if (expressions.length === 1)
838
+ return expressions[0];
839
+ return { type: "or", expr: expressions };
840
+ }
841
+ function And(pattern) {
842
+ function Group(value, index4) {
843
+ if (!IsOpenParen(value, index4))
844
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
845
+ let count = 0;
846
+ for (let scan = index4; scan < value.length; scan++) {
847
+ if (IsOpenParen(value, scan))
848
+ count += 1;
849
+ if (IsCloseParen(value, scan))
850
+ count -= 1;
851
+ if (count === 0)
852
+ return [index4, scan];
853
+ }
854
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
855
+ }
856
+ function Range(pattern2, index4) {
857
+ for (let scan = index4; scan < pattern2.length; scan++) {
858
+ if (IsOpenParen(pattern2, scan))
859
+ return [index4, scan];
860
+ }
861
+ return [index4, pattern2.length];
862
+ }
863
+ const expressions = [];
864
+ for (let index4 = 0; index4 < pattern.length; index4++) {
865
+ if (IsOpenParen(pattern, index4)) {
866
+ const [start, end] = Group(pattern, index4);
867
+ const range = pattern.slice(start, end + 1);
868
+ expressions.push(TemplateLiteralParse(range));
869
+ index4 = end;
870
+ } else {
871
+ const [start, end] = Range(pattern, index4);
872
+ const range = pattern.slice(start, end);
873
+ if (range.length > 0)
874
+ expressions.push(TemplateLiteralParse(range));
875
+ index4 = end - 1;
876
+ }
877
+ }
878
+ return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
879
+ }
880
+ function TemplateLiteralParse(pattern) {
881
+ return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
882
+ }
883
+ function TemplateLiteralParseExact(pattern) {
884
+ return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
885
+ }
886
+
887
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
888
+ var TemplateLiteralFiniteError = class extends TypeBoxError {
889
+ };
890
+ function IsNumberExpression(expression) {
891
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
892
+ }
893
+ function IsBooleanExpression(expression) {
894
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
895
+ }
896
+ function IsStringExpression(expression) {
897
+ return expression.type === "const" && expression.const === ".*";
898
+ }
899
+ function IsTemplateLiteralExpressionFinite(expression) {
900
+ return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
901
+ throw new TemplateLiteralFiniteError(`Unknown expression type`);
902
+ })();
903
+ }
904
+ function IsTemplateLiteralFinite(schema) {
905
+ const expression = TemplateLiteralParseExact(schema.pattern);
906
+ return IsTemplateLiteralExpressionFinite(expression);
907
+ }
908
+
909
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
910
+ var TemplateLiteralGenerateError = class extends TypeBoxError {
911
+ };
912
+ function* GenerateReduce(buffer) {
913
+ if (buffer.length === 1)
914
+ return yield* buffer[0];
915
+ for (const left of buffer[0]) {
916
+ for (const right of GenerateReduce(buffer.slice(1))) {
917
+ yield `${left}${right}`;
918
+ }
919
+ }
920
+ }
921
+ function* GenerateAnd(expression) {
922
+ return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
923
+ }
924
+ function* GenerateOr(expression) {
925
+ for (const expr of expression.expr)
926
+ yield* TemplateLiteralExpressionGenerate(expr);
927
+ }
928
+ function* GenerateConst(expression) {
929
+ return yield expression.const;
930
+ }
931
+ function* TemplateLiteralExpressionGenerate(expression) {
932
+ return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
933
+ throw new TemplateLiteralGenerateError("Unknown expression");
934
+ })();
935
+ }
936
+ function TemplateLiteralGenerate(schema) {
937
+ const expression = TemplateLiteralParseExact(schema.pattern);
938
+ return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
939
+ }
940
+
941
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
942
+ function Literal(value, options) {
943
+ return CreateType({
944
+ [Kind]: "Literal",
945
+ const: value,
946
+ type: typeof value
947
+ }, options);
948
+ }
949
+
950
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
951
+ function Boolean(options) {
952
+ return CreateType({ [Kind]: "Boolean", type: "boolean" }, options);
953
+ }
954
+
955
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
956
+ function BigInt(options) {
957
+ return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
958
+ }
959
+
960
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
961
+ function Number2(options) {
962
+ return CreateType({ [Kind]: "Number", type: "number" }, options);
963
+ }
964
+
965
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
966
+ function String(options) {
967
+ return CreateType({ [Kind]: "String", type: "string" }, options);
968
+ }
969
+
970
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
971
+ function* FromUnion(syntax) {
972
+ const trim = syntax.trim().replace(/"|'/g, "");
973
+ return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt() : trim === "string" ? yield String() : yield (() => {
974
+ const literals = trim.split("|").map((literal) => Literal(literal.trim()));
975
+ return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
976
+ })();
977
+ }
978
+ function* FromTerminal(syntax) {
979
+ if (syntax[1] !== "{") {
980
+ const L = Literal("$");
981
+ const R = FromSyntax(syntax.slice(1));
982
+ return yield* [L, ...R];
983
+ }
984
+ for (let i = 2; i < syntax.length; i++) {
985
+ if (syntax[i] === "}") {
986
+ const L = FromUnion(syntax.slice(2, i));
987
+ const R = FromSyntax(syntax.slice(i + 1));
988
+ return yield* [...L, ...R];
989
+ }
990
+ }
991
+ yield Literal(syntax);
992
+ }
993
+ function* FromSyntax(syntax) {
994
+ for (let i = 0; i < syntax.length; i++) {
995
+ if (syntax[i] === "$") {
996
+ const L = Literal(syntax.slice(0, i));
997
+ const R = FromTerminal(syntax.slice(i));
998
+ return yield* [L, ...R];
999
+ }
1000
+ }
1001
+ yield Literal(syntax);
1002
+ }
1003
+ function TemplateLiteralSyntax(syntax) {
1004
+ return [...FromSyntax(syntax)];
1005
+ }
1006
+
1007
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
1008
+ var TemplateLiteralPatternError = class extends TypeBoxError {
1009
+ };
1010
+ function Escape(value) {
1011
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1012
+ }
1013
+ function Visit2(schema, acc) {
1014
+ return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
1015
+ throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
1016
+ })();
1017
+ }
1018
+ function TemplateLiteralPattern(kinds) {
1019
+ return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
1020
+ }
1021
+
1022
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
1023
+ function TemplateLiteralToUnion(schema) {
1024
+ const R = TemplateLiteralGenerate(schema);
1025
+ const L = R.map((S) => Literal(S));
1026
+ return UnionEvaluated(L);
1027
+ }
1028
+
1029
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
1030
+ function TemplateLiteral(unresolved, options) {
1031
+ const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
1032
+ return CreateType({ [Kind]: "TemplateLiteral", type: "string", pattern }, options);
1033
+ }
1034
+
1035
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
1036
+ function FromTemplateLiteral(templateLiteral) {
1037
+ const keys = TemplateLiteralGenerate(templateLiteral);
1038
+ return keys.map((key) => key.toString());
1039
+ }
1040
+ function FromUnion2(types) {
1041
+ const result = [];
1042
+ for (const type of types)
1043
+ result.push(...IndexPropertyKeys(type));
1044
+ return result;
1045
+ }
1046
+ function FromLiteral(literalValue) {
1047
+ return [literalValue.toString()];
1048
+ }
1049
+ function IndexPropertyKeys(type) {
1050
+ return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger(type) ? ["[number]"] : [])];
1051
+ }
1052
+
1053
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
1054
+ function FromProperties(type, properties, options) {
1055
+ const result = {};
1056
+ for (const K2 of Object.getOwnPropertyNames(properties)) {
1057
+ result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options);
1058
+ }
1059
+ return result;
1060
+ }
1061
+ function FromMappedResult(type, mappedResult, options) {
1062
+ return FromProperties(type, mappedResult.properties, options);
1063
+ }
1064
+ function IndexFromMappedResult(type, mappedResult, options) {
1065
+ const properties = FromMappedResult(type, mappedResult, options);
1066
+ return MappedResult(properties);
1067
+ }
1068
+
1069
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
1070
+ function FromRest(types, key) {
1071
+ return types.map((type) => IndexFromPropertyKey(type, key));
1072
+ }
1073
+ function FromIntersectRest(types) {
1074
+ return types.filter((type) => !IsNever(type));
1075
+ }
1076
+ function FromIntersect(types, key) {
1077
+ return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
1078
+ }
1079
+ function FromUnionRest(types) {
1080
+ return types.some((L) => IsNever(L)) ? [] : types;
1081
+ }
1082
+ function FromUnion3(types, key) {
1083
+ return UnionEvaluated(FromUnionRest(FromRest(types, key)));
1084
+ }
1085
+ function FromTuple(types, key) {
1086
+ return key in types ? types[key] : key === "[number]" ? UnionEvaluated(types) : Never();
1087
+ }
1088
+ function FromArray(type, key) {
1089
+ return key === "[number]" ? type : Never();
1090
+ }
1091
+ function FromProperty(properties, propertyKey) {
1092
+ return propertyKey in properties ? properties[propertyKey] : Never();
1093
+ }
1094
+ function IndexFromPropertyKey(type, propertyKey) {
1095
+ return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
1096
+ }
1097
+ function IndexFromPropertyKeys(type, propertyKeys) {
1098
+ return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
1099
+ }
1100
+ function FromSchema(type, propertyKeys) {
1101
+ return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
1102
+ }
1103
+ function Index(type, key, options) {
1104
+ if (IsRef(type) || IsRef(key)) {
1105
+ const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
1106
+ if (!IsSchema(type) || !IsSchema(key))
1107
+ throw new TypeBoxError(error);
1108
+ return Computed("Index", [type, key]);
1109
+ }
1110
+ if (IsMappedResult(key))
1111
+ return IndexFromMappedResult(type, key, options);
1112
+ if (IsMappedKey(key))
1113
+ return IndexFromMappedKey(type, key, options);
1114
+ return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
1115
+ }
1116
+
1117
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
1118
+ function MappedIndexPropertyKey(type, key, options) {
1119
+ return { [key]: Index(type, [key], Clone(options)) };
1120
+ }
1121
+ function MappedIndexPropertyKeys(type, propertyKeys, options) {
1122
+ return propertyKeys.reduce((result, left) => {
1123
+ return { ...result, ...MappedIndexPropertyKey(type, left, options) };
1124
+ }, {});
1125
+ }
1126
+ function MappedIndexProperties(type, mappedKey, options) {
1127
+ return MappedIndexPropertyKeys(type, mappedKey.keys, options);
1128
+ }
1129
+ function IndexFromMappedKey(type, mappedKey, options) {
1130
+ const properties = MappedIndexProperties(type, mappedKey, options);
1131
+ return MappedResult(properties);
1132
+ }
1133
+
1134
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
1135
+ function Iterator(items, options) {
1136
+ return CreateType({ [Kind]: "Iterator", type: "Iterator", items }, options);
1137
+ }
1138
+
1139
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
1140
+ function RequiredKeys(properties) {
1141
+ const keys = [];
1142
+ for (let key in properties) {
1143
+ if (!IsOptional(properties[key]))
1144
+ keys.push(key);
1145
+ }
1146
+ return keys;
1147
+ }
1148
+ function _Object(properties, options) {
1149
+ const required = RequiredKeys(properties);
1150
+ const schematic = required.length > 0 ? { [Kind]: "Object", type: "object", properties, required } : { [Kind]: "Object", type: "object", properties };
1151
+ return CreateType(schematic, options);
1152
+ }
1153
+ var Object2 = _Object;
1154
+
1155
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
1156
+ function Promise2(item, options) {
1157
+ return CreateType({ [Kind]: "Promise", type: "Promise", item }, options);
1158
+ }
1159
+
1160
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
1161
+ function RemoveReadonly(schema) {
1162
+ return CreateType(Discard(schema, [ReadonlyKind]));
1163
+ }
1164
+ function AddReadonly(schema) {
1165
+ return CreateType({ ...schema, [ReadonlyKind]: "Readonly" });
1166
+ }
1167
+ function ReadonlyWithFlag(schema, F) {
1168
+ return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
1169
+ }
1170
+ function Readonly(schema, enable) {
1171
+ const F = enable ?? true;
1172
+ return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
1173
+ }
1174
+
1175
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
1176
+ function FromProperties2(K, F) {
1177
+ const Acc = {};
1178
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
1179
+ Acc[K2] = Readonly(K[K2], F);
1180
+ return Acc;
1181
+ }
1182
+ function FromMappedResult2(R, F) {
1183
+ return FromProperties2(R.properties, F);
1184
+ }
1185
+ function ReadonlyFromMappedResult(R, F) {
1186
+ const P = FromMappedResult2(R, F);
1187
+ return MappedResult(P);
1188
+ }
1189
+
1190
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
1191
+ function Tuple(types, options) {
1192
+ return CreateType(types.length > 0 ? { [Kind]: "Tuple", type: "array", items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : { [Kind]: "Tuple", type: "array", minItems: types.length, maxItems: types.length }, options);
1193
+ }
1194
+
1195
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
1196
+ function FromMappedResult3(K, P) {
1197
+ return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
1198
+ }
1199
+ function MappedKeyToKnownMappedResultProperties(K) {
1200
+ return { [K]: Literal(K) };
1201
+ }
1202
+ function MappedKeyToUnknownMappedResultProperties(P) {
1203
+ const Acc = {};
1204
+ for (const L of P)
1205
+ Acc[L] = Literal(L);
1206
+ return Acc;
1207
+ }
1208
+ function MappedKeyToMappedResultProperties(K, P) {
1209
+ return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
1210
+ }
1211
+ function FromMappedKey(K, P) {
1212
+ const R = MappedKeyToMappedResultProperties(K, P);
1213
+ return FromMappedResult3(K, R);
1214
+ }
1215
+ function FromRest2(K, T) {
1216
+ return T.map((L) => FromSchemaType(K, L));
1217
+ }
1218
+ function FromProperties3(K, T) {
1219
+ const Acc = {};
1220
+ for (const K2 of globalThis.Object.getOwnPropertyNames(T))
1221
+ Acc[K2] = FromSchemaType(K, T[K2]);
1222
+ return Acc;
1223
+ }
1224
+ function FromSchemaType(K, T) {
1225
+ const options = { ...T };
1226
+ return (
1227
+ // unevaluated modifier types
1228
+ IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
1229
+ // unevaluated mapped types
1230
+ IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
1231
+ // unevaluated types
1232
+ IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction2(T) ? Function(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item), options) : T
1233
+ )
1234
+ )
1235
+ );
1236
+ }
1237
+ function MappedFunctionReturnType(K, T) {
1238
+ const Acc = {};
1239
+ for (const L of K)
1240
+ Acc[L] = FromSchemaType(L, T);
1241
+ return Acc;
1242
+ }
1243
+ function Mapped(key, map, options) {
1244
+ const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
1245
+ const RT = map({ [Kind]: "MappedKey", keys: K });
1246
+ const R = MappedFunctionReturnType(K, RT);
1247
+ return Object2(R, options);
1248
+ }
1249
+
1250
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
1251
+ function RemoveOptional(schema) {
1252
+ return CreateType(Discard(schema, [OptionalKind]));
1253
+ }
1254
+ function AddOptional(schema) {
1255
+ return CreateType({ ...schema, [OptionalKind]: "Optional" });
1256
+ }
1257
+ function OptionalWithFlag(schema, F) {
1258
+ return F === false ? RemoveOptional(schema) : AddOptional(schema);
1259
+ }
1260
+ function Optional(schema, enable) {
1261
+ const F = enable ?? true;
1262
+ return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
1263
+ }
1264
+
1265
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
1266
+ function FromProperties4(P, F) {
1267
+ const Acc = {};
1268
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
1269
+ Acc[K2] = Optional(P[K2], F);
1270
+ return Acc;
1271
+ }
1272
+ function FromMappedResult4(R, F) {
1273
+ return FromProperties4(R.properties, F);
1274
+ }
1275
+ function OptionalFromMappedResult(R, F) {
1276
+ const P = FromMappedResult4(R, F);
1277
+ return MappedResult(P);
1278
+ }
1279
+
1280
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
1281
+ function IntersectCreate(T, options = {}) {
1282
+ const allObjects = T.every((schema) => IsObject3(schema));
1283
+ const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
1284
+ return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T }, options);
1285
+ }
1286
+
1287
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
1288
+ function IsIntersectOptional(types) {
1289
+ return types.every((left) => IsOptional(left));
1290
+ }
1291
+ function RemoveOptionalFromType2(type) {
1292
+ return Discard(type, [OptionalKind]);
1293
+ }
1294
+ function RemoveOptionalFromRest2(types) {
1295
+ return types.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
1296
+ }
1297
+ function ResolveIntersect(types, options) {
1298
+ return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
1299
+ }
1300
+ function IntersectEvaluated(types, options = {}) {
1301
+ if (types.length === 1)
1302
+ return CreateType(types[0], options);
1303
+ if (types.length === 0)
1304
+ return Never(options);
1305
+ if (types.some((schema) => IsTransform(schema)))
1306
+ throw new Error("Cannot intersect transform types");
1307
+ return ResolveIntersect(types, options);
1308
+ }
1309
+
1310
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
1311
+ function Intersect(types, options) {
1312
+ if (types.length === 1)
1313
+ return CreateType(types[0], options);
1314
+ if (types.length === 0)
1315
+ return Never(options);
1316
+ if (types.some((schema) => IsTransform(schema)))
1317
+ throw new Error("Cannot intersect transform types");
1318
+ return IntersectCreate(types, options);
1319
+ }
1320
+
1321
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
1322
+ function Ref(...args) {
1323
+ const [$ref, options] = typeof args[0] === "string" ? [args[0], args[1]] : [args[0].$id, args[1]];
1324
+ if (typeof $ref !== "string")
1325
+ throw new TypeBoxError("Ref: $ref must be a string");
1326
+ return CreateType({ [Kind]: "Ref", $ref }, options);
1327
+ }
1328
+
1329
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
1330
+ function FromComputed(target, parameters) {
1331
+ return Computed("Awaited", [Computed(target, parameters)]);
1332
+ }
1333
+ function FromRef($ref) {
1334
+ return Computed("Awaited", [Ref($ref)]);
1335
+ }
1336
+ function FromIntersect2(types) {
1337
+ return Intersect(FromRest3(types));
1338
+ }
1339
+ function FromUnion4(types) {
1340
+ return Union(FromRest3(types));
1341
+ }
1342
+ function FromPromise(type) {
1343
+ return Awaited(type);
1344
+ }
1345
+ function FromRest3(types) {
1346
+ return types.map((type) => Awaited(type));
1347
+ }
1348
+ function Awaited(type, options) {
1349
+ return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
1350
+ }
1351
+
1352
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
1353
+ function FromRest4(types) {
1354
+ const result = [];
1355
+ for (const L of types)
1356
+ result.push(KeyOfPropertyKeys(L));
1357
+ return result;
1358
+ }
1359
+ function FromIntersect3(types) {
1360
+ const propertyKeysArray = FromRest4(types);
1361
+ const propertyKeys = SetUnionMany(propertyKeysArray);
1362
+ return propertyKeys;
1363
+ }
1364
+ function FromUnion5(types) {
1365
+ const propertyKeysArray = FromRest4(types);
1366
+ const propertyKeys = SetIntersectMany(propertyKeysArray);
1367
+ return propertyKeys;
1368
+ }
1369
+ function FromTuple2(types) {
1370
+ return types.map((_, indexer) => indexer.toString());
1371
+ }
1372
+ function FromArray2(_) {
1373
+ return ["[number]"];
1374
+ }
1375
+ function FromProperties5(T) {
1376
+ return globalThis.Object.getOwnPropertyNames(T);
1377
+ }
1378
+ function FromPatternProperties(patternProperties) {
1379
+ if (!includePatternProperties)
1380
+ return [];
1381
+ const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
1382
+ return patternPropertyKeys.map((key) => {
1383
+ return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
1384
+ });
1385
+ }
1386
+ function KeyOfPropertyKeys(type) {
1387
+ return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
1388
+ }
1389
+ var includePatternProperties = false;
1390
+
1391
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
1392
+ function FromComputed2(target, parameters) {
1393
+ return Computed("KeyOf", [Computed(target, parameters)]);
1394
+ }
1395
+ function FromRef2($ref) {
1396
+ return Computed("KeyOf", [Ref($ref)]);
1397
+ }
1398
+ function KeyOfFromType(type, options) {
1399
+ const propertyKeys = KeyOfPropertyKeys(type);
1400
+ const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
1401
+ const result = UnionEvaluated(propertyKeyTypes);
1402
+ return CreateType(result, options);
1403
+ }
1404
+ function KeyOfPropertyKeysToRest(propertyKeys) {
1405
+ return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
1406
+ }
1407
+ function KeyOf(type, options) {
1408
+ return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
1409
+ }
1410
+
1411
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
1412
+ function FromProperties6(properties, options) {
1413
+ const result = {};
1414
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
1415
+ result[K2] = KeyOf(properties[K2], Clone(options));
1416
+ return result;
1417
+ }
1418
+ function FromMappedResult5(mappedResult, options) {
1419
+ return FromProperties6(mappedResult.properties, options);
1420
+ }
1421
+ function KeyOfFromMappedResult(mappedResult, options) {
1422
+ const properties = FromMappedResult5(mappedResult, options);
1423
+ return MappedResult(properties);
1424
+ }
1425
+
1426
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
1427
+ function CompositeKeys(T) {
1428
+ const Acc = [];
1429
+ for (const L of T)
1430
+ Acc.push(...KeyOfPropertyKeys(L));
1431
+ return SetDistinct(Acc);
1432
+ }
1433
+ function FilterNever(T) {
1434
+ return T.filter((L) => !IsNever(L));
1435
+ }
1436
+ function CompositeProperty(T, K) {
1437
+ const Acc = [];
1438
+ for (const L of T)
1439
+ Acc.push(...IndexFromPropertyKeys(L, [K]));
1440
+ return FilterNever(Acc);
1441
+ }
1442
+ function CompositeProperties(T, K) {
1443
+ const Acc = {};
1444
+ for (const L of K) {
1445
+ Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
1446
+ }
1447
+ return Acc;
1448
+ }
1449
+ function Composite(T, options) {
1450
+ const K = CompositeKeys(T);
1451
+ const P = CompositeProperties(T, K);
1452
+ const R = Object2(P, options);
1453
+ return R;
1454
+ }
1455
+
1456
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
1457
+ function Date2(options) {
1458
+ return CreateType({ [Kind]: "Date", type: "Date" }, options);
1459
+ }
1460
+
1461
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
1462
+ function Null(options) {
1463
+ return CreateType({ [Kind]: "Null", type: "null" }, options);
1464
+ }
1465
+
1466
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
1467
+ function Symbol2(options) {
1468
+ return CreateType({ [Kind]: "Symbol", type: "symbol" }, options);
1469
+ }
1470
+
1471
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
1472
+ function Undefined(options) {
1473
+ return CreateType({ [Kind]: "Undefined", type: "undefined" }, options);
1474
+ }
1475
+
1476
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
1477
+ function Uint8Array2(options) {
1478
+ return CreateType({ [Kind]: "Uint8Array", type: "Uint8Array" }, options);
1479
+ }
1480
+
1481
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
1482
+ function Unknown(options) {
1483
+ return CreateType({ [Kind]: "Unknown" }, options);
1484
+ }
1485
+
1486
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
1487
+ function FromArray3(T) {
1488
+ return T.map((L) => FromValue(L, false));
1489
+ }
1490
+ function FromProperties7(value) {
1491
+ const Acc = {};
1492
+ for (const K of globalThis.Object.getOwnPropertyNames(value))
1493
+ Acc[K] = Readonly(FromValue(value[K], false));
1494
+ return Acc;
1495
+ }
1496
+ function ConditionalReadonly(T, root) {
1497
+ return root === true ? T : Readonly(T);
1498
+ }
1499
+ function FromValue(value, root) {
1500
+ return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
1501
+ }
1502
+ function Const(T, options) {
1503
+ return CreateType(FromValue(T, true), options);
1504
+ }
1505
+
1506
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
1507
+ function ConstructorParameters(schema, options) {
1508
+ return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
1509
+ }
1510
+
1511
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
1512
+ function Enum(item, options) {
1513
+ if (IsUndefined(item))
1514
+ throw new Error("Enum undefined or empty");
1515
+ const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
1516
+ const values2 = [...new Set(values1)];
1517
+ const anyOf = values2.map((value) => Literal(value));
1518
+ return Union(anyOf, { ...options, [Hint]: "Enum" });
1519
+ }
1520
+
1521
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
1522
+ var ExtendsResolverError = class extends TypeBoxError {
1523
+ };
1524
+ var ExtendsResult;
1525
+ (function(ExtendsResult2) {
1526
+ ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
1527
+ ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
1528
+ ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
1529
+ })(ExtendsResult || (ExtendsResult = {}));
1530
+ function IntoBooleanResult(result) {
1531
+ return result === ExtendsResult.False ? result : ExtendsResult.True;
1532
+ }
1533
+ function Throw(message) {
1534
+ throw new ExtendsResolverError(message);
1535
+ }
1536
+ function IsStructuralRight(right) {
1537
+ return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
1538
+ }
1539
+ function StructuralRight(left, right) {
1540
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
1541
+ }
1542
+ function FromAnyRight(left, right) {
1543
+ return ExtendsResult.True;
1544
+ }
1545
+ function FromAny(left, right) {
1546
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
1547
+ }
1548
+ function FromArrayRight(left, right) {
1549
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
1550
+ }
1551
+ function FromArray4(left, right) {
1552
+ return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
1553
+ }
1554
+ function FromAsyncIterator(left, right) {
1555
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
1556
+ }
1557
+ function FromBigInt(left, right) {
1558
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
1559
+ }
1560
+ function FromBooleanRight(left, right) {
1561
+ return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
1562
+ }
1563
+ function FromBoolean(left, right) {
1564
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
1565
+ }
1566
+ function FromConstructor(left, right) {
1567
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index4) => IntoBooleanResult(Visit3(right.parameters[index4], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
1568
+ }
1569
+ function FromDate(left, right) {
1570
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
1571
+ }
1572
+ function FromFunction(left, right) {
1573
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index4) => IntoBooleanResult(Visit3(right.parameters[index4], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
1574
+ }
1575
+ function FromIntegerRight(left, right) {
1576
+ return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
1577
+ }
1578
+ function FromInteger(left, right) {
1579
+ return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
1580
+ }
1581
+ function FromIntersectRight(left, right) {
1582
+ return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
1583
+ }
1584
+ function FromIntersect4(left, right) {
1585
+ return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
1586
+ }
1587
+ function FromIterator(left, right) {
1588
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
1589
+ }
1590
+ function FromLiteral2(left, right) {
1591
+ return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
1592
+ }
1593
+ function FromNeverRight(left, right) {
1594
+ return ExtendsResult.False;
1595
+ }
1596
+ function FromNever(left, right) {
1597
+ return ExtendsResult.True;
1598
+ }
1599
+ function UnwrapTNot(schema) {
1600
+ let [current, depth] = [schema, 0];
1601
+ while (true) {
1602
+ if (!type_exports.IsNot(current))
1603
+ break;
1604
+ current = current.not;
1605
+ depth += 1;
1606
+ }
1607
+ return depth % 2 === 0 ? current : Unknown();
1608
+ }
1609
+ function FromNot(left, right) {
1610
+ return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
1611
+ }
1612
+ function FromNull(left, right) {
1613
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
1614
+ }
1615
+ function FromNumberRight(left, right) {
1616
+ return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
1617
+ }
1618
+ function FromNumber(left, right) {
1619
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
1620
+ }
1621
+ function IsObjectPropertyCount(schema, count) {
1622
+ return Object.getOwnPropertyNames(schema.properties).length === count;
1623
+ }
1624
+ function IsObjectStringLike(schema) {
1625
+ return IsObjectArrayLike(schema);
1626
+ }
1627
+ function IsObjectSymbolLike(schema) {
1628
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
1629
+ }
1630
+ function IsObjectNumberLike(schema) {
1631
+ return IsObjectPropertyCount(schema, 0);
1632
+ }
1633
+ function IsObjectBooleanLike(schema) {
1634
+ return IsObjectPropertyCount(schema, 0);
1635
+ }
1636
+ function IsObjectBigIntLike(schema) {
1637
+ return IsObjectPropertyCount(schema, 0);
1638
+ }
1639
+ function IsObjectDateLike(schema) {
1640
+ return IsObjectPropertyCount(schema, 0);
1641
+ }
1642
+ function IsObjectUint8ArrayLike(schema) {
1643
+ return IsObjectArrayLike(schema);
1644
+ }
1645
+ function IsObjectFunctionLike(schema) {
1646
+ const length = Number2();
1647
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
1648
+ }
1649
+ function IsObjectConstructorLike(schema) {
1650
+ return IsObjectPropertyCount(schema, 0);
1651
+ }
1652
+ function IsObjectArrayLike(schema) {
1653
+ const length = Number2();
1654
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
1655
+ }
1656
+ function IsObjectPromiseLike(schema) {
1657
+ const then = Function([Any()], Any());
1658
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
1659
+ }
1660
+ function Property(left, right) {
1661
+ return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
1662
+ }
1663
+ function FromObjectRight(left, right) {
1664
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
1665
+ return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
1666
+ })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
1667
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
1668
+ })() : ExtendsResult.False;
1669
+ }
1670
+ function FromObject(left, right) {
1671
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
1672
+ for (const key of Object.getOwnPropertyNames(right.properties)) {
1673
+ if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
1674
+ return ExtendsResult.False;
1675
+ }
1676
+ if (type_exports.IsOptional(right.properties[key])) {
1677
+ return ExtendsResult.True;
1678
+ }
1679
+ if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
1680
+ return ExtendsResult.False;
1681
+ }
1682
+ }
1683
+ return ExtendsResult.True;
1684
+ })();
1685
+ }
1686
+ function FromPromise2(left, right) {
1687
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
1688
+ }
1689
+ function RecordKey(schema) {
1690
+ return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String() : Throw("Unknown record key pattern");
1691
+ }
1692
+ function RecordValue(schema) {
1693
+ return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
1694
+ }
1695
+ function FromRecordRight(left, right) {
1696
+ const [Key, Value] = [RecordKey(right), RecordValue(right)];
1697
+ return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
1698
+ for (const key of Object.getOwnPropertyNames(left.properties)) {
1699
+ if (Property(Value, left.properties[key]) === ExtendsResult.False) {
1700
+ return ExtendsResult.False;
1701
+ }
1702
+ }
1703
+ return ExtendsResult.True;
1704
+ })() : ExtendsResult.False;
1705
+ }
1706
+ function FromRecord(left, right) {
1707
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
1708
+ }
1709
+ function FromRegExp(left, right) {
1710
+ const L = type_exports.IsRegExp(left) ? String() : left;
1711
+ const R = type_exports.IsRegExp(right) ? String() : right;
1712
+ return Visit3(L, R);
1713
+ }
1714
+ function FromStringRight(left, right) {
1715
+ return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
1716
+ }
1717
+ function FromString(left, right) {
1718
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
1719
+ }
1720
+ function FromSymbol(left, right) {
1721
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
1722
+ }
1723
+ function FromTemplateLiteral2(left, right) {
1724
+ return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
1725
+ }
1726
+ function IsArrayOfTuple(left, right) {
1727
+ return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
1728
+ }
1729
+ function FromTupleRight(left, right) {
1730
+ return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
1731
+ }
1732
+ function FromTuple3(left, right) {
1733
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index4) => Visit3(schema, right.items[index4]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
1734
+ }
1735
+ function FromUint8Array(left, right) {
1736
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
1737
+ }
1738
+ function FromUndefined(left, right) {
1739
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
1740
+ }
1741
+ function FromUnionRight(left, right) {
1742
+ return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
1743
+ }
1744
+ function FromUnion6(left, right) {
1745
+ return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
1746
+ }
1747
+ function FromUnknownRight(left, right) {
1748
+ return ExtendsResult.True;
1749
+ }
1750
+ function FromUnknown(left, right) {
1751
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
1752
+ }
1753
+ function FromVoidRight(left, right) {
1754
+ return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
1755
+ }
1756
+ function FromVoid(left, right) {
1757
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
1758
+ }
1759
+ function Visit3(left, right) {
1760
+ return (
1761
+ // resolvable
1762
+ type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
1763
+ // standard
1764
+ type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray4(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : type_exports.IsConstructor(left) ? FromConstructor(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect4(left, right) : type_exports.IsIterator(left) ? FromIterator(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple3(left, right) : type_exports.IsPromise(left) ? FromPromise2(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion6(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
1765
+ )
1766
+ );
1767
+ }
1768
+ function ExtendsCheck(left, right) {
1769
+ return Visit3(left, right);
1770
+ }
1771
+
1772
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
1773
+ function FromProperties8(P, Right, True, False, options) {
1774
+ const Acc = {};
1775
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
1776
+ Acc[K2] = Extends(P[K2], Right, True, False, Clone(options));
1777
+ return Acc;
1778
+ }
1779
+ function FromMappedResult6(Left, Right, True, False, options) {
1780
+ return FromProperties8(Left.properties, Right, True, False, options);
1781
+ }
1782
+ function ExtendsFromMappedResult(Left, Right, True, False, options) {
1783
+ const P = FromMappedResult6(Left, Right, True, False, options);
1784
+ return MappedResult(P);
1785
+ }
1786
+
1787
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
1788
+ function ExtendsResolve(left, right, trueType, falseType) {
1789
+ const R = ExtendsCheck(left, right);
1790
+ return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
1791
+ }
1792
+ function Extends(L, R, T, F, options) {
1793
+ return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : CreateType(ExtendsResolve(L, R, T, F), options);
1794
+ }
1795
+
1796
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
1797
+ function FromPropertyKey(K, U, L, R, options) {
1798
+ return {
1799
+ [K]: Extends(Literal(K), U, L, R, Clone(options))
1800
+ };
1801
+ }
1802
+ function FromPropertyKeys(K, U, L, R, options) {
1803
+ return K.reduce((Acc, LK) => {
1804
+ return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
1805
+ }, {});
1806
+ }
1807
+ function FromMappedKey2(K, U, L, R, options) {
1808
+ return FromPropertyKeys(K.keys, U, L, R, options);
1809
+ }
1810
+ function ExtendsFromMappedKey(T, U, L, R, options) {
1811
+ const P = FromMappedKey2(T, U, L, R, options);
1812
+ return MappedResult(P);
1813
+ }
1814
+
1815
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
1816
+ function ExcludeFromTemplateLiteral(L, R) {
1817
+ return Exclude(TemplateLiteralToUnion(L), R);
1818
+ }
1819
+
1820
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
1821
+ function ExcludeRest(L, R) {
1822
+ const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
1823
+ return excluded.length === 1 ? excluded[0] : Union(excluded);
1824
+ }
1825
+ function Exclude(L, R, options = {}) {
1826
+ if (IsTemplateLiteral(L))
1827
+ return CreateType(ExcludeFromTemplateLiteral(L, R), options);
1828
+ if (IsMappedResult(L))
1829
+ return CreateType(ExcludeFromMappedResult(L, R), options);
1830
+ return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
1831
+ }
1832
+
1833
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
1834
+ function FromProperties9(P, U) {
1835
+ const Acc = {};
1836
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
1837
+ Acc[K2] = Exclude(P[K2], U);
1838
+ return Acc;
1839
+ }
1840
+ function FromMappedResult7(R, T) {
1841
+ return FromProperties9(R.properties, T);
1842
+ }
1843
+ function ExcludeFromMappedResult(R, T) {
1844
+ const P = FromMappedResult7(R, T);
1845
+ return MappedResult(P);
1846
+ }
1847
+
1848
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
1849
+ function ExtractFromTemplateLiteral(L, R) {
1850
+ return Extract(TemplateLiteralToUnion(L), R);
1851
+ }
1852
+
1853
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
1854
+ function ExtractRest(L, R) {
1855
+ const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
1856
+ return extracted.length === 1 ? extracted[0] : Union(extracted);
1857
+ }
1858
+ function Extract(L, R, options) {
1859
+ if (IsTemplateLiteral(L))
1860
+ return CreateType(ExtractFromTemplateLiteral(L, R), options);
1861
+ if (IsMappedResult(L))
1862
+ return CreateType(ExtractFromMappedResult(L, R), options);
1863
+ return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
1864
+ }
1865
+
1866
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
1867
+ function FromProperties10(P, T) {
1868
+ const Acc = {};
1869
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
1870
+ Acc[K2] = Extract(P[K2], T);
1871
+ return Acc;
1872
+ }
1873
+ function FromMappedResult8(R, T) {
1874
+ return FromProperties10(R.properties, T);
1875
+ }
1876
+ function ExtractFromMappedResult(R, T) {
1877
+ const P = FromMappedResult8(R, T);
1878
+ return MappedResult(P);
1879
+ }
1880
+
1881
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
1882
+ function InstanceType(schema, options) {
1883
+ return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
1884
+ }
1885
+
1886
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
1887
+ function ReadonlyOptional(schema) {
1888
+ return Readonly(Optional(schema));
1889
+ }
1890
+
1891
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
1892
+ function RecordCreateFromPattern(pattern, T, options) {
1893
+ return CreateType({ [Kind]: "Record", type: "object", patternProperties: { [pattern]: T } }, options);
1894
+ }
1895
+ function RecordCreateFromKeys(K, T, options) {
1896
+ const result = {};
1897
+ for (const K2 of K)
1898
+ result[K2] = T;
1899
+ return Object2(result, { ...options, [Hint]: "Record" });
1900
+ }
1901
+ function FromTemplateLiteralKey(K, T, options) {
1902
+ return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
1903
+ }
1904
+ function FromUnionKey(key, type, options) {
1905
+ return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
1906
+ }
1907
+ function FromLiteralKey(key, type, options) {
1908
+ return RecordCreateFromKeys([key.toString()], type, options);
1909
+ }
1910
+ function FromRegExpKey(key, type, options) {
1911
+ return RecordCreateFromPattern(key.source, type, options);
1912
+ }
1913
+ function FromStringKey(key, type, options) {
1914
+ const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
1915
+ return RecordCreateFromPattern(pattern, type, options);
1916
+ }
1917
+ function FromAnyKey(_, type, options) {
1918
+ return RecordCreateFromPattern(PatternStringExact, type, options);
1919
+ }
1920
+ function FromNeverKey(_key, type, options) {
1921
+ return RecordCreateFromPattern(PatternNeverExact, type, options);
1922
+ }
1923
+ function FromBooleanKey(_key, type, options) {
1924
+ return Object2({ true: type, false: type }, options);
1925
+ }
1926
+ function FromIntegerKey(_key, type, options) {
1927
+ return RecordCreateFromPattern(PatternNumberExact, type, options);
1928
+ }
1929
+ function FromNumberKey(_, type, options) {
1930
+ return RecordCreateFromPattern(PatternNumberExact, type, options);
1931
+ }
1932
+ function Record(key, type, options = {}) {
1933
+ return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean2(key) ? FromBooleanKey(key, type, options) : IsInteger(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString2(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
1934
+ }
1935
+ function RecordPattern(record) {
1936
+ return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
1937
+ }
1938
+ function RecordKey2(type) {
1939
+ const pattern = RecordPattern(type);
1940
+ return pattern === PatternStringExact ? String() : pattern === PatternNumberExact ? Number2() : String({ pattern });
1941
+ }
1942
+ function RecordValue2(type) {
1943
+ return type.patternProperties[RecordPattern(type)];
1944
+ }
1945
+
1946
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs
1947
+ function FromConstructor2(args, type) {
1948
+ type.parameters = FromTypes(args, type.parameters);
1949
+ type.returns = FromType(args, type.returns);
1950
+ return type;
1951
+ }
1952
+ function FromFunction2(args, type) {
1953
+ type.parameters = FromTypes(args, type.parameters);
1954
+ type.returns = FromType(args, type.returns);
1955
+ return type;
1956
+ }
1957
+ function FromIntersect5(args, type) {
1958
+ type.allOf = FromTypes(args, type.allOf);
1959
+ return type;
1960
+ }
1961
+ function FromUnion7(args, type) {
1962
+ type.anyOf = FromTypes(args, type.anyOf);
1963
+ return type;
1964
+ }
1965
+ function FromTuple4(args, type) {
1966
+ if (IsUndefined(type.items))
1967
+ return type;
1968
+ type.items = FromTypes(args, type.items);
1969
+ return type;
1970
+ }
1971
+ function FromArray5(args, type) {
1972
+ type.items = FromType(args, type.items);
1973
+ return type;
1974
+ }
1975
+ function FromAsyncIterator2(args, type) {
1976
+ type.items = FromType(args, type.items);
1977
+ return type;
1978
+ }
1979
+ function FromIterator2(args, type) {
1980
+ type.items = FromType(args, type.items);
1981
+ return type;
1982
+ }
1983
+ function FromPromise3(args, type) {
1984
+ type.item = FromType(args, type.item);
1985
+ return type;
1986
+ }
1987
+ function FromObject2(args, type) {
1988
+ const mappedProperties = FromProperties11(args, type.properties);
1989
+ return { ...type, ...Object2(mappedProperties) };
1990
+ }
1991
+ function FromRecord2(args, type) {
1992
+ const mappedKey = FromType(args, RecordKey2(type));
1993
+ const mappedValue = FromType(args, RecordValue2(type));
1994
+ const result = Record(mappedKey, mappedValue);
1995
+ return { ...type, ...result };
1996
+ }
1997
+ function FromArgument(args, argument) {
1998
+ return argument.index in args ? args[argument.index] : Unknown();
1999
+ }
2000
+ function FromProperty2(args, type) {
2001
+ const isReadonly = IsReadonly(type);
2002
+ const isOptional = IsOptional(type);
2003
+ const mapped = FromType(args, type);
2004
+ return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
2005
+ }
2006
+ function FromProperties11(args, properties) {
2007
+ return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
2008
+ return { ...result, [key]: FromProperty2(args, properties[key]) };
2009
+ }, {});
2010
+ }
2011
+ function FromTypes(args, types) {
2012
+ return types.map((type) => FromType(args, type));
2013
+ }
2014
+ function FromType(args, type) {
2015
+ return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction2(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator2(type) ? FromAsyncIterator2(args, type) : IsIterator2(type) ? FromIterator2(args, type) : IsPromise(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
2016
+ }
2017
+ function Instantiate(type, args) {
2018
+ return FromType(args, CloneType(type));
2019
+ }
2020
+
2021
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
2022
+ function Integer(options) {
2023
+ return CreateType({ [Kind]: "Integer", type: "integer" }, options);
2024
+ }
2025
+
2026
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
2027
+ function MappedIntrinsicPropertyKey(K, M, options) {
2028
+ return {
2029
+ [K]: Intrinsic(Literal(K), M, Clone(options))
2030
+ };
2031
+ }
2032
+ function MappedIntrinsicPropertyKeys(K, M, options) {
2033
+ const result = K.reduce((Acc, L) => {
2034
+ return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
2035
+ }, {});
2036
+ return result;
2037
+ }
2038
+ function MappedIntrinsicProperties(T, M, options) {
2039
+ return MappedIntrinsicPropertyKeys(T["keys"], M, options);
2040
+ }
2041
+ function IntrinsicFromMappedKey(T, M, options) {
2042
+ const P = MappedIntrinsicProperties(T, M, options);
2043
+ return MappedResult(P);
2044
+ }
2045
+
2046
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
2047
+ function ApplyUncapitalize(value) {
2048
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
2049
+ return [first.toLowerCase(), rest].join("");
2050
+ }
2051
+ function ApplyCapitalize(value) {
2052
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
2053
+ return [first.toUpperCase(), rest].join("");
2054
+ }
2055
+ function ApplyUppercase(value) {
2056
+ return value.toUpperCase();
2057
+ }
2058
+ function ApplyLowercase(value) {
2059
+ return value.toLowerCase();
2060
+ }
2061
+ function FromTemplateLiteral3(schema, mode, options) {
2062
+ const expression = TemplateLiteralParseExact(schema.pattern);
2063
+ const finite = IsTemplateLiteralExpressionFinite(expression);
2064
+ if (!finite)
2065
+ return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
2066
+ const strings = [...TemplateLiteralExpressionGenerate(expression)];
2067
+ const literals = strings.map((value) => Literal(value));
2068
+ const mapped = FromRest5(literals, mode);
2069
+ const union = Union(mapped);
2070
+ return TemplateLiteral([union], options);
2071
+ }
2072
+ function FromLiteralValue(value, mode) {
2073
+ return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
2074
+ }
2075
+ function FromRest5(T, M) {
2076
+ return T.map((L) => Intrinsic(L, M));
2077
+ }
2078
+ function Intrinsic(schema, mode, options = {}) {
2079
+ return (
2080
+ // Intrinsic-Mapped-Inference
2081
+ IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
2082
+ // Standard-Inference
2083
+ IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : (
2084
+ // Default Type
2085
+ CreateType(schema, options)
2086
+ )
2087
+ )
2088
+ );
2089
+ }
2090
+
2091
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
2092
+ function Capitalize(T, options = {}) {
2093
+ return Intrinsic(T, "Capitalize", options);
2094
+ }
2095
+
2096
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
2097
+ function Lowercase(T, options = {}) {
2098
+ return Intrinsic(T, "Lowercase", options);
2099
+ }
2100
+
2101
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
2102
+ function Uncapitalize(T, options = {}) {
2103
+ return Intrinsic(T, "Uncapitalize", options);
2104
+ }
2105
+
2106
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
2107
+ function Uppercase(T, options = {}) {
2108
+ return Intrinsic(T, "Uppercase", options);
2109
+ }
2110
+
2111
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
2112
+ function FromProperties12(properties, propertyKeys, options) {
2113
+ const result = {};
2114
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
2115
+ result[K2] = Omit(properties[K2], propertyKeys, Clone(options));
2116
+ return result;
2117
+ }
2118
+ function FromMappedResult9(mappedResult, propertyKeys, options) {
2119
+ return FromProperties12(mappedResult.properties, propertyKeys, options);
2120
+ }
2121
+ function OmitFromMappedResult(mappedResult, propertyKeys, options) {
2122
+ const properties = FromMappedResult9(mappedResult, propertyKeys, options);
2123
+ return MappedResult(properties);
2124
+ }
2125
+
2126
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
2127
+ function FromIntersect6(types, propertyKeys) {
2128
+ return types.map((type) => OmitResolve(type, propertyKeys));
2129
+ }
2130
+ function FromUnion8(types, propertyKeys) {
2131
+ return types.map((type) => OmitResolve(type, propertyKeys));
2132
+ }
2133
+ function FromProperty3(properties, key) {
2134
+ const { [key]: _, ...R } = properties;
2135
+ return R;
2136
+ }
2137
+ function FromProperties13(properties, propertyKeys) {
2138
+ return propertyKeys.reduce((T, K2) => FromProperty3(T, K2), properties);
2139
+ }
2140
+ function FromObject3(properties, propertyKeys) {
2141
+ const options = Discard(properties, [TransformKind, "$id", "required", "properties"]);
2142
+ const omittedProperties = FromProperties13(properties["properties"], propertyKeys);
2143
+ return Object2(omittedProperties, options);
2144
+ }
2145
+ function UnionFromPropertyKeys(propertyKeys) {
2146
+ const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
2147
+ return Union(result);
2148
+ }
2149
+ function OmitResolve(properties, propertyKeys) {
2150
+ return IsIntersect(properties) ? Intersect(FromIntersect6(properties.allOf, propertyKeys)) : IsUnion(properties) ? Union(FromUnion8(properties.anyOf, propertyKeys)) : IsObject3(properties) ? FromObject3(properties, propertyKeys) : Object2({});
2151
+ }
2152
+ function Omit(type, key, options) {
2153
+ const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
2154
+ const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
2155
+ const isTypeRef = IsRef(type);
2156
+ const isKeyRef = IsRef(key);
2157
+ return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
2158
+ }
2159
+
2160
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
2161
+ function FromPropertyKey2(type, key, options) {
2162
+ return { [key]: Omit(type, [key], Clone(options)) };
2163
+ }
2164
+ function FromPropertyKeys2(type, propertyKeys, options) {
2165
+ return propertyKeys.reduce((Acc, LK) => {
2166
+ return { ...Acc, ...FromPropertyKey2(type, LK, options) };
2167
+ }, {});
2168
+ }
2169
+ function FromMappedKey3(type, mappedKey, options) {
2170
+ return FromPropertyKeys2(type, mappedKey.keys, options);
2171
+ }
2172
+ function OmitFromMappedKey(type, mappedKey, options) {
2173
+ const properties = FromMappedKey3(type, mappedKey, options);
2174
+ return MappedResult(properties);
2175
+ }
2176
+
2177
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
2178
+ function FromProperties14(properties, propertyKeys, options) {
2179
+ const result = {};
2180
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
2181
+ result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
2182
+ return result;
2183
+ }
2184
+ function FromMappedResult10(mappedResult, propertyKeys, options) {
2185
+ return FromProperties14(mappedResult.properties, propertyKeys, options);
2186
+ }
2187
+ function PickFromMappedResult(mappedResult, propertyKeys, options) {
2188
+ const properties = FromMappedResult10(mappedResult, propertyKeys, options);
2189
+ return MappedResult(properties);
2190
+ }
2191
+
2192
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
2193
+ function FromIntersect7(types, propertyKeys) {
2194
+ return types.map((type) => PickResolve(type, propertyKeys));
2195
+ }
2196
+ function FromUnion9(types, propertyKeys) {
2197
+ return types.map((type) => PickResolve(type, propertyKeys));
2198
+ }
2199
+ function FromProperties15(properties, propertyKeys) {
2200
+ const result = {};
2201
+ for (const K2 of propertyKeys)
2202
+ if (K2 in properties)
2203
+ result[K2] = properties[K2];
2204
+ return result;
2205
+ }
2206
+ function FromObject4(T, K) {
2207
+ const options = Discard(T, [TransformKind, "$id", "required", "properties"]);
2208
+ const properties = FromProperties15(T["properties"], K);
2209
+ return Object2(properties, options);
2210
+ }
2211
+ function UnionFromPropertyKeys2(propertyKeys) {
2212
+ const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
2213
+ return Union(result);
2214
+ }
2215
+ function PickResolve(properties, propertyKeys) {
2216
+ return IsIntersect(properties) ? Intersect(FromIntersect7(properties.allOf, propertyKeys)) : IsUnion(properties) ? Union(FromUnion9(properties.anyOf, propertyKeys)) : IsObject3(properties) ? FromObject4(properties, propertyKeys) : Object2({});
2217
+ }
2218
+ function Pick(type, key, options) {
2219
+ const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
2220
+ const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
2221
+ const isTypeRef = IsRef(type);
2222
+ const isKeyRef = IsRef(key);
2223
+ return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
2224
+ }
2225
+
2226
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
2227
+ function FromPropertyKey3(type, key, options) {
2228
+ return {
2229
+ [key]: Pick(type, [key], Clone(options))
2230
+ };
2231
+ }
2232
+ function FromPropertyKeys3(type, propertyKeys, options) {
2233
+ return propertyKeys.reduce((result, leftKey) => {
2234
+ return { ...result, ...FromPropertyKey3(type, leftKey, options) };
2235
+ }, {});
2236
+ }
2237
+ function FromMappedKey4(type, mappedKey, options) {
2238
+ return FromPropertyKeys3(type, mappedKey.keys, options);
2239
+ }
2240
+ function PickFromMappedKey(type, mappedKey, options) {
2241
+ const properties = FromMappedKey4(type, mappedKey, options);
2242
+ return MappedResult(properties);
2243
+ }
2244
+
2245
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
2246
+ function FromComputed3(target, parameters) {
2247
+ return Computed("Partial", [Computed(target, parameters)]);
2248
+ }
2249
+ function FromRef3($ref) {
2250
+ return Computed("Partial", [Ref($ref)]);
2251
+ }
2252
+ function FromProperties16(properties) {
2253
+ const partialProperties = {};
2254
+ for (const K of globalThis.Object.getOwnPropertyNames(properties))
2255
+ partialProperties[K] = Optional(properties[K]);
2256
+ return partialProperties;
2257
+ }
2258
+ function FromObject5(type) {
2259
+ const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
2260
+ const properties = FromProperties16(type["properties"]);
2261
+ return Object2(properties, options);
2262
+ }
2263
+ function FromRest6(types) {
2264
+ return types.map((type) => PartialResolve(type));
2265
+ }
2266
+ function PartialResolve(type) {
2267
+ return (
2268
+ // Mappable
2269
+ IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type) : (
2270
+ // Intrinsic
2271
+ IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
2272
+ // Passthrough
2273
+ Object2({})
2274
+ )
2275
+ )
2276
+ );
2277
+ }
2278
+ function Partial(type, options) {
2279
+ if (IsMappedResult(type)) {
2280
+ return PartialFromMappedResult(type, options);
2281
+ } else {
2282
+ return CreateType({ ...PartialResolve(type), ...options });
2283
+ }
2284
+ }
2285
+
2286
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
2287
+ function FromProperties17(K, options) {
2288
+ const Acc = {};
2289
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
2290
+ Acc[K2] = Partial(K[K2], Clone(options));
2291
+ return Acc;
2292
+ }
2293
+ function FromMappedResult11(R, options) {
2294
+ return FromProperties17(R.properties, options);
2295
+ }
2296
+ function PartialFromMappedResult(R, options) {
2297
+ const P = FromMappedResult11(R, options);
2298
+ return MappedResult(P);
2299
+ }
2300
+
2301
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
2302
+ function FromComputed4(target, parameters) {
2303
+ return Computed("Required", [Computed(target, parameters)]);
2304
+ }
2305
+ function FromRef4($ref) {
2306
+ return Computed("Required", [Ref($ref)]);
2307
+ }
2308
+ function FromProperties18(properties) {
2309
+ const requiredProperties = {};
2310
+ for (const K of globalThis.Object.getOwnPropertyNames(properties))
2311
+ requiredProperties[K] = Discard(properties[K], [OptionalKind]);
2312
+ return requiredProperties;
2313
+ }
2314
+ function FromObject6(type) {
2315
+ const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
2316
+ const properties = FromProperties18(type["properties"]);
2317
+ return Object2(properties, options);
2318
+ }
2319
+ function FromRest7(types) {
2320
+ return types.map((type) => RequiredResolve(type));
2321
+ }
2322
+ function RequiredResolve(type) {
2323
+ return (
2324
+ // Mappable
2325
+ IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type) : (
2326
+ // Intrinsic
2327
+ IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
2328
+ // Passthrough
2329
+ Object2({})
2330
+ )
2331
+ )
2332
+ );
2333
+ }
2334
+ function Required(type, options) {
2335
+ if (IsMappedResult(type)) {
2336
+ return RequiredFromMappedResult(type, options);
2337
+ } else {
2338
+ return CreateType({ ...RequiredResolve(type), ...options });
2339
+ }
2340
+ }
2341
+
2342
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
2343
+ function FromProperties19(P, options) {
2344
+ const Acc = {};
2345
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
2346
+ Acc[K2] = Required(P[K2], options);
2347
+ return Acc;
2348
+ }
2349
+ function FromMappedResult12(R, options) {
2350
+ return FromProperties19(R.properties, options);
2351
+ }
2352
+ function RequiredFromMappedResult(R, options) {
2353
+ const P = FromMappedResult12(R, options);
2354
+ return MappedResult(P);
2355
+ }
2356
+
2357
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
2358
+ function DereferenceParameters(moduleProperties, types) {
2359
+ return types.map((type) => {
2360
+ return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
2361
+ });
2362
+ }
2363
+ function Dereference(moduleProperties, ref) {
2364
+ return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
2365
+ }
2366
+ function FromAwaited(parameters) {
2367
+ return Awaited(parameters[0]);
2368
+ }
2369
+ function FromIndex(parameters) {
2370
+ return Index(parameters[0], parameters[1]);
2371
+ }
2372
+ function FromKeyOf(parameters) {
2373
+ return KeyOf(parameters[0]);
2374
+ }
2375
+ function FromPartial(parameters) {
2376
+ return Partial(parameters[0]);
2377
+ }
2378
+ function FromOmit(parameters) {
2379
+ return Omit(parameters[0], parameters[1]);
2380
+ }
2381
+ function FromPick(parameters) {
2382
+ return Pick(parameters[0], parameters[1]);
2383
+ }
2384
+ function FromRequired(parameters) {
2385
+ return Required(parameters[0]);
2386
+ }
2387
+ function FromComputed5(moduleProperties, target, parameters) {
2388
+ const dereferenced = DereferenceParameters(moduleProperties, parameters);
2389
+ return target === "Awaited" ? FromAwaited(dereferenced) : target === "Index" ? FromIndex(dereferenced) : target === "KeyOf" ? FromKeyOf(dereferenced) : target === "Partial" ? FromPartial(dereferenced) : target === "Omit" ? FromOmit(dereferenced) : target === "Pick" ? FromPick(dereferenced) : target === "Required" ? FromRequired(dereferenced) : Never();
2390
+ }
2391
+ function FromArray6(moduleProperties, type) {
2392
+ return Array2(FromType2(moduleProperties, type));
2393
+ }
2394
+ function FromAsyncIterator3(moduleProperties, type) {
2395
+ return AsyncIterator(FromType2(moduleProperties, type));
2396
+ }
2397
+ function FromConstructor3(moduleProperties, parameters, instanceType) {
2398
+ return Constructor(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, instanceType));
2399
+ }
2400
+ function FromFunction3(moduleProperties, parameters, returnType) {
2401
+ return Function(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, returnType));
2402
+ }
2403
+ function FromIntersect8(moduleProperties, types) {
2404
+ return Intersect(FromTypes2(moduleProperties, types));
2405
+ }
2406
+ function FromIterator3(moduleProperties, type) {
2407
+ return Iterator(FromType2(moduleProperties, type));
2408
+ }
2409
+ function FromObject7(moduleProperties, properties) {
2410
+ return Object2(globalThis.Object.keys(properties).reduce((result, key) => {
2411
+ return { ...result, [key]: FromType2(moduleProperties, properties[key]) };
2412
+ }, {}));
2413
+ }
2414
+ function FromRecord3(moduleProperties, type) {
2415
+ const [value, pattern] = [FromType2(moduleProperties, RecordValue2(type)), RecordPattern(type)];
2416
+ const result = CloneType(type);
2417
+ result.patternProperties[pattern] = value;
2418
+ return result;
2419
+ }
2420
+ function FromTransform(moduleProperties, transform) {
2421
+ return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
2422
+ }
2423
+ function FromTuple5(moduleProperties, types) {
2424
+ return Tuple(FromTypes2(moduleProperties, types));
2425
+ }
2426
+ function FromUnion10(moduleProperties, types) {
2427
+ return Union(FromTypes2(moduleProperties, types));
2428
+ }
2429
+ function FromTypes2(moduleProperties, types) {
2430
+ return types.map((type) => FromType2(moduleProperties, type));
2431
+ }
2432
+ function FromType2(moduleProperties, type) {
2433
+ return (
2434
+ // Modifiers
2435
+ IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : (
2436
+ // Transform
2437
+ IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
2438
+ // Types
2439
+ IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator2(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction2(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator2(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
2440
+ )
2441
+ )
2442
+ );
2443
+ }
2444
+ function ComputeType(moduleProperties, key) {
2445
+ return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
2446
+ }
2447
+ function ComputeModuleProperties(moduleProperties) {
2448
+ return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => {
2449
+ return { ...result, [key]: ComputeType(moduleProperties, key) };
2450
+ }, {});
2451
+ }
2452
+
2453
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs
2454
+ var TModule = class {
2455
+ constructor($defs) {
2456
+ const computed = ComputeModuleProperties($defs);
2457
+ const identified = this.WithIdentifiers(computed);
2458
+ this.$defs = identified;
2459
+ }
2460
+ /** `[Json]` Imports a Type by Key. */
2461
+ Import(key, options) {
2462
+ const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) };
2463
+ return CreateType({ [Kind]: "Import", $defs, $ref: key });
2464
+ }
2465
+ // prettier-ignore
2466
+ WithIdentifiers($defs) {
2467
+ return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => {
2468
+ return { ...result, [key]: { ...$defs[key], $id: key } };
2469
+ }, {});
2470
+ }
2471
+ };
2472
+ function Module(properties) {
2473
+ return new TModule(properties);
2474
+ }
2475
+
2476
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
2477
+ function Not(type, options) {
2478
+ return CreateType({ [Kind]: "Not", not: type }, options);
2479
+ }
2480
+
2481
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
2482
+ function Parameters(schema, options) {
2483
+ return IsFunction2(schema) ? Tuple(schema.parameters, options) : Never();
2484
+ }
2485
+
2486
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
2487
+ var Ordinal = 0;
2488
+ function Recursive(callback, options = {}) {
2489
+ if (IsUndefined(options.$id))
2490
+ options.$id = `T${Ordinal++}`;
2491
+ const thisType = CloneType(callback({ [Kind]: "This", $ref: `${options.$id}` }));
2492
+ thisType.$id = options.$id;
2493
+ return CreateType({ [Hint]: "Recursive", ...thisType }, options);
2494
+ }
2495
+
2496
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
2497
+ function RegExp2(unresolved, options) {
2498
+ const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
2499
+ return CreateType({ [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags }, options);
2500
+ }
2501
+
2502
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
2503
+ function RestResolve(T) {
2504
+ return IsIntersect(T) ? T.allOf : IsUnion(T) ? T.anyOf : IsTuple(T) ? T.items ?? [] : [];
2505
+ }
2506
+ function Rest(T) {
2507
+ return RestResolve(T);
2508
+ }
2509
+
2510
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
2511
+ function ReturnType(schema, options) {
2512
+ return IsFunction2(schema) ? CreateType(schema.returns, options) : Never(options);
2513
+ }
2514
+
2515
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
2516
+ var TransformDecodeBuilder = class {
2517
+ constructor(schema) {
2518
+ this.schema = schema;
2519
+ }
2520
+ Decode(decode) {
2521
+ return new TransformEncodeBuilder(this.schema, decode);
2522
+ }
2523
+ };
2524
+ var TransformEncodeBuilder = class {
2525
+ constructor(schema, decode) {
2526
+ this.schema = schema;
2527
+ this.decode = decode;
2528
+ }
2529
+ EncodeTransform(encode, schema) {
2530
+ const Encode = (value) => schema[TransformKind].Encode(encode(value));
2531
+ const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
2532
+ const Codec = { Encode, Decode };
2533
+ return { ...schema, [TransformKind]: Codec };
2534
+ }
2535
+ EncodeSchema(encode, schema) {
2536
+ const Codec = { Decode: this.decode, Encode: encode };
2537
+ return { ...schema, [TransformKind]: Codec };
2538
+ }
2539
+ Encode(encode) {
2540
+ return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
2541
+ }
2542
+ };
2543
+ function Transform(schema) {
2544
+ return new TransformDecodeBuilder(schema);
2545
+ }
2546
+
2547
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
2548
+ function Unsafe(options = {}) {
2549
+ return CreateType({ [Kind]: options[Kind] ?? "Unsafe" }, options);
2550
+ }
2551
+
2552
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
2553
+ function Void(options) {
2554
+ return CreateType({ [Kind]: "Void", type: "void" }, options);
2555
+ }
2556
+
2557
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
2558
+ var type_exports2 = {};
2559
+ __export(type_exports2, {
2560
+ Any: () => Any,
2561
+ Argument: () => Argument,
2562
+ Array: () => Array2,
2563
+ AsyncIterator: () => AsyncIterator,
2564
+ Awaited: () => Awaited,
2565
+ BigInt: () => BigInt,
2566
+ Boolean: () => Boolean,
2567
+ Capitalize: () => Capitalize,
2568
+ Composite: () => Composite,
2569
+ Const: () => Const,
2570
+ Constructor: () => Constructor,
2571
+ ConstructorParameters: () => ConstructorParameters,
2572
+ Date: () => Date2,
2573
+ Enum: () => Enum,
2574
+ Exclude: () => Exclude,
2575
+ Extends: () => Extends,
2576
+ Extract: () => Extract,
2577
+ Function: () => Function,
2578
+ Index: () => Index,
2579
+ InstanceType: () => InstanceType,
2580
+ Instantiate: () => Instantiate,
2581
+ Integer: () => Integer,
2582
+ Intersect: () => Intersect,
2583
+ Iterator: () => Iterator,
2584
+ KeyOf: () => KeyOf,
2585
+ Literal: () => Literal,
2586
+ Lowercase: () => Lowercase,
2587
+ Mapped: () => Mapped,
2588
+ Module: () => Module,
2589
+ Never: () => Never,
2590
+ Not: () => Not,
2591
+ Null: () => Null,
2592
+ Number: () => Number2,
2593
+ Object: () => Object2,
2594
+ Omit: () => Omit,
2595
+ Optional: () => Optional,
2596
+ Parameters: () => Parameters,
2597
+ Partial: () => Partial,
2598
+ Pick: () => Pick,
2599
+ Promise: () => Promise2,
2600
+ Readonly: () => Readonly,
2601
+ ReadonlyOptional: () => ReadonlyOptional,
2602
+ Record: () => Record,
2603
+ Recursive: () => Recursive,
2604
+ Ref: () => Ref,
2605
+ RegExp: () => RegExp2,
2606
+ Required: () => Required,
2607
+ Rest: () => Rest,
2608
+ ReturnType: () => ReturnType,
2609
+ String: () => String,
2610
+ Symbol: () => Symbol2,
2611
+ TemplateLiteral: () => TemplateLiteral,
2612
+ Transform: () => Transform,
2613
+ Tuple: () => Tuple,
2614
+ Uint8Array: () => Uint8Array2,
2615
+ Uncapitalize: () => Uncapitalize,
2616
+ Undefined: () => Undefined,
2617
+ Union: () => Union,
2618
+ Unknown: () => Unknown,
2619
+ Unsafe: () => Unsafe,
2620
+ Uppercase: () => Uppercase,
2621
+ Void: () => Void
2622
+ });
2623
+
2624
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
2625
+ var Type = type_exports2;
2626
+
2627
+ // src/server/routes/admin/errors.ts
2628
+ import { route } from "@spfn/core/route";
2629
+
2630
+ // src/server/repositories/error-groups.repository.ts
2631
+ import { eq, and, desc, sql, ilike, or, gte, lte } from "drizzle-orm";
2632
+ import { BaseRepository } from "@spfn/core/db";
2633
+
2634
+ // src/server/entities/schema.ts
2635
+ import { createSchema } from "@spfn/core/db";
2636
+ var monitorSchema = createSchema("@spfn/monitor");
2637
+
2638
+ // src/server/entities/error-groups.ts
2639
+ import { text, integer, index } from "drizzle-orm/pg-core";
2640
+ import { id, timestamps, enumText, utcTimestamp } from "@spfn/core/db";
2641
+ var ERROR_GROUP_STATUSES = ["active", "resolved", "ignored"];
2642
+ var errorGroups = monitorSchema.table(
2643
+ "error_groups",
2644
+ {
2645
+ // Primary Key
2646
+ id: id(),
2647
+ // Business Key — SHA-256 first 16 hex chars of (name:message:path)
2648
+ fingerprint: text("fingerprint").notNull().unique(),
2649
+ // Error identification
2650
+ name: text("name").notNull(),
2651
+ message: text("message").notNull(),
2652
+ path: text("path").notNull(),
2653
+ method: text("method").notNull(),
2654
+ statusCode: integer("status_code").notNull(),
2655
+ // Status
2656
+ status: enumText("status", ERROR_GROUP_STATUSES).default("active").notNull(),
2657
+ // Counters
2658
+ count: integer("count").notNull().default(1),
2659
+ // Timeline
2660
+ firstSeenAt: utcTimestamp("first_seen_at").notNull(),
2661
+ lastSeenAt: utcTimestamp("last_seen_at").notNull(),
2662
+ resolvedAt: utcTimestamp("resolved_at"),
2663
+ ...timestamps()
2664
+ },
2665
+ (table) => [
2666
+ index("monitor_eg_fingerprint_idx").on(table.fingerprint),
2667
+ index("monitor_eg_status_idx").on(table.status),
2668
+ index("monitor_eg_last_seen_at_idx").on(table.lastSeenAt),
2669
+ index("monitor_eg_path_idx").on(table.path)
2670
+ ]
2671
+ );
2672
+
2673
+ // src/server/entities/error-events.ts
2674
+ import { text as text2, integer as integer2, jsonb, index as index2 } from "drizzle-orm/pg-core";
2675
+ import { id as id2, timestamps as timestamps2, foreignKey } from "@spfn/core/db";
2676
+ var errorEvents = monitorSchema.table(
2677
+ "error_events",
2678
+ {
2679
+ // Primary Key
2680
+ id: id2(),
2681
+ // Foreign Key
2682
+ groupId: foreignKey("group", () => errorGroups.id).notNull(),
2683
+ // Request context
2684
+ requestId: text2("request_id"),
2685
+ userId: text2("user_id"),
2686
+ statusCode: integer2("status_code").notNull(),
2687
+ // Request details
2688
+ headers: jsonb("headers").$type(),
2689
+ query: jsonb("query").$type(),
2690
+ stackTrace: text2("stack_trace"),
2691
+ metadata: jsonb("metadata").$type(),
2692
+ ...timestamps2()
2693
+ },
2694
+ (table) => [
2695
+ index2("monitor_ee_group_id_idx").on(table.groupId),
2696
+ index2("monitor_ee_created_at_idx").on(table.createdAt),
2697
+ index2("monitor_ee_user_id_idx").on(table.userId)
2698
+ ]
2699
+ );
2700
+
2701
+ // src/server/entities/logs.ts
2702
+ import { text as text3, jsonb as jsonb2, index as index3 } from "drizzle-orm/pg-core";
2703
+ import { id as id3, timestamps as timestamps3, enumText as enumText2 } from "@spfn/core/db";
2704
+ var LOG_LEVELS = ["debug", "info", "warn", "error", "fatal"];
2705
+ var logs = monitorSchema.table(
2706
+ "logs",
2707
+ {
2708
+ // Primary Key
2709
+ id: id3(),
2710
+ // Log data
2711
+ level: enumText2("level", LOG_LEVELS).notNull(),
2712
+ message: text3("message").notNull(),
2713
+ source: text3("source"),
2714
+ // Request context
2715
+ requestId: text3("request_id"),
2716
+ userId: text3("user_id"),
2717
+ // Extra data
2718
+ metadata: jsonb2("metadata").$type(),
2719
+ ...timestamps3()
2720
+ },
2721
+ (table) => [
2722
+ index3("monitor_log_level_idx").on(table.level),
2723
+ index3("monitor_log_source_idx").on(table.source),
2724
+ index3("monitor_log_created_at_idx").on(table.createdAt)
2725
+ ]
2726
+ );
2727
+
2728
+ // src/server/repositories/error-groups.repository.ts
2729
+ var ErrorGroupsRepository = class extends BaseRepository {
2730
+ async findById(id4) {
2731
+ const result = await this.readDb.select().from(errorGroups).where(eq(errorGroups.id, id4)).limit(1);
2732
+ return result[0] ?? null;
2733
+ }
2734
+ async findByFingerprint(fingerprint) {
2735
+ const result = await this.readDb.select().from(errorGroups).where(eq(errorGroups.fingerprint, fingerprint)).limit(1);
2736
+ return result[0] ?? null;
2737
+ }
2738
+ async findMany(filters = {}) {
2739
+ const conditions = [];
2740
+ if (filters.status) {
2741
+ conditions.push(eq(errorGroups.status, filters.status));
2742
+ }
2743
+ if (filters.path) {
2744
+ conditions.push(eq(errorGroups.path, filters.path));
2745
+ }
2746
+ if (filters.search) {
2747
+ conditions.push(
2748
+ or(
2749
+ ilike(errorGroups.name, `%${filters.search}%`),
2750
+ ilike(errorGroups.message, `%${filters.search}%`),
2751
+ ilike(errorGroups.path, `%${filters.search}%`)
2752
+ )
2753
+ );
2754
+ }
2755
+ if (filters.dateFrom) {
2756
+ conditions.push(gte(errorGroups.lastSeenAt, filters.dateFrom));
2757
+ }
2758
+ if (filters.dateTo) {
2759
+ conditions.push(lte(errorGroups.lastSeenAt, filters.dateTo));
2760
+ }
2761
+ const where = conditions.length > 0 ? and(...conditions) : void 0;
2762
+ let query = this.readDb.select().from(errorGroups).orderBy(desc(errorGroups.lastSeenAt)).$dynamic();
2763
+ if (where) {
2764
+ query = query.where(where);
2765
+ }
2766
+ if (filters.limit) {
2767
+ query = query.limit(filters.limit);
2768
+ }
2769
+ if (filters.offset) {
2770
+ query = query.offset(filters.offset);
2771
+ }
2772
+ return await query;
2773
+ }
2774
+ async create(data) {
2775
+ return await this._create(errorGroups, {
2776
+ ...data,
2777
+ createdAt: /* @__PURE__ */ new Date(),
2778
+ updatedAt: /* @__PURE__ */ new Date()
2779
+ });
2780
+ }
2781
+ async incrementCount(id4) {
2782
+ const result = await this.db.update(errorGroups).set({
2783
+ count: sql`${errorGroups.count} + 1`,
2784
+ lastSeenAt: /* @__PURE__ */ new Date(),
2785
+ updatedAt: /* @__PURE__ */ new Date()
2786
+ }).where(eq(errorGroups.id, id4)).returning();
2787
+ return result[0] ?? null;
2788
+ }
2789
+ async updateStatus(id4, status) {
2790
+ const now = /* @__PURE__ */ new Date();
2791
+ const result = await this.db.update(errorGroups).set({
2792
+ status,
2793
+ resolvedAt: status === "resolved" ? now : null,
2794
+ updatedAt: now
2795
+ }).where(eq(errorGroups.id, id4)).returning();
2796
+ return result[0] ?? null;
2797
+ }
2798
+ async countByStatus() {
2799
+ const result = await this.readDb.select({
2800
+ status: errorGroups.status,
2801
+ count: sql`count(*)::int`
2802
+ }).from(errorGroups).groupBy(errorGroups.status);
2803
+ const counts = {
2804
+ active: 0,
2805
+ resolved: 0,
2806
+ ignored: 0
2807
+ };
2808
+ for (const row of result) {
2809
+ counts[row.status] = row.count;
2810
+ }
2811
+ return counts;
2812
+ }
2813
+ };
2814
+ var errorGroupsRepository = new ErrorGroupsRepository();
2815
+
2816
+ // src/server/repositories/error-events.repository.ts
2817
+ import { eq as eq2, desc as desc2, lt } from "drizzle-orm";
2818
+ import { BaseRepository as BaseRepository2 } from "@spfn/core/db";
2819
+ var ErrorEventsRepository = class extends BaseRepository2 {
2820
+ async create(data) {
2821
+ return await this._create(errorEvents, {
2822
+ ...data,
2823
+ createdAt: /* @__PURE__ */ new Date(),
2824
+ updatedAt: /* @__PURE__ */ new Date()
2825
+ });
2826
+ }
2827
+ async findByGroupId(groupId, options = {}) {
2828
+ const { limit = 20, offset = 0 } = options;
2829
+ return await this.readDb.select().from(errorEvents).where(eq2(errorEvents.groupId, groupId)).orderBy(desc2(errorEvents.createdAt)).limit(limit).offset(offset);
2830
+ }
2831
+ async deleteOlderThan(date) {
2832
+ const result = await this.db.delete(errorEvents).where(lt(errorEvents.createdAt, date)).returning();
2833
+ return result.length;
2834
+ }
2835
+ };
2836
+ var errorEventsRepository = new ErrorEventsRepository();
2837
+
2838
+ // src/server/repositories/logs.repository.ts
2839
+ import { eq as eq3, and as and2, desc as desc3, lt as lt2, ilike as ilike2, or as or2, gte as gte2, lte as lte2, sql as sql2 } from "drizzle-orm";
2840
+ import { BaseRepository as BaseRepository3 } from "@spfn/core/db";
2841
+ var LogsRepository = class extends BaseRepository3 {
2842
+ async create(data) {
2843
+ return await this._create(logs, {
2844
+ ...data,
2845
+ createdAt: /* @__PURE__ */ new Date(),
2846
+ updatedAt: /* @__PURE__ */ new Date()
2847
+ });
2848
+ }
2849
+ async findMany(filters = {}) {
2850
+ const conditions = [];
2851
+ if (filters.level) {
2852
+ conditions.push(eq3(logs.level, filters.level));
2853
+ }
2854
+ if (filters.source) {
2855
+ conditions.push(eq3(logs.source, filters.source));
2856
+ }
2857
+ if (filters.requestId) {
2858
+ conditions.push(eq3(logs.requestId, filters.requestId));
2859
+ }
2860
+ if (filters.userId) {
2861
+ conditions.push(eq3(logs.userId, filters.userId));
2862
+ }
2863
+ if (filters.search) {
2864
+ conditions.push(
2865
+ or2(
2866
+ ilike2(logs.message, `%${filters.search}%`),
2867
+ ilike2(logs.source, `%${filters.search}%`)
2868
+ )
2869
+ );
2870
+ }
2871
+ if (filters.dateFrom) {
2872
+ conditions.push(gte2(logs.createdAt, filters.dateFrom));
2873
+ }
2874
+ if (filters.dateTo) {
2875
+ conditions.push(lte2(logs.createdAt, filters.dateTo));
2876
+ }
2877
+ const where = conditions.length > 0 ? and2(...conditions) : void 0;
2878
+ let query = this.readDb.select().from(logs).orderBy(desc3(logs.createdAt)).$dynamic();
2879
+ if (where) {
2880
+ query = query.where(where);
2881
+ }
2882
+ if (filters.limit) {
2883
+ query = query.limit(filters.limit);
2884
+ }
2885
+ if (filters.offset) {
2886
+ query = query.offset(filters.offset);
2887
+ }
2888
+ return await query;
2889
+ }
2890
+ async countByLevel() {
2891
+ const result = await this.readDb.select({
2892
+ level: logs.level,
2893
+ count: sql2`count(*)::int`
2894
+ }).from(logs).groupBy(logs.level);
2895
+ const counts = {
2896
+ debug: 0,
2897
+ info: 0,
2898
+ warn: 0,
2899
+ error: 0,
2900
+ fatal: 0
2901
+ };
2902
+ for (const row of result) {
2903
+ counts[row.level] = row.count;
2904
+ }
2905
+ return counts;
2906
+ }
2907
+ async deleteOlderThan(date) {
2908
+ const result = await this.db.delete(logs).where(lt2(logs.createdAt, date)).returning();
2909
+ return result.length;
2910
+ }
2911
+ };
2912
+ var logsRepository = new LogsRepository();
2913
+
2914
+ // src/server/services/error-tracking.service.ts
2915
+ import crypto from "crypto";
2916
+
2917
+ // src/server/logger.ts
2918
+ import { logger as rootLogger } from "@spfn/core/logger";
2919
+ var monitorLogger = {
2920
+ errorTracking: rootLogger.child("@spfn/monitor:error-tracking"),
2921
+ logging: rootLogger.child("@spfn/monitor:logging"),
2922
+ notification: rootLogger.child("@spfn/monitor:notification"),
2923
+ lifecycle: rootLogger.child("@spfn/monitor:lifecycle"),
2924
+ route: rootLogger.child("@spfn/monitor:route")
2925
+ };
2926
+
2927
+ // src/server/notifiers/slack.ts
2928
+ import { sendSlack } from "@spfn/notification/server";
2929
+ import { getSlackWebhookUrl } from "@spfn/monitor/config";
2930
+ var logger = monitorLogger.notification;
2931
+ async function notifyErrorToSlack(group, event, reason) {
2932
+ const webhookUrl = getSlackWebhookUrl();
2933
+ if (!webhookUrl) {
2934
+ logger.warn("Slack webhook URL not configured, skipping notification");
2935
+ return;
2936
+ }
2937
+ const { text: text4, blocks } = formatSlackMessage(group, event, reason);
2938
+ const result = await sendSlack({ webhookUrl, text: text4, blocks });
2939
+ if (!result.success) {
2940
+ logger.warn("Failed to send Slack notification", { error: result.error });
2941
+ }
2942
+ }
2943
+ function formatSlackMessage(group, event, reason) {
2944
+ const isNew = reason === "new";
2945
+ const emoji = isNew ? ":rotating_light:" : ":warning:";
2946
+ const label = isNew ? "New Error" : "Re-opened Error";
2947
+ const title = `${emoji} ${label} \u2014 ${group.statusCode}`;
2948
+ const blocks = [
2949
+ {
2950
+ type: "header",
2951
+ text: {
2952
+ type: "plain_text",
2953
+ text: `${label} \u2014 ${group.statusCode}`,
2954
+ emoji: true
2955
+ }
2956
+ },
2957
+ {
2958
+ type: "section",
2959
+ text: {
2960
+ type: "mrkdwn",
2961
+ text: `*${group.name}*
2962
+ > ${group.message}`
2963
+ }
2964
+ },
2965
+ {
2966
+ type: "section",
2967
+ fields: [
2968
+ { type: "mrkdwn", text: `*Method*
2969
+ ${group.method}` },
2970
+ { type: "mrkdwn", text: `*Path*
2971
+ ${group.path}` },
2972
+ { type: "mrkdwn", text: `*User*
2973
+ ${event.userId ?? "(anonymous)"}` },
2974
+ { type: "mrkdwn", text: `*Request ID*
2975
+ ${event.requestId ?? "(none)"}` }
2976
+ ]
2977
+ },
2978
+ {
2979
+ type: "context",
2980
+ elements: [
2981
+ { type: "mrkdwn", text: `*Count:* ${group.count}` },
2982
+ { type: "mrkdwn", text: `*First seen:* ${formatTime(group.firstSeenAt)}` },
2983
+ { type: "mrkdwn", text: `*Last seen:* ${formatTime(group.lastSeenAt)}` }
2984
+ ]
2985
+ }
2986
+ ];
2987
+ if (event.stackTrace) {
2988
+ const shortStack = event.stackTrace.split("\n").slice(1, 4).map((l) => l.trim()).join("\n");
2989
+ blocks.push(
2990
+ { type: "divider" },
2991
+ {
2992
+ type: "section",
2993
+ text: {
2994
+ type: "mrkdwn",
2995
+ text: `*Stack Trace*
2996
+ \`\`\`${shortStack}\`\`\``
2997
+ }
2998
+ }
2999
+ );
3000
+ }
3001
+ if (event.headers && Object.keys(event.headers).length > 0) {
3002
+ const headerStr = Object.entries(event.headers).map(([k, v]) => `${k}: ${v}`).join("\n");
3003
+ blocks.push({
3004
+ type: "section",
3005
+ text: {
3006
+ type: "mrkdwn",
3007
+ text: `*Request Headers*
3008
+ \`\`\`${headerStr}\`\`\``
3009
+ }
3010
+ });
3011
+ }
3012
+ return { text: title, blocks };
3013
+ }
3014
+ function formatTime(date) {
3015
+ if (!date) {
3016
+ return "(unknown)";
3017
+ }
3018
+ return date.toISOString().replace("T", " ").slice(0, 19) + " UTC";
3019
+ }
3020
+
3021
+ // src/server/services/error-tracking.service.ts
3022
+ var logger2 = monitorLogger.errorTracking;
3023
+ function generateFingerprint(name, message, path) {
3024
+ return crypto.createHash("sha256").update(`${name}:${message}:${path}`).digest("hex").slice(0, 16);
3025
+ }
3026
+ async function trackError(err, ctx, metadata) {
3027
+ const fingerprint = generateFingerprint(
3028
+ err.name || "Error",
3029
+ err.message,
3030
+ ctx.path
3031
+ );
3032
+ const existing = await errorGroupsRepository.findByFingerprint(fingerprint);
3033
+ const now = /* @__PURE__ */ new Date();
3034
+ if (!existing) {
3035
+ const group = await errorGroupsRepository.create({
3036
+ fingerprint,
3037
+ name: err.name || "Error",
3038
+ message: err.message,
3039
+ path: ctx.path,
3040
+ method: ctx.method,
3041
+ statusCode: ctx.statusCode,
3042
+ status: "active",
3043
+ count: 1,
3044
+ firstSeenAt: now,
3045
+ lastSeenAt: now
3046
+ });
3047
+ const event = await createEvent(group.id, err, ctx, metadata);
3048
+ logger2.info("New error group tracked", { fingerprint, groupId: group.id });
3049
+ notifyErrorToSlack(group, event, "new").catch((e) => logger2.warn("Slack notification failed", e));
3050
+ return;
3051
+ }
3052
+ if (existing.status === "resolved") {
3053
+ await errorGroupsRepository.updateStatus(existing.id, "active");
3054
+ await errorGroupsRepository.incrementCount(existing.id);
3055
+ const event = await createEvent(existing.id, err, ctx, metadata);
3056
+ logger2.info("Error group reopened", { fingerprint, groupId: existing.id });
3057
+ notifyErrorToSlack(
3058
+ { ...existing, status: "active", count: existing.count + 1 },
3059
+ event,
3060
+ "reopened"
3061
+ ).catch((e) => logger2.warn("Slack notification failed", e));
3062
+ return;
3063
+ }
3064
+ await errorGroupsRepository.incrementCount(existing.id);
3065
+ await createEvent(existing.id, err, ctx, metadata);
3066
+ }
3067
+ async function updateErrorGroupStatus(groupId, newStatus) {
3068
+ const group = await errorGroupsRepository.findById(groupId);
3069
+ if (!group) {
3070
+ throw new Error(`Error group ${groupId} not found`);
3071
+ }
3072
+ const updated = await errorGroupsRepository.updateStatus(groupId, newStatus);
3073
+ if (!updated) {
3074
+ throw new Error(`Failed to update error group ${groupId}`);
3075
+ }
3076
+ logger2.info("Error group status updated", {
3077
+ groupId,
3078
+ from: group.status,
3079
+ to: newStatus
3080
+ });
3081
+ return updated;
3082
+ }
3083
+ async function createEvent(groupId, err, ctx, metadata) {
3084
+ return await errorEventsRepository.create({
3085
+ groupId,
3086
+ requestId: ctx.requestId,
3087
+ userId: ctx.userId,
3088
+ statusCode: ctx.statusCode,
3089
+ headers: ctx.headers,
3090
+ query: ctx.query,
3091
+ stackTrace: err.stack,
3092
+ metadata
3093
+ });
3094
+ }
3095
+
3096
+ // src/server/services/log.service.ts
3097
+ var logger3 = monitorLogger.logging;
3098
+ var DatabaseLogStore = class {
3099
+ async write(entry) {
3100
+ return await logsRepository.create(entry);
3101
+ }
3102
+ async query(filters) {
3103
+ return await logsRepository.findMany(filters);
3104
+ }
3105
+ async purge(olderThan) {
3106
+ return await logsRepository.deleteOlderThan(olderThan);
3107
+ }
3108
+ };
3109
+ var currentStore = new DatabaseLogStore();
3110
+ function setLogStore(store) {
3111
+ currentStore = store;
3112
+ logger3.info("Log store replaced", { store: store.constructor.name });
3113
+ }
3114
+ function getLogStore() {
3115
+ return currentStore;
3116
+ }
3117
+ async function writeLog(params) {
3118
+ return await currentStore.write({
3119
+ level: params.level,
3120
+ message: params.message,
3121
+ source: params.source,
3122
+ requestId: params.requestId,
3123
+ userId: params.userId,
3124
+ metadata: params.metadata
3125
+ });
3126
+ }
3127
+ async function queryLogs(filters) {
3128
+ return await currentStore.query(filters);
3129
+ }
3130
+
3131
+ // src/server/services/stats.service.ts
3132
+ import { sql as sql3, gte as gte3 } from "drizzle-orm";
3133
+ import { getDatabase } from "@spfn/core/db";
3134
+ async function getMonitorStats() {
3135
+ const [statusCounts, recentErrors, levelCounts, trends] = await Promise.all([
3136
+ errorGroupsRepository.countByStatus(),
3137
+ errorGroupsRepository.findMany({ status: "active", limit: 10 }),
3138
+ logsRepository.countByLevel(),
3139
+ getTrends()
3140
+ ]);
3141
+ const total = statusCounts.active + statusCounts.resolved + statusCounts.ignored;
3142
+ const logTotal = Object.values(levelCounts).reduce((sum, n) => sum + n, 0);
3143
+ return {
3144
+ errors: {
3145
+ total,
3146
+ ...statusCounts
3147
+ },
3148
+ recentErrors,
3149
+ logs: {
3150
+ total: logTotal,
3151
+ byLevel: levelCounts
3152
+ },
3153
+ trends
3154
+ };
3155
+ }
3156
+ async function getTrends() {
3157
+ const db = getDatabase("read");
3158
+ const now = /* @__PURE__ */ new Date();
3159
+ const last24h = new Date(now.getTime() - 24 * 60 * 60 * 1e3);
3160
+ const last7d = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1e3);
3161
+ const [errorsLast24h, errorsLast7d, logsLast24h] = await Promise.all([
3162
+ db.select({ count: sql3`count(*)::int` }).from(errorEvents).where(gte3(errorEvents.createdAt, last24h)).then((r) => r[0]?.count ?? 0),
3163
+ db.select({ count: sql3`count(*)::int` }).from(errorEvents).where(gte3(errorEvents.createdAt, last7d)).then((r) => r[0]?.count ?? 0),
3164
+ db.select({ count: sql3`count(*)::int` }).from(logs).where(gte3(logs.createdAt, last24h)).then((r) => r[0]?.count ?? 0)
3165
+ ]);
3166
+ return { errorsLast24h, errorsLast7d, logsLast24h };
3167
+ }
3168
+
3169
+ // src/server/routes/admin/errors.ts
3170
+ var listErrors = route.get("/_monitor/admin/errors").input({
3171
+ query: Type.Object({
3172
+ status: Type.Optional(Type.String({ description: "Filter by status (active/resolved/ignored)" })),
3173
+ path: Type.Optional(Type.String({ description: "Filter by request path" })),
3174
+ search: Type.Optional(Type.String({ description: "Search in name, message, path" })),
3175
+ dateFrom: Type.Optional(Type.String({ description: "Date range start (ISO)" })),
3176
+ dateTo: Type.Optional(Type.String({ description: "Date range end (ISO)" })),
3177
+ limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
3178
+ offset: Type.Optional(Type.Number({ minimum: 0 }))
3179
+ })
3180
+ }).use([authenticate, requireRole("superadmin")]).handler(async (c) => {
3181
+ const { query } = await c.data();
3182
+ return await errorGroupsRepository.findMany({
3183
+ status: query.status,
3184
+ path: query.path,
3185
+ search: query.search,
3186
+ dateFrom: query.dateFrom ? new Date(query.dateFrom) : void 0,
3187
+ dateTo: query.dateTo ? new Date(query.dateTo) : void 0,
3188
+ limit: query.limit ?? 20,
3189
+ offset: query.offset ?? 0
3190
+ });
3191
+ });
3192
+ var getErrorDetail = route.get("/_monitor/admin/errors/:id").input({
3193
+ params: Type.Object({
3194
+ id: Type.Number({ description: "Error group ID" })
3195
+ })
3196
+ }).use([authenticate, requireRole("superadmin")]).handler(async (c) => {
3197
+ const { params } = await c.data();
3198
+ const group = await errorGroupsRepository.findById(params.id);
3199
+ if (!group) {
3200
+ throw new Error(`Error group ${params.id} not found`);
3201
+ }
3202
+ const events = await errorEventsRepository.findByGroupId(params.id, { limit: 20 });
3203
+ return { group, events };
3204
+ });
3205
+ var updateErrorStatus = route.patch("/_monitor/admin/errors/:id").input({
3206
+ params: Type.Object({
3207
+ id: Type.Number({ description: "Error group ID" })
3208
+ }),
3209
+ body: Type.Object({
3210
+ status: Type.String({ description: "New status (active/resolved/ignored)" })
3211
+ })
3212
+ }).use([authenticate, requireRole("superadmin")]).handler(async (c) => {
3213
+ const { params, body } = await c.data();
3214
+ return await updateErrorGroupStatus(params.id, body.status);
3215
+ });
3216
+ var listErrorEvents = route.get("/_monitor/admin/errors/:id/events").input({
3217
+ params: Type.Object({
3218
+ id: Type.Number({ description: "Error group ID" })
3219
+ }),
3220
+ query: Type.Object({
3221
+ limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
3222
+ offset: Type.Optional(Type.Number({ minimum: 0 }))
3223
+ })
3224
+ }).use([authenticate, requireRole("superadmin")]).handler(async (c) => {
3225
+ const { params, query } = await c.data();
3226
+ return await errorEventsRepository.findByGroupId(params.id, {
3227
+ limit: query.limit ?? 20,
3228
+ offset: query.offset ?? 0
3229
+ });
3230
+ });
3231
+
3232
+ // src/server/routes/admin/logs.ts
3233
+ import { authenticate as authenticate2, requireRole as requireRole2 } from "@spfn/auth/server";
3234
+ import { route as route2 } from "@spfn/core/route";
3235
+ var listLogs = route2.get("/_monitor/admin/logs").input({
3236
+ query: Type.Object({
3237
+ level: Type.Optional(Type.String({ description: "Filter by level (debug/info/warn/error/fatal)" })),
3238
+ source: Type.Optional(Type.String({ description: "Filter by source module" })),
3239
+ search: Type.Optional(Type.String({ description: "Search in message" })),
3240
+ requestId: Type.Optional(Type.String({ description: "Filter by request ID" })),
3241
+ userId: Type.Optional(Type.String({ description: "Filter by user ID" })),
3242
+ dateFrom: Type.Optional(Type.String({ description: "Date range start (ISO)" })),
3243
+ dateTo: Type.Optional(Type.String({ description: "Date range end (ISO)" })),
3244
+ limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100 })),
3245
+ offset: Type.Optional(Type.Number({ minimum: 0 }))
3246
+ })
3247
+ }).use([authenticate2, requireRole2("superadmin")]).handler(async (c) => {
3248
+ const { query } = await c.data();
3249
+ return await queryLogs({
3250
+ level: query.level,
3251
+ source: query.source,
3252
+ search: query.search,
3253
+ requestId: query.requestId,
3254
+ userId: query.userId,
3255
+ dateFrom: query.dateFrom ? new Date(query.dateFrom) : void 0,
3256
+ dateTo: query.dateTo ? new Date(query.dateTo) : void 0,
3257
+ limit: query.limit ?? 50,
3258
+ offset: query.offset ?? 0
3259
+ });
3260
+ });
3261
+
3262
+ // src/server/routes/admin/stats.ts
3263
+ import { authenticate as authenticate3, requireRole as requireRole3 } from "@spfn/auth/server";
3264
+ import { route as route3 } from "@spfn/core/route";
3265
+ var getStats = route3.get("/_monitor/admin/stats").use([authenticate3, requireRole3("superadmin")]).handler(async () => {
3266
+ return await getMonitorStats();
3267
+ });
3268
+
3269
+ // src/server/routes/index.ts
3270
+ var monitorRouter = defineRouter({
3271
+ listErrors,
3272
+ getErrorDetail,
3273
+ updateErrorStatus,
3274
+ listErrorEvents,
3275
+ listLogs,
3276
+ getStats
3277
+ });
3278
+
3279
+ // src/server/integrations/error-handler.ts
3280
+ import { getMinStatusCode } from "@spfn/monitor/config";
3281
+ var logger4 = monitorLogger.errorTracking;
3282
+ function createMonitorErrorHandler(options = {}) {
3283
+ return async (err, ctx) => {
3284
+ const minStatus = options.minStatusCode ?? getMinStatusCode();
3285
+ if (ctx.statusCode < minStatus) {
3286
+ return;
3287
+ }
3288
+ const trackingCtx = {
3289
+ statusCode: ctx.statusCode,
3290
+ path: ctx.path,
3291
+ method: ctx.method,
3292
+ requestId: ctx.requestId,
3293
+ userId: ctx.userId,
3294
+ headers: ctx.request.headers,
3295
+ query: ctx.request.query
3296
+ };
3297
+ const metadata = options.extractMetadata?.(err, trackingCtx);
3298
+ try {
3299
+ await trackError(err, trackingCtx, metadata);
3300
+ } catch (e) {
3301
+ logger4.warn("Monitor error handler failed", e);
3302
+ }
3303
+ };
3304
+ }
3305
+
3306
+ // src/server/lifecycle.ts
3307
+ var logger5 = monitorLogger.lifecycle;
3308
+ function createMonitorLifecycle() {
3309
+ return {
3310
+ afterInfrastructure: async () => {
3311
+ logger5.info("@spfn/monitor initialized \u2014 error tracking and logging active");
3312
+ }
3313
+ };
3314
+ }
3315
+
3316
+ // src/server.ts
3317
+ var monitor = {
3318
+ log: writeLog
3319
+ };
3320
+ export {
3321
+ ERROR_GROUP_STATUSES,
3322
+ LOG_LEVELS,
3323
+ createMonitorErrorHandler,
3324
+ createMonitorLifecycle,
3325
+ errorEvents,
3326
+ errorEventsRepository,
3327
+ errorGroups,
3328
+ errorGroupsRepository,
3329
+ generateFingerprint,
3330
+ getLogStore,
3331
+ getMonitorStats,
3332
+ logs,
3333
+ logsRepository,
3334
+ monitor,
3335
+ monitorLogger,
3336
+ monitorRouter,
3337
+ monitorSchema,
3338
+ queryLogs,
3339
+ setLogStore,
3340
+ trackError,
3341
+ updateErrorGroupStatus,
3342
+ writeLog
3343
+ };
3344
+ //# sourceMappingURL=server.js.map