@agntn/tools 0.3.0 → 0.3.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.
@@ -87,12 +87,6 @@ function IsMultipleOf$1(dividend, divisor) {
87
87
  const mod = dividend % divisor;
88
88
  return Math.min(Math.abs(mod), Math.abs(mod - divisor), Math.abs(mod + divisor)) < tolerance;
89
89
  }
90
- function IsClassInstance(value) {
91
- if (!IsObject$1(value)) return false;
92
- const proto = globalThis.Object.getPrototypeOf(value);
93
- if (IsNull$1(proto)) return false;
94
- return IsEqual(typeof proto.constructor, "function") && !(IsEqual(proto.constructor, globalThis.Object) || IsEqual(proto.constructor.name, "Object"));
95
- }
96
90
  function IsValueLike(value) {
97
91
  return IsBigInt$1(value) || IsBoolean$2(value) || IsNull$1(value) || IsNumber$2(value) || IsString$2(value) || IsUndefined$1(value);
98
92
  }
@@ -137,7 +131,7 @@ function HasPropertyKey(value, key) {
137
131
  function Entries(value) {
138
132
  return Object.entries(value);
139
133
  }
140
- function Keys(value) {
134
+ function Keys$1(value) {
141
135
  return Object.getOwnPropertyNames(value);
142
136
  }
143
137
  function Symbols(value) {
@@ -148,8 +142,8 @@ function Values(value) {
148
142
  }
149
143
  function DeepEqualObject(left, right) {
150
144
  if (!IsObject$1(right)) return false;
151
- const keys = Keys(left);
152
- return IsEqual(keys.length, Keys(right).length) && keys.every((key) => IsDeepEqual(left[key], right[key]));
145
+ const keys = Keys$1(left);
146
+ return IsEqual(keys.length, Keys$1(right).length) && keys.every((key) => IsDeepEqual(left[key], right[key]));
153
147
  }
154
148
  function DeepEqualArray(left, right) {
155
149
  return IsArray$1(right) && IsEqual(left.length, right.length) && left.every((_, index) => IsDeepEqual(left[index], right[index]));
@@ -175,12 +169,6 @@ function IsRegExp(value) {
175
169
  function IsDate$1(value) {
176
170
  return value instanceof globalThis.Date;
177
171
  }
178
- function IsSet(value) {
179
- return value instanceof globalThis.Set;
180
- }
181
- function IsMap(value) {
182
- return value instanceof globalThis.Map;
183
- }
184
172
  const settings = {
185
173
  immutableTypes: false,
186
174
  maxErrors: 8,
@@ -195,68 +183,41 @@ const settings = {
195
183
  function Get$2() {
196
184
  return settings;
197
185
  }
198
- function Freeze(value) {
199
- return Get$2().immutableTypes ? Object.freeze(value) : value;
200
- }
201
- function Assign(left, right) {
202
- Metrics.assign += 1;
203
- return Freeze({
204
- ...left,
205
- ...right
206
- });
207
- }
208
- function FromClassInstance(value) {
209
- return value;
210
- }
211
- function IsSchemaObject$1(value) {
212
- return HasPropertyKey(value, "~kind") || HasPropertyKey(value, "~unsafe");
186
+ function Keys(value) {
187
+ return [...Keys$1(value), ...Symbols(value)];
213
188
  }
214
- function FromSchemaObject(value) {
215
- const result = {};
189
+ function Freeze(value, seen) {
190
+ if (seen.has(value)) return;
191
+ seen.add(value);
216
192
  for (const key of Keys(value)) {
217
- if (IsUnsafePropertyKey(key)) continue;
218
193
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
219
- descriptor.value = FromValue$1(descriptor.value);
220
- if (IsEqual(descriptor.enumerable, true)) result[key] = descriptor.value;
221
- else Object.defineProperty(result, key, descriptor);
222
- }
223
- return result;
224
- }
225
- function FromPlainObject(value) {
226
- const result = {};
227
- for (const key of Keys(value)) {
228
- if (IsUnsafePropertyKey(key)) continue;
229
- result[key] = FromValue$1(value[key]);
194
+ if (!descriptor || !("value" in descriptor)) continue;
195
+ if (IsObject$1(descriptor.value)) Freeze(descriptor.value, seen);
230
196
  }
231
- for (const key of Symbols(value)) result[key] = FromValue$1(value[key]);
232
- return result;
233
- }
234
- function FromObject$12(value) {
235
- return IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject$1(value) ? FromSchemaObject(value) : FromPlainObject(value);
236
- }
237
- function FromArray$8(value) {
238
- return value.map((element) => FromValue$1(element));
239
- }
240
- function FromTypedArray(value) {
241
- return value.slice();
242
- }
243
- function FromRegExp$1(value) {
244
- return new RegExp(value.source, value.flags);
245
- }
246
- function FromMap(value) {
247
- return new Map(FromValue$1([...value.entries()]));
197
+ Object.freeze(value);
248
198
  }
249
- function FromSet(value) {
250
- return new Set(FromValue$1([...value.values()]));
199
+ function Finalize(value) {
200
+ if (!Get$2().immutableTypes) return value;
201
+ Freeze(value, /* @__PURE__ */ new WeakSet());
202
+ return value;
251
203
  }
252
- function FromValue$1(value) {
253
- return IsTypeArray(value) ? FromTypedArray(value) : IsRegExp(value) ? FromRegExp$1(value) : IsMap(value) ? FromMap(value) : IsSet(value) ? FromSet(value) : IsArray$1(value) ? FromArray$8(value) : IsObject$1(value) ? FromObject$12(value) : value;
204
+ function Assign(left, right) {
205
+ Metrics.assign += 1;
206
+ const result = {}, rightKeys = Keys(right), leftKeys = Keys(left);
207
+ for (const key of leftKeys) {
208
+ if (rightKeys.includes(key)) continue;
209
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(left, key));
210
+ }
211
+ for (const key of rightKeys) Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(right, key));
212
+ return Finalize(result);
254
213
  }
255
- function Clone$1(value) {
256
- Metrics.clone += 1;
257
- return FromValue$1(value);
214
+ function WithEnumerable$1(left, right) {
215
+ return {
216
+ ...left,
217
+ ...right
218
+ };
258
219
  }
259
- function MergeHidden(left, right) {
220
+ function WithHidden$1(left, right) {
260
221
  for (const key of Object.keys(right)) Object.defineProperty(left, key, {
261
222
  configurable: true,
262
223
  writable: true,
@@ -265,16 +226,10 @@ function MergeHidden(left, right) {
265
226
  });
266
227
  return left;
267
228
  }
268
- function Merge(left, right) {
269
- return {
270
- ...left,
271
- ...right
272
- };
273
- }
274
229
  function Create(hidden, enumerable, options = {}) {
275
230
  Metrics.create += 1;
276
- const withOptions = Merge(enumerable, options);
277
- return Freeze(Get$2().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden));
231
+ const withEnumerable = WithEnumerable$1(enumerable, options);
232
+ return Finalize(Get$2().enumerableKind ? WithEnumerable$1(withEnumerable, hidden) : WithHidden$1(withEnumerable, hidden));
278
233
  }
279
234
  function Discard(value, propertyKeys) {
280
235
  Metrics.discard += 1;
@@ -282,28 +237,47 @@ function Discard(value, propertyKeys) {
282
237
  for (const key of Keys(value)) {
283
238
  if (propertyKeys.includes(key)) continue;
284
239
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
285
- descriptor.value = Clone$1(descriptor.value);
286
240
  Object.defineProperty(result, key, descriptor);
287
241
  }
288
- return Freeze(result);
242
+ return Finalize(result);
243
+ }
244
+ function WithCurrent(current, hiddenKeys, enumerableKeys, result) {
245
+ for (const key of Keys(current)) {
246
+ if (IsUnsafePropertyKey(key) || hiddenKeys.includes(key) || enumerableKeys.includes(key)) continue;
247
+ const descriptor = Object.getOwnPropertyDescriptor(current, key);
248
+ Object.defineProperty(result, key, descriptor);
249
+ }
250
+ }
251
+ function WithHidden(hidden, keys, result) {
252
+ const enumerableKind = Get$2().enumerableKind;
253
+ for (const key of keys) {
254
+ if (IsUnsafePropertyKey(key)) continue;
255
+ Object.defineProperty(result, key, {
256
+ configurable: true,
257
+ writable: true,
258
+ enumerable: enumerableKind,
259
+ value: hidden[key]
260
+ });
261
+ }
262
+ }
263
+ function WithEnumerable(enumerable, keys, result) {
264
+ for (const key of keys) {
265
+ if (IsUnsafePropertyKey(key)) continue;
266
+ Object.defineProperty(result, key, {
267
+ configurable: true,
268
+ enumerable: true,
269
+ writable: true,
270
+ value: enumerable[key]
271
+ });
272
+ }
289
273
  }
290
274
  function Update$1(current, hidden, enumerable) {
291
275
  Metrics.update += 1;
292
- const settings = Get$2();
293
- const result = Clone$1(current);
294
- for (const key of Object.keys(hidden)) Object.defineProperty(result, key, {
295
- configurable: true,
296
- writable: true,
297
- enumerable: settings.enumerableKind,
298
- value: hidden[key]
299
- });
300
- for (const key of Object.keys(enumerable)) Object.defineProperty(result, key, {
301
- configurable: true,
302
- enumerable: true,
303
- writable: true,
304
- value: enumerable[key]
305
- });
306
- return Freeze(result);
276
+ const result = {}, hiddenKeys = Keys(hidden), enumerableKeys = Keys(enumerable);
277
+ WithCurrent(current, hiddenKeys, enumerableKeys, result);
278
+ WithHidden(hidden, hiddenKeys, result);
279
+ WithEnumerable(enumerable, enumerableKeys, result);
280
+ return Finalize(result);
307
281
  }
308
282
  function IsKind(value, kind) {
309
283
  return IsObject$1(value) && HasPropertyKey(value, "~kind") && IsEqual(value["~kind"], kind);
@@ -322,20 +296,14 @@ function Deferred(action, parameters, options) {
322
296
  function IsDeferred(value) {
323
297
  return IsKind(value, "Deferred");
324
298
  }
325
- function AddReadonlyOperation(type) {
326
- return Update$1(type, { "~readonly": true }, {});
327
- }
328
299
  function AddReadonlyAction(type, options) {
329
- return Update$1(AddReadonlyOperation(type), {}, options);
300
+ return Update$1(type, { "~readonly": true }, options);
330
301
  }
331
302
  function AddReadonlyInstantiate(context, state, type, options) {
332
303
  return AddReadonlyAction(InstantiateType(context, state, type), options);
333
304
  }
334
- function AddOptionalOperation(type) {
335
- return Update$1(type, { "~optional": true }, {});
336
- }
337
305
  function AddOptionalAction(type, options) {
338
- return Update$1(AddOptionalOperation(type), {}, options);
306
+ return Update$1(type, { "~optional": true }, options);
339
307
  }
340
308
  function AddOptionalInstantiate(context, state, type, options) {
341
309
  return AddOptionalAction(InstantiateType(context, state, type), options);
@@ -434,10 +402,10 @@ function IsOptional(value) {
434
402
  return IsSchema$1(value) && HasPropertyKey(value, "~optional");
435
403
  }
436
404
  function RequiredArray(properties) {
437
- return Keys(properties).filter((key) => !IsOptional(properties[key]));
405
+ return Keys$1(properties).filter((key) => !IsOptional(properties[key]));
438
406
  }
439
407
  function PropertyKeys(properties) {
440
- return Keys(properties);
408
+ return Keys$1(properties);
441
409
  }
442
410
  function PropertyValues(properties) {
443
411
  return Values(properties);
@@ -468,7 +436,7 @@ function IsUnknown(value) {
468
436
  return IsKind(value, "Unknown");
469
437
  }
470
438
  function Cyclic($defs, $ref, options) {
471
- const defs = Keys($defs).reduce((result, key) => {
439
+ const defs = Keys$1($defs).reduce((result, key) => {
472
440
  return {
473
441
  ...result,
474
442
  [key]: Update$1($defs[key], {}, { $id: key })
@@ -544,7 +512,7 @@ function IsTypeScriptEnumLike(value) {
544
512
  return IsObjectNotArray(value);
545
513
  }
546
514
  function TypeScriptEnumToEnumValues(type) {
547
- return Keys(type).filter((key) => isNaN(key)).reduce((result, key) => [...result, type[key]], []);
515
+ return Keys$1(type).filter((key) => isNaN(key)).reduce((result, key) => [...result, type[key]], []);
548
516
  }
549
517
  function IsEnumValue(value) {
550
518
  return IsString$2(value) || IsNumber$2(value);
@@ -579,36 +547,43 @@ function InstanceKeys(value) {
579
547
  function IsIEEE754(value) {
580
548
  return typeof value === "number";
581
549
  }
582
- var ByteMarker;
583
- (function(ByteMarker) {
584
- ByteMarker[ByteMarker["Array"] = 0] = "Array";
585
- ByteMarker[ByteMarker["BigInt"] = 1] = "BigInt";
586
- ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean";
587
- ByteMarker[ByteMarker["Date"] = 3] = "Date";
588
- ByteMarker[ByteMarker["Constructor"] = 4] = "Constructor";
589
- ByteMarker[ByteMarker["Function"] = 5] = "Function";
590
- ByteMarker[ByteMarker["Null"] = 6] = "Null";
591
- ByteMarker[ByteMarker["Number"] = 7] = "Number";
592
- ByteMarker[ByteMarker["Object"] = 8] = "Object";
593
- ByteMarker[ByteMarker["RegExp"] = 9] = "RegExp";
594
- ByteMarker[ByteMarker["String"] = 10] = "String";
595
- ByteMarker[ByteMarker["Symbol"] = 11] = "Symbol";
596
- ByteMarker[ByteMarker["TypeArray"] = 12] = "TypeArray";
597
- ByteMarker[ByteMarker["Undefined"] = 13] = "Undefined";
598
- })(ByteMarker || (ByteMarker = {}));
599
- let Accumulator = BigInt("14695981039346656037");
600
- const [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
601
- const Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
550
+ const ByteMarker = {
551
+ Array: 0,
552
+ BigInt: 1,
553
+ Boolean: 2,
554
+ Date: 3,
555
+ Constructor: 4,
556
+ Function: 5,
557
+ Null: 6,
558
+ Number: 7,
559
+ Object: 8,
560
+ RegExp: 9,
561
+ String: 10,
562
+ Symbol: 11,
563
+ TypeArray: 12,
564
+ Undefined: 13
565
+ };
566
+ let A0 = 8997;
567
+ let A1 = 33826;
568
+ let A2 = 40164;
569
+ let A3 = 52210;
602
570
  const F64 = /* @__PURE__ */ new Float64Array(1);
603
571
  const F64In = new DataView(F64.buffer);
604
572
  const F64Out = new Uint8Array(F64.buffer);
605
573
  function FNV1A64_OP(byte) {
606
- Accumulator = Accumulator ^ Bytes[byte];
607
- Accumulator = Accumulator * Prime % Size;
574
+ const L0 = A0 ^ byte;
575
+ const T0 = L0 * 435;
576
+ const T1 = A1 * 435 + (T0 >>> 16);
577
+ const T2 = A2 * 435 + (T1 >>> 16) + (L0 << 8);
578
+ const T3 = A3 * 435 + (T2 >>> 16) + (A1 << 8);
579
+ A0 = T0 & 65535;
580
+ A1 = T1 & 65535;
581
+ A2 = T2 & 65535;
582
+ A3 = T3 & 65535;
608
583
  }
609
- function FromArray$7(value) {
584
+ function FromArray$8(value) {
610
585
  FNV1A64_OP(ByteMarker.Array);
611
- for (const item of value) FromValue(item);
586
+ for (const item of value) FromValue$1(item);
612
587
  }
613
588
  function FromBigInt$5(value) {
614
589
  FNV1A64_OP(ByteMarker.BigInt);
@@ -621,15 +596,15 @@ function FromBoolean$5(value) {
621
596
  }
622
597
  function FromConstructor(value) {
623
598
  FNV1A64_OP(ByteMarker.Constructor);
624
- FromValue(value.toString());
599
+ FromValue$1(value.toString());
625
600
  }
626
601
  function FromDate(value) {
627
602
  FNV1A64_OP(ByteMarker.Date);
628
- FromValue(value.getTime());
603
+ FromValue$1(value.getTime());
629
604
  }
630
605
  function FromFunction(value) {
631
606
  FNV1A64_OP(ByteMarker.Function);
632
- FromValue(value.toString());
607
+ FromValue$1(value.toString());
633
608
  }
634
609
  function FromNull$1(_value) {
635
610
  FNV1A64_OP(ByteMarker.Null);
@@ -639,25 +614,32 @@ function FromNumber$4(value) {
639
614
  F64In.setFloat64(0, value, true);
640
615
  for (const byte of F64Out) FNV1A64_OP(byte);
641
616
  }
642
- function FromObject$11(value) {
617
+ function FromObject$12(value) {
643
618
  FNV1A64_OP(ByteMarker.Object);
644
619
  for (const key of InstanceKeys(value).sort()) {
645
- FromValue(key);
646
- FromValue(value[key]);
620
+ FromValue$1(key);
621
+ FromValue$1(value[key]);
647
622
  }
648
623
  }
649
- function FromRegExp(value) {
624
+ function FromRegExp$1(value) {
650
625
  FNV1A64_OP(ByteMarker.RegExp);
651
626
  FromString$6(value.toString());
652
627
  }
653
628
  const encoder = new TextEncoder();
654
629
  function FromString$6(value) {
655
630
  FNV1A64_OP(ByteMarker.String);
656
- for (const byte of encoder.encode(value)) FNV1A64_OP(byte);
631
+ for (let i = 0; i < value.length; i++) {
632
+ const code = value.charCodeAt(i);
633
+ if (code > 127) {
634
+ for (const byte of encoder.encode(value.slice(i))) FNV1A64_OP(byte);
635
+ return;
636
+ }
637
+ FNV1A64_OP(code);
638
+ }
657
639
  }
658
640
  function FromSymbol(value) {
659
641
  FNV1A64_OP(ByteMarker.Symbol);
660
- FromValue(value.toString());
642
+ FromValue$1(value.toString());
661
643
  }
662
644
  function FromTypeArray(value) {
663
645
  FNV1A64_OP(ByteMarker.TypeArray);
@@ -667,16 +649,16 @@ function FromTypeArray(value) {
667
649
  function FromUndefined$1(_value) {
668
650
  return FNV1A64_OP(ByteMarker.Undefined);
669
651
  }
670
- function FromValue(value) {
671
- return IsTypeArray(value) ? FromTypeArray(value) : IsDate$1(value) ? FromDate(value) : IsRegExp(value) ? FromRegExp(value) : IsBoolean$1(value) ? FromBoolean$5(value.valueOf()) : IsString$1(value) ? FromString$6(value.valueOf()) : IsNumber$1(value) ? FromNumber$4(value.valueOf()) : IsIEEE754(value) ? FromNumber$4(value) : IsArray$1(value) ? FromArray$7(value) : IsBoolean$2(value) ? FromBoolean$5(value) : IsBigInt$1(value) ? FromBigInt$5(value) : IsConstructor$1(value) ? FromConstructor(value) : IsNull$1(value) ? FromNull$1(value) : IsObject$1(value) ? FromObject$11(value) : IsString$2(value) ? FromString$6(value) : IsSymbol$1(value) ? FromSymbol(value) : IsUndefined$1(value) ? FromUndefined$1(value) : IsFunction$1(value) ? FromFunction(value) : Unreachable$1();
652
+ function FromValue$1(value) {
653
+ return IsTypeArray(value) ? FromTypeArray(value) : IsDate$1(value) ? FromDate(value) : IsRegExp(value) ? FromRegExp$1(value) : IsBoolean$1(value) ? FromBoolean$5(value.valueOf()) : IsString$1(value) ? FromString$6(value.valueOf()) : IsNumber$1(value) ? FromNumber$4(value.valueOf()) : IsIEEE754(value) ? FromNumber$4(value) : IsArray$1(value) ? FromArray$8(value) : IsBoolean$2(value) ? FromBoolean$5(value) : IsBigInt$1(value) ? FromBigInt$5(value) : IsConstructor$1(value) ? FromConstructor(value) : IsNull$1(value) ? FromNull$1(value) : IsObject$1(value) ? FromObject$12(value) : IsString$2(value) ? FromString$6(value) : IsSymbol$1(value) ? FromSymbol(value) : IsUndefined$1(value) ? FromUndefined$1(value) : IsFunction$1(value) ? FromFunction(value) : Unreachable$1();
672
654
  }
673
- function HashCode(value) {
674
- Accumulator = BigInt("14695981039346656037");
675
- FromValue(value);
676
- return Accumulator;
655
+ function Hex(limb) {
656
+ return limb.toString(16).padStart(4, "0");
677
657
  }
678
658
  function Hash(value) {
679
- return HashCode(value).toString(16).padStart(16, "0");
659
+ A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210;
660
+ FromValue$1(value);
661
+ return `${Hex(A3)}${Hex(A2)}${Hex(A1)}${Hex(A0)}`;
680
662
  }
681
663
  function en_US(error) {
682
664
  switch (error.keyword) {
@@ -1027,20 +1009,16 @@ function TupleOptions(type) {
1027
1009
  "additionalItems"
1028
1010
  ]);
1029
1011
  }
1030
- function RemoveReadonlyOperation(type) {
1031
- return Discard(type, ["~readonly"]);
1032
- }
1033
- function RemoveReadonlyAction(type, options) {
1034
- return Update$1(RemoveReadonlyOperation(type), {}, options);
1035
- }
1036
- function RemoveReadonlyInstantiate(context, state, type, options) {
1037
- return RemoveReadonlyAction(InstantiateType(context, state, type), options);
1038
- }
1039
- function RemoveReadonlyDeferred(type, options = {}) {
1040
- return Deferred("RemoveReadonly", [type], options);
1012
+ function TupleElementsToProperties(types) {
1013
+ return types.reduceRight((result, right, index) => {
1014
+ return {
1015
+ [index]: right,
1016
+ ...result
1017
+ };
1018
+ }, {});
1041
1019
  }
1042
- function RemoveReadonly(type, options = {}) {
1043
- return RemoveReadonlyAction(type, options);
1020
+ function TupleToObject(type) {
1021
+ return _Object_$1(TupleElementsToProperties(type.items));
1044
1022
  }
1045
1023
  function RemoveOptionalOperation(type) {
1046
1024
  return Discard(type, ["~optional"]);
@@ -1051,43 +1029,32 @@ function RemoveOptionalAction(type, options) {
1051
1029
  function RemoveOptionalInstantiate(context, state, type, options) {
1052
1030
  return RemoveOptionalAction(InstantiateType(context, state, type), options);
1053
1031
  }
1054
- function RemoveOptionalDeferred(type, options = {}) {
1055
- return Deferred("RemoveOptional", [type], options);
1056
- }
1057
- function RemoveOptional(type, options = {}) {
1058
- return RemoveOptionalAction(type, options);
1059
- }
1060
- function TupleElementsToProperties(types) {
1061
- return types.reduceRight((result, right, index) => {
1062
- return {
1063
- [index]: right,
1064
- ...result
1065
- };
1066
- }, {});
1067
- }
1068
- function TupleToObject(type) {
1069
- return _Object_$1(TupleElementsToProperties(type.items));
1032
+ function RemoveReadonlyOperation(type) {
1033
+ return Discard(type, ["~readonly"]);
1070
1034
  }
1071
- function CanComposite(type) {
1072
- return IsObject(type) || IsTuple(type);
1035
+ function RemoveReadonlyAction(type, options) {
1036
+ return Update$1(RemoveReadonlyOperation(type), {}, options);
1073
1037
  }
1074
- function IsReadonlyProperty(left, right) {
1075
- return IsReadonly(left) ? IsReadonly(right) ? true : false : false;
1038
+ function RemoveReadonlyInstantiate(context, state, type, options) {
1039
+ return RemoveReadonlyAction(InstantiateType(context, state, type), options);
1076
1040
  }
1077
- function IsOptionalProperty(left, right) {
1078
- return IsOptional(left) ? IsOptional(right) ? true : false : false;
1041
+ function EvaluatePropertyIntersect(left, right) {
1042
+ const isReadonly = IsReadonly(left) && IsReadonly(right);
1043
+ const isOptional = IsOptional(left) && IsOptional(right);
1044
+ const property = RemoveReadonlyAction(RemoveOptionalAction(EvaluateIntersect([left, right]), {}), {});
1045
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
1079
1046
  }
1080
- function CompositeProperty(left, right) {
1081
- const isReadonly = IsReadonlyProperty(left, right);
1082
- const isOptional = IsOptionalProperty(left, right);
1083
- const property = RemoveReadonly(RemoveOptional(EvaluateIntersect([left, right])));
1084
- return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
1047
+ function EvaluatePropertyUnion(left, right) {
1048
+ const isReadonly = IsReadonly(left) || IsReadonly(right);
1049
+ const isOptional = IsOptional(left) || IsOptional(right);
1050
+ const property = EvaluateUnion([RemoveReadonlyAction(RemoveOptionalAction(left, {}), {}), RemoveReadonlyAction(RemoveOptionalAction(right, {}), {})]);
1051
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
1085
1052
  }
1086
1053
  function CompositePropertyKey(left, right, key) {
1087
- return key in left ? key in right ? CompositeProperty(left[key], right[key]) : left[key] : key in right ? right[key] : Never();
1054
+ return key in left ? key in right ? EvaluatePropertyIntersect(left[key], right[key]) : left[key] : key in right ? right[key] : Never();
1088
1055
  }
1089
1056
  function CompositeProperties(left, right) {
1090
- return [.../* @__PURE__ */ new Set([...Keys(left), ...Keys(right)])].reduce((result, key) => {
1057
+ return [.../* @__PURE__ */ new Set([...Keys$1(left), ...Keys$1(right)])].reduce((result, key) => {
1091
1058
  return {
1092
1059
  ...result,
1093
1060
  [key]: CompositePropertyKey(left, right, key)
@@ -1104,6 +1071,9 @@ function NarrowCompareRule(left, right) {
1104
1071
  const result = Compare(left, right);
1105
1072
  return IsEqual(result, 2) ? left : IsEqual(result, 3) ? right : IsEqual(result, 0) ? right : Never();
1106
1073
  }
1074
+ function CanComposite(type) {
1075
+ return IsObject(type) || IsTuple(type);
1076
+ }
1107
1077
  function NarrowCompositeRule(left, right) {
1108
1078
  const canCompositeLeft = CanComposite(left);
1109
1079
  const canCompositeRight = CanComposite(right);
@@ -1234,7 +1204,7 @@ function RecordPatternToType(pattern) {
1234
1204
  return IsEqual(pattern, StringKey) ? String$2() : IsEqual(pattern, IntegerKey) ? Integer$1() : IsEqual(pattern, NumberKey) ? Number$2() : TemplateLiteralDecodeUnsafe(pattern);
1235
1205
  }
1236
1206
  function RecordPattern(type) {
1237
- return Keys(type.patternProperties)[0];
1207
+ return Keys$1(type.patternProperties)[0];
1238
1208
  }
1239
1209
  function RecordKey(type) {
1240
1210
  return RecordPatternToType(RecordPattern(type));
@@ -1516,7 +1486,7 @@ function PropertiesMapping(input) {
1516
1486
  }
1517
1487
  function _Object_Mapping(input) {
1518
1488
  const [properties, patternProperties] = input;
1519
- return _Object_$1(properties, IsEqual(Keys(patternProperties).length, 0) ? {} : { patternProperties });
1489
+ return _Object_$1(properties, IsEqual(Keys$1(patternProperties).length, 0) ? {} : { patternProperties });
1520
1490
  }
1521
1491
  function ElementNamedMapping(input) {
1522
1492
  return IsEqual(input.length, 5) ? AddReadonlyDeferred(AddOptionalDeferred(input[4])) : IsEqual(input.length, 3) ? input[2] : IsEqual(input.length, 4) ? IsEqual(input[2], "readonly") ? AddReadonlyDeferred(input[3]) : AddOptionalDeferred(input[3]) : Unreachable();
@@ -1667,13 +1637,13 @@ function InterfaceDeclarationGenericMapping(input) {
1667
1637
  const parameters = input[2];
1668
1638
  const heritage = input[3];
1669
1639
  const [properties, patternProperties] = input[4];
1670
- const options = IsEqual(Keys(patternProperties).length, 0) ? {} : { patternProperties };
1640
+ const options = IsEqual(Keys$1(patternProperties).length, 0) ? {} : { patternProperties };
1671
1641
  return { [input[1]]: Generic(parameters, InterfaceDeferred(heritage, properties, options)) };
1672
1642
  }
1673
1643
  function InterfaceDeclarationMapping(input) {
1674
1644
  const heritage = input[2];
1675
1645
  const [properties, patternProperties] = input[3];
1676
- const options = IsEqual(Keys(patternProperties).length, 0) ? {} : { patternProperties };
1646
+ const options = IsEqual(Keys$1(patternProperties).length, 0) ? {} : { patternProperties };
1677
1647
  return { [input[1]]: InterfaceDeferred(heritage, properties, options) };
1678
1648
  }
1679
1649
  function TypeAliasDeclarationGenericMapping(input) {
@@ -2497,9 +2467,9 @@ function ExtractInferredProperties(keys, properties) {
2497
2467
  }
2498
2468
  function ExtendsPropertiesComparer(inferred, left, right) {
2499
2469
  const properties = {};
2500
- for (const rightKey of Keys(right)) properties[rightKey] = rightKey in left ? ExtendsProperty({}, left[rightKey], right[rightKey]) : IsOptional(right[rightKey]) ? IsInfer(right[rightKey]) ? ExtendsTrue(Assign(inferred, { [right[rightKey].name]: right[rightKey].extends })) : ExtendsTrue(inferred) : ExtendsFalse();
2470
+ for (const rightKey of Keys$1(right)) properties[rightKey] = rightKey in left ? ExtendsProperty({}, left[rightKey], right[rightKey]) : IsOptional(right[rightKey]) ? IsInfer(right[rightKey]) ? ExtendsTrue(Assign(inferred, { [right[rightKey].name]: right[rightKey].extends })) : ExtendsTrue(inferred) : ExtendsFalse();
2501
2471
  const checked = Values(properties).every((result) => IsExtendsTrueLike(result));
2502
- const extracted = checked ? ExtractInferredProperties(Keys(properties), properties) : {};
2472
+ const extracted = checked ? ExtractInferredProperties(Keys$1(properties), properties) : {};
2503
2473
  return checked ? ExtendsTrue(extracted) : ExtendsFalse();
2504
2474
  }
2505
2475
  function ExtendsProperties(inferred, left, right) {
@@ -2510,7 +2480,7 @@ function ExtendsObjectToObject(inferred, left, right) {
2510
2480
  return ExtendsProperties(inferred, left, right);
2511
2481
  }
2512
2482
  function RecordMergeInferred(left, right) {
2513
- return Keys(right).reduce((result, key) => {
2483
+ return Keys$1(right).reduce((result, key) => {
2514
2484
  return {
2515
2485
  ...result,
2516
2486
  [key]: HasPropertyKey(left, key) ? IsUnion(result[key]) ? Union([...result[key].anyOf, right[key]]) : Union([left[key], right[key]]) : right[key]
@@ -2521,19 +2491,19 @@ function ExtendsRecordComparer(properties, keys, type, result) {
2521
2491
  return ShiftLeft(keys, (left, right) => Match$1(ExtendsLeft({}, properties[left], type), (inferred) => ExtendsRecordComparer(properties, right, type, RecordMergeInferred(result, inferred)), () => ExtendsFalse()), () => ExtendsTrue(result));
2522
2492
  }
2523
2493
  function ExtendsObjectToRecord(inferred, properties, _pattern, value) {
2524
- return ExtendsRecordComparer(properties, Keys(properties), value, inferred);
2494
+ return ExtendsRecordComparer(properties, Keys$1(properties), value, inferred);
2525
2495
  }
2526
2496
  function ExtendsObject(inferred, left, right) {
2527
2497
  return IsRecord(right) ? ExtendsObjectToRecord(inferred, left, RecordPattern(right), RecordValue(right)) : IsObject(right) ? ExtendsObjectToObject(inferred, left, right.properties) : ExtendsRight(inferred, _Object_$1(left), right);
2528
2498
  }
2529
- function FromObject$10(inferred, properties) {
2530
- return IsEqual(Keys(properties).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
2499
+ function FromObject$11(inferred, properties) {
2500
+ return IsEqual(Keys$1(properties).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
2531
2501
  }
2532
2502
  function FromRecord$5(inferred, _leftKey, leftValue, _rightKey, rightValue) {
2533
2503
  return ExtendsLeft(inferred, leftValue, rightValue);
2534
2504
  }
2535
2505
  function ExtendsRecord(inferred, leftPattern, leftValue, right) {
2536
- return IsRecord(right) ? FromRecord$5(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject(right) ? FromObject$10(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
2506
+ return IsRecord(right) ? FromRecord$5(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject(right) ? FromObject$11(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
2537
2507
  }
2538
2508
  function ExtendsString(inferred, left, right) {
2539
2509
  return IsString(right) ? ExtendsTrue(inferred) : ExtendsRight(inferred, left, right);
@@ -2703,7 +2673,7 @@ function FromRef$5(_ref) {
2703
2673
  return Any();
2704
2674
  }
2705
2675
  function FromProperties$2(properties) {
2706
- return Keys(properties).reduce((result, key) => {
2676
+ return Keys$1(properties).reduce((result, key) => {
2707
2677
  return {
2708
2678
  ...result,
2709
2679
  [key]: FromType$18(properties[key])
@@ -2730,7 +2700,7 @@ function CyclicInterface(context, heritage, properties) {
2730
2700
  return EvaluateIntersect([...instantiatedHeritage, _Object_$1(instantiatedProperties)]);
2731
2701
  }
2732
2702
  function CyclicDefinitions(context, dependencies) {
2733
- return Keys(context).filter((key) => dependencies.includes(key)).reduce((result, key) => {
2703
+ return Keys$1(context).filter((key) => dependencies.includes(key)).reduce((result, key) => {
2734
2704
  const type = context[key];
2735
2705
  const instantiatedType = IsInterfaceDeferred(type) ? CyclicInterface(context, type.parameters[0], type.parameters[1]) : type;
2736
2706
  return {
@@ -3085,9 +3055,9 @@ function FromDependent$4(if_, then_, else_) {
3085
3055
  return FromType$15(EvaluateDependent(if_, then_, else_));
3086
3056
  }
3087
3057
  function CollapseIntersectProperties(left, right) {
3088
- const leftKeys = Keys(left).filter((key) => !HasPropertyKey(right, key));
3089
- const rightKeys = Keys(right).filter((key) => !HasPropertyKey(left, key));
3090
- const sharedKeys = Keys(left).filter((key) => HasPropertyKey(right, key));
3058
+ const leftKeys = Keys$1(left).filter((key) => !HasPropertyKey(right, key));
3059
+ const rightKeys = Keys$1(right).filter((key) => !HasPropertyKey(left, key));
3060
+ const sharedKeys = Keys$1(left).filter((key) => HasPropertyKey(right, key));
3091
3061
  const leftProperties = leftKeys.reduce((result, key) => ({
3092
3062
  ...result,
3093
3063
  [key]: left[key]
@@ -3098,7 +3068,7 @@ function CollapseIntersectProperties(left, right) {
3098
3068
  }), {});
3099
3069
  const sharedProperties = sharedKeys.reduce((result, key) => ({
3100
3070
  ...result,
3101
- [key]: EvaluateIntersect([left[key], right[key]])
3071
+ [key]: EvaluatePropertyIntersect(left[key], right[key])
3102
3072
  }), {});
3103
3073
  return Assign(Assign(leftProperties, rightProperties), sharedProperties);
3104
3074
  }
@@ -3107,17 +3077,17 @@ function FromIntersect$8(types) {
3107
3077
  return CollapseIntersectProperties(result, FromType$15(left));
3108
3078
  }, {});
3109
3079
  }
3110
- function FromObject$9(properties) {
3080
+ function FromObject$10(properties) {
3111
3081
  return properties;
3112
3082
  }
3113
3083
  function FromTuple$7(types) {
3114
3084
  return FromType$15(TupleToObject(Tuple(types)));
3115
3085
  }
3116
3086
  function CollapseUnionProperties(left, right) {
3117
- return Keys(left).filter((key) => key in right).reduce((result, key) => {
3087
+ return Keys$1(left).filter((key) => key in right).reduce((result, key) => {
3118
3088
  return {
3119
3089
  ...result,
3120
- [key]: EvaluateUnion([left[key], right[key]])
3090
+ [key]: EvaluatePropertyUnion(left[key], right[key])
3121
3091
  };
3122
3092
  }, {});
3123
3093
  }
@@ -3128,7 +3098,7 @@ function FromUnion$9(types) {
3128
3098
  return ShiftLeft(types, (left, right) => ReduceVariants(right, FromType$15(left)), () => Unreachable$1());
3129
3099
  }
3130
3100
  function FromType$15(type) {
3131
- return IsCyclic(type) ? FromCyclic$8(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$8(type.allOf) : IsUnion(type) ? FromUnion$9(type.anyOf) : IsTuple(type) ? FromTuple$7(type.items) : IsObject(type) ? FromObject$9(type.properties) : {};
3101
+ return IsCyclic(type) ? FromCyclic$8(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$8(type.allOf) : IsUnion(type) ? FromUnion$9(type.anyOf) : IsTuple(type) ? FromTuple$7(type.items) : IsObject(type) ? FromObject$10(type.properties) : {};
3132
3102
  }
3133
3103
  function CollapseToObject(type) {
3134
3104
  return _Object_$1(FromType$15(type));
@@ -3147,7 +3117,7 @@ function NormalizeIndexerTypes(types) {
3147
3117
  function NormalizeIndexer(type) {
3148
3118
  return IsIntersect(type) ? Intersect(NormalizeIndexerTypes(type.allOf)) : IsUnion(type) ? Union(NormalizeIndexerTypes(type.anyOf)) : IsLiteral(type) ? NormalizeLiteral(type.const) : type;
3149
3119
  }
3150
- function FromArray$6(type, indexer) {
3120
+ function FromArray$7(type, indexer) {
3151
3121
  return IsExtendsTrueLike(Extends({}, NormalizeIndexer(indexer), Number$2())) ? type : IsLiteral(indexer) && IsEqual(indexer.const, "length") ? Number$2() : Never();
3152
3122
  }
3153
3123
  function FromCyclic$7(defs, ref) {
@@ -3206,7 +3176,7 @@ function NumericKeys(keys) {
3206
3176
  function FromIndexerNumber(properties) {
3207
3177
  return EvaluateUnion(IndexProperties(properties, NumericKeys(PropertyKeys(properties))));
3208
3178
  }
3209
- function FromObject$8(properties, indexer) {
3179
+ function FromObject$9(properties, indexer) {
3210
3180
  return IsNumber(indexer) ? FromIndexerNumber(properties) : FromIndexer(properties, indexer);
3211
3181
  }
3212
3182
  function ConvertLiteral(value) {
@@ -3233,7 +3203,7 @@ function FromTuple$6(types, indexer) {
3233
3203
  return IsLiteral(indexer) && IsEqual(indexer.const, "length") ? Literal(types.length) : IsNumber(indexer) || IsInteger(indexer) ? FromTupleWithoutIndexer(types) : FromTupleWithIndexer(types, indexer);
3234
3204
  }
3235
3205
  function FromType$12(type, indexer) {
3236
- return IsArray(type) ? FromArray$6(type.items, indexer) : IsObject(type) ? FromObject$8(type.properties, indexer) : IsTuple(type) ? FromTuple$6(type.items, indexer) : Never();
3206
+ return IsArray(type) ? FromArray$7(type.items, indexer) : IsObject(type) ? FromObject$9(type.properties, indexer) : IsTuple(type) ? FromTuple$6(type.items, indexer) : Never();
3237
3207
  }
3238
3208
  function NormalizeType$1(type) {
3239
3209
  return IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
@@ -3272,7 +3242,7 @@ function FromAny() {
3272
3242
  Symbol$1()
3273
3243
  ]);
3274
3244
  }
3275
- function FromArray$5(_type) {
3245
+ function FromArray$6(_type) {
3276
3246
  return Number$2();
3277
3247
  }
3278
3248
  function FromPropertyKeys(keys) {
@@ -3280,8 +3250,8 @@ function FromPropertyKeys(keys) {
3280
3250
  return IsLiteralValue(left) ? [...result, Literal(ConvertToIntegerKey(left))] : Unreachable$1();
3281
3251
  }, []);
3282
3252
  }
3283
- function FromObject$7(properties) {
3284
- return EvaluateUnionFast(FromPropertyKeys(Keys(properties)));
3253
+ function FromObject$8(properties) {
3254
+ return EvaluateUnionFast(FromPropertyKeys(Keys$1(properties)));
3285
3255
  }
3286
3256
  function FromRecord$4(type) {
3287
3257
  return RecordKey(type);
@@ -3290,7 +3260,7 @@ function FromTuple$5(types) {
3290
3260
  return EvaluateUnionFast(types.map((_, index) => Literal(index)));
3291
3261
  }
3292
3262
  function FromType$11(type) {
3293
- return IsAny(type) ? FromAny() : IsArray(type) ? FromArray$5(type.items) : IsObject(type) ? FromObject$7(type.properties) : IsRecord(type) ? FromRecord$4(type) : IsTuple(type) ? FromTuple$5(type.items) : Never();
3263
+ return IsAny(type) ? FromAny() : IsArray(type) ? FromArray$6(type.items) : IsObject(type) ? FromObject$8(type.properties) : IsRecord(type) ? FromRecord$4(type) : IsTuple(type) ? FromTuple$5(type.items) : Never();
3294
3264
  }
3295
3265
  function NormalizeType(type) {
3296
3266
  return IsCyclic(type) || IsDependent(type) || IsIntersect(type) || IsUnion(type) ? CollapseToObject(type) : type;
@@ -3362,7 +3332,7 @@ function MappedInstantiate(context, state, identifier, type, as, property, optio
3362
3332
  }
3363
3333
  function InstantiateCyclics(context, declarations, cyclicKeys) {
3364
3334
  const declarationContext = Assign(context, declarations);
3365
- return Keys(declarations).filter((key) => cyclicKeys.includes(key)).reduce((result, key) => {
3335
+ return Keys$1(declarations).filter((key) => cyclicKeys.includes(key)).reduce((result, key) => {
3366
3336
  return {
3367
3337
  ...result,
3368
3338
  [key]: InstantiateCyclic(declarationContext, key, declarations[key])
@@ -3371,7 +3341,7 @@ function InstantiateCyclics(context, declarations, cyclicKeys) {
3371
3341
  }
3372
3342
  function InstantiateNonCyclics(context, declarations, cyclicKeys) {
3373
3343
  const declarationContext = Assign(context, declarations);
3374
- return Keys(declarations).filter((key) => !cyclicKeys.includes(key)).reduce((result, key) => {
3344
+ return Keys$1(declarations).filter((key) => !cyclicKeys.includes(key)).reduce((result, key) => {
3375
3345
  return {
3376
3346
  ...result,
3377
3347
  [key]: InstantiateType(declarationContext, State([], []), declarations[key])
@@ -3416,7 +3386,7 @@ function ToIndexable(type) {
3416
3386
  return IsObject(collapsed) ? collapsed.properties : Unreachable$1();
3417
3387
  }
3418
3388
  function FromKeys$1(properties, keys) {
3419
- return Keys(properties).reduce((result, key) => {
3389
+ return Keys$1(properties).reduce((result, key) => {
3420
3390
  return keys.includes(key) ? result : {
3421
3391
  ...result,
3422
3392
  [key]: properties[key]
@@ -3467,8 +3437,8 @@ function FromIntersect$6(types) {
3467
3437
  function FromUnion$6(types) {
3468
3438
  return Union(types.map((type) => FromType$8(type)));
3469
3439
  }
3470
- function FromObject$6(properties) {
3471
- return _Object_$1(Keys(properties).reduce((result, left) => {
3440
+ function FromObject$7(properties) {
3441
+ return _Object_$1(Keys$1(properties).reduce((result, left) => {
3472
3442
  return {
3473
3443
  ...result,
3474
3444
  [left]: AddOptional(properties[left])
@@ -3476,7 +3446,7 @@ function FromObject$6(properties) {
3476
3446
  }, {}));
3477
3447
  }
3478
3448
  function FromType$8(type) {
3479
- return IsCyclic(type) ? FromCyclic$6(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$2(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$6(type.allOf) : IsUnion(type) ? FromUnion$6(type.anyOf) : IsObject(type) ? FromObject$6(type.properties) : _Object_$1({});
3449
+ return IsCyclic(type) ? FromCyclic$6(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$2(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$6(type.allOf) : IsUnion(type) ? FromUnion$6(type.anyOf) : IsObject(type) ? FromObject$7(type.properties) : _Object_$1({});
3480
3450
  }
3481
3451
  function PartialAction(type, options) {
3482
3452
  return CanInstantiate([type]) ? Update$1(FromType$8(type), {}, options) : PartialDeferred(type, options);
@@ -3491,7 +3461,7 @@ function Pick(type, indexer_or_keys, options = {}) {
3491
3461
  return PickAction(type, IsArray$1(indexer_or_keys) ? KeysToIndexer(indexer_or_keys) : indexer_or_keys, options);
3492
3462
  }
3493
3463
  function FromKeys(properties, keys) {
3494
- return Keys(properties).reduce((result, key) => {
3464
+ return Keys$1(properties).reduce((result, key) => {
3495
3465
  return keys.includes(key) ? Assign(result, { [key]: properties[key] }) : result;
3496
3466
  }, {});
3497
3467
  }
@@ -3511,7 +3481,7 @@ function ReadonlyObject(type, options = {}) {
3511
3481
  return ReadonlyObjectAction(type, options);
3512
3482
  }
3513
3483
  const ReadonlyType = ReadonlyObject;
3514
- function FromArray$4(type) {
3484
+ function FromArray$5(type) {
3515
3485
  return AddImmutable(_Array_(type));
3516
3486
  }
3517
3487
  function FromCyclic$5(defs, ref) {
@@ -3524,8 +3494,8 @@ function FromDependent$1(if_, then_, else_) {
3524
3494
  function FromIntersect$5(types) {
3525
3495
  return FromType$6(EvaluateIntersect(types));
3526
3496
  }
3527
- function FromObject$5(properties) {
3528
- return _Object_$1(Keys(properties).reduce((result, left) => {
3497
+ function FromObject$6(properties) {
3498
+ return _Object_$1(Keys$1(properties).reduce((result, left) => {
3529
3499
  return {
3530
3500
  ...result,
3531
3501
  [left]: AddReadonly(properties[left])
@@ -3539,7 +3509,7 @@ function FromUnion$5(types) {
3539
3509
  return Union(types.map((type) => FromType$6(type)));
3540
3510
  }
3541
3511
  function FromType$6(type) {
3542
- return IsArray(type) ? FromArray$4(type.items) : IsCyclic(type) ? FromCyclic$5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$1(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$5(type.allOf) : IsObject(type) ? FromObject$5(type.properties) : IsTuple(type) ? FromTuple$4(type.items) : IsUnion(type) ? FromUnion$5(type.anyOf) : type;
3512
+ return IsArray(type) ? FromArray$5(type.items) : IsCyclic(type) ? FromCyclic$5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent$1(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$5(type.allOf) : IsObject(type) ? FromObject$6(type.properties) : IsTuple(type) ? FromTuple$4(type.items) : IsUnion(type) ? FromUnion$5(type.anyOf) : type;
3543
3513
  }
3544
3514
  function ReadonlyObjectAction(type, options) {
3545
3515
  return CanInstantiate([type]) ? Update$1(FromType$6(type), {}, options) : ReadonlyObjectDeferred(type);
@@ -3563,8 +3533,14 @@ function FromIntersect$4(types) {
3563
3533
  function FromUnion$4(types) {
3564
3534
  return Union(types.map((type) => FromType$5(type)));
3565
3535
  }
3566
- function FromObject$4(properties) {
3567
- return _Object_$1(Keys(properties).reduce((result, left) => {
3536
+ function RemoveOptionalDeferred(type, options = {}) {
3537
+ return Deferred("RemoveOptional", [type], options);
3538
+ }
3539
+ function RemoveOptional(type, options = {}) {
3540
+ return RemoveOptionalAction(type, options);
3541
+ }
3542
+ function FromObject$5(properties) {
3543
+ return _Object_$1(Keys$1(properties).reduce((result, left) => {
3568
3544
  return {
3569
3545
  ...result,
3570
3546
  [left]: RemoveOptional(properties[left])
@@ -3572,7 +3548,7 @@ function FromObject$4(properties) {
3572
3548
  }, {}));
3573
3549
  }
3574
3550
  function FromType$5(type) {
3575
- return IsCyclic(type) ? FromCyclic$4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$4(type.allOf) : IsUnion(type) ? FromUnion$4(type.anyOf) : IsObject(type) ? FromObject$4(type.properties) : _Object_$1({});
3551
+ return IsCyclic(type) ? FromCyclic$4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect$4(type.allOf) : IsUnion(type) ? FromUnion$4(type.anyOf) : IsObject(type) ? FromObject$5(type.properties) : _Object_$1({});
3576
3552
  }
3577
3553
  function RequiredDeferred(type, options = {}) {
3578
3554
  return Deferred("Required", [type], options);
@@ -3631,7 +3607,7 @@ function CanInstantiate(types) {
3631
3607
  return ShiftLeft(types, (left, right) => IsRef$1(left) ? false : CanInstantiate(right), () => true);
3632
3608
  }
3633
3609
  function InstantiateProperties(context, state, properties) {
3634
- return Keys(properties).reduce((result, key) => {
3610
+ return Keys$1(properties).reduce((result, key) => {
3635
3611
  return {
3636
3612
  ...result,
3637
3613
  [key]: InstantiateType(context, state, properties[key])
@@ -3661,11 +3637,8 @@ function InstantiateType(context, state, type) {
3661
3637
  function Instantiate(context, type) {
3662
3638
  return InstantiateType(context, State([], []), type);
3663
3639
  }
3664
- function AddImmutableOperation(type) {
3665
- return Update$1(type, { "~immutable": true }, {});
3666
- }
3667
3640
  function AddImmutableAction(type, options) {
3668
- return Update$1(AddImmutableOperation(type), {}, options);
3641
+ return Update$1(type, { "~immutable": true }, options);
3669
3642
  }
3670
3643
  function AddImmutableInstantiate(context, state, type, options) {
3671
3644
  return AddImmutableAction(InstantiateType(context, state, type), options);
@@ -3682,6 +3655,12 @@ function RemoveImmutableDeferred(type, options = {}) {
3682
3655
  function RemoveImmutable(type, options = {}) {
3683
3656
  return RemoveImmutableAction(type, options);
3684
3657
  }
3658
+ function RemoveReadonlyDeferred(type, options = {}) {
3659
+ return Deferred("RemoveReadonly", [type], options);
3660
+ }
3661
+ function RemoveReadonly(type, options = {}) {
3662
+ return RemoveReadonlyAction(type, options);
3663
+ }
3685
3664
  function EvaluateDeferred(type, options = {}) {
3686
3665
  return Deferred("Evaluate", [type], options);
3687
3666
  }
@@ -3755,7 +3734,6 @@ var type_exports = /* @__PURE__ */ __exportAll({
3755
3734
  Broaden: () => Broaden,
3756
3735
  Call: () => Call,
3757
3736
  CallConstruct: () => CallConstruct,
3758
- CanComposite: () => CanComposite,
3759
3737
  Capitalize: () => Capitalize,
3760
3738
  CapitalizeAction: () => CapitalizeAction,
3761
3739
  CapitalizeDeferred: () => CapitalizeDeferred,
@@ -3802,6 +3780,8 @@ var type_exports = /* @__PURE__ */ __exportAll({
3802
3780
  EvaluateEnum: () => EvaluateEnum,
3803
3781
  EvaluateInstantiate: () => EvaluateInstantiate,
3804
3782
  EvaluateIntersect: () => EvaluateIntersect,
3783
+ EvaluatePropertyIntersect: () => EvaluatePropertyIntersect,
3784
+ EvaluatePropertyUnion: () => EvaluatePropertyUnion,
3805
3785
  EvaluateTemplateLiteral: () => EvaluateTemplateLiteral,
3806
3786
  EvaluateType: () => EvaluateType,
3807
3787
  EvaluateUnion: () => EvaluateUnion,
@@ -4029,14 +4009,14 @@ var type_exports = /* @__PURE__ */ __exportAll({
4029
4009
  function IsRefine(value) {
4030
4010
  return HasPropertyKey(value, "~refine") && IsArray$1(value["~refine"]) && Every(value["~refine"], 0, (value) => IsObject$1(value) && HasPropertyKey(value, "check") && HasPropertyKey(value, "error") && IsFunction$1(value.check) && IsFunction$1(value.error));
4031
4011
  }
4032
- function IsSchemaObject(value) {
4012
+ function IsSchemaObject$1(value) {
4033
4013
  return IsObject$1(value) && !IsArray$1(value);
4034
4014
  }
4035
4015
  function IsSchemaBoolean(value) {
4036
4016
  return IsBoolean$2(value);
4037
4017
  }
4038
4018
  function IsSchema(value) {
4039
- return IsSchemaObject(value) || IsSchemaBoolean(value);
4019
+ return IsSchemaObject$1(value) || IsSchemaBoolean(value);
4040
4020
  }
4041
4021
  function IsAdditionalItems(schema) {
4042
4022
  return HasPropertyKey(schema, "additionalItems") && IsSchema(schema.additionalItems);
@@ -4275,7 +4255,7 @@ function NextUri(ref, base) {
4275
4255
  return URL.canParse(ref, base) ? new URL(ref, base) : IsEqual(base, "urn:typebox:root") ? new URL(`${base}:${ref}`) : new URL(`${base.slice(0, base.lastIndexOf(":"))}:${ref}`);
4276
4256
  }
4277
4257
  function Stack(context, schema) {
4278
- const base = IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
4258
+ const base = IsSchemaObject$1(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
4279
4259
  return {
4280
4260
  context,
4281
4261
  schema,
@@ -4295,7 +4275,7 @@ function Stack(context, schema) {
4295
4275
  function RegisterResourceAnchors(anchors, schema, isRoot = true) {
4296
4276
  if (IsSchemaBoolean(schema)) return anchors;
4297
4277
  if (Array.isArray(schema)) return schema.reduce((result, item) => RegisterResourceAnchors(result, item, false), anchors);
4298
- if (!IsSchemaObject(schema)) return anchors;
4278
+ if (!IsSchemaObject$1(schema)) return anchors;
4299
4279
  if (!isRoot && IsId(schema)) return anchors;
4300
4280
  const next = !isRoot && IsDynamicAnchor(schema) ? [...anchors, schema] : anchors;
4301
4281
  return Object.keys(schema).reduce((result, key) => RegisterResourceAnchors(result, schema[key], false), next);
@@ -4346,7 +4326,7 @@ function NextLexicalSchema(stack, schema) {
4346
4326
  return IsId(schema) ? schema : stack.lexicalSchema;
4347
4327
  }
4348
4328
  function HasStackKeywords(stack, schema) {
4349
- return IsSchemaObject(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined$1(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined$1(ResourceEntry(stack, schema)));
4329
+ return IsSchemaObject$1(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined$1(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined$1(ResourceEntry(stack, schema)));
4350
4330
  }
4351
4331
  function NextStack(stack, schema) {
4352
4332
  return HasStackKeywords(stack, schema) ? {
@@ -4391,20 +4371,20 @@ function GetPropertyKeyAsPattern(key) {
4391
4371
  }
4392
4372
  function GetPropertiesPattern(schema) {
4393
4373
  const patterns = [];
4394
- if (IsPatternProperties(schema)) patterns.push(...Keys(schema.patternProperties));
4395
- if (IsProperties(schema)) patterns.push(...Keys(schema.properties).map(GetPropertyKeyAsPattern));
4374
+ if (IsPatternProperties(schema)) patterns.push(...Keys$1(schema.patternProperties));
4375
+ if (IsProperties(schema)) patterns.push(...Keys$1(schema.properties).map(GetPropertyKeyAsPattern));
4396
4376
  return IsEqual(patterns.length, 0) ? "(?!)" : `(${patterns.join("|")})`;
4397
4377
  }
4398
4378
  function CheckAdditionalProperties(stack, context, schema, value) {
4399
4379
  const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
4400
- return Every(Keys(value), 0, (key, _index) => {
4380
+ return Every(Keys$1(value), 0, (key, _index) => {
4401
4381
  return regexp.test(key) || CheckSchemaPushStack(stack, context, schema.additionalProperties, value[key]) && context.AddKey(key);
4402
4382
  });
4403
4383
  }
4404
4384
  function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
4405
4385
  const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
4406
4386
  const additionalProperties = [];
4407
- return EveryAll(Keys(value), 0, (key, _index) => {
4387
+ return EveryAll(Keys$1(value), 0, (key, _index) => {
4408
4388
  const nextSchemaPath = `${schemaPath}/additionalProperties`;
4409
4389
  const nextInstancePath = `${instancePath}/${EncodeFragment(key)}`;
4410
4390
  const isAdditionalProperty = regexp.test(key) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key);
@@ -4476,14 +4456,14 @@ function ErrorContains(stack, context, schemaPath, instancePath, schema, value)
4476
4456
  return CheckContains(stack, context, schema, value) || context.AddError("contains", schemaPath, instancePath, { minContains: 1 });
4477
4457
  }
4478
4458
  function CheckDependencies(stack, context, schema, value) {
4479
- const isLength = IsEqual(Keys(value).length, 0);
4459
+ const isLength = IsEqual(Keys$1(value).length, 0);
4480
4460
  const isEvery = Every(Entries(schema.dependencies), 0, ([key, schema]) => {
4481
4461
  return !HasPropertyKey(value, key) || (IsArray$1(schema) ? schema.every((key) => HasPropertyKey(value, key)) : CheckSchema(stack, context, schema, value));
4482
4462
  });
4483
4463
  return isLength || isEvery;
4484
4464
  }
4485
4465
  function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
4486
- const isLength = IsEqual(Keys(value).length, 0);
4466
+ const isLength = IsEqual(Keys$1(value).length, 0);
4487
4467
  const isEvery = EveryAll(Entries(schema.dependencies), 0, ([key, schema]) => {
4488
4468
  const nextSchemaPath = `${schemaPath}/dependencies/${EncodeFragment(key)}`;
4489
4469
  return !HasPropertyKey(value, key) || (IsArray$1(schema) ? schema.every((dependency) => HasPropertyKey(value, dependency) || context.AddError("dependencies", schemaPath, instancePath, {
@@ -4494,14 +4474,14 @@ function ErrorDependencies(stack, context, schemaPath, instancePath, schema, val
4494
4474
  return isLength || isEvery;
4495
4475
  }
4496
4476
  function CheckDependentRequired(_stack, _context, schema, value) {
4497
- const isLength = IsEqual(Keys(value).length, 0);
4477
+ const isLength = IsEqual(Keys$1(value).length, 0);
4498
4478
  const isEvery = Every(Entries(schema.dependentRequired), 0, ([key, keys]) => {
4499
4479
  return !HasPropertyKey(value, key) || keys.every((key) => HasPropertyKey(value, key));
4500
4480
  });
4501
4481
  return isLength || isEvery;
4502
4482
  }
4503
4483
  function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
4504
- const isLength = IsEqual(Keys(value).length, 0);
4484
+ const isLength = IsEqual(Keys$1(value).length, 0);
4505
4485
  const isEveryEntry = EveryAll(Entries(schema.dependentRequired), 0, ([key, keys]) => {
4506
4486
  return !HasPropertyKey(value, key) || EveryAll(keys, 0, (dependency) => HasPropertyKey(value, dependency) || context.AddError("dependentRequired", schemaPath, instancePath, {
4507
4487
  property: key,
@@ -4511,14 +4491,14 @@ function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schem
4511
4491
  return isLength || isEveryEntry;
4512
4492
  }
4513
4493
  function CheckDependentSchemas(stack, context, schema, value) {
4514
- const isLength = IsEqual(Keys(value).length, 0);
4494
+ const isLength = IsEqual(Keys$1(value).length, 0);
4515
4495
  const isEvery = Every(Entries(schema.dependentSchemas), 0, ([key, schema]) => {
4516
4496
  return !HasPropertyKey(value, key) || CheckSchema(stack, context, schema, value);
4517
4497
  });
4518
4498
  return isLength || isEvery;
4519
4499
  }
4520
4500
  function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
4521
- const isLength = IsEqual(Keys(value).length, 0);
4501
+ const isLength = IsEqual(Keys$1(value).length, 0);
4522
4502
  const isEvery = EveryAll(Entries(schema.dependentSchemas), 0, ([key, schema]) => {
4523
4503
  const nextSchemaPath = `${schemaPath}/dependentSchemas/${EncodeFragment(key)}`;
4524
4504
  return !HasPropertyKey(value, key) || ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value);
@@ -4538,7 +4518,7 @@ function Get(value, pointer) {
4538
4518
  return current;
4539
4519
  }
4540
4520
  function RelativeBase(schema, base) {
4541
- return IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
4521
+ return IsSchemaObject$1(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
4542
4522
  }
4543
4523
  function AbsoluteBase(base) {
4544
4524
  return NextUri(base, DefaultUri);
@@ -4557,7 +4537,7 @@ function IsPointerFragment(fragment) {
4557
4537
  }
4558
4538
  function SearchDynamicAnchor(schema, name) {
4559
4539
  if (IsObject$1(schema) && IsDynamicAnchor(schema) && IsEqual(schema.$dynamicAnchor, name)) return schema;
4560
- if (IsObject$1(schema)) for (const key of Keys(schema)) {
4540
+ if (IsObject$1(schema)) for (const key of Keys$1(schema)) {
4561
4541
  const result = SearchDynamicAnchor(schema[key], name);
4562
4542
  if (result) return result;
4563
4543
  }
@@ -4569,7 +4549,7 @@ function SearchBase(schema, base, target) {
4569
4549
  const result = SearchBase(item, nextBase, target);
4570
4550
  if (!IsUndefined$1(result)) return result;
4571
4551
  }
4572
- else if (IsObject$1(schema)) for (const key of Keys(schema)) {
4552
+ else if (IsObject$1(schema)) for (const key of Keys$1(schema)) {
4573
4553
  const result = SearchBase(schema[key], nextBase, target);
4574
4554
  if (!IsUndefined$1(result)) return result;
4575
4555
  }
@@ -4600,7 +4580,7 @@ function MatchWithDynamicAnchor(schema, base, ref) {
4600
4580
  return IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : void 0;
4601
4581
  }
4602
4582
  function MatchSchemaObject(schema, base, ref) {
4603
- if (!IsSchemaObject(schema)) return void 0;
4583
+ if (!IsSchemaObject$1(schema)) return void 0;
4604
4584
  return MatchWithId(schema, base, ref) ?? MatchWithAnchor(schema, base, ref) ?? MatchWithDynamicAnchor(schema, base, ref) ?? MatchWithHash(schema, ref);
4605
4585
  }
4606
4586
  function MatchFromArray(schema, base, ref) {
@@ -4612,7 +4592,7 @@ function MatchFromArray(schema, base, ref) {
4612
4592
  }
4613
4593
  function MatchFromObject(schema, base, ref) {
4614
4594
  if (!IsObject$1(schema)) return void 0;
4615
- return Keys(schema).reduce((result, key) => {
4595
+ return Keys$1(schema).reduce((result, key) => {
4616
4596
  if (IsEqual(key, "const") || IsEqual(key, "enum")) return result;
4617
4597
  const match = Match(schema[key], base, ref);
4618
4598
  return !IsUndefined$1(match) ? match : result;
@@ -4624,11 +4604,11 @@ function Match(schema, base, ref) {
4624
4604
  }
4625
4605
  function Resource(context, schema, base, ref) {
4626
4606
  const result = RefInternal(context, schema, base, ref);
4627
- return IsSchemaObject(result) && IsId(result) ? result : void 0;
4607
+ return IsSchemaObject$1(result) && IsId(result) ? result : void 0;
4628
4608
  }
4629
4609
  function FindDeferredResourceLegacy(stack, ref, schema) {
4630
4610
  if (!ref.$ref.startsWith("#")) return void 0;
4631
- if (!IsSchemaObject(stack.schema) || HasPropertyKey(stack.schema, "$schema")) return void 0;
4611
+ if (!IsSchemaObject$1(stack.schema) || HasPropertyKey(stack.schema, "$schema")) return void 0;
4632
4612
  const targetBase = Base(stack.lexicalSchema, stack.referenceBase, schema);
4633
4613
  if (IsUndefined$1(targetBase) || IsEqual(targetBase, stack.referenceBase)) return void 0;
4634
4614
  return {
@@ -4639,7 +4619,7 @@ function FindDeferredResourceLegacy(stack, ref, schema) {
4639
4619
  }
4640
4620
  function FindDeferredResourceModern(stack, canonical, schema) {
4641
4621
  const remoteRoot = stack.context[canonical];
4642
- if (!IsSchemaObject(remoteRoot)) return void 0;
4622
+ if (!IsSchemaObject$1(remoteRoot)) return void 0;
4643
4623
  return {
4644
4624
  target: schema,
4645
4625
  base: canonical,
@@ -4711,10 +4691,10 @@ function RefResultNotFound(stack, schema) {
4711
4691
  }
4712
4692
  function Ref(stack, ref) {
4713
4693
  const schema = RefInternal(stack.context, RefRoot(stack, ref), stack.referenceBase, ref.$ref);
4714
- return IsSchemaObject(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
4694
+ return IsSchemaObject$1(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
4715
4695
  }
4716
4696
  function IsRecursiveAnchorInScope(stack) {
4717
- return IsSchemaObject(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
4697
+ return IsSchemaObject$1(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
4718
4698
  }
4719
4699
  function RecursiveRef(stack, recursiveRef) {
4720
4700
  const schema = IsRecursiveAnchorInScope(stack) ? stack.recursiveAnchor : stack.lexicalSchema;
@@ -4727,7 +4707,7 @@ function FindScopedDynamicAnchor(stack, name) {
4727
4707
  return stack.dynamicAnchors.find((anchor) => IsEqual(anchor.$dynamicAnchor, name)) ?? SearchDynamicAnchor(stack.schema, name);
4728
4708
  }
4729
4709
  function DynamicRefWhenFound(stack, dynamicRef, fragmentTarget) {
4730
- if (!IsSchemaObject(fragmentTarget) || !IsDynamicAnchor(fragmentTarget)) return fragmentTarget;
4710
+ if (!IsSchemaObject$1(fragmentTarget) || !IsDynamicAnchor(fragmentTarget)) return fragmentTarget;
4731
4711
  return IsPointerFragment(DynamicRefFragment(stack, dynamicRef)) ? fragmentTarget : FindScopedDynamicAnchor(stack, fragmentTarget.$dynamicAnchor);
4732
4712
  }
4733
4713
  function DynamicRefWhenNotFound(stack, dynamicRef) {
@@ -4826,9 +4806,13 @@ function IsTime(value, strictTimeZone = true) {
4826
4806
  const tzM = +(matches[7] || 0);
4827
4807
  return ((hr * 60 + min - tzSign * (tzH * 60 + tzM)) % 1440 + 1440) % 1440 === 1439;
4828
4808
  }
4809
+ const 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]+)*\])*)$/;
4829
4810
  function IsDateTime(value) {
4830
- const dateTime = value.split(/T/i);
4831
- return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);
4811
+ const index = value.indexOf("[");
4812
+ const datetime = index === -1 ? value : value.slice(0, index);
4813
+ if (index !== -1 && !DATE_TIME_SUFFIX.test(value.slice(index))) return false;
4814
+ const split = datetime.split(/T/i);
4815
+ return split.length === 2 && IsDate(split[0]) && IsTime(split[1]);
4832
4816
  }
4833
4817
  const Duration = /^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;
4834
4818
  function IsDuration(value) {
@@ -5282,7 +5266,7 @@ function ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value)
5282
5266
  return CheckMaxLength(stack, context, schema, value) || context.AddError("maxLength", schemaPath, instancePath, { limit: schema.maxLength });
5283
5267
  }
5284
5268
  function CheckMaxProperties(_stack, _context, schema, value) {
5285
- return IsLessEqualThan(Keys(value).length, schema.maxProperties);
5269
+ return IsLessEqualThan(Keys$1(value).length, schema.maxProperties);
5286
5270
  }
5287
5271
  function ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value) {
5288
5272
  return CheckMaxProperties(stack, context, schema, value) || context.AddError("maxProperties", schemaPath, instancePath, { limit: schema.maxProperties });
@@ -5319,7 +5303,7 @@ function ErrorMinLength(stack, context, schemaPath, instancePath, schema, value)
5319
5303
  return CheckMinLength(stack, context, schema, value) || context.AddError("minLength", schemaPath, instancePath, { limit: schema.minLength });
5320
5304
  }
5321
5305
  function CheckMinProperties(_stack, _context, schema, value) {
5322
- return IsGreaterEqualThan(Keys(value).length, schema.minProperties);
5306
+ return IsGreaterEqualThan(Keys$1(value).length, schema.minProperties);
5323
5307
  }
5324
5308
  function ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value) {
5325
5309
  return CheckMinProperties(stack, context, schema, value) || context.AddError("minProperties", schemaPath, instancePath, { limit: schema.minProperties });
@@ -5417,11 +5401,11 @@ function ErrorProperties(stack, context, schemaPath, instancePath, schema, value
5417
5401
  });
5418
5402
  }
5419
5403
  function CheckPropertyNames(stack, context, schema, value) {
5420
- return Every(Keys(value), 0, (key, _index) => CheckSchema(stack, context, schema.propertyNames, key));
5404
+ return Every(Keys$1(value), 0, (key, _index) => CheckSchema(stack, context, schema.propertyNames, key));
5421
5405
  }
5422
5406
  function ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value) {
5423
5407
  const propertyNames = [];
5424
- return EveryAll(Keys(value), 0, (key, _index) => {
5408
+ return EveryAll(Keys$1(value), 0, (key, _index) => {
5425
5409
  const nextInstancePath = `${instancePath}/${EncodeFragment(key)}`;
5426
5410
  const isPropertyName = ErrorSchema(stack, context, `${schemaPath}/propertyNames`, nextInstancePath, schema.propertyNames, key);
5427
5411
  if (!isPropertyName) propertyNames.push(key);