@bcts/dcbor 1.0.0-alpha.22 → 1.0.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5,18 +5,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
20
16
  }
21
17
  return to;
22
18
  };
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
20
  value: mod,
25
21
  enumerable: true
26
22
  }) : target, mod));
27
-
28
23
  //#endregion
29
24
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-function.js
30
25
  var require_shim_function = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -80,7 +75,6 @@ var require_shim_function = /* @__PURE__ */ __commonJSMin(((exports, module) =>
80
75
  };
81
76
  };
82
77
  }));
83
-
84
78
  //#endregion
85
79
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-collection.js
86
80
  var require_generic_collection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -299,7 +293,6 @@ var require_generic_collection = /* @__PURE__ */ __commonJSMin(((exports, module
299
293
  Object.defineProperty(GenericCollection.prototype, "size", GenericCollection._sizePropertyDescriptor);
300
294
  require_shim_array();
301
295
  }));
302
-
303
296
  //#endregion
304
297
  //#region ../../node_modules/.bun/weak-map@1.0.8/node_modules/weak-map/weak-map.js
305
298
  var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -419,7 +412,6 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
419
412
  }
420
413
  }
421
414
  }
422
- Object.prototype.hasOwnProperty;
423
415
  var gopn = Object.getOwnPropertyNames;
424
416
  var defProp = Object.defineProperty;
425
417
  var isExtensible = Object.isExtensible;
@@ -462,8 +454,7 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
462
454
  var HIDDEN_NAME_PREFIX = "weakmap:";
463
455
  var HIDDEN_NAME = HIDDEN_NAME_PREFIX + "ident:" + Math.random() + "___";
464
456
  if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function" && typeof ArrayBuffer === "function" && typeof Uint8Array === "function") {
465
- var ab = /* @__PURE__ */ new ArrayBuffer(25);
466
- var u8s = new Uint8Array(ab);
457
+ var u8s = new Uint8Array(/* @__PURE__ */ new ArrayBuffer(25));
467
458
  crypto.getRandomValues(u8s);
468
459
  HIDDEN_NAME = HIDDEN_NAME_PREFIX + "rand:" + Array.prototype.map.call(u8s, function(u8) {
469
460
  return (u8 % 36).toString(36);
@@ -651,6 +642,10 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
651
642
  };
652
643
  OurWeakMap.prototype = Object.create(Object.prototype, {
653
644
  get: {
645
+ /**
646
+ * Return the value most recently associated with key, or
647
+ * opt_default if none.
648
+ */
654
649
  value: function get(key, opt_default) {
655
650
  return this.get___(key, opt_default);
656
651
  },
@@ -658,6 +653,9 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
658
653
  configurable: true
659
654
  },
660
655
  has: {
656
+ /**
657
+ * Is there a value associated with key in this WeakMap?
658
+ */
661
659
  value: function has(key) {
662
660
  return this.has___(key);
663
661
  },
@@ -665,6 +663,10 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
665
663
  configurable: true
666
664
  },
667
665
  set: {
666
+ /**
667
+ * Associate value with key in this WeakMap, overwriting any
668
+ * previous association if present.
669
+ */
668
670
  value: function set(key, value) {
669
671
  return this.set___(key, value);
670
672
  },
@@ -672,6 +674,18 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
672
674
  configurable: true
673
675
  },
674
676
  "delete": {
677
+ /**
678
+ * Remove any association for key in this WeakMap, returning
679
+ * whether there was one.
680
+ *
681
+ * <p>Note that the boolean return here does not work like the
682
+ * {@code delete} operator. The {@code delete} operator returns
683
+ * whether the deletion succeeds at bringing about a state in
684
+ * which the deleted property is absent. The {@code delete}
685
+ * operator therefore returns true if the property was already
686
+ * absent, whereas this {@code delete} method returns false if
687
+ * the association was already absent.
688
+ */
675
689
  value: function remove(key) {
676
690
  return this.delete___(key);
677
691
  },
@@ -743,13 +757,11 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
743
757
  }
744
758
  })();
745
759
  }));
746
-
747
760
  //#endregion
748
761
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/weak-map.js
749
762
  var require_weak_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
