@explyt/ai-agent 0.2.0 → 0.2.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.
Files changed (37) hide show
  1. package/README.md +3 -3
  2. package/THIRD-PARTY-NOTICES.md +34 -5
  3. package/dist/cli/engine.js +8 -5
  4. package/dist/cli/index.js +2 -2
  5. package/dist/cli/update.js +7 -3
  6. package/dist/extensions/ask-user-question.js +1 -1
  7. package/dist/extensions/bash.js +1 -1
  8. package/dist/extensions/custom-provider.js +1 -1
  9. package/dist/extensions/hello.js +1 -1
  10. package/dist/extensions/identity.js +1 -1
  11. package/dist/extensions/mcp.js +1 -1
  12. package/dist/extensions/misc-hacks.js +1 -1
  13. package/dist/extensions/policy.js +1 -1
  14. package/dist/extensions/rules.js +1 -1
  15. package/dist/extensions/session-title.js +1 -1
  16. package/dist/extensions/skills.js +1 -1
  17. package/dist/extensions/subagents.js +1 -1
  18. package/dist/extensions/tui.js +1 -1
  19. package/dist/extensions/update-notice.js +1 -1
  20. package/dist/extensions/web-access.js +1 -1
  21. package/dist/extensions/write.js +1 -0
  22. package/dist/mcp-adapter.js +4 -4
  23. package/dist/rpiv-ask-user-question/{chunk-GAM3ZAHN.js → chunk-JNDW3P3A.js} +2 -2
  24. package/dist/rpiv-ask-user-question/index.js +3 -3
  25. package/dist/vendor/model-probe/rules.json +102 -0
  26. package/dist/vendor/model-probe/src/index.js +983 -0
  27. package/dist/vendor/model-probe/src/opencode-models-snapshot.js +8 -0
  28. package/dist/vendor/model-probe/src/opencode-models.js +6 -0
  29. package/dist/vendor/pi-ai-compat.js +2 -0
  30. package/dist/vendor/pi-coding-agent.js +159 -0
  31. package/dist/vendor/pi-web-access-deps/modelcontextprotocol__sdk__client__index.js.js +9 -0
  32. package/dist/vendor/pi-web-access-deps/modelcontextprotocol__sdk__client__streamableHttp.js.js +9 -0
  33. package/dist/vendor/pi-web-access.js +24958 -0
  34. package/dist/vendor/typebox/chunk-6XHASRAZ.js +4819 -0
  35. package/dist/vendor/typebox/index.js +703 -0
  36. package/dist/vendor/typebox/value.js +3736 -0
  37. package/package.json +12 -4
