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