750
763
  module.exports = typeof WeakMap !== "undefined" ? WeakMap : require_weak_map$1();
751
764
  }));
752
-
753
765
  //#endregion
754
766
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-object.js
755
767
  var require_shim_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1169,7 +1181,6 @@ var require_shim_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1169
1181
  return object;
1170
1182
  };
1171
1183
  }));
1172
-
1173
1184
  //#endregion
1174
1185
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-order.js
1175
1186
  var require_generic_order = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1203,7 +1214,6 @@ var require_generic_order = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1203
1214
  return this.toArray();
1204
1215
  };
1205
1216
  }));
1206
-
1207
1217
  //#endregion
1208
1218
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-array.js
1209
1219
  var require_shim_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1478,7 +1488,6 @@ var require_shim_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1478
1488
  return this._iterationObject;
1479
1489
  };
1480
1490
  }));
1481
-
1482
1491
  //#endregion
1483
1492
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-regexp.js
1484
1493
  var require_shim_regexp = /* @__PURE__ */ __commonJSMin((() => {
@@ -1495,7 +1504,6 @@ var require_shim_regexp = /* @__PURE__ */ __commonJSMin((() => {
1495
1504
  };
1496
1505
  }
1497
1506
  }));
1498
-
1499
1507
  //#endregion
1500
1508
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim.js
1501
1509
  var require_shim = /* @__PURE__ */ __commonJSMin((() => {
@@ -1504,7 +1512,6 @@ var require_shim = /* @__PURE__ */ __commonJSMin((() => {
1504
1512
  require_shim_function();
1505
1513
  require_shim_regexp();
1506
1514
  }));
1507
-
1508
1515
  //#endregion
1509
1516
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-set.js
1510
1517
  var require_generic_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1574,7 +1581,6 @@ var require_generic_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1574
1581
  return this.map(_entriesArrayFunction);
1575
1582
  };
1576
1583
  }));
1577
-
1578
1584
  //#endregion
1579
1585
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_list.js
1580
1586
  var require__list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1873,7 +1879,6 @@ var require__list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1873
1879
  node.prev = this;
1874
1880
  };
1875
1881
  }));
1876
-
1877
1882
  //#endregion
1878
1883
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/iterator.js
1879
1884
  var require_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2113,7 +2118,6 @@ var require_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2113
2118
  });
2114
2119
  };
2115
2120
  }));
2116
-
2117
2121
  //#endregion
2118
2122
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-map.js
2119
2123
  var require_generic_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2251,7 +2255,6 @@ var require_generic_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2251
2255
  return Object.compare(this.key, that.key);
2252
2256
  };
2253
2257
  }));
2254
-
2255
2258
  //#endregion
2256
2259
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_dict.js
2257
2260
  var require__dict = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2379,7 +2382,6 @@ var require__dict = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2379
2382
  return this.toObject();
2380
2383
  };
2381
2384
  }));
2382
-
2383
2385
  //#endregion
2384
2386
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/tree-log.js
2385
2387
  var require_tree_log = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2416,7 +2418,6 @@ var require_tree_log = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2416
2418
  strafe: "┃"
2417
2419
  };
2418
2420
  }));
2419
-
2420
2421
  //#endregion
2421
2422
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_fast-set.js
2422
2423
  var require__fast_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2558,7 +2559,6 @@ var require__fast_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2558
2559
  else write(" " + value);
2559
2560
  };
2560
2561
  }));
2561
-
2562
2562
  //#endregion
2563
2563
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_set.js
2564
2564
  var require__set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2756,7 +2756,6 @@ var require__set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2756
2756
  GlobalSet.CollectionsSet = CollectionsSet;
2757
2757
  }
2758
2758
  }));
2759
-
2760
2759
  //#endregion
2761
2760
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_map.js
2762
2761
  var require__map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2960,7 +2959,6 @@ var require__map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2960
2959
  GlobalMap.CollectionsMap = CollectionsMap;
2961
2960
  }
2962
2961
  }));
2963
-
2964
2962
  //#endregion