@@ -0,0 +1,3736 @@
1
+ /*
2
+ * typebox@1.3.24 -- MIT License, Copyright (c) 2017-2026 Haydn Paterson.
3
+ * Compiled unobfuscated and unmodified by Explyt AI Agent. Full license text: THIRD-PARTY-NOTICES.md.
4
+ */
5
+ import {
6
+ ArrayOptions,
7
+ Clone,
8
+ Evaluate,
9
+ Flatten,
10
+ Get,
11
+ Instantiate,
12
+ Intersect,
13
+ IsArray,
14
+ IsBigInt,
15
+ IsBoolean,
16
+ IsCodec,
17
+ IsConstructor,
18
+ IsCyclic,
19
+ IsEnum,
20
+ IsFunction,
21
+ IsInteger,
22
+ IsIntersect,
23
+ IsLiteral,
24
+ IsLiteralBigInt,
25
+ IsLiteralBoolean,
26
+ IsLiteralNumber,
27
+ IsLiteralString,
28
+ IsNever,
29
+ IsNull,
30
+ IsNumber,
31
+ IsObject,
32
+ IsOptional,
33
+ IsRecord,
34
+ IsRef,
35
+ IsRefine,
36
+ IsSchema,
37
+ IsString,
38
+ IsSymbol,
39
+ IsTemplateLiteral,
40
+ IsTuple,
41
+ IsUndefined,
42
+ IsUnion,
43
+ IsVoid,
44
+ Literal,
45
+ Priority,
46
+ Record,
47
+ RecordKey,
48
+ RecordPattern,
49
+ RecordValue,
50
+ Ref,
51
+ String as String2,
52
+ TemplateLiteralDecode,
53
+ Tuple,
54
+ Union,
55
+ Unknown,
56
+ Unreachable,
57
+ With,
58
+ _Array_,
59
+ _Object_,
60
+ __export,
61
+ arguments_exports,
62
+ globals_exports,
63
+ guard_default,
64
+ guard_exports,
65
+ hash_exports,
66
+ settings_exports
67
+ } from "./chunk-6XHASRAZ.js";
68
+
69
+ // node_modules/typebox/build/schema/types/_refine.mjs
70
+ function IsRefine2(value) {
71
+ return guard_exports.HasPropertyKey(value, "~refine") && guard_exports.IsArray(value["~refine"]) && guard_exports.Every(value["~refine"], 0, (value2) => guard_exports.IsObject(value2) && guard_exports.HasPropertyKey(value2, "check") && guard_exports.HasPropertyKey(value2, "error") && guard_exports.IsFunction(value2.check) && guard_exports.IsFunction(value2.error));
72
+ }
73
+
74
+ // node_modules/typebox/build/schema/types/schema.mjs
75
+ function IsSchemaObject(value) {
76
+ return guard_exports.IsObject(value) && !guard_exports.IsArray(value);
77
+ }
78
+ function IsSchemaBoolean(value) {
79
+ return guard_exports.IsBoolean(value);
80
+ }
81
+ function IsSchema2(value) {
82
+ return IsSchemaObject(value) || IsSchemaBoolean(value);
83
+ }
84
+
85
+ // node_modules/typebox/build/schema/types/additionalItems.mjs
86
+ function IsAdditionalItems(schema) {
87
+ return guard_exports.HasPropertyKey(schema, "additionalItems") && IsSchema2(schema.additionalItems);
88
+ }
89
+
90
+ // node_modules/typebox/build/schema/types/additionalProperties.mjs
91
+ function IsAdditionalProperties(schema) {
92
+ return guard_exports.HasPropertyKey(schema, "additionalProperties") && IsSchema2(schema.additionalProperties);
93
+ }
94
+
95
+ // node_modules/typebox/build/schema/types/allOf.mjs
96
+ function IsAllOf(schema) {
97
+ return guard_exports.HasPropertyKey(schema, "allOf") && guard_exports.IsArray(schema.allOf) && schema.allOf.every((value) => IsSchema2(value));
98
+ }
99
+
100
+ // node_modules/typebox/build/schema/types/anchor.mjs
101
+ function IsAnchor(schema) {
102
+ return guard_exports.HasPropertyKey(schema, "$anchor") && guard_exports.IsString(schema.$anchor);
103
+ }
104
+
105
+ // node_modules/typebox/build/schema/types/anyOf.mjs
106
+ function IsAnyOf(schema) {
107
+ return guard_exports.HasPropertyKey(schema, "anyOf") && guard_exports.IsArray(schema.anyOf) && schema.anyOf.every((value) => IsSchema2(value));
108
+ }
109
+
110
+ // node_modules/typebox/build/schema/types/const.mjs
111
+ function IsConst(value) {
112
+ return guard_exports.HasPropertyKey(value, "const");
113
+ }
114
+
115
+ // node_modules/typebox/build/schema/types/contains.mjs
116
+ function IsContains(schema) {
117
+ return guard_exports.HasPropertyKey(schema, "contains") && IsSchema2(schema.contains);
118
+ }
119
+
120
+ // node_modules/typebox/build/schema/types/default.mjs
121
+ function IsDefault(schema) {
122
+ return guard_exports.HasPropertyKey(schema, "default");
123
+ }
124
+
125
+ // node_modules/typebox/build/schema/types/dependencies.mjs
126
+ function IsDependencies(schema) {
127
+ return guard_exports.HasPropertyKey(schema, "dependencies") && guard_exports.IsObject(schema.dependencies) && Object.values(schema.dependencies).every((value) => IsSchema2(value) || guard_exports.IsArray(value) && value.every((value2) => guard_exports.IsString(value2)));
128
+ }
129
+
130
+ // node_modules/typebox/build/schema/types/dependentRequired.mjs
131
+ function IsDependentRequired(schema) {
132
+ return guard_exports.HasPropertyKey(schema, "dependentRequired") && guard_exports.IsObject(schema.dependentRequired) && Object.values(schema.dependentRequired).every((value) => guard_exports.IsArray(value) && value.every((value2) => guard_exports.IsString(value2)));
133
+ }
134
+
135
+ // node_modules/typebox/build/schema/types/dependentSchemas.mjs
136
+ function IsDependentSchemas(schema) {
137
+ return guard_exports.HasPropertyKey(schema, "dependentSchemas") && guard_exports.IsObject(schema.dependentSchemas) && Object.values(schema.dependentSchemas).every((value) => IsSchema2(value));
138
+ }
139
+
140
+ // node_modules/typebox/build/schema/types/dynamicAnchor.mjs
141
+ function IsDynamicAnchor(schema) {
142
+ return guard_exports.HasPropertyKey(schema, "$dynamicAnchor") && guard_exports.IsString(schema.$dynamicAnchor);
143
+ }
144
+
145
+ // node_modules/typebox/build/schema/types/dynamicRef.mjs
146
+ function IsDynamicRef(schema) {
147
+ return guard_exports.HasPropertyKey(schema, "$dynamicRef") && guard_exports.IsString(schema.$dynamicRef);
148
+ }
149
+
150
+ // node_modules/typebox/build/schema/types/else.mjs
151
+ function IsElse(schema) {
152
+ return guard_exports.HasPropertyKey(schema, "else") && IsSchema2(schema.else);
153
+ }
154
+
155
+ // node_modules/typebox/build/schema/types/enum.mjs
156
+ function IsEnum2(schema) {
157
+ return guard_exports.HasPropertyKey(schema, "enum") && guard_exports.IsArray(schema.enum);
158
+ }
159
+
160
+ // node_modules/typebox/build/schema/types/exclusiveMaximum.mjs
161
+ function IsExclusiveMaximum(schema) {
162
+ return guard_exports.HasPropertyKey(schema, "exclusiveMaximum") && (guard_exports.IsNumber(schema.exclusiveMaximum) || guard_exports.IsBigInt(schema.exclusiveMaximum));
163
+ }
164
+
165
+ // node_modules/typebox/build/schema/types/exclusiveMinimum.mjs
166
+ function IsExclusiveMinimum(schema) {
167
+ return guard_exports.HasPropertyKey(schema, "exclusiveMinimum") && (guard_exports.IsNumber(schema.exclusiveMinimum) || guard_exports.IsBigInt(schema.exclusiveMinimum));
168
+ }
169
+
170
+ // node_modules/typebox/build/schema/types/format.mjs
171
+ function IsFormat(schema) {
172
+ return guard_exports.HasPropertyKey(schema, "format") && guard_exports.IsString(schema.format);
173
+ }
174
+
175
+ // node_modules/typebox/build/schema/types/id.mjs
176
+ function IsId(schema) {
177
+ return guard_exports.HasPropertyKey(schema, "$id") && guard_exports.IsString(schema.$id);
178
+ }
179
+
180
+ // node_modules/typebox/build/schema/types/if.mjs
181
+ function IsIf(schema) {
182
+ return guard_exports.HasPropertyKey(schema, "if") && IsSchema2(schema.if);
183
+ }
184
+
185
+ // node_modules/typebox/build/schema/types/items.mjs
186
+ function IsItems(schema) {
187
+ return guard_exports.HasPropertyKey(schema, "items") && (IsSchema2(schema.items) || guard_exports.IsArray(schema.items) && schema.items.every((value) => {
188
+ return IsSchema2(value);
189
+ }));
190
+ }
191
+ function IsItemsSized(schema) {
192
+ return IsItems(schema) && guard_exports.IsArray(schema.items);
193
+ }
194
+
195
+ // node_modules/typebox/build/schema/types/maximum.mjs
196
+ function IsMaximum(schema) {
197
+ return guard_exports.HasPropertyKey(schema, "maximum") && (guard_exports.IsNumber(schema.maximum) || guard_exports.IsBigInt(schema.maximum));
198
+ }
199
+
200
+ // node_modules/typebox/build/schema/types/maxContains.mjs
201
+ function IsMaxContains(schema) {
202
+ return guard_exports.HasPropertyKey(schema, "maxContains") && guard_exports.IsNumber(schema.maxContains);
203
+ }
204
+
205
+ // node_modules/typebox/build/schema/types/maxItems.mjs
206
+ function IsMaxItems(schema) {
207
+ return guard_exports.HasPropertyKey(schema, "maxItems") && guard_exports.IsNumber(schema.maxItems);
208
+ }
209
+
210
+ // node_modules/typebox/build/schema/types/maxLength.mjs
211
+ function IsMaxLength(schema) {
212
+ return guard_exports.HasPropertyKey(schema, "maxLength") && guard_exports.IsNumber(schema.maxLength);
213
+ }
214
+
215
+ // node_modules/typebox/build/schema/types/maxProperties.mjs
216
+ function IsMaxProperties(schema) {
217
+ return guard_exports.HasPropertyKey(schema, "maxProperties") && guard_exports.IsNumber(schema.maxProperties);
218
+ }
219
+
220
+ // node_modules/typebox/build/schema/types/minimum.mjs
221
+ function IsMinimum(schema) {
222
+ return guard_exports.HasPropertyKey(schema, "minimum") && (guard_exports.IsNumber(schema.minimum) || guard_exports.IsBigInt(schema.minimum));
223
+ }
224
+
225
+ // node_modules/typebox/build/schema/types/minContains.mjs
226
+ function IsMinContains(schema) {
227
+ return guard_exports.HasPropertyKey(schema, "minContains") && guard_exports.IsNumber(schema.minContains);
228
+ }
229
+
230
+ // node_modules/typebox/build/schema/types/minItems.mjs
231
+ function IsMinItems(schema) {
232
+ return guard_exports.HasPropertyKey(schema, "minItems") && guard_exports.IsNumber(schema.minItems);
233
+ }
234
+
235
+ // node_modules/typebox/build/schema/types/minLength.mjs
236
+ function IsMinLength(schema) {
237
+ return guard_exports.HasPropertyKey(schema, "minLength") && guard_exports.IsNumber(schema.minLength);
238
+ }
239
+
240
+ // node_modules/typebox/build/schema/types/minProperties.mjs
241
+ function IsMinProperties(schema) {
242
+ return guard_exports.HasPropertyKey(schema, "minProperties") && guard_exports.IsNumber(schema.minProperties);
243
+ }
244
+
245
+ // node_modules/typebox/build/schema/types/multipleOf.mjs
246
+ function IsMultipleOf(schema) {
247
+ return guard_exports.HasPropertyKey(schema, "multipleOf") && (guard_exports.IsNumber(schema.multipleOf) || guard_exports.IsBigInt(schema.multipleOf));
248
+ }
249
+
250
+ // node_modules/typebox/build/schema/types/not.mjs
251
+ function IsNot(schema) {
252
+ return guard_exports.HasPropertyKey(schema, "not") && IsSchema2(schema.not);
253
+ }
254
+
255
+ // node_modules/typebox/build/schema/types/oneOf.mjs
256
+ function IsOneOf(schema) {
257
+ return guard_exports.HasPropertyKey(schema, "oneOf") && guard_exports.IsArray(schema.oneOf) && schema.oneOf.every((value) => IsSchema2(value));
258
+ }
259
+
260
+ // node_modules/typebox/build/schema/types/pattern.mjs
261
+ function IsPattern(schema) {
262
+ return guard_exports.HasPropertyKey(schema, "pattern") && (guard_exports.IsString(schema.pattern) || schema.pattern instanceof RegExp);
263
+ }
264
+
265
+ // node_modules/typebox/build/schema/types/patternProperties.mjs
266
+ function IsPatternProperties(schema) {
267
+ return guard_exports.HasPropertyKey(schema, "patternProperties") && guard_exports.IsObject(schema.patternProperties) && Object.values(schema.patternProperties).every((value) => IsSchema2(value));
268
+ }
269
+
270
+ // node_modules/typebox/build/schema/types/prefixItems.mjs
271
+ function IsPrefixItems(schema) {
272
+ return guard_exports.HasPropertyKey(schema, "prefixItems") && guard_exports.IsArray(schema.prefixItems) && schema.prefixItems.every((schema2) => IsSchema2(schema2));
273
+ }
274
+
275
+ // node_modules/typebox/build/schema/types/properties.mjs
276
+ function IsProperties(schema) {
277
+ return guard_exports.HasPropertyKey(schema, "properties") && guard_exports.IsObject(schema.properties) && Object.values(schema.properties).every((value) => IsSchema2(value));
278
+ }
279
+
280
+ // node_modules/typebox/build/schema/types/propertyNames.mjs
281
+ function IsPropertyNames(schema) {
282
+ return guard_exports.HasPropertyKey(schema, "propertyNames") && (guard_exports.IsObject(schema.propertyNames) || IsSchema2(schema.propertyNames));
283
+ }
284
+
285
+ // node_modules/typebox/build/schema/types/recursiveAnchor.mjs
286
+ function IsRecursiveAnchor(schema) {
287
+ return guard_exports.HasPropertyKey(schema, "$recursiveAnchor") && guard_exports.IsBoolean(schema.$recursiveAnchor);
288
+ }
289
+ function IsRecursiveAnchorTrue(schema) {
290
+ return IsRecursiveAnchor(schema) && guard_exports.IsEqual(schema.$recursiveAnchor, true);
291
+ }
292
+
293
+ // node_modules/typebox/build/schema/types/recursiveRef.mjs
294
+ function IsRecursiveRef(schema) {
295
+ return guard_exports.HasPropertyKey(schema, "$recursiveRef") && guard_exports.IsString(schema.$recursiveRef);
296
+ }
297
+
298
+ // node_modules/typebox/build/schema/types/ref.mjs
299
+ function IsRef2(schema) {
300
+ return guard_exports.HasPropertyKey(schema, "$ref") && guard_exports.IsString(schema.$ref);
301
+ }
302
+
303
+ // node_modules/typebox/build/schema/types/required.mjs
304
+ function IsRequired(schema) {
305
+ return guard_exports.HasPropertyKey(schema, "required") && guard_exports.IsArray(schema.required) && schema.required.every((value) => guard_exports.IsString(value));
306
+ }
307
+
308
+ // node_modules/typebox/build/schema/types/then.mjs
309
+ function IsThen(schema) {
310
+ return guard_exports.HasPropertyKey(schema, "then") && IsSchema2(schema.then);
311
+ }
312
+
313
+ // node_modules/typebox/build/schema/types/type.mjs
314
+ function IsType(schema) {
315
+ return guard_exports.HasPropertyKey(schema, "type") && (guard_exports.IsString(schema.type) || guard_exports.IsArray(schema.type) && schema.type.every((value) => guard_exports.IsString(value)));
316
+ }
317
+
318
+ // node_modules/typebox/build/schema/types/uniqueItems.mjs
319
+ function IsUniqueItems(schema) {
320
+ return guard_exports.HasPropertyKey(schema, "uniqueItems") && guard_exports.IsBoolean(schema.uniqueItems);
321
+ }
322
+
323
+ // node_modules/typebox/build/schema/types/unevaluatedItems.mjs
324
+ function IsUnevaluatedItems(schema) {
325
+ return guard_exports.HasPropertyKey(schema, "unevaluatedItems") && IsSchema2(schema.unevaluatedItems);
326
+ }
327
+
328
+ // node_modules/typebox/build/schema/types/unevaluatedProperties.mjs
329
+ function IsUnevaluatedProperties(schema) {
330
+ return guard_exports.HasPropertyKey(schema, "unevaluatedProperties") && IsSchema2(schema.unevaluatedProperties);
331
+ }
332
+
333
+ // node_modules/typebox/build/schema/engine/_context.mjs
334
+ var CheckContext = class {
335
+ constructor() {
336
+ const indices = /* @__PURE__ */ new Set();
337
+ const keys = /* @__PURE__ */ new Set();
338
+ this.stack = [{ indices, keys }];
339
+ }
340
+ // ----------------------------------------------------------------
341
+ // Stack
342
+ // ----------------------------------------------------------------
343
+ Push() {
344
+ const indices = /* @__PURE__ */ new Set();
345
+ const keys = /* @__PURE__ */ new Set();
346
+ this.stack.push({ indices, keys });
347
+ return true;
348
+ }
349
+ Pop() {
350
+ this.stack.pop();
351
+ return true;
352
+ }
353
+ // ----------------------------------------------------------------
354
+ // Top
355
+ // ----------------------------------------------------------------
356
+ AddIndex(index) {
357
+ this.GetIndices().add(index);
358
+ return true;
359
+ }
360
+ AddKey(key) {
361
+ this.GetKeys().add(key);
362
+ return true;
363
+ }
364
+ GetIndices() {
365
+ const top = this.stack[this.stack.length - 1];
366
+ return top.indices;
367
+ }
368
+ GetKeys() {
369
+ const top = this.stack[this.stack.length - 1];
370
+ return top.keys;
371
+ }
372
+ Merge(results) {
373
+ for (const context of results) {
374
+ context.GetIndices().forEach((value) => this.GetIndices().add(value));
375
+ context.GetKeys().forEach((value) => this.GetKeys().add(value));
376
+ }
377
+ return true;
378
+ }
379
+ };
380
+ var ErrorContext = class extends CheckContext {
381
+ constructor() {
382
+ super();
383
+ this.errors = [];
384
+ }
385
+ AtCapacity() {
386
+ return this.errors.length >= settings_exports.Get().maxErrors;
387
+ }
388
+ AddError(error) {
389
+ if (!this.AtCapacity())
390
+ this.errors.push(error);
391
+ return false;
392
+ }
393
+ GetErrors() {
394
+ return this.errors;
395
+ }
396
+ };
397
+
398
+ // node_modules/typebox/build/schema/engine/_refine.mjs
399
+ function CheckRefine(_stack, _context, schema, value) {
400
+ return guard_exports.Every(schema["~refine"], 0, (refinement, _) => refinement.check(value));
401
+ }
402
+ function ErrorRefine(_stack, context, schemaPath, instancePath, schema, value) {
403
+ return guard_exports.EveryAll(schema["~refine"], 0, (refinement, index) => {
404
+ return refinement.check(value) || context.AddError({
405
+ keyword: "~refine",
406
+ schemaPath,
407
+ instancePath,
408
+ params: { index, message: refinement.error(value) }
409
+ });
410
+ });
411
+ }
412
+
413
+ // node_modules/typebox/build/schema/engine/additionalItems.mjs
414
+ function IsValid(schema) {
415
+ return IsItems(schema) && guard_exports.IsArray(schema.items);
416
+ }
417
+ function CheckAdditionalItems(stack, context, schema, value) {
418
+ if (!IsValid(schema))
419
+ return true;
420
+ const isAdditionalItems = guard_exports.Every(value, 0, (item, index) => {
421
+ return guard_exports.IsLessThan(index, schema.items.length) || CheckSchemaPushStack(stack, context, schema.additionalItems, item) && context.AddIndex(index);
422
+ });
423
+ return isAdditionalItems;
424
+ }
425
+ function ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value) {
426
+ if (!IsValid(schema))
427
+ return true;
428
+ const isAdditionalItems = guard_exports.Every(value, 0, (item, index) => {
429
+ const nextSchemaPath = `${schemaPath}/additionalItems`;
430
+ const nextInstancePath = `${instancePath}/${index}`;
431
+ return guard_exports.IsLessThan(index, schema.items.length) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalItems, item) && context.AddIndex(index);
432
+ });
433
+ return isAdditionalItems;
434
+ }
435
+
436
+ // node_modules/typebox/build/schema/engine/_regexp.mjs
437
+ function UnicodeRegExp(pattern) {
438
+ return new RegExp(pattern, "u");
439
+ }
440
+
441
+ // node_modules/typebox/build/schema/engine/additionalProperties.mjs
442
+ function GetPropertyKeyAsPattern(key) {
443
+ const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
444
+ return `^${escaped}$`;
445
+ }
446
+ function GetPropertiesPattern(schema) {
447
+ const patterns = [];
448
+ if (IsPatternProperties(schema))
449
+ patterns.push(...guard_exports.Keys(schema.patternProperties));
450
+ if (IsProperties(schema))
451
+ patterns.push(...guard_exports.Keys(schema.properties).map(GetPropertyKeyAsPattern));
452
+ return guard_exports.IsEqual(patterns.length, 0) ? "(?!)" : `(${patterns.join("|")})`;
453
+ }
454
+ function CheckAdditionalProperties(stack, context, schema, value) {
455
+ const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
456
+ const isAdditionalProperties = guard_exports.Every(guard_exports.Keys(value), 0, (key, _index) => {
457
+ return regexp.test(key) || CheckSchemaPushStack(stack, context, schema.additionalProperties, value[key]) && context.AddKey(key);
458
+ });
459
+ return isAdditionalProperties;
460
+ }
461
+ function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
462
+ const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
463
+ const additionalProperties = [];
464
+ const isAdditionalProperties = guard_exports.EveryAll(guard_exports.Keys(value), 0, (key, _index) => {
465
+ const nextSchemaPath = `${schemaPath}/additionalProperties`;
466
+ const nextInstancePath = `${instancePath}/${key}`;
467
+ const isAdditionalProperty = regexp.test(key) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key);
468
+ if (!isAdditionalProperty)
469
+ additionalProperties.push(key);
470
+ return isAdditionalProperty;
471
+ });
472
+ return isAdditionalProperties || context.AddError({
473
+ keyword: "additionalProperties",
474
+ schemaPath,
475
+ instancePath,
476
+ params: { additionalProperties }
477
+ });
478
+ }
479
+
480
+ // node_modules/typebox/build/schema/engine/allOf.mjs
481
+ function CheckAllOf(stack, context, schema, value) {
482
+ const results = schema.allOf.reduce((result, schema2) => {
483
+ const nextContext = new CheckContext();
484
+ return CheckSchema(stack, nextContext, schema2, value) ? [...result, nextContext] : result;
485
+ }, []);
486
+ return guard_exports.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
487
+ }
488
+ function ErrorAllOf(stack, context, schemaPath, instancePath, schema, value) {
489
+ const failedContexts = [];
490
+ const results = schema.allOf.reduce((result, schema2, index) => {
491
+ const nextSchemaPath = `${schemaPath}/allOf/${index}`;
492
+ const nextContext = new ErrorContext();
493
+ const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema2, value);
494
+ if (!isSchema)
495
+ failedContexts.push(nextContext);
496
+ return isSchema ? [...result, nextContext] : result;
497
+ }, []);
498
+ const isAllOf = guard_exports.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
499
+ if (!isAllOf)
500
+ failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
501
+ return isAllOf;
502
+ }
503
+
504
+ // node_modules/typebox/build/schema/engine/anyOf.mjs
505
+ function CheckAnyOf(stack, context, schema, value) {
506
+ const results = schema.anyOf.reduce((result, schema2) => {
507
+ const nextContext = new CheckContext();
508
+ return CheckSchema(stack, nextContext, schema2, value) ? [...result, nextContext] : result;
509
+ }, []);
510
+ return guard_exports.IsGreaterThan(results.length, 0) && context.Merge(results);
511
+ }
512
+ function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value) {
513
+ const failedContexts = [];
514
+ const results = schema.anyOf.reduce((result, schema2, index) => {
515
+ const nextContext = new ErrorContext();
516
+ const nextSchemaPath = `${schemaPath}/anyOf/${index}`;
517
+ const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema2, value);
518
+ if (!isSchema)
519
+ failedContexts.push(nextContext);
520
+ return isSchema ? [...result, nextContext] : result;
521
+ }, []);
522
+ const isAnyOf = guard_exports.IsGreaterThan(results.length, 0) && context.Merge(results);
523
+ if (!isAnyOf)
524
+ failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
525
+ return isAnyOf || context.AddError({
526
+ keyword: "anyOf",
527
+ schemaPath,
528
+ instancePath,
529
+ params: {}
530
+ });
531
+ }
532
+
533
+ // node_modules/typebox/build/schema/engine/boolean.mjs
534
+ function CheckSchemaBoolean(_stack, _context, schema, _value) {
535
+ return schema;
536
+ }
537
+ function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
538
+ return CheckSchemaBoolean(stack, context, schema, value) || context.AddError({
539
+ keyword: "boolean",
540
+ schemaPath,
541
+ instancePath,
542
+ params: {}
543
+ });
544
+ }
545
+
546
+ // node_modules/typebox/build/schema/engine/const.mjs
547
+ function CheckConst(_stack, _context, schema, value) {
548
+ return guard_exports.IsValueLike(schema.const) ? guard_exports.IsEqual(value, schema.const) : guard_exports.IsDeepEqual(value, schema.const);
549
+ }
550
+ function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
551
+ return CheckConst(stack, context, schema, value) || context.AddError({
552
+ keyword: "const",
553
+ schemaPath,
554
+ instancePath,
555
+ params: { allowedValue: schema.const }
556
+ });
557
+ }
558
+
559
+ // node_modules/typebox/build/schema/engine/contains.mjs
560
+ function IsValid2(schema) {
561
+ return !(IsMinContains(schema) && guard_exports.IsEqual(schema.minContains, 0));
562
+ }
563
+ function CheckContains(stack, context, schema, value) {
564
+ if (!IsValid2(schema))
565
+ return true;
566
+ return !guard_exports.IsEqual(value.length, 0) && guard_exports.SomeAll(value, (item, index) => {
567
+ return CheckSchema(stack, context, schema.contains, item) && context.AddIndex(index);
568
+ });
569
+ }
570
+ function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
571
+ return CheckContains(stack, context, schema, value) || context.AddError({
572
+ keyword: "contains",
573
+ schemaPath,
574
+ instancePath,
575
+ params: { minContains: 1 }
576
+ });
577
+ }
578
+
579
+ // node_modules/typebox/build/schema/engine/dependencies.mjs
580
+ function CheckDependencies(stack, context, schema, value) {
581
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
582
+ const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependencies), 0, ([key, schema2]) => {
583
+ return !guard_exports.HasPropertyKey(value, key) || (guard_exports.IsArray(schema2) ? schema2.every((key2) => guard_exports.HasPropertyKey(value, key2)) : CheckSchema(stack, context, schema2, value));
584
+ });
585
+ return isLength || isEvery;
586
+ }
587
+ function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
588
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
589
+ const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependencies), 0, ([key, schema2]) => {
590
+ const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
591
+ return !guard_exports.HasPropertyKey(value, key) || (guard_exports.IsArray(schema2) ? schema2.every((dependency) => guard_exports.HasPropertyKey(value, dependency) || context.AddError({
592
+ keyword: "dependencies",
593
+ schemaPath,
594
+ instancePath,
595
+ params: { property: key, dependencies: schema2 }
596
+ })) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema2, value));
597
+ });
598
+ return isLength || isEvery;
599
+ }
600
+
601
+ // node_modules/typebox/build/schema/engine/dependentRequired.mjs
602
+ function CheckDependentRequired(_stack, _context, schema, value) {
603
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
604
+ const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentRequired), 0, ([key, keys]) => {
605
+ return !guard_exports.HasPropertyKey(value, key) || keys.every((key2) => guard_exports.HasPropertyKey(value, key2));
606
+ });
607
+ return isLength || isEvery;
608
+ }
609
+ function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
610
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
611
+ const isEveryEntry = guard_exports.EveryAll(guard_exports.Entries(schema.dependentRequired), 0, ([key, keys]) => {
612
+ return !guard_exports.HasPropertyKey(value, key) || guard_exports.EveryAll(keys, 0, (dependency) => guard_exports.HasPropertyKey(value, dependency) || context.AddError({
613
+ keyword: "dependentRequired",
614
+ schemaPath,
615
+ instancePath,
616
+ params: { property: key, dependencies: keys }
617
+ }));
618
+ });
619
+ return isLength || isEveryEntry;
620
+ }
621
+
622
+ // node_modules/typebox/build/schema/engine/dependentSchemas.mjs
623
+ function CheckDependentSchemas(stack, context, schema, value) {
624
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
625
+ const isEvery = guard_exports.Every(guard_exports.Entries(schema.dependentSchemas), 0, ([key, schema2]) => {
626
+ return !guard_exports.HasPropertyKey(value, key) || CheckSchema(stack, context, schema2, value);
627
+ });
628
+ return isLength || isEvery;
629
+ }
630
+ function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
631
+ const isLength = guard_exports.IsEqual(guard_exports.Keys(value).length, 0);
632
+ const isEvery = guard_exports.EveryAll(guard_exports.Entries(schema.dependentSchemas), 0, ([key, schema2]) => {
633
+ const nextSchemaPath = `${schemaPath}/dependentSchemas/${key}`;
634
+ return !guard_exports.HasPropertyKey(value, key) || ErrorSchema(stack, context, nextSchemaPath, instancePath, schema2, value);
635
+ });
636
+ return isLength || isEvery;
637
+ }
638
+
639
+ // node_modules/typebox/build/schema/engine/dynamicRef.mjs
640
+ function CheckDynamicRef(stack, context, schema, value) {
641
+ const target = stack.DynamicRef(schema) ?? false;
642
+ return IsSchema2(target) && CheckSchema(stack, context, target, value);
643
+ }
644
+ function ErrorDynamicRef(stack, context, _schemaPath, instancePath, schema, value) {
645
+ const target = stack.DynamicRef(schema) ?? false;
646
+ return IsSchema2(target) && ErrorSchema(stack, context, "#", instancePath, target, value);
647
+ }
648
+
649
+ // node_modules/typebox/build/schema/engine/enum.mjs
650
+ function CheckEnum(_stack, _context, schema, value) {
651
+ return guard_exports.Some(schema.enum, (option) => guard_exports.IsValueLike(option) ? guard_exports.IsEqual(value, option) : guard_exports.IsDeepEqual(value, option));
652
+ }
653
+ function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
654
+ return CheckEnum(stack, context, schema, value) || context.AddError({
655
+ keyword: "enum",
656
+ schemaPath,
657
+ instancePath,
658
+ params: { allowedValues: schema.enum }
659
+ });
660
+ }
661
+
662
+ // node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs
663
+ function CheckExclusiveMaximum(_stack, _context, schema, value) {
664
+ return guard_exports.IsLessThan(value, schema.exclusiveMaximum);
665
+ }
666
+ function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
667
+ return CheckExclusiveMaximum(stack, context, schema, value) || context.AddError({
668
+ keyword: "exclusiveMaximum",
669
+ schemaPath,
670
+ instancePath,
671
+ params: { comparison: "<", limit: schema.exclusiveMaximum }
672
+ });
673
+ }
674
+
675
+ // node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs
676
+ function CheckExclusiveMinimum(_stack, _context, schema, value) {
677
+ return guard_exports.IsGreaterThan(value, schema.exclusiveMinimum);
678
+ }
679
+ function ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value) {
680
+ return CheckExclusiveMinimum(stack, context, schema, value) || context.AddError({
681
+ keyword: "exclusiveMinimum",
682
+ schemaPath,
683
+ instancePath,
684
+ params: { comparison: ">", limit: schema.exclusiveMinimum }
685
+ });
686
+ }
687
+
688
+ // node_modules/typebox/build/format/format.mjs
689
+ var format_exports = {};
690
+ __export(format_exports, {
691
+ Clear: () => Clear,
692
+ Entries: () => Entries,
693
+ Get: () => Get2,
694
+ Has: () => Has,
695
+ IsDate: () => IsDate,
696
+ IsDateTime: () => IsDateTime,
697
+ IsDuration: () => IsDuration,
698
+ IsEmail: () => IsEmail,
699
+ IsHostname: () => IsHostname2,
700
+ IsIPv4: () => IsIPv4,
701
+ IsIPv6: () => IsIPv6,
702
+ IsIdnEmail: () => IsIdnEmail,
703
+ IsIdnHostname: () => IsIdnHostname2,
704
+ IsIri: () => IsIri,
705
+ IsIriReference: () => IsIriReference,
706
+ IsJsonPointer: () => IsJsonPointer,
707
+ IsJsonPointerUriFragment: () => IsJsonPointerUriFragment,
708
+ IsRegex: () => IsRegex,
709
+ IsRelativeJsonPointer: () => IsRelativeJsonPointer,
710
+ IsTime: () => IsTime,
711
+ IsUri: () => IsUri,
712
+ IsUriReference: () => IsUriReference,
713
+ IsUriTemplate: () => IsUriTemplate,
714
+ IsUrl: () => IsUrl,
715
+ IsUuid: () => IsUuid,
716
+ Reset: () => Reset,
717
+ Set: () => Set2,
718
+ Test: () => Test
719
+ });
720
+
721
+ // node_modules/typebox/build/format/date.mjs
722
+ var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
723
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
724
+ function IsLeapYear(year) {
725
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
726
+ }
727
+ function IsDate(value) {
728
+ const matches = DATE.exec(value);
729
+ if (!matches)
730
+ return false;
731
+ const year = +matches[1];
732
+ const month = +matches[2];
733
+ const day = +matches[3];
734
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && IsLeapYear(year) ? 29 : DAYS[month]);
735
+ }
736
+
737
+ // node_modules/typebox/build/format/time.mjs
738
+ var TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;
739
+ function IsTime(value, strictTimeZone = true) {
740
+ const matches = TIME.exec(value);
741
+ if (!matches)
742
+ return false;
743
+ if (strictTimeZone && !matches[4] && !matches[5])
744
+ return false;
745
+ const hr = +matches[1];
746
+ const min = +matches[2];
747
+ const sec = +matches[3];
748
+ if (hr > 23 || min > 59 || sec > 60)
749
+ return false;
750
+ if (matches[5]) {
751
+ const tzH2 = +matches[6];
752
+ const tzM2 = +matches[7];
753
+ if (tzH2 > 23 || tzM2 > 59)
754
+ return false;
755
+ }
756
+ if (sec < 60)
757
+ return true;
758
+ const tzSign = matches[5] === "-" ? -1 : 1;
759
+ const tzH = +(matches[6] || 0);
760
+ const tzM = +(matches[7] || 0);
761
+ const totalUtcMin = hr * 60 + min - tzSign * (tzH * 60 + tzM);
762
+ return (totalUtcMin % 1440 + 1440) % 1440 === 1439;
763
+ }
764
+
765
+ // node_modules/typebox/build/format/date_time.mjs
766
+ function IsDateTime(value) {
767
+ const dateTime = value.split(/T/i);
768
+ return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);
769
+ }
770
+
771
+ // node_modules/typebox/build/format/duration.mjs
772
+ var Duration = /^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;
773
+ function IsDuration(value) {
774
+ return Duration.test(value);
775
+ }
776
+
777
+ // node_modules/typebox/build/format/email.mjs
778
+ var Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
779
+ function IsEmail(value) {
780
+ return Email.test(value);
781
+ }
782
+
783
+ // node_modules/typebox/build/format/idna/pattern/pattern.mjs
784
+ var RE_RULE_HYPHEN_PLACEMENT = /^(?!-).*(?<!-)$/;
785
+ var RE_RULE_NOT_RESERVED_ACE = /^(?!..--)/;
786
+ var RE_ASCII_LDH = /^[a-zA-Z0-9-]*$/;
787
+ var RE_ASCII = new RegExp("^\\p{ASCII}*$", "u");
788
+ var RE_NON_ASCII = /[^\p{ASCII}]/u;
789
+ var RE_ASCII_DIGIT = /[0-9]/;
790
+ var RE_ARABIC_INDIC_DIGIT = /[\u{0660}-\u{0669}]/u;
791
+ var RE_EXT_ARABIC_INDIC_DIGIT = /[\u{06f0}-\u{06f9}]/u;
792
+ var RE_COMMON_SEPARATOR = /[\u{002e}\u{002c}\u{003a}\u{002f}]/u;
793
+ var RE_EUROPEAN_SEPARATOR = /[\u{002d}\u{002b}]/u;
794
+ var RE_MARK_NONSPACING = new RegExp("\\p{Mn}", "u");
795
+ var RE_MARK_SPACING_COMBINING = new RegExp("\\p{Mc}", "u");
796
+ var RE_MARK_ENCLOSING = new RegExp("\\p{Me}", "u");
797
+ var RE_COMBINING_MARK = /[\p{Mn}\p{Mc}\p{Me}]/u;
798
+ var RE_LETTER = new RegExp("\\p{L}", "u");
799
+ var RE_NUMBER_DECIMAL = new RegExp("\\p{Nd}", "u");
800
+ var RE_SCRIPT_GREEK = new RegExp("\\p{Script=Greek}", "u");
801
+ var RE_SCRIPT_HEBREW = new RegExp("\\p{Script=Hebrew}", "u");
802
+ var RE_SCRIPT_JAPANESE = /[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u;
803
+ var RE_SCRIPT_ARABIC_LETTER = /[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u;
804
+ var RE_VIRAMA = /[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u;
805
+ var RE_RFC5892_DISALLOWED = /[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u;
806
+ var RE_CONTEXTO_EXCEPTIONS = /[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u;
807
+ var RE_PVALID_EXCEPTIONS = /[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u;
808
+ var RE_EUROPEAN_NUMBER = new RegExp([
809
+ RE_ASCII_DIGIT,
810
+ RE_EXT_ARABIC_INDIC_DIGIT
811
+ ].map((regexp) => regexp.source).join("|"), "u");
812
+ var RE_PERMITTED_CATEGORY = new RegExp([
813
+ RE_LETTER,
814
+ RE_EUROPEAN_SEPARATOR,
815
+ RE_COMMON_SEPARATOR,
816
+ RE_NUMBER_DECIMAL,
817
+ RE_MARK_NONSPACING,
818
+ RE_MARK_SPACING_COMBINING,
819
+ RE_CONTEXTO_EXCEPTIONS,
820
+ RE_PVALID_EXCEPTIONS
821
+ ].map((regexp) => regexp.source).join("|"), "u");
822
+
823
+ // node_modules/typebox/build/format/idna/label/ascii.mjs
824
+ function IsAsciiLabel(value) {
825
+ return RE_RULE_HYPHEN_PLACEMENT.test(value) && RE_RULE_NOT_RESERVED_ACE.test(value) && RE_ASCII_LDH.test(value);
826
+ }
827
+
828
+ // node_modules/typebox/build/format/idna/format/puny.mjs
829
+ var PUNYCODE_BASE = 36;
830
+ var PUNYCODE_TMIN = 1;
831
+ var PUNYCODE_TMAX = 26;
832
+ var PUNYCODE_SKEW = 38;
833
+ var PUNYCODE_DAMP = 700;
834
+ var PUNYCODE_INITIAL_BIAS = 72;
835
+ var PUNYCODE_INITIAL_N = 128;
836
+ function ThrowDontCare() {
837
+ throw null;
838
+ }
839
+ function IsAcePrefixed(value) {
840
+ return value.toLowerCase().startsWith("xn--");
841
+ }
842
+ function Adapt(delta, numPoints, firstTime) {
843
+ delta = firstTime ? Math.floor(delta / PUNYCODE_DAMP) : delta >> 1;
844
+ delta += Math.floor(delta / numPoints);
845
+ let k = 0;
846
+ while (delta > (PUNYCODE_BASE - PUNYCODE_TMIN) * PUNYCODE_TMAX >> 1) {
847
+ delta = Math.floor(delta / (PUNYCODE_BASE - PUNYCODE_TMIN));
848
+ k += PUNYCODE_BASE;
849
+ }
850
+ return k + Math.floor((PUNYCODE_BASE - PUNYCODE_TMIN + 1) * delta / (delta + PUNYCODE_SKEW));
851
+ }
852
+ function Decode(value) {
853
+ const output = [];
854
+ let n = PUNYCODE_INITIAL_N;
855
+ let i = 0;
856
+ let bias = PUNYCODE_INITIAL_BIAS;
857
+ const delimIdx = value.lastIndexOf("-");
858
+ if (delimIdx > 0) {
859
+ for (let j = 0; j < delimIdx; j++) {
860
+ const cp = value.charCodeAt(j);
861
+ if (cp >= 128)
862
+ ThrowDontCare();
863
+ output.push(cp);
864
+ }
865
+ }
866
+ let inIdx = delimIdx < 0 ? 0 : delimIdx + 1;
867
+ while (inIdx < value.length) {
868
+ const oldi = i;
869
+ let w = 1;
870
+ let k = PUNYCODE_BASE;
871
+ while (true) {
872
+ if (inIdx >= value.length)
873
+ ThrowDontCare();
874
+ const ch = value.charCodeAt(inIdx++);
875
+ let digit;
876
+ if (ch >= 97 && ch <= 122)
877
+ digit = ch - 97;
878
+ else if (ch >= 48 && ch <= 57)
879
+ digit = ch - 48 + 26;
880
+ else
881
+ ThrowDontCare();
882
+ i += digit * w;
883
+ const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
884
+ if (digit < t)
885
+ break;
886
+ w *= PUNYCODE_BASE - t;
887
+ k += PUNYCODE_BASE;
888
+ }
889
+ const outLen = output.length + 1;
890
+ bias = Adapt(i - oldi, outLen, oldi === 0);
891
+ n += Math.floor(i / outLen);
892
+ i %= outLen;
893
+ output.splice(i, 0, n);
894
+ i++;
895
+ }
896
+ return String.fromCodePoint(...output);
897
+ }
898
+ function DigitToChar(digit) {
899
+ return digit < 26 ? String.fromCharCode(digit + 97) : String.fromCharCode(digit - 26 + 48);
900
+ }
901
+ var RE_REPLACE_NON_ASCII = new RegExp(RE_NON_ASCII.source, "gu");
902
+ function Encode(input) {
903
+ const basic = input.replace(RE_REPLACE_NON_ASCII, "");
904
+ const basicLength = basic.length;
905
+ const result = basicLength > 0 ? [basic, "-"] : [];
906
+ const codePoints = Array.from(input, (char) => char.codePointAt(0));
907
+ let n = PUNYCODE_INITIAL_N;
908
+ let delta = 0;
909
+ let bias = PUNYCODE_INITIAL_BIAS;
910
+ let handledCPCount = basicLength;
911
+ while (handledCPCount < codePoints.length) {
912
+ let m = Infinity;
913
+ for (const cp of codePoints) {
914
+ if (cp >= n && cp < m)
915
+ m = cp;
916
+ }
917
+ delta += (m - n) * (handledCPCount + 1);
918
+ n = m;
919
+ for (const cp of codePoints) {
920
+ if (cp < n)
921
+ delta++;
922
+ if (cp === n) {
923
+ let q = delta;
924
+ for (let k = PUNYCODE_BASE; ; k += PUNYCODE_BASE) {
925
+ const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
926
+ if (q < t)
927
+ break;
928
+ const digit = t + (q - t) % (PUNYCODE_BASE - t);
929
+ result.push(DigitToChar(digit));
930
+ q = Math.floor((q - t) / (PUNYCODE_BASE - t));
931
+ }
932
+ result.push(DigitToChar(q));
933
+ bias = Adapt(delta, handledCPCount + 1, handledCPCount === basicLength);
934
+ delta = 0;
935
+ handledCPCount++;
936
+ }
937
+ }
938
+ delta++;
939
+ n++;
940
+ }
941
+ return result.join("");
942
+ }
943
+
944
+ // node_modules/typebox/build/format/idna/format/bidi.mjs
945
+ var RE_RTL_ALLOWED = /^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/;
946
+ var RE_LTR_ALLOWED = /^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/;
947
+ var RE_RTL_CLASSES = /^(?:R|AL|AN)$/;
948
+ function HasBidiChars(value) {
949
+ if (IsAcePrefixed(value)) {
950
+ try {
951
+ return HasRightToLeftCharacters(Decode(value.slice(4).toLowerCase()));
952
+ } catch {
953
+ return false;
954
+ }
955
+ }
956
+ return HasRightToLeftCharacters(value);
957
+ }
958
+ function GetBidiClass(codePoint) {
959
+ const char = String.fromCodePoint(codePoint);
960
+ return RE_EUROPEAN_NUMBER.test(char) ? "EN" : RE_ARABIC_INDIC_DIGIT.test(char) ? "AN" : (
961
+ // Pattern.RE_EUROPEAN_SEPARATOR.test(char) ? 'ES' : // (no-spec-coverage)
962
+ // Pattern.RE_COMMON_SEPARATOR.test(char) ? 'CS' : // (no-spec-coverage)
963
+ RE_MARK_NONSPACING.test(char) ? "NSM" : RE_SCRIPT_HEBREW.test(char) ? "R" : RE_SCRIPT_ARABIC_LETTER.test(char) ? "AL" : RE_LETTER.test(char) ? "L" : "ON"
964
+ );
965
+ }
966
+ function HasRightToLeftCharacters(value) {
967
+ for (const ch of value)
968
+ if (RE_RTL_CLASSES.test(GetBidiClass(ch.codePointAt(0))))
969
+ return true;
970
+ return false;
971
+ }
972
+ function SatisfiesBidiRule(value) {
973
+ let isRtl = false;
974
+ let allowed = RE_LTR_ALLOWED;
975
+ let sawEN = false;
976
+ let sawAN = false;
977
+ let isFirst = true;
978
+ for (const ch of value) {
979
+ const bidiClass = GetBidiClass(ch.codePointAt(0));
980
+ if (isFirst) {
981
+ if (bidiClass !== "L" && bidiClass !== "R" && bidiClass !== "AL")
982
+ return false;
983
+ isRtl = bidiClass === "R" || bidiClass === "AL";
984
+ allowed = isRtl ? RE_RTL_ALLOWED : RE_LTR_ALLOWED;
985
+ isFirst = false;
986
+ }
987
+ if (!allowed.test(bidiClass))
988
+ return false;
989
+ if (bidiClass === "EN")
990
+ sawEN = true;
991
+ else if (bidiClass === "AN")
992
+ sawAN = true;
993
+ }
994
+ if (isRtl && sawEN && sawAN)
995
+ return false;
996
+ return true;
997
+ }
998
+
999
+ // node_modules/typebox/build/format/idna/label/unicode.mjs
1000
+ function ExceedsMaxALabelLength(value) {
1001
+ return RE_NON_ASCII.test(value) && Encode(value).length + 4 > 63;
1002
+ }
1003
+ function HasInvalidHyphens(chars) {
1004
+ if (chars[0] === "-" || chars[chars.length - 1] === "-")
1005
+ return true;
1006
+ return chars.slice(2).join("").startsWith("--");
1007
+ }
1008
+ function IsUnicodeLabel(value) {
1009
+ if (ExceedsMaxALabelLength(value))
1010
+ return false;
1011
+ if (HasRightToLeftCharacters(value) && !SatisfiesBidiRule(value))
1012
+ return false;
1013
+ const chars = [...value];
1014
+ const codePoints = chars.map((c) => c.codePointAt(0));
1015
+ const length = codePoints.length;
1016
+ if (HasInvalidHyphens(chars))
1017
+ return false;
1018
+ if (RE_COMBINING_MARK.test(chars[0]))
1019
+ return false;
1020
+ let hasJapanese = false;
1021
+ for (let i = 0; i < length; i++) {
1022
+ const codePoint = codePoints[i];
1023
+ const char = chars[i];
1024
+ if (RE_RFC5892_DISALLOWED.test(char))
1025
+ return false;
1026
+ if (!RE_PERMITTED_CATEGORY.test(char))
1027
+ return false;
1028
+ if (RE_SCRIPT_JAPANESE.test(char))
1029
+ hasJapanese = true;
1030
+ const prev = codePoints[i - 1], next = codePoints[i + 1];
1031
+ switch (codePoint) {
1032
+ case 183:
1033
+ if (prev !== 108 || next !== 108)
1034
+ return false;
1035
+ break;
1036
+ // MIDDLE DOT (Catalan)
1037
+ case 885:
1038
+ if (!next || !RE_SCRIPT_GREEK.test(chars[i + 1]))
1039
+ return false;
1040
+ break;
1041
+ // Greek KERAIA
1042
+ case 1523:
1043
+ case 1524:
1044
+ if (!prev || !RE_SCRIPT_HEBREW.test(chars[i - 1]))
1045
+ return false;
1046
+ break;
1047
+ // Hebrew GERESH
1048
+ case 8204:
1049
+ if (!prev || prev < 128 && !RE_VIRAMA.test(chars[i - 1]))
1050
+ return false;
1051
+ break;
1052
+ case 8205:
1053
+ if (!prev || !RE_VIRAMA.test(chars[i - 1]))
1054
+ return false;
1055
+ break;
1056
+ case 12539:
1057
+ break;
1058
+ }
1059
+ }
1060
+ if (value.includes("\u30FB") && !hasJapanese)
1061
+ return false;
1062
+ return true;
1063
+ }
1064
+
1065
+ // node_modules/typebox/build/format/idna/label/puny.mjs
1066
+ function IsPunyLabel(value) {
1067
+ if (!IsAcePrefixed(value))
1068
+ return false;
1069
+ try {
1070
+ const body = value.slice(4).toLowerCase();
1071
+ if (body.lastIndexOf("-") === 0)
1072
+ return false;
1073
+ const decoded = Decode(body);
1074
+ if (!RE_NON_ASCII.test(decoded))
1075
+ return false;
1076
+ return IsUnicodeLabel(decoded);
1077
+ } catch {
1078
+ return false;
1079
+ }
1080
+ }
1081
+
1082
+ // node_modules/typebox/build/format/idna/hostname.mjs
1083
+ function IsValidLabelLength(value) {
1084
+ return value.length > 0 && value.length <= 63;
1085
+ }
1086
+ function IsLabel(value) {
1087
+ return IsValidLabelLength(value) && (IsPunyLabel(value) || IsAsciiLabel(value));
1088
+ }
1089
+ function IsHostname(value) {
1090
+ if (value.length === 0 || value.length > 253)
1091
+ return false;
1092
+ if (value.charCodeAt(value.length - 1) === 46)
1093
+ return false;
1094
+ return value.split(".").every((label) => IsLabel(label));
1095
+ }
1096
+
1097
+ // node_modules/typebox/build/format/idna/idn-hostname.mjs
1098
+ function IsValidLabelLength2(value) {
1099
+ return value.length > 0 && value.length <= 63;
1100
+ }
1101
+ function IsLabel2(value) {
1102
+ return IsValidLabelLength2(value) && (IsPunyLabel(value) || IsUnicodeLabel(value));
1103
+ }
1104
+ function NormalizeHostname(value) {
1105
+ return value.replace(/[\uff01-\uff5e]/g, (char) => String.fromCharCode(char.charCodeAt(0) - 65248)).normalize("NFC").replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu, "").replace(/[\u002E\u3002\uFF0E\uFF61]/g, ".");
1106
+ }
1107
+ function IsIdnHostname(value) {
1108
+ if (value.length === 0 || value.includes(" "))
1109
+ return false;
1110
+ const normalized = NormalizeHostname(value);
1111
+ if (normalized.length > 253)
1112
+ return false;
1113
+ const labels = normalized.split(".");
1114
+ const hasBidiChars = labels.some((label) => HasBidiChars(label));
1115
+ return labels.every((label) => IsLabel2(label) && (!hasBidiChars || SatisfiesBidiRule(label)));
1116
+ }
1117
+
1118
+ // node_modules/typebox/build/format/hostname.mjs
1119
+ function IsHostname2(value) {
1120
+ return IsHostname(value);
1121
+ }
1122
+
1123
+ // node_modules/typebox/build/format/idn_email.mjs
1124
+ var IdnEmail = /^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;
1125
+ function IsIdnEmail(value) {
1126
+ return IdnEmail.test(value.normalize("NFC"));
1127
+ }
1128
+
1129
+ // node_modules/typebox/build/format/idn_hostname.mjs
1130
+ function IsIdnHostname2(value) {
1131
+ return IsIdnHostname(value);
1132
+ }
1133
+
1134
+ // node_modules/typebox/build/format/ipv4.mjs
1135
+ var IPv4 = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
1136
+ function IsIPv4(value) {
1137
+ return IPv4.test(value);
1138
+ }
1139
+
1140
+ // node_modules/typebox/build/format/ipv6.mjs
1141
+ var IPv6 = /^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;
1142
+ function IsIPv6(value) {
1143
+ return IPv6.test(value);
1144
+ }
1145
+
1146
+ // node_modules/typebox/build/format/iri_reference.mjs
1147
+ var InvalidIriChars = /[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/;
1148
+ var MalformedScheme = /^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;
1149
+ function IsIriReference(value) {
1150
+ return !InvalidIriChars.test(value) && !MalformedScheme.test(value) && URL.canParse(value, "http://example.com");
1151
+ }
1152
+
1153
+ // node_modules/typebox/build/format/iri.mjs
1154
+ var IpvFutureMatchMaxLength = 2048;
1155
+ var IpvFutureMatch = /\[[vV][0-9a-fA-F]+\.[^\]]+\]/;
1156
+ var InvalidIriChars2 = /[\x00-\x20<>\^`{|}\\]/;
1157
+ function NarrowIpvFuture(value) {
1158
+ return value.length < IpvFutureMatchMaxLength ? value.replace(IpvFutureMatch, "[::1]") : value;
1159
+ }
1160
+ function IsIri(value) {
1161
+ if (InvalidIriChars2.test(value))
1162
+ return false;
1163
+ return URL.canParse(NarrowIpvFuture(value));
1164
+ }
1165
+
1166
+ // node_modules/typebox/build/format/json_pointer_uri_fragment.mjs
1167
+ var JsonPointerUriFragment = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
1168
+ function IsJsonPointerUriFragment(value) {
1169
+ return JsonPointerUriFragment.test(value);
1170
+ }
1171
+
1172
+ // node_modules/typebox/build/format/json_pointer.mjs
1173
+ var JsonPointer = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
1174
+ function IsJsonPointer(value) {
1175
+ return JsonPointer.test(value);
1176
+ }
1177
+
1178
+ // node_modules/typebox/build/format/regex.mjs
1179
+ function IsRegex(value) {
1180
+ try {
1181
+ new RegExp(value, "u");
1182
+ return true;
1183
+ } catch {
1184
+ return false;
1185
+ }
1186
+ }
1187
+
1188
+ // node_modules/typebox/build/format/relative_json_pointer.mjs
1189
+ var RelativeJsonPointer = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
1190
+ function IsRelativeJsonPointer(value) {
1191
+ return RelativeJsonPointer.test(value);
1192
+ }
1193
+
1194
+ // node_modules/typebox/build/format/uri_reference.mjs
1195
+ var UriReference = /^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
1196
+ function IsUriReference(value) {
1197
+ return UriReference.test(value);
1198
+ }
1199
+
1200
+ // node_modules/typebox/build/format/uri_template.mjs
1201
+ var UriTemplate = /^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;
1202
+ function IsUriTemplate(value) {
1203
+ return UriTemplate.test(value);
1204
+ }
1205
+
1206
+ // node_modules/typebox/build/format/uri.mjs
1207
+ var Uri = /^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
1208
+ function IsUri(value) {
1209
+ return Uri.test(value);
1210
+ }
1211
+
1212
+ // node_modules/typebox/build/format/url.mjs
1213
+ function IsUrl(value) {
1214
+ return URL.canParse(value);
1215
+ }
1216
+
1217
+ // node_modules/typebox/build/format/uuid.mjs
1218
+ var Uuid = /^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
1219
+ function IsUuid(value) {
1220
+ return Uuid.test(value);
1221
+ }
1222
+
1223
+ // node_modules/typebox/build/format/_registry.mjs
1224
+ var formats = /* @__PURE__ */ new Map();
1225
+ function Clear() {
1226
+ formats.clear();
1227
+ }
1228
+ function Entries() {
1229
+ return [...formats.entries()];
1230
+ }
1231
+ function Set2(format, check) {
1232
+ formats.set(format, check);
1233
+ }
1234
+ function Has(format) {
1235
+ return formats.has(format);
1236
+ }
1237
+ function Get2(format) {
1238
+ return formats.get(format);
1239
+ }
1240
+ function Test(format, value) {
1241
+ return formats.get(format)?.(value) ?? true;
1242
+ }
1243
+ function Reset() {
1244
+ Clear();
1245
+ formats.set("date-time", IsDateTime);
1246
+ formats.set("date", IsDate);
1247
+ formats.set("duration", IsDuration);
1248
+ formats.set("email", IsEmail);
1249
+ formats.set("hostname", IsHostname2);
1250
+ formats.set("idn-email", IsIdnEmail);
1251
+ formats.set("idn-hostname", IsIdnHostname2);
1252
+ formats.set("ipv4", IsIPv4);
1253
+ formats.set("ipv6", IsIPv6);
1254
+ formats.set("iri-reference", IsIriReference);
1255
+ formats.set("iri", IsIri);
1256
+ formats.set("json-pointer-uri-fragment", IsJsonPointerUriFragment);
1257
+ formats.set("json-pointer", IsJsonPointer);
1258
+ formats.set("regex", IsRegex);
1259
+ formats.set("relative-json-pointer", IsRelativeJsonPointer);
1260
+ formats.set("time", IsTime);
1261
+ formats.set("uri-reference", IsUriReference);
1262
+ formats.set("uri-template", IsUriTemplate);
1263
+ formats.set("uri", IsUri);
1264
+ formats.set("url", IsUrl);
1265
+ formats.set("uuid", IsUuid);
1266
+ }
1267
+ Reset();
1268
+
1269
+ // node_modules/typebox/build/schema/engine/format.mjs
1270
+ function CheckFormat(_stack, _context, schema, value) {
1271
+ return format_exports.Test(schema.format, value);
1272
+ }
1273
+ function ErrorFormat(stack, context, schemaPath, instancePath, schema, value) {
1274
+ return CheckFormat(stack, context, schema, value) || context.AddError({
1275
+ keyword: "format",
1276
+ schemaPath,
1277
+ instancePath,
1278
+ params: { format: schema.format }
1279
+ });
1280
+ }
1281
+
1282
+ // node_modules/typebox/build/schema/engine/if.mjs
1283
+ function CheckIf(stack, context, schema, value) {
1284
+ const thenSchema = IsThen(schema) ? schema.then : true;
1285
+ const elseSchema = IsElse(schema) ? schema.else : true;
1286
+ return CheckSchema(stack, context, schema.if, value) ? CheckSchema(stack, context, thenSchema, value) : CheckSchema(stack, context, elseSchema, value);
1287
+ }
1288
+ function ErrorIf(stack, context, schemaPath, instancePath, schema, value) {
1289
+ const thenSchema = IsThen(schema) ? schema.then : true;
1290
+ const elseSchema = IsElse(schema) ? schema.else : true;
1291
+ const trueContext = new ErrorContext();
1292
+ const isIf = ErrorSchema(stack, trueContext, `${schemaPath}/if`, instancePath, schema.if, value) ? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) || context.AddError({
1293
+ keyword: "if",
1294
+ schemaPath,
1295
+ instancePath,
1296
+ params: { failingKeyword: "then" }
1297
+ }) : ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) || context.AddError({
1298
+ keyword: "if",
1299
+ schemaPath,
1300
+ instancePath,
1301
+ params: { failingKeyword: "else" }
1302
+ });
1303
+ if (isIf)
1304
+ context.Merge([trueContext]);
1305
+ return isIf;
1306
+ }
1307
+
1308
+ // node_modules/typebox/build/schema/engine/items.mjs
1309
+ function CheckItemsSized(stack, context, schema, value) {
1310
+ return guard_exports.Every(schema.items, 0, (schema2, index) => {
1311
+ return guard_exports.IsLessEqualThan(value.length, index) || CheckSchemaPushStack(stack, context, schema2, value[index]) && context.AddIndex(index);
1312
+ });
1313
+ }
1314
+ function ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value) {
1315
+ return guard_exports.EveryAll(schema.items, 0, (schema2, index) => {
1316
+ const nextSchemaPath = `${schemaPath}/items/${index}`;
1317
+ const nextInstancePath = `${instancePath}/${index}`;
1318
+ return guard_exports.IsLessEqualThan(value.length, index) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value[index]) && context.AddIndex(index);
1319
+ });
1320
+ }
1321
+ function CheckItemsUnsized(stack, context, schema, value) {
1322
+ const offset = IsPrefixItems(schema) ? schema.prefixItems.length : 0;
1323
+ return guard_exports.Every(value, offset, (element, index) => {
1324
+ return CheckSchemaPushStack(stack, context, schema.items, element) && context.AddIndex(index);
1325
+ });
1326
+ }
1327
+ function ErrorItemsUnsized(stack, context, schemaPath, instancePath, schema, value) {
1328
+ const offset = IsPrefixItems(schema) ? schema.prefixItems.length : 0;
1329
+ return guard_exports.EveryAll(value, offset, (element, index) => {
1330
+ const nextSchemaPath = `${schemaPath}/items`;
1331
+ const nextInstancePath = `${instancePath}/${index}`;
1332
+ return ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.items, element) && context.AddIndex(index);
1333
+ });
1334
+ }
1335
+ function CheckItems(stack, context, schema, value) {
1336
+ return IsItemsSized(schema) ? CheckItemsSized(stack, context, schema, value) : CheckItemsUnsized(stack, context, schema, value);
1337
+ }
1338
+ function ErrorItems(stack, context, schemaPath, instancePath, schema, value) {
1339
+ return IsItemsSized(schema) ? ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value) : ErrorItemsUnsized(stack, context, schemaPath, instancePath, schema, value);
1340
+ }
1341
+
1342
+ // node_modules/typebox/build/schema/engine/maxContains.mjs
1343
+ function IsValid3(schema) {
1344
+ return IsContains(schema);
1345
+ }
1346
+ function CheckMaxContains(stack, context, schema, value) {
1347
+ if (!IsValid3(schema))
1348
+ return true;
1349
+ const count = guard_exports.Counted(value, (item) => CheckSchema(stack, context, schema.contains, item));
1350
+ return guard_exports.IsLessEqualThan(count, schema.maxContains);
1351
+ }
1352
+ function ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value) {
1353
+ const minContains = IsMinContains(schema) ? schema.minContains : 1;
1354
+ return CheckMaxContains(stack, context, schema, value) || context.AddError({
1355
+ keyword: "contains",
1356
+ schemaPath,
1357
+ instancePath,
1358
+ params: { minContains, maxContains: schema.maxContains }
1359
+ });
1360
+ }
1361
+
1362
+ // node_modules/typebox/build/schema/engine/maximum.mjs
1363
+ function CheckMaximum(_stack, _context, schema, value) {
1364
+ return guard_exports.IsLessEqualThan(value, schema.maximum);
1365
+ }
1366
+ function ErrorMaximum(stack, context, schemaPath, instancePath, schema, value) {
1367
+ return CheckMaximum(stack, context, schema, value) || context.AddError({
1368
+ keyword: "maximum",
1369
+ schemaPath,
1370
+ instancePath,
1371
+ params: { comparison: "<=", limit: schema.maximum }
1372
+ });
1373
+ }
1374
+
1375
+ // node_modules/typebox/build/schema/engine/maxItems.mjs
1376
+ function CheckMaxItems(_stack, _context, schema, value) {
1377
+ return guard_exports.IsLessEqualThan(value.length, schema.maxItems);
1378
+ }
1379
+ function ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value) {
1380
+ return CheckMaxItems(stack, context, schema, value) || context.AddError({
1381
+ keyword: "maxItems",
1382
+ schemaPath,
1383
+ instancePath,
1384
+ params: { limit: schema.maxItems }
1385
+ });
1386
+ }
1387
+
1388
+ // node_modules/typebox/build/schema/engine/maxLength.mjs
1389
+ function CheckMaxLength(_stack, _context, schema, value) {
1390
+ return guard_exports.IsMaxLength(value, schema.maxLength);
1391
+ }
1392
+ function ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value) {
1393
+ return CheckMaxLength(stack, context, schema, value) || context.AddError({
1394
+ keyword: "maxLength",
1395
+ schemaPath,
1396
+ instancePath,
1397
+ params: { limit: schema.maxLength }
1398
+ });
1399
+ }
1400
+
1401
+ // node_modules/typebox/build/schema/engine/maxProperties.mjs
1402
+ function CheckMaxProperties(_stack, _context, schema, value) {
1403
+ return guard_exports.IsLessEqualThan(guard_exports.Keys(value).length, schema.maxProperties);
1404
+ }
1405
+ function ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value) {
1406
+ return CheckMaxProperties(stack, context, schema, value) || context.AddError({
1407
+ keyword: "maxProperties",
1408
+ schemaPath,
1409
+ instancePath,
1410
+ params: { limit: schema.maxProperties }
1411
+ });
1412
+ }
1413
+
1414
+ // node_modules/typebox/build/schema/engine/minContains.mjs
1415
+ function IsValid4(schema) {
1416
+ return IsContains(schema);
1417
+ }
1418
+ function CheckMinContains(stack, context, schema, value) {
1419
+ if (!IsValid4(schema))
1420
+ return true;
1421
+ const count = guard_exports.Counted(value, (item, index) => CheckSchema(stack, context, schema.contains, item) && context.AddIndex(index));
1422
+ return guard_exports.IsGreaterEqualThan(count, schema.minContains);
1423
+ }
1424
+ function ErrorMinContains(stack, context, schemaPath, instancePath, schema, value) {
1425
+ return CheckMinContains(stack, context, schema, value) || context.AddError({
1426
+ keyword: "contains",
1427
+ schemaPath,
1428
+ instancePath,
1429
+ params: { minContains: schema.minContains }
1430
+ });
1431
+ }
1432
+
1433
+ // node_modules/typebox/build/schema/engine/minimum.mjs
1434
+ function CheckMinimum(_stack, _context, schema, value) {
1435
+ return guard_exports.IsGreaterEqualThan(value, schema.minimum);
1436
+ }
1437
+ function ErrorMinimum(stack, context, schemaPath, instancePath, schema, value) {
1438
+ return CheckMinimum(stack, context, schema, value) || context.AddError({
1439
+ keyword: "minimum",
1440
+ schemaPath,
1441
+ instancePath,
1442
+ params: { comparison: ">=", limit: schema.minimum }
1443
+ });
1444
+ }
1445
+
1446
+ // node_modules/typebox/build/schema/engine/minItems.mjs
1447
+ function CheckMinItems(_stack, _context, schema, value) {
1448
+ return guard_exports.IsGreaterEqualThan(value.length, schema.minItems);
1449
+ }
1450
+ function ErrorMinItems(stack, context, schemaPath, instancePath, schema, value) {
1451
+ return CheckMinItems(stack, context, schema, value) || context.AddError({
1452
+ keyword: "minItems",
1453
+ schemaPath,
1454
+ instancePath,
1455
+ params: { limit: schema.minItems }
1456
+ });
1457
+ }
1458
+
1459
+ // node_modules/typebox/build/schema/engine/minLength.mjs
1460
+ function CheckMinLength(_stack, _context, schema, value) {
1461
+ return guard_exports.IsMinLength(value, schema.minLength);
1462
+ }
1463
+ function ErrorMinLength(stack, context, schemaPath, instancePath, schema, value) {
1464
+ return CheckMinLength(stack, context, schema, value) || context.AddError({
1465
+ keyword: "minLength",
1466
+ schemaPath,
1467
+ instancePath,
1468
+ params: { limit: schema.minLength }
1469
+ });
1470
+ }
1471
+
1472
+ // node_modules/typebox/build/schema/engine/minProperties.mjs
1473
+ function CheckMinProperties(_stack, _context, schema, value) {
1474
+ return guard_exports.IsGreaterEqualThan(guard_exports.Keys(value).length, schema.minProperties);
1475
+ }
1476
+ function ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value) {
1477
+ return CheckMinProperties(stack, context, schema, value) || context.AddError({
1478
+ keyword: "minProperties",
1479
+ schemaPath,
1480
+ instancePath,
1481
+ params: { limit: schema.minProperties }
1482
+ });
1483
+ }
1484
+
1485
+ // node_modules/typebox/build/schema/engine/multipleOf.mjs
1486
+ function CheckMultipleOf(_stack, _context, schema, value) {
1487
+ return guard_exports.IsMultipleOf(value, schema.multipleOf);
1488
+ }
1489
+ function ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value) {
1490
+ return CheckMultipleOf(stack, context, schema, value) || context.AddError({
1491
+ keyword: "multipleOf",
1492
+ schemaPath,
1493
+ instancePath,
1494
+ params: { multipleOf: schema.multipleOf }
1495
+ });
1496
+ }
1497
+
1498
+ // node_modules/typebox/build/schema/engine/not.mjs
1499
+ function CheckNot(stack, context, schema, value) {
1500
+ const nextContext = new CheckContext();
1501
+ const isSchema = !CheckSchema(stack, nextContext, schema.not, value);
1502
+ const isNot = isSchema && context.Merge([nextContext]);
1503
+ return isNot;
1504
+ }
1505
+ function ErrorNot(stack, context, schemaPath, instancePath, schema, value) {
1506
+ return CheckNot(stack, context, schema, value) || context.AddError({
1507
+ keyword: "not",
1508
+ schemaPath,
1509
+ instancePath,
1510
+ params: {}
1511
+ });
1512
+ }
1513
+
1514
+ // node_modules/typebox/build/schema/engine/oneOf.mjs
1515
+ function CheckOneOf(stack, context, schema, value) {
1516
+ const passedContexts = schema.oneOf.reduce((result, schema2) => {
1517
+ const nextContext = new CheckContext();
1518
+ return CheckSchema(stack, nextContext, schema2, value) ? [...result, nextContext] : result;
1519
+ }, []);
1520
+ return guard_exports.IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
1521
+ }
1522
+ function ErrorOneOf(stack, context, schemaPath, instancePath, schema, value) {
1523
+ const failedContexts = [];
1524
+ const passingSchemas = [];
1525
+ const passedContexts = schema.oneOf.reduce((result, schema2, index) => {
1526
+ const nextContext = new ErrorContext();
1527
+ const nextSchemaPath = `${schemaPath}/oneOf/${index}`;
1528
+ const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema2, value);
1529
+ if (isSchema)
1530
+ passingSchemas.push(index);
1531
+ if (!isSchema)
1532
+ failedContexts.push(nextContext);
1533
+ return isSchema ? [...result, nextContext] : result;
1534
+ }, []);
1535
+ const isOneOf = guard_exports.IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
1536
+ if (!isOneOf && guard_exports.IsEqual(passingSchemas.length, 0))
1537
+ failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
1538
+ return isOneOf || context.AddError({
1539
+ keyword: "oneOf",
1540
+ schemaPath,
1541
+ instancePath,
1542
+ params: { passingSchemas }
1543
+ });
1544
+ }
1545
+
1546
+ // node_modules/typebox/build/schema/engine/pattern.mjs
1547
+ function CheckPattern(_stack, _context, schema, value) {
1548
+ const regexp = guard_exports.IsString(schema.pattern) ? UnicodeRegExp(schema.pattern) : schema.pattern;
1549
+ return regexp.test(value);
1550
+ }
1551
+ function ErrorPattern(stack, context, schemaPath, instancePath, schema, value) {
1552
+ return CheckPattern(stack, context, schema, value) || context.AddError({
1553
+ keyword: "pattern",
1554
+ schemaPath,
1555
+ instancePath,
1556
+ params: { pattern: schema.pattern }
1557
+ });
1558
+ }
1559
+
1560
+ // node_modules/typebox/build/schema/engine/patternProperties.mjs
1561
+ function CheckPatternProperties(stack, context, schema, value) {
1562
+ return guard_exports.Every(guard_exports.Entries(schema.patternProperties), 0, ([pattern, schema2]) => {
1563
+ const regexp = UnicodeRegExp(pattern);
1564
+ return guard_exports.Every(guard_exports.Entries(value), 0, ([key, prop]) => {
1565
+ return !regexp.test(key) || CheckSchemaPushStack(stack, context, schema2, prop) && context.AddKey(key);
1566
+ });
1567
+ });
1568
+ }
1569
+ function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value) {
1570
+ return guard_exports.EveryAll(guard_exports.Entries(schema.patternProperties), 0, ([pattern, schema2]) => {
1571
+ const nextSchemaPath = `${schemaPath}/patternProperties/${pattern}`;
1572
+ const regexp = UnicodeRegExp(pattern);
1573
+ return guard_exports.EveryAll(guard_exports.Entries(value), 0, ([key, value2]) => {
1574
+ const nextInstancePath = `${instancePath}/${key}`;
1575
+ const notKey = !regexp.test(key);
1576
+ return notKey || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value2) && context.AddKey(key);
1577
+ });
1578
+ });
1579
+ }
1580
+
1581
+ // node_modules/typebox/build/schema/engine/prefixItems.mjs
1582
+ function CheckPrefixItems(stack, context, schema, value) {
1583
+ return guard_exports.IsEqual(value.length, 0) || guard_exports.Every(schema.prefixItems, 0, (schema2, index) => {
1584
+ return guard_exports.IsLessEqualThan(value.length, index) || CheckSchemaPushStack(stack, context, schema2, value[index]) && context.AddIndex(index);
1585
+ });
1586
+ }
1587
+ function ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, value) {
1588
+ return guard_exports.IsEqual(value.length, 0) || guard_exports.EveryAll(schema.prefixItems, 0, (schema2, index) => {
1589
+ const nextSchemaPath = `${schemaPath}/prefixItems/${index}`;
1590
+ const nextInstancePath = `${instancePath}/${index}`;
1591
+ return guard_exports.IsLessEqualThan(value.length, index) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value[index]) && context.AddIndex(index);
1592
+ });
1593
+ }
1594
+
1595
+ // node_modules/typebox/build/schema/engine/_exact_optional.mjs
1596
+ function IsExactOptional(required, key) {
1597
+ return required.includes(key) || settings_exports.Get().exactOptionalPropertyTypes;
1598
+ }
1599
+ function InexactOptionalCheck(value, key) {
1600
+ return guard_exports.IsUndefined(value[key]);
1601
+ }
1602
+
1603
+ // node_modules/typebox/build/schema/engine/properties.mjs
1604
+ function CheckProperties(stack, context, schema, value) {
1605
+ const required = IsRequired(schema) ? schema.required : [];
1606
+ const isProperties = guard_exports.Every(guard_exports.Entries(schema.properties), 0, ([key, schema2]) => {
1607
+ const isProperty = !guard_exports.HasPropertyKey(value, key) || CheckSchemaPushStack(stack, context, schema2, value[key]) && context.AddKey(key);
1608
+ return IsExactOptional(required, key) ? isProperty : InexactOptionalCheck(value, key) || isProperty;
1609
+ });
1610
+ return isProperties;
1611
+ }
1612
+ function ErrorProperties(stack, context, schemaPath, instancePath, schema, value) {
1613
+ const required = IsRequired(schema) ? schema.required : [];
1614
+ const isProperties = guard_exports.EveryAll(guard_exports.Entries(schema.properties), 0, ([key, schema2]) => {
1615
+ const nextSchemaPath = `${schemaPath}/properties/${key}`;
1616
+ const nextInstancePath = `${instancePath}/${key}`;
1617
+ const isProperty = () => !guard_exports.HasPropertyKey(value, key) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema2, value[key]) && context.AddKey(key);
1618
+ return IsExactOptional(required, key) ? isProperty() : InexactOptionalCheck(value, key) || isProperty();
1619
+ });
1620
+ return isProperties;
1621
+ }
1622
+
1623
+ // node_modules/typebox/build/schema/engine/propertyNames.mjs
1624
+ function CheckPropertyNames(stack, context, schema, value) {
1625
+ return guard_exports.Every(guard_exports.Keys(value), 0, (key, _index) => CheckSchema(stack, context, schema.propertyNames, key));
1626
+ }
1627
+ function ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value) {
1628
+ const propertyNames = [];
1629
+ const isPropertyNames = guard_exports.EveryAll(guard_exports.Keys(value), 0, (key, _index) => {
1630
+ const nextInstancePath = `${instancePath}/${key}`;
1631
+ const nextSchemaPath = `${schemaPath}/propertyNames`;
1632
+ const isPropertyName = ErrorSchema(stack, context, nextSchemaPath, nextInstancePath, schema.propertyNames, key);
1633
+ if (!isPropertyName)
1634
+ propertyNames.push(key);
1635
+ return isPropertyName;
1636
+ });
1637
+ return isPropertyNames || context.AddError({
1638
+ keyword: "propertyNames",
1639
+ schemaPath,
1640
+ instancePath,
1641
+ params: { propertyNames }
1642
+ });
1643
+ }
1644
+
1645
+ // node_modules/typebox/build/schema/engine/recursiveRef.mjs
1646
+ function CheckRecursiveRef(stack, context, schema, value) {
1647
+ const target = stack.RecursiveRef(schema) ?? false;
1648
+ return IsSchema2(target) && CheckSchema(stack, context, target, value);
1649
+ }
1650
+ function ErrorRecursiveRef(stack, context, _schemaPath, instancePath, schema, value) {
1651
+ const target = stack.RecursiveRef(schema) ?? false;
1652
+ return IsSchema2(target) && ErrorSchema(stack, context, "#", instancePath, target, value);
1653
+ }
1654
+
1655
+ // node_modules/typebox/build/schema/engine/ref.mjs
1656
+ function CheckRef(stack, context, schema, value) {
1657
+ const target = stack.Ref(schema) ?? false;
1658
+ const nextContext = new CheckContext();
1659
+ const result = IsSchema2(target) && CheckSchema(stack, nextContext, target, value);
1660
+ if (result)
1661
+ context.Merge([nextContext]);
1662
+ return result;
1663
+ }
1664
+ function ErrorRef(stack, context, _schemaPath, instancePath, schema, value) {
1665
+ const target = stack.Ref(schema) ?? false;
1666
+ const nextContext = new ErrorContext();
1667
+ const result = IsSchema2(target) && ErrorSchema(stack, nextContext, "#", instancePath, target, value);
1668
+ if (result)
1669
+ context.Merge([nextContext]);
1670
+ if (!result)
1671
+ nextContext.GetErrors().forEach((error) => context.AddError(error));
1672
+ return result;
1673
+ }
1674
+
1675
+ // node_modules/typebox/build/schema/engine/required.mjs
1676
+ function CheckRequired(_stack, _context, schema, value) {
1677
+ return guard_exports.Every(schema.required, 0, (key) => guard_exports.HasPropertyKey(value, key));
1678
+ }
1679
+ function ErrorRequired(_stack, context, schemaPath, instancePath, schema, value) {
1680
+ const requiredProperties = [];
1681
+ const isRequired = guard_exports.EveryAll(schema.required, 0, (key) => {
1682
+ const hasKey = guard_exports.HasPropertyKey(value, key);
1683
+ if (!hasKey)
1684
+ requiredProperties.push(key);
1685
+ return hasKey;
1686
+ });
1687
+ return isRequired || context.AddError({
1688
+ keyword: "required",
1689
+ schemaPath,
1690
+ instancePath,
1691
+ params: { requiredProperties }
1692
+ });
1693
+ }
1694
+
1695
+ // node_modules/typebox/build/schema/engine/type.mjs
1696
+ function CheckTypeName(_stack, _context, type, _schema, value) {
1697
+ return (
1698
+ // jsonschema
1699
+ guard_exports.IsEqual(type, "object") ? guard_exports.IsObjectNotArray(value) : guard_exports.IsEqual(type, "array") ? guard_exports.IsArray(value) : guard_exports.IsEqual(type, "boolean") ? guard_exports.IsBoolean(value) : guard_exports.IsEqual(type, "integer") ? guard_exports.IsInteger(value) : guard_exports.IsEqual(type, "number") ? guard_exports.IsNumber(value) : guard_exports.IsEqual(type, "null") ? guard_exports.IsNull(value) : guard_exports.IsEqual(type, "string") ? guard_exports.IsString(value) : (
1700
+ // xschema
1701
+ guard_exports.IsEqual(type, "bigint") ? guard_exports.IsBigInt(value) : guard_exports.IsEqual(type, "constructor") ? guard_exports.IsConstructor(value) : guard_exports.IsEqual(type, "function") ? guard_exports.IsFunction(value) : guard_exports.IsEqual(type, "symbol") ? guard_exports.IsSymbol(value) : guard_exports.IsEqual(type, "undefined") ? guard_exports.IsUndefined(value) : guard_exports.IsEqual(type, "void") ? guard_exports.IsUndefined(value) : true
1702
+ )
1703
+ );
1704
+ }
1705
+ function CheckTypeNames(stack, context, types, schema, value) {
1706
+ return guard_exports.Some(types, (type) => CheckTypeName(stack, context, type, schema, value));
1707
+ }
1708
+ function CheckType(stack, context, schema, value) {
1709
+ return guard_exports.IsArray(schema.type) ? CheckTypeNames(stack, context, schema.type, schema, value) : CheckTypeName(stack, context, schema.type, schema, value);
1710
+ }
1711
+ function ErrorType(stack, context, schemaPath, instancePath, schema, value) {
1712
+ const isType = guard_exports.IsArray(schema.type) ? CheckTypeNames(stack, context, schema.type, schema, value) : CheckTypeName(stack, context, schema.type, schema, value);
1713
+ return isType || context.AddError({
1714
+ keyword: "type",
1715
+ schemaPath,
1716
+ instancePath,
1717
+ params: { type: schema.type }
1718
+ });
1719
+ }
1720
+
1721
+ // node_modules/typebox/build/schema/engine/unevaluatedItems.mjs
1722
+ function CheckUnevaluatedItems(stack, context, schema, value) {
1723
+ const indices = context.GetIndices();
1724
+ return guard_exports.Every(value, 0, (item, index) => {
1725
+ return (indices.has(index) || CheckSchema(stack, context, schema.unevaluatedItems, item)) && context.AddIndex(index);
1726
+ });
1727
+ }
1728
+ function ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema, value) {
1729
+ const indices = context.GetIndices();
1730
+ const unevaluatedItems = [];
1731
+ const isUnevaluatedItems = guard_exports.EveryAll(value, 0, (item, index) => {
1732
+ const nextContext = new ErrorContext();
1733
+ const isEvaluatedItem = (indices.has(index) || ErrorSchema(stack, nextContext, schemaPath, instancePath, schema.unevaluatedItems, item)) && context.AddIndex(index);
1734
+ if (!isEvaluatedItem)
1735
+ unevaluatedItems.push(index);
1736
+ return isEvaluatedItem;
1737
+ });
1738
+ return isUnevaluatedItems || context.AddError({
1739
+ keyword: "unevaluatedItems",
1740
+ schemaPath,
1741
+ instancePath,
1742
+ params: { unevaluatedItems }
1743
+ });
1744
+ }
1745
+
1746
+ // node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs
1747
+ function CheckUnevaluatedProperties(stack, context, schema, value) {
1748
+ const keys = context.GetKeys();
1749
+ return guard_exports.Every(guard_exports.Entries(value), 0, ([key, prop]) => {
1750
+ return keys.has(key) || CheckSchema(stack, context, schema.unevaluatedProperties, prop) && context.AddKey(key);
1751
+ });
1752
+ }
1753
+ function ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value) {
1754
+ const keys = context.GetKeys();
1755
+ const unevaluatedProperties = [];
1756
+ const isUnevaluatedProperties = guard_exports.EveryAll(guard_exports.Entries(value), 0, ([key, prop]) => {
1757
+ const nextContext = new ErrorContext();
1758
+ const isEvaluatedProperty = keys.has(key) || ErrorSchema(stack, nextContext, schemaPath, instancePath, schema.unevaluatedProperties, prop) && context.AddKey(key);
1759
+ if (!isEvaluatedProperty)
1760
+ unevaluatedProperties.push(key);
1761
+ return isEvaluatedProperty;
1762
+ });
1763
+ return isUnevaluatedProperties || context.AddError({
1764
+ keyword: "unevaluatedProperties",
1765
+ schemaPath,
1766
+ instancePath,
1767
+ params: { unevaluatedProperties }
1768
+ });
1769
+ }
1770
+
1771
+ // node_modules/typebox/build/schema/engine/uniqueItems.mjs
1772
+ function IsValid5(schema) {
1773
+ return !guard_exports.IsEqual(schema.uniqueItems, false);
1774
+ }
1775
+ function CheckUniqueItems(_stack, _context, schema, value) {
1776
+ if (!IsValid5(schema))
1777
+ return true;
1778
+ const set = new Set(value.map(hash_exports.Hash)).size;
1779
+ const isLength = value.length;
1780
+ return guard_exports.IsEqual(set, isLength);
1781
+ }
1782
+ function ErrorUniqueItems(_stack, context, schemaPath, instancePath, schema, value) {
1783
+ if (!IsValid5(schema))
1784
+ return true;
1785
+ const set = /* @__PURE__ */ new Set();
1786
+ const duplicateItems = value.reduce((result, value2, index) => {
1787
+ const hash = hash_exports.Hash(value2);
1788
+ if (set.has(hash))
1789
+ return [...result, index];
1790
+ set.add(hash);
1791
+ return result;
1792
+ }, []);
1793
+ const isUniqueItems = guard_exports.IsEqual(duplicateItems.length, 0);
1794
+ return isUniqueItems || context.AddError({
1795
+ keyword: "uniqueItems",
1796
+ schemaPath,
1797
+ instancePath,
1798
+ params: { duplicateItems }
1799
+ });
1800
+ }
1801
+
1802
+ // node_modules/typebox/build/schema/engine/schema.mjs
1803
+ function CheckSchemaPushStack(stack, context, schema, value) {
1804
+ return context.Push() && CheckSchema(stack, context, schema, value) && context.Pop();
1805
+ }
1806
+ function CheckSchema(stack, context, schema, value) {
1807
+ stack.Push(schema);
1808
+ const result = IsSchemaBoolean(schema) ? CheckSchemaBoolean(stack, context, schema, value) : (!IsType(schema) || CheckType(stack, context, schema, value)) && (!(guard_exports.IsObject(value) && !guard_exports.IsArray(value)) || (!IsRequired(schema) || CheckRequired(stack, context, schema, value)) && (!IsAdditionalProperties(schema) || CheckAdditionalProperties(stack, context, schema, value)) && (!IsDependencies(schema) || CheckDependencies(stack, context, schema, value)) && (!IsDependentRequired(schema) || CheckDependentRequired(stack, context, schema, value)) && (!IsDependentSchemas(schema) || CheckDependentSchemas(stack, context, schema, value)) && (!IsPatternProperties(schema) || CheckPatternProperties(stack, context, schema, value)) && (!IsProperties(schema) || CheckProperties(stack, context, schema, value)) && (!IsPropertyNames(schema) || CheckPropertyNames(stack, context, schema, value)) && (!IsMinProperties(schema) || CheckMinProperties(stack, context, schema, value)) && (!IsMaxProperties(schema) || CheckMaxProperties(stack, context, schema, value))) && (!guard_exports.IsArray(value) || (!IsAdditionalItems(schema) || CheckAdditionalItems(stack, context, schema, value)) && (!IsContains(schema) || CheckContains(stack, context, schema, value)) && (!IsItems(schema) || CheckItems(stack, context, schema, value)) && (!IsMaxContains(schema) || CheckMaxContains(stack, context, schema, value)) && (!IsMaxItems(schema) || CheckMaxItems(stack, context, schema, value)) && (!IsMinContains(schema) || CheckMinContains(stack, context, schema, value)) && (!IsMinItems(schema) || CheckMinItems(stack, context, schema, value)) && (!IsPrefixItems(schema) || CheckPrefixItems(stack, context, schema, value)) && (!IsUniqueItems(schema) || CheckUniqueItems(stack, context, schema, value))) && (!guard_exports.IsString(value) || (!IsMaxLength(schema) || CheckMaxLength(stack, context, schema, value)) && (!IsMinLength(schema) || CheckMinLength(stack, context, schema, value)) && (!IsFormat(schema) || CheckFormat(stack, context, schema, value)) && (!IsPattern(schema) || CheckPattern(stack, context, schema, value))) && (!(guard_exports.IsNumber(value) || guard_exports.IsBigInt(value)) || (!IsExclusiveMaximum(schema) || CheckExclusiveMaximum(stack, context, schema, value)) && (!IsExclusiveMinimum(schema) || CheckExclusiveMinimum(stack, context, schema, value)) && (!IsMaximum(schema) || CheckMaximum(stack, context, schema, value)) && (!IsMinimum(schema) || CheckMinimum(stack, context, schema, value)) && (!IsMultipleOf(schema) || CheckMultipleOf(stack, context, schema, value))) && (!IsRef2(schema) || CheckRef(stack, context, schema, value)) && (!IsRecursiveRef(schema) || CheckRecursiveRef(stack, context, schema, value)) && (!IsDynamicRef(schema) || CheckDynamicRef(stack, context, schema, value)) && (!IsConst(schema) || CheckConst(stack, context, schema, value)) && (!IsEnum2(schema) || CheckEnum(stack, context, schema, value)) && (!IsIf(schema) || CheckIf(stack, context, schema, value)) && (!IsNot(schema) || CheckNot(stack, context, schema, value)) && (!IsAllOf(schema) || CheckAllOf(stack, context, schema, value)) && (!IsAnyOf(schema) || CheckAnyOf(stack, context, schema, value)) && (!IsOneOf(schema) || CheckOneOf(stack, context, schema, value)) && (!IsUnevaluatedItems(schema) || (!guard_exports.IsArray(value) || CheckUnevaluatedItems(stack, context, schema, value))) && (!IsUnevaluatedProperties(schema) || (!guard_exports.IsObject(value) || CheckUnevaluatedProperties(stack, context, schema, value))) && (!IsRefine2(schema) || CheckRefine(stack, context, schema, value));
1809
+ stack.Pop(schema);
1810
+ return result;
1811
+ }
1812
+ function ErrorSchemaPushStack(stack, context, schemaPath, instancePath, schema, value) {
1813
+ return context.Push() && ErrorSchema(stack, context, schemaPath, instancePath, schema, value) && context.Pop();
1814
+ }
1815
+ function ErrorSchema(stack, context, schemaPath, instancePath, schema, value) {
1816
+ if (context.AtCapacity())
1817
+ return false;
1818
+ stack.Push(schema);
1819
+ const result = IsSchemaBoolean(schema) ? ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) : !!(+(!IsType(schema) || ErrorType(stack, context, schemaPath, instancePath, schema, value)) & +(!(guard_exports.IsObject(value) && !guard_exports.IsArray(value)) || !!(+(!IsRequired(schema) || ErrorRequired(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAdditionalProperties(schema) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependencies(schema) || ErrorDependencies(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependentRequired(schema) || ErrorDependentRequired(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependentSchemas(schema) || ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPatternProperties(schema) || ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsProperties(schema) || ErrorProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPropertyNames(schema) || ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinProperties(schema) || ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxProperties(schema) || ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value)))) & +(!guard_exports.IsArray(value) || !!(+(!IsAdditionalItems(schema) || ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsContains(schema) || ErrorContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsItems(schema) || ErrorItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxContains(schema) || ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxItems(schema) || ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinContains(schema) || ErrorMinContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinItems(schema) || ErrorMinItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPrefixItems(schema) || ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsUniqueItems(schema) || ErrorUniqueItems(stack, context, schemaPath, instancePath, schema, value)))) & +(!guard_exports.IsString(value) || !!(+(!IsMaxLength(schema) || ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinLength(schema) || ErrorMinLength(stack, context, schemaPath, instancePath, schema, value)) & +(!IsFormat(schema) || ErrorFormat(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPattern(schema) || ErrorPattern(stack, context, schemaPath, instancePath, schema, value)))) & +(!(guard_exports.IsNumber(value) || guard_exports.IsBigInt(value)) || !!(+(!IsExclusiveMaximum(schema) || ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsExclusiveMinimum(schema) || ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaximum(schema) || ErrorMaximum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinimum(schema) || ErrorMinimum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMultipleOf(schema) || ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value)))) & +(!IsRef2(schema) || ErrorRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsRecursiveRef(schema) || ErrorRecursiveRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDynamicRef(schema) || ErrorDynamicRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsConst(schema) || ErrorConst(stack, context, schemaPath, instancePath, schema, value)) & +(!IsEnum2(schema) || ErrorEnum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsIf(schema) || ErrorIf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsNot(schema) || ErrorNot(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAllOf(schema) || ErrorAllOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAnyOf(schema) || ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsOneOf(schema) || ErrorOneOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsUnevaluatedItems(schema) || (!guard_exports.IsArray(value) || ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema, value))) & +(!IsUnevaluatedProperties(schema) || (!guard_exports.IsObject(value) || ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value)))) && (!IsRefine2(schema) || ErrorRefine(stack, context, schemaPath, instancePath, schema, value));
1820
+ stack.Pop(schema);
1821
+ return result;
1822
+ }
1823
+
1824
+ // node_modules/typebox/build/schema/resolve/resolve.mjs
1825
+ var resolve_exports = {};
1826
+ __export(resolve_exports, {
1827
+ DefaultBase: () => DefaultBase,
1828
+ DynamicRef: () => DynamicRef,
1829
+ Ref: () => Ref2
1830
+ });
1831
+
1832
+ // node_modules/typebox/build/schema/pointer/pointer.mjs
1833
+ var pointer_exports = {};
1834
+ __export(pointer_exports, {
1835
+ Delete: () => Delete,
1836
+ Get: () => Get3,
1837
+ Has: () => Has2,
1838
+ Indices: () => Indices,
1839
+ Set: () => Set3
1840
+ });
1841
+ function AssertNotRoot(indices) {
1842
+ if (indices.length === 0)
1843
+ throw Error("Cannot set root");
1844
+ }
1845
+ function AssertCanSet(value) {
1846
+ if (!guard_exports.IsObject(value))
1847
+ throw Error("Cannot set value");
1848
+ }
1849
+ function AssertIndex(index) {
1850
+ if (guard_exports.IsUnsafePropertyKey(index))
1851
+ throw Error("Pointer contains unsafe property key");
1852
+ }
1853
+ function AssertIndices(indices) {
1854
+ for (const index of indices)
1855
+ AssertIndex(index);
1856
+ }
1857
+ function IsNumericIndex(index) {
1858
+ return /^(0|[1-9]\d*)$/.test(index);
1859
+ }
1860
+ function TakeIndexRight(indices) {
1861
+ return [
1862
+ indices.slice(0, indices.length - 1),
1863
+ indices.slice(indices.length - 1)[0]
1864
+ ];
1865
+ }
1866
+ function HasIndex(index, value) {
1867
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, index);
1868
+ }
1869
+ function GetIndex(index, value) {
1870
+ return guard_exports.IsObject(value) && !guard_exports.IsUnsafePropertyKey(index) ? value[index] : void 0;
1871
+ }
1872
+ function GetIndices(indices, value) {
1873
+ return indices.reduce((value2, index) => GetIndex(index, value2), value);
1874
+ }
1875
+ function Indices(pointer) {
1876
+ if (guard_exports.IsEqual(pointer.length, 0))
1877
+ return [];
1878
+ const indices = pointer.split("/").map((index) => index.replace(/~1/g, "/").replace(/~0/g, "~"));
1879
+ return indices.length > 0 && indices[0] === "" ? indices.slice(1) : indices;
1880
+ }
1881
+ function Has2(value, pointer) {
1882
+ let current = value;
1883
+ return Indices(pointer).every((index) => {
1884
+ if (!HasIndex(index, current))
1885
+ return false;
1886
+ current = current[index];
1887
+ return true;
1888
+ });
1889
+ }
1890
+ function Get3(value, pointer) {
1891
+ const indices = Indices(pointer);
1892
+ return GetIndices(indices, value);
1893
+ }
1894
+ function Set3(value, pointer, next) {
1895
+ const indices = Indices(pointer);
1896
+ AssertNotRoot(indices);
1897
+ AssertIndices(indices);
1898
+ const [head, index] = TakeIndexRight(indices);
1899
+ const parent = GetIndices(head, value);
1900
+ AssertCanSet(parent);
1901
+ parent[index] = next;
1902
+ return value;
1903
+ }
1904
+ function Delete(value, pointer) {
1905
+ const indices = Indices(pointer);
1906
+ AssertNotRoot(indices);
1907
+ AssertIndices(indices);
1908
+ const [head, index] = TakeIndexRight(indices);
1909
+ const parent = GetIndices(head, value);
1910
+ AssertCanSet(parent);
1911
+ if (guard_exports.IsArray(parent) && IsNumericIndex(index)) {
1912
+ parent.splice(+index, 1);
1913
+ } else {
1914
+ delete parent[index];
1915
+ }
1916
+ return value;
1917
+ }
1918
+
1919
+ // node_modules/typebox/build/schema/resolve/resolve.mjs
1920
+ var DefaultBase = new URL("https://json-schema.org");
1921
+ function MatchId(schema, base, ref) {
1922
+ if (schema.$id === ref.hash)
1923
+ return schema;
1924
+ const absoluteId = new URL(schema.$id, base.href);
1925
+ const absoluteRef = new URL(ref.href, base.href);
1926
+ if (guard_exports.IsEqual(absoluteId.pathname, absoluteRef.pathname)) {
1927
+ return ref.hash.startsWith("#") ? MatchHash(schema, base, ref) : schema;
1928
+ }
1929
+ return void 0;
1930
+ }
1931
+ function MatchAnchor(schema, base, ref) {
1932
+ const absoluteAnchor = new URL(`#${schema.$anchor}`, base.href);
1933
+ const absoluteRef = new URL(ref.href, base.href);
1934
+ return guard_exports.IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : void 0;
1935
+ }
1936
+ function MatchDynamicAnchor(schema, base, ref) {
1937
+ const absoluteAnchor = new URL(`#${schema.$dynamicAnchor}`, base.href);
1938
+ const absoluteRef = new URL(ref.href, base.href);
1939
+ return guard_exports.IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : void 0;
1940
+ }
1941
+ function MatchHash(schema, _base, ref) {
1942
+ if (ref.href.endsWith("#"))
1943
+ return schema;
1944
+ if (!ref.hash.startsWith("#"))
1945
+ return void 0;
1946
+ const fragment = decodeURIComponent(ref.hash.slice(1));
1947
+ if (!fragment.startsWith("/"))
1948
+ return void 0;
1949
+ return pointer_exports.Get(schema, fragment);
1950
+ }
1951
+ function Match(schema, base, ref) {
1952
+ if (IsId(schema)) {
1953
+ const result = MatchId(schema, base, ref);
1954
+ if (!guard_exports.IsUndefined(result))
1955
+ return result;
1956
+ }
1957
+ if (IsAnchor(schema)) {
1958
+ const result = MatchAnchor(schema, base, ref);
1959
+ if (!guard_exports.IsUndefined(result))
1960
+ return result;
1961
+ }
1962
+ if (IsDynamicAnchor(schema)) {
1963
+ const result = MatchDynamicAnchor(schema, base, ref);
1964
+ if (!guard_exports.IsUndefined(result))
1965
+ return result;
1966
+ }
1967
+ return MatchHash(schema, base, ref);
1968
+ }
1969
+ function FromArray(schema, base, ref) {
1970
+ return schema.reduce((result, item) => {
1971
+ const match = FromValue(item, base, ref);
1972
+ return !guard_exports.IsUndefined(match) ? match : result;
1973
+ }, void 0);
1974
+ }
1975
+ function SkipProperty(key) {
1976
+ return guard_exports.IsEqual(key, "const") || guard_exports.IsEqual(key, "enum");
1977
+ }
1978
+ function FromObject(schema, base, ref) {
1979
+ return guard_exports.Keys(schema).reduce((result, key) => {
1980
+ if (SkipProperty(key))
1981
+ return result;
1982
+ const match = FromValue(schema[key], base, ref);
1983
+ return !guard_exports.IsUndefined(match) ? match : result;
1984
+ }, void 0);
1985
+ }
1986
+ function FromValue(schema, base, ref) {
1987
+ const nextBase = IsSchemaObject(schema) && IsId(schema) ? new URL(schema.$id, base.href) : base;
1988
+ if (IsSchemaObject(schema)) {
1989
+ const result = Match(schema, nextBase, ref);
1990
+ if (!guard_exports.IsUndefined(result))
1991
+ return result;
1992
+ }
1993
+ if (guard_exports.IsArray(schema))
1994
+ return FromArray(schema, nextBase, ref);
1995
+ if (guard_exports.IsObject(schema))
1996
+ return FromObject(schema, nextBase, ref);
1997
+ return void 0;
1998
+ }
1999
+ function CanonicalHref(url) {
2000
+ return url.href.split("#")[0];
2001
+ }
2002
+ function RefContext(context, ref) {
2003
+ return guard_exports.HasPropertyKey(context, ref) ? context[ref] : void 0;
2004
+ }
2005
+ function RefLocal(schema, base, ref) {
2006
+ return FromValue(schema, base, ref);
2007
+ }
2008
+ function RefRemote(context, base, ref) {
2009
+ const targetDocumentHref = CanonicalHref(ref);
2010
+ if (guard_exports.IsEqual(targetDocumentHref, CanonicalHref(base)))
2011
+ return void 0;
2012
+ if (!guard_exports.HasPropertyKey(context, targetDocumentHref))
2013
+ return void 0;
2014
+ const remoteSchema = context[targetDocumentHref];
2015
+ const remoteBase = IsSchemaObject(remoteSchema) && IsId(remoteSchema) ? new URL(remoteSchema.$id, DefaultBase.href) : new URL(targetDocumentHref);
2016
+ return FromValue(remoteSchema, remoteBase, ref);
2017
+ }
2018
+ function Ref2(context, schema, ref) {
2019
+ const initialBase = IsId(schema) ? new URL(schema.$id, DefaultBase.href) : DefaultBase;
2020
+ const initialRef = new URL(ref, initialBase.href);
2021
+ return RefContext(context, ref) ?? RefLocal(schema, initialBase, initialRef) ?? RefRemote(context, initialBase, initialRef);
2022
+ }
2023
+ function DynamicRef(context, root, base, dynamicRef, dynamicAnchors) {
2024
+ const fragmentTarget = dynamicRef.$dynamicRef.startsWith("#") ? Ref2(context, base, dynamicRef.$dynamicRef) : Ref2(context, root, dynamicRef.$dynamicRef);
2025
+ if (guard_exports.IsUndefined(fragmentTarget))
2026
+ return void 0;
2027
+ if (!IsSchemaObject(fragmentTarget) || !IsDynamicAnchor(fragmentTarget))
2028
+ return fragmentTarget;
2029
+ const fragment = new URL(dynamicRef.$dynamicRef, DefaultBase).hash;
2030
+ if (fragment.startsWith("#/"))
2031
+ return fragmentTarget;
2032
+ const anchorTarget = dynamicAnchors.find((anchor) => anchor.$dynamicAnchor === fragmentTarget.$dynamicAnchor);
2033
+ return anchorTarget ?? fragmentTarget;
2034
+ }
2035
+
2036
+ // node_modules/typebox/build/schema/engine/_stack.mjs
2037
+ var __classPrivateFieldGet = function(receiver, state, kind, f) {
2038
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2039
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2040
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2041
+ };
2042
+ var _Stack_instances;
2043
+ var _Stack_PushResourceAnchors;
2044
+ var _Stack_PopResourceAnchors;
2045
+ var Stack = class {
2046
+ constructor(context, schema) {
2047
+ _Stack_instances.add(this);
2048
+ this.context = context;
2049
+ this.schema = schema;
2050
+ this.ids = [];
2051
+ this.anchors = [];
2052
+ this.recursiveAnchors = [];
2053
+ this.dynamicAnchors = [];
2054
+ }
2055
+ // ----------------------------------------------------------------
2056
+ // Base
2057
+ // ----------------------------------------------------------------
2058
+ BaseURL() {
2059
+ return this.ids.reduce((result, schema) => new URL(schema.$id, result), resolve_exports.DefaultBase);
2060
+ }
2061
+ Base() {
2062
+ return this.ids[this.ids.length - 1] ?? this.schema;
2063
+ }
2064
+ // ----------------------------------------------------------------
2065
+ // Stack
2066
+ // ----------------------------------------------------------------
2067
+ Push(schema) {
2068
+ if (!IsSchemaObject(schema))
2069
+ return;
2070
+ if (IsId(schema)) {
2071
+ this.ids.push(schema);
2072
+ __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PushResourceAnchors).call(this, schema);
2073
+ }
2074
+ if (IsAnchor(schema))
2075
+ this.anchors.push(schema);
2076
+ if (IsRecursiveAnchorTrue(schema))
2077
+ this.recursiveAnchors.push(schema);
2078
+ if (IsDynamicAnchor(schema))
2079
+ this.dynamicAnchors.push(schema);
2080
+ }
2081
+ Pop(schema) {
2082
+ if (!IsSchemaObject(schema))
2083
+ return;
2084
+ if (IsId(schema)) {
2085
+ this.ids.pop();
2086
+ __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PopResourceAnchors).call(this, schema);
2087
+ }
2088
+ if (IsAnchor(schema))
2089
+ this.anchors.pop();
2090
+ if (IsRecursiveAnchorTrue(schema))
2091
+ this.recursiveAnchors.pop();
2092
+ if (IsDynamicAnchor(schema))
2093
+ this.dynamicAnchors.pop();
2094
+ }
2095
+ // ----------------------------------------------------------------
2096
+ // Ref
2097
+ // ----------------------------------------------------------------
2098
+ Ref(ref) {
2099
+ const root = this.schema;
2100
+ return !ref.$ref.startsWith("#") ? resolve_exports.Ref(this.context, root, ref.$ref) : resolve_exports.Ref(this.context, this.Base(), ref.$ref);
2101
+ }
2102
+ // ----------------------------------------------------------------
2103
+ // RecursiveRef
2104
+ // ----------------------------------------------------------------
2105
+ RecursiveRef(recursiveRef) {
2106
+ return IsRecursiveAnchorTrue(this.Base()) ? resolve_exports.Ref(this.context, this.recursiveAnchors[0], recursiveRef.$recursiveRef) : resolve_exports.Ref(this.context, this.Base(), recursiveRef.$recursiveRef);
2107
+ }
2108
+ // ----------------------------------------------------------------
2109
+ // DynamicRef
2110
+ // ----------------------------------------------------------------
2111
+ DynamicRef(dynamicRef) {
2112
+ const root = this.schema;
2113
+ return resolve_exports.DynamicRef(this.context, root, this.Base(), dynamicRef, this.dynamicAnchors);
2114
+ }
2115
+ };
2116
+ _Stack_instances = /* @__PURE__ */ new WeakSet(), _Stack_PushResourceAnchors = function _Stack_PushResourceAnchors2(schema, isRoot = true) {
2117
+ if (!IsSchemaObject(schema))
2118
+ return;
2119
+ const current = schema;
2120
+ if (!isRoot && IsId(current))
2121
+ return;
2122
+ if (!isRoot && IsDynamicAnchor(current))
2123
+ this.dynamicAnchors.push(current);
2124
+ for (const key of guard_exports.Keys(current))
2125
+ __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PushResourceAnchors2).call(this, current[key], false);
2126
+ }, _Stack_PopResourceAnchors = function _Stack_PopResourceAnchors2(schema, isRoot = true) {
2127
+ if (!IsSchemaObject(schema))
2128
+ return;
2129
+ const current = schema;
2130
+ if (!isRoot && IsId(current))
2131
+ return;
2132
+ if (!isRoot && IsDynamicAnchor(current))
2133
+ this.dynamicAnchors.pop();
2134
+ for (const key of guard_exports.Keys(current))
2135
+ __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PopResourceAnchors2).call(this, current[key], false);
2136
+ };
2137
+
2138
+ // node_modules/typebox/build/schema/errors.mjs
2139
+ function Errors(...args) {
2140
+ const [context, schema, value] = arguments_exports.Match(args, {
2141
+ 3: (context2, schema2, value2) => [context2, schema2, value2],
2142
+ 2: (schema2, value2) => [{}, schema2, value2]
2143
+ });
2144
+ const stack = new Stack(context, schema);
2145
+ const errorContext = new ErrorContext();
2146
+ const result = ErrorSchema(stack, errorContext, "#", "", schema, value);
2147
+ const errors = errorContext.GetErrors().slice(0, settings_exports.Get().maxErrors);
2148
+ const locale = Get();
2149
+ const localized = errors.map((error) => ({ ...error, message: locale(error) }));
2150
+ return [result, localized];
2151
+ }
2152
+
2153
+ // node_modules/typebox/build/schema/check.mjs
2154
+ function Check(...args) {
2155
+ const [context, schema, value] = arguments_exports.Match(args, {
2156
+ 3: (context2, schema2, value2) => [context2, schema2, value2],
2157
+ 2: (schema2, value2) => [{}, schema2, value2]
2158
+ });
2159
+ const stack = new Stack(context, schema);
2160
+ const checkContext = new CheckContext();
2161
+ return CheckSchema(stack, checkContext, schema, value);
2162
+ }
2163
+
2164
+ // node_modules/typebox/build/value/check/check.mjs
2165
+ function Check2(...args) {
2166
+ const [context, type, value] = arguments_exports.Match(args, {
2167
+ 3: (context2, type2, value2) => [context2, type2, value2],
2168
+ 2: (type2, value2) => [{}, type2, value2]
2169
+ });
2170
+ return Check(context, type, value);
2171
+ }
2172
+
2173
+ // node_modules/typebox/build/value/errors/errors.mjs
2174
+ function Errors2(...args) {
2175
+ const [context, type, value] = arguments_exports.Match(args, {
2176
+ 3: (context2, type2, value2) => [context2, type2, value2],
2177
+ 2: (type2, value2) => [{}, type2, value2]
2178
+ });
2179
+ const [_, errors] = Errors(context, type, value);
2180
+ return errors;
2181
+ }
2182
+
2183
+ // node_modules/typebox/build/value/assert/assert.mjs
2184
+ var AssertError = class extends Error {
2185
+ constructor(source, value, errors) {
2186
+ super(source);
2187
+ Object.defineProperty(this, "cause", {
2188
+ value: { source, errors, value },
2189
+ writable: false,
2190
+ configurable: false,
2191
+ enumerable: false
2192
+ });
2193
+ }
2194
+ };
2195
+ function Assert(...args) {
2196
+ const [context, type, value] = arguments_exports.Match(args, {
2197
+ 3: (context2, type2, value2) => [context2, type2, value2],
2198
+ 2: (type2, value2) => [{}, type2, value2]
2199
+ });
2200
+ const check = Check2(context, type, value);
2201
+ if (!check)
2202
+ throw new AssertError("Assert", value, Errors2(context, type, value));
2203
+ }
2204
+
2205
+ // node_modules/typebox/build/value/clean/from_array.mjs
2206
+ function FromArray2(context, type, value) {
2207
+ if (!guard_exports.IsArray(value))
2208
+ return value;
2209
+ return value.map((value2) => FromType(context, type.items, value2));
2210
+ }
2211
+
2212
+ // node_modules/typebox/build/value/clean/from_cyclic.mjs
2213
+ function FromCyclic(context, type, value) {
2214
+ return FromType({ ...context, ...type.$defs }, Ref(type.$ref), value);
2215
+ }
2216
+
2217
+ // node_modules/typebox/build/value/clean/from_intersect.mjs
2218
+ function EvaluateIntersection(context, type) {
2219
+ const additionalProperties = guard_exports.HasPropertyKey(type, "unevaluatedProperties") ? { additionalProperties: type.unevaluatedProperties } : {};
2220
+ const instantiated = Instantiate(context, type);
2221
+ const evaluated = Evaluate(instantiated);
2222
+ return IsObject(evaluated) ? With(evaluated, additionalProperties) : evaluated;
2223
+ }
2224
+ function FromIntersect(context, type, value) {
2225
+ const evaluated = EvaluateIntersection(context, type);
2226
+ return FromType(context, evaluated, value);
2227
+ }
2228
+
2229
+ // node_modules/typebox/build/value/clean/additional.mjs
2230
+ function GetAdditionalProperties(type) {
2231
+ const additionalProperties = guard_exports.HasPropertyKey(type, "additionalProperties") ? type.additionalProperties : void 0;
2232
+ return additionalProperties;
2233
+ }
2234
+
2235
+ // node_modules/typebox/build/value/clean/from_object.mjs
2236
+ function FromObject2(context, type, value) {
2237
+ if (!guard_exports.IsObject(value) || guard_exports.IsArray(value))
2238
+ return value;
2239
+ const additionalProperties = GetAdditionalProperties(type);
2240
+ for (const key of guard_exports.Keys(value)) {
2241
+ if (guard_exports.HasPropertyKey(type.properties, key)) {
2242
+ value[key] = FromType(context, type.properties[key], value[key]);
2243
+ continue;
2244
+ }
2245
+ const unknownCheck = (
2246
+ // 1. additionalProperties: true
2247
+ guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[key])
2248
+ );
2249
+ if (unknownCheck) {
2250
+ value[key] = FromType(context, additionalProperties, value[key]);
2251
+ continue;
2252
+ }
2253
+ delete value[key];
2254
+ }
2255
+ return value;
2256
+ }
2257
+
2258
+ // node_modules/typebox/build/value/clean/from_record.mjs
2259
+ function FromRecord(context, type, value) {
2260
+ if (!guard_exports.IsObject(value))
2261
+ return value;
2262
+ const additionalProperties = GetAdditionalProperties(type);
2263
+ const [recordPattern, recordValue] = [new RegExp(RecordPattern(type)), RecordValue(type)];
2264
+ for (const key of guard_exports.Keys(value)) {
2265
+ if (recordPattern.test(key)) {
2266
+ value[key] = FromType(context, recordValue, value[key]);
2267
+ continue;
2268
+ }
2269
+ const unknownCheck = (
2270
+ // 1. additionalProperties: true
2271
+ guard_exports.IsBoolean(additionalProperties) && guard_exports.IsEqual(additionalProperties, true) || IsSchema(additionalProperties) && Check2(context, additionalProperties, value[key])
2272
+ );
2273
+ if (unknownCheck) {
2274
+ value[key] = FromType(context, additionalProperties, value[key]);
2275
+ continue;
2276
+ }
2277
+ delete value[key];
2278
+ }
2279
+ return value;
2280
+ }
2281
+
2282
+ // node_modules/typebox/build/value/clean/from_ref.mjs
2283
+ function FromRef(context, type, value) {
2284
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType(context, context[type.$ref], value) : value;
2285
+ }
2286
+
2287
+ // node_modules/typebox/build/value/clean/from_tuple.mjs
2288
+ function FromTuple(context, schema, value) {
2289
+ if (!guard_exports.IsArray(value))
2290
+ return value;
2291
+ const length = Math.min(value.length, schema.items.length);
2292
+ for (let index = 0; index < length; index++) {
2293
+ value[index] = FromType(context, schema.items[index], value[index]);
2294
+ }
2295
+ return guard_exports.IsGreaterThan(value.length, length) ? value.slice(0, length) : value;
2296
+ }
2297
+
2298
+ // node_modules/typebox/build/value/clone/clone.mjs
2299
+ function Clone2(value) {
2300
+ return Clone(value);
2301
+ }
2302
+
2303
+ // node_modules/typebox/build/value/clean/from_union.mjs
2304
+ function FromUnion(context, type, value) {
2305
+ for (const schema of type.anyOf) {
2306
+ const clean = FromType(context, schema, Clone2(value));
2307
+ if (Check2(context, schema, clean))
2308
+ return clean;
2309
+ }
2310
+ return value;
2311
+ }
2312
+
2313
+ // node_modules/typebox/build/value/clean/from_type.mjs
2314
+ function FromType(context, type, value) {
2315
+ return IsArray(type) ? FromArray2(context, type, value) : IsCyclic(type) ? FromCyclic(context, type, value) : IsIntersect(type) ? FromIntersect(context, type, value) : IsObject(type) ? FromObject2(context, type, value) : IsRecord(type) ? FromRecord(context, type, value) : IsRef(type) ? FromRef(context, type, value) : IsTuple(type) ? FromTuple(context, type, value) : IsUnion(type) ? FromUnion(context, type, value) : value;
2316
+ }
2317
+
2318
+ // node_modules/typebox/build/value/shared/union_priority_sort.mjs
2319
+ function Modifiers(type, next) {
2320
+ for (const key of guard_default.Keys(type)) {
2321
+ if (guard_default.HasPropertyKey(next, key))
2322
+ continue;
2323
+ next[key] = type[key];
2324
+ }
2325
+ return next;
2326
+ }
2327
+ function FromProperties(properties) {
2328
+ const result = {};
2329
+ for (const key of guard_default.Keys(properties))
2330
+ result[key] = FromType2(properties[key]);
2331
+ return result;
2332
+ }
2333
+ function FromPriorityTypes(types) {
2334
+ return FromTypes(Priority(types));
2335
+ }
2336
+ function FromTypes(types) {
2337
+ return types.map((type) => FromType2(type));
2338
+ }
2339
+ function FromType2(type) {
2340
+ const next = IsArray(type) ? _Array_(FromType2(type.items), ArrayOptions(type)) : IsIntersect(type) ? Intersect(FromTypes(type.allOf)) : IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) : IsObject(type) ? _Object_(FromProperties(type.properties)) : IsRecord(type) ? Record(RecordKey(type), FromType2(RecordValue(type))) : IsTuple(type) ? Tuple(FromTypes(type.items)) : type;
2341
+ return Modifiers(type, next);
2342
+ }
2343
+ function UnionPrioritySort(type) {
2344
+ const result = FromType2(type);
2345
+ return result;
2346
+ }
2347
+
2348
+ // node_modules/typebox/build/value/clean/clean.mjs
2349
+ function Clean(...args) {
2350
+ const [context, type, value] = arguments_exports.Match(args, {
2351
+ 3: (context2, type2, value2) => [context2, type2, value2],
2352
+ 2: (type2, value2) => [{}, type2, value2]
2353
+ });
2354
+ const sorted = settings_exports.Get().unionPrioritySort ? UnionPrioritySort(type) : type;
2355
+ return FromType(context, sorted, value);
2356
+ }
2357
+
2358
+ // node_modules/typebox/build/value/convert/try/try.mjs
2359
+ var try_exports = {};
2360
+ __export(try_exports, {
2361
+ Fail: () => Fail,
2362
+ IsOk: () => IsOk,
2363
+ Ok: () => Ok,
2364
+ TryArray: () => TryArray,
2365
+ TryBigInt: () => TryBigInt,
2366
+ TryBoolean: () => TryBoolean,
2367
+ TryNull: () => TryNull,
2368
+ TryNumber: () => TryNumber,
2369
+ TryString: () => TryString,
2370
+ TryUndefined: () => TryUndefined
2371
+ });
2372
+
2373
+ // node_modules/typebox/build/value/convert/try/try_result.mjs
2374
+ function IsOk(value) {
2375
+ return guard_exports.IsObject(value) && guard_exports.HasPropertyKey(value, "value");
2376
+ }
2377
+ function Ok(value) {
2378
+ return { value };
2379
+ }
2380
+ function Fail() {
2381
+ return void 0;
2382
+ }
2383
+
2384
+ // node_modules/typebox/build/value/convert/try/try_array.mjs
2385
+ function TryArray(value) {
2386
+ return guard_exports.IsArray(value) ? Ok(value) : Ok([value]);
2387
+ }
2388
+
2389
+ // node_modules/typebox/build/value/convert/try/try_bigint.mjs
2390
+ function FromBoolean(value) {
2391
+ return guard_exports.IsEqual(value, true) ? Ok(BigInt(1)) : Ok(BigInt(0));
2392
+ }
2393
+ var bigintPattern = /^-?(0|[1-9]\d*)n$/;
2394
+ var decimalPattern = /^-?(0|[1-9]\d*)\.\d+$/;
2395
+ var integerPattern = /^-?(0|[1-9]\d*)$/;
2396
+ function IsStringBigIntLike(value) {
2397
+ return bigintPattern.test(value);
2398
+ }
2399
+ function IsStringDecimalLike(value) {
2400
+ return decimalPattern.test(value);
2401
+ }
2402
+ function IsStringIntegerLike(value) {
2403
+ return integerPattern.test(value);
2404
+ }
2405
+ function FromString(value) {
2406
+ const lowercase = value.toLowerCase();
2407
+ return IsStringBigIntLike(value) ? Ok(BigInt(value.slice(0, value.length - 1))) : IsStringDecimalLike(value) ? Ok(BigInt(value.split(".")[0])) : IsStringIntegerLike(value) ? Ok(BigInt(value)) : guard_exports.IsEqual(lowercase, "false") ? Ok(BigInt(0)) : guard_exports.IsEqual(lowercase, "true") ? Ok(BigInt(1)) : Fail();
2408
+ }
2409
+ function TryBigInt(value) {
2410
+ return guard_exports.IsBigInt(value) ? Ok(value) : guard_exports.IsBoolean(value) ? FromBoolean(value) : guard_exports.IsNumber(value) ? Ok(BigInt(Math.trunc(value))) : guard_exports.IsNull(value) ? Ok(BigInt(0)) : guard_exports.IsString(value) ? FromString(value) : guard_exports.IsUndefined(value) ? Ok(BigInt(0)) : Fail();
2411
+ }
2412
+
2413
+ // node_modules/typebox/build/value/convert/try/try_boolean.mjs
2414
+ function FromBigInt(value) {
2415
+ return guard_exports.IsEqual(value, BigInt(0)) ? Ok(false) : guard_exports.IsEqual(value, BigInt(1)) ? Ok(true) : Fail();
2416
+ }
2417
+ function FromNumber(value) {
2418
+ return guard_exports.IsEqual(value, 0) ? Ok(false) : guard_exports.IsEqual(value, 1) ? Ok(true) : Fail();
2419
+ }
2420
+ function FromString2(value) {
2421
+ return guard_exports.IsEqual(value.toLowerCase(), "false") ? Ok(false) : guard_exports.IsEqual(value.toLowerCase(), "true") ? Ok(true) : guard_exports.IsEqual(value, "0") ? Ok(false) : guard_exports.IsEqual(value, "1") ? Ok(true) : Fail();
2422
+ }
2423
+ function TryBoolean(value) {
2424
+ return guard_exports.IsBigInt(value) ? FromBigInt(value) : guard_exports.IsBoolean(value) ? Ok(value) : guard_exports.IsNumber(value) ? FromNumber(value) : guard_exports.IsNull(value) ? Ok(false) : guard_exports.IsString(value) ? FromString2(value) : guard_exports.IsUndefined(value) ? Ok(false) : Fail();
2425
+ }
2426
+
2427
+ // node_modules/typebox/build/value/convert/try/try_null.mjs
2428
+ function FromBigInt2(value) {
2429
+ return guard_exports.IsEqual(value, BigInt(0)) ? Ok(null) : Fail();
2430
+ }
2431
+ function FromBoolean2(value) {
2432
+ return guard_exports.IsEqual(value, false) ? Ok(null) : Fail();
2433
+ }
2434
+ function FromNumber2(value) {
2435
+ return guard_exports.IsEqual(value, 0) ? Ok(null) : Fail();
2436
+ }
2437
+ function FromString3(value) {
2438
+ const lowercase = value.toLowerCase();
2439
+ const predicate = guard_exports.IsEqual(lowercase, "undefined") || guard_exports.IsEqual(lowercase, "null") || guard_exports.IsEqual(value, "") || guard_exports.IsEqual(value, "0");
2440
+ return predicate ? Ok(null) : Fail();
2441
+ }
2442
+ function TryNull(value) {
2443
+ return guard_exports.IsBigInt(value) ? FromBigInt2(value) : guard_exports.IsBoolean(value) ? FromBoolean2(value) : guard_exports.IsNumber(value) ? FromNumber2(value) : guard_exports.IsNull(value) ? Ok(null) : guard_exports.IsString(value) ? FromString3(value) : guard_exports.IsUndefined(value) ? Ok(null) : Fail();
2444
+ }
2445
+
2446
+ // node_modules/typebox/build/value/convert/try/try_number.mjs
2447
+ var maxBigInt = BigInt(Number.MAX_SAFE_INTEGER);
2448
+ var minBigInt = BigInt(Number.MIN_SAFE_INTEGER);
2449
+ function FromBigInt3(value) {
2450
+ return value <= maxBigInt && value >= minBigInt ? Ok(Number(value)) : Fail();
2451
+ }
2452
+ function FromBoolean3(value) {
2453
+ return Ok(value ? 1 : 0);
2454
+ }
2455
+ function FromString4(value) {
2456
+ const coerced = +value;
2457
+ if (guard_exports.IsNumber(coerced))
2458
+ return Ok(coerced);
2459
+ const lowercase = value.toLowerCase();
2460
+ if (guard_exports.IsEqual(lowercase, "false"))
2461
+ return Ok(0);
2462
+ if (guard_exports.IsEqual(lowercase, "true"))
2463
+ return Ok(1);
2464
+ const result = TryBigInt(value);
2465
+ if (IsOk(result))
2466
+ return result.value <= maxBigInt && result.value >= minBigInt ? Ok(Number(result.value)) : Fail();
2467
+ return Fail();
2468
+ }
2469
+ function TryNumber(value) {
2470
+ return guard_exports.IsBigInt(value) ? FromBigInt3(value) : guard_exports.IsBoolean(value) ? FromBoolean3(value) : guard_exports.IsNumber(value) ? Ok(value) : guard_exports.IsNull(value) ? Ok(0) : guard_exports.IsString(value) ? FromString4(value) : guard_exports.IsUndefined(value) ? Ok(0) : Fail();
2471
+ }
2472
+
2473
+ // node_modules/typebox/build/value/convert/try/try_string.mjs
2474
+ function TryString(value) {
2475
+ return guard_exports.IsBigInt(value) ? Ok(value.toString()) : guard_exports.IsBoolean(value) ? Ok(value.toString()) : guard_exports.IsNumber(value) ? Ok(value.toString()) : guard_exports.IsNull(value) ? Ok("null") : guard_exports.IsString(value) ? Ok(value) : guard_exports.IsUndefined(value) ? Ok("") : Fail();
2476
+ }
2477
+
2478
+ // node_modules/typebox/build/value/convert/try/try_undefined.mjs
2479
+ function FromBigInt4(value) {
2480
+ return guard_exports.IsEqual(value, BigInt(0)) ? Ok(void 0) : Fail();
2481
+ }
2482
+ function FromBoolean4(value) {
2483
+ return guard_exports.IsEqual(value, false) ? Ok(void 0) : Fail();
2484
+ }
2485
+ function FromNumber3(value) {
2486
+ return guard_exports.IsEqual(value, 0) ? Ok(void 0) : Fail();
2487
+ }
2488
+ function FromString5(value) {
2489
+ const lowercase = value.toLowerCase();
2490
+ const predicate = guard_exports.IsEqual(lowercase, "undefined") || guard_exports.IsEqual(lowercase, "null") || guard_exports.IsEqual(value, "") || guard_exports.IsEqual(value, "0");
2491
+ return predicate ? Ok(void 0) : Fail();
2492
+ }
2493
+ function TryUndefined(value) {
2494
+ return guard_exports.IsBigInt(value) ? FromBigInt4(value) : guard_exports.IsBoolean(value) ? FromBoolean4(value) : guard_exports.IsNumber(value) ? FromNumber3(value) : guard_exports.IsNull(value) ? Ok(void 0) : guard_exports.IsString(value) ? FromString5(value) : guard_exports.IsUndefined(value) ? Ok(value) : Fail();
2495
+ }
2496
+
2497
+ // node_modules/typebox/build/value/convert/from_array.mjs
2498
+ function FromArray3(context, type, value) {
2499
+ const result = try_exports.TryArray(value);
2500
+ return result.value.map((value2) => FromType3(context, type.items, value2));
2501
+ }
2502
+
2503
+ // node_modules/typebox/build/value/convert/from_bigint.mjs
2504
+ function FromBigInt5(_context, _type, value) {
2505
+ const result = try_exports.TryBigInt(value);
2506
+ return try_exports.IsOk(result) ? result.value : value;
2507
+ }
2508
+
2509
+ // node_modules/typebox/build/value/convert/from_boolean.mjs
2510
+ function FromBoolean5(_context, _type, value) {
2511
+ const result = try_exports.TryBoolean(value);
2512
+ return try_exports.IsOk(result) ? result.value : value;
2513
+ }
2514
+
2515
+ // node_modules/typebox/build/value/convert/from_cyclic.mjs
2516
+ function FromCyclic2(context, type, value) {
2517
+ return FromType3({ ...context, ...type.$defs }, Ref(type.$ref), value);
2518
+ }
2519
+
2520
+ // node_modules/typebox/build/value/convert/from_enum.mjs
2521
+ function FromEnum(context, type, value) {
2522
+ return FromType3(context, Evaluate(type), value);
2523
+ }
2524
+
2525
+ // node_modules/typebox/build/value/convert/from_integer.mjs
2526
+ function FromInteger(_context, _type, value) {
2527
+ const result = try_exports.TryNumber(value);
2528
+ return try_exports.IsOk(result) ? Math.trunc(result.value) : value;
2529
+ }
2530
+
2531
+ // node_modules/typebox/build/value/convert/from_intersect.mjs
2532
+ function FromIntersect2(context, type, value) {
2533
+ const instantiated = Instantiate(context, type);
2534
+ const evaluated = Evaluate(instantiated);
2535
+ return FromType3(context, evaluated, value);
2536
+ }
2537
+
2538
+ // node_modules/typebox/build/value/convert/from_literal.mjs
2539
+ function FromLiteralBigInt(_context, type, value) {
2540
+ const result = try_exports.TryBigInt(value);
2541
+ return try_exports.IsOk(result) && guard_exports.IsEqual(type.const, result.value) ? result.value : value;
2542
+ }
2543
+ function FromLiteralBoolean(_context, type, value) {
2544
+ const result = try_exports.TryBoolean(value);
2545
+ return try_exports.IsOk(result) && guard_exports.IsEqual(type.const, result.value) ? result.value : value;
2546
+ }
2547
+ function FromLiteralNumber(_context, type, value) {
2548
+ const result = try_exports.TryNumber(value);
2549
+ return try_exports.IsOk(result) && guard_exports.IsEqual(type.const, result.value) ? result.value : value;
2550
+ }
2551
+ function FromLiteralString(_context, type, value) {
2552
+ const result = try_exports.TryString(value);
2553
+ return try_exports.IsOk(result) && guard_exports.IsEqual(type.const, result.value) ? result.value : value;
2554
+ }
2555
+ function FromLiteral(context, type, value) {
2556
+ if (guard_exports.IsEqual(type.const, value))
2557
+ return value;
2558
+ return IsLiteralBigInt(type) ? FromLiteralBigInt(context, type, value) : IsLiteralBoolean(type) ? FromLiteralBoolean(context, type, value) : IsLiteralNumber(type) ? FromLiteralNumber(context, type, value) : IsLiteralString(type) ? FromLiteralString(context, type, value) : Unreachable();
2559
+ }
2560
+
2561
+ // node_modules/typebox/build/value/convert/from_null.mjs
2562
+ function FromNull(_context, _type, value) {
2563
+ const result = try_exports.TryNull(value);
2564
+ return try_exports.IsOk(result) ? result.value : value;
2565
+ }
2566
+
2567
+ // node_modules/typebox/build/value/convert/from_number.mjs
2568
+ function FromNumber4(_context, _type, value) {
2569
+ const result = try_exports.TryNumber(value);
2570
+ return try_exports.IsOk(result) ? result.value : value;
2571
+ }
2572
+
2573
+ // node_modules/typebox/build/value/convert/from_additional.mjs
2574
+ function FromAdditionalProperties(context, entries, additionalProperties, value) {
2575
+ const keys = guard_exports.Keys(value);
2576
+ for (const [regexp, _] of entries) {
2577
+ for (const key of keys) {
2578
+ if (!regexp.test(key)) {
2579
+ value[key] = FromType3(context, additionalProperties, value[key]);
2580
+ }
2581
+ }
2582
+ }
2583
+ return value;
2584
+ }
2585
+
2586
+ // node_modules/typebox/build/value/shared/optional_undefined.mjs
2587
+ function IsOptionalUndefined(property, key, value) {
2588
+ return IsOptional(property) && guard_exports.IsUndefined(value[key]);
2589
+ }
2590
+
2591
+ // node_modules/typebox/build/value/convert/from_object.mjs
2592
+ function FromProperties2(context, type, value) {
2593
+ const entries = guard_exports.EntriesRegExp(type.properties);
2594
+ const keys = guard_exports.Keys(value);
2595
+ for (const [regexp, property] of entries) {
2596
+ for (const key of keys) {
2597
+ if (!regexp.test(key) || IsOptionalUndefined(property, key, value))
2598
+ continue;
2599
+ value[key] = FromType3(context, property, value[key]);
2600
+ }
2601
+ }
2602
+ return guard_exports.HasPropertyKey(type, "additionalProperties") && guard_exports.IsObject(type.additionalProperties) ? FromAdditionalProperties(context, entries, type.additionalProperties, value) : value;
2603
+ }
2604
+ function FromObject3(context, type, value) {
2605
+ return guard_exports.IsObjectNotArray(value) ? FromProperties2(context, type, value) : value;
2606
+ }
2607
+
2608
+ // node_modules/typebox/build/value/convert/from_record.mjs
2609
+ function FromPatternProperties(context, type, value) {
2610
+ const entries = guard_exports.EntriesRegExp(type.patternProperties);
2611
+ const keys = guard_exports.Keys(value);
2612
+ for (const [regexp, schema] of entries) {
2613
+ for (const key of keys) {
2614
+ if (regexp.test(key)) {
2615
+ value[key] = FromType3(context, schema, value[key]);
2616
+ }
2617
+ }
2618
+ }
2619
+ return guard_exports.HasPropertyKey(type, "additionalProperties") && guard_exports.IsObject(type.additionalProperties) ? FromAdditionalProperties(context, entries, type.additionalProperties, value) : value;
2620
+ }
2621
+ function FromRecord2(context, type, value) {
2622
+ return guard_exports.IsObjectNotArray(value) ? FromPatternProperties(context, type, value) : value;
2623
+ }
2624
+
2625
+ // node_modules/typebox/build/value/convert/from_ref.mjs
2626
+ function FromRef2(context, type, value) {
2627
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType3(context, context[type.$ref], value) : value;
2628
+ }
2629
+
2630
+ // node_modules/typebox/build/value/convert/from_string.mjs
2631
+ function FromString6(_context, _type, value) {
2632
+ const result = try_exports.TryString(value);
2633
+ return try_exports.IsOk(result) ? result.value : value;
2634
+ }
2635
+
2636
+ // node_modules/typebox/build/value/convert/from_template_literal.mjs
2637
+ function FromTemplateLiteral(context, type, value) {
2638
+ return FromType3(context, Evaluate(type), value);
2639
+ }
2640
+
2641
+ // node_modules/typebox/build/value/convert/from_tuple.mjs
2642
+ function FromTuple2(context, type, value) {
2643
+ if (!guard_exports.IsArray(value))
2644
+ return value;
2645
+ for (let index = 0; index < Math.min(type.items.length, value.length); index++) {
2646
+ value[index] = FromType3(context, type.items[index], value[index]);
2647
+ }
2648
+ return value;
2649
+ }
2650
+
2651
+ // node_modules/typebox/build/value/convert/from_undefined.mjs
2652
+ function FromUndefined(_context, _type, value) {
2653
+ const result = try_exports.TryUndefined(value);
2654
+ return try_exports.IsOk(result) ? result.value : value;
2655
+ }
2656
+
2657
+ // node_modules/typebox/build/value/convert/from_union.mjs
2658
+ function FromUnion2(context, type, value) {
2659
+ const matched = type.anyOf.some((type2) => Check2(context, type2, value));
2660
+ if (matched)
2661
+ return value;
2662
+ const candidates = type.anyOf.map((type2) => FromType3(context, type2, Clone2(value)));
2663
+ const selected = candidates.find((value2) => Check2(context, type, value2));
2664
+ return guard_exports.IsUndefined(selected) ? value : selected;
2665
+ }
2666
+
2667
+ // node_modules/typebox/build/value/convert/from_void.mjs
2668
+ function FromVoid(_context, _type, value) {
2669
+ const result = try_exports.TryUndefined(value);
2670
+ return try_exports.IsOk(result) ? void 0 : value;
2671
+ }
2672
+
2673
+ // node_modules/typebox/build/value/convert/from_type.mjs
2674
+ function FromType3(context, type, value) {
2675
+ return IsArray(type) ? FromArray3(context, type, value) : IsBigInt(type) ? FromBigInt5(context, type, value) : IsBoolean(type) ? FromBoolean5(context, type, value) : IsCyclic(type) ? FromCyclic2(context, type, value) : IsEnum(type) ? FromEnum(context, type, value) : IsInteger(type) ? FromInteger(context, type, value) : IsIntersect(type) ? FromIntersect2(context, type, value) : IsLiteral(type) ? FromLiteral(context, type, value) : IsNull(type) ? FromNull(context, type, value) : IsNumber(type) ? FromNumber4(context, type, value) : IsObject(type) ? FromObject3(context, type, value) : IsRecord(type) ? FromRecord2(context, type, value) : IsRef(type) ? FromRef2(context, type, value) : IsString(type) ? FromString6(context, type, value) : IsTemplateLiteral(type) ? FromTemplateLiteral(context, type, value) : IsTuple(type) ? FromTuple2(context, type, value) : IsUndefined(type) ? FromUndefined(context, type, value) : IsUnion(type) ? FromUnion2(context, type, value) : IsVoid(type) ? FromVoid(context, type, value) : value;
2676
+ }
2677
+
2678
+ // node_modules/typebox/build/value/convert/convert.mjs
2679
+ function Convert(...args) {
2680
+ const [context, type, value] = arguments_exports.Match(args, {
2681
+ 3: (context2, type2, value2) => [context2, type2, value2],
2682
+ 2: (type2, value2) => [{}, type2, value2]
2683
+ });
2684
+ return FromType3(context, type, value);
2685
+ }
2686
+
2687
+ // node_modules/typebox/build/value/default/from_array.mjs
2688
+ function FromArray4(context, type, value) {
2689
+ if (!guard_exports.IsArray(value))
2690
+ return value;
2691
+ for (let i = 0; i < value.length; i++) {
2692
+ value[i] = FromType4(context, type.items, value[i]);
2693
+ }
2694
+ return value;
2695
+ }
2696
+
2697
+ // node_modules/typebox/build/value/default/from_cyclic.mjs
2698
+ function FromCyclic3(context, type, value) {
2699
+ return FromType4({ ...context, ...type.$defs }, Ref(type.$ref), value);
2700
+ }
2701
+
2702
+ // node_modules/typebox/build/value/default/from_default.mjs
2703
+ function FromDefault(type, value) {
2704
+ if (!guard_exports.IsUndefined(value))
2705
+ return value;
2706
+ return guard_exports.IsFunction(type.default) ? type.default() : Clone2(type.default);
2707
+ }
2708
+
2709
+ // node_modules/typebox/build/value/default/from_intersect.mjs
2710
+ function FromIntersect3(context, type, value) {
2711
+ const instantiated = Instantiate(context, type);
2712
+ const evaluated = Evaluate(instantiated);
2713
+ return FromType4(context, evaluated, value);
2714
+ }
2715
+
2716
+ // node_modules/typebox/build/value/default/from_object.mjs
2717
+ function FromObject4(context, type, value) {
2718
+ if (!guard_exports.IsObject(value))
2719
+ return value;
2720
+ const knownPropertyKeys = guard_exports.Keys(type.properties);
2721
+ for (const key of knownPropertyKeys) {
2722
+ const propertyValue = FromType4(context, type.properties[key], value[key]);
2723
+ const isUnassignableUndefined = guard_exports.IsUndefined(propertyValue) && (IsOptional(type.properties[key]) || !guard_exports.HasPropertyKey(type.properties[key], "default"));
2724
+ if (isUnassignableUndefined)
2725
+ continue;
2726
+ value[key] = propertyValue;
2727
+ }
2728
+ if (!IsAdditionalProperties(type) || guard_exports.IsBoolean(type.additionalProperties))
2729
+ return value;
2730
+ for (const key of guard_exports.Keys(value)) {
2731
+ if (knownPropertyKeys.includes(key))
2732
+ continue;
2733
+ value[key] = FromType4(context, type.additionalProperties, value[key]);
2734
+ }
2735
+ return value;
2736
+ }
2737
+
2738
+ // node_modules/typebox/build/value/default/from_record.mjs
2739
+ function FromRecord3(context, type, value) {
2740
+ if (!guard_exports.IsObject(value))
2741
+ return value;
2742
+ const [recordKey, recordValue] = [new RegExp(RecordPattern(type)), RecordValue(type)];
2743
+ for (const key of guard_exports.Keys(value)) {
2744
+ if (!(recordKey.test(key) && IsDefault(recordValue)))
2745
+ continue;
2746
+ value[key] = FromType4(context, recordValue, value[key]);
2747
+ }
2748
+ if (!IsAdditionalProperties(type))
2749
+ return value;
2750
+ for (const key of guard_exports.Keys(value)) {
2751
+ if (recordKey.test(key))
2752
+ continue;
2753
+ value[key] = FromType4(context, type.additionalProperties, value[key]);
2754
+ }
2755
+ return value;
2756
+ }
2757
+
2758
+ // node_modules/typebox/build/value/default/from_ref.mjs
2759
+ function FromRef3(context, type, value) {
2760
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType4(context, context[type.$ref], value) : value;
2761
+ }
2762
+
2763
+ // node_modules/typebox/build/value/default/from_tuple.mjs
2764
+ function FromTuple3(context, schema, value) {
2765
+ if (!guard_exports.IsArray(value))
2766
+ return value;
2767
+ const [items, max] = [schema.items, Math.max(schema.items.length, value.length)];
2768
+ for (let i = 0; i < max; i++) {
2769
+ if (i < items.length)
2770
+ value[i] = FromType4(context, items[i], value[i]);
2771
+ }
2772
+ return value;
2773
+ }
2774
+
2775
+ // node_modules/typebox/build/value/default/from_union.mjs
2776
+ function FromUnion3(context, schema, value) {
2777
+ for (const inner of schema.anyOf) {
2778
+ const result = FromType4(context, inner, Clone2(value));
2779
+ if (Check2(context, inner, result)) {
2780
+ return result;
2781
+ }
2782
+ }
2783
+ return value;
2784
+ }
2785
+
2786
+ // node_modules/typebox/build/value/default/from_type.mjs
2787
+ function FromType4(context, type, value) {
2788
+ const defaulted = IsDefault(type) ? FromDefault(type, value) : value;
2789
+ return IsArray(type) ? FromArray4(context, type, defaulted) : IsCyclic(type) ? FromCyclic3(context, type, defaulted) : IsIntersect(type) ? FromIntersect3(context, type, defaulted) : IsObject(type) ? FromObject4(context, type, defaulted) : IsRecord(type) ? FromRecord3(context, type, defaulted) : IsRef(type) ? FromRef3(context, type, defaulted) : IsTuple(type) ? FromTuple3(context, type, defaulted) : IsUnion(type) ? FromUnion3(context, type, defaulted) : defaulted;
2790
+ }
2791
+
2792
+ // node_modules/typebox/build/value/default/default.mjs
2793
+ function Default(...args) {
2794
+ const [context, type, value] = arguments_exports.Match(args, {
2795
+ 3: (context2, type2, value2) => [context2, type2, value2],
2796
+ 2: (type2, value2) => [{}, type2, value2]
2797
+ });
2798
+ return FromType4(context, type, value);
2799
+ }
2800
+
2801
+ // node_modules/typebox/build/value/pipeline/pipeline.mjs
2802
+ function Pipeline(pipeline) {
2803
+ return (...args) => {
2804
+ const [context, type, value] = arguments_exports.Match(args, {
2805
+ 3: (context2, type2, value2) => [context2, type2, value2],
2806
+ 2: (type2, value2) => [{}, type2, value2]
2807
+ });
2808
+ return pipeline.reduce((result, func) => func(context, type, result), value);
2809
+ };
2810
+ }
2811
+
2812
+ // node_modules/typebox/build/value/codec/callback.mjs
2813
+ function Decode2(_context, type, value) {
2814
+ return type["~codec"].decode(value);
2815
+ }
2816
+ function Encode2(_context, type, value) {
2817
+ return type["~codec"].encode(value);
2818
+ }
2819
+ function Callback(direction, context, type, value) {
2820
+ if (!IsCodec(type))
2821
+ return value;
2822
+ return guard_exports.IsEqual(direction, "Decode") ? Decode2(context, type, value) : Encode2(context, type, value);
2823
+ }
2824
+
2825
+ // node_modules/typebox/build/value/codec/from_array.mjs
2826
+ function Decode3(direction, context, type, value) {
2827
+ if (!guard_exports.IsArray(value))
2828
+ return value;
2829
+ for (let i = 0; i < value.length; i++) {
2830
+ value[i] = FromType5(direction, context, type.items, value[i]);
2831
+ }
2832
+ return Callback(direction, context, type, value);
2833
+ }
2834
+ function Encode3(direction, context, type, value) {
2835
+ const exterior = Callback(direction, context, type, value);
2836
+ if (!guard_exports.IsArray(exterior))
2837
+ return exterior;
2838
+ for (let i = 0; i < exterior.length; i++) {
2839
+ exterior[i] = FromType5(direction, context, type.items, exterior[i]);
2840
+ }
2841
+ return exterior;
2842
+ }
2843
+ function FromArray5(direction, context, type, value) {
2844
+ return guard_exports.IsEqual(direction, "Decode") ? Decode3(direction, context, type, value) : Encode3(direction, context, type, value);
2845
+ }
2846
+
2847
+ // node_modules/typebox/build/value/codec/from_cyclic.mjs
2848
+ function FromCyclic4(direction, context, type, value) {
2849
+ value = FromType5(direction, { ...context, ...type.$defs }, Ref(type.$ref), value);
2850
+ return Callback(direction, context, type, value);
2851
+ }
2852
+
2853
+ // node_modules/typebox/build/value/codec/from_intersect.mjs
2854
+ function MergeInteriors(interiors) {
2855
+ return interiors.reduce((results, interior) => ({ ...results, ...interior }), {});
2856
+ }
2857
+ function NonMatchingInterior(value, interiors) {
2858
+ for (const interior of interiors)
2859
+ if (!guard_exports.IsDeepEqual(value, interior))
2860
+ return interior;
2861
+ return value;
2862
+ }
2863
+ function Decode4(direction, context, type, value) {
2864
+ if (guard_exports.IsEqual(type.allOf.length, 0))
2865
+ return Callback(direction, context, type, value);
2866
+ const interiors = type.allOf.map((schema) => FromType5(direction, context, schema, Clean(schema, Clone2(value))));
2867
+ const structural = interiors.every((result) => guard_exports.IsObject(result));
2868
+ const exterior = structural ? MergeInteriors(interiors) : NonMatchingInterior(value, interiors);
2869
+ return Callback(direction, context, type, exterior);
2870
+ }
2871
+ function Encode4(direction, context, type, value) {
2872
+ if (guard_exports.IsEqual(type.allOf.length, 0))
2873
+ return Callback(direction, context, type, value);
2874
+ const exterior = Callback(direction, context, type, value);
2875
+ const interiors = type.allOf.map((schema) => FromType5(direction, context, schema, Clean(schema, Clone2(exterior))));
2876
+ const structural = interiors.every((result) => guard_exports.IsObject(result));
2877
+ if (structural)
2878
+ return MergeInteriors(interiors);
2879
+ return NonMatchingInterior(exterior, interiors);
2880
+ }
2881
+ function FromIntersect4(direction, context, type, value) {
2882
+ return guard_exports.IsEqual(direction, "Decode") ? Decode4(direction, context, type, value) : Encode4(direction, context, type, value);
2883
+ }
2884
+
2885
+ // node_modules/typebox/build/value/codec/from_object.mjs
2886
+ function Decode5(direction, context, type, value) {
2887
+ if (!guard_exports.IsObjectNotArray(value))
2888
+ return value;
2889
+ for (const key of guard_exports.Keys(type.properties)) {
2890
+ if (!guard_exports.HasPropertyKey(value, key) || IsOptionalUndefined(type.properties[key], key, value))
2891
+ continue;
2892
+ value[key] = FromType5(direction, context, type.properties[key], value[key]);
2893
+ }
2894
+ return Callback(direction, context, type, value);
2895
+ }
2896
+ function Encode5(direction, context, type, value) {
2897
+ const exterior = Callback(direction, context, type, value);
2898
+ if (!guard_exports.IsObjectNotArray(exterior))
2899
+ return exterior;
2900
+ for (const key of guard_exports.Keys(type.properties)) {
2901
+ if (!guard_exports.HasPropertyKey(exterior, key) || IsOptionalUndefined(type.properties[key], key, exterior))
2902
+ continue;
2903
+ exterior[key] = FromType5(direction, context, type.properties[key], exterior[key]);
2904
+ }
2905
+ return exterior;
2906
+ }
2907
+ function FromObject5(direction, context, type, value) {
2908
+ return guard_exports.IsEqual(direction, "Decode") ? Decode5(direction, context, type, value) : Encode5(direction, context, type, value);
2909
+ }
2910
+
2911
+ // node_modules/typebox/build/value/codec/from_record.mjs
2912
+ function Decode6(direction, context, type, value) {
2913
+ if (!guard_exports.IsObjectNotArray(value))
2914
+ return value;
2915
+ const regexp = new RegExp(RecordPattern(type));
2916
+ for (const key of guard_exports.Keys(value)) {
2917
+ if (!regexp.test(key))
2918
+ continue;
2919
+ value[key] = FromType5(direction, context, RecordValue(type), value[key]);
2920
+ }
2921
+ return Callback(direction, context, type, value);
2922
+ }
2923
+ function Encode6(direction, context, type, value) {
2924
+ const exterior = Callback(direction, context, type, value);
2925
+ if (!guard_exports.IsObjectNotArray(exterior))
2926
+ return exterior;
2927
+ const regexp = new RegExp(RecordPattern(type));
2928
+ for (const key of guard_exports.Keys(exterior)) {
2929
+ if (!regexp.test(key))
2930
+ continue;
2931
+ exterior[key] = FromType5(direction, context, RecordValue(type), exterior[key]);
2932
+ }
2933
+ return exterior;
2934
+ }
2935
+ function FromRecord4(direction, context, type, value) {
2936
+ return guard_exports.IsEqual(direction, "Decode") ? Decode6(direction, context, type, value) : Encode6(direction, context, type, value);
2937
+ }
2938
+
2939
+ // node_modules/typebox/build/value/codec/from_ref.mjs
2940
+ function ResolveRef(direction, context, type, value) {
2941
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType5(direction, context, context[type.$ref], value) : value;
2942
+ }
2943
+ function FromRef4(direction, context, type, value) {
2944
+ return guard_exports.IsEqual(direction, "Decode") ? Callback(direction, context, type, ResolveRef(direction, context, type, value)) : ResolveRef(direction, context, type, Callback(direction, context, type, value));
2945
+ }
2946
+
2947
+ // node_modules/typebox/build/value/codec/from_tuple.mjs
2948
+ function Decode7(direction, context, type, value) {
2949
+ if (!guard_exports.IsArray(value))
2950
+ return value;
2951
+ for (let i = 0; i < Math.min(type.items.length, value.length); i++) {
2952
+ value[i] = FromType5(direction, context, type.items[i], value[i]);
2953
+ }
2954
+ return Callback(direction, context, type, value);
2955
+ }
2956
+ function Encode7(direction, context, type, value) {
2957
+ const exterior = Callback(direction, context, type, value);
2958
+ if (!guard_exports.IsArray(exterior))
2959
+ return value;
2960
+ for (let i = 0; i < Math.min(type.items.length, exterior.length); i++) {
2961
+ exterior[i] = FromType5(direction, context, type.items[i], exterior[i]);
2962
+ }
2963
+ return exterior;
2964
+ }
2965
+ function FromTuple4(direction, context, type, value) {
2966
+ return guard_exports.IsEqual(direction, "Decode") ? Decode7(direction, context, type, value) : Encode7(direction, context, type, value);
2967
+ }
2968
+
2969
+ // node_modules/typebox/build/value/codec/from_union.mjs
2970
+ function Decode8(direction, context, type, value) {
2971
+ for (const schema of type.anyOf) {
2972
+ if (!Check2(context, schema, value))
2973
+ continue;
2974
+ const variant = FromType5(direction, context, schema, value);
2975
+ return Callback(direction, context, type, variant);
2976
+ }
2977
+ return value;
2978
+ }
2979
+ function Encode8(direction, context, type, value) {
2980
+ const exterior = Callback(direction, context, type, value);
2981
+ for (const schema of type.anyOf) {
2982
+ const variant = FromType5(direction, context, schema, Clone2(exterior));
2983
+ if (!Check2(context, schema, variant))
2984
+ continue;
2985
+ return variant;
2986
+ }
2987
+ return exterior;
2988
+ }
2989
+ function FromUnion4(direction, context, type, value) {
2990
+ return guard_exports.IsEqual(direction, "Decode") ? Decode8(direction, context, type, value) : Encode8(direction, context, type, value);
2991
+ }
2992
+
2993
+ // node_modules/typebox/build/value/codec/from_type.mjs
2994
+ function FromType5(direction, context, type, value) {
2995
+ return IsArray(type) ? FromArray5(direction, context, type, value) : IsCyclic(type) ? FromCyclic4(direction, context, type, value) : IsIntersect(type) ? FromIntersect4(direction, context, type, value) : IsObject(type) ? FromObject5(direction, context, type, value) : IsRecord(type) ? FromRecord4(direction, context, type, value) : IsRef(type) ? FromRef4(direction, context, type, value) : IsTuple(type) ? FromTuple4(direction, context, type, value) : IsUnion(type) ? FromUnion4(direction, context, type, value) : Callback(direction, context, type, value);
2996
+ }
2997
+
2998
+ // node_modules/typebox/build/value/codec/decode.mjs
2999
+ var DecodeError = class extends AssertError {
3000
+ constructor(value, errors) {
3001
+ super("Decode", value, errors);
3002
+ }
3003
+ };
3004
+ function Assert2(context, type, value) {
3005
+ if (!Check2(context, type, value))
3006
+ throw new DecodeError(value, Errors2(context, type, value));
3007
+ return value;
3008
+ }
3009
+ function DecodeUnsafe(context, type, value) {
3010
+ const sorted = settings_exports.Get().unionPrioritySort ? UnionPrioritySort(type) : type;
3011
+ return FromType5("Decode", context, sorted, value);
3012
+ }
3013
+ var Decoder = Pipeline([
3014
+ (_context, _type, value) => Clone2(value),
3015
+ (context, type, value) => Default(context, type, value),
3016
+ (context, type, value) => Convert(context, type, value),
3017
+ (context, type, value) => Clean(context, type, value),
3018
+ (context, type, value) => Assert2(context, type, value),
3019
+ (context, type, value) => DecodeUnsafe(context, type, value)
3020
+ ]);
3021
+ function Decode9(...args) {
3022
+ const [context, type, value] = arguments_exports.Match(args, {
3023
+ 3: (context2, type2, value2) => [context2, type2, value2],
3024
+ 2: (type2, value2) => [{}, type2, value2]
3025
+ });
3026
+ return Decoder(context, type, value);
3027
+ }
3028
+
3029
+ // node_modules/typebox/build/value/codec/encode.mjs
3030
+ var EncodeError = class extends AssertError {
3031
+ constructor(value, errors) {
3032
+ super("Encode", value, errors);
3033
+ }
3034
+ };
3035
+ function Assert3(context, type, value) {
3036
+ if (!Check2(context, type, value))
3037
+ throw new EncodeError(value, Errors2(context, type, value));
3038
+ return value;
3039
+ }
3040
+ function EncodeUnsafe(context, type, value) {
3041
+ const sorted = settings_exports.Get().unionPrioritySort ? UnionPrioritySort(type) : type;
3042
+ return FromType5("Encode", context, sorted, value);
3043
+ }
3044
+ var Encoder = Pipeline([
3045
+ (_context, _type, value) => Clone2(value),
3046
+ (context, type, value) => EncodeUnsafe(context, type, value),
3047
+ (context, type, value) => Default(context, type, value),
3048
+ (context, type, value) => Convert(context, type, value),
3049
+ (context, type, value) => Clean(context, type, value),
3050
+ (context, type, value) => Assert3(context, type, value)
3051
+ ]);
3052
+ function Encode9(...args) {
3053
+ const [context, type, value] = arguments_exports.Match(args, {
3054
+ 3: (context2, type2, value2) => [context2, type2, value2],
3055
+ 2: (type2, value2) => [{}, type2, value2]
3056
+ });
3057
+ return Encoder(context, type, value);
3058
+ }
3059
+
3060
+ // node_modules/typebox/build/value/codec/has.mjs
3061
+ function FromArray6(context, type) {
3062
+ return IsCodec(type) || FromType6(context, type.items);
3063
+ }
3064
+ function FromCyclic5(context, type) {
3065
+ return IsCodec(type) || FromRef5({ ...context, ...type.$defs }, Ref(type.$ref));
3066
+ }
3067
+ function FromIntersect5(context, type) {
3068
+ return IsCodec(type) || type.allOf.some((type2) => FromType6(context, type2));
3069
+ }
3070
+ function FromObject6(context, type) {
3071
+ return IsCodec(type) || guard_exports.Keys(type.properties).some((key) => {
3072
+ return FromType6(context, type.properties[key]);
3073
+ });
3074
+ }
3075
+ function FromRecord5(context, type) {
3076
+ return IsCodec(type) || FromType6(context, RecordValue(type));
3077
+ }
3078
+ function FromRef5(context, type) {
3079
+ if (visited.has(type.$ref))
3080
+ return false;
3081
+ visited.add(type.$ref);
3082
+ return IsCodec(type) || guard_exports.HasPropertyKey(context, type.$ref) && FromType6(context, context[type.$ref]);
3083
+ }
3084
+ function FromTuple5(context, type) {
3085
+ return IsCodec(type) || type.items.some((type2) => FromType6(context, type2));
3086
+ }
3087
+ function FromUnion5(context, type) {
3088
+ return IsCodec(type) || type.anyOf.some((type2) => FromType6(context, type2));
3089
+ }
3090
+ function FromType6(context, type) {
3091
+ return IsArray(type) ? FromArray6(context, type) : IsCyclic(type) ? FromCyclic5(context, type) : IsIntersect(type) ? FromIntersect5(context, type) : IsObject(type) ? FromObject6(context, type) : IsRecord(type) ? FromRecord5(context, type) : IsRef(type) ? FromRef5(context, type) : IsTuple(type) ? FromTuple5(context, type) : IsUnion(type) ? FromUnion5(context, type) : IsCodec(type);
3092
+ }
3093
+ var visited = /* @__PURE__ */ new Set();
3094
+ function HasCodec(...args) {
3095
+ const [context, type] = arguments_exports.Match(args, {
3096
+ 2: (context2, type2) => [context2, type2],
3097
+ 1: (type2) => [{}, type2]
3098
+ });
3099
+ visited.clear();
3100
+ return FromType6(context, type);
3101
+ }
3102
+
3103
+ // node_modules/typebox/build/value/create/error.mjs
3104
+ var CreateError = class extends Error {
3105
+ constructor(type, message) {
3106
+ super(message);
3107
+ this.type = type;
3108
+ }
3109
+ };
3110
+
3111
+ // node_modules/typebox/build/value/create/from_default.mjs
3112
+ function FromDefault2(_context, schema) {
3113
+ return guard_exports.IsFunction(schema.default) ? schema.default(schema) : guard_exports.IsObject(schema.default) ? Clone2(schema.default) : schema.default;
3114
+ }
3115
+
3116
+ // node_modules/typebox/build/value/create/from_array.mjs
3117
+ function FromArray7(context, type) {
3118
+ if (IsUniqueItems(type) && !IsDefault(type))
3119
+ throw new CreateError(type, "Arrays with uniqueItems constraints must specify a default annotation");
3120
+ const length = IsMinItems(type) ? type.minItems : 0;
3121
+ return Array.from({ length }, () => FromType7(context, type.items));
3122
+ }
3123
+
3124
+ // node_modules/typebox/build/value/create/from_bigint.mjs
3125
+ function FromBigInt6(_context, type) {
3126
+ return IsExclusiveMinimum(type) ? BigInt(type.exclusiveMinimum) + BigInt(1) : IsMinimum(type) ? BigInt(type.minimum) : BigInt(0);
3127
+ }
3128
+
3129
+ // node_modules/typebox/build/value/create/from_boolean.mjs
3130
+ function FromBoolean6(_context, _type) {
3131
+ return false;
3132
+ }
3133
+
3134
+ // node_modules/typebox/build/value/create/from_constructor.mjs
3135
+ function FromConstructor(context, type) {
3136
+ const instanceType = FromType7(context, type.instanceType);
3137
+ return class {
3138
+ constructor() {
3139
+ Object.assign(this, instanceType);
3140
+ }
3141
+ };
3142
+ }
3143
+
3144
+ // node_modules/typebox/build/value/create/from_cyclic.mjs
3145
+ function FromCyclic6(context, type) {
3146
+ return FromType7({ ...context, ...type.$defs }, Ref(type.$ref));
3147
+ }
3148
+
3149
+ // node_modules/typebox/build/value/create/from_enum.mjs
3150
+ function FromEnum2(context, type) {
3151
+ return FromType7(context, Evaluate(type));
3152
+ }
3153
+
3154
+ // node_modules/typebox/build/value/create/from_function.mjs
3155
+ function FromFunction(context, type) {
3156
+ const returnType = FromType7(context, type.returnType);
3157
+ return () => returnType;
3158
+ }
3159
+
3160
+ // node_modules/typebox/build/value/create/from_integer.mjs
3161
+ function FromInteger2(_context, type) {
3162
+ return IsExclusiveMinimum(type) && guard_exports.IsNumber(type.exclusiveMinimum) ? type.exclusiveMinimum + 1 : IsMinimum(type) ? type.minimum : 0;
3163
+ }
3164
+
3165
+ // node_modules/typebox/build/value/create/from_intersect.mjs
3166
+ function FromIntersect6(context, type) {
3167
+ const instantiated = Instantiate(context, type);
3168
+ const evaluated = Evaluate(instantiated);
3169
+ return FromType7(context, evaluated);
3170
+ }
3171
+
3172
+ // node_modules/typebox/build/value/create/from_literal.mjs
3173
+ function FromLiteral2(_context, type) {
3174
+ return type.const;
3175
+ }
3176
+
3177
+ // node_modules/typebox/build/value/create/from_never.mjs
3178
+ function FromNever(_context, type) {
3179
+ throw new CreateError(type, "Cannot create TNever types");
3180
+ }
3181
+
3182
+ // node_modules/typebox/build/value/create/from_null.mjs
3183
+ function FromNull2(_context, _type) {
3184
+ return null;
3185
+ }
3186
+
3187
+ // node_modules/typebox/build/value/create/from_number.mjs
3188
+ function FromNumber5(_context, type) {
3189
+ return IsExclusiveMinimum(type) && guard_exports.IsNumber(type.exclusiveMinimum) ? type.exclusiveMinimum + 1 : IsMinimum(type) ? type.minimum : 0;
3190
+ }
3191
+
3192
+ // node_modules/typebox/build/value/create/from_object.mjs
3193
+ function FromObject7(context, type) {
3194
+ const required = guard_exports.IsUndefined(type.required) ? [] : type.required;
3195
+ return required.reduce((result, key) => {
3196
+ return { ...result, [key]: FromType7(context, type.properties[key]) };
3197
+ }, {});
3198
+ }
3199
+
3200
+ // node_modules/typebox/build/value/create/from_record.mjs
3201
+ function FromRecord6(_context, type) {
3202
+ if (IsMinProperties(type) && !IsDefault(type))
3203
+ throw new CreateError(type, "Record with the minProperties constraint must have a default annotation");
3204
+ return {};
3205
+ }
3206
+
3207
+ // node_modules/typebox/build/value/create/from_ref.mjs
3208
+ function FromRef6(context, type) {
3209
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType7(context, context[type.$ref]) : (() => {
3210
+ throw new CreateError(type, "Unable to deref Ref");
3211
+ })();
3212
+ }
3213
+
3214
+ // node_modules/typebox/build/value/create/from_string.mjs
3215
+ function FromString7(_context, type) {
3216
+ const needsDefault = (IsPattern(type) || IsFormat(type)) && !IsDefault(type);
3217
+ if (needsDefault)
3218
+ throw Error("Strings with format or pattern constraints must specify default");
3219
+ const minLength = IsMinLength(type) ? type.minLength : 0;
3220
+ return "".padEnd(minLength);
3221
+ }
3222
+
3223
+ // node_modules/typebox/build/value/create/from_symbol.mjs
3224
+ function FromSymbol(_context, _type) {
3225
+ return /* @__PURE__ */ Symbol();
3226
+ }
3227
+
3228
+ // node_modules/typebox/build/value/create/from_template_literal.mjs
3229
+ function FromTemplateLiteral2(context, type) {
3230
+ const decoded = TemplateLiteralDecode(type.pattern);
3231
+ if (IsString(decoded))
3232
+ throw new CreateError(type, "Unable to create TemplateLiteral due to infinite type expansion");
3233
+ return FromType7(context, decoded);
3234
+ }
3235
+
3236
+ // node_modules/typebox/build/value/create/from_tuple.mjs
3237
+ function FromTuple6(context, type) {
3238
+ return Array.from({ length: type.minItems }, (_, i) => FromType7(context, type.items[i]));
3239
+ }
3240
+
3241
+ // node_modules/typebox/build/value/create/from_undefined.mjs
3242
+ function FromUndefined2(_context, _type) {
3243
+ return void 0;
3244
+ }
3245
+
3246
+ // node_modules/typebox/build/value/create/from_union.mjs
3247
+ function FromUnion6(context, type) {
3248
+ if (guard_exports.IsEqual(type.anyOf.length, 0)) {
3249
+ throw Error("Unable to create Union with no variants");
3250
+ }
3251
+ return FromType7(context, type.anyOf[0]);
3252
+ }
3253
+
3254
+ // node_modules/typebox/build/value/create/from_void.mjs
3255
+ function FromVoid2(_context, _type) {
3256
+ return void 0;
3257
+ }
3258
+
3259
+ // node_modules/typebox/build/value/create/from_type.mjs
3260
+ function FromType7(context, type) {
3261
+ return (
3262
+ // -----------------------------------------------------
3263
+ // Default
3264
+ // -----------------------------------------------------
3265
+ IsDefault(type) ? FromDefault2(context, type) : (
3266
+ // -----------------------------------------------------
3267
+ // Types
3268
+ // -----------------------------------------------------
3269
+ IsArray(type) ? FromArray7(context, type) : IsBigInt(type) ? FromBigInt6(context, type) : IsBoolean(type) ? FromBoolean6(context, type) : IsConstructor(type) ? FromConstructor(context, type) : IsCyclic(type) ? FromCyclic6(context, type) : IsEnum(type) ? FromEnum2(context, type) : IsFunction(type) ? FromFunction(context, type) : IsInteger(type) ? FromInteger2(context, type) : IsIntersect(type) ? FromIntersect6(context, type) : IsLiteral(type) ? FromLiteral2(context, type) : IsNever(type) ? FromNever(context, type) : IsNull(type) ? FromNull2(context, type) : IsNumber(type) ? FromNumber5(context, type) : IsObject(type) ? FromObject7(context, type) : IsRecord(type) ? FromRecord6(context, type) : IsRef(type) ? FromRef6(context, type) : IsString(type) ? FromString7(context, type) : IsSymbol(type) ? FromSymbol(context, type) : IsTemplateLiteral(type) ? FromTemplateLiteral2(context, type) : IsTuple(type) ? FromTuple6(context, type) : IsUndefined(type) ? FromUndefined2(context, type) : IsUnion(type) ? FromUnion6(context, type) : IsVoid(type) ? FromVoid2(context, type) : void 0
3270
+ )
3271
+ );
3272
+ }
3273
+
3274
+ // node_modules/typebox/build/value/create/create.mjs
3275
+ function Create(...args) {
3276
+ const [context, type] = arguments_exports.Match(args, {
3277
+ 2: (context2, type2) => [context2, type2],
3278
+ 1: (type2) => [{}, type2]
3279
+ });
3280
+ return FromType7(context, type);
3281
+ }
3282
+
3283
+ // node_modules/typebox/build/value/equal/equal.mjs
3284
+ function Equal(left, right) {
3285
+ return guard_exports.IsDeepEqual(left, right);
3286
+ }
3287
+
3288
+ // node_modules/typebox/build/value/hash/hash.mjs
3289
+ function Hash(value) {
3290
+ return hash_exports.Hash(value);
3291
+ }
3292
+
3293
+ // node_modules/typebox/build/value/parse/parse.mjs
3294
+ var ParseError = class extends AssertError {
3295
+ constructor(value, errors) {
3296
+ super("Parse", value, errors);
3297
+ }
3298
+ };
3299
+ function Assert4(context, type, value) {
3300
+ if (!Check2(context, type, value))
3301
+ throw new ParseError(value, Errors2(context, type, value));
3302
+ return value;
3303
+ }
3304
+ var Parser = Pipeline([
3305
+ (_context, _type, value) => Clone2(value),
3306
+ (context, type, value) => Default(context, type, value),
3307
+ (context, type, value) => Convert(context, type, value),
3308
+ (context, type, value) => Clean(context, type, value),
3309
+ (context, type, value) => Assert4(context, type, value)
3310
+ ]);
3311
+ function Parse(...args) {
3312
+ const [context, type, value] = arguments_exports.Match(args, {
3313
+ 3: (context2, type2, value2) => [context2, type2, value2],
3314
+ 2: (type2, value2) => [{}, type2, value2]
3315
+ });
3316
+ const checked = Check2(context, type, value);
3317
+ if (checked)
3318
+ return value;
3319
+ if (settings_exports.Get().correctiveParse)
3320
+ return Parser(context, type, value);
3321
+ throw new ParseError(value, Errors2(context, type, value));
3322
+ }
3323
+
3324
+ // node_modules/typebox/build/value/delta/diff.mjs
3325
+ function CreateUpdate(path, value) {
3326
+ return { type: "update", path, value };
3327
+ }
3328
+ function CreateInsert(path, value) {
3329
+ return { type: "insert", path, value };
3330
+ }
3331
+ function CreateDelete(path) {
3332
+ return { type: "delete", path };
3333
+ }
3334
+ function AssertCanDiffObject(value) {
3335
+ if (guard_exports.IsObject(value) && guard_exports.IsEqual(guard_exports.Symbols(value).length, 0))
3336
+ return;
3337
+ throw new Error("Cannot create diffs for objects with symbols keys");
3338
+ }
3339
+ function* FromObject8(path, left, right) {
3340
+ if (!guard_exports.IsObject(right) || guard_exports.IsArray(right))
3341
+ return yield CreateUpdate(path, right);
3342
+ AssertCanDiffObject(left);
3343
+ AssertCanDiffObject(right);
3344
+ const leftKeys = guard_exports.Keys(left);
3345
+ const rightKeys = guard_exports.Keys(right);
3346
+ for (const key of rightKeys) {
3347
+ if (guard_exports.HasPropertyKey(left, key))
3348
+ continue;
3349
+ if (guard_exports.IsUnsafePropertyKey(key))
3350
+ continue;
3351
+ yield CreateInsert(`${path}/${key}`, right[key]);
3352
+ }
3353
+ for (const key of leftKeys) {
3354
+ if (!guard_exports.HasPropertyKey(right, key))
3355
+ continue;
3356
+ if (guard_exports.IsUnsafePropertyKey(key))
3357
+ continue;
3358
+ if (Equal(left, right))
3359
+ continue;
3360
+ yield* FromValue2(`${path}/${key}`, left[key], right[key]);
3361
+ }
3362
+ for (const key of leftKeys) {
3363
+ if (guard_exports.HasPropertyKey(right, key))
3364
+ continue;
3365
+ if (guard_exports.IsUnsafePropertyKey(key))
3366
+ continue;
3367
+ yield CreateDelete(`${path}/${key}`);
3368
+ }
3369
+ }
3370
+ function* FromArray8(path, left, right) {
3371
+ if (!guard_exports.IsArray(right))
3372
+ return yield CreateUpdate(path, right);
3373
+ for (let i = 0; i < Math.min(left.length, right.length); i++) {
3374
+ yield* FromValue2(`${path}/${i}`, left[i], right[i]);
3375
+ }
3376
+ for (let i = 0; i < right.length; i++) {
3377
+ if (i < left.length)
3378
+ continue;
3379
+ yield CreateInsert(`${path}/${i}`, right[i]);
3380
+ }
3381
+ for (let i = left.length - 1; i >= 0; i--) {
3382
+ if (i < right.length)
3383
+ continue;
3384
+ yield CreateDelete(`${path}/${i}`);
3385
+ }
3386
+ }
3387
+ function* FromTypedArray(path, left, right) {
3388
+ const typeLeft = globalThis.Object.getPrototypeOf(left).constructor.name;
3389
+ const typeRight = globalThis.Object.getPrototypeOf(right).constructor.name;
3390
+ const predicate = globals_exports.IsTypeArray(right) && guard_exports.IsEqual(left.length, right.length) && guard_exports.IsEqual(typeLeft, typeRight);
3391
+ if (predicate) {
3392
+ for (let index = 0; index < Math.min(left.length, right.length); index++) {
3393
+ yield* FromValue2(`${path}/${index}`, left[index], right[index]);
3394
+ }
3395
+ } else {
3396
+ return yield CreateUpdate(path, right);
3397
+ }
3398
+ }
3399
+ function* FromUnknown(path, left, right) {
3400
+ if (left === right)
3401
+ return;
3402
+ yield CreateUpdate(path, right);
3403
+ }
3404
+ function* FromValue2(path, left, right) {
3405
+ return globals_exports.IsTypeArray(left) ? yield* FromTypedArray(path, left, right) : guard_exports.IsArray(left) ? yield* FromArray8(path, left, right) : guard_exports.IsObject(left) ? yield* FromObject8(path, left, right) : yield* FromUnknown(path, left, right);
3406
+ }
3407
+ function Diff(current, next) {
3408
+ return [...FromValue2("", current, next)];
3409
+ }
3410
+
3411
+ // node_modules/typebox/build/value/delta/edit.mjs
3412
+ var Insert = _Object_({
3413
+ type: Literal("insert"),
3414
+ path: String2(),
3415
+ value: Unknown()
3416
+ });
3417
+ var Update = Object({
3418
+ type: Literal("update"),
3419
+ path: String2(),
3420
+ value: Unknown()
3421
+ });
3422
+ var Delete2 = _Object_({
3423
+ type: Literal("delete"),
3424
+ path: String2()
3425
+ });
3426
+ var Edit = Union([Insert, Update, Delete2]);
3427
+
3428
+ // node_modules/typebox/build/value/delta/patch.mjs
3429
+ function IsRoot(edits) {
3430
+ return edits.length > 0 && edits[0].path === "" && edits[0].type === "update";
3431
+ }
3432
+ function IsEmpty(edits) {
3433
+ return edits.length === 0;
3434
+ }
3435
+ function Patch(current, edits) {
3436
+ if (IsRoot(edits))
3437
+ return Clone2(edits[0].value);
3438
+ if (IsEmpty(edits))
3439
+ return Clone2(current);
3440
+ const clone = Clone2(current);
3441
+ for (const edit of edits) {
3442
+ switch (edit.type) {
3443
+ case "insert": {
3444
+ pointer_exports.Set(clone, edit.path, edit.value);
3445
+ break;
3446
+ }
3447
+ case "update": {
3448
+ pointer_exports.Set(clone, edit.path, edit.value);
3449
+ break;
3450
+ }
3451
+ case "delete": {
3452
+ pointer_exports.Delete(clone, edit.path);
3453
+ break;
3454
+ }
3455
+ }
3456
+ }
3457
+ return clone;
3458
+ }
3459
+
3460
+ // node_modules/typebox/build/value/repair/error.mjs
3461
+ var RepairError = class extends Error {
3462
+ constructor(context, type, value, message) {
3463
+ super(message);
3464
+ this.context = context;
3465
+ this.type = type;
3466
+ this.value = value;
3467
+ }
3468
+ };
3469
+
3470
+ // node_modules/typebox/build/value/repair/from_array.mjs
3471
+ function MakeUnique(values) {
3472
+ const [hashes, result] = [/* @__PURE__ */ new Set(), []];
3473
+ for (const value of values) {
3474
+ const hash = Hash(value);
3475
+ if (hashes.has(hash))
3476
+ continue;
3477
+ hashes.add(hash);
3478
+ result.push(value);
3479
+ }
3480
+ return result;
3481
+ }
3482
+ function FromArray9(context, type, value) {
3483
+ if (Check2(context, type, value))
3484
+ return value;
3485
+ const created = guard_exports.IsArray(value) ? value : Create(context, type);
3486
+ const minimum = IsMinItems(type) && created.length < type.minItems ? [...created, ...Array.from({ length: type.minItems - created.length }, () => Create(context, type))] : created;
3487
+ const maximum = IsMaxItems(type) && minimum.length > type.maxItems ? minimum.slice(0, type.maxItems) : minimum;
3488
+ const repaired = maximum.map((value2) => FromType8(context, type.items, value2));
3489
+ if (!IsUniqueItems(type) || IsUniqueItems(type) && !guard_exports.IsEqual(type.uniqueItems, true))
3490
+ return repaired;
3491
+ const unique = MakeUnique(repaired);
3492
+ if (!Check2(context, type, unique))
3493
+ throw new RepairError(context, type, value, "Failed to repair Array due to uniqueItems constraint");
3494
+ return unique;
3495
+ }
3496
+
3497
+ // node_modules/typebox/build/value/repair/from_enum.mjs
3498
+ function FromEnum3(context, type, value) {
3499
+ return FromType8(context, Evaluate(type), value);
3500
+ }
3501
+
3502
+ // node_modules/typebox/build/value/repair/from_intersect.mjs
3503
+ function FromIntersect7(context, type, value) {
3504
+ const instantiated = Instantiate(context, type);
3505
+ const evaluated = Evaluate(instantiated);
3506
+ return FromType8(context, evaluated, value);
3507
+ }
3508
+
3509
+ // node_modules/typebox/build/value/repair/from_object.mjs
3510
+ function FromObject9(context, type, value) {
3511
+ if (Check2(context, type, value))
3512
+ return value;
3513
+ if (!guard_exports.IsObjectNotArray(value))
3514
+ return Create(context, type);
3515
+ const required = new Set(guard_exports.IsUndefined(type.required) ? [] : type.required);
3516
+ const result = {};
3517
+ for (const [key, schema] of guard_exports.Entries(type.properties)) {
3518
+ if (!required.has(key) && guard_exports.IsUndefined(value[key]))
3519
+ continue;
3520
+ result[key] = key in value ? FromType8(context, schema, value[key]) : Create(context, schema);
3521
+ }
3522
+ const evaluatedKeys = guard_exports.Keys(type.properties);
3523
+ if (IsAdditionalProperties(type) && guard_exports.IsObject(type.additionalProperties)) {
3524
+ for (const key of guard_exports.Keys(value)) {
3525
+ if (evaluatedKeys.includes(key))
3526
+ continue;
3527
+ result[key] = FromType8(context, type.additionalProperties, value[key]);
3528
+ }
3529
+ }
3530
+ return result;
3531
+ }
3532
+
3533
+ // node_modules/typebox/build/value/repair/from_record.mjs
3534
+ function FromRecord7(context, type, value) {
3535
+ if (Check2(context, type, value))
3536
+ return value;
3537
+ if (guard_exports.IsNull(value) || !guard_exports.IsObject(value) || guard_exports.IsArray(value))
3538
+ return Create(context, type);
3539
+ const recordKey = new RegExp(RecordPattern(type));
3540
+ const recordValue = RecordValue(type);
3541
+ const evaluatedKeys = /* @__PURE__ */ new Set();
3542
+ const result = {};
3543
+ for (const [key, value_] of guard_exports.Entries(value)) {
3544
+ if (!recordKey.test(key))
3545
+ continue;
3546
+ result[key] = FromType8(context, recordValue, value_);
3547
+ evaluatedKeys.add(key);
3548
+ }
3549
+ if (IsAdditionalProperties(type)) {
3550
+ for (const key of guard_exports.Keys(value)) {
3551
+ if (evaluatedKeys.has(key))
3552
+ continue;
3553
+ result[key] = FromType8(context, type.additionalProperties, value[key]);
3554
+ }
3555
+ }
3556
+ return result;
3557
+ }
3558
+
3559
+ // node_modules/typebox/build/value/repair/from_ref.mjs
3560
+ function FromRef7(context, type, value) {
3561
+ return guard_exports.HasPropertyKey(context, type.$ref) ? FromType8(context, context[type.$ref], value) : (() => {
3562
+ throw new RepairError(context, type, value, "Unable to de-reference target type");
3563
+ })();
3564
+ }
3565
+
3566
+ // node_modules/typebox/build/value/repair/from_template_literal.mjs
3567
+ function FromTemplateLiteral3(context, type, value) {
3568
+ const decoded = TemplateLiteralDecode(type.pattern);
3569
+ return FromType8(context, decoded, value);
3570
+ }
3571
+
3572
+ // node_modules/typebox/build/value/repair/from_tuple.mjs
3573
+ function FromTuple7(context, schema, value) {
3574
+ if (Check2(context, schema, value))
3575
+ return value;
3576
+ if (!guard_exports.IsArray(value))
3577
+ return Create(context, schema);
3578
+ return schema.items.map((schema2, index) => FromType8(context, schema2, value[index]));
3579
+ }
3580
+
3581
+ // node_modules/typebox/build/value/shared/union_score_select.mjs
3582
+ function Deref(context, type, value) {
3583
+ return IsRef(type) ? guard_exports.HasPropertyKey(context, type.$ref) ? Deref(context, context[type.$ref], value) : (() => {
3584
+ throw new Error("Unable to Deref target");
3585
+ })() : type;
3586
+ }
3587
+ function ScoreVariant(context, type, value) {
3588
+ if (!(IsObject(type) && guard_exports.IsObject(value)))
3589
+ return 0;
3590
+ const keys = guard_exports.Keys(value);
3591
+ const entries = guard_exports.Entries(type.properties);
3592
+ return entries.reduce((result, [key, schema]) => {
3593
+ const literal = IsLiteral(schema) && guard_exports.IsEqual(schema.const, value[key]) ? 100 : 0;
3594
+ const checks = Check2(context, schema, value[key]) ? 10 : 0;
3595
+ const exists = keys.includes(key) ? 1 : 0;
3596
+ return result + (literal + checks + exists);
3597
+ }, 0);
3598
+ }
3599
+ function UnionScoreSelect(context, type, value) {
3600
+ const schemas = type.anyOf.map((schema) => Deref(context, schema, value));
3601
+ let [select, best] = [schemas[0], 0];
3602
+ for (const schema of schemas) {
3603
+ const score = ScoreVariant(context, schema, value);
3604
+ if (score > best) {
3605
+ select = schema;
3606
+ best = score;
3607
+ }
3608
+ }
3609
+ return select;
3610
+ }
3611
+
3612
+ // node_modules/typebox/build/value/repair/from_union.mjs
3613
+ function RepairUnion(context, type, value) {
3614
+ const union = Union(Flatten(type.anyOf));
3615
+ const schema = UnionScoreSelect(context, union, value);
3616
+ return FromType8(context, schema, value);
3617
+ }
3618
+ function FromUnion7(context, type, value) {
3619
+ if (Check2(context, type, value))
3620
+ return Clone2(value);
3621
+ if (IsDefault(type))
3622
+ return Create(context, type);
3623
+ return RepairUnion(context, type, value);
3624
+ }
3625
+
3626
+ // node_modules/typebox/build/value/repair/from_unknown.mjs
3627
+ function FromUnknown2(context, type, value) {
3628
+ if (Check2(context, type, value))
3629
+ return value;
3630
+ const converted = Convert(context, type, value);
3631
+ if (Check2(context, type, converted))
3632
+ return converted;
3633
+ return Create(context, type);
3634
+ }
3635
+
3636
+ // node_modules/typebox/build/value/repair/from_type.mjs
3637
+ function AssertRepairableValue(context, type, value) {
3638
+ const unsupported = globals_exports.IsDate(value) || globals_exports.IsMap(value) || globals_exports.IsSet(value) || globals_exports.IsTypeArray(value) || guard_exports.IsConstructor(value) || guard_exports.IsFunction(value);
3639
+ if (unsupported) {
3640
+ throw new RepairError(context, type, value, "Value is not repairable");
3641
+ }
3642
+ }
3643
+ function AssertRepairableType(context, type, value) {
3644
+ const unsupported = IsConstructor(type) || IsFunction(type) || IsNever(type);
3645
+ if (unsupported) {
3646
+ throw new RepairError(context, type, value, "Type is not repairable");
3647
+ }
3648
+ }
3649
+ function CreateWhenUndefined(context, type, value) {
3650
+ return guard_exports.IsUndefined(value) && !IsUndefined(type) ? Create(context, type) : value;
3651
+ }
3652
+ function FinalizeRepair(context, type, repaired) {
3653
+ return IsRefine(type) ? Check2(context, type, repaired) ? repaired : Create(context, type) : repaired;
3654
+ }
3655
+ function FromType8(context, type, value) {
3656
+ AssertRepairableValue(context, type, value);
3657
+ AssertRepairableType(context, type, value);
3658
+ const candidate = CreateWhenUndefined(context, type, value);
3659
+ const repaired = IsArray(type) ? FromArray9(context, type, candidate) : IsEnum(type) ? FromEnum3(context, type, candidate) : IsIntersect(type) ? FromIntersect7(context, type, candidate) : IsObject(type) ? FromObject9(context, type, candidate) : IsRecord(type) ? FromRecord7(context, type, candidate) : IsRef(type) ? FromRef7(context, type, candidate) : IsTemplateLiteral(type) ? FromTemplateLiteral3(context, type, candidate) : IsTuple(type) ? FromTuple7(context, type, candidate) : IsUnion(type) ? FromUnion7(context, type, candidate) : FromUnknown2(context, type, candidate);
3660
+ return FinalizeRepair(context, type, repaired);
3661
+ }
3662
+
3663
+ // node_modules/typebox/build/value/repair/repair.mjs
3664
+ function Repair(...args) {
3665
+ const [context, type, value] = arguments_exports.Match(args, {
3666
+ 3: (context2, type2, value2) => [context2, type2, value2],
3667
+ 2: (type2, value2) => [{}, type2, value2]
3668
+ });
3669
+ const repaired = FromType8(context, type, value);
3670
+ Assert(context, type, repaired);
3671
+ return repaired;
3672
+ }
3673
+
3674
+ // node_modules/typebox/build/value/value.mjs
3675
+ var value_exports = {};
3676
+ __export(value_exports, {
3677
+ Assert: () => Assert,
3678
+ Check: () => Check2,
3679
+ Clean: () => Clean,
3680
+ Clone: () => Clone2,
3681
+ Convert: () => Convert,
3682
+ Create: () => Create,
3683
+ Decode: () => Decode9,
3684
+ Default: () => Default,
3685
+ Diff: () => Diff,
3686
+ Encode: () => Encode9,
3687
+ Equal: () => Equal,
3688
+ Errors: () => Errors2,
3689
+ HasCodec: () => HasCodec,
3690
+ Hash: () => Hash,
3691
+ Parse: () => Parse,
3692
+ Patch: () => Patch,
3693
+ Pointer: () => pointer_exports,
3694
+ Repair: () => Repair
3695
+ });
3696
+
3697
+ // node_modules/typebox/build/value/index.mjs
3698
+ var value_default = value_exports;
3699
+ export {
3700
+ Assert,
3701
+ AssertError,
3702
+ Check2 as Check,
3703
+ Clean,
3704
+ Clone2 as Clone,
3705
+ Convert,
3706
+ Create,
3707
+ CreateError,
3708
+ Decode9 as Decode,
3709
+ DecodeError,
3710
+ DecodeUnsafe,
3711
+ Default,
3712
+ Delete2 as Delete,
3713
+ Diff,
3714
+ Edit,
3715
+ Encode9 as Encode,
3716
+ EncodeError,
3717
+ EncodeUnsafe,
3718
+ Equal,
3719
+ Errors2 as Errors,
3720
+ HasCodec,
3721
+ Hash,
3722
+ Insert,
3723
+ IsOptionalUndefined,
3724
+ Parse,
3725
+ ParseError,
3726
+ Parser,
3727
+ Patch,
3728
+ Pipeline,
3729
+ pointer_exports as Pointer,
3730
+ Repair,
3731
+ UnionPrioritySort,
3732
+ UnionScoreSelect,
3733
+ Update,
3734
+ value_exports as Value,
3735
+ value_default as default
3736
+ };