@learncard/core 5.0.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -123,7 +123,7 @@ function base(ALPHABET, name5) {
123
123
  var LEADER = ALPHABET.charAt(0);
124
124
  var FACTOR = Math.log(BASE) / Math.log(256);
125
125
  var iFACTOR = Math.log(256) / Math.log(BASE);
126
- function encode11(source) {
126
+ function encode18(source) {
127
127
  if (source instanceof Uint8Array)
128
128
  ;
129
129
  else if (ArrayBuffer.isView(source)) {
@@ -171,7 +171,7 @@ function base(ALPHABET, name5) {
171
171
  }
172
172
  return str;
173
173
  }
174
- __name(encode11, "encode");
174
+ __name(encode18, "encode");
175
175
  function decodeUnsafe(source) {
176
176
  if (typeof source !== "string") {
177
177
  throw new TypeError("Expected String");
@@ -223,18 +223,18 @@ function base(ALPHABET, name5) {
223
223
  return vch;
224
224
  }
225
225
  __name(decodeUnsafe, "decodeUnsafe");
226
- function decode10(string2) {
226
+ function decode14(string2) {
227
227
  var buffer2 = decodeUnsafe(string2);
228
228
  if (buffer2) {
229
229
  return buffer2;
230
230
  }
231
231
  throw new Error(`Non-${name5} character`);
232
232
  }
233
- __name(decode10, "decode");
233
+ __name(decode14, "decode");
234
234
  return {
235
- encode: encode11,
235
+ encode: encode18,
236
236
  decodeUnsafe,
237
- decode: decode10
237
+ decode: decode14
238
238
  };
239
239
  }
240
240
  var src, _brrp__multiformats_scope_baseX, base_x_default;
@@ -379,20 +379,20 @@ var init_base = __esm({
379
379
  }
380
380
  };
381
381
  __name(Codec, "Codec");
382
- from = /* @__PURE__ */ __name(({ name: name5, prefix, encode: encode11, decode: decode10 }) => new Codec(name5, prefix, encode11, decode10), "from");
383
- baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet: alphabet2 }) => {
384
- const { encode: encode11, decode: decode10 } = base_x_default(alphabet2, name5);
382
+ from = /* @__PURE__ */ __name(({ name: name5, prefix, encode: encode18, decode: decode14 }) => new Codec(name5, prefix, encode18, decode14), "from");
383
+ baseX = /* @__PURE__ */ __name(({ prefix, name: name5, alphabet: alphabet3 }) => {
384
+ const { encode: encode18, decode: decode14 } = base_x_default(alphabet3, name5);
385
385
  return from({
386
386
  prefix,
387
387
  name: name5,
388
- encode: encode11,
389
- decode: (text) => coerce(decode10(text))
388
+ encode: encode18,
389
+ decode: (text) => coerce(decode14(text))
390
390
  });
391
391
  }, "baseX");
392
- decode = /* @__PURE__ */ __name((string2, alphabet2, bitsPerChar, name5) => {
392
+ decode = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar, name5) => {
393
393
  const codes = {};
394
- for (let i = 0; i < alphabet2.length; ++i) {
395
- codes[alphabet2[i]] = i;
394
+ for (let i = 0; i < alphabet3.length; ++i) {
395
+ codes[alphabet3[i]] = i;
396
396
  }
397
397
  let end = string2.length;
398
398
  while (string2[end - 1] === "=") {
@@ -419,8 +419,8 @@ var init_base = __esm({
419
419
  }
420
420
  return out;
421
421
  }, "decode");
422
- encode = /* @__PURE__ */ __name((data, alphabet2, bitsPerChar) => {
423
- const pad2 = alphabet2[alphabet2.length - 1] === "=";
422
+ encode = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
423
+ const pad2 = alphabet3[alphabet3.length - 1] === "=";
424
424
  const mask = (1 << bitsPerChar) - 1;
425
425
  let out = "";
426
426
  let bits = 0;
@@ -430,11 +430,11 @@ var init_base = __esm({
430
430
  bits += 8;
431
431
  while (bits > bitsPerChar) {
432
432
  bits -= bitsPerChar;
433
- out += alphabet2[mask & buffer2 >> bits];
433
+ out += alphabet3[mask & buffer2 >> bits];
434
434
  }
435
435
  }
436
436
  if (bits) {
437
- out += alphabet2[mask & buffer2 << bitsPerChar - bits];
437
+ out += alphabet3[mask & buffer2 << bitsPerChar - bits];
438
438
  }
439
439
  if (pad2) {
440
440
  while (out.length * bitsPerChar & 7) {
@@ -443,15 +443,15 @@ var init_base = __esm({
443
443
  }
444
444
  return out;
445
445
  }, "encode");
446
- rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet: alphabet2 }) => {
446
+ rfc4648 = /* @__PURE__ */ __name(({ name: name5, prefix, bitsPerChar, alphabet: alphabet3 }) => {
447
447
  return from({
448
448
  prefix,
449
449
  name: name5,
450
450
  encode(input) {
451
- return encode(input, alphabet2, bitsPerChar);
451
+ return encode(input, alphabet3, bitsPerChar);
452
452
  },
453
453
  decode(input) {
454
- return decode(input, alphabet2, bitsPerChar, name5);
454
+ return decode(input, alphabet3, bitsPerChar, name5);
455
455
  }
456
456
  });
457
457
  }, "rfc4648");
@@ -916,12 +916,12 @@ var from2, Hasher;
916
916
  var init_hasher = __esm({
917
917
  "../../node_modules/.pnpm/multiformats@9.7.0/node_modules/multiformats/esm/src/hashes/hasher.js"() {
918
918
  init_digest();
919
- from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode: encode11 }) => new Hasher(name5, code5, encode11), "from");
919
+ from2 = /* @__PURE__ */ __name(({ name: name5, code: code5, encode: encode18 }) => new Hasher(name5, code5, encode18), "from");
920
920
  Hasher = class {
921
- constructor(name5, code5, encode11) {
921
+ constructor(name5, code5, encode18) {
922
922
  this.name = name5;
923
923
  this.code = code5;
924
- this.encode = encode11;
924
+ this.encode = encode18;
925
925
  }
926
926
  digest(input) {
927
927
  if (input instanceof Uint8Array) {
@@ -1034,9 +1034,9 @@ var init_cid = __esm({
1034
1034
  init_base32();
1035
1035
  init_bytes();
1036
1036
  CID = class {
1037
- constructor(version11, code5, multihash, bytes) {
1037
+ constructor(version12, code5, multihash, bytes) {
1038
1038
  this.code = code5;
1039
- this.version = version11;
1039
+ this.version = version12;
1040
1040
  this.multihash = multihash;
1041
1041
  this.bytes = bytes;
1042
1042
  this.byteOffset = bytes.byteOffset;
@@ -1090,8 +1090,8 @@ var init_cid = __esm({
1090
1090
  return other && this.code === other.code && this.version === other.version && equals2(this.multihash, other.multihash);
1091
1091
  }
1092
1092
  toString(base4) {
1093
- const { bytes, version: version11, _baseCache } = this;
1094
- switch (version11) {
1093
+ const { bytes, version: version12, _baseCache } = this;
1094
+ switch (version12) {
1095
1095
  case 0:
1096
1096
  return toStringV0(bytes, _baseCache, base4 || base58btc.encoder);
1097
1097
  default:
@@ -1134,31 +1134,31 @@ var init_cid = __esm({
1134
1134
  if (value instanceof CID) {
1135
1135
  return value;
1136
1136
  } else if (value != null && value.asCID === value) {
1137
- const { version: version11, code: code5, multihash, bytes } = value;
1138
- return new CID(version11, code5, multihash, bytes || encodeCID(version11, code5, multihash.bytes));
1137
+ const { version: version12, code: code5, multihash, bytes } = value;
1138
+ return new CID(version12, code5, multihash, bytes || encodeCID(version12, code5, multihash.bytes));
1139
1139
  } else if (value != null && value[cidSymbol] === true) {
1140
- const { version: version11, multihash, code: code5 } = value;
1140
+ const { version: version12, multihash, code: code5 } = value;
1141
1141
  const digest2 = decode5(multihash);
1142
- return CID.create(version11, code5, digest2);
1142
+ return CID.create(version12, code5, digest2);
1143
1143
  } else {
1144
1144
  return null;
1145
1145
  }
1146
1146
  }
1147
- static create(version11, code5, digest2) {
1147
+ static create(version12, code5, digest2) {
1148
1148
  if (typeof code5 !== "number") {
1149
1149
  throw new Error("String codecs are no longer supported");
1150
1150
  }
1151
- switch (version11) {
1151
+ switch (version12) {
1152
1152
  case 0: {
1153
1153
  if (code5 !== DAG_PB_CODE) {
1154
1154
  throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
1155
1155
  } else {
1156
- return new CID(version11, code5, digest2, digest2.bytes);
1156
+ return new CID(version12, code5, digest2, digest2.bytes);
1157
1157
  }
1158
1158
  }
1159
1159
  case 1: {
1160
- const bytes = encodeCID(version11, code5, digest2.bytes);
1161
- return new CID(version11, code5, digest2, bytes);
1160
+ const bytes = encodeCID(version12, code5, digest2.bytes);
1161
+ return new CID(version12, code5, digest2, bytes);
1162
1162
  }
1163
1163
  default: {
1164
1164
  throw new Error("Invalid version");
@@ -1200,16 +1200,16 @@ var init_cid = __esm({
1200
1200
  offset += length2;
1201
1201
  return i;
1202
1202
  }, "next");
1203
- let version11 = next();
1203
+ let version12 = next();
1204
1204
  let codec = DAG_PB_CODE;
1205
- if (version11 === 18) {
1206
- version11 = 0;
1205
+ if (version12 === 18) {
1206
+ version12 = 0;
1207
1207
  offset = 0;
1208
- } else if (version11 === 1) {
1208
+ } else if (version12 === 1) {
1209
1209
  codec = next();
1210
1210
  }
1211
- if (version11 !== 0 && version11 !== 1) {
1212
- throw new RangeError(`Invalid CID version ${version11}`);
1211
+ if (version12 !== 0 && version12 !== 1) {
1212
+ throw new RangeError(`Invalid CID version ${version12}`);
1213
1213
  }
1214
1214
  const prefixSize = offset;
1215
1215
  const multihashCode = next();
@@ -1217,7 +1217,7 @@ var init_cid = __esm({
1217
1217
  const size = offset + digestSize;
1218
1218
  const multihashSize = size - prefixSize;
1219
1219
  return {
1220
- version: version11,
1220
+ version: version12,
1221
1221
  codec,
1222
1222
  multihashCode,
1223
1223
  digestSize,
@@ -1294,11 +1294,11 @@ var init_cid = __esm({
1294
1294
  }, "toStringV1");
1295
1295
  DAG_PB_CODE = 112;
1296
1296
  SHA_256_CODE = 18;
1297
- encodeCID = /* @__PURE__ */ __name((version11, code5, multihash) => {
1298
- const codeOffset = encodingLength(version11);
1297
+ encodeCID = /* @__PURE__ */ __name((version12, code5, multihash) => {
1298
+ const codeOffset = encodingLength(version12);
1299
1299
  const hashOffset = codeOffset + encodingLength(code5);
1300
1300
  const bytes = new Uint8Array(hashOffset + multihash.byteLength);
1301
- encodeTo(version11, bytes, 0);
1301
+ encodeTo(version12, bytes, 0);
1302
1302
  encodeTo(code5, bytes, codeOffset);
1303
1303
  bytes.set(multihash, hashOffset);
1304
1304
  return bytes;
@@ -1391,16 +1391,16 @@ var init_basics = __esm({
1391
1391
  });
1392
1392
 
1393
1393
  // ../../node_modules/.pnpm/uint8arrays@3.0.0/node_modules/uint8arrays/esm/src/util/bases.js
1394
- function createCodec(name5, prefix, encode11, decode10) {
1394
+ function createCodec(name5, prefix, encode18, decode14) {
1395
1395
  return {
1396
1396
  name: name5,
1397
1397
  prefix,
1398
1398
  encoder: {
1399
1399
  name: name5,
1400
1400
  prefix,
1401
- encode: encode11
1401
+ encode: encode18
1402
1402
  },
1403
- decoder: { decode: decode10 }
1403
+ decoder: { decode: decode14 }
1404
1404
  };
1405
1405
  }
1406
1406
  var string, ascii, BASES, bases_default;
@@ -2881,9 +2881,9 @@ var require_package = __commonJS({
2881
2881
  }
2882
2882
  });
2883
2883
 
2884
- // (disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
2884
+ // (disabled):../../node_modules/.pnpm/buffer@5.2.1/node_modules/buffer/index.js
2885
2885
  var require_buffer = __commonJS({
2886
- "(disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"() {
2886
+ "(disabled):../../node_modules/.pnpm/buffer@5.2.1/node_modules/buffer/index.js"() {
2887
2887
  }
2888
2888
  });
2889
2889
 
@@ -3190,7 +3190,7 @@ var require_bn = __commonJS({
3190
3190
  }
3191
3191
  return this;
3192
3192
  }, "_normSign");
3193
- BN3.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
3193
+ BN3.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
3194
3194
  return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
3195
3195
  }, "inspect");
3196
3196
  var zeros = [
@@ -3299,7 +3299,7 @@ var require_bn = __commonJS({
3299
3299
  52521875,
3300
3300
  60466176
3301
3301
  ];
3302
- BN3.prototype.toString = /* @__PURE__ */ __name(function toString5(base4, padding) {
3302
+ BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
3303
3303
  base4 = base4 || 10;
3304
3304
  padding = padding | 0 || 1;
3305
3305
  var out;
@@ -5808,7 +5808,7 @@ var require_utils = __commonJS({
5808
5808
  }
5809
5809
  __name(toHex2, "toHex");
5810
5810
  utils.toHex = toHex2;
5811
- utils.encode = /* @__PURE__ */ __name(function encode11(arr, enc) {
5811
+ utils.encode = /* @__PURE__ */ __name(function encode18(arr, enc) {
5812
5812
  if (enc === "hex")
5813
5813
  return toHex2(arr);
5814
5814
  else
@@ -6019,7 +6019,7 @@ var require_base = __commonJS({
6019
6019
  BaseCurve2.prototype.point = /* @__PURE__ */ __name(function point3() {
6020
6020
  throw new Error("Not implemented");
6021
6021
  }, "point");
6022
- BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function validate6() {
6022
+ BaseCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
6023
6023
  throw new Error("Not implemented");
6024
6024
  }, "validate");
6025
6025
  BaseCurve2.prototype._fixedNafMul = /* @__PURE__ */ __name(function _fixedNafMul2(p, k) {
@@ -6198,7 +6198,7 @@ var require_base = __commonJS({
6198
6198
  BasePoint2.prototype.eq = /* @__PURE__ */ __name(function eq4() {
6199
6199
  throw new Error("Not implemented");
6200
6200
  }, "eq");
6201
- BasePoint2.prototype.validate = /* @__PURE__ */ __name(function validate6() {
6201
+ BasePoint2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
6202
6202
  return this.curve.validate(this);
6203
6203
  }, "validate");
6204
6204
  BaseCurve2.prototype.decodePoint = /* @__PURE__ */ __name(function decodePoint2(bytes, enc) {
@@ -6219,14 +6219,14 @@ var require_base = __commonJS({
6219
6219
  BasePoint2.prototype.encodeCompressed = /* @__PURE__ */ __name(function encodeCompressed2(enc) {
6220
6220
  return this.encode(enc, true);
6221
6221
  }, "encodeCompressed");
6222
- BasePoint2.prototype._encode = /* @__PURE__ */ __name(function _encode2(compact) {
6222
+ BasePoint2.prototype._encode = /* @__PURE__ */ __name(function _encode3(compact) {
6223
6223
  var len = this.curve.p.byteLength();
6224
6224
  var x = this.getX().toArray("be", len);
6225
6225
  if (compact)
6226
6226
  return [this.getY().isEven() ? 2 : 3].concat(x);
6227
6227
  return [4].concat(x, this.getY().toArray("be", len));
6228
6228
  }, "_encode");
6229
- BasePoint2.prototype.encode = /* @__PURE__ */ __name(function encode11(enc, compact) {
6229
+ BasePoint2.prototype.encode = /* @__PURE__ */ __name(function encode18(enc, compact) {
6230
6230
  return utils.encode(this._encode(compact), enc);
6231
6231
  }, "encode");
6232
6232
  BasePoint2.prototype.precompute = /* @__PURE__ */ __name(function precompute2(power) {
@@ -6482,7 +6482,7 @@ var require_short = __commonJS({
6482
6482
  y = y.redNeg();
6483
6483
  return this.point(x, y);
6484
6484
  }, "pointFromX");
6485
- ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function validate6(point3) {
6485
+ ShortCurve2.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
6486
6486
  if (point3.inf)
6487
6487
  return true;
6488
6488
  var x = point3.x;
@@ -6611,7 +6611,7 @@ var require_short = __commonJS({
6611
6611
  };
6612
6612
  return res;
6613
6613
  }, "fromJSON");
6614
- Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
6614
+ Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
6615
6615
  if (this.isInfinity())
6616
6616
  return "<EC Point Infinity>";
6617
6617
  return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + ">";
@@ -7014,7 +7014,7 @@ var require_short = __commonJS({
7014
7014
  return true;
7015
7015
  }
7016
7016
  }, "eqXToP");
7017
- JPoint2.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
7017
+ JPoint2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
7018
7018
  if (this.isInfinity())
7019
7019
  return "<EC JPoint Infinity>";
7020
7020
  return "<EC JPoint x: " + this.x.toString(16, 2) + " y: " + this.y.toString(16, 2) + " z: " + this.z.toString(16, 2) + ">";
@@ -7044,7 +7044,7 @@ var require_mont = __commonJS({
7044
7044
  __name(MontCurve, "MontCurve");
7045
7045
  inherits(MontCurve, Base);
7046
7046
  module2.exports = MontCurve;
7047
- MontCurve.prototype.validate = /* @__PURE__ */ __name(function validate6(point3) {
7047
+ MontCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
7048
7048
  var x = point3.normalize().x;
7049
7049
  var x2 = x.redSqr();
7050
7050
  var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
@@ -7078,13 +7078,13 @@ var require_mont = __commonJS({
7078
7078
  }, "pointFromJSON");
7079
7079
  Point2.prototype.precompute = /* @__PURE__ */ __name(function precompute2() {
7080
7080
  }, "precompute");
7081
- Point2.prototype._encode = /* @__PURE__ */ __name(function _encode2() {
7081
+ Point2.prototype._encode = /* @__PURE__ */ __name(function _encode3() {
7082
7082
  return this.getX().toArray("be", this.curve.p.byteLength());
7083
7083
  }, "_encode");
7084
7084
  Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
7085
7085
  return new Point2(curve, obj[0], obj[1] || curve.one);
7086
7086
  }, "fromJSON");
7087
- Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
7087
+ Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
7088
7088
  if (this.isInfinity())
7089
7089
  return "<EC Point Infinity>";
7090
7090
  return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
@@ -7233,7 +7233,7 @@ var require_edwards = __commonJS({
7233
7233
  x = x.redNeg();
7234
7234
  return this.point(x, y);
7235
7235
  }, "pointFromY");
7236
- EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function validate6(point3) {
7236
+ EdwardsCurve.prototype.validate = /* @__PURE__ */ __name(function validate7(point3) {
7237
7237
  if (point3.isInfinity())
7238
7238
  return true;
7239
7239
  point3.normalize();
@@ -7283,7 +7283,7 @@ var require_edwards = __commonJS({
7283
7283
  Point2.fromJSON = /* @__PURE__ */ __name(function fromJSON2(curve, obj) {
7284
7284
  return new Point2(curve, obj[0], obj[1], obj[2]);
7285
7285
  }, "fromJSON");
7286
- Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
7286
+ Point2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
7287
7287
  if (this.isInfinity())
7288
7288
  return "<EC Point Infinity>";
7289
7289
  return "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
@@ -10179,7 +10179,7 @@ var require_key = __commonJS({
10179
10179
  privEnc: enc
10180
10180
  });
10181
10181
  }, "fromPrivate");
10182
- KeyPair2.prototype.validate = /* @__PURE__ */ __name(function validate6() {
10182
+ KeyPair2.prototype.validate = /* @__PURE__ */ __name(function validate7() {
10183
10183
  var pub = this.getPublic();
10184
10184
  if (pub.isInfinity())
10185
10185
  return { result: false, reason: "Invalid public key" };
@@ -10234,7 +10234,7 @@ var require_key = __commonJS({
10234
10234
  KeyPair2.prototype.verify = /* @__PURE__ */ __name(function verify4(msg, signature2) {
10235
10235
  return this.ec.verify(msg, signature2, this);
10236
10236
  }, "verify");
10237
- KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function inspect4() {
10237
+ KeyPair2.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
10238
10238
  return "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub.inspect()) + " >";
10239
10239
  }, "inspect");
10240
10240
  }
@@ -15299,7 +15299,7 @@ var require_transformers = __commonJS({
15299
15299
  return void 0;
15300
15300
  },
15301
15301
  decode(codes) {
15302
- function validate6(buf3) {
15302
+ function validate7(buf3) {
15303
15303
  const chars = [];
15304
15304
  let tail2 = 0;
15305
15305
  for (let i2 = 0; i2 < buf3.length; i2 += 1) {
@@ -15358,11 +15358,11 @@ var require_transformers = __commonJS({
15358
15358
  }
15359
15359
  return { tail: tail2, buf: Buffer.from(chars) };
15360
15360
  }
15361
- __name(validate6, "validate");
15361
+ __name(validate7, "validate");
15362
15362
  if (codes.length === 0) {
15363
15363
  return Buffer.alloc(0);
15364
15364
  }
15365
- const val = validate6(codes);
15365
+ const val = validate7(codes);
15366
15366
  const { tail } = val;
15367
15367
  const base642 = val.buf;
15368
15368
  let i;
@@ -15433,7 +15433,7 @@ ${c4}`;
15433
15433
  }
15434
15434
  }
15435
15435
  __name(buildLine, "buildLine");
15436
- function validate6(c) {
15436
+ function validate7(c) {
15437
15437
  if (c >= 65 && c <= 90) {
15438
15438
  return true;
15439
15439
  }
@@ -15454,10 +15454,10 @@ ${c4}`;
15454
15454
  }
15455
15455
  return false;
15456
15456
  }
15457
- __name(validate6, "validate");
15457
+ __name(validate7, "validate");
15458
15458
  for (let i = 0; i < buf2.length; i += 4) {
15459
15459
  for (let j = i; j < i + 4; j += 1) {
15460
- if (!validate6(buf2[j])) {
15460
+ if (!validate7(buf2[j])) {
15461
15461
  throw new RangeError(`base64.toString: buf[${j}]: ${buf2[j]} : not valid base64 character code`);
15462
15462
  }
15463
15463
  }
@@ -15756,7 +15756,7 @@ var require_converter = __commonJS({
15756
15756
  }
15757
15757
  return ret;
15758
15758
  }, "validateDst");
15759
- var encode11 = /* @__PURE__ */ __name(function encode12(type, chars) {
15759
+ var encode18 = /* @__PURE__ */ __name(function encode19(type, chars) {
15760
15760
  switch (type) {
15761
15761
  case UTF8:
15762
15762
  return trans.utf8.encode(chars);
@@ -15788,7 +15788,7 @@ var require_converter = __commonJS({
15788
15788
  throw new TypeError(`encode type "${type}" not recognized`);
15789
15789
  }
15790
15790
  }, "encode");
15791
- var decode10 = /* @__PURE__ */ __name(function decode11(src2) {
15791
+ var decode14 = /* @__PURE__ */ __name(function decode15(src2) {
15792
15792
  switch (src2.type) {
15793
15793
  case UTF8:
15794
15794
  return trans.utf8.decode(src2.data, src2.bom);
@@ -15822,7 +15822,7 @@ var require_converter = __commonJS({
15822
15822
  }, "decode");
15823
15823
  exports.decode = /* @__PURE__ */ __name(function exportsDecode(type, data) {
15824
15824
  const src2 = validateSrc(type, data);
15825
- return decode10(src2);
15825
+ return decode14(src2);
15826
15826
  }, "exportsDecode");
15827
15827
  exports.encode = /* @__PURE__ */ __name(function exportsEncode(type, chars) {
15828
15828
  let c;
@@ -15830,12 +15830,12 @@ var require_converter = __commonJS({
15830
15830
  const dst = validateDst(type, chars);
15831
15831
  if (dst.crlf) {
15832
15832
  c = trans.lineEnds.crlf(chars);
15833
- buf2 = encode11(dst.type, c);
15833
+ buf2 = encode18(dst.type, c);
15834
15834
  } else if (dst.lf) {
15835
15835
  c = trans.lineEnds.lf(chars);
15836
- buf2 = encode11(dst.type, c);
15836
+ buf2 = encode18(dst.type, c);
15837
15837
  } else {
15838
- buf2 = encode11(dst.type, chars);
15838
+ buf2 = encode18(dst.type, chars);
15839
15839
  }
15840
15840
  if (dst.base64) {
15841
15841
  buf2 = trans.base64.encode(buf2);
@@ -17045,7 +17045,7 @@ var require_parser = __commonJS({
17045
17045
  initializeInputChars(inputChars, inputIndex, inputLength);
17046
17046
  return privateParse(grammar, startRule, callbackData);
17047
17047
  }, "parseSubstring");
17048
- this.parse = /* @__PURE__ */ __name(function parse2(grammar, startRule, inputChars, callbackData) {
17048
+ this.parse = /* @__PURE__ */ __name(function parse3(grammar, startRule, inputChars, callbackData) {
17049
17049
  clear();
17050
17050
  initializeInputChars(inputChars, 0, inputChars.length);
17051
17051
  return privateParse(grammar, startRule, callbackData);
@@ -18027,7 +18027,7 @@ var require_stats = __commonJS({
18027
18027
  }
18028
18028
  return html;
18029
18029
  }, "displayRules");
18030
- this.validate = /* @__PURE__ */ __name(function validate6(name5) {
18030
+ this.validate = /* @__PURE__ */ __name(function validate7(name5) {
18031
18031
  let ret = false;
18032
18032
  if (typeof name5 === "string" && nameId === name5) {
18033
18033
  ret = true;
@@ -18659,9 +18659,9 @@ var require_trace = __commonJS({
18659
18659
  obj.tree = display(root, root.depth, false);
18660
18660
  return obj;
18661
18661
  }, "toTreeObj");
18662
- this.toTree = function(stringify2) {
18662
+ this.toTree = function(stringify3) {
18663
18663
  const obj = toTreeObj();
18664
- if (stringify2) {
18664
+ if (stringify3) {
18665
18665
  return JSON.stringify(obj);
18666
18666
  }
18667
18667
  return obj;
@@ -19235,7 +19235,7 @@ var require_scanner_grammar = __commonJS({
19235
19235
  this.rules[8].opcodes[0] = { type: 6, string: [10] };
19236
19236
  this.rules[9].opcodes = [];
19237
19237
  this.rules[9].opcodes[0] = { type: 6, string: [13] };
19238
- this.toString = /* @__PURE__ */ __name(function toString5() {
19238
+ this.toString = /* @__PURE__ */ __name(function toString6() {
19239
19239
  let str = "";
19240
19240
  str += "file = *line [last-line]\n";
19241
19241
  str += "line = line-text end\n";
@@ -21448,7 +21448,7 @@ var require_sabnf_grammar = __commonJS({
21448
21448
  this.rules[94].opcodes[5] = { type: 1, children: [6, 7] };
21449
21449
  this.rules[94].opcodes[6] = { type: 6, string: [32] };
21450
21450
  this.rules[94].opcodes[7] = { type: 6, string: [9] };
21451
- this.toString = /* @__PURE__ */ __name(function toString5() {
21451
+ this.toString = /* @__PURE__ */ __name(function toString6() {
21452
21452
  let str = "";
21453
21453
  str += ";\n";
21454
21454
  str += "; ABNF for JavaScript APG 2.0 SABNF\n";
@@ -23263,7 +23263,7 @@ var require_api = __commonJS({
23263
23263
  this.lines = scanner(this.chars, this.errors, strict, trace);
23264
23264
  isScanned = true;
23265
23265
  }, "scan");
23266
- this.parse = /* @__PURE__ */ __name(function parse2(strict, trace) {
23266
+ this.parse = /* @__PURE__ */ __name(function parse3(strict, trace) {
23267
23267
  if (!isScanned) {
23268
23268
  throw new Error(`${thisFileName}grammar not scanned`);
23269
23269
  }
@@ -23690,17 +23690,17 @@ var require_bn2 = __commonJS({
23690
23690
  }, "_normSign");
23691
23691
  if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") {
23692
23692
  try {
23693
- BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect4;
23693
+ BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect5;
23694
23694
  } catch (e) {
23695
- BN3.prototype.inspect = inspect4;
23695
+ BN3.prototype.inspect = inspect5;
23696
23696
  }
23697
23697
  } else {
23698
- BN3.prototype.inspect = inspect4;
23698
+ BN3.prototype.inspect = inspect5;
23699
23699
  }
23700
- function inspect4() {
23700
+ function inspect5() {
23701
23701
  return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
23702
23702
  }
23703
- __name(inspect4, "inspect");
23703
+ __name(inspect5, "inspect");
23704
23704
  var zeros = [
23705
23705
  "",
23706
23706
  "0",
@@ -23807,7 +23807,7 @@ var require_bn2 = __commonJS({
23807
23807
  52521875,
23808
23808
  60466176
23809
23809
  ];
23810
- BN3.prototype.toString = /* @__PURE__ */ __name(function toString5(base4, padding) {
23810
+ BN3.prototype.toString = /* @__PURE__ */ __name(function toString6(base4, padding) {
23811
23811
  base4 = base4 || 10;
23812
23812
  padding = padding | 0 || 1;
23813
23813
  var out;
@@ -26310,14 +26310,14 @@ var require_bn2 = __commonJS({
26310
26310
  // ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
26311
26311
  var require_encode = __commonJS({
26312
26312
  "../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports, module2) {
26313
- module2.exports = encode11;
26313
+ module2.exports = encode18;
26314
26314
  var MSB2 = 128;
26315
26315
  var REST2 = 127;
26316
26316
  var MSBALL2 = ~REST2;
26317
26317
  var INT2 = Math.pow(2, 31);
26318
- function encode11(num, out, offset) {
26318
+ function encode18(num, out, offset) {
26319
26319
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
26320
- encode11.bytes = 0;
26320
+ encode18.bytes = 0;
26321
26321
  throw new RangeError("Could not encode varint");
26322
26322
  }
26323
26323
  out = out || [];
@@ -26332,10 +26332,10 @@ var require_encode = __commonJS({
26332
26332
  num >>>= 7;
26333
26333
  }
26334
26334
  out[offset] = num | 0;
26335
- encode11.bytes = offset - oldOffset + 1;
26335
+ encode18.bytes = offset - oldOffset + 1;
26336
26336
  return out;
26337
26337
  }
26338
- __name(encode11, "encode");
26338
+ __name(encode18, "encode");
26339
26339
  }
26340
26340
  });
26341
26341
 
@@ -26366,17 +26366,17 @@ var require_decode = __commonJS({
26366
26366
  // ../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js
26367
26367
  var require_length = __commonJS({
26368
26368
  "../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports, module2) {
26369
- var N12 = Math.pow(2, 7);
26370
- var N22 = Math.pow(2, 14);
26371
- var N32 = Math.pow(2, 21);
26372
- var N42 = Math.pow(2, 28);
26369
+ var N13 = Math.pow(2, 7);
26370
+ var N23 = Math.pow(2, 14);
26371
+ var N33 = Math.pow(2, 21);
26372
+ var N43 = Math.pow(2, 28);
26373
26373
  var N52 = Math.pow(2, 35);
26374
26374
  var N62 = Math.pow(2, 42);
26375
26375
  var N72 = Math.pow(2, 49);
26376
26376
  var N82 = Math.pow(2, 56);
26377
26377
  var N92 = Math.pow(2, 63);
26378
26378
  module2.exports = function(value) {
26379
- return value < N12 ? 1 : value < N22 ? 2 : value < N32 ? 3 : value < N42 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
26379
+ return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
26380
26380
  };
26381
26381
  }
26382
26382
  });
@@ -26416,7 +26416,7 @@ var require_src = __commonJS({
26416
26416
  var LEADER = ALPHABET.charAt(0);
26417
26417
  var FACTOR = Math.log(BASE) / Math.log(256);
26418
26418
  var iFACTOR = Math.log(256) / Math.log(BASE);
26419
- function encode11(source) {
26419
+ function encode18(source) {
26420
26420
  if (source instanceof Uint8Array) {
26421
26421
  } else if (ArrayBuffer.isView(source)) {
26422
26422
  source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
@@ -26463,7 +26463,7 @@ var require_src = __commonJS({
26463
26463
  }
26464
26464
  return str;
26465
26465
  }
26466
- __name(encode11, "encode");
26466
+ __name(encode18, "encode");
26467
26467
  function decodeUnsafe(source) {
26468
26468
  if (typeof source !== "string") {
26469
26469
  throw new TypeError("Expected String");
@@ -26515,18 +26515,18 @@ var require_src = __commonJS({
26515
26515
  return vch;
26516
26516
  }
26517
26517
  __name(decodeUnsafe, "decodeUnsafe");
26518
- function decode10(string2) {
26518
+ function decode14(string2) {
26519
26519
  var buffer2 = decodeUnsafe(string2);
26520
26520
  if (buffer2) {
26521
26521
  return buffer2;
26522
26522
  }
26523
26523
  throw new Error("Non-base" + BASE + " character");
26524
26524
  }
26525
- __name(decode10, "decode");
26525
+ __name(decode14, "decode");
26526
26526
  return {
26527
- encode: encode11,
26527
+ encode: encode18,
26528
26528
  decodeUnsafe,
26529
- decode: decode10
26529
+ decode: decode14
26530
26530
  };
26531
26531
  }
26532
26532
  __name(base4, "base");
@@ -26562,12 +26562,12 @@ var require_base2 = __commonJS({
26562
26562
  "use strict";
26563
26563
  var { encodeText } = require_util();
26564
26564
  var Base = class {
26565
- constructor(name5, code5, factory, alphabet2) {
26565
+ constructor(name5, code5, factory, alphabet3) {
26566
26566
  this.name = name5;
26567
26567
  this.code = code5;
26568
26568
  this.codeBuf = encodeText(this.code);
26569
- this.alphabet = alphabet2;
26570
- this.codec = factory(alphabet2);
26569
+ this.alphabet = alphabet3;
26570
+ this.codec = factory(alphabet3);
26571
26571
  }
26572
26572
  encode(buf2) {
26573
26573
  return this.codec.encode(buf2);
@@ -26590,10 +26590,10 @@ var require_base2 = __commonJS({
26590
26590
  var require_rfc4648 = __commonJS({
26591
26591
  "../../node_modules/.pnpm/multibase@4.0.6/node_modules/multibase/src/rfc4648.js"(exports, module2) {
26592
26592
  "use strict";
26593
- var decode10 = /* @__PURE__ */ __name((string2, alphabet2, bitsPerChar) => {
26593
+ var decode14 = /* @__PURE__ */ __name((string2, alphabet3, bitsPerChar) => {
26594
26594
  const codes = {};
26595
- for (let i = 0; i < alphabet2.length; ++i) {
26596
- codes[alphabet2[i]] = i;
26595
+ for (let i = 0; i < alphabet3.length; ++i) {
26596
+ codes[alphabet3[i]] = i;
26597
26597
  }
26598
26598
  let end = string2.length;
26599
26599
  while (string2[end - 1] === "=") {
@@ -26620,8 +26620,8 @@ var require_rfc4648 = __commonJS({
26620
26620
  }
26621
26621
  return out;
26622
26622
  }, "decode");
26623
- var encode11 = /* @__PURE__ */ __name((data, alphabet2, bitsPerChar) => {
26624
- const pad2 = alphabet2[alphabet2.length - 1] === "=";
26623
+ var encode18 = /* @__PURE__ */ __name((data, alphabet3, bitsPerChar) => {
26624
+ const pad2 = alphabet3[alphabet3.length - 1] === "=";
26625
26625
  const mask = (1 << bitsPerChar) - 1;
26626
26626
  let out = "";
26627
26627
  let bits = 0;
@@ -26631,11 +26631,11 @@ var require_rfc4648 = __commonJS({
26631
26631
  bits += 8;
26632
26632
  while (bits > bitsPerChar) {
26633
26633
  bits -= bitsPerChar;
26634
- out += alphabet2[mask & buffer2 >> bits];
26634
+ out += alphabet3[mask & buffer2 >> bits];
26635
26635
  }
26636
26636
  }
26637
26637
  if (bits) {
26638
- out += alphabet2[mask & buffer2 << bitsPerChar - bits];
26638
+ out += alphabet3[mask & buffer2 << bitsPerChar - bits];
26639
26639
  }
26640
26640
  if (pad2) {
26641
26641
  while (out.length * bitsPerChar & 7) {
@@ -26644,13 +26644,13 @@ var require_rfc4648 = __commonJS({
26644
26644
  }
26645
26645
  return out;
26646
26646
  }, "encode");
26647
- var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (alphabet2) => {
26647
+ var rfc46482 = /* @__PURE__ */ __name((bitsPerChar) => (alphabet3) => {
26648
26648
  return {
26649
26649
  encode(input) {
26650
- return encode11(input, alphabet2, bitsPerChar);
26650
+ return encode18(input, alphabet3, bitsPerChar);
26651
26651
  },
26652
26652
  decode(input) {
26653
- return decode10(input, alphabet2, bitsPerChar);
26653
+ return decode14(input, alphabet3, bitsPerChar);
26654
26654
  }
26655
26655
  };
26656
26656
  }, "rfc4648");
@@ -26727,13 +26727,13 @@ var require_src2 = __commonJS({
26727
26727
  return concat4([codeBuf, buf2], codeBuf.length + buf2.length);
26728
26728
  }
26729
26729
  __name(multibase, "multibase");
26730
- function encode11(nameOrCode, buf2) {
26730
+ function encode18(nameOrCode, buf2) {
26731
26731
  const enc = encoding(nameOrCode);
26732
26732
  const data = encodeText(enc.encode(buf2));
26733
26733
  return concat4([enc.codeBuf, data], enc.codeBuf.length + data.length);
26734
26734
  }
26735
- __name(encode11, "encode");
26736
- function decode10(data) {
26735
+ __name(encode18, "encode");
26736
+ function decode14(data) {
26737
26737
  if (data instanceof Uint8Array) {
26738
26738
  data = decodeText(data);
26739
26739
  }
@@ -26744,7 +26744,7 @@ var require_src2 = __commonJS({
26744
26744
  const enc = encoding(data[0]);
26745
26745
  return enc.decode(data.substring(1));
26746
26746
  }
26747
- __name(decode10, "decode");
26747
+ __name(decode14, "decode");
26748
26748
  function isEncoded(data) {
26749
26749
  if (data instanceof Uint8Array) {
26750
26750
  data = decodeText(data);
@@ -26783,8 +26783,8 @@ var require_src2 = __commonJS({
26783
26783
  }
26784
26784
  __name(encodingFromData, "encodingFromData");
26785
26785
  exports = module2.exports = multibase;
26786
- exports.encode = encode11;
26787
- exports.decode = decode10;
26786
+ exports.encode = encode18;
26787
+ exports.decode = decode14;
26788
26788
  exports.isEncoded = isEncoded;
26789
26789
  exports.encoding = encoding;
26790
26790
  exports.encodingFromData = encodingFromData;
@@ -26870,17 +26870,17 @@ var require_bases = __commonJS({
26870
26870
  "../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/util/bases.js"(exports, module2) {
26871
26871
  "use strict";
26872
26872
  var { bases: bases2 } = (init_basics(), __toCommonJS(basics_exports));
26873
- function createCodec2(name5, prefix, encode11, decode10) {
26873
+ function createCodec2(name5, prefix, encode18, decode14) {
26874
26874
  return {
26875
26875
  name: name5,
26876
26876
  prefix,
26877
26877
  encoder: {
26878
26878
  name: name5,
26879
26879
  prefix,
26880
- encode: encode11
26880
+ encode: encode18
26881
26881
  },
26882
26882
  decoder: {
26883
- decode: decode10
26883
+ decode: decode14
26884
26884
  }
26885
26885
  };
26886
26886
  }
@@ -26940,15 +26940,15 @@ var require_to_string = __commonJS({
26940
26940
  "../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/to-string.js"(exports, module2) {
26941
26941
  "use strict";
26942
26942
  var bases2 = require_bases();
26943
- function toString5(array, encoding = "utf8") {
26943
+ function toString6(array, encoding = "utf8") {
26944
26944
  const base4 = bases2[encoding];
26945
26945
  if (!base4) {
26946
26946
  throw new Error(`Unsupported encoding "${encoding}"`);
26947
26947
  }
26948
26948
  return base4.encoder.encode(array).substring(1);
26949
26949
  }
26950
- __name(toString5, "toString");
26951
- module2.exports = toString5;
26950
+ __name(toString6, "toString");
26951
+ module2.exports = toString6;
26952
26952
  }
26953
26953
  });
26954
26954
 
@@ -26979,14 +26979,14 @@ var require_uint8arrays = __commonJS({
26979
26979
  var concat4 = require_concat();
26980
26980
  var equals4 = require_equals();
26981
26981
  var fromString6 = require_from_string();
26982
- var toString5 = require_to_string();
26982
+ var toString6 = require_to_string();
26983
26983
  var xor2 = require_xor();
26984
26984
  module2.exports = {
26985
26985
  compare: compare4,
26986
26986
  concat: concat4,
26987
26987
  equals: equals4,
26988
26988
  fromString: fromString6,
26989
- toString: toString5,
26989
+ toString: toString6,
26990
26990
  xor: xor2
26991
26991
  };
26992
26992
  }
@@ -27233,7 +27233,7 @@ var require_fast_json_stable_stringify = __commonJS({
27233
27233
  };
27234
27234
  }(opts.cmp);
27235
27235
  var seen = [];
27236
- return (/* @__PURE__ */ __name(function stringify2(node) {
27236
+ return (/* @__PURE__ */ __name(function stringify3(node) {
27237
27237
  if (node && node.toJSON && typeof node.toJSON === "function") {
27238
27238
  node = node.toJSON();
27239
27239
  }
@@ -27249,7 +27249,7 @@ var require_fast_json_stable_stringify = __commonJS({
27249
27249
  for (i = 0; i < node.length; i++) {
27250
27250
  if (i)
27251
27251
  out += ",";
27252
- out += stringify2(node[i]) || "null";
27252
+ out += stringify3(node[i]) || "null";
27253
27253
  }
27254
27254
  return out + "]";
27255
27255
  }
@@ -27265,7 +27265,7 @@ var require_fast_json_stable_stringify = __commonJS({
27265
27265
  out = "";
27266
27266
  for (i = 0; i < keys.length; i++) {
27267
27267
  var key2 = keys[i];
27268
- var value = stringify2(node[key2]);
27268
+ var value = stringify3(node[key2]);
27269
27269
  if (!value)
27270
27270
  continue;
27271
27271
  if (out)
@@ -28678,12 +28678,12 @@ var require_dataloader = __commonJS({
28678
28678
  // ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js
28679
28679
  var require_encode2 = __commonJS({
28680
28680
  "../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/encode.js"(exports, module2) {
28681
- module2.exports = encode11;
28681
+ module2.exports = encode18;
28682
28682
  var MSB2 = 128;
28683
28683
  var REST2 = 127;
28684
28684
  var MSBALL2 = ~REST2;
28685
28685
  var INT2 = Math.pow(2, 31);
28686
- function encode11(num, out, offset) {
28686
+ function encode18(num, out, offset) {
28687
28687
  out = out || [];
28688
28688
  offset = offset || 0;
28689
28689
  var oldOffset = offset;
@@ -28696,10 +28696,10 @@ var require_encode2 = __commonJS({
28696
28696
  num >>>= 7;
28697
28697
  }
28698
28698
  out[offset] = num | 0;
28699
- encode11.bytes = offset - oldOffset + 1;
28699
+ encode18.bytes = offset - oldOffset + 1;
28700
28700
  return out;
28701
28701
  }
28702
- __name(encode11, "encode");
28702
+ __name(encode18, "encode");
28703
28703
  }
28704
28704
  });
28705
28705
 
@@ -28730,17 +28730,17 @@ var require_decode2 = __commonJS({
28730
28730
  // ../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js
28731
28731
  var require_length2 = __commonJS({
28732
28732
  "../../node_modules/.pnpm/varint@5.0.2/node_modules/varint/length.js"(exports, module2) {
28733
- var N12 = Math.pow(2, 7);
28734
- var N22 = Math.pow(2, 14);
28735
- var N32 = Math.pow(2, 21);
28736
- var N42 = Math.pow(2, 28);
28733
+ var N13 = Math.pow(2, 7);
28734
+ var N23 = Math.pow(2, 14);
28735
+ var N33 = Math.pow(2, 21);
28736
+ var N43 = Math.pow(2, 28);
28737
28737
  var N52 = Math.pow(2, 35);
28738
28738
  var N62 = Math.pow(2, 42);
28739
28739
  var N72 = Math.pow(2, 49);
28740
28740
  var N82 = Math.pow(2, 56);
28741
28741
  var N92 = Math.pow(2, 63);
28742
28742
  module2.exports = function(value) {
28743
- return value < N12 ? 1 : value < N22 ? 2 : value < N32 ? 3 : value < N42 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
28743
+ return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N52 ? 5 : value < N62 ? 6 : value < N72 ? 7 : value < N82 ? 8 : value < N92 ? 9 : 10;
28744
28744
  };
28745
28745
  }
28746
28746
  });
@@ -29156,7 +29156,7 @@ var require_src3 = __commonJS({
29156
29156
  return multibase.decode("z" + encoded);
29157
29157
  }
29158
29158
  __name(fromB58String, "fromB58String");
29159
- function decode10(bytes) {
29159
+ function decode14(bytes) {
29160
29160
  if (!(bytes instanceof Uint8Array)) {
29161
29161
  throw new Error("multihash must be a Uint8Array");
29162
29162
  }
@@ -29183,8 +29183,8 @@ var require_src3 = __commonJS({
29183
29183
  digest: bytes
29184
29184
  };
29185
29185
  }
29186
- __name(decode10, "decode");
29187
- function encode11(digest2, code5, length2) {
29186
+ __name(decode14, "decode");
29187
+ function encode18(digest2, code5, length2) {
29188
29188
  if (!digest2 || code5 === void 0) {
29189
29189
  throw new Error("multihash encode requires at least two args: digest, code");
29190
29190
  }
@@ -29202,7 +29202,7 @@ var require_src3 = __commonJS({
29202
29202
  const len = varint5.encode(length2);
29203
29203
  return uint8ArrayConcat([hash3, len, digest2], hash3.length + len.length + digest2.length);
29204
29204
  }
29205
- __name(encode11, "encode");
29205
+ __name(encode18, "encode");
29206
29206
  function coerceCode(name5) {
29207
29207
  let code5 = name5;
29208
29208
  if (typeof name5 === "string") {
@@ -29234,12 +29234,12 @@ var require_src3 = __commonJS({
29234
29234
  return false;
29235
29235
  }
29236
29236
  __name(isValidCode, "isValidCode");
29237
- function validate6(multihash) {
29238
- decode10(multihash);
29237
+ function validate7(multihash) {
29238
+ decode14(multihash);
29239
29239
  }
29240
- __name(validate6, "validate");
29240
+ __name(validate7, "validate");
29241
29241
  function prefix(multihash) {
29242
- validate6(multihash);
29242
+ validate7(multihash);
29243
29243
  return multihash.subarray(0, 2);
29244
29244
  }
29245
29245
  __name(prefix, "prefix");
@@ -29250,11 +29250,11 @@ var require_src3 = __commonJS({
29250
29250
  fromHexString,
29251
29251
  toB58String,
29252
29252
  fromB58String,
29253
- decode: decode10,
29254
- encode: encode11,
29253
+ decode: decode14,
29254
+ encode: encode18,
29255
29255
  coerceCode,
29256
29256
  isAppCode,
29257
- validate: validate6,
29257
+ validate: validate7,
29258
29258
  prefix,
29259
29259
  isValidCode
29260
29260
  };
@@ -35212,6 +35212,57 @@ var require_uniswap_default_tokenlist = __commonJS({
35212
35212
  }
35213
35213
  });
35214
35214
 
35215
+ // ../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js
35216
+ var require_base32_decode = __commonJS({
35217
+ "../../node_modules/.pnpm/base32-decode@1.0.0/node_modules/base32-decode/index.js"(exports, module2) {
35218
+ var RFC46482 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
35219
+ var RFC4648_HEX2 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
35220
+ var CROCKFORD2 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
35221
+ function readChar(alphabet3, char) {
35222
+ var idx = alphabet3.indexOf(char);
35223
+ if (idx === -1) {
35224
+ throw new Error("Invalid character found: " + char);
35225
+ }
35226
+ return idx;
35227
+ }
35228
+ __name(readChar, "readChar");
35229
+ module2.exports = /* @__PURE__ */ __name(function base32Decode2(input, variant) {
35230
+ var alphabet3;
35231
+ switch (variant) {
35232
+ case "RFC3548":
35233
+ case "RFC4648":
35234
+ alphabet3 = RFC46482;
35235
+ input = input.replace(/=+$/, "");
35236
+ break;
35237
+ case "RFC4648-HEX":
35238
+ alphabet3 = RFC4648_HEX2;
35239
+ input = input.replace(/=+$/, "");
35240
+ break;
35241
+ case "Crockford":
35242
+ alphabet3 = CROCKFORD2;
35243
+ input = input.toUpperCase().replace(/O/g, "0").replace(/[IL]/g, "1");
35244
+ break;
35245
+ default:
35246
+ throw new Error("Unknown base32 variant: " + variant);
35247
+ }
35248
+ var length2 = input.length;
35249
+ var bits = 0;
35250
+ var value = 0;
35251
+ var index = 0;
35252
+ var output = new Uint8Array(length2 * 5 / 8 | 0);
35253
+ for (var i = 0; i < length2; i++) {
35254
+ value = value << 5 | readChar(alphabet3, input[i]);
35255
+ bits += 5;
35256
+ if (bits >= 8) {
35257
+ output[index++] = value >>> bits - 8 & 255;
35258
+ bits -= 8;
35259
+ }
35260
+ }
35261
+ return output.buffer;
35262
+ }, "base32Decode");
35263
+ }
35264
+ });
35265
+
35215
35266
  // src/index.ts
35216
35267
  var src_exports2 = {};
35217
35268
  __export(src_exports2, {
@@ -35225,7 +35276,7 @@ var import_polyfill = require("abort-controller/polyfill");
35225
35276
 
35226
35277
  // src/wallet/base/crypto.ts
35227
35278
  var import_isomorphic_webcrypto = __toESM(require("isomorphic-webcrypto"));
35228
- if (typeof window === "undefined")
35279
+ if (typeof window === "undefined" && !globalThis.crypto)
35229
35280
  globalThis.crypto = import_isomorphic_webcrypto.default;
35230
35281
 
35231
35282
  // src/wallet/base/wallet.ts
@@ -35450,6 +35501,15 @@ function __wbg_adapter_24(arg0, arg1, arg2) {
35450
35501
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h47a829c6210a1ab1(arg0, arg1, addHeapObject(arg2));
35451
35502
  }
35452
35503
  __name(__wbg_adapter_24, "__wbg_adapter_24");
35504
+ function resolveDID(did, input_metadata) {
35505
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35506
+ const len0 = WASM_VECTOR_LEN;
35507
+ const ptr1 = passStringToWasm0(input_metadata, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35508
+ const len1 = WASM_VECTOR_LEN;
35509
+ const ret = wasm.resolveDID(ptr0, len0, ptr1, len1);
35510
+ return takeObject(ret);
35511
+ }
35512
+ __name(resolveDID, "resolveDID");
35453
35513
  function passArray8ToWasm0(arg, malloc) {
35454
35514
  const ptr = malloc(arg.length * 1);
35455
35515
  getUint8Memory0().set(arg, ptr / 1);
@@ -36004,6 +36064,9 @@ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async(void 0, null, fu
36004
36064
  }),
36005
36065
  contextLoader: (_wallet, url) => __async(void 0, null, function* () {
36006
36066
  return JSON.parse(yield contextLoader(url));
36067
+ }),
36068
+ resolveDid: (_wallet, did) => __async(void 0, null, function* () {
36069
+ return JSON.parse(yield resolveDID(did, "{}"));
36007
36070
  })
36008
36071
  }
36009
36072
  };
@@ -39073,6 +39136,13 @@ var CredentialInfoValidator = mod.object({
39073
39136
  issuee: ProfileValidator.optional(),
39074
39137
  credentialSubject: CredentialSubjectValidator.optional()
39075
39138
  });
39139
+ var StorageTypeValidator = mod.enum(["ceramic"]);
39140
+ var StorageTypeEnum = StorageTypeValidator.enum;
39141
+ var IDXCredentialValidator = mod.object({
39142
+ id: mod.string(),
39143
+ title: mod.string(),
39144
+ storageType: StorageTypeValidator.optional()
39145
+ });
39076
39146
 
39077
39147
  // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/toInteger/index.js
39078
39148
  function toInteger(dirtyNumber) {
@@ -40689,7 +40759,8 @@ var emptyWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], fun
40689
40759
  return {
40690
40760
  _wallet: wallet,
40691
40761
  verifyCredential: verifyCredential2(wallet),
40692
- verifyPresentation: wallet.pluginMethods.verifyPresentation
40762
+ verifyPresentation: wallet.pluginMethods.verifyPresentation,
40763
+ resolveDid: wallet.pluginMethods.resolveDid
40693
40764
  };
40694
40765
  }), "emptyWallet");
40695
40766
 
@@ -44096,7 +44167,7 @@ var ChainId = /* @__PURE__ */ function() {
44096
44167
  this.reference = params.reference;
44097
44168
  }
44098
44169
  __name(ChainId2, "ChainId");
44099
- ChainId2.parse = /* @__PURE__ */ __name(function parse2(id) {
44170
+ ChainId2.parse = /* @__PURE__ */ __name(function parse3(id) {
44100
44171
  if (!isValidId(id, this.spec)) {
44101
44172
  throw new Error("Invalid " + this.spec.name + " provided: " + id);
44102
44173
  }
@@ -44106,7 +44177,7 @@ var ChainId = /* @__PURE__ */ function() {
44106
44177
  return joinParams(params, this.spec);
44107
44178
  }, "format");
44108
44179
  var _proto = ChainId2.prototype;
44109
- _proto.toString = /* @__PURE__ */ __name(function toString5() {
44180
+ _proto.toString = /* @__PURE__ */ __name(function toString6() {
44110
44181
  return ChainId2.format(this.toJSON());
44111
44182
  }, "toString");
44112
44183
  _proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
@@ -44127,7 +44198,7 @@ var AccountId = /* @__PURE__ */ function() {
44127
44198
  this.address = params.address;
44128
44199
  }
44129
44200
  __name(AccountId2, "AccountId");
44130
- AccountId2.parse = /* @__PURE__ */ __name(function parse2(id) {
44201
+ AccountId2.parse = /* @__PURE__ */ __name(function parse3(id) {
44131
44202
  if (!isValidId(id, this.spec)) {
44132
44203
  throw new Error("Invalid " + this.spec.name + " provided: " + id);
44133
44204
  }
@@ -44149,7 +44220,7 @@ var AccountId = /* @__PURE__ */ function() {
44149
44220
  return joinParams(splitParams2, this.spec);
44150
44221
  }, "format");
44151
44222
  var _proto = AccountId2.prototype;
44152
- _proto.toString = /* @__PURE__ */ __name(function toString5() {
44223
+ _proto.toString = /* @__PURE__ */ __name(function toString6() {
44153
44224
  return AccountId2.format(this.toJSON());
44154
44225
  }, "toString");
44155
44226
  _proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
@@ -44170,7 +44241,7 @@ var AssetName = /* @__PURE__ */ function() {
44170
44241
  this.reference = params.reference;
44171
44242
  }
44172
44243
  __name(AssetName2, "AssetName");
44173
- AssetName2.parse = /* @__PURE__ */ __name(function parse2(id) {
44244
+ AssetName2.parse = /* @__PURE__ */ __name(function parse3(id) {
44174
44245
  if (!isValidId(id, this.spec)) {
44175
44246
  throw new Error("Invalid " + this.spec.name + " provided: " + id);
44176
44247
  }
@@ -44180,7 +44251,7 @@ var AssetName = /* @__PURE__ */ function() {
44180
44251
  return joinParams(params, this.spec);
44181
44252
  }, "format");
44182
44253
  var _proto = AssetName2.prototype;
44183
- _proto.toString = /* @__PURE__ */ __name(function toString5() {
44254
+ _proto.toString = /* @__PURE__ */ __name(function toString6() {
44184
44255
  return AssetName2.format(this.toJSON());
44185
44256
  }, "toString");
44186
44257
  _proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
@@ -44201,7 +44272,7 @@ var AssetType = /* @__PURE__ */ function() {
44201
44272
  this.assetName = new AssetName(params.assetName);
44202
44273
  }
44203
44274
  __name(AssetType2, "AssetType");
44204
- AssetType2.parse = /* @__PURE__ */ __name(function parse2(id) {
44275
+ AssetType2.parse = /* @__PURE__ */ __name(function parse3(id) {
44205
44276
  if (!isValidId(id, this.spec)) {
44206
44277
  throw new Error("Invalid " + this.spec.name + " provided: " + id);
44207
44278
  }
@@ -44211,7 +44282,7 @@ var AssetType = /* @__PURE__ */ function() {
44211
44282
  return joinParams(params, this.spec);
44212
44283
  }, "format");
44213
44284
  var _proto = AssetType2.prototype;
44214
- _proto.toString = /* @__PURE__ */ __name(function toString5() {
44285
+ _proto.toString = /* @__PURE__ */ __name(function toString6() {
44215
44286
  return AssetType2.format(this.toJSON());
44216
44287
  }, "toString");
44217
44288
  _proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
@@ -44233,7 +44304,7 @@ var AssetId = /* @__PURE__ */ function() {
44233
44304
  this.tokenId = params.tokenId;
44234
44305
  }
44235
44306
  __name(AssetId2, "AssetId");
44236
- AssetId2.parse = /* @__PURE__ */ __name(function parse2(id) {
44307
+ AssetId2.parse = /* @__PURE__ */ __name(function parse3(id) {
44237
44308
  if (!isValidId(id, this.spec)) {
44238
44309
  throw new Error("Invalid " + this.spec.name + " provided: " + id);
44239
44310
  }
@@ -44243,7 +44314,7 @@ var AssetId = /* @__PURE__ */ function() {
44243
44314
  return joinParams(params, this.spec);
44244
44315
  }, "format");
44245
44316
  var _proto = AssetId2.prototype;
44246
- _proto.toString = /* @__PURE__ */ __name(function toString5() {
44317
+ _proto.toString = /* @__PURE__ */ __name(function toString6() {
44247
44318
  return AssetId2.format(this.toJSON());
44248
44319
  }, "toString");
44249
44320
  _proto.toJSON = /* @__PURE__ */ __name(function toJSON2() {
@@ -44323,10 +44394,10 @@ var ErrorCode;
44323
44394
  })(ErrorCode || (ErrorCode = {}));
44324
44395
  var HEX = "0123456789abcdef";
44325
44396
  var Logger = class {
44326
- constructor(version11) {
44397
+ constructor(version12) {
44327
44398
  Object.defineProperty(this, "version", {
44328
44399
  enumerable: true,
44329
- value: version11,
44400
+ value: version12,
44330
44401
  writable: false
44331
44402
  });
44332
44403
  }
@@ -44541,8 +44612,8 @@ var Logger = class {
44541
44612
  }
44542
44613
  _logLevel = level;
44543
44614
  }
44544
- static from(version11) {
44545
- return new Logger(version11);
44615
+ static from(version12) {
44616
+ return new Logger(version12);
44546
44617
  }
44547
44618
  };
44548
44619
  __name(Logger, "Logger");
@@ -45189,7 +45260,7 @@ var utils_1 = createCommonjsModule(function(module2, exports) {
45189
45260
  }
45190
45261
  __name(toHex2, "toHex");
45191
45262
  utils.toHex = toHex2;
45192
- utils.encode = /* @__PURE__ */ __name(function encode11(arr, enc) {
45263
+ utils.encode = /* @__PURE__ */ __name(function encode18(arr, enc) {
45193
45264
  if (enc === "hex")
45194
45265
  return toHex2(arr);
45195
45266
  else
@@ -47303,14 +47374,14 @@ var ParsedMessage = class {
47303
47374
  return ret;
47304
47375
  }, "uri");
47305
47376
  parser.ast.callbacks.uri = uri;
47306
- const version11 = /* @__PURE__ */ __name(function(state, chars, phraseIndex, phraseLength, data) {
47377
+ const version12 = /* @__PURE__ */ __name(function(state, chars, phraseIndex, phraseLength, data) {
47307
47378
  const ret = id.SEM_OK;
47308
47379
  if (state === id.SEM_PRE) {
47309
47380
  data.version = import_node_exports.default.utils.charsToString(chars, phraseIndex, phraseLength);
47310
47381
  }
47311
47382
  return ret;
47312
47383
  }, "version");
47313
- parser.ast.callbacks.version = version11;
47384
+ parser.ast.callbacks.version = version12;
47314
47385
  const chainId = /* @__PURE__ */ __name(function(state, chars, phraseIndex, phraseLength, data) {
47315
47386
  const ret = id.SEM_OK;
47316
47387
  if (state === id.SEM_PRE) {
@@ -53383,6 +53454,18 @@ var CeramicClient = class {
53383
53454
  };
53384
53455
  __name(CeramicClient, "CeramicClient");
53385
53456
 
53457
+ // src/wallet/plugins/idx/types.ts
53458
+ var StorageTypeValidator2 = mod.enum(["ceramic"]);
53459
+ var StorageTypeEnum2 = StorageTypeValidator2.enum;
53460
+ var CredentialMetadataValidator = mod.object({ name: mod.string().optional(), image: mod.string().optional() }).catchall(mod.any());
53461
+ var IDXCredentialValidator2 = mod.object({
53462
+ id: mod.string(),
53463
+ title: mod.string(),
53464
+ storageType: StorageTypeValidator2.optional(),
53465
+ metadata: CredentialMetadataValidator.optional()
53466
+ }).strict();
53467
+ var CredentialsListValidator = mod.object({ credentials: IDXCredentialValidator2.array() }).strict();
53468
+
53386
53469
  // src/wallet/plugins/idx/idx.ts
53387
53470
  var getCeramicClientFromWalletSuite = /* @__PURE__ */ __name((wallet, ceramicEndpoint) => __async(void 0, null, function* () {
53388
53471
  const client = new CeramicClient(ceramicEndpoint);
@@ -53400,9 +53483,17 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
53400
53483
  const loader = new TileLoader({ ceramic });
53401
53484
  const dataStore = new DIDDataStore({ ceramic, model: modelData });
53402
53485
  const getCredentialsListFromIdx = /* @__PURE__ */ __name((..._02) => __async(void 0, [..._02], function* (alias = credentialAlias) {
53403
- return (yield dataStore.get(alias)) || { credentials: [] };
53486
+ const list = yield dataStore.get(alias);
53487
+ if (!list)
53488
+ return { credentials: [] };
53489
+ const validationResult = yield CredentialsListValidator.spa(list);
53490
+ if (validationResult.success)
53491
+ return validationResult.data;
53492
+ console.error(validationResult.error);
53493
+ throw new Error("Invalid credentials list stored in IDX");
53404
53494
  }), "getCredentialsListFromIdx");
53405
- const addCredentialStreamIdToIdx = /* @__PURE__ */ __name((record, alias) => __async(void 0, null, function* () {
53495
+ const addCredentialStreamIdToIdx = /* @__PURE__ */ __name((_record, alias) => __async(void 0, null, function* () {
53496
+ const record = IDXCredentialValidator2.parse(_record);
53406
53497
  if (!record)
53407
53498
  throw new Error("record is required");
53408
53499
  if (!record.id)
@@ -53417,10 +53508,10 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
53417
53508
  });
53418
53509
  if (indexOfExistingCredential > -1) {
53419
53510
  existing.credentials[indexOfExistingCredential] = __spreadValues({
53420
- storageType: "ceramic" /* ceramic */
53511
+ storageType: StorageTypeEnum.ceramic
53421
53512
  }, record);
53422
53513
  } else
53423
- existing.credentials.push(__spreadValues({ storageType: "ceramic" /* ceramic */ }, record));
53514
+ existing.credentials.push(__spreadValues({ storageType: StorageTypeEnum.ceramic }, record));
53424
53515
  return dataStore.set(alias, existing);
53425
53516
  }), "addCredentialStreamIdToIdx");
53426
53517
  const removeCredentialFromIdx = /* @__PURE__ */ __name((title, alias) => __async(void 0, null, function* () {
@@ -53473,8 +53564,8 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
53473
53564
  return readContentFromCeramic(streamId);
53474
53565
  })));
53475
53566
  }),
53476
- addVerifiableCredentialInIdx: (_02, _12) => __async(void 0, [_02, _12], function* (_wallet, { title, id }) {
53477
- return addCredentialStreamIdToIdx({ title, id });
53567
+ addVerifiableCredentialInIdx: (_wallet, idxCredential) => __async(void 0, null, function* () {
53568
+ return addCredentialStreamIdToIdx(idxCredential);
53478
53569
  }),
53479
53570
  removeVerifiableCredentialInIdx: (_wallet, title) => __async(void 0, null, function* () {
53480
53571
  return removeCredentialFromIdx(title);
@@ -53781,6 +53872,3170 @@ var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
53781
53872
  };
53782
53873
  }, "getEthereumPlugin");
53783
53874
 
53875
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/CborldError.js
53876
+ var CborldError = class extends Error {
53877
+ constructor(value, message) {
53878
+ super();
53879
+ this.message = message;
53880
+ this.value = value;
53881
+ this.stack = new Error(`${value}: ${message}`).stack;
53882
+ this.name = this.constructor.name;
53883
+ }
53884
+ };
53885
+ __name(CborldError, "CborldError");
53886
+
53887
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldDecoder.js
53888
+ var CborldDecoder = class {
53889
+ decode({ value } = {}) {
53890
+ throw new Error("Must be implemented by derived class.");
53891
+ }
53892
+ static createDecoder({ value, transformer } = {}) {
53893
+ throw new Error("Must be implemented by derived class.");
53894
+ }
53895
+ };
53896
+ __name(CborldDecoder, "CborldDecoder");
53897
+
53898
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/registeredContexts.js
53899
+ var ID_TO_URL = /* @__PURE__ */ new Map();
53900
+ var URL_TO_ID = /* @__PURE__ */ new Map();
53901
+ _addRegistration(16, "https://www.w3.org/ns/activitystreams");
53902
+ _addRegistration(17, "https://www.w3.org/2018/credentials/v1");
53903
+ _addRegistration(18, "https://www.w3.org/ns/did/v1");
53904
+ _addRegistration(19, "https://w3id.org/security/suites/ed25519-2018/v1");
53905
+ _addRegistration(20, "https://w3id.org/security/suites/ed25519-2020/v1");
53906
+ _addRegistration(21, "https://w3id.org/cit/v1");
53907
+ _addRegistration(22, "https://w3id.org/age/v1");
53908
+ _addRegistration(23, "https://w3id.org/security/suites/x25519-2020/v1");
53909
+ _addRegistration(24, "https://w3id.org/veres-one/v1");
53910
+ _addRegistration(25, "https://w3id.org/webkms/v1");
53911
+ _addRegistration(26, "https://w3id.org/zcap/v1");
53912
+ _addRegistration(27, "https://w3id.org/security/suites/hmac-2019/v1");
53913
+ _addRegistration(28, "https://w3id.org/security/suites/aes-2019/v1");
53914
+ _addRegistration(29, "https://w3id.org/vaccination/v1");
53915
+ _addRegistration(30, "https://w3id.org/vc-revocation-list-2020/v1");
53916
+ _addRegistration(31, "https://w3id.org/dcc/v1c");
53917
+ _addRegistration(32, "https://w3id.org/vc/status-list/v1");
53918
+ function _addRegistration(id, url) {
53919
+ URL_TO_ID.set(url, id);
53920
+ ID_TO_URL.set(id, url);
53921
+ }
53922
+ __name(_addRegistration, "_addRegistration");
53923
+
53924
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextDecoder.js
53925
+ var ContextDecoder = class extends CborldDecoder {
53926
+ constructor({ reverseAppContextMap } = {}) {
53927
+ super();
53928
+ this.reverseAppContextMap = reverseAppContextMap;
53929
+ }
53930
+ decode({ value } = {}) {
53931
+ if (typeof value !== "number") {
53932
+ return _mapToObject(value);
53933
+ }
53934
+ const url = ID_TO_URL.get(value) || this.reverseAppContextMap.get(value);
53935
+ if (url === void 0) {
53936
+ throw new CborldError("ERR_UNDEFINED_COMPRESSED_CONTEXT", `Undefined compressed context "${value}".`);
53937
+ }
53938
+ return url;
53939
+ }
53940
+ static createDecoder({ transformer } = {}) {
53941
+ const { reverseAppContextMap } = transformer;
53942
+ return new ContextDecoder({ reverseAppContextMap });
53943
+ }
53944
+ };
53945
+ __name(ContextDecoder, "ContextDecoder");
53946
+ function _mapToObject(map2) {
53947
+ if (Array.isArray(map2)) {
53948
+ return map2.map(_mapToObject);
53949
+ }
53950
+ if (!(map2 instanceof Map)) {
53951
+ return map2;
53952
+ }
53953
+ const obj = {};
53954
+ for (const [key2, value] of map2) {
53955
+ obj[key2] = _mapToObject(value);
53956
+ }
53957
+ return obj;
53958
+ }
53959
+ __name(_mapToObject, "_mapToObject");
53960
+
53961
+ // ../../node_modules/.pnpm/js-base64@3.7.2/node_modules/js-base64/base64.mjs
53962
+ var version11 = "3.7.2";
53963
+ var VERSION = version11;
53964
+ var _hasatob = typeof atob === "function";
53965
+ var _hasbtoa = typeof btoa === "function";
53966
+ var _hasBuffer = typeof Buffer === "function";
53967
+ var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
53968
+ var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
53969
+ var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
53970
+ var b64chs = Array.prototype.slice.call(b64ch);
53971
+ var b64tab = ((a) => {
53972
+ let tab = {};
53973
+ a.forEach((c, i) => tab[c] = i);
53974
+ return tab;
53975
+ })(b64chs);
53976
+ var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
53977
+ var _fromCC = String.fromCharCode.bind(String);
53978
+ var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
53979
+ var _mkUriSafe = /* @__PURE__ */ __name((src2) => src2.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_"), "_mkUriSafe");
53980
+ var _tidyB64 = /* @__PURE__ */ __name((s) => s.replace(/[^A-Za-z0-9\+\/]/g, ""), "_tidyB64");
53981
+ var btoaPolyfill = /* @__PURE__ */ __name((bin) => {
53982
+ let u32, c0, c1, c2, asc = "";
53983
+ const pad2 = bin.length % 3;
53984
+ for (let i = 0; i < bin.length; ) {
53985
+ if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
53986
+ throw new TypeError("invalid character found");
53987
+ u32 = c0 << 16 | c1 << 8 | c2;
53988
+ asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
53989
+ }
53990
+ return pad2 ? asc.slice(0, pad2 - 3) + "===".substring(pad2) : asc;
53991
+ }, "btoaPolyfill");
53992
+ var _btoa = _hasbtoa ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
53993
+ var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
53994
+ const maxargs = 4096;
53995
+ let strs = [];
53996
+ for (let i = 0, l = u8a.length; i < l; i += maxargs) {
53997
+ strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
53998
+ }
53999
+ return _btoa(strs.join(""));
54000
+ };
54001
+ var fromUint8Array = /* @__PURE__ */ __name((u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a), "fromUint8Array");
54002
+ var cb_utob = /* @__PURE__ */ __name((c) => {
54003
+ if (c.length < 2) {
54004
+ var cc = c.charCodeAt(0);
54005
+ return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
54006
+ } else {
54007
+ var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
54008
+ return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
54009
+ }
54010
+ }, "cb_utob");
54011
+ var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
54012
+ var utob = /* @__PURE__ */ __name((u) => u.replace(re_utob, cb_utob), "utob");
54013
+ var _encode2 = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
54014
+ var encode11 = /* @__PURE__ */ __name((src2, urlsafe = false) => urlsafe ? _mkUriSafe(_encode2(src2)) : _encode2(src2), "encode");
54015
+ var encodeURI = /* @__PURE__ */ __name((src2) => encode11(src2, true), "encodeURI");
54016
+ var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
54017
+ var cb_btou = /* @__PURE__ */ __name((cccc) => {
54018
+ switch (cccc.length) {
54019
+ case 4:
54020
+ var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
54021
+ return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
54022
+ case 3:
54023
+ return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
54024
+ default:
54025
+ return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
54026
+ }
54027
+ }, "cb_btou");
54028
+ var btou = /* @__PURE__ */ __name((b) => b.replace(re_btou, cb_btou), "btou");
54029
+ var atobPolyfill = /* @__PURE__ */ __name((asc) => {
54030
+ asc = asc.replace(/\s+/g, "");
54031
+ if (!b64re.test(asc))
54032
+ throw new TypeError("malformed base64.");
54033
+ asc += "==".slice(2 - (asc.length & 3));
54034
+ let u24, bin = "", r1, r2;
54035
+ for (let i = 0; i < asc.length; ) {
54036
+ u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
54037
+ bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
54038
+ }
54039
+ return bin;
54040
+ }, "atobPolyfill");
54041
+ var _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
54042
+ var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a), (c) => c.charCodeAt(0));
54043
+ var toUint8Array2 = /* @__PURE__ */ __name((a) => _toUint8Array(_unURI(a)), "toUint8Array");
54044
+ var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
54045
+ var _unURI = /* @__PURE__ */ __name((a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/")), "_unURI");
54046
+ var decode10 = /* @__PURE__ */ __name((src2) => _decode(_unURI(src2)), "decode");
54047
+ var isValid3 = /* @__PURE__ */ __name((src2) => {
54048
+ if (typeof src2 !== "string")
54049
+ return false;
54050
+ const s = src2.replace(/\s+/g, "").replace(/={0,2}$/, "");
54051
+ return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
54052
+ }, "isValid");
54053
+ var _noEnum = /* @__PURE__ */ __name((v) => {
54054
+ return {
54055
+ value: v,
54056
+ enumerable: false,
54057
+ writable: true,
54058
+ configurable: true
54059
+ };
54060
+ }, "_noEnum");
54061
+ var extendString = /* @__PURE__ */ __name(function() {
54062
+ const _add = /* @__PURE__ */ __name((name5, body) => Object.defineProperty(String.prototype, name5, _noEnum(body)), "_add");
54063
+ _add("fromBase64", function() {
54064
+ return decode10(this);
54065
+ });
54066
+ _add("toBase64", function(urlsafe) {
54067
+ return encode11(this, urlsafe);
54068
+ });
54069
+ _add("toBase64URI", function() {
54070
+ return encode11(this, true);
54071
+ });
54072
+ _add("toBase64URL", function() {
54073
+ return encode11(this, true);
54074
+ });
54075
+ _add("toUint8Array", function() {
54076
+ return toUint8Array2(this);
54077
+ });
54078
+ }, "extendString");
54079
+ var extendUint8Array = /* @__PURE__ */ __name(function() {
54080
+ const _add = /* @__PURE__ */ __name((name5, body) => Object.defineProperty(Uint8Array.prototype, name5, _noEnum(body)), "_add");
54081
+ _add("toBase64", function(urlsafe) {
54082
+ return fromUint8Array(this, urlsafe);
54083
+ });
54084
+ _add("toBase64URI", function() {
54085
+ return fromUint8Array(this, true);
54086
+ });
54087
+ _add("toBase64URL", function() {
54088
+ return fromUint8Array(this, true);
54089
+ });
54090
+ }, "extendUint8Array");
54091
+ var extendBuiltins = /* @__PURE__ */ __name(() => {
54092
+ extendString();
54093
+ extendUint8Array();
54094
+ }, "extendBuiltins");
54095
+ var gBase64 = {
54096
+ version: version11,
54097
+ VERSION,
54098
+ atob: _atob,
54099
+ atobPolyfill,
54100
+ btoa: _btoa,
54101
+ btoaPolyfill,
54102
+ fromBase64: decode10,
54103
+ toBase64: encode11,
54104
+ encode: encode11,
54105
+ encodeURI,
54106
+ encodeURL: encodeURI,
54107
+ utob,
54108
+ btou,
54109
+ decode: decode10,
54110
+ isValid: isValid3,
54111
+ fromUint8Array,
54112
+ toUint8Array: toUint8Array2,
54113
+ extendString,
54114
+ extendUint8Array,
54115
+ extendBuiltins
54116
+ };
54117
+
54118
+ // ../../node_modules/.pnpm/base58-universal@2.0.0/node_modules/base58-universal/lib/baseN.js
54119
+ var _reverseAlphabets = {};
54120
+ function encode12(input, alphabet3, maxline) {
54121
+ if (!(input instanceof Uint8Array)) {
54122
+ throw new TypeError('"input" must be a Uint8Array.');
54123
+ }
54124
+ if (typeof alphabet3 !== "string") {
54125
+ throw new TypeError('"alphabet" must be a string.');
54126
+ }
54127
+ if (maxline !== void 0 && typeof maxline !== "number") {
54128
+ throw new TypeError('"maxline" must be a number.');
54129
+ }
54130
+ if (input.length === 0) {
54131
+ return "";
54132
+ }
54133
+ let output = "";
54134
+ let i = 0;
54135
+ const base4 = alphabet3.length;
54136
+ const first2 = alphabet3.charAt(0);
54137
+ const digits = [0];
54138
+ for (i = 0; i < input.length; ++i) {
54139
+ let carry = input[i];
54140
+ for (let j = 0; j < digits.length; ++j) {
54141
+ carry += digits[j] << 8;
54142
+ digits[j] = carry % base4;
54143
+ carry = carry / base4 | 0;
54144
+ }
54145
+ while (carry > 0) {
54146
+ digits.push(carry % base4);
54147
+ carry = carry / base4 | 0;
54148
+ }
54149
+ }
54150
+ for (i = 0; input[i] === 0 && i < input.length - 1; ++i) {
54151
+ output += first2;
54152
+ }
54153
+ for (i = digits.length - 1; i >= 0; --i) {
54154
+ output += alphabet3[digits[i]];
54155
+ }
54156
+ if (maxline) {
54157
+ const regex = new RegExp(".{1," + maxline + "}", "g");
54158
+ output = output.match(regex).join("\r\n");
54159
+ }
54160
+ return output;
54161
+ }
54162
+ __name(encode12, "encode");
54163
+ function decode11(input, alphabet3) {
54164
+ if (typeof input !== "string") {
54165
+ throw new TypeError('"input" must be a string.');
54166
+ }
54167
+ if (typeof alphabet3 !== "string") {
54168
+ throw new TypeError('"alphabet" must be a string.');
54169
+ }
54170
+ if (input.length === 0) {
54171
+ return new Uint8Array();
54172
+ }
54173
+ let table = _reverseAlphabets[alphabet3];
54174
+ if (!table) {
54175
+ table = _reverseAlphabets[alphabet3] = [];
54176
+ for (let i = 0; i < alphabet3.length; ++i) {
54177
+ table[alphabet3.charCodeAt(i)] = i;
54178
+ }
54179
+ }
54180
+ input = input.replace(/\s/g, "");
54181
+ const base4 = alphabet3.length;
54182
+ const first2 = alphabet3.charAt(0);
54183
+ const bytes = [0];
54184
+ for (let i = 0; i < input.length; i++) {
54185
+ const value = table[input.charCodeAt(i)];
54186
+ if (value === void 0) {
54187
+ return;
54188
+ }
54189
+ let carry = value;
54190
+ for (let j = 0; j < bytes.length; ++j) {
54191
+ carry += bytes[j] * base4;
54192
+ bytes[j] = carry & 255;
54193
+ carry >>= 8;
54194
+ }
54195
+ while (carry > 0) {
54196
+ bytes.push(carry & 255);
54197
+ carry >>= 8;
54198
+ }
54199
+ }
54200
+ for (let k = 0; input[k] === first2 && k < input.length - 1; ++k) {
54201
+ bytes.push(0);
54202
+ }
54203
+ return new Uint8Array(bytes.reverse());
54204
+ }
54205
+ __name(decode11, "decode");
54206
+
54207
+ // ../../node_modules/.pnpm/base58-universal@2.0.0/node_modules/base58-universal/lib/index.js
54208
+ var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
54209
+ function encode13(input, maxline) {
54210
+ return encode12(input, alphabet2, maxline);
54211
+ }
54212
+ __name(encode13, "encode");
54213
+ function decode12(input) {
54214
+ return decode11(input, alphabet2);
54215
+ }
54216
+ __name(decode12, "decode");
54217
+
54218
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseDecoder.js
54219
+ var MultibaseDecoder = class extends CborldDecoder {
54220
+ decode({ value } = {}) {
54221
+ const { buffer: buffer2, byteOffset, length: length2 } = value;
54222
+ const suffix = new Uint8Array(buffer2, byteOffset + 1, length2 - 1);
54223
+ if (value[0] === 122) {
54224
+ return `z${encode13(suffix)}`;
54225
+ }
54226
+ if (value[0] === 77) {
54227
+ return `M${gBase64.fromUint8Array(suffix)}`;
54228
+ }
54229
+ return value;
54230
+ }
54231
+ static createDecoder({ value } = {}) {
54232
+ if (!(value instanceof Uint8Array)) {
54233
+ return false;
54234
+ }
54235
+ if (value[0] === 122 || value[0] === 77) {
54236
+ return new MultibaseDecoder();
54237
+ }
54238
+ }
54239
+ };
54240
+ __name(MultibaseDecoder, "MultibaseDecoder");
54241
+
54242
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/keywords.js
54243
+ var KEYWORDS = /* @__PURE__ */ new Map([
54244
+ ["@context", 0],
54245
+ ["@type", 2],
54246
+ ["@id", 4],
54247
+ ["@value", 6],
54248
+ ["@direction", 8],
54249
+ ["@graph", 10],
54250
+ ["@included", 12],
54251
+ ["@index", 14],
54252
+ ["@json", 16],
54253
+ ["@language", 18],
54254
+ ["@list", 20],
54255
+ ["@nest", 22],
54256
+ ["@reverse", 24],
54257
+ ["@base", 26],
54258
+ ["@container", 28],
54259
+ ["@default", 30],
54260
+ ["@embed", 32],
54261
+ ["@explicit", 34],
54262
+ ["@none", 36],
54263
+ ["@omitDefault", 38],
54264
+ ["@prefix", 40],
54265
+ ["@preserve", 42],
54266
+ ["@protected", 44],
54267
+ ["@requireAll", 46],
54268
+ ["@set", 48],
54269
+ ["@version", 50],
54270
+ ["@vocab", 52]
54271
+ ]);
54272
+ var FIRST_CUSTOM_TERM_ID = 100;
54273
+
54274
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Transformer.js
54275
+ var Transformer = class {
54276
+ constructor({ appContextMap, documentLoader } = {}) {
54277
+ this.appContextMap = appContextMap;
54278
+ this.documentLoader = documentLoader;
54279
+ }
54280
+ _beforeObjectContexts() {
54281
+ }
54282
+ _afterObjectContexts() {
54283
+ }
54284
+ _beforeTypeScopedContexts() {
54285
+ }
54286
+ _transform(_0) {
54287
+ return __async(this, arguments, function* ({ obj, transformMap, contextStack = [] }) {
54288
+ this._beforeObjectContexts({ obj, transformMap });
54289
+ let activeCtx = yield this._applyEmbeddedContexts({ obj, contextStack });
54290
+ this._afterObjectContexts({ obj, transformMap });
54291
+ const childContextStack = contextStack.slice();
54292
+ this._beforeTypeScopedContexts({ activeCtx, obj, transformMap });
54293
+ activeCtx = yield this._applyTypeScopedContexts({ obj, contextStack });
54294
+ const { aliases, scopedContextMap, termMap } = activeCtx;
54295
+ const termEntries = this._getEntries({ obj, transformMap, transformer: this, termMap });
54296
+ for (const [termInfo, value] of termEntries) {
54297
+ const { term } = termInfo;
54298
+ if (term === "@id" || aliases.id.has(term)) {
54299
+ this._transformObjectId({ obj, transformMap, termInfo, value });
54300
+ continue;
54301
+ }
54302
+ if (term === "@type" || aliases.type.has(term)) {
54303
+ this._transformObjectType({ obj, transformMap, termInfo, value });
54304
+ continue;
54305
+ }
54306
+ let propertyContextStack = childContextStack;
54307
+ let newActiveCtx;
54308
+ const propertyScopedContext = scopedContextMap.get(term);
54309
+ if (propertyScopedContext) {
54310
+ newActiveCtx = yield this._applyEmbeddedContexts({
54311
+ obj: { "@context": propertyScopedContext },
54312
+ contextStack
54313
+ });
54314
+ propertyContextStack = contextStack.slice();
54315
+ }
54316
+ const { plural, def } = termInfo;
54317
+ const termType = this._getTermType({ activeCtx: newActiveCtx || activeCtx, def });
54318
+ const values = plural ? value : [value];
54319
+ const entries = [];
54320
+ for (const value2 of values) {
54321
+ if (value2 === null) {
54322
+ entries.push(null);
54323
+ continue;
54324
+ }
54325
+ if (this._transformTypedValue({ entries, termType, value: value2, termInfo })) {
54326
+ continue;
54327
+ }
54328
+ if (typeof value2 !== "object") {
54329
+ entries.push(value2);
54330
+ continue;
54331
+ }
54332
+ if (Array.isArray(value2)) {
54333
+ yield this._transformArray({ entries, contextStack: propertyContextStack, value: value2 });
54334
+ continue;
54335
+ }
54336
+ yield this._transformObject({
54337
+ entries,
54338
+ contextStack: propertyContextStack,
54339
+ value: value2
54340
+ });
54341
+ }
54342
+ if (newActiveCtx) {
54343
+ newActiveCtx.revert();
54344
+ }
54345
+ this._assignEntries({ entries, obj, transformMap, termInfo });
54346
+ }
54347
+ activeCtx.revert();
54348
+ });
54349
+ }
54350
+ _applyEmbeddedContexts(_0) {
54351
+ return __async(this, arguments, function* ({ obj, contextStack }) {
54352
+ const stackTop = contextStack.length;
54353
+ const localContexts = obj["@context"];
54354
+ yield this._updateContextStack({ contextStack, contexts: localContexts });
54355
+ let active = contextStack[contextStack.length - 1];
54356
+ if (!active) {
54357
+ active = {
54358
+ aliases: {
54359
+ id: /* @__PURE__ */ new Set(),
54360
+ type: /* @__PURE__ */ new Set()
54361
+ },
54362
+ context: {},
54363
+ scopedContextMap: /* @__PURE__ */ new Map(),
54364
+ termMap: /* @__PURE__ */ new Map()
54365
+ };
54366
+ }
54367
+ return __spreadProps(__spreadValues({}, active), {
54368
+ revert() {
54369
+ contextStack.length = stackTop;
54370
+ }
54371
+ });
54372
+ });
54373
+ }
54374
+ _applyTypeScopedContexts(_0) {
54375
+ return __async(this, arguments, function* ({ obj, contextStack }) {
54376
+ const stackTop = contextStack.length;
54377
+ let active = contextStack[contextStack.length - 1];
54378
+ if (!active) {
54379
+ active = {
54380
+ aliases: {
54381
+ id: /* @__PURE__ */ new Set(),
54382
+ type: /* @__PURE__ */ new Set()
54383
+ },
54384
+ context: {},
54385
+ scopedContextMap: /* @__PURE__ */ new Map(),
54386
+ termMap: /* @__PURE__ */ new Map()
54387
+ };
54388
+ }
54389
+ const { aliases } = active;
54390
+ let totalTypes = [];
54391
+ const typeTerms = ["@type", ...aliases.type];
54392
+ for (const term of typeTerms) {
54393
+ const types = obj[term];
54394
+ if (Array.isArray(types)) {
54395
+ totalTypes.push(...types);
54396
+ } else {
54397
+ totalTypes.push(types);
54398
+ }
54399
+ }
54400
+ totalTypes = [...new Set(totalTypes)].sort();
54401
+ let { scopedContextMap } = active;
54402
+ for (const type of totalTypes) {
54403
+ const contexts = scopedContextMap.get(type);
54404
+ if (contexts) {
54405
+ yield this._updateContextStack({ contextStack, contexts });
54406
+ active = contextStack[contextStack.length - 1];
54407
+ ({ scopedContextMap } = active);
54408
+ }
54409
+ }
54410
+ return __spreadProps(__spreadValues({}, active), {
54411
+ revert() {
54412
+ contextStack.length = stackTop;
54413
+ }
54414
+ });
54415
+ });
54416
+ }
54417
+ _updateContextStack(_0) {
54418
+ return __async(this, arguments, function* ({ contextStack, contexts, transformer }) {
54419
+ if (!contexts) {
54420
+ return;
54421
+ }
54422
+ if (!Array.isArray(contexts)) {
54423
+ contexts = [contexts];
54424
+ }
54425
+ const { contextMap } = this;
54426
+ for (const context2 of contexts) {
54427
+ let entry = contextMap.get(context2);
54428
+ if (!entry) {
54429
+ let ctx = context2;
54430
+ let contextUrl;
54431
+ if (typeof context2 === "string") {
54432
+ contextUrl = context2;
54433
+ ({ "@context": ctx } = yield this._getDocument({ url: contextUrl }));
54434
+ }
54435
+ entry = yield this._addContext({ context: ctx, contextUrl, transformer });
54436
+ }
54437
+ const newActive = {
54438
+ aliases: {
54439
+ id: new Set(entry.aliases.id),
54440
+ type: new Set(entry.aliases.type)
54441
+ },
54442
+ context: context2,
54443
+ scopedContextMap: new Map(entry.scopedContextMap),
54444
+ termMap: new Map(entry.termMap)
54445
+ };
54446
+ const oldActive = contextStack[contextStack.length - 1];
54447
+ contextStack.push(newActive);
54448
+ if (!oldActive) {
54449
+ continue;
54450
+ }
54451
+ const { aliases, termMap } = newActive;
54452
+ for (const key2 of ["id", "type"]) {
54453
+ for (const alias of oldActive.aliases[key2]) {
54454
+ if (!(context2[alias] === null || newActive.termMap.has(alias))) {
54455
+ aliases[key2].add(alias);
54456
+ }
54457
+ }
54458
+ }
54459
+ const { scopedContextMap } = newActive;
54460
+ for (const [key2, value] of oldActive.scopedContextMap) {
54461
+ if (!(context2[key2] === null || scopedContextMap.has(key2))) {
54462
+ scopedContextMap.set(key2, value);
54463
+ }
54464
+ }
54465
+ for (const [key2, value] of oldActive.termMap) {
54466
+ if (!(context2[key2] === null || termMap.has(key2))) {
54467
+ termMap.set(key2, value);
54468
+ }
54469
+ }
54470
+ }
54471
+ });
54472
+ }
54473
+ _addContext(_0) {
54474
+ return __async(this, arguments, function* ({ context: context2, contextUrl }) {
54475
+ const { contextMap, termToId, idToTerm } = this;
54476
+ const importUrl = context2["@import"];
54477
+ if (importUrl) {
54478
+ let importEntry = contextMap.get(importUrl);
54479
+ if (!importEntry) {
54480
+ const { "@context": importCtx } = yield this._getDocument({ url: importUrl });
54481
+ importEntry = yield this._addContext({ context: importCtx, contextUrl: importUrl });
54482
+ }
54483
+ context2 = __spreadValues(__spreadValues({}, importEntry.context), context2);
54484
+ }
54485
+ const scopedContextMap = /* @__PURE__ */ new Map();
54486
+ const termMap = /* @__PURE__ */ new Map();
54487
+ const entry = {
54488
+ aliases: { id: /* @__PURE__ */ new Set(), type: /* @__PURE__ */ new Set() },
54489
+ context: context2,
54490
+ scopedContextMap,
54491
+ termMap
54492
+ };
54493
+ const keys = Object.keys(context2).sort();
54494
+ for (const key2 of keys) {
54495
+ const def = context2[key2];
54496
+ if (!def) {
54497
+ continue;
54498
+ }
54499
+ if (def === "@id" || def.id === "@id") {
54500
+ entry.aliases.id.add(key2);
54501
+ } else if (def === "@type" || def.id === "@type") {
54502
+ entry.aliases.type.add(key2);
54503
+ }
54504
+ if (KEYWORDS.has(key2)) {
54505
+ continue;
54506
+ }
54507
+ if (!termToId.has(key2)) {
54508
+ const id = this.nextTermId;
54509
+ this.nextTermId += 2;
54510
+ termToId.set(key2, id);
54511
+ if (idToTerm) {
54512
+ idToTerm.set(id, key2);
54513
+ }
54514
+ }
54515
+ termMap.set(key2, def);
54516
+ const scopedContext = def["@context"];
54517
+ if (scopedContext) {
54518
+ scopedContextMap.set(key2, scopedContext);
54519
+ }
54520
+ }
54521
+ contextMap.set(contextUrl || context2, entry);
54522
+ return entry;
54523
+ });
54524
+ }
54525
+ _getDocument(_0) {
54526
+ return __async(this, arguments, function* ({ url }) {
54527
+ const { document } = yield this.documentLoader(url);
54528
+ if (typeof document === "string") {
54529
+ return JSON.parse(document);
54530
+ }
54531
+ return document;
54532
+ });
54533
+ }
54534
+ _getTermType({ activeCtx, def }) {
54535
+ const { "@type": type } = def;
54536
+ if (!type) {
54537
+ return;
54538
+ }
54539
+ const [prefix, ...suffix] = type.split(":");
54540
+ const prefixDef = activeCtx.termMap.get(prefix);
54541
+ if (prefixDef === void 0) {
54542
+ return type;
54543
+ }
54544
+ if (typeof prefixDef === "string") {
54545
+ return prefixDef + suffix.join(":");
54546
+ }
54547
+ if (!(typeof prefixDef === "object" && typeof prefixDef["@id"] === "string")) {
54548
+ throw new CborldError("ERR_INVALID_TERM_DEFINITION", 'JSON-LD term definitions must be strings or objects with "@id".');
54549
+ }
54550
+ return prefixDef["@id"] + suffix.join(":");
54551
+ }
54552
+ _getIdForTerm({ term, plural }) {
54553
+ const id = this.termToId.get(term);
54554
+ if (id === void 0) {
54555
+ throw new CborldError("ERR_UNDEFINED_TERM", "CBOR-LD compression requires all terms to be defined in a JSON-LD context.");
54556
+ }
54557
+ return plural ? id + 1 : id;
54558
+ }
54559
+ _getTermForId({ id }) {
54560
+ const plural = (id & 1) === 1;
54561
+ const term = this.idToTerm.get(plural ? id - 1 : id);
54562
+ return { term, plural };
54563
+ }
54564
+ };
54565
+ __name(Transformer, "Transformer");
54566
+
54567
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlDecoder.js
54568
+ var ID_TO_SCHEME = /* @__PURE__ */ new Map([
54569
+ [1024, "did:v1:nym:"],
54570
+ [1025, "did:key:"]
54571
+ ]);
54572
+ var Base58DidUrlDecoder = class extends CborldDecoder {
54573
+ decode({ value } = {}) {
54574
+ let url = ID_TO_SCHEME.get(value[0]);
54575
+ if (typeof value[1] === "string") {
54576
+ url += value[1];
54577
+ } else {
54578
+ url += `z${encode13(value[1])}`;
54579
+ }
54580
+ if (value.length > 2) {
54581
+ if (typeof value[2] === "string") {
54582
+ url += `#${value[2]}`;
54583
+ } else {
54584
+ url += `#z${encode13(value[2])}`;
54585
+ }
54586
+ }
54587
+ return url;
54588
+ }
54589
+ static createDecoder({ value } = {}) {
54590
+ if (!(Array.isArray(value) && value.length > 1 && value.length <= 3)) {
54591
+ return false;
54592
+ }
54593
+ if (!ID_TO_SCHEME.has(value[0])) {
54594
+ return false;
54595
+ }
54596
+ return new Base58DidUrlDecoder();
54597
+ }
54598
+ };
54599
+ __name(Base58DidUrlDecoder, "Base58DidUrlDecoder");
54600
+
54601
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlDecoder.js
54602
+ var HttpUrlDecoder = class extends CborldDecoder {
54603
+ constructor({ secure } = {}) {
54604
+ super();
54605
+ this.secure = secure;
54606
+ }
54607
+ decode({ value } = {}) {
54608
+ const scheme = this.secure ? "https://" : "http://";
54609
+ return `${scheme}${value[1]}`;
54610
+ }
54611
+ static createDecoder({ value } = {}) {
54612
+ if (!(value.length === 2 && typeof value[1] === "string")) {
54613
+ return false;
54614
+ }
54615
+ return new HttpUrlDecoder({ secure: value[0] === 2 });
54616
+ }
54617
+ };
54618
+ __name(HttpUrlDecoder, "HttpUrlDecoder");
54619
+
54620
+ // ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/regex.js
54621
+ var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
54622
+
54623
+ // ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/validate.js
54624
+ function validate6(uuid) {
54625
+ return typeof uuid === "string" && regex_default.test(uuid);
54626
+ }
54627
+ __name(validate6, "validate");
54628
+ var validate_default = validate6;
54629
+
54630
+ // ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/stringify.js
54631
+ var byteToHex = [];
54632
+ for (i = 0; i < 256; ++i) {
54633
+ byteToHex.push((i + 256).toString(16).substr(1));
54634
+ }
54635
+ var i;
54636
+ function stringify2(arr) {
54637
+ var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
54638
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
54639
+ if (!validate_default(uuid)) {
54640
+ throw TypeError("Stringified UUID is invalid");
54641
+ }
54642
+ return uuid;
54643
+ }
54644
+ __name(stringify2, "stringify");
54645
+ var stringify_default = stringify2;
54646
+
54647
+ // ../../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/parse.js
54648
+ function parse2(uuid) {
54649
+ if (!validate_default(uuid)) {
54650
+ throw TypeError("Invalid UUID");
54651
+ }
54652
+ var v;
54653
+ var arr = new Uint8Array(16);
54654
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
54655
+ arr[1] = v >>> 16 & 255;
54656
+ arr[2] = v >>> 8 & 255;
54657
+ arr[3] = v & 255;
54658
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
54659
+ arr[5] = v & 255;
54660
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
54661
+ arr[7] = v & 255;
54662
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
54663
+ arr[9] = v & 255;
54664
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
54665
+ arr[11] = v / 4294967296 & 255;
54666
+ arr[12] = v >>> 24 & 255;
54667
+ arr[13] = v >>> 16 & 255;
54668
+ arr[14] = v >>> 8 & 255;
54669
+ arr[15] = v & 255;
54670
+ return arr;
54671
+ }
54672
+ __name(parse2, "parse");
54673
+ var parse_default = parse2;
54674
+
54675
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnDecoder.js
54676
+ var UuidUrnDecoder = class extends CborldDecoder {
54677
+ decode({ value } = {}) {
54678
+ const uuid = typeof value[1] === "string" ? value[1] : stringify_default(value[1]);
54679
+ return `urn:uuid:${uuid}`;
54680
+ }
54681
+ static createDecoder({ value } = {}) {
54682
+ if (value.length === 2 && (typeof value[1] === "string" || value[1] instanceof Uint8Array)) {
54683
+ return new UuidUrnDecoder();
54684
+ }
54685
+ }
54686
+ };
54687
+ __name(UuidUrnDecoder, "UuidUrnDecoder");
54688
+
54689
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriDecoder.js
54690
+ var SCHEME_ID_TO_DECODER = /* @__PURE__ */ new Map([
54691
+ [1, HttpUrlDecoder],
54692
+ [2, HttpUrlDecoder],
54693
+ [3, UuidUrnDecoder],
54694
+ [1024, Base58DidUrlDecoder],
54695
+ [1025, Base58DidUrlDecoder]
54696
+ ]);
54697
+ var UriDecoder = class extends CborldDecoder {
54698
+ static createDecoder({ value } = {}) {
54699
+ if (!(Array.isArray(value) || value.length > 1)) {
54700
+ return false;
54701
+ }
54702
+ const DecoderClass = SCHEME_ID_TO_DECODER.get(value[0]);
54703
+ return DecoderClass && DecoderClass.createDecoder({ value });
54704
+ }
54705
+ };
54706
+ __name(UriDecoder, "UriDecoder");
54707
+
54708
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermDecoder.js
54709
+ var VocabTermDecoder = class extends CborldDecoder {
54710
+ constructor({ term } = {}) {
54711
+ super();
54712
+ this.term = term;
54713
+ }
54714
+ decode() {
54715
+ return this.term;
54716
+ }
54717
+ static createDecoder({ value, transformer } = {}) {
54718
+ if (Array.isArray(value)) {
54719
+ return UriDecoder.createDecoder({ value, transformer });
54720
+ }
54721
+ const term = transformer.idToTerm.get(value);
54722
+ if (term !== void 0) {
54723
+ return new VocabTermDecoder({ term });
54724
+ }
54725
+ }
54726
+ };
54727
+ __name(VocabTermDecoder, "VocabTermDecoder");
54728
+
54729
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateDecoder.js
54730
+ var XsdDateDecoder = class extends CborldDecoder {
54731
+ decode({ value } = {}) {
54732
+ const dateString = new Date(value * 1e3).toISOString();
54733
+ return dateString.substring(0, dateString.indexOf("T"));
54734
+ }
54735
+ static createDecoder({ value } = {}) {
54736
+ if (typeof value === "number") {
54737
+ return new XsdDateDecoder();
54738
+ }
54739
+ }
54740
+ };
54741
+ __name(XsdDateDecoder, "XsdDateDecoder");
54742
+
54743
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeDecoder.js
54744
+ var XsdDateTimeDecoder = class extends CborldDecoder {
54745
+ constructor({ value } = {}) {
54746
+ super();
54747
+ this.value = value;
54748
+ }
54749
+ decode({ value } = {}) {
54750
+ if (typeof value === "number") {
54751
+ return new Date(value * 1e3).toISOString().replace(".000Z", "Z");
54752
+ }
54753
+ return new Date(value[0] * 1e3 + value[1]).toISOString();
54754
+ }
54755
+ static createDecoder({ value } = {}) {
54756
+ if (typeof value === "number") {
54757
+ return new XsdDateTimeDecoder();
54758
+ }
54759
+ if (Array.isArray(value) && value.length === 2 && (typeof value[0] === "number" || typeof value[1] === "number")) {
54760
+ return new XsdDateTimeDecoder();
54761
+ }
54762
+ }
54763
+ };
54764
+ __name(XsdDateTimeDecoder, "XsdDateTimeDecoder");
54765
+
54766
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/util-browser.js
54767
+ function inspect4(data, options) {
54768
+ return JSON.stringify(data, null, 2);
54769
+ }
54770
+ __name(inspect4, "inspect");
54771
+
54772
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Decompressor.js
54773
+ var TYPE_DECODERS = /* @__PURE__ */ new Map([
54774
+ ["@id", UriDecoder],
54775
+ ["@vocab", VocabTermDecoder],
54776
+ ["https://w3id.org/security#multibase", MultibaseDecoder],
54777
+ ["http://www.w3.org/2001/XMLSchema#date", XsdDateDecoder],
54778
+ ["http://www.w3.org/2001/XMLSchema#dateTime", XsdDateTimeDecoder]
54779
+ ]);
54780
+ var CONTEXT_TERM_ID = KEYWORDS.get("@context");
54781
+ var CONTEXT_TERM_ID_PLURAL = CONTEXT_TERM_ID + 1;
54782
+ var Decompressor = class extends Transformer {
54783
+ constructor({ documentLoader, appContextMap } = {}) {
54784
+ super({ documentLoader, appContextMap });
54785
+ this.reverseAppContextMap = /* @__PURE__ */ new Map();
54786
+ if (appContextMap) {
54787
+ for (const [k, v] of appContextMap) {
54788
+ this.reverseAppContextMap.set(v, k);
54789
+ }
54790
+ }
54791
+ }
54792
+ decompress() {
54793
+ return __async(this, arguments, function* ({ compressedBytes, diagnose } = {}) {
54794
+ this.contextMap = /* @__PURE__ */ new Map();
54795
+ this.termToId = new Map(KEYWORDS);
54796
+ this.nextTermId = FIRST_CUSTOM_TERM_ID;
54797
+ this.idToTerm = /* @__PURE__ */ new Map();
54798
+ for (const [term, id] of this.termToId) {
54799
+ this.idToTerm.set(id, term);
54800
+ }
54801
+ const transformMap = decode8(compressedBytes, { useMaps: true });
54802
+ if (diagnose) {
54803
+ diagnose("Diagnostic CBOR-LD decompression transform map(s):");
54804
+ diagnose(inspect4(transformMap, { depth: null, colors: true }));
54805
+ }
54806
+ const results = [];
54807
+ const isArray2 = Array.isArray(transformMap);
54808
+ const transformMaps = isArray2 ? transformMap : [transformMap];
54809
+ for (const transformMap2 of transformMaps) {
54810
+ const obj = {};
54811
+ yield this._transform({ obj, transformMap: transformMap2 });
54812
+ results.push(obj);
54813
+ }
54814
+ return isArray2 ? results : results[0];
54815
+ });
54816
+ }
54817
+ _beforeObjectContexts({ obj, transformMap }) {
54818
+ const encodedContext = transformMap.get(CONTEXT_TERM_ID);
54819
+ if (encodedContext) {
54820
+ const decoder = ContextDecoder.createDecoder({ value: encodedContext, transformer: this });
54821
+ obj["@context"] = decoder ? decoder.decode({ value: encodedContext }) : encodedContext;
54822
+ }
54823
+ const encodedContexts = transformMap.get(CONTEXT_TERM_ID_PLURAL);
54824
+ if (encodedContexts) {
54825
+ if (encodedContext) {
54826
+ throw new CborldError("ERR_INVALID_ENCODED_CONTEXT", "Both singular and plural context IDs were found in the CBOR-LD input.");
54827
+ }
54828
+ if (!Array.isArray(encodedContexts)) {
54829
+ throw new CborldError("ERR_INVALID_ENCODED_CONTEXT", "Encoded plural context value must be an array.");
54830
+ }
54831
+ const entries = [];
54832
+ for (const value of encodedContexts) {
54833
+ const decoder = ContextDecoder.createDecoder({ value, transformer: this });
54834
+ entries.push(decoder ? decoder.decode({ value }) : value);
54835
+ }
54836
+ obj["@context"] = entries;
54837
+ }
54838
+ }
54839
+ _beforeTypeScopedContexts({ activeCtx, obj, transformMap }) {
54840
+ const { termToId } = this;
54841
+ const typeTerms = ["@type", ...activeCtx.aliases.type];
54842
+ for (const term of typeTerms) {
54843
+ const termId = termToId.get(term);
54844
+ let value = transformMap.get(termId);
54845
+ if (value === void 0) {
54846
+ value = transformMap.get(termId + 1);
54847
+ }
54848
+ if (value !== void 0) {
54849
+ if (Array.isArray(value)) {
54850
+ obj[term] = value.map((value2) => {
54851
+ const decoder = VocabTermDecoder.createDecoder({ value: value2, transformer: this });
54852
+ return decoder ? decoder.decode({ value: value2 }) : value2;
54853
+ });
54854
+ } else {
54855
+ const decoder = VocabTermDecoder.createDecoder({ value, transformer: this });
54856
+ obj[term] = decoder ? decoder.decode({ value }) : value;
54857
+ }
54858
+ }
54859
+ }
54860
+ }
54861
+ _getEntries({ transformMap, termMap }) {
54862
+ const entries = [];
54863
+ for (const [key2, value] of transformMap) {
54864
+ if (key2 === CONTEXT_TERM_ID || key2 === CONTEXT_TERM_ID_PLURAL) {
54865
+ continue;
54866
+ }
54867
+ const { term, plural } = this._getTermForId({ id: key2 });
54868
+ if (term === void 0) {
54869
+ throw new CborldError("ERR_UNKNOWN_CBORLD_TERM_ID", `Unknown term ID '${key2}' was detected in the CBOR-LD input.`);
54870
+ }
54871
+ const def = termMap.get(term);
54872
+ if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
54873
+ throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term "${term}" was detected in the CBOR-LD input.`);
54874
+ }
54875
+ entries.push([{ term, termId: key2, plural, def }, value]);
54876
+ }
54877
+ return entries.sort(_sortEntriesByTerm);
54878
+ }
54879
+ _getTermInfo({ termMap, key: key2 }) {
54880
+ const { term, plural } = this._getTermForId({ id: key2 });
54881
+ if (term === void 0) {
54882
+ throw new CborldError("ERR_UNKNOWN_CBORLD_TERM_ID", `Unknown term ID '${key2}' was detected in the CBOR-LD input.`);
54883
+ }
54884
+ const def = termMap.get(term);
54885
+ if (def === void 0 && !(term.startsWith("@") && KEYWORDS.has(term))) {
54886
+ throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term "${term}" was detected in the CBOR-LD input.`);
54887
+ }
54888
+ return { term, termId: key2, plural, def };
54889
+ }
54890
+ _transformObjectId({ obj, termInfo, value }) {
54891
+ const decoder = UriDecoder.createDecoder({ value });
54892
+ obj[termInfo.term] = decoder ? decoder.decode({ value }) : value;
54893
+ }
54894
+ _transformObjectType({ obj, termInfo, value }) {
54895
+ const { term, plural } = termInfo;
54896
+ const values = plural ? value : [value];
54897
+ const entries = [];
54898
+ for (const value2 of values) {
54899
+ const decoder = VocabTermDecoder.createDecoder({ value: value2, transformer: this });
54900
+ entries.push(decoder ? decoder.decode({ value: value2 }) : value2);
54901
+ }
54902
+ obj[term] = plural ? entries : entries[0];
54903
+ }
54904
+ _transformTypedValue({ entries, termType, value }) {
54905
+ const DecoderClass = TYPE_DECODERS.get(termType);
54906
+ const decoder = DecoderClass && DecoderClass.createDecoder({ value, transformer: this });
54907
+ if (decoder) {
54908
+ entries.push(decoder.decode({ value }));
54909
+ return true;
54910
+ }
54911
+ }
54912
+ _transformArray(_0) {
54913
+ return __async(this, arguments, function* ({ entries, contextStack, value }) {
54914
+ const children = [];
54915
+ for (const transformMap of value) {
54916
+ const obj = {};
54917
+ children.push(obj);
54918
+ yield this._transform({ obj, transformMap, contextStack });
54919
+ }
54920
+ entries.push(children);
54921
+ });
54922
+ }
54923
+ _transformObject(_0) {
54924
+ return __async(this, arguments, function* ({ entries, contextStack, value }) {
54925
+ const child = {};
54926
+ entries.push(child);
54927
+ return this._transform({ obj: child, transformMap: value, contextStack });
54928
+ });
54929
+ }
54930
+ _assignEntries({ entries, obj, termInfo }) {
54931
+ const { term, plural } = termInfo;
54932
+ obj[term] = plural ? entries : entries[0];
54933
+ }
54934
+ };
54935
+ __name(Decompressor, "Decompressor");
54936
+ function _sortEntriesByTerm([{ term: t1 }], [{ term: t2 }]) {
54937
+ return t1 < t2 ? -1 : t1 > t2 ? 1 : 0;
54938
+ }
54939
+ __name(_sortEntriesByTerm, "_sortEntriesByTerm");
54940
+
54941
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/decode.js
54942
+ function decode13(_0) {
54943
+ return __async(this, arguments, function* ({
54944
+ cborldBytes,
54945
+ documentLoader,
54946
+ appContextMap = /* @__PURE__ */ new Map(),
54947
+ diagnose
54948
+ }) {
54949
+ if (!(cborldBytes instanceof Uint8Array)) {
54950
+ throw new TypeError('"cborldBytes" must be a Uint8Array.');
54951
+ }
54952
+ let index = 0;
54953
+ if (cborldBytes[index++] !== 217) {
54954
+ throw new CborldError("ERR_NOT_CBORLD", 'CBOR-LD must start with a CBOR major type "Tag" header of `0xd9`.');
54955
+ }
54956
+ if (cborldBytes[index++] !== 5) {
54957
+ throw new CborldError("ERR_NOT_CBORLD", "CBOR-LD 16-bit tag must start with `0x05`.");
54958
+ }
54959
+ const compressionMode = cborldBytes[index];
54960
+ if (compressionMode === void 0) {
54961
+ throw new CborldError("ERR_NOT_CBORLD", "Truncated CBOR-LD 16-bit tag.");
54962
+ }
54963
+ if (!(compressionMode === 0 || compressionMode === 1)) {
54964
+ throw new CborldError("ERR_NOT_CBORLD", `Unsupported CBOR-LD compression mode "${compressionMode}".`);
54965
+ }
54966
+ index++;
54967
+ const { buffer: buffer2, byteOffset, length: length2 } = cborldBytes;
54968
+ const suffix = new Uint8Array(buffer2, byteOffset + index, length2 - index);
54969
+ if (compressionMode === 0) {
54970
+ return decode8(suffix, { useMaps: false });
54971
+ }
54972
+ const decompressor = new Decompressor({ documentLoader, appContextMap });
54973
+ const result = yield decompressor.decompress({ compressedBytes: suffix, diagnose });
54974
+ if (diagnose) {
54975
+ diagnose("Diagnostic JSON-LD result:");
54976
+ diagnose(inspect4(result, { depth: null, colors: true }));
54977
+ }
54978
+ return result;
54979
+ });
54980
+ }
54981
+ __name(decode13, "decode");
54982
+
54983
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/CborldEncoder.js
54984
+ var CborldEncoder = class {
54985
+ encode() {
54986
+ throw new Error("Must be implemented by derived class.");
54987
+ }
54988
+ static createEncoder({ value } = {}) {
54989
+ throw new Error("Must be implemented by derived class.");
54990
+ }
54991
+ };
54992
+ __name(CborldEncoder, "CborldEncoder");
54993
+
54994
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/ContextEncoder.js
54995
+ var ContextEncoder = class extends CborldEncoder {
54996
+ constructor({ context: context2, appContextMap } = {}) {
54997
+ super();
54998
+ this.context = context2;
54999
+ this.appContextMap = appContextMap;
55000
+ }
55001
+ encode() {
55002
+ const { context: context2 } = this;
55003
+ const id = URL_TO_ID.get(context2) || this.appContextMap.get(context2);
55004
+ if (id === void 0) {
55005
+ return new Token(Type.string, context2);
55006
+ }
55007
+ return new Token(Type.uint, id);
55008
+ }
55009
+ static createEncoder({ value, transformer } = {}) {
55010
+ if (typeof value !== "string") {
55011
+ return false;
55012
+ }
55013
+ const { appContextMap } = transformer;
55014
+ return new ContextEncoder({ context: value, appContextMap });
55015
+ }
55016
+ };
55017
+ __name(ContextEncoder, "ContextEncoder");
55018
+
55019
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/MultibaseEncoder.js
55020
+ var MultibaseEncoder = class extends CborldEncoder {
55021
+ constructor({ value } = {}) {
55022
+ super();
55023
+ this.value = value;
55024
+ }
55025
+ encode() {
55026
+ const { value } = this;
55027
+ let prefix;
55028
+ let suffix;
55029
+ if (value[0] === "z") {
55030
+ prefix = 122;
55031
+ suffix = decode12(value.substr(1));
55032
+ } else if (value[0] === "M") {
55033
+ prefix = 77;
55034
+ suffix = gBase64.toUint8Array(value.substr(1));
55035
+ }
55036
+ const bytes = new Uint8Array(1 + suffix.length);
55037
+ bytes[0] = prefix;
55038
+ bytes.set(suffix, 1);
55039
+ return new Token(Type.bytes, bytes);
55040
+ }
55041
+ static createEncoder({ value } = {}) {
55042
+ if (typeof value !== "string") {
55043
+ return false;
55044
+ }
55045
+ if (value[0] === "z" || value[0] === "M") {
55046
+ return new MultibaseEncoder({ value });
55047
+ }
55048
+ }
55049
+ };
55050
+ __name(MultibaseEncoder, "MultibaseEncoder");
55051
+
55052
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/Base58DidUrlEncoder.js
55053
+ var SCHEME_TO_ID = /* @__PURE__ */ new Map([
55054
+ ["did:v1:nym:", 1024],
55055
+ ["did:key:", 1025]
55056
+ ]);
55057
+ var Base58DidUrlEncoder = class extends CborldEncoder {
55058
+ constructor({ value, scheme } = {}) {
55059
+ super();
55060
+ this.value = value;
55061
+ this.scheme = scheme;
55062
+ }
55063
+ encode() {
55064
+ const { value, scheme } = this;
55065
+ const suffix = value.substr(scheme.length);
55066
+ const [authority, fragment] = suffix.split("#");
55067
+ const entries = [
55068
+ new Token(Type.uint, SCHEME_TO_ID.get(scheme)),
55069
+ _multibase58ToToken(authority)
55070
+ ];
55071
+ if (fragment !== void 0) {
55072
+ entries.push(_multibase58ToToken(fragment));
55073
+ }
55074
+ return [new Token(Type.array, entries.length), entries];
55075
+ }
55076
+ static createEncoder({ value } = {}) {
55077
+ const keys = [...SCHEME_TO_ID.keys()];
55078
+ for (const key2 of keys) {
55079
+ if (value.startsWith(key2)) {
55080
+ return new Base58DidUrlEncoder({ value, scheme: key2 });
55081
+ }
55082
+ }
55083
+ }
55084
+ };
55085
+ __name(Base58DidUrlEncoder, "Base58DidUrlEncoder");
55086
+ function _multibase58ToToken(str) {
55087
+ if (str.startsWith("z")) {
55088
+ const decoded = decode12(str.substr(1));
55089
+ if (decoded) {
55090
+ return new Token(Type.bytes, decoded);
55091
+ }
55092
+ }
55093
+ return new Token(Type.string, str);
55094
+ }
55095
+ __name(_multibase58ToToken, "_multibase58ToToken");
55096
+
55097
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/HttpUrlEncoder.js
55098
+ var HttpUrlEncoder = class extends CborldEncoder {
55099
+ constructor({ value, secure } = {}) {
55100
+ super();
55101
+ this.value = value;
55102
+ this.secure = secure;
55103
+ }
55104
+ encode() {
55105
+ const { value, secure } = this;
55106
+ const length2 = secure ? "https://".length : "http://".length;
55107
+ const entries = [
55108
+ new Token(Type.uint, secure ? 2 : 1),
55109
+ new Token(Type.string, value.substr(length2))
55110
+ ];
55111
+ return [new Token(Type.array, entries.length), entries];
55112
+ }
55113
+ static createEncoder({ value } = {}) {
55114
+ if (value.startsWith("https://")) {
55115
+ return new HttpUrlEncoder({ value, secure: true });
55116
+ }
55117
+ if (value.startsWith("http://")) {
55118
+ return new HttpUrlEncoder({ value, secure: false });
55119
+ }
55120
+ }
55121
+ };
55122
+ __name(HttpUrlEncoder, "HttpUrlEncoder");
55123
+
55124
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UuidUrnEncoder.js
55125
+ var UuidUrnEncoder = class extends CborldEncoder {
55126
+ constructor({ value } = {}) {
55127
+ super();
55128
+ this.value = value;
55129
+ }
55130
+ encode() {
55131
+ const { value } = this;
55132
+ const rest = value.substr("urn:uuid:".length);
55133
+ const entries = [new Token(Type.uint, 3)];
55134
+ if (rest.toLowerCase() === rest) {
55135
+ const uuidBytes = parse_default(rest);
55136
+ entries.push(new Token(Type.bytes, uuidBytes));
55137
+ } else {
55138
+ entries.push(new Token(Type.string, rest));
55139
+ }
55140
+ return [new Token(Type.array, entries.length), entries];
55141
+ }
55142
+ static createEncoder({ value } = {}) {
55143
+ if (value.startsWith("urn:uuid:")) {
55144
+ return new UuidUrnEncoder({ value });
55145
+ }
55146
+ }
55147
+ };
55148
+ __name(UuidUrnEncoder, "UuidUrnEncoder");
55149
+
55150
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/UriEncoder.js
55151
+ var SCHEME_TO_ENCODER = /* @__PURE__ */ new Map([
55152
+ ["http", HttpUrlEncoder],
55153
+ ["https", HttpUrlEncoder],
55154
+ ["urn:uuid", UuidUrnEncoder],
55155
+ ["did:v1:nym", Base58DidUrlEncoder],
55156
+ ["did:key", Base58DidUrlEncoder]
55157
+ ]);
55158
+ var UriEncoder = class extends CborldEncoder {
55159
+ static createEncoder({ value } = {}) {
55160
+ if (typeof value !== "string") {
55161
+ return false;
55162
+ }
55163
+ let scheme;
55164
+ try {
55165
+ const { protocol, pathname } = new URL(value);
55166
+ scheme = protocol;
55167
+ if (pathname.includes(":")) {
55168
+ scheme += pathname;
55169
+ }
55170
+ const split = value.split(":");
55171
+ split.pop();
55172
+ scheme = split.join(":");
55173
+ } catch (e) {
55174
+ return false;
55175
+ }
55176
+ const EncoderClass = SCHEME_TO_ENCODER.get(scheme);
55177
+ return EncoderClass && EncoderClass.createEncoder({ value });
55178
+ }
55179
+ };
55180
+ __name(UriEncoder, "UriEncoder");
55181
+
55182
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/VocabTermEncoder.js
55183
+ var VocabTermEncoder = class extends CborldEncoder {
55184
+ constructor({ termId } = {}) {
55185
+ super();
55186
+ this.termId = termId;
55187
+ }
55188
+ encode() {
55189
+ return new Token(Type.uint, this.termId);
55190
+ }
55191
+ static createEncoder({ value, transformer } = {}) {
55192
+ const { termToId } = transformer;
55193
+ const termId = termToId.get(value);
55194
+ if (termId !== void 0) {
55195
+ return new VocabTermEncoder({ termId });
55196
+ }
55197
+ return UriEncoder.createEncoder({ value });
55198
+ }
55199
+ };
55200
+ __name(VocabTermEncoder, "VocabTermEncoder");
55201
+
55202
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateEncoder.js
55203
+ var XsdDateEncoder = class extends CborldEncoder {
55204
+ constructor({ value, parsed } = {}) {
55205
+ super();
55206
+ this.value = value;
55207
+ this.parsed = parsed;
55208
+ }
55209
+ encode() {
55210
+ const { value, parsed } = this;
55211
+ const secondsSinceEpoch = Math.floor(parsed / 1e3);
55212
+ const dateString = new Date(secondsSinceEpoch * 1e3).toISOString();
55213
+ const expectedDate = dateString.substring(0, dateString.indexOf("T"));
55214
+ if (value !== expectedDate) {
55215
+ return new Token(Type.string, value);
55216
+ }
55217
+ return new Token(Type.uint, secondsSinceEpoch);
55218
+ }
55219
+ static createEncoder({ value } = {}) {
55220
+ if (value.includes("T")) {
55221
+ return false;
55222
+ }
55223
+ const parsed = Date.parse(value);
55224
+ if (isNaN(parsed)) {
55225
+ return false;
55226
+ }
55227
+ return new XsdDateEncoder({ value, parsed });
55228
+ }
55229
+ };
55230
+ __name(XsdDateEncoder, "XsdDateEncoder");
55231
+
55232
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/codecs/XsdDateTimeEncoder.js
55233
+ var XsdDateTimeEncoder = class extends CborldEncoder {
55234
+ constructor({ value, parsed } = {}) {
55235
+ super();
55236
+ this.value = value;
55237
+ this.parsed = parsed;
55238
+ }
55239
+ encode() {
55240
+ const { value, parsed } = this;
55241
+ const secondsSinceEpoch = Math.floor(parsed / 1e3);
55242
+ const secondsToken = new Token(Type.uint, secondsSinceEpoch);
55243
+ const millisecondIndex = value.indexOf(".");
55244
+ if (millisecondIndex === -1) {
55245
+ const expectedDate2 = new Date(secondsSinceEpoch * 1e3).toISOString().replace(".000Z", "Z");
55246
+ if (value !== expectedDate2) {
55247
+ return new Token(Type.string, value);
55248
+ }
55249
+ return secondsToken;
55250
+ }
55251
+ const milliseconds = parseInt(value.substr(millisecondIndex + 1), 10);
55252
+ const expectedDate = new Date(secondsSinceEpoch * 1e3 + milliseconds).toISOString();
55253
+ if (value !== expectedDate) {
55254
+ return new Token(Type.string, value);
55255
+ }
55256
+ const entries = [
55257
+ secondsToken,
55258
+ new Token(Type.uint, milliseconds)
55259
+ ];
55260
+ return [new Token(Type.array, entries.length), entries];
55261
+ }
55262
+ static createEncoder({ value } = {}) {
55263
+ if (!value.includes("T")) {
55264
+ return false;
55265
+ }
55266
+ const parsed = Date.parse(value);
55267
+ if (isNaN(parsed)) {
55268
+ return false;
55269
+ }
55270
+ return new XsdDateTimeEncoder({ value, parsed });
55271
+ }
55272
+ };
55273
+ __name(XsdDateTimeEncoder, "XsdDateTimeEncoder");
55274
+
55275
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/Compressor.js
55276
+ var TYPE_ENCODERS = /* @__PURE__ */ new Map([
55277
+ ["@id", UriEncoder],
55278
+ ["@vocab", VocabTermEncoder],
55279
+ ["https://w3id.org/security#multibase", MultibaseEncoder],
55280
+ ["http://www.w3.org/2001/XMLSchema#date", XsdDateEncoder],
55281
+ ["http://www.w3.org/2001/XMLSchema#dateTime", XsdDateTimeEncoder]
55282
+ ]);
55283
+ var CONTEXT_TERM_ID2 = KEYWORDS.get("@context");
55284
+ var CONTEXT_TERM_ID_PLURAL2 = CONTEXT_TERM_ID2 + 1;
55285
+ var typeEncoders2 = {
55286
+ Object(obj) {
55287
+ if (obj instanceof CborldEncoder) {
55288
+ return obj.encode({ obj });
55289
+ }
55290
+ }
55291
+ };
55292
+ var Compressor = class extends Transformer {
55293
+ constructor({ documentLoader, appContextMap } = {}) {
55294
+ super({ documentLoader, appContextMap });
55295
+ }
55296
+ compress() {
55297
+ return __async(this, arguments, function* ({ jsonldDocument, diagnose } = {}) {
55298
+ const transformMaps = yield this._createTransformMaps({ jsonldDocument });
55299
+ if (diagnose) {
55300
+ diagnose("Diagnostic CBOR-LD compression transform map(s):");
55301
+ diagnose(inspect4(transformMaps, { depth: null, colors: true }));
55302
+ }
55303
+ return encode8(transformMaps, { typeEncoders: typeEncoders2 });
55304
+ });
55305
+ }
55306
+ _createTransformMaps(_0) {
55307
+ return __async(this, arguments, function* ({ jsonldDocument }) {
55308
+ this.contextMap = /* @__PURE__ */ new Map();
55309
+ this.termToId = new Map(KEYWORDS);
55310
+ this.nextTermId = FIRST_CUSTOM_TERM_ID;
55311
+ const transformMaps = [];
55312
+ const isArray2 = Array.isArray(jsonldDocument);
55313
+ const docs = isArray2 ? jsonldDocument : [jsonldDocument];
55314
+ for (const obj of docs) {
55315
+ const transformMap = /* @__PURE__ */ new Map();
55316
+ yield this._transform({ obj, transformMap });
55317
+ transformMaps.push(transformMap);
55318
+ }
55319
+ return isArray2 ? transformMaps : transformMaps[0];
55320
+ });
55321
+ }
55322
+ _afterObjectContexts({ obj, transformMap }) {
55323
+ const context2 = obj["@context"];
55324
+ if (!context2) {
55325
+ return;
55326
+ }
55327
+ const entries = [];
55328
+ const isArray2 = Array.isArray(context2);
55329
+ const contexts = isArray2 ? context2 : [context2];
55330
+ for (const value of contexts) {
55331
+ const encoder = ContextEncoder.createEncoder({ value, transformer: this });
55332
+ entries.push(encoder || value);
55333
+ }
55334
+ const id = isArray2 ? CONTEXT_TERM_ID_PLURAL2 : CONTEXT_TERM_ID2;
55335
+ transformMap.set(id, isArray2 ? entries : entries[0]);
55336
+ }
55337
+ _getEntries({ obj, termMap }) {
55338
+ const entries = [];
55339
+ const keys = Object.keys(obj).sort();
55340
+ for (const key2 of keys) {
55341
+ if (key2 === "@context") {
55342
+ continue;
55343
+ }
55344
+ const def = termMap.get(key2);
55345
+ if (def === void 0 && !(key2.startsWith("@") && KEYWORDS.has(key2))) {
55346
+ throw new CborldError("ERR_UNKNOWN_CBORLD_TERM", `Unknown term '${key2}' was detected in the JSON-LD input.`);
55347
+ }
55348
+ const value = obj[key2];
55349
+ const plural = Array.isArray(value);
55350
+ const termId = this._getIdForTerm({ term: key2, plural });
55351
+ entries.push([{ term: key2, termId, plural, def }, value]);
55352
+ }
55353
+ return entries;
55354
+ }
55355
+ _transformObjectId({ transformMap, termInfo, value }) {
55356
+ const { termId } = termInfo;
55357
+ const encoder = UriEncoder.createEncoder({ value, transformer: this, termInfo });
55358
+ transformMap.set(termId, encoder || value);
55359
+ }
55360
+ _transformObjectType({ transformMap, termInfo, value }) {
55361
+ const { termId, plural } = termInfo;
55362
+ const values = plural ? value : [value];
55363
+ const entries = [];
55364
+ for (const value2 of values) {
55365
+ const encoder = VocabTermEncoder.createEncoder({ value: value2, transformer: this, termInfo });
55366
+ entries.push(encoder || value2);
55367
+ }
55368
+ transformMap.set(termId, plural ? entries : entries[0]);
55369
+ }
55370
+ _transformTypedValue({ entries, termType, value, termInfo }) {
55371
+ const EncoderClass = TYPE_ENCODERS.get(termType);
55372
+ const encoder = EncoderClass && EncoderClass.createEncoder({ value, transformer: this, termInfo });
55373
+ if (encoder) {
55374
+ entries.push(encoder);
55375
+ return true;
55376
+ }
55377
+ }
55378
+ _transformArray(_0) {
55379
+ return __async(this, arguments, function* ({ entries, contextStack, value }) {
55380
+ const children = [];
55381
+ for (const obj of value) {
55382
+ const childMap = /* @__PURE__ */ new Map();
55383
+ children.push(childMap);
55384
+ yield this._transform({ obj, transformMap: childMap, contextStack });
55385
+ }
55386
+ entries.push(children);
55387
+ });
55388
+ }
55389
+ _transformObject(_0) {
55390
+ return __async(this, arguments, function* ({ entries, contextStack, value }) {
55391
+ const transformMap = /* @__PURE__ */ new Map();
55392
+ entries.push(transformMap);
55393
+ yield this._transform({ obj: value, transformMap, contextStack });
55394
+ });
55395
+ }
55396
+ _assignEntries({ entries, transformMap, termInfo }) {
55397
+ const { termId, plural } = termInfo;
55398
+ transformMap.set(termId, plural ? entries : entries[0]);
55399
+ }
55400
+ };
55401
+ __name(Compressor, "Compressor");
55402
+
55403
+ // ../../node_modules/.pnpm/@digitalbazaar+cborld@5.0.0/node_modules/@digitalbazaar/cborld/lib/encode.js
55404
+ function encode14() {
55405
+ return __async(this, arguments, function* ({
55406
+ jsonldDocument,
55407
+ documentLoader,
55408
+ appContextMap = /* @__PURE__ */ new Map(),
55409
+ compressionMode = 1,
55410
+ diagnose
55411
+ } = {}) {
55412
+ if (!(compressionMode === 0 || compressionMode === 1)) {
55413
+ throw new TypeError('"compressionMode" must be "0" (no compression) or "1" for compression mode version 1.');
55414
+ }
55415
+ const prefix = new Uint8Array([217, 5, compressionMode]);
55416
+ let suffix;
55417
+ if (compressionMode === 0) {
55418
+ suffix = encode8(jsonldDocument);
55419
+ } else {
55420
+ const compressor = new Compressor({ documentLoader, appContextMap });
55421
+ suffix = yield compressor.compress({ jsonldDocument, diagnose });
55422
+ }
55423
+ const length2 = prefix.length + suffix.length;
55424
+ const bytes = new Uint8Array(length2);
55425
+ bytes.set(prefix);
55426
+ bytes.set(suffix, prefix.length);
55427
+ if (diagnose) {
55428
+ diagnose("Diagnostic CBOR-LD result:");
55429
+ diagnose(inspect4(bytes, { depth: null, colors: true }));
55430
+ }
55431
+ return bytes;
55432
+ });
55433
+ }
55434
+ __name(encode14, "encode");
55435
+
55436
+ // ../../node_modules/.pnpm/to-data-view@2.0.0/node_modules/to-data-view/index.js
55437
+ function toDataView(data) {
55438
+ if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
55439
+ return new DataView(data.buffer, data.byteOffset, data.byteLength);
55440
+ }
55441
+ if (data instanceof ArrayBuffer) {
55442
+ return new DataView(data);
55443
+ }
55444
+ throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
55445
+ }
55446
+ __name(toDataView, "toDataView");
55447
+
55448
+ // ../../node_modules/.pnpm/base32-encode@2.0.0/node_modules/base32-encode/index.js
55449
+ var RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
55450
+ var RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
55451
+ var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
55452
+ function base32Encode(data, variant, options) {
55453
+ options = options || {};
55454
+ let alphabet3, defaultPadding;
55455
+ switch (variant) {
55456
+ case "RFC3548":
55457
+ case "RFC4648":
55458
+ alphabet3 = RFC4648;
55459
+ defaultPadding = true;
55460
+ break;
55461
+ case "RFC4648-HEX":
55462
+ alphabet3 = RFC4648_HEX;
55463
+ defaultPadding = true;
55464
+ break;
55465
+ case "Crockford":
55466
+ alphabet3 = CROCKFORD;
55467
+ defaultPadding = false;
55468
+ break;
55469
+ default:
55470
+ throw new Error("Unknown base32 variant: " + variant);
55471
+ }
55472
+ const padding = options.padding !== void 0 ? options.padding : defaultPadding;
55473
+ const view = toDataView(data);
55474
+ let bits = 0;
55475
+ let value = 0;
55476
+ let output = "";
55477
+ for (let i = 0; i < view.byteLength; i++) {
55478
+ value = value << 8 | view.getUint8(i);
55479
+ bits += 8;
55480
+ while (bits >= 5) {
55481
+ output += alphabet3[value >>> bits - 5 & 31];
55482
+ bits -= 5;
55483
+ }
55484
+ }
55485
+ if (bits > 0) {
55486
+ output += alphabet3[value << 5 - bits & 31];
55487
+ }
55488
+ if (padding) {
55489
+ while (output.length % 8 !== 0) {
55490
+ output += "=";
55491
+ }
55492
+ }
55493
+ return output;
55494
+ }
55495
+ __name(base32Encode, "base32Encode");
55496
+
55497
+ // ../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
55498
+ var import_base32_decode = __toESM(require_base32_decode(), 1);
55499
+
55500
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/Mode.js
55501
+ var Mode;
55502
+ (function(Mode2) {
55503
+ Mode2[Mode2["Terminator"] = 0] = "Terminator";
55504
+ Mode2[Mode2["Numeric"] = 1] = "Numeric";
55505
+ Mode2[Mode2["Alphanumeric"] = 2] = "Alphanumeric";
55506
+ Mode2[Mode2["StructuredAppend"] = 3] = "StructuredAppend";
55507
+ Mode2[Mode2["Byte"] = 4] = "Byte";
55508
+ Mode2[Mode2["Kanji"] = 8] = "Kanji";
55509
+ Mode2[Mode2["ECI"] = 7] = "ECI";
55510
+ })(Mode || (Mode = {}));
55511
+
55512
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRData.js
55513
+ var QRData = /* @__PURE__ */ function() {
55514
+ function QRData2(mode, data) {
55515
+ this.bytes = [];
55516
+ this.mode = mode;
55517
+ this.data = data;
55518
+ }
55519
+ __name(QRData2, "QRData");
55520
+ QRData2.prototype.getLength = function() {
55521
+ return this.bytes.length;
55522
+ };
55523
+ QRData2.prototype.getLengthInBits = function(version12) {
55524
+ var mode = this.mode;
55525
+ var error = new Error("illegal mode: ".concat(mode));
55526
+ if (1 <= version12 && version12 < 10) {
55527
+ switch (mode) {
55528
+ case Mode.Numeric:
55529
+ return 10;
55530
+ case Mode.Alphanumeric:
55531
+ return 9;
55532
+ case Mode.Byte:
55533
+ return 8;
55534
+ case Mode.Kanji:
55535
+ return 8;
55536
+ default:
55537
+ throw error;
55538
+ }
55539
+ } else if (version12 < 27) {
55540
+ switch (mode) {
55541
+ case Mode.Numeric:
55542
+ return 12;
55543
+ case Mode.Alphanumeric:
55544
+ return 11;
55545
+ case Mode.Byte:
55546
+ return 16;
55547
+ case Mode.Kanji:
55548
+ return 10;
55549
+ default:
55550
+ throw error;
55551
+ }
55552
+ } else if (version12 < 41) {
55553
+ switch (mode) {
55554
+ case Mode.Numeric:
55555
+ return 14;
55556
+ case Mode.Alphanumeric:
55557
+ return 13;
55558
+ case Mode.Byte:
55559
+ return 16;
55560
+ case Mode.Kanji:
55561
+ return 12;
55562
+ default:
55563
+ throw error;
55564
+ }
55565
+ } else {
55566
+ throw new Error("illegal version: ".concat(version12));
55567
+ }
55568
+ };
55569
+ return QRData2;
55570
+ }();
55571
+
55572
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/encoding/UTF8.js
55573
+ function encode15(text) {
55574
+ var pos = 0;
55575
+ var length2 = text.length;
55576
+ var bytes = [];
55577
+ for (var i = 0; i < length2; i++) {
55578
+ var code5 = text.charCodeAt(i);
55579
+ if (code5 < 128) {
55580
+ bytes[pos++] = code5;
55581
+ } else if (code5 < 2048) {
55582
+ bytes[pos++] = code5 >> 6 | 192;
55583
+ bytes[pos++] = code5 & 63 | 128;
55584
+ } else if ((code5 & 64512) === 55296 && i + 1 < length2 && (text.charCodeAt(i + 1) & 64512) === 56320) {
55585
+ code5 = 65536 + ((code5 & 1023) << 10) + (text.charCodeAt(++i) & 1023);
55586
+ bytes[pos++] = code5 >> 18 | 240;
55587
+ bytes[pos++] = code5 >> 12 & 63 | 128;
55588
+ bytes[pos++] = code5 >> 6 & 63 | 128;
55589
+ bytes[pos++] = code5 & 63 | 128;
55590
+ } else {
55591
+ bytes[pos++] = code5 >> 12 | 224;
55592
+ bytes[pos++] = code5 >> 6 & 63 | 128;
55593
+ bytes[pos++] = code5 & 63 | 128;
55594
+ }
55595
+ }
55596
+ return bytes;
55597
+ }
55598
+ __name(encode15, "encode");
55599
+
55600
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRByte.js
55601
+ var QRByte = /* @__PURE__ */ function(_super) {
55602
+ __extends2(QRByte2, _super);
55603
+ function QRByte2(data, encode$1) {
55604
+ var _this = _super.call(this, Mode.Byte, data) || this;
55605
+ _this.encoding = -1;
55606
+ if (typeof encode$1 === "function") {
55607
+ var _a = encode$1(data), encoding = _a.encoding, bytes = _a.bytes;
55608
+ _this.bytes = bytes;
55609
+ _this.encoding = encoding;
55610
+ } else {
55611
+ _this.bytes = encode15(data);
55612
+ _this.encoding = 26;
55613
+ }
55614
+ return _this;
55615
+ }
55616
+ __name(QRByte2, "QRByte");
55617
+ QRByte2.prototype.writeTo = function(buffer2) {
55618
+ var bytes = this.bytes;
55619
+ for (var _i = 0, bytes_1 = bytes; _i < bytes_1.length; _i++) {
55620
+ var byte = bytes_1[_i];
55621
+ buffer2.put(byte, 8);
55622
+ }
55623
+ };
55624
+ return QRByte2;
55625
+ }(QRData);
55626
+
55627
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRMath.js
55628
+ var EXP_TABLE = [];
55629
+ var LOG_TABLE = [];
55630
+ for (i = 0; i < 256; i++) {
55631
+ LOG_TABLE[i] = 0;
55632
+ EXP_TABLE[i] = i < 8 ? 1 << i : EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
55633
+ }
55634
+ var i;
55635
+ for (i = 0; i < 255; i++) {
55636
+ LOG_TABLE[EXP_TABLE[i]] = i;
55637
+ }
55638
+ var i;
55639
+ function glog(n) {
55640
+ if (n < 1) {
55641
+ throw new Error("illegal log: ".concat(n));
55642
+ }
55643
+ return LOG_TABLE[n];
55644
+ }
55645
+ __name(glog, "glog");
55646
+ function gexp(n) {
55647
+ while (n < 0) {
55648
+ n += 255;
55649
+ }
55650
+ while (n >= 256) {
55651
+ n -= 255;
55652
+ }
55653
+ return EXP_TABLE[n];
55654
+ }
55655
+ __name(gexp, "gexp");
55656
+
55657
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Polynomial.js
55658
+ var Polynomial = /* @__PURE__ */ function() {
55659
+ function Polynomial2(num, shift) {
55660
+ if (shift === void 0) {
55661
+ shift = 0;
55662
+ }
55663
+ var offset = 0;
55664
+ var length2 = num.length;
55665
+ while (offset < length2 && num[offset] === 0) {
55666
+ offset++;
55667
+ }
55668
+ length2 -= offset;
55669
+ var numbers = [];
55670
+ for (var i = 0; i < length2; i++) {
55671
+ numbers.push(num[offset + i]);
55672
+ }
55673
+ for (var i = 0; i < shift; i++) {
55674
+ numbers.push(0);
55675
+ }
55676
+ this.num = numbers;
55677
+ }
55678
+ __name(Polynomial2, "Polynomial");
55679
+ Polynomial2.prototype.getAt = function(index) {
55680
+ return this.num[index];
55681
+ };
55682
+ Polynomial2.prototype.getLength = function() {
55683
+ return this.num.length;
55684
+ };
55685
+ Polynomial2.prototype.multiply = function(e) {
55686
+ var num = [];
55687
+ var eLength = e.getLength();
55688
+ var tLength = this.getLength();
55689
+ var dLength = tLength + eLength - 1;
55690
+ for (var i = 0; i < dLength; i++) {
55691
+ num.push(0);
55692
+ }
55693
+ for (var i = 0; i < tLength; i++) {
55694
+ for (var j = 0; j < eLength; j++) {
55695
+ num[i + j] ^= gexp(glog(this.getAt(i)) + glog(e.getAt(j)));
55696
+ }
55697
+ }
55698
+ return new Polynomial2(num);
55699
+ };
55700
+ Polynomial2.prototype.mod = function(e) {
55701
+ var eLength = e.getLength();
55702
+ var tLength = this.getLength();
55703
+ if (tLength - eLength < 0) {
55704
+ return this;
55705
+ }
55706
+ var ratio = glog(this.getAt(0)) - glog(e.getAt(0));
55707
+ var num = [];
55708
+ for (var i = 0; i < tLength; i++) {
55709
+ num.push(this.getAt(i));
55710
+ }
55711
+ for (var i = 0; i < eLength; i++) {
55712
+ num[i] ^= gexp(glog(e.getAt(i)) + ratio);
55713
+ }
55714
+ return new Polynomial2(num).mod(e);
55715
+ };
55716
+ return Polynomial2;
55717
+ }();
55718
+
55719
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRUtil.js
55720
+ var N12 = 3;
55721
+ var N22 = 3;
55722
+ var N32 = 40;
55723
+ var N42 = 10;
55724
+ var ALIGNMENT_PATTERN_TABLE = [
55725
+ [],
55726
+ [6, 18],
55727
+ [6, 22],
55728
+ [6, 26],
55729
+ [6, 30],
55730
+ [6, 34],
55731
+ [6, 22, 38],
55732
+ [6, 24, 42],
55733
+ [6, 26, 46],
55734
+ [6, 28, 50],
55735
+ [6, 30, 54],
55736
+ [6, 32, 58],
55737
+ [6, 34, 62],
55738
+ [6, 26, 46, 66],
55739
+ [6, 26, 48, 70],
55740
+ [6, 26, 50, 74],
55741
+ [6, 30, 54, 78],
55742
+ [6, 30, 56, 82],
55743
+ [6, 30, 58, 86],
55744
+ [6, 34, 62, 90],
55745
+ [6, 28, 50, 72, 94],
55746
+ [6, 26, 50, 74, 98],
55747
+ [6, 30, 54, 78, 102],
55748
+ [6, 28, 54, 80, 106],
55749
+ [6, 32, 58, 84, 110],
55750
+ [6, 30, 58, 86, 114],
55751
+ [6, 34, 62, 90, 118],
55752
+ [6, 26, 50, 74, 98, 122],
55753
+ [6, 30, 54, 78, 102, 126],
55754
+ [6, 26, 52, 78, 104, 130],
55755
+ [6, 30, 56, 82, 108, 134],
55756
+ [6, 34, 60, 86, 112, 138],
55757
+ [6, 30, 58, 86, 114, 142],
55758
+ [6, 34, 62, 90, 118, 146],
55759
+ [6, 30, 54, 78, 102, 126, 150],
55760
+ [6, 24, 50, 76, 102, 128, 154],
55761
+ [6, 28, 54, 80, 106, 132, 158],
55762
+ [6, 32, 58, 84, 110, 136, 162],
55763
+ [6, 26, 54, 82, 110, 138, 166],
55764
+ [6, 30, 58, 86, 114, 142, 170]
55765
+ ];
55766
+ var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
55767
+ var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
55768
+ var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
55769
+ function getAlignmentPattern(version12) {
55770
+ return ALIGNMENT_PATTERN_TABLE[version12 - 1];
55771
+ }
55772
+ __name(getAlignmentPattern, "getAlignmentPattern");
55773
+ function getErrorCorrectionPolynomial(errorCorrectionLength) {
55774
+ var e = new Polynomial([1]);
55775
+ for (var i = 0; i < errorCorrectionLength; i++) {
55776
+ e = e.multiply(new Polynomial([1, gexp(i)]));
55777
+ }
55778
+ return e;
55779
+ }
55780
+ __name(getErrorCorrectionPolynomial, "getErrorCorrectionPolynomial");
55781
+ function getBCHDigit(data) {
55782
+ var digit = 0;
55783
+ while (data !== 0) {
55784
+ digit++;
55785
+ data >>>= 1;
55786
+ }
55787
+ return digit;
55788
+ }
55789
+ __name(getBCHDigit, "getBCHDigit");
55790
+ var G18_BCH = getBCHDigit(G18);
55791
+ function getBCHVersion(data) {
55792
+ var offset = data << 12;
55793
+ while (getBCHDigit(offset) - G18_BCH >= 0) {
55794
+ offset ^= G18 << getBCHDigit(offset) - G18_BCH;
55795
+ }
55796
+ return data << 12 | offset;
55797
+ }
55798
+ __name(getBCHVersion, "getBCHVersion");
55799
+ var G15_BCH = getBCHDigit(G15);
55800
+ function getBCHVersionInfo(data) {
55801
+ var offset = data << 10;
55802
+ while (getBCHDigit(offset) - G15_BCH >= 0) {
55803
+ offset ^= G15 << getBCHDigit(offset) - G15_BCH;
55804
+ }
55805
+ return (data << 10 | offset) ^ G15_MASK;
55806
+ }
55807
+ __name(getBCHVersionInfo, "getBCHVersionInfo");
55808
+ function applyMaskPenaltyRule1Internal(qrcode, isHorizontal) {
55809
+ var matrixSize = qrcode.getMatrixSize();
55810
+ var penalty = 0;
55811
+ for (var i = 0; i < matrixSize; i++) {
55812
+ var prevBit = false;
55813
+ var numSameBitCells = 0;
55814
+ for (var j = 0; j < matrixSize; j++) {
55815
+ var bit = isHorizontal ? qrcode.isDark(i, j) : qrcode.isDark(j, i);
55816
+ if (bit === prevBit) {
55817
+ numSameBitCells++;
55818
+ if (numSameBitCells === 5) {
55819
+ penalty += N12;
55820
+ } else if (numSameBitCells > 5) {
55821
+ penalty++;
55822
+ }
55823
+ } else {
55824
+ prevBit = bit;
55825
+ numSameBitCells = 1;
55826
+ }
55827
+ }
55828
+ }
55829
+ return penalty;
55830
+ }
55831
+ __name(applyMaskPenaltyRule1Internal, "applyMaskPenaltyRule1Internal");
55832
+ function applyMaskPenaltyRule1(qrcode) {
55833
+ return applyMaskPenaltyRule1Internal(qrcode, true) + applyMaskPenaltyRule1Internal(qrcode, false);
55834
+ }
55835
+ __name(applyMaskPenaltyRule1, "applyMaskPenaltyRule1");
55836
+ function applyMaskPenaltyRule2(qrcode) {
55837
+ var matrixSize = qrcode.getMatrixSize();
55838
+ var penalty = 0;
55839
+ for (var y = 0; y < matrixSize - 1; y++) {
55840
+ for (var x = 0; x < matrixSize - 1; x++) {
55841
+ var value = qrcode.isDark(y, x);
55842
+ if (value === qrcode.isDark(y, x + 1) && value === qrcode.isDark(y + 1, x) && value === qrcode.isDark(y + 1, x + 1)) {
55843
+ penalty += N22;
55844
+ }
55845
+ }
55846
+ }
55847
+ return penalty;
55848
+ }
55849
+ __name(applyMaskPenaltyRule2, "applyMaskPenaltyRule2");
55850
+ function isFourWhite(qrcode, rangeIndex, from4, to, isHorizontal) {
55851
+ from4 = Math.max(from4, 0);
55852
+ to = Math.min(to, qrcode.getMatrixSize());
55853
+ for (var i = from4; i < to; i++) {
55854
+ var value = isHorizontal ? qrcode.isDark(rangeIndex, i) : qrcode.isDark(i, rangeIndex);
55855
+ if (value) {
55856
+ return false;
55857
+ }
55858
+ }
55859
+ return true;
55860
+ }
55861
+ __name(isFourWhite, "isFourWhite");
55862
+ function applyMaskPenaltyRule3(qrcode) {
55863
+ var matrixSize = qrcode.getMatrixSize();
55864
+ var penalty = 0;
55865
+ for (var y = 0; y < matrixSize; y++) {
55866
+ for (var x = 0; x < matrixSize; x++) {
55867
+ if (x + 6 < matrixSize && qrcode.isDark(y, x) && !qrcode.isDark(y, x + 1) && qrcode.isDark(y, x + 2) && qrcode.isDark(y, x + 3) && qrcode.isDark(y, x + 4) && !qrcode.isDark(y, x + 5) && qrcode.isDark(y, x + 6) && (isFourWhite(qrcode, y, x - 4, x, true) || isFourWhite(qrcode, y, x + 7, x + 11, true))) {
55868
+ penalty += N32;
55869
+ }
55870
+ if (y + 6 < matrixSize && qrcode.isDark(y, x) && !qrcode.isDark(y + 1, x) && qrcode.isDark(y + 2, x) && qrcode.isDark(y + 3, x) && qrcode.isDark(y + 4, x) && !qrcode.isDark(y + 5, x) && qrcode.isDark(y + 6, x) && (isFourWhite(qrcode, x, y - 4, y, false) || isFourWhite(qrcode, x, y + 7, y + 11, false))) {
55871
+ penalty += N32;
55872
+ }
55873
+ }
55874
+ }
55875
+ return penalty;
55876
+ }
55877
+ __name(applyMaskPenaltyRule3, "applyMaskPenaltyRule3");
55878
+ function applyMaskPenaltyRule4(qrcode) {
55879
+ var matrixSize = qrcode.getMatrixSize();
55880
+ var numDarkCells = 0;
55881
+ for (var y = 0; y < matrixSize; y++) {
55882
+ for (var x = 0; x < matrixSize; x++) {
55883
+ if (qrcode.isDark(y, x)) {
55884
+ numDarkCells++;
55885
+ }
55886
+ }
55887
+ }
55888
+ var numTotalCells = matrixSize * matrixSize;
55889
+ var fivePercentVariances = Math.floor(Math.abs(numDarkCells * 20 - numTotalCells * 10) / numTotalCells);
55890
+ return fivePercentVariances * N42;
55891
+ }
55892
+ __name(applyMaskPenaltyRule4, "applyMaskPenaltyRule4");
55893
+ function calculateMaskPenalty(qrcode) {
55894
+ return applyMaskPenaltyRule1(qrcode) + applyMaskPenaltyRule2(qrcode) + applyMaskPenaltyRule3(qrcode) + applyMaskPenaltyRule4(qrcode);
55895
+ }
55896
+ __name(calculateMaskPenalty, "calculateMaskPenalty");
55897
+
55898
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/ErrorCorrectionLevel.js
55899
+ var ErrorCorrectionLevel;
55900
+ (function(ErrorCorrectionLevel2) {
55901
+ ErrorCorrectionLevel2[ErrorCorrectionLevel2["L"] = 1] = "L";
55902
+ ErrorCorrectionLevel2[ErrorCorrectionLevel2["M"] = 0] = "M";
55903
+ ErrorCorrectionLevel2[ErrorCorrectionLevel2["Q"] = 3] = "Q";
55904
+ ErrorCorrectionLevel2[ErrorCorrectionLevel2["H"] = 2] = "H";
55905
+ })(ErrorCorrectionLevel || (ErrorCorrectionLevel = {}));
55906
+
55907
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/RSBlock.js
55908
+ var RSBlock = /* @__PURE__ */ function() {
55909
+ function RSBlock2(totalCount, dataCount) {
55910
+ this.dataCount = dataCount;
55911
+ this.totalCount = totalCount;
55912
+ }
55913
+ __name(RSBlock2, "RSBlock");
55914
+ RSBlock2.prototype.getDataCount = function() {
55915
+ return this.dataCount;
55916
+ };
55917
+ RSBlock2.prototype.getTotalCount = function() {
55918
+ return this.totalCount;
55919
+ };
55920
+ RSBlock2.getRSBlocks = function(version12, errorCorrectionLevel) {
55921
+ var rsBlocks = [];
55922
+ var rsBlock = RSBlock2.getRSBlockTable(version12, errorCorrectionLevel);
55923
+ var length2 = rsBlock.length / 3;
55924
+ for (var i = 0; i < length2; i++) {
55925
+ var count = rsBlock[i * 3 + 0];
55926
+ var totalCount = rsBlock[i * 3 + 1];
55927
+ var dataCount = rsBlock[i * 3 + 2];
55928
+ for (var j = 0; j < count; j++) {
55929
+ rsBlocks.push(new RSBlock2(totalCount, dataCount));
55930
+ }
55931
+ }
55932
+ return rsBlocks;
55933
+ };
55934
+ RSBlock2.getRSBlockTable = function(version12, errorCorrectionLevel) {
55935
+ switch (errorCorrectionLevel) {
55936
+ case ErrorCorrectionLevel.L:
55937
+ return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 0];
55938
+ case ErrorCorrectionLevel.M:
55939
+ return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 1];
55940
+ case ErrorCorrectionLevel.Q:
55941
+ return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 2];
55942
+ case ErrorCorrectionLevel.H:
55943
+ return RSBlock2.RS_BLOCK_TABLE[(version12 - 1) * 4 + 3];
55944
+ default:
55945
+ throw new Error("illegal error correction level: ".concat(errorCorrectionLevel));
55946
+ }
55947
+ };
55948
+ RSBlock2.RS_BLOCK_TABLE = [
55949
+ [1, 26, 19],
55950
+ [1, 26, 16],
55951
+ [1, 26, 13],
55952
+ [1, 26, 9],
55953
+ [1, 44, 34],
55954
+ [1, 44, 28],
55955
+ [1, 44, 22],
55956
+ [1, 44, 16],
55957
+ [1, 70, 55],
55958
+ [1, 70, 44],
55959
+ [2, 35, 17],
55960
+ [2, 35, 13],
55961
+ [1, 100, 80],
55962
+ [2, 50, 32],
55963
+ [2, 50, 24],
55964
+ [4, 25, 9],
55965
+ [1, 134, 108],
55966
+ [2, 67, 43],
55967
+ [2, 33, 15, 2, 34, 16],
55968
+ [2, 33, 11, 2, 34, 12],
55969
+ [2, 86, 68],
55970
+ [4, 43, 27],
55971
+ [4, 43, 19],
55972
+ [4, 43, 15],
55973
+ [2, 98, 78],
55974
+ [4, 49, 31],
55975
+ [2, 32, 14, 4, 33, 15],
55976
+ [4, 39, 13, 1, 40, 14],
55977
+ [2, 121, 97],
55978
+ [2, 60, 38, 2, 61, 39],
55979
+ [4, 40, 18, 2, 41, 19],
55980
+ [4, 40, 14, 2, 41, 15],
55981
+ [2, 146, 116],
55982
+ [3, 58, 36, 2, 59, 37],
55983
+ [4, 36, 16, 4, 37, 17],
55984
+ [4, 36, 12, 4, 37, 13],
55985
+ [2, 86, 68, 2, 87, 69],
55986
+ [4, 69, 43, 1, 70, 44],
55987
+ [6, 43, 19, 2, 44, 20],
55988
+ [6, 43, 15, 2, 44, 16],
55989
+ [4, 101, 81],
55990
+ [1, 80, 50, 4, 81, 51],
55991
+ [4, 50, 22, 4, 51, 23],
55992
+ [3, 36, 12, 8, 37, 13],
55993
+ [2, 116, 92, 2, 117, 93],
55994
+ [6, 58, 36, 2, 59, 37],
55995
+ [4, 46, 20, 6, 47, 21],
55996
+ [7, 42, 14, 4, 43, 15],
55997
+ [4, 133, 107],
55998
+ [8, 59, 37, 1, 60, 38],
55999
+ [8, 44, 20, 4, 45, 21],
56000
+ [12, 33, 11, 4, 34, 12],
56001
+ [3, 145, 115, 1, 146, 116],
56002
+ [4, 64, 40, 5, 65, 41],
56003
+ [11, 36, 16, 5, 37, 17],
56004
+ [11, 36, 12, 5, 37, 13],
56005
+ [5, 109, 87, 1, 110, 88],
56006
+ [5, 65, 41, 5, 66, 42],
56007
+ [5, 54, 24, 7, 55, 25],
56008
+ [11, 36, 12, 7, 37, 13],
56009
+ [5, 122, 98, 1, 123, 99],
56010
+ [7, 73, 45, 3, 74, 46],
56011
+ [15, 43, 19, 2, 44, 20],
56012
+ [3, 45, 15, 13, 46, 16],
56013
+ [1, 135, 107, 5, 136, 108],
56014
+ [10, 74, 46, 1, 75, 47],
56015
+ [1, 50, 22, 15, 51, 23],
56016
+ [2, 42, 14, 17, 43, 15],
56017
+ [5, 150, 120, 1, 151, 121],
56018
+ [9, 69, 43, 4, 70, 44],
56019
+ [17, 50, 22, 1, 51, 23],
56020
+ [2, 42, 14, 19, 43, 15],
56021
+ [3, 141, 113, 4, 142, 114],
56022
+ [3, 70, 44, 11, 71, 45],
56023
+ [17, 47, 21, 4, 48, 22],
56024
+ [9, 39, 13, 16, 40, 14],
56025
+ [3, 135, 107, 5, 136, 108],
56026
+ [3, 67, 41, 13, 68, 42],
56027
+ [15, 54, 24, 5, 55, 25],
56028
+ [15, 43, 15, 10, 44, 16],
56029
+ [4, 144, 116, 4, 145, 117],
56030
+ [17, 68, 42],
56031
+ [17, 50, 22, 6, 51, 23],
56032
+ [19, 46, 16, 6, 47, 17],
56033
+ [2, 139, 111, 7, 140, 112],
56034
+ [17, 74, 46],
56035
+ [7, 54, 24, 16, 55, 25],
56036
+ [34, 37, 13],
56037
+ [4, 151, 121, 5, 152, 122],
56038
+ [4, 75, 47, 14, 76, 48],
56039
+ [11, 54, 24, 14, 55, 25],
56040
+ [16, 45, 15, 14, 46, 16],
56041
+ [6, 147, 117, 4, 148, 118],
56042
+ [6, 73, 45, 14, 74, 46],
56043
+ [11, 54, 24, 16, 55, 25],
56044
+ [30, 46, 16, 2, 47, 17],
56045
+ [8, 132, 106, 4, 133, 107],
56046
+ [8, 75, 47, 13, 76, 48],
56047
+ [7, 54, 24, 22, 55, 25],
56048
+ [22, 45, 15, 13, 46, 16],
56049
+ [10, 142, 114, 2, 143, 115],
56050
+ [19, 74, 46, 4, 75, 47],
56051
+ [28, 50, 22, 6, 51, 23],
56052
+ [33, 46, 16, 4, 47, 17],
56053
+ [8, 152, 122, 4, 153, 123],
56054
+ [22, 73, 45, 3, 74, 46],
56055
+ [8, 53, 23, 26, 54, 24],
56056
+ [12, 45, 15, 28, 46, 16],
56057
+ [3, 147, 117, 10, 148, 118],
56058
+ [3, 73, 45, 23, 74, 46],
56059
+ [4, 54, 24, 31, 55, 25],
56060
+ [11, 45, 15, 31, 46, 16],
56061
+ [7, 146, 116, 7, 147, 117],
56062
+ [21, 73, 45, 7, 74, 46],
56063
+ [1, 53, 23, 37, 54, 24],
56064
+ [19, 45, 15, 26, 46, 16],
56065
+ [5, 145, 115, 10, 146, 116],
56066
+ [19, 75, 47, 10, 76, 48],
56067
+ [15, 54, 24, 25, 55, 25],
56068
+ [23, 45, 15, 25, 46, 16],
56069
+ [13, 145, 115, 3, 146, 116],
56070
+ [2, 74, 46, 29, 75, 47],
56071
+ [42, 54, 24, 1, 55, 25],
56072
+ [23, 45, 15, 28, 46, 16],
56073
+ [17, 145, 115],
56074
+ [10, 74, 46, 23, 75, 47],
56075
+ [10, 54, 24, 35, 55, 25],
56076
+ [19, 45, 15, 35, 46, 16],
56077
+ [17, 145, 115, 1, 146, 116],
56078
+ [14, 74, 46, 21, 75, 47],
56079
+ [29, 54, 24, 19, 55, 25],
56080
+ [11, 45, 15, 46, 46, 16],
56081
+ [13, 145, 115, 6, 146, 116],
56082
+ [14, 74, 46, 23, 75, 47],
56083
+ [44, 54, 24, 7, 55, 25],
56084
+ [59, 46, 16, 1, 47, 17],
56085
+ [12, 151, 121, 7, 152, 122],
56086
+ [12, 75, 47, 26, 76, 48],
56087
+ [39, 54, 24, 14, 55, 25],
56088
+ [22, 45, 15, 41, 46, 16],
56089
+ [6, 151, 121, 14, 152, 122],
56090
+ [6, 75, 47, 34, 76, 48],
56091
+ [46, 54, 24, 10, 55, 25],
56092
+ [2, 45, 15, 64, 46, 16],
56093
+ [17, 152, 122, 4, 153, 123],
56094
+ [29, 74, 46, 14, 75, 47],
56095
+ [49, 54, 24, 10, 55, 25],
56096
+ [24, 45, 15, 46, 46, 16],
56097
+ [4, 152, 122, 18, 153, 123],
56098
+ [13, 74, 46, 32, 75, 47],
56099
+ [48, 54, 24, 14, 55, 25],
56100
+ [42, 45, 15, 32, 46, 16],
56101
+ [20, 147, 117, 4, 148, 118],
56102
+ [40, 75, 47, 7, 76, 48],
56103
+ [43, 54, 24, 22, 55, 25],
56104
+ [10, 45, 15, 67, 46, 16],
56105
+ [19, 148, 118, 6, 149, 119],
56106
+ [18, 75, 47, 31, 76, 48],
56107
+ [34, 54, 24, 34, 55, 25],
56108
+ [20, 45, 15, 61, 46, 16]
56109
+ ];
56110
+ return RSBlock2;
56111
+ }();
56112
+
56113
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/BitBuffer.js
56114
+ var BitBuffer = /* @__PURE__ */ function() {
56115
+ function BitBuffer2() {
56116
+ this.length = 0;
56117
+ this.buffer = [];
56118
+ }
56119
+ __name(BitBuffer2, "BitBuffer");
56120
+ BitBuffer2.prototype.getBuffer = function() {
56121
+ return this.buffer;
56122
+ };
56123
+ BitBuffer2.prototype.getLengthInBits = function() {
56124
+ return this.length;
56125
+ };
56126
+ BitBuffer2.prototype.getBit = function(index) {
56127
+ return (this.buffer[index / 8 >> 0] >>> 7 - index % 8 & 1) === 1;
56128
+ };
56129
+ BitBuffer2.prototype.put = function(num, length2) {
56130
+ for (var i = 0; i < length2; i++) {
56131
+ this.putBit((num >>> length2 - i - 1 & 1) === 1);
56132
+ }
56133
+ };
56134
+ BitBuffer2.prototype.putBit = function(bit) {
56135
+ var buffer2 = this.buffer;
56136
+ if (this.length === buffer2.length * 8) {
56137
+ buffer2.push(0);
56138
+ }
56139
+ if (bit) {
56140
+ buffer2[this.length / 8 >> 0] |= 128 >>> this.length % 8;
56141
+ }
56142
+ this.length++;
56143
+ };
56144
+ return BitBuffer2;
56145
+ }();
56146
+
56147
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/OutputStream.js
56148
+ var OutputStream = /* @__PURE__ */ function() {
56149
+ function OutputStream2() {
56150
+ }
56151
+ __name(OutputStream2, "OutputStream");
56152
+ OutputStream2.prototype.writeBytes = function(bytes, offset, length2) {
56153
+ if (offset === void 0) {
56154
+ offset = 0;
56155
+ }
56156
+ if (length2 === void 0) {
56157
+ length2 = bytes.length;
56158
+ }
56159
+ for (var i = 0; i < length2; i++) {
56160
+ this.writeByte(bytes[i + offset]);
56161
+ }
56162
+ };
56163
+ OutputStream2.prototype.flush = function() {
56164
+ };
56165
+ OutputStream2.prototype.close = function() {
56166
+ this.flush();
56167
+ };
56168
+ return OutputStream2;
56169
+ }();
56170
+
56171
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/ByteArrayOutputStream.js
56172
+ var ByteArrayOutputStream = /* @__PURE__ */ function(_super) {
56173
+ __extends2(ByteArrayOutputStream2, _super);
56174
+ function ByteArrayOutputStream2() {
56175
+ var _this = _super !== null && _super.apply(this, arguments) || this;
56176
+ _this.bytes = [];
56177
+ return _this;
56178
+ }
56179
+ __name(ByteArrayOutputStream2, "ByteArrayOutputStream");
56180
+ ByteArrayOutputStream2.prototype.writeByte = function(byte) {
56181
+ this.bytes.push(byte);
56182
+ };
56183
+ ByteArrayOutputStream2.prototype.writeInt16 = function(byte) {
56184
+ this.bytes.push(byte, byte >>> 8);
56185
+ };
56186
+ ByteArrayOutputStream2.prototype.toByteArray = function() {
56187
+ return this.bytes;
56188
+ };
56189
+ return ByteArrayOutputStream2;
56190
+ }(OutputStream);
56191
+
56192
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/io/Base64EncodeOutputStream.js
56193
+ function encode16(ch) {
56194
+ if (ch >= 0) {
56195
+ if (ch < 26) {
56196
+ return 65 + ch;
56197
+ } else if (ch < 52) {
56198
+ return 97 + (ch - 26);
56199
+ } else if (ch < 62) {
56200
+ return 48 + (ch - 52);
56201
+ } else if (ch === 62) {
56202
+ return 43;
56203
+ } else if (ch === 63) {
56204
+ return 47;
56205
+ }
56206
+ }
56207
+ throw new Error("illegal char: ".concat(String.fromCharCode(ch)));
56208
+ }
56209
+ __name(encode16, "encode");
56210
+ var Base64EncodeOutputStream = /* @__PURE__ */ function(_super) {
56211
+ __extends2(Base64EncodeOutputStream2, _super);
56212
+ function Base64EncodeOutputStream2(stream) {
56213
+ var _this = _super.call(this) || this;
56214
+ _this.buffer = 0;
56215
+ _this.length = 0;
56216
+ _this.bufLength = 0;
56217
+ _this.stream = stream;
56218
+ return _this;
56219
+ }
56220
+ __name(Base64EncodeOutputStream2, "Base64EncodeOutputStream");
56221
+ Base64EncodeOutputStream2.prototype.writeByte = function(byte) {
56222
+ this.buffer = this.buffer << 8 | byte & 255;
56223
+ this.bufLength += 8;
56224
+ this.length++;
56225
+ while (this.bufLength >= 6) {
56226
+ this.writeEncoded(this.buffer >>> this.bufLength - 6);
56227
+ this.bufLength -= 6;
56228
+ }
56229
+ };
56230
+ Base64EncodeOutputStream2.prototype.flush = function() {
56231
+ if (this.bufLength > 0) {
56232
+ this.writeEncoded(this.buffer << 6 - this.bufLength);
56233
+ this.buffer = 0;
56234
+ this.bufLength = 0;
56235
+ }
56236
+ var stream = this.stream;
56237
+ if (this.length % 3 != 0) {
56238
+ var pad2 = 3 - this.length % 3;
56239
+ for (var i = 0; i < pad2; i++) {
56240
+ stream.writeByte(61);
56241
+ }
56242
+ }
56243
+ };
56244
+ Base64EncodeOutputStream2.prototype.writeEncoded = function(byte) {
56245
+ this.stream.writeByte(encode16(byte & 63));
56246
+ };
56247
+ return Base64EncodeOutputStream2;
56248
+ }(OutputStream);
56249
+
56250
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/image/GIFImage.js
56251
+ function encodeToBase64(data) {
56252
+ var output = new ByteArrayOutputStream();
56253
+ var stream = new Base64EncodeOutputStream(output);
56254
+ stream.writeBytes(data);
56255
+ stream.close();
56256
+ output.close();
56257
+ return output.toByteArray();
56258
+ }
56259
+ __name(encodeToBase64, "encodeToBase64");
56260
+ var LZWTable = /* @__PURE__ */ function() {
56261
+ function LZWTable2() {
56262
+ this.size = 0;
56263
+ this.map = {};
56264
+ }
56265
+ __name(LZWTable2, "LZWTable");
56266
+ LZWTable2.prototype.add = function(key2) {
56267
+ if (!this.contains(key2)) {
56268
+ this.map[key2] = this.size++;
56269
+ }
56270
+ };
56271
+ LZWTable2.prototype.getSize = function() {
56272
+ return this.size;
56273
+ };
56274
+ LZWTable2.prototype.indexOf = function(key2) {
56275
+ return this.map[key2];
56276
+ };
56277
+ LZWTable2.prototype.contains = function(key2) {
56278
+ return this.map[key2] >= 0;
56279
+ };
56280
+ return LZWTable2;
56281
+ }();
56282
+ var BitOutputStream = /* @__PURE__ */ function() {
56283
+ function BitOutputStream2(output) {
56284
+ this.output = output;
56285
+ this.bitLength = 0;
56286
+ this.bitBuffer = 0;
56287
+ }
56288
+ __name(BitOutputStream2, "BitOutputStream");
56289
+ BitOutputStream2.prototype.write = function(data, length2) {
56290
+ if (data >>> length2 !== 0) {
56291
+ throw new Error("length overflow");
56292
+ }
56293
+ var output = this.output;
56294
+ while (this.bitLength + length2 >= 8) {
56295
+ output.writeByte(255 & (data << this.bitLength | this.bitBuffer));
56296
+ length2 -= 8 - this.bitLength;
56297
+ data >>>= 8 - this.bitLength;
56298
+ this.bitBuffer = 0;
56299
+ this.bitLength = 0;
56300
+ }
56301
+ this.bitBuffer = data << this.bitLength | this.bitBuffer;
56302
+ this.bitLength = this.bitLength + length2;
56303
+ };
56304
+ BitOutputStream2.prototype.flush = function() {
56305
+ var output = this.output;
56306
+ if (this.bitLength > 0) {
56307
+ output.writeByte(this.bitBuffer);
56308
+ }
56309
+ output.flush();
56310
+ };
56311
+ BitOutputStream2.prototype.close = function() {
56312
+ this.flush();
56313
+ this.output.close();
56314
+ };
56315
+ return BitOutputStream2;
56316
+ }();
56317
+ var GIFImage = /* @__PURE__ */ function() {
56318
+ function GIFImage2(width, height) {
56319
+ this.data = [];
56320
+ this.width = width;
56321
+ this.height = height;
56322
+ var size = width * height;
56323
+ for (var i = 0; i < size; i++) {
56324
+ this.data[i] = 0;
56325
+ }
56326
+ }
56327
+ __name(GIFImage2, "GIFImage");
56328
+ GIFImage2.prototype.getLZWRaster = function(lzwMinCodeSize) {
56329
+ var table = new LZWTable();
56330
+ var fromCharCode = String.fromCharCode;
56331
+ var clearCode = 1 << lzwMinCodeSize;
56332
+ var endCode = (1 << lzwMinCodeSize) + 1;
56333
+ for (var i = 0; i < clearCode; i++) {
56334
+ table.add(fromCharCode(i));
56335
+ }
56336
+ table.add(fromCharCode(clearCode));
56337
+ table.add(fromCharCode(endCode));
56338
+ var bitLength = lzwMinCodeSize + 1;
56339
+ var byteOutput = new ByteArrayOutputStream();
56340
+ var bitOutput = new BitOutputStream(byteOutput);
56341
+ try {
56342
+ var data = this.data;
56343
+ var length_1 = data.length;
56344
+ var fromCharCode_1 = String.fromCharCode;
56345
+ bitOutput.write(clearCode, bitLength);
56346
+ var dataIndex = 0;
56347
+ var words = fromCharCode_1(data[dataIndex++]);
56348
+ while (dataIndex < length_1) {
56349
+ var char = fromCharCode_1(data[dataIndex++]);
56350
+ if (table.contains(words + char)) {
56351
+ words += char;
56352
+ } else {
56353
+ bitOutput.write(table.indexOf(words), bitLength);
56354
+ if (table.getSize() < 4095) {
56355
+ if (table.getSize() === 1 << bitLength) {
56356
+ bitLength++;
56357
+ }
56358
+ table.add(words + char);
56359
+ }
56360
+ words = char;
56361
+ }
56362
+ }
56363
+ bitOutput.write(table.indexOf(words), bitLength);
56364
+ bitOutput.write(endCode, bitLength);
56365
+ } finally {
56366
+ bitOutput.close();
56367
+ }
56368
+ return byteOutput.toByteArray();
56369
+ };
56370
+ GIFImage2.prototype.setPixel = function(x, y, pixel) {
56371
+ var _a = this, width = _a.width, height = _a.height;
56372
+ if (x < 0 || width <= x)
56373
+ throw new Error("illegal x axis: ".concat(x));
56374
+ if (y < 0 || height <= y)
56375
+ throw new Error("illegal y axis: ".concat(y));
56376
+ this.data[y * width + x] = pixel;
56377
+ };
56378
+ GIFImage2.prototype.getPixel = function(x, y) {
56379
+ var _a = this, width = _a.width, height = _a.height;
56380
+ if (x < 0 || width <= x)
56381
+ throw new Error("illegal x axis: ".concat(x));
56382
+ if (y < 0 || height <= y)
56383
+ throw new Error("illegal y axis: ".concat(y));
56384
+ return this.data[y * width + x];
56385
+ };
56386
+ GIFImage2.prototype.write = function(output) {
56387
+ var _a = this, width = _a.width, height = _a.height;
56388
+ output.writeByte(71);
56389
+ output.writeByte(73);
56390
+ output.writeByte(70);
56391
+ output.writeByte(56);
56392
+ output.writeByte(55);
56393
+ output.writeByte(97);
56394
+ output.writeInt16(width);
56395
+ output.writeInt16(height);
56396
+ output.writeByte(128);
56397
+ output.writeByte(0);
56398
+ output.writeByte(0);
56399
+ output.writeByte(0);
56400
+ output.writeByte(0);
56401
+ output.writeByte(0);
56402
+ output.writeByte(255);
56403
+ output.writeByte(255);
56404
+ output.writeByte(255);
56405
+ output.writeByte(44);
56406
+ output.writeInt16(0);
56407
+ output.writeInt16(0);
56408
+ output.writeInt16(width);
56409
+ output.writeInt16(height);
56410
+ output.writeByte(0);
56411
+ var lzwMinCodeSize = 2;
56412
+ var raster = this.getLZWRaster(lzwMinCodeSize);
56413
+ var raLength = raster.length;
56414
+ output.writeByte(lzwMinCodeSize);
56415
+ var offset = 0;
56416
+ while (raLength - offset > 255) {
56417
+ output.writeByte(255);
56418
+ output.writeBytes(raster, offset, 255);
56419
+ offset += 255;
56420
+ }
56421
+ var length2 = raLength - offset;
56422
+ output.writeByte(length2);
56423
+ output.writeBytes(raster, offset, length2);
56424
+ output.writeByte(0);
56425
+ output.writeByte(59);
56426
+ };
56427
+ GIFImage2.prototype.toDataURL = function() {
56428
+ var output = new ByteArrayOutputStream();
56429
+ this.write(output);
56430
+ var bytes = encodeToBase64(output.toByteArray());
56431
+ output.close();
56432
+ var length2 = bytes.length;
56433
+ var fromCharCode = String.fromCharCode;
56434
+ var url = "data:image/gif;base64,";
56435
+ for (var i = 0; i < length2; i++) {
56436
+ url += fromCharCode(bytes[i]);
56437
+ }
56438
+ return url;
56439
+ };
56440
+ return GIFImage2;
56441
+ }();
56442
+
56443
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/common/MaskPattern.js
56444
+ function getMaskFunc(maskPattern) {
56445
+ switch (maskPattern) {
56446
+ case 0:
56447
+ return function(x, y) {
56448
+ return (x + y & 1) === 0;
56449
+ };
56450
+ case 1:
56451
+ return function(_x, y) {
56452
+ return (y & 1) === 0;
56453
+ };
56454
+ case 2:
56455
+ return function(x, _y) {
56456
+ return x % 3 === 0;
56457
+ };
56458
+ case 3:
56459
+ return function(x, y) {
56460
+ return (x + y) % 3 === 0;
56461
+ };
56462
+ case 4:
56463
+ return function(x, y) {
56464
+ return ((x / 3 >> 0) + (y / 2 >> 0) & 1) === 0;
56465
+ };
56466
+ case 5:
56467
+ return function(x, y) {
56468
+ return (x * y & 1) + x * y % 3 === 0;
56469
+ };
56470
+ case 6:
56471
+ return function(x, y) {
56472
+ return ((x * y & 1) + x * y % 3 & 1) === 0;
56473
+ };
56474
+ case 7:
56475
+ return function(x, y) {
56476
+ return (x * y % 3 + (x + y & 1) & 1) === 0;
56477
+ };
56478
+ default:
56479
+ throw new Error("illegal mask: ".concat(maskPattern));
56480
+ }
56481
+ }
56482
+ __name(getMaskFunc, "getMaskFunc");
56483
+
56484
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/Writer.js
56485
+ var PAD0 = 236;
56486
+ var PAD1 = 17;
56487
+ var toString5 = Object.prototype.toString;
56488
+ function appendECI(encoding, buffer2) {
56489
+ if (encoding < 0 || encoding >= 1e6) {
56490
+ throw new Error("byte mode encoding hint out of range");
56491
+ }
56492
+ buffer2.put(Mode.ECI, 4);
56493
+ if (encoding < 1 << 7) {
56494
+ buffer2.put(encoding, 8);
56495
+ } else if (encoding < 1 << 14) {
56496
+ buffer2.put(2, 2);
56497
+ buffer2.put(encoding, 14);
56498
+ } else {
56499
+ buffer2.put(6, 3);
56500
+ buffer2.put(encoding, 21);
56501
+ }
56502
+ }
56503
+ __name(appendECI, "appendECI");
56504
+ function prepareData(version12, errorCorrectionLevel, encodingHint, chunks) {
56505
+ var buffer2 = new BitBuffer();
56506
+ var rsBlocks = RSBlock.getRSBlocks(version12, errorCorrectionLevel);
56507
+ for (var _i = 0, chunks_1 = chunks; _i < chunks_1.length; _i++) {
56508
+ var data = chunks_1[_i];
56509
+ var mode = data.mode;
56510
+ if (encodingHint && mode === Mode.Byte) {
56511
+ appendECI(data.encoding, buffer2);
56512
+ }
56513
+ buffer2.put(mode, 4);
56514
+ buffer2.put(data.getLength(), data.getLengthInBits(version12));
56515
+ data.writeTo(buffer2);
56516
+ }
56517
+ var maxDataCount = 0;
56518
+ for (var _a = 0, rsBlocks_1 = rsBlocks; _a < rsBlocks_1.length; _a++) {
56519
+ var rsBlock = rsBlocks_1[_a];
56520
+ maxDataCount += rsBlock.getDataCount();
56521
+ }
56522
+ maxDataCount *= 8;
56523
+ return [buffer2, rsBlocks, maxDataCount];
56524
+ }
56525
+ __name(prepareData, "prepareData");
56526
+ function createBytes(buffer2, rsBlocks) {
56527
+ var offset = 0;
56528
+ var maxDcCount = 0;
56529
+ var maxEcCount = 0;
56530
+ var dcData = [];
56531
+ var ecData = [];
56532
+ var rsLength = rsBlocks.length;
56533
+ var bufferData = buffer2.getBuffer();
56534
+ for (var r = 0; r < rsLength; r++) {
56535
+ var rsBlock = rsBlocks[r];
56536
+ var dcCount = rsBlock.getDataCount();
56537
+ var ecCount = rsBlock.getTotalCount() - dcCount;
56538
+ maxDcCount = Math.max(maxDcCount, dcCount);
56539
+ maxEcCount = Math.max(maxEcCount, ecCount);
56540
+ dcData[r] = [];
56541
+ for (var i = 0; i < dcCount; i++) {
56542
+ dcData[r][i] = 255 & bufferData[i + offset];
56543
+ }
56544
+ offset += dcCount;
56545
+ var rsPoly = getErrorCorrectionPolynomial(ecCount);
56546
+ var ecLength = rsPoly.getLength() - 1;
56547
+ var rawPoly = new Polynomial(dcData[r], ecLength);
56548
+ var modPoly = rawPoly.mod(rsPoly);
56549
+ var mpLength = modPoly.getLength();
56550
+ ecData[r] = [];
56551
+ for (var i = 0; i < ecLength; i++) {
56552
+ var modIndex = i + mpLength - ecLength;
56553
+ ecData[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
56554
+ }
56555
+ }
56556
+ buffer2 = new BitBuffer();
56557
+ for (var i = 0; i < maxDcCount; i++) {
56558
+ for (var r = 0; r < rsLength; r++) {
56559
+ if (i < dcData[r].length) {
56560
+ buffer2.put(dcData[r][i], 8);
56561
+ }
56562
+ }
56563
+ }
56564
+ for (var i = 0; i < maxEcCount; i++) {
56565
+ for (var r = 0; r < rsLength; r++) {
56566
+ if (i < ecData[r].length) {
56567
+ buffer2.put(ecData[r][i], 8);
56568
+ }
56569
+ }
56570
+ }
56571
+ return buffer2;
56572
+ }
56573
+ __name(createBytes, "createBytes");
56574
+ function createData(buffer2, rsBlocks, maxDataCount) {
56575
+ if (buffer2.getLengthInBits() + 4 <= maxDataCount) {
56576
+ buffer2.put(0, 4);
56577
+ }
56578
+ while (buffer2.getLengthInBits() % 8 !== 0) {
56579
+ buffer2.putBit(false);
56580
+ }
56581
+ while (true) {
56582
+ if (buffer2.getLengthInBits() >= maxDataCount) {
56583
+ break;
56584
+ }
56585
+ buffer2.put(PAD0, 8);
56586
+ if (buffer2.getLengthInBits() >= maxDataCount) {
56587
+ break;
56588
+ }
56589
+ buffer2.put(PAD1, 8);
56590
+ }
56591
+ return createBytes(buffer2, rsBlocks);
56592
+ }
56593
+ __name(createData, "createData");
56594
+ var Encoder2 = /* @__PURE__ */ function() {
56595
+ function Encoder3(options) {
56596
+ if (options === void 0) {
56597
+ options = {};
56598
+ }
56599
+ this.matrixSize = 0;
56600
+ this.chunks = [];
56601
+ this.matrix = [];
56602
+ var _a = options.version, version12 = _a === void 0 ? 0 : _a, _b = options.encodingHint, encodingHint = _b === void 0 ? false : _b, _c = options.errorCorrectionLevel, errorCorrectionLevel = _c === void 0 ? ErrorCorrectionLevel.L : _c;
56603
+ this.setVersion(version12);
56604
+ this.setEncodingHint(encodingHint);
56605
+ this.setErrorCorrectionLevel(errorCorrectionLevel);
56606
+ }
56607
+ __name(Encoder3, "Encoder");
56608
+ Encoder3.prototype.getMatrix = function() {
56609
+ return this.matrix;
56610
+ };
56611
+ Encoder3.prototype.getMatrixSize = function() {
56612
+ return this.matrixSize;
56613
+ };
56614
+ Encoder3.prototype.getVersion = function() {
56615
+ return this.version;
56616
+ };
56617
+ Encoder3.prototype.setVersion = function(version12) {
56618
+ this.version = Math.min(40, Math.max(0, version12 >> 0));
56619
+ this.auto = this.version === 0;
56620
+ return this;
56621
+ };
56622
+ Encoder3.prototype.getErrorCorrectionLevel = function() {
56623
+ return this.errorCorrectionLevel;
56624
+ };
56625
+ Encoder3.prototype.setErrorCorrectionLevel = function(errorCorrectionLevel) {
56626
+ switch (errorCorrectionLevel) {
56627
+ case ErrorCorrectionLevel.L:
56628
+ case ErrorCorrectionLevel.M:
56629
+ case ErrorCorrectionLevel.Q:
56630
+ case ErrorCorrectionLevel.H:
56631
+ this.errorCorrectionLevel = errorCorrectionLevel;
56632
+ }
56633
+ return this;
56634
+ };
56635
+ Encoder3.prototype.getEncodingHint = function() {
56636
+ return this.encodingHint;
56637
+ };
56638
+ Encoder3.prototype.setEncodingHint = function(encodingHint) {
56639
+ this.encodingHint = encodingHint;
56640
+ return this;
56641
+ };
56642
+ Encoder3.prototype.write = function(data) {
56643
+ var chunks = this.chunks;
56644
+ if (data instanceof QRData) {
56645
+ chunks.push(data);
56646
+ } else {
56647
+ var type = toString5.call(data);
56648
+ if (type === "[object String]") {
56649
+ chunks.push(new QRByte(data));
56650
+ } else {
56651
+ throw new Error("illegal data: ".concat(data));
56652
+ }
56653
+ }
56654
+ return this;
56655
+ };
56656
+ Encoder3.prototype.isDark = function(row, col) {
56657
+ return this.matrix[row][col] === true;
56658
+ };
56659
+ Encoder3.prototype.setupFinderPattern = function(row, col) {
56660
+ var matrix = this.matrix;
56661
+ var matrixSize = this.matrixSize;
56662
+ for (var r = -1; r <= 7; r++) {
56663
+ for (var c = -1; c <= 7; c++) {
56664
+ if (row + r <= -1 || matrixSize <= row + r || col + c <= -1 || matrixSize <= col + c) {
56665
+ continue;
56666
+ }
56667
+ if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
56668
+ matrix[row + r][col + c] = true;
56669
+ } else {
56670
+ matrix[row + r][col + c] = false;
56671
+ }
56672
+ }
56673
+ }
56674
+ };
56675
+ Encoder3.prototype.setupAlignmentPattern = function() {
56676
+ var matrix = this.matrix;
56677
+ var pos = getAlignmentPattern(this.version);
56678
+ var length2 = pos.length;
56679
+ for (var i = 0; i < length2; i++) {
56680
+ for (var j = 0; j < length2; j++) {
56681
+ var row = pos[i];
56682
+ var col = pos[j];
56683
+ if (matrix[row][col] !== null) {
56684
+ continue;
56685
+ }
56686
+ for (var r = -2; r <= 2; r++) {
56687
+ for (var c = -2; c <= 2; c++) {
56688
+ if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
56689
+ matrix[row + r][col + c] = true;
56690
+ } else {
56691
+ matrix[row + r][col + c] = false;
56692
+ }
56693
+ }
56694
+ }
56695
+ }
56696
+ }
56697
+ };
56698
+ Encoder3.prototype.setupTimingPattern = function() {
56699
+ var matrix = this.matrix;
56700
+ var count = this.matrixSize - 8;
56701
+ for (var i = 8; i < count; i++) {
56702
+ var bit = i % 2 === 0;
56703
+ if (matrix[i][6] === null) {
56704
+ matrix[i][6] = bit;
56705
+ }
56706
+ if (matrix[6][i] === null) {
56707
+ matrix[6][i] = bit;
56708
+ }
56709
+ }
56710
+ };
56711
+ Encoder3.prototype.setupFormatInfo = function(maskPattern) {
56712
+ var matrix = this.matrix;
56713
+ var data = this.errorCorrectionLevel << 3 | maskPattern;
56714
+ var bits = getBCHVersionInfo(data);
56715
+ var matrixSize = this.matrixSize;
56716
+ for (var i = 0; i < 15; i++) {
56717
+ var bit = (bits >> i & 1) === 1;
56718
+ if (i < 6) {
56719
+ matrix[i][8] = bit;
56720
+ } else if (i < 8) {
56721
+ matrix[i + 1][8] = bit;
56722
+ } else {
56723
+ matrix[matrixSize - 15 + i][8] = bit;
56724
+ }
56725
+ if (i < 8) {
56726
+ matrix[8][matrixSize - i - 1] = bit;
56727
+ } else if (i < 9) {
56728
+ matrix[8][15 - i - 1 + 1] = bit;
56729
+ } else {
56730
+ matrix[8][15 - i - 1] = bit;
56731
+ }
56732
+ }
56733
+ matrix[matrixSize - 8][8] = true;
56734
+ };
56735
+ Encoder3.prototype.setupVersionInfo = function() {
56736
+ if (this.version >= 7) {
56737
+ var matrix = this.matrix;
56738
+ var matrixSize = this.matrixSize;
56739
+ var bits = getBCHVersion(this.version);
56740
+ for (var i = 0; i < 18; i++) {
56741
+ var bit = (bits >> i & 1) === 1;
56742
+ matrix[i / 3 >> 0][i % 3 + matrixSize - 8 - 3] = bit;
56743
+ matrix[i % 3 + matrixSize - 8 - 3][i / 3 >> 0] = bit;
56744
+ }
56745
+ }
56746
+ };
56747
+ Encoder3.prototype.setupCodewords = function(data, maskPattern) {
56748
+ var matrix = this.matrix;
56749
+ var matrixSize = this.matrixSize;
56750
+ var bitLength = data.getLengthInBits();
56751
+ var maskFunc = getMaskFunc(maskPattern);
56752
+ var bitIndex = 0;
56753
+ for (var right = matrixSize - 1; right >= 1; right -= 2) {
56754
+ if (right === 6) {
56755
+ right = 5;
56756
+ }
56757
+ for (var vert = 0; vert < matrixSize; vert++) {
56758
+ for (var j = 0; j < 2; j++) {
56759
+ var x = right - j;
56760
+ var upward = (right + 1 & 2) === 0;
56761
+ var y = upward ? matrixSize - 1 - vert : vert;
56762
+ if (matrix[y][x] !== null) {
56763
+ continue;
56764
+ }
56765
+ var bit = false;
56766
+ if (bitIndex < bitLength) {
56767
+ bit = data.getBit(bitIndex++);
56768
+ }
56769
+ var invert = maskFunc(x, y);
56770
+ if (invert) {
56771
+ bit = !bit;
56772
+ }
56773
+ matrix[y][x] = bit;
56774
+ }
56775
+ }
56776
+ }
56777
+ };
56778
+ Encoder3.prototype.buildMatrix = function(data, maskPattern) {
56779
+ var matrix = [];
56780
+ var matrixSize = this.matrixSize;
56781
+ for (var row = 0; row < matrixSize; row++) {
56782
+ matrix[row] = [];
56783
+ for (var col = 0; col < matrixSize; col++) {
56784
+ matrix[row][col] = null;
56785
+ }
56786
+ }
56787
+ this.matrix = matrix;
56788
+ this.setupFinderPattern(0, 0);
56789
+ this.setupFinderPattern(matrixSize - 7, 0);
56790
+ this.setupFinderPattern(0, matrixSize - 7);
56791
+ this.setupAlignmentPattern();
56792
+ this.setupTimingPattern();
56793
+ this.setupFormatInfo(maskPattern);
56794
+ this.setupVersionInfo();
56795
+ this.setupCodewords(data, maskPattern);
56796
+ };
56797
+ Encoder3.prototype.make = function() {
56798
+ var _a, _b;
56799
+ var buffer2;
56800
+ var rsBlocks;
56801
+ var maxDataCount;
56802
+ var _c = this, chunks = _c.chunks, errorCorrectionLevel = _c.errorCorrectionLevel;
56803
+ if (this.auto) {
56804
+ var version12 = 1;
56805
+ for (; version12 <= 40; version12++) {
56806
+ _a = prepareData(version12, errorCorrectionLevel, this.encodingHint, chunks), buffer2 = _a[0], rsBlocks = _a[1], maxDataCount = _a[2];
56807
+ if (buffer2.getLengthInBits() <= maxDataCount)
56808
+ break;
56809
+ }
56810
+ var dataLengthInBits = buffer2.getLengthInBits();
56811
+ if (dataLengthInBits > maxDataCount) {
56812
+ throw new Error("data overflow: ".concat(dataLengthInBits, " > ").concat(maxDataCount));
56813
+ }
56814
+ this.version = version12;
56815
+ } else {
56816
+ _b = prepareData(this.version, errorCorrectionLevel, this.encodingHint, chunks), buffer2 = _b[0], rsBlocks = _b[1], maxDataCount = _b[2];
56817
+ }
56818
+ this.matrixSize = this.version * 4 + 17;
56819
+ var matrices = [];
56820
+ var data = createData(buffer2, rsBlocks, maxDataCount);
56821
+ var bestMaskPattern = -1;
56822
+ var minPenalty = Number.MAX_VALUE;
56823
+ for (var maskPattern = 0; maskPattern < 8; maskPattern++) {
56824
+ this.buildMatrix(data, maskPattern);
56825
+ matrices.push(this.matrix);
56826
+ var penalty = calculateMaskPenalty(this);
56827
+ if (penalty < minPenalty) {
56828
+ minPenalty = penalty;
56829
+ bestMaskPattern = maskPattern;
56830
+ }
56831
+ }
56832
+ this.matrix = matrices[bestMaskPattern];
56833
+ return this;
56834
+ };
56835
+ Encoder3.prototype.toDataURL = function(moduleSize, margin) {
56836
+ if (moduleSize === void 0) {
56837
+ moduleSize = 2;
56838
+ }
56839
+ if (margin === void 0) {
56840
+ margin = moduleSize * 4;
56841
+ }
56842
+ moduleSize = Math.max(1, moduleSize >> 0);
56843
+ margin = Math.max(0, margin >> 0);
56844
+ var matrixSize = this.matrixSize;
56845
+ var size = moduleSize * matrixSize + margin * 2;
56846
+ var min = margin;
56847
+ var max = size - margin;
56848
+ var gif = new GIFImage(size, size);
56849
+ for (var y = 0; y < size; y++) {
56850
+ for (var x = 0; x < size; x++) {
56851
+ if (min <= x && x < max && min <= y && y < max) {
56852
+ var row = (y - min) / moduleSize >> 0;
56853
+ var col = (x - min) / moduleSize >> 0;
56854
+ gif.setPixel(x, y, this.isDark(row, col) ? 0 : 1);
56855
+ } else {
56856
+ gif.setPixel(x, y, 1);
56857
+ }
56858
+ }
56859
+ }
56860
+ return gif.toDataURL();
56861
+ };
56862
+ Encoder3.prototype.clear = function() {
56863
+ this.chunks = [];
56864
+ };
56865
+ return Encoder3;
56866
+ }();
56867
+
56868
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/encoding/UTF16.js
56869
+ function encode17(text) {
56870
+ var length2 = text.length;
56871
+ var bytes = [];
56872
+ for (var i = 0; i < length2; i++) {
56873
+ bytes.push(text.charCodeAt(i));
56874
+ }
56875
+ return bytes;
56876
+ }
56877
+ __name(encode17, "encode");
56878
+
56879
+ // ../../node_modules/.pnpm/@nuintun+qrcode@3.3.0/node_modules/@nuintun/qrcode/esm/qrcode/encoder/QRAlphanumeric.js
56880
+ function getByte(byte) {
56881
+ if (48 <= byte && byte <= 57) {
56882
+ return byte - 48;
56883
+ } else if (65 <= byte && byte <= 90) {
56884
+ return byte - 65 + 10;
56885
+ } else {
56886
+ switch (byte) {
56887
+ case 32:
56888
+ return 36;
56889
+ case 36:
56890
+ return 37;
56891
+ case 37:
56892
+ return 38;
56893
+ case 42:
56894
+ return 39;
56895
+ case 43:
56896
+ return 40;
56897
+ case 45:
56898
+ return 41;
56899
+ case 46:
56900
+ return 42;
56901
+ case 47:
56902
+ return 43;
56903
+ case 58:
56904
+ return 44;
56905
+ default:
56906
+ throw new Error("illegal char: ".concat(String.fromCharCode(byte)));
56907
+ }
56908
+ }
56909
+ }
56910
+ __name(getByte, "getByte");
56911
+ var QRAlphanumeric = /* @__PURE__ */ function(_super) {
56912
+ __extends2(QRAlphanumeric2, _super);
56913
+ function QRAlphanumeric2(data) {
56914
+ var _this = _super.call(this, Mode.Alphanumeric, data) || this;
56915
+ _this.bytes = encode17(data);
56916
+ return _this;
56917
+ }
56918
+ __name(QRAlphanumeric2, "QRAlphanumeric");
56919
+ QRAlphanumeric2.prototype.writeTo = function(buffer2) {
56920
+ var i = 0;
56921
+ var bytes = this.bytes;
56922
+ var length2 = bytes.length;
56923
+ while (i + 1 < length2) {
56924
+ buffer2.put(getByte(bytes[i]) * 45 + getByte(bytes[i + 1]), 11);
56925
+ i += 2;
56926
+ }
56927
+ if (i < length2) {
56928
+ buffer2.put(getByte(bytes[i]), 6);
56929
+ }
56930
+ };
56931
+ return QRAlphanumeric2;
56932
+ }(QRData);
56933
+
56934
+ // ../../node_modules/.pnpm/@digitalbazaar+vpqr@3.0.0/node_modules/@digitalbazaar/vpqr/lib/vpqr.js
56935
+ var VP_QR_VERSION = "VP1";
56936
+ var BASE_32_UPPERCASE_MULTIBASE_PREFIX = "B";
56937
+ function _bytesToQrCodeDataUrl({ bytes, size }) {
56938
+ const qrcode = new Encoder2();
56939
+ qrcode.setEncodingHint(true);
56940
+ const encoded = base32Encode(bytes, "RFC4648", { padding: false });
56941
+ const vpPayload = `${VP_QR_VERSION}-${BASE_32_UPPERCASE_MULTIBASE_PREFIX}${encoded}`;
56942
+ qrcode.write(new QRAlphanumeric(vpPayload));
56943
+ qrcode.make();
56944
+ return {
56945
+ payload: vpPayload,
56946
+ encodedCborld: encoded,
56947
+ version: qrcode.getVersion(),
56948
+ imageDataUrl: qrcode.toDataURL(size)
56949
+ };
56950
+ }
56951
+ __name(_bytesToQrCodeDataUrl, "_bytesToQrCodeDataUrl");
56952
+ function toQrCode() {
56953
+ return __async(this, arguments, function* ({
56954
+ vp,
56955
+ documentLoader,
56956
+ size,
56957
+ diagnose
56958
+ } = {}) {
56959
+ const cborldBytes = yield encode14({
56960
+ jsonldDocument: vp,
56961
+ documentLoader,
56962
+ diagnose
56963
+ });
56964
+ const {
56965
+ payload,
56966
+ imageDataUrl,
56967
+ encodedCborld,
56968
+ version: version12
56969
+ } = _bytesToQrCodeDataUrl({
56970
+ bytes: cborldBytes,
56971
+ size
56972
+ });
56973
+ return {
56974
+ payload,
56975
+ imageDataUrl,
56976
+ encodedCborld,
56977
+ rawCborldBytes: cborldBytes,
56978
+ version: version12
56979
+ };
56980
+ });
56981
+ }
56982
+ __name(toQrCode, "toQrCode");
56983
+ function fromQrCode() {
56984
+ return __async(this, arguments, function* ({
56985
+ text,
56986
+ documentLoader,
56987
+ diagnose
56988
+ } = {}) {
56989
+ const header = VP_QR_VERSION + "-";
56990
+ if (!(text && text.startsWith(header))) {
56991
+ throw TypeError("Unsupported VP QR format.");
56992
+ }
56993
+ const multibasePayload = text.slice(header.length);
56994
+ if (!multibasePayload.startsWith(BASE_32_UPPERCASE_MULTIBASE_PREFIX)) {
56995
+ throw TypeError("Payload must be multibase base32 (RFC4648) encoded.");
56996
+ }
56997
+ const cborldArrayBuffer = (0, import_base32_decode.default)(multibasePayload.slice(1), "RFC4648");
56998
+ const cborldBytes = new Uint8Array(cborldArrayBuffer);
56999
+ const vp = yield decode13({
57000
+ cborldBytes,
57001
+ documentLoader,
57002
+ diagnose
57003
+ });
57004
+ return { vp };
57005
+ });
57006
+ }
57007
+ __name(fromQrCode, "fromQrCode");
57008
+
57009
+ // src/wallet/plugins/vpqr/index.ts
57010
+ var getVpqrPlugin = /* @__PURE__ */ __name((wallet) => {
57011
+ return {
57012
+ pluginMethods: {
57013
+ vpFromQrCode: (_wallet, text) => __async(void 0, null, function* () {
57014
+ var _a;
57015
+ return (_a = yield fromQrCode({
57016
+ text,
57017
+ documentLoader: (url) => __async(void 0, null, function* () {
57018
+ return {
57019
+ document: yield wallet.pluginMethods.contextLoader(url)
57020
+ };
57021
+ })
57022
+ })) == null ? void 0 : _a.vp;
57023
+ }),
57024
+ vpToQrCode: (_wallet, vp) => __async(void 0, null, function* () {
57025
+ var _a;
57026
+ return (_a = yield toQrCode({
57027
+ vp,
57028
+ documentLoader: (url) => __async(void 0, null, function* () {
57029
+ return {
57030
+ document: yield wallet.pluginMethods.contextLoader(url)
57031
+ };
57032
+ })
57033
+ })) == null ? void 0 : _a.imageDataUrl;
57034
+ })
57035
+ }
57036
+ };
57037
+ }, "getVpqrPlugin");
57038
+
53784
57039
  // src/wallet/defaults.ts
53785
57040
  var defaultCeramicIDXArgs = {
53786
57041
  modelData: {
@@ -53814,7 +57069,8 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
53814
57069
  const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
53815
57070
  const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
53816
57071
  const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
53817
- const wallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
57072
+ const ethWallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
57073
+ const wallet = yield ethWallet.addPlugin(getVpqrPlugin(ethWallet));
53818
57074
  return {
53819
57075
  _wallet: wallet,
53820
57076
  did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
@@ -53835,9 +57091,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
53835
57091
  removeCredential: (title) => __async(void 0, null, function* () {
53836
57092
  yield wallet.pluginMethods.removeVerifiableCredentialInIdx(title);
53837
57093
  }),
57094
+ resolveDid: wallet.pluginMethods.resolveDid,
53838
57095
  readFromCeramic: wallet.pluginMethods.readContentFromCeramic,
53839
57096
  getTestVc: wallet.pluginMethods.getTestVc,
53840
57097
  getTestVp: wallet.pluginMethods.getTestVp,
57098
+ vpFromQrCode: wallet.pluginMethods.vpFromQrCode,
57099
+ vpToQrCode: wallet.pluginMethods.vpToQrCode,
53841
57100
  getEthereumAddress: wallet.pluginMethods.getEthereumAddress,
53842
57101
  getBalance: wallet.pluginMethods.getBalance,
53843
57102
  getBalanceForAddress: wallet.pluginMethods.getBalanceForAddress,
@@ -53859,6 +57118,18 @@ function initLearnCard() {
53859
57118
  });
53860
57119
  }
53861
57120
  __name(initLearnCard, "initLearnCard");
57121
+ /*!
57122
+ * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
57123
+ */
57124
+ /*!
57125
+ * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
57126
+ */
57127
+ /*!
57128
+ * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
57129
+ */
57130
+ /*!
57131
+ * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
57132
+ */
53862
57133
  /*!
53863
57134
  * https://github.com/Starcounter-Jack/JSON-Patch
53864
57135
  * (c) 2017-2021 Joachim Wester
@@ -53869,6 +57140,15 @@ __name(initLearnCard, "initLearnCard");
53869
57140
  * (c) 2017-2022 Joachim Wester
53870
57141
  * MIT licensed
53871
57142
  */
57143
+ /**
57144
+ * @module QRCode
57145
+ * @package @nuintun/qrcode
57146
+ * @license MIT
57147
+ * @version 3.3.0
57148
+ * @author nuintun <nuintun@qq.com>
57149
+ * @description A pure JavaScript QRCode encode and decode library.
57150
+ * @see https://github.com/nuintun/qrcode#readme
57151
+ */
53872
57152
  /**
53873
57153
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
53874
57154
  *