2965
2963
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/change-descriptor.js
2966
2964
  var require_change_descriptor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -3081,7 +3079,6 @@ var require_change_descriptor = /* @__PURE__ */ __commonJSMin(((exports, module)
3081
3079
  WillChangeListenersRecord.prototype.constructor = WillChangeListenersRecord;
3082
3080
  WillChangeListenersRecord.prototype.genericHandlerMethodName = "handlePropertyWillChange";
3083
3081
  }));
3084
-
3085
3082
  //#endregion
3086
3083
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/property-changes.js
3087
3084
  var require_property_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -3318,7 +3315,6 @@ var require_property_changes = /* @__PURE__ */ __commonJSMin(((exports, module)
3318
3315
  else return PropertyChanges.prototype.makePropertyObservable.call(object, key);
3319
3316
  };
3320
3317
  }));
3321
-
3322
3318
  //#endregion
3323
3319
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/range-changes.js
3324
3320
  var require_range_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -3469,7 +3465,6 @@ var require_range_changes = /* @__PURE__ */ __commonJSMin(((exports, module) =>
3469
3465
  return this.dispatchRangeChange(plus, minus, index, true);
3470
3466
  };
3471
3467
  }));
3472
-
3473
3468
  //#endregion
3474
3469
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/sorted-set.js
3475
3470
  var require_sorted_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -3953,7 +3948,6 @@ var require_sorted_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3953
3948
  return this._iterationObject;
3954
3949
  };
3955
3950
  }));
3956
-
3957
3951
  //#endregion
3958
3952
  //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/map-changes.js
3959
3953
  var require_map_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -4101,10 +4095,9 @@ var require_map_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4101
4095
  return this.dispatchMapChange(key, value, true);
4102
4096
  };
4103
4097
  }));
4104
-
4105
4098
  //#endregion
4106
- //#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/sorted-map.js
4107
- var require_sorted_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4099
+ //#region src/tag.ts
4100
+ var import_sorted_map = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
4108
4101
  require_shim();
4109
4102
  var SortedSet = require_sorted_set();
4110
4103
  var GenericCollection = require_generic_collection();
@@ -4151,11 +4144,7 @@ var require_sorted_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4151
4144
  log(" key: " + node.key);
4152
4145
  log(" value: " + node.value);
4153
4146
  };
4154
- }));
4155
-
4156
- //#endregion
4157
- //#region src/tag.ts
4158
- var import_sorted_map = require_sorted_map();
4147
+ })))();
4159
4148
  /**
4160
4149
  * Create a new Tag.
4161
4150
  *
@@ -4186,7 +4175,6 @@ const createTag = (value, name) => {
4186
4175
  * @internal
4187
4176
  */
4188
4177
  const tagToString = (tag) => tag.name ?? tag.value.toString();
4189
-
4190
4178
  //#endregion
4191
4179
  //#region src/error.ts
4192
4180
  /**
@@ -4276,7 +4264,6 @@ var CborError = class CborError extends Error {
4276
4264
  return error instanceof CborError;
4277
4265
  }
4278
4266
  };
4279
-
4280
4267
  //#endregion
4281
4268
  //#region src/stdlib.ts
4282
4269
  /**
@@ -4332,10 +4319,9 @@ const lexicographicallyCompareBytes = (a, b) => {
4332
4319
  if (a.length > b.length) return 1;
4333
4320
  return 0;
4334
4321
  };
4335
-
4336
4322
  //#endregion
4337
- //#region ../../node_modules/.bun/byte-data@19.0.1/node_modules/byte-data/dist/byte-data.js
4338
- var require_byte_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4323
+ //#region src/exact.ts
4324
+ var import_byte_data = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4339
4325
  /*! https://github.com/rochars/byte-data
4340
4326
  Copyright (c) 2019 Rafael da Silva Rocha */
4341
4327
  (function() {
@@ -4593,11 +4579,7 @@ var require_byte_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4593
4579
  typeof module !== "undefined" ? module.exports = exports$1 : typeof define === "function" && define.amd ? define(["exports"], exports$1) : typeof global !== "undefined" && (global.byteData = exports$1);
4594
4580
  return exports$1;
4595
4581
  })();
4596
- }));
4597
-
4598
- //#endregion
4599
- //#region src/exact.ts
4600
- var import_byte_data = /* @__PURE__ */ __toESM(require_byte_data(), 1);
4582
+ })))(), 1);
4601
4583
  const hasFract = (n) => {
4602
4584
  return n % 1 !== 0;
4603
4585
  };
@@ -4764,47 +4746,6 @@ var ExactU64 = class {
4764
4746
  return source <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(source) : source;
4765
4747
  }
4766
4748
  };
4767
- /**
4768
- * Exact conversions for u128 (JavaScript bigint, unsigned).
4769
- */
4770
- var ExactU128 = class {
4771
- static MIN = 0n;
4772
- static MAX = 2n ** 128n - 1n;
4773
- static exactFromF16(source) {
4774
- if (!Number.isFinite(source)) return void 0;
4775
- if (source <= -1) return void 0;
4776
- if (hasFract(source)) return void 0;
4777
- return BigInt(Math.trunc(source));
4778
- }
4779
- static exactFromF32(source) {
4780
- if (!Number.isFinite(source)) return void 0;
4781
- if (source <= -1) return void 0;
4782
- if (hasFract(source)) return void 0;
4783
- return BigInt(Math.trunc(source));
4784
- }
4785
- static exactFromF64(source) {
4786
- if (!Number.isFinite(source)) return void 0;
4787
- if (source <= -1) return void 0;
4788
- if (hasFract(source)) return void 0;
4789
- return BigInt(Math.trunc(source));
4790
- }
4791
- static exactFromU64(source) {
4792
- return BigInt(source);
4793
- }
4794
- static exactFromI64(source) {
4795
- const n = typeof source === "bigint" ? source : BigInt(source);
4796
- if (n < 0n) return void 0;
4797
- return n;
4798
- }
4799
- static exactFromU128(source) {
4800
- return source;
4801
- }
4802
- static exactFromI128(source) {
4803
- if (source < 0n) return void 0;
4804
- return source;
4805
- }
4806
- };
4807
-
4808
4749
  //#endregion
4809
4750
  //#region src/float.ts
4810
4751
  /**
@@ -4962,7 +4903,6 @@ const f16CborData = (value) => {
4962
4903
  const bytes = numberToBinary16(value);
4963
4904
  return new Uint8Array([249, ...bytes]);
4964
4905
  };
4965
-
4966
4906
  //#endregion
4967
4907
  //#region src/varint.ts
4968
4908
  /**
@@ -5059,7 +4999,6 @@ function getUint64(view, byteOffset, littleEndian) {
5059
4999
  const highWord = littleEndian ? view.getUint32(byteOffset + 4, true) : view.getUint32(byteOffset, false);
5060
5000
  return (BigInt(highWord) << BigInt(32)) + BigInt(lowWord);
5061
5001
  }
5062
-
5063
5002
  //#endregion
5064
5003
  //#region src/string-util.ts
5065
5004
  /**
@@ -5108,7 +5047,6 @@ const sanitized = (str) => {
5108
5047
  if (!hasPrintable) return;
5109
5048
  return chars.join("");
5110
5049
  };
5111
-
5112
5050
  //#endregion
5113
5051
  //#region src/tags-store.ts
5114
5052
  /**
@@ -5236,7 +5174,6 @@ const getGlobalTagsStore = () => {
5236
5174
  globalTagsStore ??= new TagsStore();
5237
5175
  return globalTagsStore;
5238
5176
  };
5239
-
5240
5177
  //#endregion
5241
5178
  //#region src/dump.ts
5242
5179
  /**
@@ -5424,7 +5361,6 @@ function dumpItems(cbor, level, opts) {
5424
5361
  }
5425
5362
  return items;
5426
5363
  }
5427
-
5428
5364
  //#endregion
5429
5365
  //#region src/diag.ts
5430
5366
  /**
@@ -5659,7 +5595,6 @@ function resolveTagsStore(tags) {
5659
5595
  else if (tags === "global" || tags === void 0) return getGlobalTagsStore();
5660
5596
  else return tags;
5661
5597
  }
5662
-
5663
5598
  //#endregion
5664
5599
  //#region src/simple.ts
5665
5600
  /**
@@ -5717,7 +5652,6 @@ const simpleCborData = (simple) => {
5717
5652
  case "Float": return f64CborData(simple.value);
5718
5653
  }
5719
5654
  };
5720
-
5721
5655
  //#endregion
5722
5656
  //#region src/decode.ts
5723
5657
  /**
@@ -5986,7 +5920,6 @@ function decodeCborInternal(data) {
5986
5920
  function checkCanonicalEncoding(cbor, buf) {
5987
5921
  if (!areBytesEqual(buf, isCbor(cbor) ? cborData(cbor) : encodeCbor(cbor))) throw new CborError({ type: "NonCanonicalNumeric" });
5988
5922
  }
5989
-
5990
5923
  //#endregion
5991
5924
  //#region src/conveniences.ts
5992
5925
  /**
@@ -6576,7 +6509,6 @@ const isNumber = (cbor) => {
6576
6509
  if (cbor.type === MajorType.Simple) return isFloat$1(cbor.value);
6577
6510
  return false;
6578
6511
  };
6579
-
6580
6512
  //#endregion
6581
6513
  //#region src/map.ts
6582
6514
  /**
@@ -6812,7 +6744,6 @@ var CborMap = class CborMap {
6812
6744
  return map;
6813
6745
  }
6814
6746
  };
6815
-
6816
6747
  //#endregion
6817
6748
  //#region src/walk.ts
6818
6749
  /**
@@ -6828,24 +6759,6 @@ var CborMap = class CborMap {
6828
6759
  * @module walk
6829
6760
  */
6830
6761
  /**
6831
- * Types of edges in the CBOR tree traversal.
6832
- */
6833
- let EdgeType = /* @__PURE__ */ function(EdgeType) {
6834
- /** No specific edge type (root element) */
6835
- EdgeType["None"] = "none";
6836
- /** Element within an array */
6837
- EdgeType["ArrayElement"] = "array_element";
6838
- /** Key-value pair in a map (semantic unit) */
6839
- EdgeType["MapKeyValue"] = "map_key_value";
6840
- /** Key within a map */
6841
- EdgeType["MapKey"] = "map_key";
6842
- /** Value within a map */
6843
- EdgeType["MapValue"] = "map_value";
6844
- /** Content of a tagged value */
6845
- EdgeType["TaggedContent"] = "tagged_content";
6846
- return EdgeType;
6847
- }({});
6848
- /**
6849
6762
  * Returns a short text label for the edge type, or undefined if no label is needed.
6850
6763
  *
6851
6764
  * This is primarily used for tree formatting to identify relationships between elements.
@@ -6865,12 +6778,12 @@ let EdgeType = /* @__PURE__ */ function(EdgeType) {
6865
6778
  */
6866
6779
  const edgeLabel = (edge) => {
6867
6780
  switch (edge.type) {
6868
- case EdgeType.ArrayElement: return `arr[${edge.index}]`;
6869
- case EdgeType.MapKeyValue: return "kv";
6870
- case EdgeType.MapKey: return "key";
6871
- case EdgeType.MapValue: return "val";
6872
- case EdgeType.TaggedContent: return "content";
6873
- case EdgeType.None: return;
6781
+ case "array_element": return `arr[${edge.index}]`;
6782
+ case "map_key_value": return "kv";
6783
+ case "map_key": return "key";
6784
+ case "map_value": return "val";
6785
+ case "tagged_content": return "content";
6786
+ case "none": return;
6874
6787
  }
6875
6788
  };
6876
6789
  /**
@@ -6955,7 +6868,7 @@ const asKeyValue = (element) => {
6955
6868
  * ```
6956
6869
  */
6957
6870
  const walk = (cbor, initialState, visitor) => {
6958
- walkInternal(cbor, 0, { type: EdgeType.None }, initialState, visitor);
6871
+ walkInternal(cbor, 0, { type: "none" }, initialState, visitor);
6959
6872
  };
6960
6873
  /**
6961
6874
  * Internal recursive walk implementation.
@@ -7000,7 +6913,7 @@ function walkArray(cbor, level, state, visitor) {
7000
6913
  message: `Array element at index ${index} is undefined`
7001
6914
  });
7002
6915
  currentState = walkInternal(item, level + 1, {
7003
- type: EdgeType.ArrayElement,
6916
+ type: "array_element",
7004
6917
  index
7005
6918
  }, currentState, visitor);
7006
6919
  }
@@ -7024,11 +6937,11 @@ function walkMap(cbor, level, state, visitor) {
7024
6937
  type: "keyvalue",
7025
6938
  key,
7026
6939
  value
7027
- }, level + 1, { type: EdgeType.MapKeyValue }, currentState);
6940
+ }, level + 1, { type: "map_key_value" }, currentState);
7028
6941
  currentState = kvState;
7029
6942
  if (!kvStop) {
7030
- currentState = walkInternal(key, level + 1, { type: EdgeType.MapKey }, currentState, visitor);
7031
- currentState = walkInternal(value, level + 1, { type: EdgeType.MapValue }, currentState, visitor);
6943
+ currentState = walkInternal(key, level + 1, { type: "map_key" }, currentState, visitor);
6944
+ currentState = walkInternal(value, level + 1, { type: "map_value" }, currentState, visitor);
7032
6945
  }
7033
6946
  }
7034
6947
  return currentState;
@@ -7039,9 +6952,8 @@ function walkMap(cbor, level, state, visitor) {
7039
6952
  * @internal
7040
6953
  */
7041
6954
  function walkTagged(cbor, level, state, visitor) {
7042
- return walkInternal(cbor.value, level + 1, { type: EdgeType.TaggedContent }, state, visitor);
6955
+ return walkInternal(cbor.value, level + 1, { type: "tagged_content" }, state, visitor);
7043
6956
  }
7044
-
7045
6957
  //#endregion
7046
6958
  //#region src/cbor.ts
7047
6959
  /**
@@ -7509,18 +7421,43 @@ const Cbor = {
7509
7421
  value: NaN
7510
7422
  }
7511
7423
  }),
7424
+ /**
7425
+ * Creates a CBOR value from any JavaScript value.
7426
+ *
7427
+ * Matches Rust's `CBOR::from()` behavior for various types.
7428
+ *
7429
+ * @param value - Any JavaScript value (number, string, boolean, null, array, object, etc.)
7430
+ * @returns A CBOR symbolic representation with instance methods
7431
+ */
7512
7432
  from(value) {
7513
7433
  return cbor(value);
7514
7434
  },
7435
+ /**
7436
+ * Decodes binary data into CBOR symbolic representation.
7437
+ *
7438
+ * Matches Rust's `CBOR::try_from_data()` method.
7439
+ *
7440
+ * @param data - The binary data to decode
7441
+ * @returns A CBOR value with instance methods
7442
+ * @throws Error if the data is not valid CBOR or violates dCBOR encoding rules
7443
+ */
7515
7444
  tryFromData(data) {
7516
7445
  return decodeCbor(data);
7517
7446
  },
7447
+ /**
7448
+ * Decodes a hexadecimal string into CBOR symbolic representation.
7449
+ *
7450
+ * Matches Rust's `CBOR::try_from_hex()` method.
7451
+ *
7452
+ * @param hex - A string containing hexadecimal characters
7453
+ * @returns A CBOR value with instance methods
7454
+ * @throws Error if the hex string is invalid or the resulting data is not valid dCBOR
7455
+ */
7518
7456
  tryFromHex(hex) {
7519
7457
  const data = hexToBytes(hex);
7520
7458
  return this.tryFromData(data);
7521
7459
  }
7522
7460
  };
7523
-
7524
7461
  //#endregion
7525
7462
  //#region src/cbor-tagged-encodable.ts
7526
7463
  /**
@@ -7570,7 +7507,6 @@ const createTaggedCbor = (encodable) => {
7570
7507
  value: untagged
7571
7508
  });
7572
7509
  };
7573
-
7574
7510
  //#endregion
7575
7511
  //#region src/cbor-tagged-decodable.ts
7576
7512
  /**
@@ -7619,7 +7555,6 @@ const extractTaggedContent = (cbor) => {
7619
7555
  if (cbor.type !== MajorType.Tagged) throw new CborError({ type: "WrongType" });
7620
7556
  return cbor.value;
7621
7557
  };
7622
-
7623
7558
  //#endregion
7624
7559
  //#region src/date.ts
7625
7560
  /**
@@ -7843,8 +7778,7 @@ var CborDate = class CborDate {
7843
7778
  * ```
7844
7779
  */
7845
7780
  static withDurationFromNow(durationMs) {
7846
- const now = /* @__PURE__ */ new Date();
7847
- const future = new Date(now.getTime() + durationMs);
7781
+ const future = new Date((/* @__PURE__ */ new Date()).getTime() + durationMs);
7848
7782
  return CborDate.fromDatetime(future);
7849
7783
  }
7850
7784
  /**
@@ -7941,7 +7875,7 @@ var CborDate = class CborDate {
7941
7875
  * @returns A vector containing tag 1
7942
7876
  */
7943
7877
  cborTags() {
7944
- return [createTag(TAG_EPOCH_DATE_TIME, "date")];
7878
+ return [createTag(1, "date")];
7945
7879
  }
7946
7880
  /**
7947
7881
  * Implementation of the `CborTaggedEncodable` interface for `CborDate`.
@@ -8002,7 +7936,8 @@ var CborDate = class CborDate {
8002
7936
  message: "Invalid date CBOR: expected numeric value"
8003
7937
  });
8004
7938
  }
8005
- this._datetime = CborDate.fromTimestamp(timestamp)._datetime;
7939
+ const date = CborDate.fromTimestamp(timestamp);
7940
+ this._datetime = date._datetime;
8006
7941
  return this;
8007
7942
  }
8008
7943
  /**
@@ -8104,7 +8039,6 @@ var CborDate = class CborDate {
8104
8039
  this._datetime = /* @__PURE__ */ new Date();
8105
8040
  }
8106
8041
  };
8107
-
8108
8042
  //#endregion
8109
8043
  //#region src/bignum.ts
8110
8044
  /**
@@ -8370,7 +8304,6 @@ function cborToBigint(cbor) {
8370
8304
  case MajorType.Simple: throw new CborError({ type: "WrongType" });
8371
8305
  }
8372
8306
  }
8373
-
8374
8307
  //#endregion
8375
8308
  //#region src/tags.ts
8376
8309
  /**
@@ -8486,9 +8419,9 @@ const TAG_NAME_DATE = "date";
8486
8419
  * @param tagsStore - The tags store to register tags into
8487
8420
  */
8488
8421
  const registerTagsIn = (tagsStore) => {
8489
- const tags = [createTag(TAG_DATE, TAG_NAME_DATE)];
8422
+ const tags = [createTag(1, TAG_NAME_DATE)];
8490
8423
  tagsStore.insertAll(tags);
8491
- tagsStore.setSummarizer(TAG_DATE, (untaggedCbor, _flat) => {
8424
+ tagsStore.setSummarizer(1, (untaggedCbor, _flat) => {
8492
8425
  try {
8493
8426
  return {
8494
8427
  ok: true,
@@ -8504,10 +8437,10 @@ const registerTagsIn = (tagsStore) => {
8504
8437
  };
8505
8438
  }
8506
8439
  });
8507
- const biguintTag = createTag(TAG_POSITIVE_BIGNUM, TAG_NAME_POSITIVE_BIGNUM);
8508
- const bigintTag = createTag(TAG_NEGATIVE_BIGNUM, TAG_NAME_NEGATIVE_BIGNUM);
8440
+ const biguintTag = createTag(2, TAG_NAME_POSITIVE_BIGNUM);
8441
+ const bigintTag = createTag(3, TAG_NAME_NEGATIVE_BIGNUM);
8509
8442
  tagsStore.insertAll([biguintTag, bigintTag]);
8510
- tagsStore.setSummarizer(TAG_POSITIVE_BIGNUM, (untaggedCbor, _flat) => {
8443
+ tagsStore.setSummarizer(2, (untaggedCbor, _flat) => {
8511
8444
  try {
8512
8445
  return {
8513
8446
  ok: true,
@@ -8523,7 +8456,7 @@ const registerTagsIn = (tagsStore) => {
8523
8456
  };
8524
8457
  }
8525
8458
  });
8526
- tagsStore.setSummarizer(TAG_NEGATIVE_BIGNUM, (untaggedCbor, _flat) => {
8459
+ tagsStore.setSummarizer(3, (untaggedCbor, _flat) => {
8527
8460
  try {
8528
8461
  return {
8529
8462
  ok: true,
@@ -8586,7 +8519,6 @@ const tagsForValues = (values) => {
8586
8519
  return createTag(value);
8587
8520
  });
8588
8521
  };
8589
-
8590
8522
  //#endregion
8591
8523
  //#region src/set.ts
8592
8524
  /**
@@ -8878,7 +8810,7 @@ var CborSet = class CborSet {
8878
8810
  for (const value of this) callback(value);
8879
8811
  }
8880
8812
  cborTags() {
8881
- return [createTag(TAG_SET, "set")];
8813
+ return [createTag(258, "set")];
8882
8814
  }
8883
8815
  untaggedCbor() {
8884
8816
  return cbor(this.values());
@@ -8991,7 +8923,6 @@ function encodeCborValue(value) {
8991
8923
  if (typeof value === "object" && value !== null && "isCbor" in value && value.isCbor === true) return value;
8992
8924
  return cbor(value);
8993
8925
  }
8994
-
8995
8926
  //#endregion
8996
8927
  //#region src/byte-string.ts
8997
8928
  /**
@@ -9271,7 +9202,7 @@ var ByteString = class ByteString {
9271
9202
  return new ByteString(this.toUint8Array());
9272
9203
  }
9273
9204
  };
9274
-
9275
9205
  //#endregion
9276
9206
  export { ByteString, Cbor, CborDate, CborError, CborMap, CborSet, Err, MajorType, Ok, TAG_BASE16, TAG_BASE64, TAG_BASE64URL, TAG_BASE64URL_TEXT, TAG_BASE64_TEXT, TAG_BIGFLOAT, TAG_BINARY_UUID, TAG_DATE, TAG_DATE_TIME_STRING, TAG_DECIMAL_FRACTION, TAG_ENCODED_CBOR, TAG_EPOCH_DATE, TAG_EPOCH_DATE_TIME, TAG_MIME_MESSAGE, TAG_NAME_DATE, TAG_NAME_NEGATIVE_BIGNUM, TAG_NAME_POSITIVE_BIGNUM, TAG_NEGATIVE_BIGNUM, TAG_POSITIVE_BIGNUM, TAG_REGEXP, TAG_SELF_DESCRIBE_CBOR, TAG_SET, TAG_STRING_REF_NAMESPACE, TAG_URI, TAG_UUID, TagsStore, arrayIsEmpty, arrayItem, arrayLength, asArray, asBoolean, asByteString, asBytes, asCborArray, asCborMap, asFloat, asInteger, asKeyValue, asMap, asNegative, asNumber, asSingle, asTaggedValue, asText, asUnsigned, bigintFromNegativeUntaggedCbor, bigintToCbor, biguintFromUntaggedCbor, biguintToCbor, bytesToHex, cbor, cborData, cborToBigint, cborToBiguint, createTag, createTaggedCbor, decodeCbor, decodeVarInt, decodeVarIntData, diagnosticOpt, edgeLabel, encodeVarInt, errorMsg, errorToString, expectArray, expectBoolean, expectBoolean as tryIntoBool, expectBytes, expectBytes as tryIntoByteString, expectFloat, expectInteger, expectMap, expectNegative, expectNumber, expectTaggedContent, expectTaggedContent as tryExpectedTaggedValue, expectText, expectText as tryIntoText, expectUnsigned, extractCbor, extractTaggedContent, getGlobalTagsStore, getTaggedContent, hasFractionalPart, hasTag, hexOpt, hexToBytes, isArray, isBoolean, isBytes, isFloat, isInteger, isMap, isNaN$1 as isNaN, isNegative, isNull, isNumber, isSimple, isTagged, isText, isUnsigned, mapHas, mapIsEmpty, mapKeys, mapSize, mapValue, mapValues, registerTags, registerTagsIn, simpleName, summary, tagContent, tagValue, tagsForValues, toByteString, toByteStringFromHex, toTaggedValue, validateTag, walk };
9207
+
9277
9208
  //# sourceMappingURL=index.mjs.map