@learncard/core 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +3390 -155
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +196 -120
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +213 -42
- package/dist/core.esm.js +3390 -155
- package/dist/core.esm.js.map +3 -3
- package/package.json +4 -1
package/dist/core.esm.js
CHANGED
@@ -2888,9 +2888,9 @@ var require_package = __commonJS({
|
|
2888
2888
|
}
|
2889
2889
|
});
|
2890
2890
|
|
2891
|
-
// (disabled):../../node_modules/.pnpm/buffer@5.
|
2891
|
+
// (disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
|
2892
2892
|
var require_buffer = __commonJS({
|
2893
|
-
"(disabled):../../node_modules/.pnpm/buffer@5.
|
2893
|
+
"(disabled):../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"() {
|
2894
2894
|
}
|
2895
2895
|
});
|
2896
2896
|
|
@@ -2937,12 +2937,12 @@ var require_bn = __commonJS({
|
|
2937
2937
|
}
|
2938
2938
|
BN3.BN = BN3;
|
2939
2939
|
BN3.wordSize = 26;
|
2940
|
-
var
|
2940
|
+
var Buffer3;
|
2941
2941
|
try {
|
2942
2942
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
2943
|
-
|
2943
|
+
Buffer3 = window.Buffer;
|
2944
2944
|
} else {
|
2945
|
-
|
2945
|
+
Buffer3 = require_buffer().Buffer;
|
2946
2946
|
}
|
2947
2947
|
} catch (e) {
|
2948
2948
|
}
|
@@ -3383,8 +3383,8 @@ var require_bn = __commonJS({
|
|
3383
3383
|
return this.toString(16);
|
3384
3384
|
}, "toJSON");
|
3385
3385
|
BN3.prototype.toBuffer = /* @__PURE__ */ __name(function toBuffer(endian, length2) {
|
3386
|
-
assert2(typeof
|
3387
|
-
return this.toArrayLike(
|
3386
|
+
assert2(typeof Buffer3 !== "undefined");
|
3387
|
+
return this.toArrayLike(Buffer3, endian, length2);
|
3388
3388
|
}, "toBuffer");
|
3389
3389
|
BN3.prototype.toArray = /* @__PURE__ */ __name(function toArray(endian, length2) {
|
3390
3390
|
return this.toArrayLike(Array, endian, length2);
|
@@ -23420,12 +23420,12 @@ var require_bn2 = __commonJS({
|
|
23420
23420
|
}
|
23421
23421
|
BN3.BN = BN3;
|
23422
23422
|
BN3.wordSize = 26;
|
23423
|
-
var
|
23423
|
+
var Buffer3;
|
23424
23424
|
try {
|
23425
23425
|
if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") {
|
23426
|
-
|
23426
|
+
Buffer3 = window.Buffer;
|
23427
23427
|
} else {
|
23428
|
-
|
23428
|
+
Buffer3 = require_buffer().Buffer;
|
23429
23429
|
}
|
23430
23430
|
} catch (e) {
|
23431
23431
|
}
|
@@ -23890,9 +23890,9 @@ var require_bn2 = __commonJS({
|
|
23890
23890
|
BN3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
23891
23891
|
return this.toString(16, 2);
|
23892
23892
|
}, "toJSON");
|
23893
|
-
if (
|
23893
|
+
if (Buffer3) {
|
23894
23894
|
BN3.prototype.toBuffer = /* @__PURE__ */ __name(function toBuffer(endian, length2) {
|
23895
|
-
return this.toArrayLike(
|
23895
|
+
return this.toArrayLike(Buffer3, endian, length2);
|
23896
23896
|
}, "toBuffer");
|
23897
23897
|
}
|
23898
23898
|
BN3.prototype.toArray = /* @__PURE__ */ __name(function toArray(endian, length2) {
|
@@ -27428,7 +27428,7 @@ var require_lodash = __commonJS({
|
|
27428
27428
|
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
27429
27429
|
var objectToString = objectProto.toString;
|
27430
27430
|
var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
27431
|
-
var
|
27431
|
+
var Buffer3 = moduleExports ? root.Buffer : void 0;
|
27432
27432
|
var Symbol2 = root.Symbol;
|
27433
27433
|
var Uint8Array2 = root.Uint8Array;
|
27434
27434
|
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
@@ -27436,7 +27436,7 @@ var require_lodash = __commonJS({
|
|
27436
27436
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
27437
27437
|
var splice = arrayProto.splice;
|
27438
27438
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
27439
|
-
var nativeIsBuffer =
|
27439
|
+
var nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : void 0;
|
27440
27440
|
var nativeKeys = overArg(Object.keys, Object);
|
27441
27441
|
var DataView2 = getNative(root, "DataView");
|
27442
27442
|
var Map2 = getNative(root, "Map");
|
@@ -28460,7 +28460,7 @@ var require_dataloader = __commonJS({
|
|
28460
28460
|
}
|
28461
28461
|
__name(DataLoader3, "DataLoader");
|
28462
28462
|
var _proto = DataLoader3.prototype;
|
28463
|
-
_proto.load = /* @__PURE__ */ __name(function
|
28463
|
+
_proto.load = /* @__PURE__ */ __name(function load3(key2) {
|
28464
28464
|
if (key2 === null || key2 === void 0) {
|
28465
28465
|
throw new TypeError("The loader.load() function must be called with a value, " + ("but got: " + String(key2) + "."));
|
28466
28466
|
}
|
@@ -29268,6 +29268,1667 @@ var require_src3 = __commonJS({
|
|
29268
29268
|
}
|
29269
29269
|
});
|
29270
29270
|
|
29271
|
+
// ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
29272
|
+
var require_base64_js = __commonJS({
|
29273
|
+
"../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js"(exports) {
|
29274
|
+
"use strict";
|
29275
|
+
exports.byteLength = byteLength;
|
29276
|
+
exports.toByteArray = toByteArray;
|
29277
|
+
exports.fromByteArray = fromByteArray;
|
29278
|
+
var lookup = [];
|
29279
|
+
var revLookup = [];
|
29280
|
+
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
29281
|
+
var code5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
29282
|
+
for (i = 0, len = code5.length; i < len; ++i) {
|
29283
|
+
lookup[i] = code5[i];
|
29284
|
+
revLookup[code5.charCodeAt(i)] = i;
|
29285
|
+
}
|
29286
|
+
var i;
|
29287
|
+
var len;
|
29288
|
+
revLookup["-".charCodeAt(0)] = 62;
|
29289
|
+
revLookup["_".charCodeAt(0)] = 63;
|
29290
|
+
function getLens(b64) {
|
29291
|
+
var len2 = b64.length;
|
29292
|
+
if (len2 % 4 > 0) {
|
29293
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
29294
|
+
}
|
29295
|
+
var validLen = b64.indexOf("=");
|
29296
|
+
if (validLen === -1)
|
29297
|
+
validLen = len2;
|
29298
|
+
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
|
29299
|
+
return [validLen, placeHoldersLen];
|
29300
|
+
}
|
29301
|
+
__name(getLens, "getLens");
|
29302
|
+
function byteLength(b64) {
|
29303
|
+
var lens = getLens(b64);
|
29304
|
+
var validLen = lens[0];
|
29305
|
+
var placeHoldersLen = lens[1];
|
29306
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
29307
|
+
}
|
29308
|
+
__name(byteLength, "byteLength");
|
29309
|
+
function _byteLength(b64, validLen, placeHoldersLen) {
|
29310
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
29311
|
+
}
|
29312
|
+
__name(_byteLength, "_byteLength");
|
29313
|
+
function toByteArray(b64) {
|
29314
|
+
var tmp;
|
29315
|
+
var lens = getLens(b64);
|
29316
|
+
var validLen = lens[0];
|
29317
|
+
var placeHoldersLen = lens[1];
|
29318
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
29319
|
+
var curByte = 0;
|
29320
|
+
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
29321
|
+
var i2;
|
29322
|
+
for (i2 = 0; i2 < len2; i2 += 4) {
|
29323
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
|
29324
|
+
arr[curByte++] = tmp >> 16 & 255;
|
29325
|
+
arr[curByte++] = tmp >> 8 & 255;
|
29326
|
+
arr[curByte++] = tmp & 255;
|
29327
|
+
}
|
29328
|
+
if (placeHoldersLen === 2) {
|
29329
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
|
29330
|
+
arr[curByte++] = tmp & 255;
|
29331
|
+
}
|
29332
|
+
if (placeHoldersLen === 1) {
|
29333
|
+
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
|
29334
|
+
arr[curByte++] = tmp >> 8 & 255;
|
29335
|
+
arr[curByte++] = tmp & 255;
|
29336
|
+
}
|
29337
|
+
return arr;
|
29338
|
+
}
|
29339
|
+
__name(toByteArray, "toByteArray");
|
29340
|
+
function tripletToBase64(num) {
|
29341
|
+
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
29342
|
+
}
|
29343
|
+
__name(tripletToBase64, "tripletToBase64");
|
29344
|
+
function encodeChunk(uint8, start, end) {
|
29345
|
+
var tmp;
|
29346
|
+
var output = [];
|
29347
|
+
for (var i2 = start; i2 < end; i2 += 3) {
|
29348
|
+
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
|
29349
|
+
output.push(tripletToBase64(tmp));
|
29350
|
+
}
|
29351
|
+
return output.join("");
|
29352
|
+
}
|
29353
|
+
__name(encodeChunk, "encodeChunk");
|
29354
|
+
function fromByteArray(uint8) {
|
29355
|
+
var tmp;
|
29356
|
+
var len2 = uint8.length;
|
29357
|
+
var extraBytes = len2 % 3;
|
29358
|
+
var parts = [];
|
29359
|
+
var maxChunkLength = 16383;
|
29360
|
+
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
|
29361
|
+
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
|
29362
|
+
}
|
29363
|
+
if (extraBytes === 1) {
|
29364
|
+
tmp = uint8[len2 - 1];
|
29365
|
+
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
|
29366
|
+
} else if (extraBytes === 2) {
|
29367
|
+
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
|
29368
|
+
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
|
29369
|
+
}
|
29370
|
+
return parts.join("");
|
29371
|
+
}
|
29372
|
+
__name(fromByteArray, "fromByteArray");
|
29373
|
+
}
|
29374
|
+
});
|
29375
|
+
|
29376
|
+
// ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
|
29377
|
+
var require_ieee754 = __commonJS({
|
29378
|
+
"../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js"(exports) {
|
29379
|
+
exports.read = function(buffer2, offset, isLE, mLen, nBytes) {
|
29380
|
+
var e, m;
|
29381
|
+
var eLen = nBytes * 8 - mLen - 1;
|
29382
|
+
var eMax = (1 << eLen) - 1;
|
29383
|
+
var eBias = eMax >> 1;
|
29384
|
+
var nBits = -7;
|
29385
|
+
var i = isLE ? nBytes - 1 : 0;
|
29386
|
+
var d = isLE ? -1 : 1;
|
29387
|
+
var s = buffer2[offset + i];
|
29388
|
+
i += d;
|
29389
|
+
e = s & (1 << -nBits) - 1;
|
29390
|
+
s >>= -nBits;
|
29391
|
+
nBits += eLen;
|
29392
|
+
for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
29393
|
+
}
|
29394
|
+
m = e & (1 << -nBits) - 1;
|
29395
|
+
e >>= -nBits;
|
29396
|
+
nBits += mLen;
|
29397
|
+
for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) {
|
29398
|
+
}
|
29399
|
+
if (e === 0) {
|
29400
|
+
e = 1 - eBias;
|
29401
|
+
} else if (e === eMax) {
|
29402
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
29403
|
+
} else {
|
29404
|
+
m = m + Math.pow(2, mLen);
|
29405
|
+
e = e - eBias;
|
29406
|
+
}
|
29407
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
29408
|
+
};
|
29409
|
+
exports.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
29410
|
+
var e, m, c;
|
29411
|
+
var eLen = nBytes * 8 - mLen - 1;
|
29412
|
+
var eMax = (1 << eLen) - 1;
|
29413
|
+
var eBias = eMax >> 1;
|
29414
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
29415
|
+
var i = isLE ? 0 : nBytes - 1;
|
29416
|
+
var d = isLE ? 1 : -1;
|
29417
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
29418
|
+
value = Math.abs(value);
|
29419
|
+
if (isNaN(value) || value === Infinity) {
|
29420
|
+
m = isNaN(value) ? 1 : 0;
|
29421
|
+
e = eMax;
|
29422
|
+
} else {
|
29423
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
29424
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
29425
|
+
e--;
|
29426
|
+
c *= 2;
|
29427
|
+
}
|
29428
|
+
if (e + eBias >= 1) {
|
29429
|
+
value += rt / c;
|
29430
|
+
} else {
|
29431
|
+
value += rt * Math.pow(2, 1 - eBias);
|
29432
|
+
}
|
29433
|
+
if (value * c >= 2) {
|
29434
|
+
e++;
|
29435
|
+
c /= 2;
|
29436
|
+
}
|
29437
|
+
if (e + eBias >= eMax) {
|
29438
|
+
m = 0;
|
29439
|
+
e = eMax;
|
29440
|
+
} else if (e + eBias >= 1) {
|
29441
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
29442
|
+
e = e + eBias;
|
29443
|
+
} else {
|
29444
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
29445
|
+
e = 0;
|
29446
|
+
}
|
29447
|
+
}
|
29448
|
+
for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
29449
|
+
}
|
29450
|
+
e = e << mLen | m;
|
29451
|
+
eLen += mLen;
|
29452
|
+
for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
29453
|
+
}
|
29454
|
+
buffer2[offset + i - d] |= s * 128;
|
29455
|
+
};
|
29456
|
+
}
|
29457
|
+
});
|
29458
|
+
|
29459
|
+
// ../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js
|
29460
|
+
var require_buffer2 = __commonJS({
|
29461
|
+
"../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.js"(exports) {
|
29462
|
+
"use strict";
|
29463
|
+
var base642 = require_base64_js();
|
29464
|
+
var ieee754 = require_ieee754();
|
29465
|
+
var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
|
29466
|
+
exports.Buffer = Buffer3;
|
29467
|
+
exports.SlowBuffer = SlowBuffer;
|
29468
|
+
exports.INSPECT_MAX_BYTES = 50;
|
29469
|
+
var K_MAX_LENGTH = 2147483647;
|
29470
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
29471
|
+
Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
29472
|
+
if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
|
29473
|
+
console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
|
29474
|
+
}
|
29475
|
+
function typedArraySupport() {
|
29476
|
+
try {
|
29477
|
+
var arr = new Uint8Array(1);
|
29478
|
+
var proto = { foo: function() {
|
29479
|
+
return 42;
|
29480
|
+
} };
|
29481
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
29482
|
+
Object.setPrototypeOf(arr, proto);
|
29483
|
+
return arr.foo() === 42;
|
29484
|
+
} catch (e) {
|
29485
|
+
return false;
|
29486
|
+
}
|
29487
|
+
}
|
29488
|
+
__name(typedArraySupport, "typedArraySupport");
|
29489
|
+
Object.defineProperty(Buffer3.prototype, "parent", {
|
29490
|
+
enumerable: true,
|
29491
|
+
get: function() {
|
29492
|
+
if (!Buffer3.isBuffer(this))
|
29493
|
+
return void 0;
|
29494
|
+
return this.buffer;
|
29495
|
+
}
|
29496
|
+
});
|
29497
|
+
Object.defineProperty(Buffer3.prototype, "offset", {
|
29498
|
+
enumerable: true,
|
29499
|
+
get: function() {
|
29500
|
+
if (!Buffer3.isBuffer(this))
|
29501
|
+
return void 0;
|
29502
|
+
return this.byteOffset;
|
29503
|
+
}
|
29504
|
+
});
|
29505
|
+
function createBuffer(length2) {
|
29506
|
+
if (length2 > K_MAX_LENGTH) {
|
29507
|
+
throw new RangeError('The value "' + length2 + '" is invalid for option "size"');
|
29508
|
+
}
|
29509
|
+
var buf2 = new Uint8Array(length2);
|
29510
|
+
Object.setPrototypeOf(buf2, Buffer3.prototype);
|
29511
|
+
return buf2;
|
29512
|
+
}
|
29513
|
+
__name(createBuffer, "createBuffer");
|
29514
|
+
function Buffer3(arg, encodingOrOffset, length2) {
|
29515
|
+
if (typeof arg === "number") {
|
29516
|
+
if (typeof encodingOrOffset === "string") {
|
29517
|
+
throw new TypeError('The "string" argument must be of type string. Received type number');
|
29518
|
+
}
|
29519
|
+
return allocUnsafe(arg);
|
29520
|
+
}
|
29521
|
+
return from4(arg, encodingOrOffset, length2);
|
29522
|
+
}
|
29523
|
+
__name(Buffer3, "Buffer");
|
29524
|
+
Buffer3.poolSize = 8192;
|
29525
|
+
function from4(value, encodingOrOffset, length2) {
|
29526
|
+
if (typeof value === "string") {
|
29527
|
+
return fromString6(value, encodingOrOffset);
|
29528
|
+
}
|
29529
|
+
if (ArrayBuffer.isView(value)) {
|
29530
|
+
return fromArrayView(value);
|
29531
|
+
}
|
29532
|
+
if (value == null) {
|
29533
|
+
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
29534
|
+
}
|
29535
|
+
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
29536
|
+
return fromArrayBuffer(value, encodingOrOffset, length2);
|
29537
|
+
}
|
29538
|
+
if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
29539
|
+
return fromArrayBuffer(value, encodingOrOffset, length2);
|
29540
|
+
}
|
29541
|
+
if (typeof value === "number") {
|
29542
|
+
throw new TypeError('The "value" argument must not be of type number. Received type number');
|
29543
|
+
}
|
29544
|
+
var valueOf = value.valueOf && value.valueOf();
|
29545
|
+
if (valueOf != null && valueOf !== value) {
|
29546
|
+
return Buffer3.from(valueOf, encodingOrOffset, length2);
|
29547
|
+
}
|
29548
|
+
var b = fromObject(value);
|
29549
|
+
if (b)
|
29550
|
+
return b;
|
29551
|
+
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
29552
|
+
return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length2);
|
29553
|
+
}
|
29554
|
+
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
29555
|
+
}
|
29556
|
+
__name(from4, "from");
|
29557
|
+
Buffer3.from = function(value, encodingOrOffset, length2) {
|
29558
|
+
return from4(value, encodingOrOffset, length2);
|
29559
|
+
};
|
29560
|
+
Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype);
|
29561
|
+
Object.setPrototypeOf(Buffer3, Uint8Array);
|
29562
|
+
function assertSize(size) {
|
29563
|
+
if (typeof size !== "number") {
|
29564
|
+
throw new TypeError('"size" argument must be of type number');
|
29565
|
+
} else if (size < 0) {
|
29566
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
29567
|
+
}
|
29568
|
+
}
|
29569
|
+
__name(assertSize, "assertSize");
|
29570
|
+
function alloc2(size, fill, encoding) {
|
29571
|
+
assertSize(size);
|
29572
|
+
if (size <= 0) {
|
29573
|
+
return createBuffer(size);
|
29574
|
+
}
|
29575
|
+
if (fill !== void 0) {
|
29576
|
+
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
29577
|
+
}
|
29578
|
+
return createBuffer(size);
|
29579
|
+
}
|
29580
|
+
__name(alloc2, "alloc");
|
29581
|
+
Buffer3.alloc = function(size, fill, encoding) {
|
29582
|
+
return alloc2(size, fill, encoding);
|
29583
|
+
};
|
29584
|
+
function allocUnsafe(size) {
|
29585
|
+
assertSize(size);
|
29586
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
29587
|
+
}
|
29588
|
+
__name(allocUnsafe, "allocUnsafe");
|
29589
|
+
Buffer3.allocUnsafe = function(size) {
|
29590
|
+
return allocUnsafe(size);
|
29591
|
+
};
|
29592
|
+
Buffer3.allocUnsafeSlow = function(size) {
|
29593
|
+
return allocUnsafe(size);
|
29594
|
+
};
|
29595
|
+
function fromString6(string2, encoding) {
|
29596
|
+
if (typeof encoding !== "string" || encoding === "") {
|
29597
|
+
encoding = "utf8";
|
29598
|
+
}
|
29599
|
+
if (!Buffer3.isEncoding(encoding)) {
|
29600
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
29601
|
+
}
|
29602
|
+
var length2 = byteLength(string2, encoding) | 0;
|
29603
|
+
var buf2 = createBuffer(length2);
|
29604
|
+
var actual = buf2.write(string2, encoding);
|
29605
|
+
if (actual !== length2) {
|
29606
|
+
buf2 = buf2.slice(0, actual);
|
29607
|
+
}
|
29608
|
+
return buf2;
|
29609
|
+
}
|
29610
|
+
__name(fromString6, "fromString");
|
29611
|
+
function fromArrayLike2(array) {
|
29612
|
+
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
29613
|
+
var buf2 = createBuffer(length2);
|
29614
|
+
for (var i = 0; i < length2; i += 1) {
|
29615
|
+
buf2[i] = array[i] & 255;
|
29616
|
+
}
|
29617
|
+
return buf2;
|
29618
|
+
}
|
29619
|
+
__name(fromArrayLike2, "fromArrayLike");
|
29620
|
+
function fromArrayView(arrayView) {
|
29621
|
+
if (isInstance(arrayView, Uint8Array)) {
|
29622
|
+
var copy = new Uint8Array(arrayView);
|
29623
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
29624
|
+
}
|
29625
|
+
return fromArrayLike2(arrayView);
|
29626
|
+
}
|
29627
|
+
__name(fromArrayView, "fromArrayView");
|
29628
|
+
function fromArrayBuffer(array, byteOffset, length2) {
|
29629
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
29630
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
29631
|
+
}
|
29632
|
+
if (array.byteLength < byteOffset + (length2 || 0)) {
|
29633
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
29634
|
+
}
|
29635
|
+
var buf2;
|
29636
|
+
if (byteOffset === void 0 && length2 === void 0) {
|
29637
|
+
buf2 = new Uint8Array(array);
|
29638
|
+
} else if (length2 === void 0) {
|
29639
|
+
buf2 = new Uint8Array(array, byteOffset);
|
29640
|
+
} else {
|
29641
|
+
buf2 = new Uint8Array(array, byteOffset, length2);
|
29642
|
+
}
|
29643
|
+
Object.setPrototypeOf(buf2, Buffer3.prototype);
|
29644
|
+
return buf2;
|
29645
|
+
}
|
29646
|
+
__name(fromArrayBuffer, "fromArrayBuffer");
|
29647
|
+
function fromObject(obj) {
|
29648
|
+
if (Buffer3.isBuffer(obj)) {
|
29649
|
+
var len = checked(obj.length) | 0;
|
29650
|
+
var buf2 = createBuffer(len);
|
29651
|
+
if (buf2.length === 0) {
|
29652
|
+
return buf2;
|
29653
|
+
}
|
29654
|
+
obj.copy(buf2, 0, 0, len);
|
29655
|
+
return buf2;
|
29656
|
+
}
|
29657
|
+
if (obj.length !== void 0) {
|
29658
|
+
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
|
29659
|
+
return createBuffer(0);
|
29660
|
+
}
|
29661
|
+
return fromArrayLike2(obj);
|
29662
|
+
}
|
29663
|
+
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
|
29664
|
+
return fromArrayLike2(obj.data);
|
29665
|
+
}
|
29666
|
+
}
|
29667
|
+
__name(fromObject, "fromObject");
|
29668
|
+
function checked(length2) {
|
29669
|
+
if (length2 >= K_MAX_LENGTH) {
|
29670
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
|
29671
|
+
}
|
29672
|
+
return length2 | 0;
|
29673
|
+
}
|
29674
|
+
__name(checked, "checked");
|
29675
|
+
function SlowBuffer(length2) {
|
29676
|
+
if (+length2 != length2) {
|
29677
|
+
length2 = 0;
|
29678
|
+
}
|
29679
|
+
return Buffer3.alloc(+length2);
|
29680
|
+
}
|
29681
|
+
__name(SlowBuffer, "SlowBuffer");
|
29682
|
+
Buffer3.isBuffer = /* @__PURE__ */ __name(function isBuffer3(b) {
|
29683
|
+
return b != null && b._isBuffer === true && b !== Buffer3.prototype;
|
29684
|
+
}, "isBuffer");
|
29685
|
+
Buffer3.compare = /* @__PURE__ */ __name(function compare4(a, b) {
|
29686
|
+
if (isInstance(a, Uint8Array))
|
29687
|
+
a = Buffer3.from(a, a.offset, a.byteLength);
|
29688
|
+
if (isInstance(b, Uint8Array))
|
29689
|
+
b = Buffer3.from(b, b.offset, b.byteLength);
|
29690
|
+
if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
|
29691
|
+
throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
|
29692
|
+
}
|
29693
|
+
if (a === b)
|
29694
|
+
return 0;
|
29695
|
+
var x = a.length;
|
29696
|
+
var y = b.length;
|
29697
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
29698
|
+
if (a[i] !== b[i]) {
|
29699
|
+
x = a[i];
|
29700
|
+
y = b[i];
|
29701
|
+
break;
|
29702
|
+
}
|
29703
|
+
}
|
29704
|
+
if (x < y)
|
29705
|
+
return -1;
|
29706
|
+
if (y < x)
|
29707
|
+
return 1;
|
29708
|
+
return 0;
|
29709
|
+
}, "compare");
|
29710
|
+
Buffer3.isEncoding = /* @__PURE__ */ __name(function isEncoding(encoding) {
|
29711
|
+
switch (String(encoding).toLowerCase()) {
|
29712
|
+
case "hex":
|
29713
|
+
case "utf8":
|
29714
|
+
case "utf-8":
|
29715
|
+
case "ascii":
|
29716
|
+
case "latin1":
|
29717
|
+
case "binary":
|
29718
|
+
case "base64":
|
29719
|
+
case "ucs2":
|
29720
|
+
case "ucs-2":
|
29721
|
+
case "utf16le":
|
29722
|
+
case "utf-16le":
|
29723
|
+
return true;
|
29724
|
+
default:
|
29725
|
+
return false;
|
29726
|
+
}
|
29727
|
+
}, "isEncoding");
|
29728
|
+
Buffer3.concat = /* @__PURE__ */ __name(function concat4(list, length2) {
|
29729
|
+
if (!Array.isArray(list)) {
|
29730
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
29731
|
+
}
|
29732
|
+
if (list.length === 0) {
|
29733
|
+
return Buffer3.alloc(0);
|
29734
|
+
}
|
29735
|
+
var i;
|
29736
|
+
if (length2 === void 0) {
|
29737
|
+
length2 = 0;
|
29738
|
+
for (i = 0; i < list.length; ++i) {
|
29739
|
+
length2 += list[i].length;
|
29740
|
+
}
|
29741
|
+
}
|
29742
|
+
var buffer2 = Buffer3.allocUnsafe(length2);
|
29743
|
+
var pos = 0;
|
29744
|
+
for (i = 0; i < list.length; ++i) {
|
29745
|
+
var buf2 = list[i];
|
29746
|
+
if (isInstance(buf2, Uint8Array)) {
|
29747
|
+
if (pos + buf2.length > buffer2.length) {
|
29748
|
+
Buffer3.from(buf2).copy(buffer2, pos);
|
29749
|
+
} else {
|
29750
|
+
Uint8Array.prototype.set.call(buffer2, buf2, pos);
|
29751
|
+
}
|
29752
|
+
} else if (!Buffer3.isBuffer(buf2)) {
|
29753
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
29754
|
+
} else {
|
29755
|
+
buf2.copy(buffer2, pos);
|
29756
|
+
}
|
29757
|
+
pos += buf2.length;
|
29758
|
+
}
|
29759
|
+
return buffer2;
|
29760
|
+
}, "concat");
|
29761
|
+
function byteLength(string2, encoding) {
|
29762
|
+
if (Buffer3.isBuffer(string2)) {
|
29763
|
+
return string2.length;
|
29764
|
+
}
|
29765
|
+
if (ArrayBuffer.isView(string2) || isInstance(string2, ArrayBuffer)) {
|
29766
|
+
return string2.byteLength;
|
29767
|
+
}
|
29768
|
+
if (typeof string2 !== "string") {
|
29769
|
+
throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string2);
|
29770
|
+
}
|
29771
|
+
var len = string2.length;
|
29772
|
+
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
29773
|
+
if (!mustMatch && len === 0)
|
29774
|
+
return 0;
|
29775
|
+
var loweredCase = false;
|
29776
|
+
for (; ; ) {
|
29777
|
+
switch (encoding) {
|
29778
|
+
case "ascii":
|
29779
|
+
case "latin1":
|
29780
|
+
case "binary":
|
29781
|
+
return len;
|
29782
|
+
case "utf8":
|
29783
|
+
case "utf-8":
|
29784
|
+
return utf8ToBytes2(string2).length;
|
29785
|
+
case "ucs2":
|
29786
|
+
case "ucs-2":
|
29787
|
+
case "utf16le":
|
29788
|
+
case "utf-16le":
|
29789
|
+
return len * 2;
|
29790
|
+
case "hex":
|
29791
|
+
return len >>> 1;
|
29792
|
+
case "base64":
|
29793
|
+
return base64ToBytes2(string2).length;
|
29794
|
+
default:
|
29795
|
+
if (loweredCase) {
|
29796
|
+
return mustMatch ? -1 : utf8ToBytes2(string2).length;
|
29797
|
+
}
|
29798
|
+
encoding = ("" + encoding).toLowerCase();
|
29799
|
+
loweredCase = true;
|
29800
|
+
}
|
29801
|
+
}
|
29802
|
+
}
|
29803
|
+
__name(byteLength, "byteLength");
|
29804
|
+
Buffer3.byteLength = byteLength;
|
29805
|
+
function slowToString(encoding, start, end) {
|
29806
|
+
var loweredCase = false;
|
29807
|
+
if (start === void 0 || start < 0) {
|
29808
|
+
start = 0;
|
29809
|
+
}
|
29810
|
+
if (start > this.length) {
|
29811
|
+
return "";
|
29812
|
+
}
|
29813
|
+
if (end === void 0 || end > this.length) {
|
29814
|
+
end = this.length;
|
29815
|
+
}
|
29816
|
+
if (end <= 0) {
|
29817
|
+
return "";
|
29818
|
+
}
|
29819
|
+
end >>>= 0;
|
29820
|
+
start >>>= 0;
|
29821
|
+
if (end <= start) {
|
29822
|
+
return "";
|
29823
|
+
}
|
29824
|
+
if (!encoding)
|
29825
|
+
encoding = "utf8";
|
29826
|
+
while (true) {
|
29827
|
+
switch (encoding) {
|
29828
|
+
case "hex":
|
29829
|
+
return hexSlice(this, start, end);
|
29830
|
+
case "utf8":
|
29831
|
+
case "utf-8":
|
29832
|
+
return utf8Slice2(this, start, end);
|
29833
|
+
case "ascii":
|
29834
|
+
return asciiSlice(this, start, end);
|
29835
|
+
case "latin1":
|
29836
|
+
case "binary":
|
29837
|
+
return latin1Slice(this, start, end);
|
29838
|
+
case "base64":
|
29839
|
+
return base64Slice(this, start, end);
|
29840
|
+
case "ucs2":
|
29841
|
+
case "ucs-2":
|
29842
|
+
case "utf16le":
|
29843
|
+
case "utf-16le":
|
29844
|
+
return utf16leSlice(this, start, end);
|
29845
|
+
default:
|
29846
|
+
if (loweredCase)
|
29847
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
29848
|
+
encoding = (encoding + "").toLowerCase();
|
29849
|
+
loweredCase = true;
|
29850
|
+
}
|
29851
|
+
}
|
29852
|
+
}
|
29853
|
+
__name(slowToString, "slowToString");
|
29854
|
+
Buffer3.prototype._isBuffer = true;
|
29855
|
+
function swap(b, n, m) {
|
29856
|
+
var i = b[n];
|
29857
|
+
b[n] = b[m];
|
29858
|
+
b[m] = i;
|
29859
|
+
}
|
29860
|
+
__name(swap, "swap");
|
29861
|
+
Buffer3.prototype.swap16 = /* @__PURE__ */ __name(function swap16() {
|
29862
|
+
var len = this.length;
|
29863
|
+
if (len % 2 !== 0) {
|
29864
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
29865
|
+
}
|
29866
|
+
for (var i = 0; i < len; i += 2) {
|
29867
|
+
swap(this, i, i + 1);
|
29868
|
+
}
|
29869
|
+
return this;
|
29870
|
+
}, "swap16");
|
29871
|
+
Buffer3.prototype.swap32 = /* @__PURE__ */ __name(function swap32() {
|
29872
|
+
var len = this.length;
|
29873
|
+
if (len % 4 !== 0) {
|
29874
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
29875
|
+
}
|
29876
|
+
for (var i = 0; i < len; i += 4) {
|
29877
|
+
swap(this, i, i + 3);
|
29878
|
+
swap(this, i + 1, i + 2);
|
29879
|
+
}
|
29880
|
+
return this;
|
29881
|
+
}, "swap32");
|
29882
|
+
Buffer3.prototype.swap64 = /* @__PURE__ */ __name(function swap64() {
|
29883
|
+
var len = this.length;
|
29884
|
+
if (len % 8 !== 0) {
|
29885
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
29886
|
+
}
|
29887
|
+
for (var i = 0; i < len; i += 8) {
|
29888
|
+
swap(this, i, i + 7);
|
29889
|
+
swap(this, i + 1, i + 6);
|
29890
|
+
swap(this, i + 2, i + 5);
|
29891
|
+
swap(this, i + 3, i + 4);
|
29892
|
+
}
|
29893
|
+
return this;
|
29894
|
+
}, "swap64");
|
29895
|
+
Buffer3.prototype.toString = /* @__PURE__ */ __name(function toString6() {
|
29896
|
+
var length2 = this.length;
|
29897
|
+
if (length2 === 0)
|
29898
|
+
return "";
|
29899
|
+
if (arguments.length === 0)
|
29900
|
+
return utf8Slice2(this, 0, length2);
|
29901
|
+
return slowToString.apply(this, arguments);
|
29902
|
+
}, "toString");
|
29903
|
+
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
29904
|
+
Buffer3.prototype.equals = /* @__PURE__ */ __name(function equals4(b) {
|
29905
|
+
if (!Buffer3.isBuffer(b))
|
29906
|
+
throw new TypeError("Argument must be a Buffer");
|
29907
|
+
if (this === b)
|
29908
|
+
return true;
|
29909
|
+
return Buffer3.compare(this, b) === 0;
|
29910
|
+
}, "equals");
|
29911
|
+
Buffer3.prototype.inspect = /* @__PURE__ */ __name(function inspect5() {
|
29912
|
+
var str = "";
|
29913
|
+
var max = exports.INSPECT_MAX_BYTES;
|
29914
|
+
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
29915
|
+
if (this.length > max)
|
29916
|
+
str += " ... ";
|
29917
|
+
return "<Buffer " + str + ">";
|
29918
|
+
}, "inspect");
|
29919
|
+
if (customInspectSymbol) {
|
29920
|
+
Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
|
29921
|
+
}
|
29922
|
+
Buffer3.prototype.compare = /* @__PURE__ */ __name(function compare4(target, start, end, thisStart, thisEnd) {
|
29923
|
+
if (isInstance(target, Uint8Array)) {
|
29924
|
+
target = Buffer3.from(target, target.offset, target.byteLength);
|
29925
|
+
}
|
29926
|
+
if (!Buffer3.isBuffer(target)) {
|
29927
|
+
throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target);
|
29928
|
+
}
|
29929
|
+
if (start === void 0) {
|
29930
|
+
start = 0;
|
29931
|
+
}
|
29932
|
+
if (end === void 0) {
|
29933
|
+
end = target ? target.length : 0;
|
29934
|
+
}
|
29935
|
+
if (thisStart === void 0) {
|
29936
|
+
thisStart = 0;
|
29937
|
+
}
|
29938
|
+
if (thisEnd === void 0) {
|
29939
|
+
thisEnd = this.length;
|
29940
|
+
}
|
29941
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
29942
|
+
throw new RangeError("out of range index");
|
29943
|
+
}
|
29944
|
+
if (thisStart >= thisEnd && start >= end) {
|
29945
|
+
return 0;
|
29946
|
+
}
|
29947
|
+
if (thisStart >= thisEnd) {
|
29948
|
+
return -1;
|
29949
|
+
}
|
29950
|
+
if (start >= end) {
|
29951
|
+
return 1;
|
29952
|
+
}
|
29953
|
+
start >>>= 0;
|
29954
|
+
end >>>= 0;
|
29955
|
+
thisStart >>>= 0;
|
29956
|
+
thisEnd >>>= 0;
|
29957
|
+
if (this === target)
|
29958
|
+
return 0;
|
29959
|
+
var x = thisEnd - thisStart;
|
29960
|
+
var y = end - start;
|
29961
|
+
var len = Math.min(x, y);
|
29962
|
+
var thisCopy = this.slice(thisStart, thisEnd);
|
29963
|
+
var targetCopy = target.slice(start, end);
|
29964
|
+
for (var i = 0; i < len; ++i) {
|
29965
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
29966
|
+
x = thisCopy[i];
|
29967
|
+
y = targetCopy[i];
|
29968
|
+
break;
|
29969
|
+
}
|
29970
|
+
}
|
29971
|
+
if (x < y)
|
29972
|
+
return -1;
|
29973
|
+
if (y < x)
|
29974
|
+
return 1;
|
29975
|
+
return 0;
|
29976
|
+
}, "compare");
|
29977
|
+
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
|
29978
|
+
if (buffer2.length === 0)
|
29979
|
+
return -1;
|
29980
|
+
if (typeof byteOffset === "string") {
|
29981
|
+
encoding = byteOffset;
|
29982
|
+
byteOffset = 0;
|
29983
|
+
} else if (byteOffset > 2147483647) {
|
29984
|
+
byteOffset = 2147483647;
|
29985
|
+
} else if (byteOffset < -2147483648) {
|
29986
|
+
byteOffset = -2147483648;
|
29987
|
+
}
|
29988
|
+
byteOffset = +byteOffset;
|
29989
|
+
if (numberIsNaN(byteOffset)) {
|
29990
|
+
byteOffset = dir ? 0 : buffer2.length - 1;
|
29991
|
+
}
|
29992
|
+
if (byteOffset < 0)
|
29993
|
+
byteOffset = buffer2.length + byteOffset;
|
29994
|
+
if (byteOffset >= buffer2.length) {
|
29995
|
+
if (dir)
|
29996
|
+
return -1;
|
29997
|
+
else
|
29998
|
+
byteOffset = buffer2.length - 1;
|
29999
|
+
} else if (byteOffset < 0) {
|
30000
|
+
if (dir)
|
30001
|
+
byteOffset = 0;
|
30002
|
+
else
|
30003
|
+
return -1;
|
30004
|
+
}
|
30005
|
+
if (typeof val === "string") {
|
30006
|
+
val = Buffer3.from(val, encoding);
|
30007
|
+
}
|
30008
|
+
if (Buffer3.isBuffer(val)) {
|
30009
|
+
if (val.length === 0) {
|
30010
|
+
return -1;
|
30011
|
+
}
|
30012
|
+
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
|
30013
|
+
} else if (typeof val === "number") {
|
30014
|
+
val = val & 255;
|
30015
|
+
if (typeof Uint8Array.prototype.indexOf === "function") {
|
30016
|
+
if (dir) {
|
30017
|
+
return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
|
30018
|
+
} else {
|
30019
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
|
30020
|
+
}
|
30021
|
+
}
|
30022
|
+
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
|
30023
|
+
}
|
30024
|
+
throw new TypeError("val must be string, number or Buffer");
|
30025
|
+
}
|
30026
|
+
__name(bidirectionalIndexOf, "bidirectionalIndexOf");
|
30027
|
+
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
30028
|
+
var indexSize = 1;
|
30029
|
+
var arrLength = arr.length;
|
30030
|
+
var valLength = val.length;
|
30031
|
+
if (encoding !== void 0) {
|
30032
|
+
encoding = String(encoding).toLowerCase();
|
30033
|
+
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
|
30034
|
+
if (arr.length < 2 || val.length < 2) {
|
30035
|
+
return -1;
|
30036
|
+
}
|
30037
|
+
indexSize = 2;
|
30038
|
+
arrLength /= 2;
|
30039
|
+
valLength /= 2;
|
30040
|
+
byteOffset /= 2;
|
30041
|
+
}
|
30042
|
+
}
|
30043
|
+
function read2(buf2, i2) {
|
30044
|
+
if (indexSize === 1) {
|
30045
|
+
return buf2[i2];
|
30046
|
+
} else {
|
30047
|
+
return buf2.readUInt16BE(i2 * indexSize);
|
30048
|
+
}
|
30049
|
+
}
|
30050
|
+
__name(read2, "read");
|
30051
|
+
var i;
|
30052
|
+
if (dir) {
|
30053
|
+
var foundIndex = -1;
|
30054
|
+
for (i = byteOffset; i < arrLength; i++) {
|
30055
|
+
if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
30056
|
+
if (foundIndex === -1)
|
30057
|
+
foundIndex = i;
|
30058
|
+
if (i - foundIndex + 1 === valLength)
|
30059
|
+
return foundIndex * indexSize;
|
30060
|
+
} else {
|
30061
|
+
if (foundIndex !== -1)
|
30062
|
+
i -= i - foundIndex;
|
30063
|
+
foundIndex = -1;
|
30064
|
+
}
|
30065
|
+
}
|
30066
|
+
} else {
|
30067
|
+
if (byteOffset + valLength > arrLength)
|
30068
|
+
byteOffset = arrLength - valLength;
|
30069
|
+
for (i = byteOffset; i >= 0; i--) {
|
30070
|
+
var found = true;
|
30071
|
+
for (var j = 0; j < valLength; j++) {
|
30072
|
+
if (read2(arr, i + j) !== read2(val, j)) {
|
30073
|
+
found = false;
|
30074
|
+
break;
|
30075
|
+
}
|
30076
|
+
}
|
30077
|
+
if (found)
|
30078
|
+
return i;
|
30079
|
+
}
|
30080
|
+
}
|
30081
|
+
return -1;
|
30082
|
+
}
|
30083
|
+
__name(arrayIndexOf, "arrayIndexOf");
|
30084
|
+
Buffer3.prototype.includes = /* @__PURE__ */ __name(function includes(val, byteOffset, encoding) {
|
30085
|
+
return this.indexOf(val, byteOffset, encoding) !== -1;
|
30086
|
+
}, "includes");
|
30087
|
+
Buffer3.prototype.indexOf = /* @__PURE__ */ __name(function indexOf(val, byteOffset, encoding) {
|
30088
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
30089
|
+
}, "indexOf");
|
30090
|
+
Buffer3.prototype.lastIndexOf = /* @__PURE__ */ __name(function lastIndexOf(val, byteOffset, encoding) {
|
30091
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
30092
|
+
}, "lastIndexOf");
|
30093
|
+
function hexWrite(buf2, string2, offset, length2) {
|
30094
|
+
offset = Number(offset) || 0;
|
30095
|
+
var remaining = buf2.length - offset;
|
30096
|
+
if (!length2) {
|
30097
|
+
length2 = remaining;
|
30098
|
+
} else {
|
30099
|
+
length2 = Number(length2);
|
30100
|
+
if (length2 > remaining) {
|
30101
|
+
length2 = remaining;
|
30102
|
+
}
|
30103
|
+
}
|
30104
|
+
var strLen = string2.length;
|
30105
|
+
if (length2 > strLen / 2) {
|
30106
|
+
length2 = strLen / 2;
|
30107
|
+
}
|
30108
|
+
for (var i = 0; i < length2; ++i) {
|
30109
|
+
var parsed = parseInt(string2.substr(i * 2, 2), 16);
|
30110
|
+
if (numberIsNaN(parsed))
|
30111
|
+
return i;
|
30112
|
+
buf2[offset + i] = parsed;
|
30113
|
+
}
|
30114
|
+
return i;
|
30115
|
+
}
|
30116
|
+
__name(hexWrite, "hexWrite");
|
30117
|
+
function utf8Write(buf2, string2, offset, length2) {
|
30118
|
+
return blitBuffer(utf8ToBytes2(string2, buf2.length - offset), buf2, offset, length2);
|
30119
|
+
}
|
30120
|
+
__name(utf8Write, "utf8Write");
|
30121
|
+
function asciiWrite(buf2, string2, offset, length2) {
|
30122
|
+
return blitBuffer(asciiToBytes(string2), buf2, offset, length2);
|
30123
|
+
}
|
30124
|
+
__name(asciiWrite, "asciiWrite");
|
30125
|
+
function base64Write(buf2, string2, offset, length2) {
|
30126
|
+
return blitBuffer(base64ToBytes2(string2), buf2, offset, length2);
|
30127
|
+
}
|
30128
|
+
__name(base64Write, "base64Write");
|
30129
|
+
function ucs2Write(buf2, string2, offset, length2) {
|
30130
|
+
return blitBuffer(utf16leToBytes(string2, buf2.length - offset), buf2, offset, length2);
|
30131
|
+
}
|
30132
|
+
__name(ucs2Write, "ucs2Write");
|
30133
|
+
Buffer3.prototype.write = /* @__PURE__ */ __name(function write(string2, offset, length2, encoding) {
|
30134
|
+
if (offset === void 0) {
|
30135
|
+
encoding = "utf8";
|
30136
|
+
length2 = this.length;
|
30137
|
+
offset = 0;
|
30138
|
+
} else if (length2 === void 0 && typeof offset === "string") {
|
30139
|
+
encoding = offset;
|
30140
|
+
length2 = this.length;
|
30141
|
+
offset = 0;
|
30142
|
+
} else if (isFinite(offset)) {
|
30143
|
+
offset = offset >>> 0;
|
30144
|
+
if (isFinite(length2)) {
|
30145
|
+
length2 = length2 >>> 0;
|
30146
|
+
if (encoding === void 0)
|
30147
|
+
encoding = "utf8";
|
30148
|
+
} else {
|
30149
|
+
encoding = length2;
|
30150
|
+
length2 = void 0;
|
30151
|
+
}
|
30152
|
+
} else {
|
30153
|
+
throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
|
30154
|
+
}
|
30155
|
+
var remaining = this.length - offset;
|
30156
|
+
if (length2 === void 0 || length2 > remaining)
|
30157
|
+
length2 = remaining;
|
30158
|
+
if (string2.length > 0 && (length2 < 0 || offset < 0) || offset > this.length) {
|
30159
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
30160
|
+
}
|
30161
|
+
if (!encoding)
|
30162
|
+
encoding = "utf8";
|
30163
|
+
var loweredCase = false;
|
30164
|
+
for (; ; ) {
|
30165
|
+
switch (encoding) {
|
30166
|
+
case "hex":
|
30167
|
+
return hexWrite(this, string2, offset, length2);
|
30168
|
+
case "utf8":
|
30169
|
+
case "utf-8":
|
30170
|
+
return utf8Write(this, string2, offset, length2);
|
30171
|
+
case "ascii":
|
30172
|
+
case "latin1":
|
30173
|
+
case "binary":
|
30174
|
+
return asciiWrite(this, string2, offset, length2);
|
30175
|
+
case "base64":
|
30176
|
+
return base64Write(this, string2, offset, length2);
|
30177
|
+
case "ucs2":
|
30178
|
+
case "ucs-2":
|
30179
|
+
case "utf16le":
|
30180
|
+
case "utf-16le":
|
30181
|
+
return ucs2Write(this, string2, offset, length2);
|
30182
|
+
default:
|
30183
|
+
if (loweredCase)
|
30184
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
30185
|
+
encoding = ("" + encoding).toLowerCase();
|
30186
|
+
loweredCase = true;
|
30187
|
+
}
|
30188
|
+
}
|
30189
|
+
}, "write");
|
30190
|
+
Buffer3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON2() {
|
30191
|
+
return {
|
30192
|
+
type: "Buffer",
|
30193
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
30194
|
+
};
|
30195
|
+
}, "toJSON");
|
30196
|
+
function base64Slice(buf2, start, end) {
|
30197
|
+
if (start === 0 && end === buf2.length) {
|
30198
|
+
return base642.fromByteArray(buf2);
|
30199
|
+
} else {
|
30200
|
+
return base642.fromByteArray(buf2.slice(start, end));
|
30201
|
+
}
|
30202
|
+
}
|
30203
|
+
__name(base64Slice, "base64Slice");
|
30204
|
+
function utf8Slice2(buf2, start, end) {
|
30205
|
+
end = Math.min(buf2.length, end);
|
30206
|
+
var res = [];
|
30207
|
+
var i = start;
|
30208
|
+
while (i < end) {
|
30209
|
+
var firstByte = buf2[i];
|
30210
|
+
var codePoint = null;
|
30211
|
+
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
|
30212
|
+
if (i + bytesPerSequence <= end) {
|
30213
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
30214
|
+
switch (bytesPerSequence) {
|
30215
|
+
case 1:
|
30216
|
+
if (firstByte < 128) {
|
30217
|
+
codePoint = firstByte;
|
30218
|
+
}
|
30219
|
+
break;
|
30220
|
+
case 2:
|
30221
|
+
secondByte = buf2[i + 1];
|
30222
|
+
if ((secondByte & 192) === 128) {
|
30223
|
+
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
|
30224
|
+
if (tempCodePoint > 127) {
|
30225
|
+
codePoint = tempCodePoint;
|
30226
|
+
}
|
30227
|
+
}
|
30228
|
+
break;
|
30229
|
+
case 3:
|
30230
|
+
secondByte = buf2[i + 1];
|
30231
|
+
thirdByte = buf2[i + 2];
|
30232
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
|
30233
|
+
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
|
30234
|
+
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
|
30235
|
+
codePoint = tempCodePoint;
|
30236
|
+
}
|
30237
|
+
}
|
30238
|
+
break;
|
30239
|
+
case 4:
|
30240
|
+
secondByte = buf2[i + 1];
|
30241
|
+
thirdByte = buf2[i + 2];
|
30242
|
+
fourthByte = buf2[i + 3];
|
30243
|
+
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
|
30244
|
+
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
|
30245
|
+
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
|
30246
|
+
codePoint = tempCodePoint;
|
30247
|
+
}
|
30248
|
+
}
|
30249
|
+
}
|
30250
|
+
}
|
30251
|
+
if (codePoint === null) {
|
30252
|
+
codePoint = 65533;
|
30253
|
+
bytesPerSequence = 1;
|
30254
|
+
} else if (codePoint > 65535) {
|
30255
|
+
codePoint -= 65536;
|
30256
|
+
res.push(codePoint >>> 10 & 1023 | 55296);
|
30257
|
+
codePoint = 56320 | codePoint & 1023;
|
30258
|
+
}
|
30259
|
+
res.push(codePoint);
|
30260
|
+
i += bytesPerSequence;
|
30261
|
+
}
|
30262
|
+
return decodeCodePointsArray2(res);
|
30263
|
+
}
|
30264
|
+
__name(utf8Slice2, "utf8Slice");
|
30265
|
+
var MAX_ARGUMENTS_LENGTH2 = 4096;
|
30266
|
+
function decodeCodePointsArray2(codePoints) {
|
30267
|
+
var len = codePoints.length;
|
30268
|
+
if (len <= MAX_ARGUMENTS_LENGTH2) {
|
30269
|
+
return String.fromCharCode.apply(String, codePoints);
|
30270
|
+
}
|
30271
|
+
var res = "";
|
30272
|
+
var i = 0;
|
30273
|
+
while (i < len) {
|
30274
|
+
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH2));
|
30275
|
+
}
|
30276
|
+
return res;
|
30277
|
+
}
|
30278
|
+
__name(decodeCodePointsArray2, "decodeCodePointsArray");
|
30279
|
+
function asciiSlice(buf2, start, end) {
|
30280
|
+
var ret = "";
|
30281
|
+
end = Math.min(buf2.length, end);
|
30282
|
+
for (var i = start; i < end; ++i) {
|
30283
|
+
ret += String.fromCharCode(buf2[i] & 127);
|
30284
|
+
}
|
30285
|
+
return ret;
|
30286
|
+
}
|
30287
|
+
__name(asciiSlice, "asciiSlice");
|
30288
|
+
function latin1Slice(buf2, start, end) {
|
30289
|
+
var ret = "";
|
30290
|
+
end = Math.min(buf2.length, end);
|
30291
|
+
for (var i = start; i < end; ++i) {
|
30292
|
+
ret += String.fromCharCode(buf2[i]);
|
30293
|
+
}
|
30294
|
+
return ret;
|
30295
|
+
}
|
30296
|
+
__name(latin1Slice, "latin1Slice");
|
30297
|
+
function hexSlice(buf2, start, end) {
|
30298
|
+
var len = buf2.length;
|
30299
|
+
if (!start || start < 0)
|
30300
|
+
start = 0;
|
30301
|
+
if (!end || end < 0 || end > len)
|
30302
|
+
end = len;
|
30303
|
+
var out = "";
|
30304
|
+
for (var i = start; i < end; ++i) {
|
30305
|
+
out += hexSliceLookupTable[buf2[i]];
|
30306
|
+
}
|
30307
|
+
return out;
|
30308
|
+
}
|
30309
|
+
__name(hexSlice, "hexSlice");
|
30310
|
+
function utf16leSlice(buf2, start, end) {
|
30311
|
+
var bytes = buf2.slice(start, end);
|
30312
|
+
var res = "";
|
30313
|
+
for (var i = 0; i < bytes.length - 1; i += 2) {
|
30314
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
30315
|
+
}
|
30316
|
+
return res;
|
30317
|
+
}
|
30318
|
+
__name(utf16leSlice, "utf16leSlice");
|
30319
|
+
Buffer3.prototype.slice = /* @__PURE__ */ __name(function slice2(start, end) {
|
30320
|
+
var len = this.length;
|
30321
|
+
start = ~~start;
|
30322
|
+
end = end === void 0 ? len : ~~end;
|
30323
|
+
if (start < 0) {
|
30324
|
+
start += len;
|
30325
|
+
if (start < 0)
|
30326
|
+
start = 0;
|
30327
|
+
} else if (start > len) {
|
30328
|
+
start = len;
|
30329
|
+
}
|
30330
|
+
if (end < 0) {
|
30331
|
+
end += len;
|
30332
|
+
if (end < 0)
|
30333
|
+
end = 0;
|
30334
|
+
} else if (end > len) {
|
30335
|
+
end = len;
|
30336
|
+
}
|
30337
|
+
if (end < start)
|
30338
|
+
end = start;
|
30339
|
+
var newBuf = this.subarray(start, end);
|
30340
|
+
Object.setPrototypeOf(newBuf, Buffer3.prototype);
|
30341
|
+
return newBuf;
|
30342
|
+
}, "slice");
|
30343
|
+
function checkOffset(offset, ext, length2) {
|
30344
|
+
if (offset % 1 !== 0 || offset < 0)
|
30345
|
+
throw new RangeError("offset is not uint");
|
30346
|
+
if (offset + ext > length2)
|
30347
|
+
throw new RangeError("Trying to access beyond buffer length");
|
30348
|
+
}
|
30349
|
+
__name(checkOffset, "checkOffset");
|
30350
|
+
Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = /* @__PURE__ */ __name(function readUIntLE(offset, byteLength2, noAssert) {
|
30351
|
+
offset = offset >>> 0;
|
30352
|
+
byteLength2 = byteLength2 >>> 0;
|
30353
|
+
if (!noAssert)
|
30354
|
+
checkOffset(offset, byteLength2, this.length);
|
30355
|
+
var val = this[offset];
|
30356
|
+
var mul3 = 1;
|
30357
|
+
var i = 0;
|
30358
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30359
|
+
val += this[offset + i] * mul3;
|
30360
|
+
}
|
30361
|
+
return val;
|
30362
|
+
}, "readUIntLE");
|
30363
|
+
Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = /* @__PURE__ */ __name(function readUIntBE(offset, byteLength2, noAssert) {
|
30364
|
+
offset = offset >>> 0;
|
30365
|
+
byteLength2 = byteLength2 >>> 0;
|
30366
|
+
if (!noAssert) {
|
30367
|
+
checkOffset(offset, byteLength2, this.length);
|
30368
|
+
}
|
30369
|
+
var val = this[offset + --byteLength2];
|
30370
|
+
var mul3 = 1;
|
30371
|
+
while (byteLength2 > 0 && (mul3 *= 256)) {
|
30372
|
+
val += this[offset + --byteLength2] * mul3;
|
30373
|
+
}
|
30374
|
+
return val;
|
30375
|
+
}, "readUIntBE");
|
30376
|
+
Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = /* @__PURE__ */ __name(function readUInt8(offset, noAssert) {
|
30377
|
+
offset = offset >>> 0;
|
30378
|
+
if (!noAssert)
|
30379
|
+
checkOffset(offset, 1, this.length);
|
30380
|
+
return this[offset];
|
30381
|
+
}, "readUInt8");
|
30382
|
+
Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = /* @__PURE__ */ __name(function readUInt16LE(offset, noAssert) {
|
30383
|
+
offset = offset >>> 0;
|
30384
|
+
if (!noAssert)
|
30385
|
+
checkOffset(offset, 2, this.length);
|
30386
|
+
return this[offset] | this[offset + 1] << 8;
|
30387
|
+
}, "readUInt16LE");
|
30388
|
+
Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = /* @__PURE__ */ __name(function readUInt16BE(offset, noAssert) {
|
30389
|
+
offset = offset >>> 0;
|
30390
|
+
if (!noAssert)
|
30391
|
+
checkOffset(offset, 2, this.length);
|
30392
|
+
return this[offset] << 8 | this[offset + 1];
|
30393
|
+
}, "readUInt16BE");
|
30394
|
+
Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = /* @__PURE__ */ __name(function readUInt32LE(offset, noAssert) {
|
30395
|
+
offset = offset >>> 0;
|
30396
|
+
if (!noAssert)
|
30397
|
+
checkOffset(offset, 4, this.length);
|
30398
|
+
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
30399
|
+
}, "readUInt32LE");
|
30400
|
+
Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = /* @__PURE__ */ __name(function readUInt32BE(offset, noAssert) {
|
30401
|
+
offset = offset >>> 0;
|
30402
|
+
if (!noAssert)
|
30403
|
+
checkOffset(offset, 4, this.length);
|
30404
|
+
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
30405
|
+
}, "readUInt32BE");
|
30406
|
+
Buffer3.prototype.readIntLE = /* @__PURE__ */ __name(function readIntLE(offset, byteLength2, noAssert) {
|
30407
|
+
offset = offset >>> 0;
|
30408
|
+
byteLength2 = byteLength2 >>> 0;
|
30409
|
+
if (!noAssert)
|
30410
|
+
checkOffset(offset, byteLength2, this.length);
|
30411
|
+
var val = this[offset];
|
30412
|
+
var mul3 = 1;
|
30413
|
+
var i = 0;
|
30414
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30415
|
+
val += this[offset + i] * mul3;
|
30416
|
+
}
|
30417
|
+
mul3 *= 128;
|
30418
|
+
if (val >= mul3)
|
30419
|
+
val -= Math.pow(2, 8 * byteLength2);
|
30420
|
+
return val;
|
30421
|
+
}, "readIntLE");
|
30422
|
+
Buffer3.prototype.readIntBE = /* @__PURE__ */ __name(function readIntBE(offset, byteLength2, noAssert) {
|
30423
|
+
offset = offset >>> 0;
|
30424
|
+
byteLength2 = byteLength2 >>> 0;
|
30425
|
+
if (!noAssert)
|
30426
|
+
checkOffset(offset, byteLength2, this.length);
|
30427
|
+
var i = byteLength2;
|
30428
|
+
var mul3 = 1;
|
30429
|
+
var val = this[offset + --i];
|
30430
|
+
while (i > 0 && (mul3 *= 256)) {
|
30431
|
+
val += this[offset + --i] * mul3;
|
30432
|
+
}
|
30433
|
+
mul3 *= 128;
|
30434
|
+
if (val >= mul3)
|
30435
|
+
val -= Math.pow(2, 8 * byteLength2);
|
30436
|
+
return val;
|
30437
|
+
}, "readIntBE");
|
30438
|
+
Buffer3.prototype.readInt8 = /* @__PURE__ */ __name(function readInt8(offset, noAssert) {
|
30439
|
+
offset = offset >>> 0;
|
30440
|
+
if (!noAssert)
|
30441
|
+
checkOffset(offset, 1, this.length);
|
30442
|
+
if (!(this[offset] & 128))
|
30443
|
+
return this[offset];
|
30444
|
+
return (255 - this[offset] + 1) * -1;
|
30445
|
+
}, "readInt8");
|
30446
|
+
Buffer3.prototype.readInt16LE = /* @__PURE__ */ __name(function readInt16LE(offset, noAssert) {
|
30447
|
+
offset = offset >>> 0;
|
30448
|
+
if (!noAssert)
|
30449
|
+
checkOffset(offset, 2, this.length);
|
30450
|
+
var val = this[offset] | this[offset + 1] << 8;
|
30451
|
+
return val & 32768 ? val | 4294901760 : val;
|
30452
|
+
}, "readInt16LE");
|
30453
|
+
Buffer3.prototype.readInt16BE = /* @__PURE__ */ __name(function readInt16BE(offset, noAssert) {
|
30454
|
+
offset = offset >>> 0;
|
30455
|
+
if (!noAssert)
|
30456
|
+
checkOffset(offset, 2, this.length);
|
30457
|
+
var val = this[offset + 1] | this[offset] << 8;
|
30458
|
+
return val & 32768 ? val | 4294901760 : val;
|
30459
|
+
}, "readInt16BE");
|
30460
|
+
Buffer3.prototype.readInt32LE = /* @__PURE__ */ __name(function readInt32LE(offset, noAssert) {
|
30461
|
+
offset = offset >>> 0;
|
30462
|
+
if (!noAssert)
|
30463
|
+
checkOffset(offset, 4, this.length);
|
30464
|
+
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
30465
|
+
}, "readInt32LE");
|
30466
|
+
Buffer3.prototype.readInt32BE = /* @__PURE__ */ __name(function readInt32BE(offset, noAssert) {
|
30467
|
+
offset = offset >>> 0;
|
30468
|
+
if (!noAssert)
|
30469
|
+
checkOffset(offset, 4, this.length);
|
30470
|
+
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
30471
|
+
}, "readInt32BE");
|
30472
|
+
Buffer3.prototype.readFloatLE = /* @__PURE__ */ __name(function readFloatLE(offset, noAssert) {
|
30473
|
+
offset = offset >>> 0;
|
30474
|
+
if (!noAssert)
|
30475
|
+
checkOffset(offset, 4, this.length);
|
30476
|
+
return ieee754.read(this, offset, true, 23, 4);
|
30477
|
+
}, "readFloatLE");
|
30478
|
+
Buffer3.prototype.readFloatBE = /* @__PURE__ */ __name(function readFloatBE(offset, noAssert) {
|
30479
|
+
offset = offset >>> 0;
|
30480
|
+
if (!noAssert)
|
30481
|
+
checkOffset(offset, 4, this.length);
|
30482
|
+
return ieee754.read(this, offset, false, 23, 4);
|
30483
|
+
}, "readFloatBE");
|
30484
|
+
Buffer3.prototype.readDoubleLE = /* @__PURE__ */ __name(function readDoubleLE(offset, noAssert) {
|
30485
|
+
offset = offset >>> 0;
|
30486
|
+
if (!noAssert)
|
30487
|
+
checkOffset(offset, 8, this.length);
|
30488
|
+
return ieee754.read(this, offset, true, 52, 8);
|
30489
|
+
}, "readDoubleLE");
|
30490
|
+
Buffer3.prototype.readDoubleBE = /* @__PURE__ */ __name(function readDoubleBE(offset, noAssert) {
|
30491
|
+
offset = offset >>> 0;
|
30492
|
+
if (!noAssert)
|
30493
|
+
checkOffset(offset, 8, this.length);
|
30494
|
+
return ieee754.read(this, offset, false, 52, 8);
|
30495
|
+
}, "readDoubleBE");
|
30496
|
+
function checkInt(buf2, value, offset, ext, max, min) {
|
30497
|
+
if (!Buffer3.isBuffer(buf2))
|
30498
|
+
throw new TypeError('"buffer" argument must be a Buffer instance');
|
30499
|
+
if (value > max || value < min)
|
30500
|
+
throw new RangeError('"value" argument is out of bounds');
|
30501
|
+
if (offset + ext > buf2.length)
|
30502
|
+
throw new RangeError("Index out of range");
|
30503
|
+
}
|
30504
|
+
__name(checkInt, "checkInt");
|
30505
|
+
Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = /* @__PURE__ */ __name(function writeUIntLE(value, offset, byteLength2, noAssert) {
|
30506
|
+
value = +value;
|
30507
|
+
offset = offset >>> 0;
|
30508
|
+
byteLength2 = byteLength2 >>> 0;
|
30509
|
+
if (!noAssert) {
|
30510
|
+
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
30511
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
30512
|
+
}
|
30513
|
+
var mul3 = 1;
|
30514
|
+
var i = 0;
|
30515
|
+
this[offset] = value & 255;
|
30516
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30517
|
+
this[offset + i] = value / mul3 & 255;
|
30518
|
+
}
|
30519
|
+
return offset + byteLength2;
|
30520
|
+
}, "writeUIntLE");
|
30521
|
+
Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = /* @__PURE__ */ __name(function writeUIntBE(value, offset, byteLength2, noAssert) {
|
30522
|
+
value = +value;
|
30523
|
+
offset = offset >>> 0;
|
30524
|
+
byteLength2 = byteLength2 >>> 0;
|
30525
|
+
if (!noAssert) {
|
30526
|
+
var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
|
30527
|
+
checkInt(this, value, offset, byteLength2, maxBytes, 0);
|
30528
|
+
}
|
30529
|
+
var i = byteLength2 - 1;
|
30530
|
+
var mul3 = 1;
|
30531
|
+
this[offset + i] = value & 255;
|
30532
|
+
while (--i >= 0 && (mul3 *= 256)) {
|
30533
|
+
this[offset + i] = value / mul3 & 255;
|
30534
|
+
}
|
30535
|
+
return offset + byteLength2;
|
30536
|
+
}, "writeUIntBE");
|
30537
|
+
Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = /* @__PURE__ */ __name(function writeUInt8(value, offset, noAssert) {
|
30538
|
+
value = +value;
|
30539
|
+
offset = offset >>> 0;
|
30540
|
+
if (!noAssert)
|
30541
|
+
checkInt(this, value, offset, 1, 255, 0);
|
30542
|
+
this[offset] = value & 255;
|
30543
|
+
return offset + 1;
|
30544
|
+
}, "writeUInt8");
|
30545
|
+
Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = /* @__PURE__ */ __name(function writeUInt16LE(value, offset, noAssert) {
|
30546
|
+
value = +value;
|
30547
|
+
offset = offset >>> 0;
|
30548
|
+
if (!noAssert)
|
30549
|
+
checkInt(this, value, offset, 2, 65535, 0);
|
30550
|
+
this[offset] = value & 255;
|
30551
|
+
this[offset + 1] = value >>> 8;
|
30552
|
+
return offset + 2;
|
30553
|
+
}, "writeUInt16LE");
|
30554
|
+
Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = /* @__PURE__ */ __name(function writeUInt16BE(value, offset, noAssert) {
|
30555
|
+
value = +value;
|
30556
|
+
offset = offset >>> 0;
|
30557
|
+
if (!noAssert)
|
30558
|
+
checkInt(this, value, offset, 2, 65535, 0);
|
30559
|
+
this[offset] = value >>> 8;
|
30560
|
+
this[offset + 1] = value & 255;
|
30561
|
+
return offset + 2;
|
30562
|
+
}, "writeUInt16BE");
|
30563
|
+
Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = /* @__PURE__ */ __name(function writeUInt32LE(value, offset, noAssert) {
|
30564
|
+
value = +value;
|
30565
|
+
offset = offset >>> 0;
|
30566
|
+
if (!noAssert)
|
30567
|
+
checkInt(this, value, offset, 4, 4294967295, 0);
|
30568
|
+
this[offset + 3] = value >>> 24;
|
30569
|
+
this[offset + 2] = value >>> 16;
|
30570
|
+
this[offset + 1] = value >>> 8;
|
30571
|
+
this[offset] = value & 255;
|
30572
|
+
return offset + 4;
|
30573
|
+
}, "writeUInt32LE");
|
30574
|
+
Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = /* @__PURE__ */ __name(function writeUInt32BE(value, offset, noAssert) {
|
30575
|
+
value = +value;
|
30576
|
+
offset = offset >>> 0;
|
30577
|
+
if (!noAssert)
|
30578
|
+
checkInt(this, value, offset, 4, 4294967295, 0);
|
30579
|
+
this[offset] = value >>> 24;
|
30580
|
+
this[offset + 1] = value >>> 16;
|
30581
|
+
this[offset + 2] = value >>> 8;
|
30582
|
+
this[offset + 3] = value & 255;
|
30583
|
+
return offset + 4;
|
30584
|
+
}, "writeUInt32BE");
|
30585
|
+
Buffer3.prototype.writeIntLE = /* @__PURE__ */ __name(function writeIntLE(value, offset, byteLength2, noAssert) {
|
30586
|
+
value = +value;
|
30587
|
+
offset = offset >>> 0;
|
30588
|
+
if (!noAssert) {
|
30589
|
+
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
30590
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
30591
|
+
}
|
30592
|
+
var i = 0;
|
30593
|
+
var mul3 = 1;
|
30594
|
+
var sub = 0;
|
30595
|
+
this[offset] = value & 255;
|
30596
|
+
while (++i < byteLength2 && (mul3 *= 256)) {
|
30597
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
30598
|
+
sub = 1;
|
30599
|
+
}
|
30600
|
+
this[offset + i] = (value / mul3 >> 0) - sub & 255;
|
30601
|
+
}
|
30602
|
+
return offset + byteLength2;
|
30603
|
+
}, "writeIntLE");
|
30604
|
+
Buffer3.prototype.writeIntBE = /* @__PURE__ */ __name(function writeIntBE(value, offset, byteLength2, noAssert) {
|
30605
|
+
value = +value;
|
30606
|
+
offset = offset >>> 0;
|
30607
|
+
if (!noAssert) {
|
30608
|
+
var limit = Math.pow(2, 8 * byteLength2 - 1);
|
30609
|
+
checkInt(this, value, offset, byteLength2, limit - 1, -limit);
|
30610
|
+
}
|
30611
|
+
var i = byteLength2 - 1;
|
30612
|
+
var mul3 = 1;
|
30613
|
+
var sub = 0;
|
30614
|
+
this[offset + i] = value & 255;
|
30615
|
+
while (--i >= 0 && (mul3 *= 256)) {
|
30616
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
30617
|
+
sub = 1;
|
30618
|
+
}
|
30619
|
+
this[offset + i] = (value / mul3 >> 0) - sub & 255;
|
30620
|
+
}
|
30621
|
+
return offset + byteLength2;
|
30622
|
+
}, "writeIntBE");
|
30623
|
+
Buffer3.prototype.writeInt8 = /* @__PURE__ */ __name(function writeInt8(value, offset, noAssert) {
|
30624
|
+
value = +value;
|
30625
|
+
offset = offset >>> 0;
|
30626
|
+
if (!noAssert)
|
30627
|
+
checkInt(this, value, offset, 1, 127, -128);
|
30628
|
+
if (value < 0)
|
30629
|
+
value = 255 + value + 1;
|
30630
|
+
this[offset] = value & 255;
|
30631
|
+
return offset + 1;
|
30632
|
+
}, "writeInt8");
|
30633
|
+
Buffer3.prototype.writeInt16LE = /* @__PURE__ */ __name(function writeInt16LE(value, offset, noAssert) {
|
30634
|
+
value = +value;
|
30635
|
+
offset = offset >>> 0;
|
30636
|
+
if (!noAssert)
|
30637
|
+
checkInt(this, value, offset, 2, 32767, -32768);
|
30638
|
+
this[offset] = value & 255;
|
30639
|
+
this[offset + 1] = value >>> 8;
|
30640
|
+
return offset + 2;
|
30641
|
+
}, "writeInt16LE");
|
30642
|
+
Buffer3.prototype.writeInt16BE = /* @__PURE__ */ __name(function writeInt16BE(value, offset, noAssert) {
|
30643
|
+
value = +value;
|
30644
|
+
offset = offset >>> 0;
|
30645
|
+
if (!noAssert)
|
30646
|
+
checkInt(this, value, offset, 2, 32767, -32768);
|
30647
|
+
this[offset] = value >>> 8;
|
30648
|
+
this[offset + 1] = value & 255;
|
30649
|
+
return offset + 2;
|
30650
|
+
}, "writeInt16BE");
|
30651
|
+
Buffer3.prototype.writeInt32LE = /* @__PURE__ */ __name(function writeInt32LE(value, offset, noAssert) {
|
30652
|
+
value = +value;
|
30653
|
+
offset = offset >>> 0;
|
30654
|
+
if (!noAssert)
|
30655
|
+
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
30656
|
+
this[offset] = value & 255;
|
30657
|
+
this[offset + 1] = value >>> 8;
|
30658
|
+
this[offset + 2] = value >>> 16;
|
30659
|
+
this[offset + 3] = value >>> 24;
|
30660
|
+
return offset + 4;
|
30661
|
+
}, "writeInt32LE");
|
30662
|
+
Buffer3.prototype.writeInt32BE = /* @__PURE__ */ __name(function writeInt32BE(value, offset, noAssert) {
|
30663
|
+
value = +value;
|
30664
|
+
offset = offset >>> 0;
|
30665
|
+
if (!noAssert)
|
30666
|
+
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
30667
|
+
if (value < 0)
|
30668
|
+
value = 4294967295 + value + 1;
|
30669
|
+
this[offset] = value >>> 24;
|
30670
|
+
this[offset + 1] = value >>> 16;
|
30671
|
+
this[offset + 2] = value >>> 8;
|
30672
|
+
this[offset + 3] = value & 255;
|
30673
|
+
return offset + 4;
|
30674
|
+
}, "writeInt32BE");
|
30675
|
+
function checkIEEE754(buf2, value, offset, ext, max, min) {
|
30676
|
+
if (offset + ext > buf2.length)
|
30677
|
+
throw new RangeError("Index out of range");
|
30678
|
+
if (offset < 0)
|
30679
|
+
throw new RangeError("Index out of range");
|
30680
|
+
}
|
30681
|
+
__name(checkIEEE754, "checkIEEE754");
|
30682
|
+
function writeFloat(buf2, value, offset, littleEndian, noAssert) {
|
30683
|
+
value = +value;
|
30684
|
+
offset = offset >>> 0;
|
30685
|
+
if (!noAssert) {
|
30686
|
+
checkIEEE754(buf2, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
|
30687
|
+
}
|
30688
|
+
ieee754.write(buf2, value, offset, littleEndian, 23, 4);
|
30689
|
+
return offset + 4;
|
30690
|
+
}
|
30691
|
+
__name(writeFloat, "writeFloat");
|
30692
|
+
Buffer3.prototype.writeFloatLE = /* @__PURE__ */ __name(function writeFloatLE(value, offset, noAssert) {
|
30693
|
+
return writeFloat(this, value, offset, true, noAssert);
|
30694
|
+
}, "writeFloatLE");
|
30695
|
+
Buffer3.prototype.writeFloatBE = /* @__PURE__ */ __name(function writeFloatBE(value, offset, noAssert) {
|
30696
|
+
return writeFloat(this, value, offset, false, noAssert);
|
30697
|
+
}, "writeFloatBE");
|
30698
|
+
function writeDouble(buf2, value, offset, littleEndian, noAssert) {
|
30699
|
+
value = +value;
|
30700
|
+
offset = offset >>> 0;
|
30701
|
+
if (!noAssert) {
|
30702
|
+
checkIEEE754(buf2, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
|
30703
|
+
}
|
30704
|
+
ieee754.write(buf2, value, offset, littleEndian, 52, 8);
|
30705
|
+
return offset + 8;
|
30706
|
+
}
|
30707
|
+
__name(writeDouble, "writeDouble");
|
30708
|
+
Buffer3.prototype.writeDoubleLE = /* @__PURE__ */ __name(function writeDoubleLE(value, offset, noAssert) {
|
30709
|
+
return writeDouble(this, value, offset, true, noAssert);
|
30710
|
+
}, "writeDoubleLE");
|
30711
|
+
Buffer3.prototype.writeDoubleBE = /* @__PURE__ */ __name(function writeDoubleBE(value, offset, noAssert) {
|
30712
|
+
return writeDouble(this, value, offset, false, noAssert);
|
30713
|
+
}, "writeDoubleBE");
|
30714
|
+
Buffer3.prototype.copy = /* @__PURE__ */ __name(function copy(target, targetStart, start, end) {
|
30715
|
+
if (!Buffer3.isBuffer(target))
|
30716
|
+
throw new TypeError("argument should be a Buffer");
|
30717
|
+
if (!start)
|
30718
|
+
start = 0;
|
30719
|
+
if (!end && end !== 0)
|
30720
|
+
end = this.length;
|
30721
|
+
if (targetStart >= target.length)
|
30722
|
+
targetStart = target.length;
|
30723
|
+
if (!targetStart)
|
30724
|
+
targetStart = 0;
|
30725
|
+
if (end > 0 && end < start)
|
30726
|
+
end = start;
|
30727
|
+
if (end === start)
|
30728
|
+
return 0;
|
30729
|
+
if (target.length === 0 || this.length === 0)
|
30730
|
+
return 0;
|
30731
|
+
if (targetStart < 0) {
|
30732
|
+
throw new RangeError("targetStart out of bounds");
|
30733
|
+
}
|
30734
|
+
if (start < 0 || start >= this.length)
|
30735
|
+
throw new RangeError("Index out of range");
|
30736
|
+
if (end < 0)
|
30737
|
+
throw new RangeError("sourceEnd out of bounds");
|
30738
|
+
if (end > this.length)
|
30739
|
+
end = this.length;
|
30740
|
+
if (target.length - targetStart < end - start) {
|
30741
|
+
end = target.length - targetStart + start;
|
30742
|
+
}
|
30743
|
+
var len = end - start;
|
30744
|
+
if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
|
30745
|
+
this.copyWithin(targetStart, start, end);
|
30746
|
+
} else {
|
30747
|
+
Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
|
30748
|
+
}
|
30749
|
+
return len;
|
30750
|
+
}, "copy");
|
30751
|
+
Buffer3.prototype.fill = /* @__PURE__ */ __name(function fill(val, start, end, encoding) {
|
30752
|
+
if (typeof val === "string") {
|
30753
|
+
if (typeof start === "string") {
|
30754
|
+
encoding = start;
|
30755
|
+
start = 0;
|
30756
|
+
end = this.length;
|
30757
|
+
} else if (typeof end === "string") {
|
30758
|
+
encoding = end;
|
30759
|
+
end = this.length;
|
30760
|
+
}
|
30761
|
+
if (encoding !== void 0 && typeof encoding !== "string") {
|
30762
|
+
throw new TypeError("encoding must be a string");
|
30763
|
+
}
|
30764
|
+
if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
|
30765
|
+
throw new TypeError("Unknown encoding: " + encoding);
|
30766
|
+
}
|
30767
|
+
if (val.length === 1) {
|
30768
|
+
var code5 = val.charCodeAt(0);
|
30769
|
+
if (encoding === "utf8" && code5 < 128 || encoding === "latin1") {
|
30770
|
+
val = code5;
|
30771
|
+
}
|
30772
|
+
}
|
30773
|
+
} else if (typeof val === "number") {
|
30774
|
+
val = val & 255;
|
30775
|
+
} else if (typeof val === "boolean") {
|
30776
|
+
val = Number(val);
|
30777
|
+
}
|
30778
|
+
if (start < 0 || this.length < start || this.length < end) {
|
30779
|
+
throw new RangeError("Out of range index");
|
30780
|
+
}
|
30781
|
+
if (end <= start) {
|
30782
|
+
return this;
|
30783
|
+
}
|
30784
|
+
start = start >>> 0;
|
30785
|
+
end = end === void 0 ? this.length : end >>> 0;
|
30786
|
+
if (!val)
|
30787
|
+
val = 0;
|
30788
|
+
var i;
|
30789
|
+
if (typeof val === "number") {
|
30790
|
+
for (i = start; i < end; ++i) {
|
30791
|
+
this[i] = val;
|
30792
|
+
}
|
30793
|
+
} else {
|
30794
|
+
var bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
|
30795
|
+
var len = bytes.length;
|
30796
|
+
if (len === 0) {
|
30797
|
+
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
30798
|
+
}
|
30799
|
+
for (i = 0; i < end - start; ++i) {
|
30800
|
+
this[i + start] = bytes[i % len];
|
30801
|
+
}
|
30802
|
+
}
|
30803
|
+
return this;
|
30804
|
+
}, "fill");
|
30805
|
+
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
30806
|
+
function base64clean(str) {
|
30807
|
+
str = str.split("=")[0];
|
30808
|
+
str = str.trim().replace(INVALID_BASE64_RE, "");
|
30809
|
+
if (str.length < 2)
|
30810
|
+
return "";
|
30811
|
+
while (str.length % 4 !== 0) {
|
30812
|
+
str = str + "=";
|
30813
|
+
}
|
30814
|
+
return str;
|
30815
|
+
}
|
30816
|
+
__name(base64clean, "base64clean");
|
30817
|
+
function utf8ToBytes2(string2, units) {
|
30818
|
+
units = units || Infinity;
|
30819
|
+
var codePoint;
|
30820
|
+
var length2 = string2.length;
|
30821
|
+
var leadSurrogate = null;
|
30822
|
+
var bytes = [];
|
30823
|
+
for (var i = 0; i < length2; ++i) {
|
30824
|
+
codePoint = string2.charCodeAt(i);
|
30825
|
+
if (codePoint > 55295 && codePoint < 57344) {
|
30826
|
+
if (!leadSurrogate) {
|
30827
|
+
if (codePoint > 56319) {
|
30828
|
+
if ((units -= 3) > -1)
|
30829
|
+
bytes.push(239, 191, 189);
|
30830
|
+
continue;
|
30831
|
+
} else if (i + 1 === length2) {
|
30832
|
+
if ((units -= 3) > -1)
|
30833
|
+
bytes.push(239, 191, 189);
|
30834
|
+
continue;
|
30835
|
+
}
|
30836
|
+
leadSurrogate = codePoint;
|
30837
|
+
continue;
|
30838
|
+
}
|
30839
|
+
if (codePoint < 56320) {
|
30840
|
+
if ((units -= 3) > -1)
|
30841
|
+
bytes.push(239, 191, 189);
|
30842
|
+
leadSurrogate = codePoint;
|
30843
|
+
continue;
|
30844
|
+
}
|
30845
|
+
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
30846
|
+
} else if (leadSurrogate) {
|
30847
|
+
if ((units -= 3) > -1)
|
30848
|
+
bytes.push(239, 191, 189);
|
30849
|
+
}
|
30850
|
+
leadSurrogate = null;
|
30851
|
+
if (codePoint < 128) {
|
30852
|
+
if ((units -= 1) < 0)
|
30853
|
+
break;
|
30854
|
+
bytes.push(codePoint);
|
30855
|
+
} else if (codePoint < 2048) {
|
30856
|
+
if ((units -= 2) < 0)
|
30857
|
+
break;
|
30858
|
+
bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
|
30859
|
+
} else if (codePoint < 65536) {
|
30860
|
+
if ((units -= 3) < 0)
|
30861
|
+
break;
|
30862
|
+
bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
30863
|
+
} else if (codePoint < 1114112) {
|
30864
|
+
if ((units -= 4) < 0)
|
30865
|
+
break;
|
30866
|
+
bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
30867
|
+
} else {
|
30868
|
+
throw new Error("Invalid code point");
|
30869
|
+
}
|
30870
|
+
}
|
30871
|
+
return bytes;
|
30872
|
+
}
|
30873
|
+
__name(utf8ToBytes2, "utf8ToBytes");
|
30874
|
+
function asciiToBytes(str) {
|
30875
|
+
var byteArray = [];
|
30876
|
+
for (var i = 0; i < str.length; ++i) {
|
30877
|
+
byteArray.push(str.charCodeAt(i) & 255);
|
30878
|
+
}
|
30879
|
+
return byteArray;
|
30880
|
+
}
|
30881
|
+
__name(asciiToBytes, "asciiToBytes");
|
30882
|
+
function utf16leToBytes(str, units) {
|
30883
|
+
var c, hi, lo;
|
30884
|
+
var byteArray = [];
|
30885
|
+
for (var i = 0; i < str.length; ++i) {
|
30886
|
+
if ((units -= 2) < 0)
|
30887
|
+
break;
|
30888
|
+
c = str.charCodeAt(i);
|
30889
|
+
hi = c >> 8;
|
30890
|
+
lo = c % 256;
|
30891
|
+
byteArray.push(lo);
|
30892
|
+
byteArray.push(hi);
|
30893
|
+
}
|
30894
|
+
return byteArray;
|
30895
|
+
}
|
30896
|
+
__name(utf16leToBytes, "utf16leToBytes");
|
30897
|
+
function base64ToBytes2(str) {
|
30898
|
+
return base642.toByteArray(base64clean(str));
|
30899
|
+
}
|
30900
|
+
__name(base64ToBytes2, "base64ToBytes");
|
30901
|
+
function blitBuffer(src2, dst, offset, length2) {
|
30902
|
+
for (var i = 0; i < length2; ++i) {
|
30903
|
+
if (i + offset >= dst.length || i >= src2.length)
|
30904
|
+
break;
|
30905
|
+
dst[i + offset] = src2[i];
|
30906
|
+
}
|
30907
|
+
return i;
|
30908
|
+
}
|
30909
|
+
__name(blitBuffer, "blitBuffer");
|
30910
|
+
function isInstance(obj, type) {
|
30911
|
+
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
30912
|
+
}
|
30913
|
+
__name(isInstance, "isInstance");
|
30914
|
+
function numberIsNaN(obj) {
|
30915
|
+
return obj !== obj;
|
30916
|
+
}
|
30917
|
+
__name(numberIsNaN, "numberIsNaN");
|
30918
|
+
var hexSliceLookupTable = function() {
|
30919
|
+
var alphabet3 = "0123456789abcdef";
|
30920
|
+
var table = new Array(256);
|
30921
|
+
for (var i = 0; i < 16; ++i) {
|
30922
|
+
var i16 = i * 16;
|
30923
|
+
for (var j = 0; j < 16; ++j) {
|
30924
|
+
table[i16 + j] = alphabet3[i] + alphabet3[j];
|
30925
|
+
}
|
30926
|
+
}
|
30927
|
+
return table;
|
30928
|
+
}();
|
30929
|
+
}
|
30930
|
+
});
|
30931
|
+
|
29271
30932
|
// src/wallet/plugins/EthereumPlugin/erc20.abi.json
|
29272
30933
|
var require_erc20_abi = __commonJS({
|
29273
30934
|
"src/wallet/plugins/EthereumPlugin/erc20.abi.json"(exports, module2) {
|
@@ -36081,20 +37742,20 @@ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async(void 0, null, fu
|
|
36081
37742
|
issueCredential: (_wallet, credential, options, keypair) => __async(void 0, null, function* () {
|
36082
37743
|
return JSON.parse(yield issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
|
36083
37744
|
}),
|
36084
|
-
verifyCredential: (
|
36085
|
-
return JSON.parse(yield verifyCredential(JSON.stringify(credential),
|
37745
|
+
verifyCredential: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, credential, options = {}) {
|
37746
|
+
return JSON.parse(yield verifyCredential(JSON.stringify(credential), JSON.stringify(options)));
|
36086
37747
|
}),
|
36087
37748
|
issuePresentation: (_wallet, presentation, options, keypair) => __async(void 0, null, function* () {
|
36088
37749
|
return JSON.parse(yield issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
|
36089
37750
|
}),
|
36090
|
-
verifyPresentation: (
|
36091
|
-
return JSON.parse(yield verifyPresentation(JSON.stringify(presentation),
|
37751
|
+
verifyPresentation: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, presentation, options = {}) {
|
37752
|
+
return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), JSON.stringify(options)));
|
36092
37753
|
}),
|
36093
37754
|
contextLoader: (_wallet, url) => __async(void 0, null, function* () {
|
36094
37755
|
return JSON.parse(yield contextLoader(url));
|
36095
37756
|
}),
|
36096
|
-
resolveDid: (
|
36097
|
-
return JSON.parse(yield resolveDID(did,
|
37757
|
+
resolveDid: (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, did, inputMetadata = {}) {
|
37758
|
+
return JSON.parse(yield resolveDID(did, JSON.stringify(inputMetadata)));
|
36098
37759
|
})
|
36099
37760
|
}
|
36100
37761
|
};
|
@@ -36115,8 +37776,1492 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
|
|
36115
37776
|
}
|
36116
37777
|
}), "ExpirationPlugin");
|
36117
37778
|
|
36118
|
-
//
|
36119
|
-
var
|
37779
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/utils.js
|
37780
|
+
var RPC_ERRORS = {
|
37781
|
+
ParseError: {
|
37782
|
+
message: "Parse error",
|
37783
|
+
code: -32700
|
37784
|
+
},
|
37785
|
+
InvalidRequest: {
|
37786
|
+
message: "Invalid Request",
|
37787
|
+
code: -32600
|
37788
|
+
},
|
37789
|
+
MethodNotFound: {
|
37790
|
+
message: "Method not found",
|
37791
|
+
code: -32601
|
37792
|
+
},
|
37793
|
+
InvalidParams: {
|
37794
|
+
message: "Invalid params",
|
37795
|
+
code: -32602
|
37796
|
+
},
|
37797
|
+
InternalError: {
|
37798
|
+
message: "Internal Error",
|
37799
|
+
code: -32603
|
37800
|
+
},
|
37801
|
+
ServerError: {
|
37802
|
+
message: "Server error",
|
37803
|
+
code: -32e3
|
37804
|
+
}
|
37805
|
+
};
|
37806
|
+
function parseUrl(url, base4) {
|
37807
|
+
if (base4 === void 0) {
|
37808
|
+
base4 = window.location.href;
|
37809
|
+
}
|
37810
|
+
if (typeof URL === "function") {
|
37811
|
+
return new URL(url, base4);
|
37812
|
+
}
|
37813
|
+
if (typeof url !== "string") {
|
37814
|
+
throw new TypeError('"url" must be a string.');
|
37815
|
+
}
|
37816
|
+
if (!url.includes(":")) {
|
37817
|
+
if (base4.startsWith("http") && !url.startsWith("/")) {
|
37818
|
+
url = base4 + "/" + url;
|
37819
|
+
} else {
|
37820
|
+
url = base4 + url;
|
37821
|
+
}
|
37822
|
+
}
|
37823
|
+
const parser = document.createElement("a");
|
37824
|
+
parser.href = url;
|
37825
|
+
let origin = (parser.protocol || window.location.protocol) + "//";
|
37826
|
+
if (parser.host) {
|
37827
|
+
if (parser.protocol === "http:" && parser.port === "80" || parser.protocol === "https:" && parser.port === "443") {
|
37828
|
+
origin += parser.hostname;
|
37829
|
+
} else {
|
37830
|
+
origin += parser.host;
|
37831
|
+
}
|
37832
|
+
} else {
|
37833
|
+
origin += window.location.host;
|
37834
|
+
}
|
37835
|
+
let pathname = parser.pathname;
|
37836
|
+
if (!pathname.startsWith("/")) {
|
37837
|
+
pathname = "/" + pathname;
|
37838
|
+
}
|
37839
|
+
return {
|
37840
|
+
host: parser.host || window.location.host,
|
37841
|
+
hostname: parser.hostname,
|
37842
|
+
origin,
|
37843
|
+
protocol: parser.protocol,
|
37844
|
+
pathname
|
37845
|
+
};
|
37846
|
+
}
|
37847
|
+
__name(parseUrl, "parseUrl");
|
37848
|
+
function uuidv4(a, b) {
|
37849
|
+
for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-")
|
37850
|
+
;
|
37851
|
+
return b;
|
37852
|
+
}
|
37853
|
+
__name(uuidv4, "uuidv4");
|
37854
|
+
function isValidMessage(message) {
|
37855
|
+
return message && typeof message === "object" && message.jsonrpc === "2.0" && message.id && typeof message.id === "string";
|
37856
|
+
}
|
37857
|
+
__name(isValidMessage, "isValidMessage");
|
37858
|
+
function isValidRequest(message) {
|
37859
|
+
return isValidMessage(message) && Array.isArray(message.params);
|
37860
|
+
}
|
37861
|
+
__name(isValidRequest, "isValidRequest");
|
37862
|
+
function isValidResponse(message) {
|
37863
|
+
return isValidMessage(message) && !!("result" in message ^ "error" in message) && (!("error" in message) || isValidError(message.error));
|
37864
|
+
}
|
37865
|
+
__name(isValidResponse, "isValidResponse");
|
37866
|
+
function isValidError(error) {
|
37867
|
+
return error && typeof error === "object" && typeof error.code === "number" && typeof error.message === "string";
|
37868
|
+
}
|
37869
|
+
__name(isValidError, "isValidError");
|
37870
|
+
function serializeError(error) {
|
37871
|
+
const err = {
|
37872
|
+
message: error.message
|
37873
|
+
};
|
37874
|
+
if (error.constructor.name !== "Error") {
|
37875
|
+
err.constructor = error.constructor.name;
|
37876
|
+
}
|
37877
|
+
if ("name" in error) {
|
37878
|
+
err.name = error.name;
|
37879
|
+
}
|
37880
|
+
if ("code" in error) {
|
37881
|
+
err.code = error.code;
|
37882
|
+
} else {
|
37883
|
+
err.code = RPC_ERRORS.ServerError.code;
|
37884
|
+
}
|
37885
|
+
if ("details" in error) {
|
37886
|
+
err.details = error.details;
|
37887
|
+
}
|
37888
|
+
return err;
|
37889
|
+
}
|
37890
|
+
__name(serializeError, "serializeError");
|
37891
|
+
function deserializeError(error) {
|
37892
|
+
let err;
|
37893
|
+
if (error.constructor === "DOMException") {
|
37894
|
+
err = new DOMException(error.message, error.name);
|
37895
|
+
} else {
|
37896
|
+
err = new Error(error.message);
|
37897
|
+
if ("code" in error) {
|
37898
|
+
err.code = error.code;
|
37899
|
+
}
|
37900
|
+
}
|
37901
|
+
if (error.details) {
|
37902
|
+
err.details = error.details;
|
37903
|
+
}
|
37904
|
+
return err;
|
37905
|
+
}
|
37906
|
+
__name(deserializeError, "deserializeError");
|
37907
|
+
function createMessageListener({ listener: listener2, origin, handle, expectRequest }) {
|
37908
|
+
if (isHandlePromise(handle)) {
|
37909
|
+
const promise = handle;
|
37910
|
+
handle = false;
|
37911
|
+
promise.then((h) => handle = h);
|
37912
|
+
}
|
37913
|
+
return (e) => {
|
37914
|
+
if (!(e.source === handle && e.origin === origin && (expectRequest && isValidRequest(e.data) || !expectRequest && isValidResponse(e.data)))) {
|
37915
|
+
return;
|
37916
|
+
}
|
37917
|
+
listener2(e.data, e);
|
37918
|
+
};
|
37919
|
+
}
|
37920
|
+
__name(createMessageListener, "createMessageListener");
|
37921
|
+
function destructureMethodName(fqMethodName) {
|
37922
|
+
let [name5, ...rest] = fqMethodName.split(".");
|
37923
|
+
const method = rest.pop();
|
37924
|
+
name5 = [name5, ...rest].join(".");
|
37925
|
+
return { name: name5, method };
|
37926
|
+
}
|
37927
|
+
__name(destructureMethodName, "destructureMethodName");
|
37928
|
+
function isHandlePromise(handle) {
|
37929
|
+
try {
|
37930
|
+
return typeof handle.then === "function";
|
37931
|
+
} catch (e) {
|
37932
|
+
}
|
37933
|
+
return false;
|
37934
|
+
}
|
37935
|
+
__name(isHandlePromise, "isHandlePromise");
|
37936
|
+
|
37937
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/Client.js
|
37938
|
+
var RPC_CLIENT_CALL_TIMEOUT = 3e4;
|
37939
|
+
var Client = class {
|
37940
|
+
constructor() {
|
37941
|
+
this.origin = null;
|
37942
|
+
this._handle = null;
|
37943
|
+
this._listener = null;
|
37944
|
+
this._pending = /* @__PURE__ */ new Map();
|
37945
|
+
}
|
37946
|
+
connect(origin, options) {
|
37947
|
+
return __async(this, null, function* () {
|
37948
|
+
if (this._listener) {
|
37949
|
+
throw new Error("Already connected.");
|
37950
|
+
}
|
37951
|
+
options = options || {};
|
37952
|
+
const self2 = this;
|
37953
|
+
self2.origin = parseUrl(origin).origin;
|
37954
|
+
self2._handle = options.handle || window.opener || window.parent;
|
37955
|
+
const pending = self2._pending;
|
37956
|
+
self2._listener = createMessageListener({
|
37957
|
+
origin: self2.origin,
|
37958
|
+
handle: self2._handle,
|
37959
|
+
expectRequest: false,
|
37960
|
+
listener: (message) => {
|
37961
|
+
if (!pending.has(message.id)) {
|
37962
|
+
return;
|
37963
|
+
}
|
37964
|
+
const { resolve, reject, cancelTimeout } = pending.get(message.id);
|
37965
|
+
cancelTimeout();
|
37966
|
+
if ("result" in message) {
|
37967
|
+
return resolve(message.result);
|
37968
|
+
}
|
37969
|
+
reject(deserializeError(message.error));
|
37970
|
+
}
|
37971
|
+
});
|
37972
|
+
window.addEventListener("message", self2._listener);
|
37973
|
+
return new Injector(self2);
|
37974
|
+
});
|
37975
|
+
}
|
37976
|
+
send(_0, _1, _2) {
|
37977
|
+
return __async(this, arguments, function* (qualifiedMethodName, parameters, {
|
37978
|
+
timeout = RPC_CLIENT_CALL_TIMEOUT
|
37979
|
+
}) {
|
37980
|
+
if (!this._listener) {
|
37981
|
+
throw new Error("RPC client not connected.");
|
37982
|
+
}
|
37983
|
+
const self2 = this;
|
37984
|
+
const message = {
|
37985
|
+
jsonrpc: "2.0",
|
37986
|
+
id: uuidv4(),
|
37987
|
+
method: qualifiedMethodName,
|
37988
|
+
params: parameters
|
37989
|
+
};
|
37990
|
+
if (isHandlePromise(self2._handle)) {
|
37991
|
+
const handle = yield self2._handle;
|
37992
|
+
handle.postMessage(message, self2.origin);
|
37993
|
+
} else {
|
37994
|
+
self2._handle.postMessage(message, self2.origin);
|
37995
|
+
}
|
37996
|
+
return new Promise((resolve, reject) => {
|
37997
|
+
const pending = self2._pending;
|
37998
|
+
let cancelTimeout;
|
37999
|
+
if (timeout > 0) {
|
38000
|
+
const timeoutId = setTimeout(() => {
|
38001
|
+
pending.delete(message.id);
|
38002
|
+
reject(new Error("RPC call timed out."));
|
38003
|
+
}, timeout);
|
38004
|
+
cancelTimeout = /* @__PURE__ */ __name(() => {
|
38005
|
+
pending.delete(message.id);
|
38006
|
+
clearTimeout(timeoutId);
|
38007
|
+
}, "cancelTimeout");
|
38008
|
+
} else {
|
38009
|
+
cancelTimeout = /* @__PURE__ */ __name(() => {
|
38010
|
+
pending.delete(message.id);
|
38011
|
+
}, "cancelTimeout");
|
38012
|
+
}
|
38013
|
+
pending.set(message.id, { resolve, reject, cancelTimeout });
|
38014
|
+
});
|
38015
|
+
});
|
38016
|
+
}
|
38017
|
+
close() {
|
38018
|
+
if (this._listener) {
|
38019
|
+
window.removeEventListener("message", this._listener);
|
38020
|
+
this._handle = this.origin = this._listener = null;
|
38021
|
+
for (const value of this._pending.values()) {
|
38022
|
+
value.reject(new Error("RPC client closed."));
|
38023
|
+
}
|
38024
|
+
this._pending = /* @__PURE__ */ new Map();
|
38025
|
+
}
|
38026
|
+
}
|
38027
|
+
};
|
38028
|
+
__name(Client, "Client");
|
38029
|
+
var Injector = class {
|
38030
|
+
constructor(client) {
|
38031
|
+
this.client = client;
|
38032
|
+
this._apis = /* @__PURE__ */ new Map();
|
38033
|
+
}
|
38034
|
+
define(name5, definition) {
|
38035
|
+
if (!(name5 && typeof name5 === "string")) {
|
38036
|
+
throw new TypeError("`name` must be a non-empty string.");
|
38037
|
+
}
|
38038
|
+
if (!(definition && typeof definition === "object" && Array.isArray(definition.functions))) {
|
38039
|
+
throw new TypeError("`definition.function` must be an array of function names or function definition objects to be defined.");
|
38040
|
+
}
|
38041
|
+
const self2 = this;
|
38042
|
+
const api = {};
|
38043
|
+
definition.functions.forEach((fn) => {
|
38044
|
+
if (typeof fn === "string") {
|
38045
|
+
fn = { name: fn, options: {} };
|
38046
|
+
}
|
38047
|
+
api[fn.name] = function() {
|
38048
|
+
return __async(this, arguments, function* () {
|
38049
|
+
return self2.client.send(name5 + "." + fn.name, [...arguments], fn.options);
|
38050
|
+
});
|
38051
|
+
};
|
38052
|
+
});
|
38053
|
+
self2._apis[name5] = api;
|
38054
|
+
return api;
|
38055
|
+
}
|
38056
|
+
get(name5, definition) {
|
38057
|
+
const api = this._apis[name5];
|
38058
|
+
if (!api) {
|
38059
|
+
if (definition) {
|
38060
|
+
return this.define(name5, definition);
|
38061
|
+
}
|
38062
|
+
throw new Error(`API "${name5}" has not been defined.`);
|
38063
|
+
}
|
38064
|
+
return this._apis[name5];
|
38065
|
+
}
|
38066
|
+
};
|
38067
|
+
__name(Injector, "Injector");
|
38068
|
+
|
38069
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/EventEmitter.js
|
38070
|
+
var EventEmitter = class {
|
38071
|
+
constructor({ deserialize = /* @__PURE__ */ __name((e) => e, "deserialize"), waitUntil = /* @__PURE__ */ __name(() => __async(this, null, function* () {
|
38072
|
+
}), "waitUntil") } = {}) {
|
38073
|
+
this._listeners = [];
|
38074
|
+
this._deserialize = deserialize;
|
38075
|
+
this._waitUntil = waitUntil;
|
38076
|
+
}
|
38077
|
+
emit(event) {
|
38078
|
+
return __async(this, null, function* () {
|
38079
|
+
event = this._deserialize(event);
|
38080
|
+
(this._listeners[event.type] || []).forEach((l) => l(event));
|
38081
|
+
return this._waitUntil(event);
|
38082
|
+
});
|
38083
|
+
}
|
38084
|
+
addEventListener(eventType, fn) {
|
38085
|
+
if (!this._listeners[eventType]) {
|
38086
|
+
this._listeners[eventType] = [fn];
|
38087
|
+
} else {
|
38088
|
+
this._listeners[eventType].push(fn);
|
38089
|
+
}
|
38090
|
+
}
|
38091
|
+
removeEventListener(eventType, fn) {
|
38092
|
+
const listeners = this._listeners[eventType];
|
38093
|
+
if (!listeners) {
|
38094
|
+
return;
|
38095
|
+
}
|
38096
|
+
const idx = listeners.indexOf(fn);
|
38097
|
+
if (idx !== -1) {
|
38098
|
+
listeners.splice(idx, 1);
|
38099
|
+
}
|
38100
|
+
}
|
38101
|
+
};
|
38102
|
+
__name(EventEmitter, "EventEmitter");
|
38103
|
+
|
38104
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/Server.js
|
38105
|
+
var Server = class {
|
38106
|
+
constructor() {
|
38107
|
+
this.origin = null;
|
38108
|
+
this._handle = null;
|
38109
|
+
this._apis = /* @__PURE__ */ new Map();
|
38110
|
+
}
|
38111
|
+
define(name5, api) {
|
38112
|
+
if (!(name5 && typeof name5 === "string")) {
|
38113
|
+
throw new TypeError("`name` must be a non-empty string.");
|
38114
|
+
}
|
38115
|
+
if (!(api && api !== "object")) {
|
38116
|
+
throw new TypeError("`api` must be an object.");
|
38117
|
+
}
|
38118
|
+
if (name5 in this._apis) {
|
38119
|
+
throw new Error(`The "${name5}" API is already defined.`);
|
38120
|
+
}
|
38121
|
+
this._apis[name5] = api;
|
38122
|
+
}
|
38123
|
+
listen(origin, options) {
|
38124
|
+
return __async(this, null, function* () {
|
38125
|
+
if (this._listener) {
|
38126
|
+
throw new Error("Already listening.");
|
38127
|
+
}
|
38128
|
+
options = options || {};
|
38129
|
+
const self2 = this;
|
38130
|
+
self2.origin = parseUrl(origin).origin;
|
38131
|
+
self2._handle = options.handle || window.opener || window.parent;
|
38132
|
+
const ignoreUnknownApi = options.ignoreUnknownApi === "true" || false;
|
38133
|
+
self2._listener = createMessageListener({
|
38134
|
+
origin: self2.origin,
|
38135
|
+
handle: self2._handle,
|
38136
|
+
expectRequest: true,
|
38137
|
+
listener: (message) => {
|
38138
|
+
const { name: name5, method } = destructureMethodName(message.method);
|
38139
|
+
const api = self2._apis[name5];
|
38140
|
+
if (method && method.startsWith("_")) {
|
38141
|
+
return sendMethodNotFound(self2._handle, self2.origin, message);
|
38142
|
+
}
|
38143
|
+
if (!api && ignoreUnknownApi) {
|
38144
|
+
return;
|
38145
|
+
}
|
38146
|
+
if (!api || typeof api[method] !== "function") {
|
38147
|
+
return sendMethodNotFound(self2._handle, self2.origin, message);
|
38148
|
+
}
|
38149
|
+
const fn = api[method];
|
38150
|
+
(() => __async(this, null, function* () {
|
38151
|
+
const response = {
|
38152
|
+
jsonrpc: "2.0",
|
38153
|
+
id: message.id
|
38154
|
+
};
|
38155
|
+
try {
|
38156
|
+
response.result = yield fn.apply(api, message.params);
|
38157
|
+
} catch (e) {
|
38158
|
+
response.error = serializeError(e);
|
38159
|
+
}
|
38160
|
+
if (self2._handle) {
|
38161
|
+
if (isHandlePromise(self2._handle)) {
|
38162
|
+
self2._handle.then((h) => h.postMessage(response, self2.origin));
|
38163
|
+
} else {
|
38164
|
+
self2._handle.postMessage(response, self2.origin);
|
38165
|
+
}
|
38166
|
+
}
|
38167
|
+
}))();
|
38168
|
+
}
|
38169
|
+
});
|
38170
|
+
window.addEventListener("message", self2._listener);
|
38171
|
+
});
|
38172
|
+
}
|
38173
|
+
close() {
|
38174
|
+
if (this._listener) {
|
38175
|
+
window.removeEventListener("message", this._listener);
|
38176
|
+
this._handle = this.origin = this._listener = null;
|
38177
|
+
}
|
38178
|
+
}
|
38179
|
+
};
|
38180
|
+
__name(Server, "Server");
|
38181
|
+
function sendMethodNotFound(handle, origin, message) {
|
38182
|
+
const response = {
|
38183
|
+
jsonrpc: "2.0",
|
38184
|
+
id: message.id,
|
38185
|
+
error: Object.assign({}, RPC_ERRORS.MethodNotFound)
|
38186
|
+
};
|
38187
|
+
if (isHandlePromise(handle)) {
|
38188
|
+
return handle.then((h) => h.postMessage(response, origin));
|
38189
|
+
} else {
|
38190
|
+
return handle.postMessage(response, origin);
|
38191
|
+
}
|
38192
|
+
}
|
38193
|
+
__name(sendMethodNotFound, "sendMethodNotFound");
|
38194
|
+
|
38195
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebApp.js
|
38196
|
+
var WebApp = class {
|
38197
|
+
constructor(relyingOrigin) {
|
38198
|
+
this.relyingOrigin = parseUrl(relyingOrigin).origin;
|
38199
|
+
this.client = null;
|
38200
|
+
this.injector = null;
|
38201
|
+
this.client = new Client();
|
38202
|
+
this.server = new Server();
|
38203
|
+
this._control = null;
|
38204
|
+
this._connected = false;
|
38205
|
+
}
|
38206
|
+
connect() {
|
38207
|
+
return __async(this, null, function* () {
|
38208
|
+
this.injector = yield this.client.connect(this.relyingOrigin);
|
38209
|
+
this._connected = true;
|
38210
|
+
this._control = this.injector.define("core.control", {
|
38211
|
+
functions: ["ready", "show", "hide"]
|
38212
|
+
});
|
38213
|
+
this.server.listen(this.relyingOrigin);
|
38214
|
+
return this.injector;
|
38215
|
+
});
|
38216
|
+
}
|
38217
|
+
ready() {
|
38218
|
+
return __async(this, null, function* () {
|
38219
|
+
if (!this._connected) {
|
38220
|
+
throw new Error('WebApp not connected. Did you call ".connect()"?');
|
38221
|
+
}
|
38222
|
+
yield this._control.ready();
|
38223
|
+
return this;
|
38224
|
+
});
|
38225
|
+
}
|
38226
|
+
close() {
|
38227
|
+
if (this._connected) {
|
38228
|
+
this.server.close();
|
38229
|
+
this.client.close();
|
38230
|
+
this._connected = false;
|
38231
|
+
}
|
38232
|
+
}
|
38233
|
+
show() {
|
38234
|
+
return __async(this, null, function* () {
|
38235
|
+
if (!this._connected) {
|
38236
|
+
throw new Error('Cannot "show" yet; not connected. Did you call ".connect()"?');
|
38237
|
+
}
|
38238
|
+
return this._control.show();
|
38239
|
+
});
|
38240
|
+
}
|
38241
|
+
hide() {
|
38242
|
+
return __async(this, null, function* () {
|
38243
|
+
if (!this._connected) {
|
38244
|
+
throw new Error('Cannot "hide" yet; not connected. Did you call ".connect()?"');
|
38245
|
+
}
|
38246
|
+
return this._control.hide();
|
38247
|
+
});
|
38248
|
+
}
|
38249
|
+
};
|
38250
|
+
__name(WebApp, "WebApp");
|
38251
|
+
|
38252
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowDialog.js
|
38253
|
+
var WebAppWindowDialog = class {
|
38254
|
+
constructor() {
|
38255
|
+
this._closeEventListeners = /* @__PURE__ */ new Set();
|
38256
|
+
}
|
38257
|
+
addEventListener(name5, listener2) {
|
38258
|
+
if (name5 !== "close") {
|
38259
|
+
throw new Error(`Unknown event "${name5}".`);
|
38260
|
+
}
|
38261
|
+
if (typeof listener2 !== "function") {
|
38262
|
+
throw new TypeError('"listener" must be a function.');
|
38263
|
+
}
|
38264
|
+
this._closeEventListeners.add(listener2);
|
38265
|
+
}
|
38266
|
+
removeEventListener(name5, listener2) {
|
38267
|
+
if (name5 !== "close") {
|
38268
|
+
throw new Error(`Unknown event "${name5}".`);
|
38269
|
+
}
|
38270
|
+
if (typeof listener2 !== "function") {
|
38271
|
+
throw new TypeError('"listener" must be a function.');
|
38272
|
+
}
|
38273
|
+
this._closeEventListeners.delete(listener2);
|
38274
|
+
}
|
38275
|
+
show() {
|
38276
|
+
}
|
38277
|
+
close() {
|
38278
|
+
for (const listener2 of this._closeEventListeners) {
|
38279
|
+
listener2({});
|
38280
|
+
}
|
38281
|
+
}
|
38282
|
+
destroy() {
|
38283
|
+
this._closeEventListeners.clear();
|
38284
|
+
}
|
38285
|
+
};
|
38286
|
+
__name(WebAppWindowDialog, "WebAppWindowDialog");
|
38287
|
+
|
38288
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowInlineDialog.js
|
38289
|
+
var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
38290
|
+
constructor({ url, handle, className }) {
|
38291
|
+
super();
|
38292
|
+
this.url = url;
|
38293
|
+
this.handle = handle;
|
38294
|
+
this.dialog = document.createElement("dialog");
|
38295
|
+
applyStyle(this.dialog, {
|
38296
|
+
position: "fixed",
|
38297
|
+
top: 0,
|
38298
|
+
left: 0,
|
38299
|
+
width: "100%",
|
38300
|
+
height: "100%",
|
38301
|
+
"max-width": "100%",
|
38302
|
+
"max-height": "100%",
|
38303
|
+
display: "none",
|
38304
|
+
margin: 0,
|
38305
|
+
padding: 0,
|
38306
|
+
border: "none",
|
38307
|
+
background: "transparent",
|
38308
|
+
color: "black",
|
38309
|
+
"box-sizing": "border-box",
|
38310
|
+
overflow: "hidden",
|
38311
|
+
"z-index": 1e6
|
38312
|
+
});
|
38313
|
+
this.dialog.className = "web-app-window";
|
38314
|
+
if (typeof className === "string") {
|
38315
|
+
this.dialog.className = this.dialog.className + " " + className;
|
38316
|
+
}
|
38317
|
+
const style = document.createElement("style");
|
38318
|
+
style.appendChild(document.createTextNode(`dialog.web-app-window::backdrop {
|
38319
|
+
background-color: transparent;
|
38320
|
+
}`));
|
38321
|
+
this.container = document.createElement("div");
|
38322
|
+
applyStyle(this.container, {
|
38323
|
+
position: "relative",
|
38324
|
+
width: "100%",
|
38325
|
+
height: "100%",
|
38326
|
+
margin: 0,
|
38327
|
+
padding: 0,
|
38328
|
+
display: "flex",
|
38329
|
+
"flex-direction": "column"
|
38330
|
+
});
|
38331
|
+
this.container.className = "web-app-window-backdrop";
|
38332
|
+
this.iframe = document.createElement("iframe");
|
38333
|
+
this.iframe.src = url;
|
38334
|
+
this.iframe.scrolling = "auto";
|
38335
|
+
applyStyle(this.iframe, {
|
38336
|
+
position: "fixed",
|
38337
|
+
top: 0,
|
38338
|
+
left: 0,
|
38339
|
+
width: "100%",
|
38340
|
+
height: "100%",
|
38341
|
+
border: "none",
|
38342
|
+
background: "transparent",
|
38343
|
+
overflow: "hidden",
|
38344
|
+
margin: 0,
|
38345
|
+
padding: 0,
|
38346
|
+
"flex-grow": 1
|
38347
|
+
});
|
38348
|
+
this.dialog.appendChild(style);
|
38349
|
+
this.container.appendChild(this.iframe);
|
38350
|
+
this.dialog.appendChild(this.container);
|
38351
|
+
this.dialog.addEventListener("cancel", (e) => {
|
38352
|
+
e.preventDefault();
|
38353
|
+
this.hide();
|
38354
|
+
});
|
38355
|
+
document.body.appendChild(this.dialog);
|
38356
|
+
this.handle = this.iframe.contentWindow;
|
38357
|
+
}
|
38358
|
+
show() {
|
38359
|
+
this.dialog.style.display = "block";
|
38360
|
+
if (this.dialog.showModal) {
|
38361
|
+
this.dialog.showModal();
|
38362
|
+
}
|
38363
|
+
}
|
38364
|
+
close() {
|
38365
|
+
this.dialog.style.display = "none";
|
38366
|
+
if (this.dialog.close) {
|
38367
|
+
try {
|
38368
|
+
this.dialog.close();
|
38369
|
+
} catch (e) {
|
38370
|
+
console.error(e);
|
38371
|
+
}
|
38372
|
+
}
|
38373
|
+
super.close();
|
38374
|
+
}
|
38375
|
+
destroy() {
|
38376
|
+
this.dialog.parentNode.removeChild(this.dialog);
|
38377
|
+
super.destroy();
|
38378
|
+
}
|
38379
|
+
};
|
38380
|
+
__name(WebAppWindowInlineDialog, "WebAppWindowInlineDialog");
|
38381
|
+
function applyStyle(element, style) {
|
38382
|
+
for (const name5 in style) {
|
38383
|
+
element.style[name5] = style[name5];
|
38384
|
+
}
|
38385
|
+
}
|
38386
|
+
__name(applyStyle, "applyStyle");
|
38387
|
+
|
38388
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindowPopupDialog.js
|
38389
|
+
var WebAppWindowPopupDialog = class extends WebAppWindowDialog {
|
38390
|
+
constructor({ url, handle, bounds = { width: 500, height: 400 } }) {
|
38391
|
+
super();
|
38392
|
+
this.url = url;
|
38393
|
+
this.handle = handle;
|
38394
|
+
this._locationChanging = false;
|
38395
|
+
if (!handle) {
|
38396
|
+
this._openWindow({ url, name: "web-app-window", bounds });
|
38397
|
+
}
|
38398
|
+
this.destroyed = false;
|
38399
|
+
this._removeListeners = () => {
|
38400
|
+
};
|
38401
|
+
}
|
38402
|
+
show() {
|
38403
|
+
}
|
38404
|
+
close() {
|
38405
|
+
this.destroy();
|
38406
|
+
}
|
38407
|
+
destroy() {
|
38408
|
+
if (this.handle && !this.destroyed) {
|
38409
|
+
this.handle.close();
|
38410
|
+
super.close();
|
38411
|
+
this.handle = null;
|
38412
|
+
this.destroyed = true;
|
38413
|
+
this._removeListeners();
|
38414
|
+
super.destroy();
|
38415
|
+
}
|
38416
|
+
}
|
38417
|
+
isClosed() {
|
38418
|
+
return !this.handle || this.handle.closed;
|
38419
|
+
}
|
38420
|
+
_openWindow({ url, name: name5, bounds }) {
|
38421
|
+
const { x, y } = bounds;
|
38422
|
+
let { width = 500, height = 400 } = bounds;
|
38423
|
+
width = Math.min(width, window.innerWidth);
|
38424
|
+
height = Math.min(height, window.innerHeight);
|
38425
|
+
const left = x !== void 0 ? x : window.screenX + (window.innerWidth - width) / 2;
|
38426
|
+
const top = y !== void 0 ? y : window.screenY + (window.innerHeight - height) / 2;
|
38427
|
+
const features = `popup=yes,menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=${width},height=${height},left=${left},top=${top}`;
|
38428
|
+
this._locationChanging = true;
|
38429
|
+
this.handle = window.open(url, name5, features);
|
38430
|
+
this._addListeners();
|
38431
|
+
}
|
38432
|
+
setLocation(url) {
|
38433
|
+
this.url = url;
|
38434
|
+
this._locationChanging = true;
|
38435
|
+
this.handle.location.replace(url);
|
38436
|
+
}
|
38437
|
+
_addListeners() {
|
38438
|
+
const destroyDialog = /* @__PURE__ */ __name(() => this.destroy(), "destroyDialog");
|
38439
|
+
const loadDialog = /* @__PURE__ */ __name(() => {
|
38440
|
+
this._locationChanging = false;
|
38441
|
+
}, "loadDialog");
|
38442
|
+
const unloadDialog = /* @__PURE__ */ __name(() => {
|
38443
|
+
if (this._locationChanging) {
|
38444
|
+
return;
|
38445
|
+
}
|
38446
|
+
this.destroy();
|
38447
|
+
}, "unloadDialog");
|
38448
|
+
this.handle.addEventListener("unload", unloadDialog);
|
38449
|
+
this.handle.addEventListener("load", loadDialog);
|
38450
|
+
window.addEventListener("beforeUnload", destroyDialog, { once: true });
|
38451
|
+
const intervalId = setInterval(() => {
|
38452
|
+
if (this.isClosed()) {
|
38453
|
+
this.destroy();
|
38454
|
+
clearInterval(intervalId);
|
38455
|
+
}
|
38456
|
+
}, 250);
|
38457
|
+
this._removeListeners = () => {
|
38458
|
+
clearInterval(intervalId);
|
38459
|
+
this.handle.removeListener("unload", unloadDialog);
|
38460
|
+
this.handle.removeListener("load", loadDialog);
|
38461
|
+
window.removeEventListener("beforeUnload", destroyDialog);
|
38462
|
+
};
|
38463
|
+
}
|
38464
|
+
};
|
38465
|
+
__name(WebAppWindowPopupDialog, "WebAppWindowPopupDialog");
|
38466
|
+
|
38467
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppWindow.js
|
38468
|
+
var LOAD_WINDOW_TIMEOUT = 6e4;
|
38469
|
+
var WebAppWindow = class {
|
38470
|
+
constructor(url, {
|
38471
|
+
timeout = LOAD_WINDOW_TIMEOUT,
|
38472
|
+
dialog = null,
|
38473
|
+
handle,
|
38474
|
+
popup = false,
|
38475
|
+
className = null,
|
38476
|
+
customize = null,
|
38477
|
+
bounds
|
38478
|
+
} = {}) {
|
38479
|
+
this.visible = false;
|
38480
|
+
this.dialog = dialog;
|
38481
|
+
this.handle = null;
|
38482
|
+
this.popup = popup;
|
38483
|
+
this.windowControl = null;
|
38484
|
+
this._destroyed = false;
|
38485
|
+
this._ready = false;
|
38486
|
+
this._private = {};
|
38487
|
+
this._timeoutId = null;
|
38488
|
+
if (handle && handle._dialog) {
|
38489
|
+
this.dialog = dialog = handle._dialog;
|
38490
|
+
}
|
38491
|
+
this._private._readyPromise = new Promise((resolve, reject) => {
|
38492
|
+
this._timeoutId = setTimeout(() => reject(new DOMException("Loading Web application window timed out.", "TimeoutError")), timeout);
|
38493
|
+
this._private._resolveReady = (value) => {
|
38494
|
+
clearTimeout(this.timeoutId);
|
38495
|
+
this._timeoutId = null;
|
38496
|
+
resolve(value);
|
38497
|
+
};
|
38498
|
+
this._private._rejectReady = (err) => {
|
38499
|
+
clearTimeout(this.timeoutId);
|
38500
|
+
this._timeoutId = null;
|
38501
|
+
reject(err);
|
38502
|
+
};
|
38503
|
+
});
|
38504
|
+
this._private.isReady = () => __async(this, null, function* () {
|
38505
|
+
return this._private._readyPromise;
|
38506
|
+
});
|
38507
|
+
this._private.destroy = () => {
|
38508
|
+
if (this._timeoutId) {
|
38509
|
+
this._private._rejectReady(new DOMException("Web application window closed before ready.", "AbortError"));
|
38510
|
+
}
|
38511
|
+
if (!this._destroyed) {
|
38512
|
+
this.dialog.destroy();
|
38513
|
+
this.dialog = null;
|
38514
|
+
this._destroyed = true;
|
38515
|
+
}
|
38516
|
+
};
|
38517
|
+
if (customize) {
|
38518
|
+
if (!typeof customize === "function") {
|
38519
|
+
throw new TypeError("`options.customize` must be a function.");
|
38520
|
+
}
|
38521
|
+
}
|
38522
|
+
if (!this.dialog) {
|
38523
|
+
if (this.popup) {
|
38524
|
+
this.dialog = new WebAppWindowPopupDialog({ url, handle, bounds });
|
38525
|
+
} else {
|
38526
|
+
this.dialog = new WebAppWindowInlineDialog({ url, handle, className });
|
38527
|
+
}
|
38528
|
+
} else if (this.popup && bounds) {
|
38529
|
+
if (bounds) {
|
38530
|
+
const { top: y, left: x, width, height } = bounds;
|
38531
|
+
if (x !== void 0 && y !== void 0) {
|
38532
|
+
this.dialog.handle.moveTo(x, y);
|
38533
|
+
}
|
38534
|
+
if (width !== void 0 && height !== void 0) {
|
38535
|
+
this.dialog.handle.resizeTo(width, height);
|
38536
|
+
}
|
38537
|
+
}
|
38538
|
+
}
|
38539
|
+
this.handle = this.dialog.handle;
|
38540
|
+
if (customize) {
|
38541
|
+
try {
|
38542
|
+
customize({
|
38543
|
+
dialog: this.dialog.dialog,
|
38544
|
+
container: this.dialog.container,
|
38545
|
+
iframe: this.dialog.iframe,
|
38546
|
+
webAppWindow: this
|
38547
|
+
});
|
38548
|
+
} catch (e) {
|
38549
|
+
console.error(e);
|
38550
|
+
}
|
38551
|
+
}
|
38552
|
+
}
|
38553
|
+
ready() {
|
38554
|
+
this._ready = true;
|
38555
|
+
this._private._resolveReady(true);
|
38556
|
+
}
|
38557
|
+
show() {
|
38558
|
+
if (!this.visible) {
|
38559
|
+
this.visible = true;
|
38560
|
+
const body = document.querySelector("body");
|
38561
|
+
this._bodyOverflowStyle = body.style.overflow;
|
38562
|
+
body.style.overflow = "hidden";
|
38563
|
+
if (!this._destroyed) {
|
38564
|
+
this.dialog.show();
|
38565
|
+
} else if (this.windowControl.show) {
|
38566
|
+
this.windowControl.show();
|
38567
|
+
}
|
38568
|
+
}
|
38569
|
+
}
|
38570
|
+
hide() {
|
38571
|
+
if (this.visible) {
|
38572
|
+
this.visible = false;
|
38573
|
+
const body = document.querySelector("body");
|
38574
|
+
if (this._bodyOverflowStyle) {
|
38575
|
+
body.style.overflow = this._bodyOverflowStyle;
|
38576
|
+
} else {
|
38577
|
+
body.style.overflow = "";
|
38578
|
+
}
|
38579
|
+
if (!this._destroyed) {
|
38580
|
+
this.dialog.close();
|
38581
|
+
} else if (this.windowControl.hide) {
|
38582
|
+
this.windowControl.hide();
|
38583
|
+
}
|
38584
|
+
}
|
38585
|
+
}
|
38586
|
+
};
|
38587
|
+
__name(WebAppWindow, "WebAppWindow");
|
38588
|
+
|
38589
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.0/node_modules/web-request-rpc/WebAppContext.js
|
38590
|
+
var WEB_APP_CONTEXT_LOAD_TIMEOUT = 1e4;
|
38591
|
+
var WebAppContext = class {
|
38592
|
+
constructor() {
|
38593
|
+
this.client = new Client();
|
38594
|
+
this.server = new Server();
|
38595
|
+
this.injector = null;
|
38596
|
+
this.control = null;
|
38597
|
+
this.loaded = false;
|
38598
|
+
this.closed = false;
|
38599
|
+
}
|
38600
|
+
createWindow(_0) {
|
38601
|
+
return __async(this, arguments, function* (url, {
|
38602
|
+
timeout = WEB_APP_CONTEXT_LOAD_TIMEOUT,
|
38603
|
+
iframe,
|
38604
|
+
dialog = null,
|
38605
|
+
popup = false,
|
38606
|
+
handle,
|
38607
|
+
windowControl,
|
38608
|
+
className,
|
38609
|
+
customize,
|
38610
|
+
bounds
|
38611
|
+
} = {}) {
|
38612
|
+
if (this.loaded) {
|
38613
|
+
throw new Error("AppContext already loaded.");
|
38614
|
+
}
|
38615
|
+
this.loaded = true;
|
38616
|
+
this.control = new WebAppWindow(url, {
|
38617
|
+
timeout,
|
38618
|
+
dialog,
|
38619
|
+
iframe,
|
38620
|
+
popup,
|
38621
|
+
handle,
|
38622
|
+
windowControl,
|
38623
|
+
className,
|
38624
|
+
customize,
|
38625
|
+
bounds
|
38626
|
+
});
|
38627
|
+
window.addEventListener("pagehide", () => this.close(), { once: true });
|
38628
|
+
this.server.define("core.control", this.control);
|
38629
|
+
const origin = parseUrl(url).origin;
|
38630
|
+
this.server.listen(origin, {
|
38631
|
+
handle: this.control.handle,
|
38632
|
+
ignoreUnknownApi: true
|
38633
|
+
});
|
38634
|
+
yield this.control._private.isReady();
|
38635
|
+
this.injector = yield this.client.connect(origin, {
|
38636
|
+
handle: this.control.handle
|
38637
|
+
});
|
38638
|
+
return this.injector;
|
38639
|
+
});
|
38640
|
+
}
|
38641
|
+
close() {
|
38642
|
+
if (!this.closed) {
|
38643
|
+
this.closed = true;
|
38644
|
+
this.control._private.destroy();
|
38645
|
+
this.server.close();
|
38646
|
+
this.client.close();
|
38647
|
+
}
|
38648
|
+
}
|
38649
|
+
};
|
38650
|
+
__name(WebAppContext, "WebAppContext");
|
38651
|
+
|
38652
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialRequestEvent.js
|
38653
|
+
var CredentialRequestEvent = class {
|
38654
|
+
constructor({
|
38655
|
+
credentialHandler,
|
38656
|
+
credentialRequestOrigin,
|
38657
|
+
credentialRequestOptions,
|
38658
|
+
hintKey
|
38659
|
+
}) {
|
38660
|
+
this.type = "credentialrequest";
|
38661
|
+
this._credentialHandler = credentialHandler;
|
38662
|
+
this.credentialRequestOrigin = credentialRequestOrigin;
|
38663
|
+
this.credentialRequestOptions = credentialRequestOptions;
|
38664
|
+
this.hintKey = hintKey;
|
38665
|
+
}
|
38666
|
+
openWindow(url) {
|
38667
|
+
return __async(this, null, function* () {
|
38668
|
+
yield this._credentialHandler.show();
|
38669
|
+
const appWindow = new WebAppWindow(url, {
|
38670
|
+
className: "credential-handler"
|
38671
|
+
});
|
38672
|
+
appWindow.ready();
|
38673
|
+
appWindow.show();
|
38674
|
+
appWindow.handle._dialog = appWindow.dialog;
|
38675
|
+
return appWindow.handle;
|
38676
|
+
});
|
38677
|
+
}
|
38678
|
+
respondWith(handlerResponse) {
|
38679
|
+
this._promise = handlerResponse;
|
38680
|
+
}
|
38681
|
+
};
|
38682
|
+
__name(CredentialRequestEvent, "CredentialRequestEvent");
|
38683
|
+
|
38684
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialStoreEvent.js
|
38685
|
+
var CredentialStoreEvent = class {
|
38686
|
+
constructor({
|
38687
|
+
credentialHandler,
|
38688
|
+
credentialRequestOrigin,
|
38689
|
+
credential,
|
38690
|
+
hintKey
|
38691
|
+
}) {
|
38692
|
+
this.type = "credentialstore";
|
38693
|
+
this._credentialHandler = credentialHandler;
|
38694
|
+
this.credentialRequestOrigin = credentialRequestOrigin;
|
38695
|
+
this.credential = credential;
|
38696
|
+
this.hintKey = hintKey;
|
38697
|
+
}
|
38698
|
+
openWindow(url) {
|
38699
|
+
return __async(this, null, function* () {
|
38700
|
+
yield this._credentialHandler.show();
|
38701
|
+
const appWindow = new WebAppWindow(url);
|
38702
|
+
appWindow.ready();
|
38703
|
+
appWindow.show();
|
38704
|
+
appWindow.handle._dialog = appWindow.dialog;
|
38705
|
+
return appWindow.handle;
|
38706
|
+
});
|
38707
|
+
}
|
38708
|
+
respondWith(handlerResponse) {
|
38709
|
+
this._promise = handlerResponse;
|
38710
|
+
}
|
38711
|
+
};
|
38712
|
+
__name(CredentialStoreEvent, "CredentialStoreEvent");
|
38713
|
+
|
38714
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlerService.js
|
38715
|
+
var CredentialHandlerService = class {
|
38716
|
+
constructor(credentialHandler) {
|
38717
|
+
this._credentialHandler = credentialHandler;
|
38718
|
+
}
|
38719
|
+
request(credentialRequestEvent) {
|
38720
|
+
return __async(this, null, function* () {
|
38721
|
+
return yield this._credentialHandler._emitter.emit(new CredentialRequestEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialRequestEvent)));
|
38722
|
+
});
|
38723
|
+
}
|
38724
|
+
store(credentialStoreEvent) {
|
38725
|
+
return __async(this, null, function* () {
|
38726
|
+
return yield this._credentialHandler._emitter.emit(new CredentialStoreEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialStoreEvent)));
|
38727
|
+
});
|
38728
|
+
}
|
38729
|
+
};
|
38730
|
+
__name(CredentialHandlerService, "CredentialHandlerService");
|
38731
|
+
|
38732
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandler.js
|
38733
|
+
var EVENT_TYPES = ["credentialrequest", "credentialstore"];
|
38734
|
+
var CredentialHandler = class extends WebApp {
|
38735
|
+
constructor(mediatorOrigin, inline = false) {
|
38736
|
+
if (typeof mediatorOrigin !== "string") {
|
38737
|
+
throw new TypeError('"mediatorOrigin" must be a string.');
|
38738
|
+
}
|
38739
|
+
super(mediatorOrigin, inline);
|
38740
|
+
this._emitter = new EventEmitter({
|
38741
|
+
waitUntil(event) {
|
38742
|
+
return __async(this, null, function* () {
|
38743
|
+
return event._promise || Promise.reject(new DOMException('No "credentialrequest" event handler found.', "NotFoundError"));
|
38744
|
+
});
|
38745
|
+
}
|
38746
|
+
});
|
38747
|
+
}
|
38748
|
+
connect() {
|
38749
|
+
return __async(this, null, function* () {
|
38750
|
+
const injector = yield __superGet(CredentialHandler.prototype, this, "connect").call(this);
|
38751
|
+
this.server.define("credentialHandler", new CredentialHandlerService(this));
|
38752
|
+
yield this.ready();
|
38753
|
+
return injector;
|
38754
|
+
});
|
38755
|
+
}
|
38756
|
+
addEventListener(eventType, fn) {
|
38757
|
+
if (!EVENT_TYPES.includes(eventType)) {
|
38758
|
+
throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
|
38759
|
+
}
|
38760
|
+
return this._emitter.addEventListener(eventType, fn);
|
38761
|
+
}
|
38762
|
+
removeEventListener(eventType, fn) {
|
38763
|
+
if (!EVENT_TYPES.includes(eventType)) {
|
38764
|
+
throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
|
38765
|
+
}
|
38766
|
+
return this._emitter.removeEventListener(eventType, fn);
|
38767
|
+
}
|
38768
|
+
};
|
38769
|
+
__name(CredentialHandler, "CredentialHandler");
|
38770
|
+
|
38771
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHints.js
|
38772
|
+
var CredentialHints = class {
|
38773
|
+
constructor(url, injector) {
|
38774
|
+
const remote = injector.get("credentialHints", {
|
38775
|
+
functions: ["delete", "get", "keys", "has", "set", "clear"]
|
38776
|
+
});
|
38777
|
+
for (let methodName in remote) {
|
38778
|
+
if (methodName !== "set") {
|
38779
|
+
const method = remote[methodName].bind(this, url);
|
38780
|
+
this[methodName] = function(...args) {
|
38781
|
+
this._deprecateNotice();
|
38782
|
+
return method(...args);
|
38783
|
+
};
|
38784
|
+
}
|
38785
|
+
}
|
38786
|
+
this._remoteSet = remote.set.bind(this, url);
|
38787
|
+
}
|
38788
|
+
set(hintKey, credentialHint) {
|
38789
|
+
return __async(this, null, function* () {
|
38790
|
+
this._deprecateNotice();
|
38791
|
+
credentialHint.icons = credentialHint.icons || [];
|
38792
|
+
const promises = credentialHint.icons.map((icon) => imageToDataUrl(icon.src).then((fetchedImage) => {
|
38793
|
+
icon.fetchedImage = fetchedImage;
|
38794
|
+
}));
|
38795
|
+
yield Promise.all(promises);
|
38796
|
+
return this._remoteSet(hintKey, credentialHint);
|
38797
|
+
});
|
38798
|
+
}
|
38799
|
+
_deprecateNotice() {
|
38800
|
+
console.warn("Credential hints are deprecated and no longer used.");
|
38801
|
+
}
|
38802
|
+
};
|
38803
|
+
__name(CredentialHints, "CredentialHints");
|
38804
|
+
function imageToDataUrl(url) {
|
38805
|
+
return new Promise((resolve) => {
|
38806
|
+
const img = new Image();
|
38807
|
+
img.crossOrigin = "Anonymous";
|
38808
|
+
img.onload = () => {
|
38809
|
+
let canvas = document.createElement("canvas");
|
38810
|
+
const ctx = canvas.getContext("2d");
|
38811
|
+
canvas.height = img.height;
|
38812
|
+
canvas.width = img.width;
|
38813
|
+
ctx.drawImage(img, 0, 0);
|
38814
|
+
const dataUrl = canvas.toDataURL();
|
38815
|
+
resolve(dataUrl);
|
38816
|
+
canvas = null;
|
38817
|
+
};
|
38818
|
+
img.onerror = () => resolve(null);
|
38819
|
+
img.src = url;
|
38820
|
+
});
|
38821
|
+
}
|
38822
|
+
__name(imageToDataUrl, "imageToDataUrl");
|
38823
|
+
|
38824
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialManager.js
|
38825
|
+
var CredentialManager = class {
|
38826
|
+
constructor(url, injector) {
|
38827
|
+
if (!(url && typeof url === "string")) {
|
38828
|
+
throw new TypeError('"url" must be a non-empty string.');
|
38829
|
+
}
|
38830
|
+
this.hints = new CredentialHints(url, injector);
|
38831
|
+
}
|
38832
|
+
static requestPermission() {
|
38833
|
+
return __async(this, null, function* () {
|
38834
|
+
const status = yield navigator.credentialsPolyfill.permissions.request({ name: "credentialhandler" });
|
38835
|
+
return status.state;
|
38836
|
+
});
|
38837
|
+
}
|
38838
|
+
};
|
38839
|
+
__name(CredentialManager, "CredentialManager");
|
38840
|
+
|
38841
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlerRegistration.js
|
38842
|
+
var CredentialHandlerRegistration = class {
|
38843
|
+
constructor(url, injector) {
|
38844
|
+
if (!(url && typeof url === "string")) {
|
38845
|
+
throw new TypeError('"url" must be a non-empty string.');
|
38846
|
+
}
|
38847
|
+
this.credentialManager = new CredentialManager(url, injector);
|
38848
|
+
}
|
38849
|
+
};
|
38850
|
+
__name(CredentialHandlerRegistration, "CredentialHandlerRegistration");
|
38851
|
+
|
38852
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialHandlers.js
|
38853
|
+
var CredentialHandlers = class {
|
38854
|
+
constructor(injector) {
|
38855
|
+
this._init = (() => __async(this, null, function* () {
|
38856
|
+
this._injector = yield injector;
|
38857
|
+
this._remote = this._injector.get("credentialHandlers", {
|
38858
|
+
functions: [
|
38859
|
+
"register",
|
38860
|
+
"unregister",
|
38861
|
+
"getRegistration",
|
38862
|
+
"hasRegistration"
|
38863
|
+
]
|
38864
|
+
});
|
38865
|
+
}))();
|
38866
|
+
}
|
38867
|
+
register(url) {
|
38868
|
+
return __async(this, null, function* () {
|
38869
|
+
this._deprecateNotice();
|
38870
|
+
yield this._init;
|
38871
|
+
url = yield this._remote.register("credential", url);
|
38872
|
+
return new CredentialHandlerRegistration(url, this._injector);
|
38873
|
+
});
|
38874
|
+
}
|
38875
|
+
unregister(url) {
|
38876
|
+
return __async(this, null, function* () {
|
38877
|
+
this._deprecateNotice();
|
38878
|
+
yield this._init;
|
38879
|
+
return this._remote.unregister("credential", url);
|
38880
|
+
});
|
38881
|
+
}
|
38882
|
+
getRegistration(url) {
|
38883
|
+
return __async(this, null, function* () {
|
38884
|
+
this._deprecateNotice();
|
38885
|
+
yield this._init;
|
38886
|
+
url = yield this._remote.getRegistration("credential", url);
|
38887
|
+
if (!url) {
|
38888
|
+
return null;
|
38889
|
+
}
|
38890
|
+
return new CredentialHandlerRegistration(url, this._injector);
|
38891
|
+
});
|
38892
|
+
}
|
38893
|
+
hasRegistration(url) {
|
38894
|
+
return __async(this, null, function* () {
|
38895
|
+
this._deprecateNotice();
|
38896
|
+
yield this._init;
|
38897
|
+
return yield this._remote.hasRegistration("credential", url);
|
38898
|
+
});
|
38899
|
+
}
|
38900
|
+
_deprecateNotice() {
|
38901
|
+
console.warn('Credential handler registration APIs are deprecated. The credential handler specified in "manifest.json" is now automatically registered when a user grants permission to install a credential handler via "CredentialManager.requestPermission()".');
|
38902
|
+
}
|
38903
|
+
};
|
38904
|
+
__name(CredentialHandlers, "CredentialHandlers");
|
38905
|
+
|
38906
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/WebCredential.js
|
38907
|
+
var WebCredential2 = class {
|
38908
|
+
constructor(dataType, data, { recommendedHandlerOrigins = [] } = {}) {
|
38909
|
+
if (typeof dataType !== "string") {
|
38910
|
+
throw new TypeError('"dataType" must be a string.');
|
38911
|
+
}
|
38912
|
+
this.type = "web";
|
38913
|
+
this.dataType = dataType;
|
38914
|
+
this.data = data;
|
38915
|
+
this.options = { recommendedHandlerOrigins };
|
38916
|
+
}
|
38917
|
+
};
|
38918
|
+
__name(WebCredential2, "WebCredential");
|
38919
|
+
|
38920
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/CredentialsContainer.js
|
38921
|
+
var CREDENTIAL_GET_TIMEOUT = 0;
|
38922
|
+
var CREDENTIAL_STORE_TIMEOUT = 0;
|
38923
|
+
var CredentialsContainer = class {
|
38924
|
+
constructor(injector) {
|
38925
|
+
this._nativeCredentialsContainer = {
|
38926
|
+
get: navigator.credentials && navigator.credentials.get && navigator.credentials.get.bind(navigator.credentials),
|
38927
|
+
store: navigator.credentials && navigator.credentials.store && navigator.credentials.store.bind(navigator.credentials)
|
38928
|
+
};
|
38929
|
+
this._init = (() => __async(this, null, function* () {
|
38930
|
+
this._remote = (yield injector).get("credentialsContainer", {
|
38931
|
+
functions: [
|
38932
|
+
{ name: "get", options: { timeout: CREDENTIAL_GET_TIMEOUT } },
|
38933
|
+
{ name: "store", options: { timeout: CREDENTIAL_STORE_TIMEOUT } }
|
38934
|
+
]
|
38935
|
+
});
|
38936
|
+
}))();
|
38937
|
+
}
|
38938
|
+
get() {
|
38939
|
+
return __async(this, arguments, function* (options = {}) {
|
38940
|
+
if (options.web) {
|
38941
|
+
yield this._init;
|
38942
|
+
const credential = yield this._remote.get(options);
|
38943
|
+
if (!credential) {
|
38944
|
+
return null;
|
38945
|
+
}
|
38946
|
+
return new WebCredential2(credential.dataType, credential.data);
|
38947
|
+
}
|
38948
|
+
if (this._nativeCredentialsContainer.get) {
|
38949
|
+
return this._nativeCredentialsContainer.get(options);
|
38950
|
+
}
|
38951
|
+
throw new DOMException("Not implemented.", "NotSupportedError");
|
38952
|
+
});
|
38953
|
+
}
|
38954
|
+
store(credential) {
|
38955
|
+
return __async(this, null, function* () {
|
38956
|
+
if (credential instanceof WebCredential2) {
|
38957
|
+
yield this._init;
|
38958
|
+
const result = yield this._remote.store(credential);
|
38959
|
+
if (!result) {
|
38960
|
+
return null;
|
38961
|
+
}
|
38962
|
+
return new WebCredential2(result.dataType, result.data);
|
38963
|
+
}
|
38964
|
+
if (this._nativeCredentialsContainer.store) {
|
38965
|
+
return this._nativeCredentialsContainer.store(credential);
|
38966
|
+
}
|
38967
|
+
throw new DOMException("Not implemented.", "NotSupportedError");
|
38968
|
+
});
|
38969
|
+
}
|
38970
|
+
};
|
38971
|
+
__name(CredentialsContainer, "CredentialsContainer");
|
38972
|
+
|
38973
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/PermissionManager.js
|
38974
|
+
var PERMISSION_REQUEST_TIMEOUT = 0;
|
38975
|
+
var PermissionManager = class {
|
38976
|
+
constructor(injector) {
|
38977
|
+
this._init = (() => __async(this, null, function* () {
|
38978
|
+
this._remote = (yield injector).get("permissionManager", {
|
38979
|
+
functions: [
|
38980
|
+
"query",
|
38981
|
+
{ name: "request", options: { timeout: PERMISSION_REQUEST_TIMEOUT } },
|
38982
|
+
"revoke"
|
38983
|
+
]
|
38984
|
+
});
|
38985
|
+
}))();
|
38986
|
+
}
|
38987
|
+
query(permissionDesc) {
|
38988
|
+
return __async(this, null, function* () {
|
38989
|
+
yield this._init;
|
38990
|
+
return yield this._remote.query(permissionDesc);
|
38991
|
+
});
|
38992
|
+
}
|
38993
|
+
request(permissionDesc) {
|
38994
|
+
return __async(this, null, function* () {
|
38995
|
+
yield this._init;
|
38996
|
+
return yield this._remote.request(permissionDesc);
|
38997
|
+
});
|
38998
|
+
}
|
38999
|
+
revoke(permissionDesc) {
|
39000
|
+
return __async(this, null, function* () {
|
39001
|
+
yield this._init;
|
39002
|
+
return yield this._remote.revoke(permissionDesc);
|
39003
|
+
});
|
39004
|
+
}
|
39005
|
+
};
|
39006
|
+
__name(PermissionManager, "PermissionManager");
|
39007
|
+
|
39008
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.0/node_modules/credential-handler-polyfill/index.js
|
39009
|
+
var DEFAULT_MEDIATOR_ORIGIN = "https://authn.io";
|
39010
|
+
var loaded;
|
39011
|
+
function loadOnce(options) {
|
39012
|
+
return __async(this, null, function* () {
|
39013
|
+
if (loaded) {
|
39014
|
+
return loaded;
|
39015
|
+
}
|
39016
|
+
loaded = true;
|
39017
|
+
return load2(options);
|
39018
|
+
});
|
39019
|
+
}
|
39020
|
+
__name(loadOnce, "loadOnce");
|
39021
|
+
function load2() {
|
39022
|
+
return __async(this, arguments, function* (options = {
|
39023
|
+
mediatorOrigin: DEFAULT_MEDIATOR_ORIGIN
|
39024
|
+
}) {
|
39025
|
+
let mediatorUrl;
|
39026
|
+
if (typeof options === "string") {
|
39027
|
+
mediatorUrl = options;
|
39028
|
+
} else if (options && typeof options === "object" && typeof options.mediatorOrigin === "string") {
|
39029
|
+
mediatorUrl = `${options.mediatorOrigin}/mediator`;
|
39030
|
+
} else {
|
39031
|
+
throw new Error('"options.mediatorOrigin" must be a string expressing the origin of the mediator.');
|
39032
|
+
}
|
39033
|
+
const appContext = new WebAppContext();
|
39034
|
+
const injector = appContext.createWindow(mediatorUrl, {
|
39035
|
+
className: "credential-mediator",
|
39036
|
+
timeout: 3e4
|
39037
|
+
});
|
39038
|
+
const style = document.createElement("style");
|
39039
|
+
style.appendChild(document.createTextNode(`dialog.web-app-window.credential-mediator > .web-app-window-backdrop {
|
39040
|
+
background-color: rgba(0, 0, 0, 0.25);
|
39041
|
+
}`));
|
39042
|
+
document.body.appendChild(style);
|
39043
|
+
const polyfill = {};
|
39044
|
+
polyfill.permissions = new PermissionManager(injector);
|
39045
|
+
polyfill.CredentialHandlers = new CredentialHandlers(injector);
|
39046
|
+
polyfill.CredentialHandler = CredentialHandler;
|
39047
|
+
polyfill.CredentialManager = CredentialManager;
|
39048
|
+
polyfill.credentials = new CredentialsContainer(injector);
|
39049
|
+
polyfill.WebCredential = WebCredential2;
|
39050
|
+
navigator.credentialsPolyfill = polyfill;
|
39051
|
+
if ("credentials" in navigator) {
|
39052
|
+
navigator.credentials.get = polyfill.credentials.get.bind(polyfill.credentials);
|
39053
|
+
navigator.credentials.store = polyfill.credentials.store.bind(polyfill.credentials);
|
39054
|
+
} else {
|
39055
|
+
navigator.credentials = polyfill.credentials;
|
39056
|
+
}
|
39057
|
+
window.CredentialManager = CredentialManager;
|
39058
|
+
window.WebCredential = WebCredential2;
|
39059
|
+
return polyfill;
|
39060
|
+
});
|
39061
|
+
}
|
39062
|
+
__name(load2, "load");
|
39063
|
+
|
39064
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/CredentialEventProxy.js
|
39065
|
+
var PROXY_EVENT_TIMEOUT = 6e4;
|
39066
|
+
var CredentialEventProxy = class extends WebApp {
|
39067
|
+
constructor() {
|
39068
|
+
super(window.location.origin);
|
39069
|
+
}
|
39070
|
+
receive() {
|
39071
|
+
return __async(this, null, function* () {
|
39072
|
+
const self2 = this;
|
39073
|
+
yield self2.connect();
|
39074
|
+
return new Promise((resolveReceive, rejectReceive) => {
|
39075
|
+
const timeoutId = setTimeout(() => {
|
39076
|
+
rejectReceive(new Error("Timed out waiting to receive event."));
|
39077
|
+
}, PROXY_EVENT_TIMEOUT);
|
39078
|
+
self2.server.define("credentialEventProxy", {
|
39079
|
+
send(event) {
|
39080
|
+
return __async(this, null, function* () {
|
39081
|
+
resolveReceive(event);
|
39082
|
+
clearTimeout(timeoutId);
|
39083
|
+
return new Promise((resolveSend, rejectSend) => {
|
39084
|
+
event.respondWith = (promise) => {
|
39085
|
+
try {
|
39086
|
+
resolveSend(promise);
|
39087
|
+
} catch (e) {
|
39088
|
+
rejectSend(e);
|
39089
|
+
}
|
39090
|
+
};
|
39091
|
+
});
|
39092
|
+
});
|
39093
|
+
}
|
39094
|
+
});
|
39095
|
+
self2.ready();
|
39096
|
+
});
|
39097
|
+
});
|
39098
|
+
}
|
39099
|
+
};
|
39100
|
+
__name(CredentialEventProxy, "CredentialEventProxy");
|
39101
|
+
|
39102
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/index.js
|
39103
|
+
var DEFAULT_MEDIATOR = "https://authn.io";
|
39104
|
+
function installHandler() {
|
39105
|
+
return __async(this, null, function* () {
|
39106
|
+
const CredentialManager2 = navigator.credentialsPolyfill.CredentialManager;
|
39107
|
+
const result = yield CredentialManager2.requestPermission();
|
39108
|
+
if (result !== "granted") {
|
39109
|
+
throw new Error("Permission denied.");
|
39110
|
+
}
|
39111
|
+
});
|
39112
|
+
}
|
39113
|
+
__name(installHandler, "installHandler");
|
39114
|
+
function activateHandler(_0) {
|
39115
|
+
return __async(this, arguments, function* ({
|
39116
|
+
mediatorOrigin = DEFAULT_MEDIATOR,
|
39117
|
+
get: get2,
|
39118
|
+
store
|
39119
|
+
}) {
|
39120
|
+
if (!(get2 || store)) {
|
39121
|
+
throw new Error('"get" or "store" function(s) must be specified.');
|
39122
|
+
}
|
39123
|
+
const CredentialHandler2 = navigator.credentialsPolyfill.CredentialHandler;
|
39124
|
+
const self2 = new CredentialHandler2(mediatorOrigin);
|
39125
|
+
if (get2) {
|
39126
|
+
if (typeof get2 !== "function") {
|
39127
|
+
throw new TypeError('"get" must be a function.');
|
39128
|
+
}
|
39129
|
+
self2.addEventListener("credentialrequest", (event) => listener({ event, get: get2 }));
|
39130
|
+
}
|
39131
|
+
if (store) {
|
39132
|
+
if (typeof store !== "function") {
|
39133
|
+
throw new TypeError('"store" must be a function.');
|
39134
|
+
}
|
39135
|
+
self2.addEventListener("credentialstore", (event) => listener({ event, store }));
|
39136
|
+
}
|
39137
|
+
yield self2.connect();
|
39138
|
+
});
|
39139
|
+
}
|
39140
|
+
__name(activateHandler, "activateHandler");
|
39141
|
+
function receiveCredentialEvent() {
|
39142
|
+
return __async(this, null, function* () {
|
39143
|
+
const proxy = new CredentialEventProxy();
|
39144
|
+
return proxy.receive();
|
39145
|
+
});
|
39146
|
+
}
|
39147
|
+
__name(receiveCredentialEvent, "receiveCredentialEvent");
|
39148
|
+
function listener({ event, get: get2, store }) {
|
39149
|
+
event.respondWith(createResponse({ event, get: get2, store }));
|
39150
|
+
}
|
39151
|
+
__name(listener, "listener");
|
39152
|
+
function createResponse(_0) {
|
39153
|
+
return __async(this, arguments, function* ({ event, get: get2, store }) {
|
39154
|
+
const result = yield (get2 || store)({ event });
|
39155
|
+
if (!(result && typeof result === "object")) {
|
39156
|
+
throw new TypeError('Return value of "get" or "store" hook must be an object.');
|
39157
|
+
}
|
39158
|
+
if (result.type === "response") {
|
39159
|
+
return { dataType: result.dataType, data: result.data };
|
39160
|
+
}
|
39161
|
+
if (result.type === "redirect") {
|
39162
|
+
const appContext = new WebAppContext();
|
39163
|
+
const handle = yield event.openWindow(result.url);
|
39164
|
+
const windowReady = appContext.createWindow(result.url, {
|
39165
|
+
handle,
|
39166
|
+
popup: false,
|
39167
|
+
timeout: 6e5
|
39168
|
+
});
|
39169
|
+
const injector = yield windowReady;
|
39170
|
+
const proxy = injector.get("credentialEventProxy", {
|
39171
|
+
functions: [{ name: "send", options: { timeout: 0 } }]
|
39172
|
+
});
|
39173
|
+
return proxy.send({
|
39174
|
+
type: event.type,
|
39175
|
+
credentialRequestOptions: event.credentialRequestOptions,
|
39176
|
+
credentialRequestOrigin: event.credentialRequestOrigin,
|
39177
|
+
credential: event.credential,
|
39178
|
+
hintKey: event.hintKey
|
39179
|
+
});
|
39180
|
+
}
|
39181
|
+
throw new Error('Return value of "get" or "store" must have a type of "response" or "redirect".');
|
39182
|
+
});
|
39183
|
+
}
|
39184
|
+
__name(createResponse, "createResponse");
|
39185
|
+
|
39186
|
+
// src/wallet/plugins/chapi/chapi.ts
|
39187
|
+
var getCHAPIPlugin = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
|
39188
|
+
if (typeof window === "undefined") {
|
39189
|
+
return {
|
39190
|
+
pluginMethods: {
|
39191
|
+
installChapiHandler: () => __async(void 0, null, function* () {
|
39192
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39193
|
+
}),
|
39194
|
+
activateChapiHandler: () => __async(void 0, null, function* () {
|
39195
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39196
|
+
}),
|
39197
|
+
receiveChapiEvent: () => __async(void 0, null, function* () {
|
39198
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39199
|
+
}),
|
39200
|
+
storeCredentialViaChapiDidAuth: () => __async(void 0, null, function* () {
|
39201
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39202
|
+
}),
|
39203
|
+
storePresentationViaChapi: () => __async(void 0, null, function* () {
|
39204
|
+
throw new Error("CHAPI is only available inside of a browser!");
|
39205
|
+
})
|
39206
|
+
}
|
39207
|
+
};
|
39208
|
+
}
|
39209
|
+
yield loadOnce();
|
39210
|
+
return {
|
39211
|
+
pluginMethods: {
|
39212
|
+
installChapiHandler: () => __async(void 0, null, function* () {
|
39213
|
+
return installHandler();
|
39214
|
+
}),
|
39215
|
+
activateChapiHandler: (_0, _1) => __async(void 0, [_0, _1], function* (_wallet, {
|
39216
|
+
mediatorOrigin = `https://authn.io/mediator?${encodeURIComponent(window.location.origin)}`,
|
39217
|
+
get: get2,
|
39218
|
+
store
|
39219
|
+
}) {
|
39220
|
+
return activateHandler({ mediatorOrigin, get: get2, store });
|
39221
|
+
}),
|
39222
|
+
receiveChapiEvent: () => __async(void 0, null, function* () {
|
39223
|
+
return receiveCredentialEvent();
|
39224
|
+
}),
|
39225
|
+
storeCredentialViaChapiDidAuth: (wallet, credential) => __async(void 0, null, function* () {
|
39226
|
+
var _a, _b, _c;
|
39227
|
+
const challenge = crypto.randomUUID();
|
39228
|
+
const domain = window.location.origin;
|
39229
|
+
const vpr = {
|
39230
|
+
web: {
|
39231
|
+
VerifiablePresentation: {
|
39232
|
+
query: { type: "DIDAuthentication" },
|
39233
|
+
challenge,
|
39234
|
+
domain
|
39235
|
+
}
|
39236
|
+
}
|
39237
|
+
};
|
39238
|
+
const res = yield navigator.credentials.get(vpr);
|
39239
|
+
if (!res)
|
39240
|
+
return { success: false, reason: "did not auth" };
|
39241
|
+
const verification = yield wallet.pluginMethods.verifyPresentation(res.data, {
|
39242
|
+
challenge,
|
39243
|
+
domain
|
39244
|
+
});
|
39245
|
+
if (verification.warnings.length > 0 || verification.errors.length > 0) {
|
39246
|
+
return { success: false, reason: "auth failed verification" };
|
39247
|
+
}
|
39248
|
+
const subject = (_c = (_b = (_a = res.data) == null ? void 0 : _a.proof) == null ? void 0 : _b.verificationMethod) == null ? void 0 : _c.split("#")[0];
|
39249
|
+
if (!Array.isArray(credential.credentialSubject)) {
|
39250
|
+
credential.credentialSubject.id = subject;
|
39251
|
+
}
|
39252
|
+
const vp = yield wallet.pluginMethods.issuePresentation(yield wallet.pluginMethods.getTestVp(yield wallet.pluginMethods.issueCredential(credential)));
|
39253
|
+
const success = yield wallet.pluginMethods.storePresentationViaChapi(vp);
|
39254
|
+
if (success)
|
39255
|
+
return { success: true };
|
39256
|
+
return { success: false, reason: "did not store" };
|
39257
|
+
}),
|
39258
|
+
storePresentationViaChapi: (_wallet, presentation) => __async(void 0, null, function* () {
|
39259
|
+
const wc = new WebCredential("VerifiablePresentation", presentation);
|
39260
|
+
return window.navigator.credentials.store(wc);
|
39261
|
+
})
|
39262
|
+
}
|
39263
|
+
};
|
39264
|
+
}), "getCHAPIPlugin");
|
36120
39265
|
|
36121
39266
|
// src/wallet/plugins/vc-templates/templates.ts
|
36122
39267
|
var VC_TEMPLATES = {
|
@@ -36165,9 +39310,9 @@ var VC_TEMPLATES = {
|
|
36165
39310
|
};
|
36166
39311
|
|
36167
39312
|
// src/wallet/plugins/vc-templates/vc-templates.ts
|
36168
|
-
var getVCTemplatesPlugin = /* @__PURE__ */ __name((
|
39313
|
+
var getVCTemplatesPlugin = /* @__PURE__ */ __name(() => {
|
36169
39314
|
return {
|
36170
|
-
pluginMethods:
|
39315
|
+
pluginMethods: {
|
36171
39316
|
newCredential: (_wallet, args = { type: "basic" }) => {
|
36172
39317
|
var _a, _b;
|
36173
39318
|
const did = args.did || ((_b = (_a = _wallet.pluginMethods).getSubjectDid) == null ? void 0 : _b.call(_a, "key"));
|
@@ -36195,7 +39340,7 @@ var getVCTemplatesPlugin = /* @__PURE__ */ __name((wallet) => {
|
|
36195
39340
|
verifiableCredential: credential
|
36196
39341
|
};
|
36197
39342
|
})
|
36198
|
-
}
|
39343
|
+
}
|
36199
39344
|
};
|
36200
39345
|
}, "getVCTemplatesPlugin");
|
36201
39346
|
|
@@ -40868,14 +44013,20 @@ var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
|
|
40868
44013
|
var emptyWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* ({ didkit } = {}) {
|
40869
44014
|
const didkitWallet = yield (yield generateWallet()).addPlugin(yield getDidKitPlugin(didkit));
|
40870
44015
|
const expirationWallet = yield didkitWallet.addPlugin(ExpirationPlugin(didkitWallet));
|
40871
|
-
const
|
44016
|
+
const templatesWallet = yield expirationWallet.addPlugin(getVCTemplatesPlugin());
|
44017
|
+
const wallet = yield templatesWallet.addPlugin(yield getCHAPIPlugin());
|
40872
44018
|
return {
|
40873
44019
|
_wallet: wallet,
|
40874
44020
|
newCredential: wallet.pluginMethods.newCredential,
|
40875
44021
|
newPresentation: wallet.pluginMethods.newPresentation,
|
40876
44022
|
verifyCredential: verifyCredential2(wallet),
|
40877
44023
|
verifyPresentation: wallet.pluginMethods.verifyPresentation,
|
40878
|
-
resolveDid: wallet.pluginMethods.resolveDid
|
44024
|
+
resolveDid: wallet.pluginMethods.resolveDid,
|
44025
|
+
installChapiHandler: wallet.pluginMethods.installChapiHandler,
|
44026
|
+
activateChapiHandler: wallet.pluginMethods.activateChapiHandler,
|
44027
|
+
receiveChapiEvent: wallet.pluginMethods.receiveChapiEvent,
|
44028
|
+
storePresentationViaChapi: wallet.pluginMethods.storePresentationViaChapi,
|
44029
|
+
storeCredentialViaChapiDidAuth: wallet.pluginMethods.storeCredentialViaChapiDidAuth
|
40879
44030
|
};
|
40880
44031
|
}), "emptyWallet");
|
40881
44032
|
|
@@ -48878,75 +52029,75 @@ var PatchError = function(_super) {
|
|
48878
52029
|
var JsonPatchError = PatchError;
|
48879
52030
|
var deepClone = _deepClone;
|
48880
52031
|
var objOps = {
|
48881
|
-
add: function(obj, key2,
|
52032
|
+
add: function(obj, key2, document2) {
|
48882
52033
|
obj[key2] = this.value;
|
48883
|
-
return { newDocument:
|
52034
|
+
return { newDocument: document2 };
|
48884
52035
|
},
|
48885
|
-
remove: function(obj, key2,
|
52036
|
+
remove: function(obj, key2, document2) {
|
48886
52037
|
var removed = obj[key2];
|
48887
52038
|
delete obj[key2];
|
48888
|
-
return { newDocument:
|
52039
|
+
return { newDocument: document2, removed };
|
48889
52040
|
},
|
48890
|
-
replace: function(obj, key2,
|
52041
|
+
replace: function(obj, key2, document2) {
|
48891
52042
|
var removed = obj[key2];
|
48892
52043
|
obj[key2] = this.value;
|
48893
|
-
return { newDocument:
|
52044
|
+
return { newDocument: document2, removed };
|
48894
52045
|
},
|
48895
|
-
move: function(obj, key2,
|
48896
|
-
var removed = getValueByPointer(
|
52046
|
+
move: function(obj, key2, document2) {
|
52047
|
+
var removed = getValueByPointer(document2, this.path);
|
48897
52048
|
if (removed) {
|
48898
52049
|
removed = _deepClone(removed);
|
48899
52050
|
}
|
48900
|
-
var originalValue = applyOperation(
|
48901
|
-
applyOperation(
|
48902
|
-
return { newDocument:
|
52051
|
+
var originalValue = applyOperation(document2, { op: "remove", path: this.from }).removed;
|
52052
|
+
applyOperation(document2, { op: "add", path: this.path, value: originalValue });
|
52053
|
+
return { newDocument: document2, removed };
|
48903
52054
|
},
|
48904
|
-
copy: function(obj, key2,
|
48905
|
-
var valueToCopy = getValueByPointer(
|
48906
|
-
applyOperation(
|
48907
|
-
return { newDocument:
|
52055
|
+
copy: function(obj, key2, document2) {
|
52056
|
+
var valueToCopy = getValueByPointer(document2, this.from);
|
52057
|
+
applyOperation(document2, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
|
52058
|
+
return { newDocument: document2 };
|
48908
52059
|
},
|
48909
|
-
test: function(obj, key2,
|
48910
|
-
return { newDocument:
|
52060
|
+
test: function(obj, key2, document2) {
|
52061
|
+
return { newDocument: document2, test: _areEquals(obj[key2], this.value) };
|
48911
52062
|
},
|
48912
|
-
_get: function(obj, key2,
|
52063
|
+
_get: function(obj, key2, document2) {
|
48913
52064
|
this.value = obj[key2];
|
48914
|
-
return { newDocument:
|
52065
|
+
return { newDocument: document2 };
|
48915
52066
|
}
|
48916
52067
|
};
|
48917
52068
|
var arrOps = {
|
48918
|
-
add: function(arr, i,
|
52069
|
+
add: function(arr, i, document2) {
|
48919
52070
|
if (isInteger2(i)) {
|
48920
52071
|
arr.splice(i, 0, this.value);
|
48921
52072
|
} else {
|
48922
52073
|
arr[i] = this.value;
|
48923
52074
|
}
|
48924
|
-
return { newDocument:
|
52075
|
+
return { newDocument: document2, index: i };
|
48925
52076
|
},
|
48926
|
-
remove: function(arr, i,
|
52077
|
+
remove: function(arr, i, document2) {
|
48927
52078
|
var removedList = arr.splice(i, 1);
|
48928
|
-
return { newDocument:
|
52079
|
+
return { newDocument: document2, removed: removedList[0] };
|
48929
52080
|
},
|
48930
|
-
replace: function(arr, i,
|
52081
|
+
replace: function(arr, i, document2) {
|
48931
52082
|
var removed = arr[i];
|
48932
52083
|
arr[i] = this.value;
|
48933
|
-
return { newDocument:
|
52084
|
+
return { newDocument: document2, removed };
|
48934
52085
|
},
|
48935
52086
|
move: objOps.move,
|
48936
52087
|
copy: objOps.copy,
|
48937
52088
|
test: objOps.test,
|
48938
52089
|
_get: objOps._get
|
48939
52090
|
};
|
48940
|
-
function getValueByPointer(
|
52091
|
+
function getValueByPointer(document2, pointer) {
|
48941
52092
|
if (pointer == "") {
|
48942
|
-
return
|
52093
|
+
return document2;
|
48943
52094
|
}
|
48944
52095
|
var getOriginalDestination = { op: "_get", path: pointer };
|
48945
|
-
applyOperation(
|
52096
|
+
applyOperation(document2, getOriginalDestination);
|
48946
52097
|
return getOriginalDestination.value;
|
48947
52098
|
}
|
48948
52099
|
__name(getValueByPointer, "getValueByPointer");
|
48949
|
-
function applyOperation(
|
52100
|
+
function applyOperation(document2, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
|
48950
52101
|
if (validateOperation === void 0) {
|
48951
52102
|
validateOperation = false;
|
48952
52103
|
}
|
@@ -48961,54 +52112,54 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
48961
52112
|
}
|
48962
52113
|
if (validateOperation) {
|
48963
52114
|
if (typeof validateOperation == "function") {
|
48964
|
-
validateOperation(operation, 0,
|
52115
|
+
validateOperation(operation, 0, document2, operation.path);
|
48965
52116
|
} else {
|
48966
52117
|
validator(operation, 0);
|
48967
52118
|
}
|
48968
52119
|
}
|
48969
52120
|
if (operation.path === "") {
|
48970
|
-
var returnValue = { newDocument:
|
52121
|
+
var returnValue = { newDocument: document2 };
|
48971
52122
|
if (operation.op === "add") {
|
48972
52123
|
returnValue.newDocument = operation.value;
|
48973
52124
|
return returnValue;
|
48974
52125
|
} else if (operation.op === "replace") {
|
48975
52126
|
returnValue.newDocument = operation.value;
|
48976
|
-
returnValue.removed =
|
52127
|
+
returnValue.removed = document2;
|
48977
52128
|
return returnValue;
|
48978
52129
|
} else if (operation.op === "move" || operation.op === "copy") {
|
48979
|
-
returnValue.newDocument = getValueByPointer(
|
52130
|
+
returnValue.newDocument = getValueByPointer(document2, operation.from);
|
48980
52131
|
if (operation.op === "move") {
|
48981
|
-
returnValue.removed =
|
52132
|
+
returnValue.removed = document2;
|
48982
52133
|
}
|
48983
52134
|
return returnValue;
|
48984
52135
|
} else if (operation.op === "test") {
|
48985
|
-
returnValue.test = _areEquals(
|
52136
|
+
returnValue.test = _areEquals(document2, operation.value);
|
48986
52137
|
if (returnValue.test === false) {
|
48987
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52138
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
48988
52139
|
}
|
48989
|
-
returnValue.newDocument =
|
52140
|
+
returnValue.newDocument = document2;
|
48990
52141
|
return returnValue;
|
48991
52142
|
} else if (operation.op === "remove") {
|
48992
|
-
returnValue.removed =
|
52143
|
+
returnValue.removed = document2;
|
48993
52144
|
returnValue.newDocument = null;
|
48994
52145
|
return returnValue;
|
48995
52146
|
} else if (operation.op === "_get") {
|
48996
|
-
operation.value =
|
52147
|
+
operation.value = document2;
|
48997
52148
|
return returnValue;
|
48998
52149
|
} else {
|
48999
52150
|
if (validateOperation) {
|
49000
|
-
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation,
|
52151
|
+
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document2);
|
49001
52152
|
} else {
|
49002
52153
|
return returnValue;
|
49003
52154
|
}
|
49004
52155
|
}
|
49005
52156
|
} else {
|
49006
52157
|
if (!mutateDocument) {
|
49007
|
-
|
52158
|
+
document2 = _deepClone(document2);
|
49008
52159
|
}
|
49009
52160
|
var path = operation.path || "";
|
49010
52161
|
var keys = path.split("/");
|
49011
|
-
var obj =
|
52162
|
+
var obj = document2;
|
49012
52163
|
var t = 1;
|
49013
52164
|
var len = keys.length;
|
49014
52165
|
var existingPathFragment = void 0;
|
@@ -49035,7 +52186,7 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
49035
52186
|
existingPathFragment = operation.path;
|
49036
52187
|
}
|
49037
52188
|
if (existingPathFragment !== void 0) {
|
49038
|
-
validateFunction(operation, 0,
|
52189
|
+
validateFunction(operation, 0, document2, existingPathFragment);
|
49039
52190
|
}
|
49040
52191
|
}
|
49041
52192
|
}
|
@@ -49045,39 +52196,39 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
|
|
49045
52196
|
key2 = obj.length;
|
49046
52197
|
} else {
|
49047
52198
|
if (validateOperation && !isInteger2(key2)) {
|
49048
|
-
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation,
|
52199
|
+
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document2);
|
49049
52200
|
} else if (isInteger2(key2)) {
|
49050
52201
|
key2 = ~~key2;
|
49051
52202
|
}
|
49052
52203
|
}
|
49053
52204
|
if (t >= len) {
|
49054
52205
|
if (validateOperation && operation.op === "add" && key2 > obj.length) {
|
49055
|
-
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation,
|
52206
|
+
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document2);
|
49056
52207
|
}
|
49057
|
-
var returnValue = arrOps[operation.op].call(operation, obj, key2,
|
52208
|
+
var returnValue = arrOps[operation.op].call(operation, obj, key2, document2);
|
49058
52209
|
if (returnValue.test === false) {
|
49059
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52210
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49060
52211
|
}
|
49061
52212
|
return returnValue;
|
49062
52213
|
}
|
49063
52214
|
} else {
|
49064
52215
|
if (t >= len) {
|
49065
|
-
var returnValue = objOps[operation.op].call(operation, obj, key2,
|
52216
|
+
var returnValue = objOps[operation.op].call(operation, obj, key2, document2);
|
49066
52217
|
if (returnValue.test === false) {
|
49067
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52218
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49068
52219
|
}
|
49069
52220
|
return returnValue;
|
49070
52221
|
}
|
49071
52222
|
}
|
49072
52223
|
obj = obj[key2];
|
49073
52224
|
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
49074
|
-
throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation,
|
52225
|
+
throw new JsonPatchError("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", index, operation, document2);
|
49075
52226
|
}
|
49076
52227
|
}
|
49077
52228
|
}
|
49078
52229
|
}
|
49079
52230
|
__name(applyOperation, "applyOperation");
|
49080
|
-
function applyPatch(
|
52231
|
+
function applyPatch(document2, patch, validateOperation, mutateDocument, banPrototypeModifications) {
|
49081
52232
|
if (mutateDocument === void 0) {
|
49082
52233
|
mutateDocument = true;
|
49083
52234
|
}
|
@@ -49090,72 +52241,72 @@ function applyPatch(document, patch, validateOperation, mutateDocument, banProto
|
|
49090
52241
|
}
|
49091
52242
|
}
|
49092
52243
|
if (!mutateDocument) {
|
49093
|
-
|
52244
|
+
document2 = _deepClone(document2);
|
49094
52245
|
}
|
49095
52246
|
var results = new Array(patch.length);
|
49096
52247
|
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
49097
|
-
results[i] = applyOperation(
|
49098
|
-
|
52248
|
+
results[i] = applyOperation(document2, patch[i], validateOperation, true, banPrototypeModifications, i);
|
52249
|
+
document2 = results[i].newDocument;
|
49099
52250
|
}
|
49100
|
-
results.newDocument =
|
52251
|
+
results.newDocument = document2;
|
49101
52252
|
return results;
|
49102
52253
|
}
|
49103
52254
|
__name(applyPatch, "applyPatch");
|
49104
|
-
function applyReducer(
|
49105
|
-
var operationResult = applyOperation(
|
52255
|
+
function applyReducer(document2, operation, index) {
|
52256
|
+
var operationResult = applyOperation(document2, operation);
|
49106
52257
|
if (operationResult.test === false) {
|
49107
|
-
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation,
|
52258
|
+
throw new JsonPatchError("Test operation failed", "TEST_OPERATION_FAILED", index, operation, document2);
|
49108
52259
|
}
|
49109
52260
|
return operationResult.newDocument;
|
49110
52261
|
}
|
49111
52262
|
__name(applyReducer, "applyReducer");
|
49112
|
-
function validator(operation, index,
|
52263
|
+
function validator(operation, index, document2, existingPathFragment) {
|
49113
52264
|
if (typeof operation !== "object" || operation === null || Array.isArray(operation)) {
|
49114
|
-
throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation,
|
52265
|
+
throw new JsonPatchError("Operation is not an object", "OPERATION_NOT_AN_OBJECT", index, operation, document2);
|
49115
52266
|
} else if (!objOps[operation.op]) {
|
49116
|
-
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation,
|
52267
|
+
throw new JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", index, operation, document2);
|
49117
52268
|
} else if (typeof operation.path !== "string") {
|
49118
|
-
throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation,
|
52269
|
+
throw new JsonPatchError("Operation `path` property is not a string", "OPERATION_PATH_INVALID", index, operation, document2);
|
49119
52270
|
} else if (operation.path.indexOf("/") !== 0 && operation.path.length > 0) {
|
49120
|
-
throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", index, operation,
|
52271
|
+
throw new JsonPatchError('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", index, operation, document2);
|
49121
52272
|
} else if ((operation.op === "move" || operation.op === "copy") && typeof operation.from !== "string") {
|
49122
|
-
throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation,
|
52273
|
+
throw new JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", index, operation, document2);
|
49123
52274
|
} else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && operation.value === void 0) {
|
49124
|
-
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation,
|
52275
|
+
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", index, operation, document2);
|
49125
52276
|
} else if ((operation.op === "add" || operation.op === "replace" || operation.op === "test") && hasUndefined(operation.value)) {
|
49126
|
-
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation,
|
49127
|
-
} else if (
|
52277
|
+
throw new JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", index, operation, document2);
|
52278
|
+
} else if (document2) {
|
49128
52279
|
if (operation.op == "add") {
|
49129
52280
|
var pathLen = operation.path.split("/").length;
|
49130
52281
|
var existingPathLen = existingPathFragment.split("/").length;
|
49131
52282
|
if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
|
49132
|
-
throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation,
|
52283
|
+
throw new JsonPatchError("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", index, operation, document2);
|
49133
52284
|
}
|
49134
52285
|
} else if (operation.op === "replace" || operation.op === "remove" || operation.op === "_get") {
|
49135
52286
|
if (operation.path !== existingPathFragment) {
|
49136
|
-
throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation,
|
52287
|
+
throw new JsonPatchError("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", index, operation, document2);
|
49137
52288
|
}
|
49138
52289
|
} else if (operation.op === "move" || operation.op === "copy") {
|
49139
52290
|
var existingValue = { op: "_get", path: operation.from, value: void 0 };
|
49140
|
-
var error = validate5([existingValue],
|
52291
|
+
var error = validate5([existingValue], document2);
|
49141
52292
|
if (error && error.name === "OPERATION_PATH_UNRESOLVABLE") {
|
49142
|
-
throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation,
|
52293
|
+
throw new JsonPatchError("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", index, operation, document2);
|
49143
52294
|
}
|
49144
52295
|
}
|
49145
52296
|
}
|
49146
52297
|
}
|
49147
52298
|
__name(validator, "validator");
|
49148
|
-
function validate5(sequence,
|
52299
|
+
function validate5(sequence, document2, externalValidator) {
|
49149
52300
|
try {
|
49150
52301
|
if (!Array.isArray(sequence)) {
|
49151
52302
|
throw new JsonPatchError("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
49152
52303
|
}
|
49153
|
-
if (
|
49154
|
-
applyPatch(_deepClone(
|
52304
|
+
if (document2) {
|
52305
|
+
applyPatch(_deepClone(document2), _deepClone(sequence), externalValidator || true);
|
49155
52306
|
} else {
|
49156
52307
|
externalValidator = externalValidator || validator;
|
49157
52308
|
for (var i = 0; i < sequence.length; i++) {
|
49158
|
-
externalValidator(sequence[i], i,
|
52309
|
+
externalValidator(sequence[i], i, document2, void 0);
|
49159
52310
|
}
|
49160
52311
|
}
|
49161
52312
|
} catch (e) {
|
@@ -49383,11 +52534,11 @@ var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, {
|
|
49383
52534
|
unescapePathComponent
|
49384
52535
|
});
|
49385
52536
|
|
49386
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
52537
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
49387
52538
|
var import_lodash3 = __toESM(require_lodash(), 1);
|
49388
52539
|
var import_random3 = __toESM(require_random(), 1);
|
49389
52540
|
|
49390
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/streamopts.js
|
52541
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/streamopts.js
|
49391
52542
|
var SyncOptions;
|
49392
52543
|
(function(SyncOptions2) {
|
49393
52544
|
SyncOptions2[SyncOptions2["PREFER_CACHE"] = 0] = "PREFER_CACHE";
|
@@ -49395,7 +52546,7 @@ var SyncOptions;
|
|
49395
52546
|
SyncOptions2[SyncOptions2["NEVER_SYNC"] = 2] = "NEVER_SYNC";
|
49396
52547
|
})(SyncOptions || (SyncOptions = {}));
|
49397
52548
|
|
49398
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
52549
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
49399
52550
|
var import_lodash = __toESM(require_lodash(), 1);
|
49400
52551
|
|
49401
52552
|
// ../../node_modules/.pnpm/tslib@2.4.0/node_modules/tslib/modules/index.js
|
@@ -51289,7 +54440,7 @@ function throttle(durationSelector, config2) {
|
|
51289
54440
|
}
|
51290
54441
|
__name(throttle, "throttle");
|
51291
54442
|
|
51292
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
54443
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
51293
54444
|
var SignatureStatus;
|
51294
54445
|
(function(SignatureStatus2) {
|
51295
54446
|
SignatureStatus2[SignatureStatus2["GENESIS"] = 0] = "GENESIS";
|
@@ -51368,10 +54519,10 @@ function StreamStatic() {
|
|
51368
54519
|
}
|
51369
54520
|
__name(StreamStatic, "StreamStatic");
|
51370
54521
|
|
51371
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
54522
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
51372
54523
|
import fetch2 from "cross-fetch";
|
51373
54524
|
|
51374
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/abort-signal-utils.js
|
54525
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/abort-signal-utils.js
|
51375
54526
|
function mergeAbortSignals(signals) {
|
51376
54527
|
const controller = new AbortController();
|
51377
54528
|
if (signals.length === 0) {
|
@@ -51421,7 +54572,7 @@ function abortable2(original, fn) {
|
|
51421
54572
|
}
|
51422
54573
|
__name(abortable2, "abortable");
|
51423
54574
|
|
51424
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
54575
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
51425
54576
|
var DEFAULT_FETCH_TIMEOUT = 60 * 1e3 * 3;
|
51426
54577
|
function fetchJson(_0) {
|
51427
54578
|
return __async(this, arguments, function* (url, opts = {}) {
|
@@ -51446,10 +54597,10 @@ function fetchJson(_0) {
|
|
51446
54597
|
}
|
51447
54598
|
__name(fetchJson, "fetchJson");
|
51448
54599
|
|
51449
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
54600
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
51450
54601
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
51451
54602
|
|
51452
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/cid-utils.js
|
54603
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/cid-utils.js
|
51453
54604
|
init_cid();
|
51454
54605
|
function toCID(givenCid) {
|
51455
54606
|
const cid = CID.asCID(givenCid);
|
@@ -51466,7 +54617,7 @@ function toCID(givenCid) {
|
|
51466
54617
|
}
|
51467
54618
|
__name(toCID, "toCID");
|
51468
54619
|
|
51469
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
54620
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
51470
54621
|
var TILE_TYPE_ID = 0;
|
51471
54622
|
var StreamUtils = class {
|
51472
54623
|
static streamIdFromState(state) {
|
@@ -51646,7 +54797,7 @@ var StreamUtils = class {
|
|
51646
54797
|
};
|
51647
54798
|
__name(StreamUtils, "StreamUtils");
|
51648
54799
|
|
51649
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/utils/accountid-utils.js
|
54800
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/utils/accountid-utils.js
|
51650
54801
|
function normalizeAccountId(accountId) {
|
51651
54802
|
if (typeof accountId === "string" && accountId.includes("@")) {
|
51652
54803
|
const [address, chainId] = accountId.split("@");
|
@@ -51659,7 +54810,7 @@ function normalizeAccountId(accountId) {
|
|
51659
54810
|
}
|
51660
54811
|
__name(normalizeAccountId, "normalizeAccountId");
|
51661
54812
|
|
51662
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0/node_modules/@ceramicnetwork/common/lib/stream-state-subject.js
|
54813
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/common/lib/stream-state-subject.js
|
51663
54814
|
var StreamStateSubject = class extends BehaviorSubject {
|
51664
54815
|
next(next) {
|
51665
54816
|
const current = this.value;
|
@@ -51670,7 +54821,7 @@ var StreamStateSubject = class extends BehaviorSubject {
|
|
51670
54821
|
};
|
51671
54822
|
__name(StreamStateSubject, "StreamStateSubject");
|
51672
54823
|
|
51673
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
54824
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
51674
54825
|
var __decorate4 = function(decorators, target, key2, desc) {
|
51675
54826
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
51676
54827
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
@@ -51906,7 +55057,7 @@ TileDocument = TileDocument_1 = __decorate4([
|
|
51906
55057
|
StreamStatic()
|
51907
55058
|
], TileDocument);
|
51908
55059
|
|
51909
|
-
// ../../node_modules/.pnpm/@glazed+tile-loader@0.2.1/node_modules/@glazed/tile-loader/dist/index.js
|
55060
|
+
// ../../node_modules/.pnpm/@glazed+tile-loader@0.2.1_@opentelemetry+api@1.1.0/node_modules/@glazed/tile-loader/dist/index.js
|
51910
55061
|
var import_dataloader = __toESM(require_dataloader(), 1);
|
51911
55062
|
function _checkPrivateRedeclaration2(obj, privateCollection) {
|
51912
55063
|
if (privateCollection.has(obj)) {
|
@@ -52065,7 +55216,7 @@ var TileLoader = class extends import_dataloader.default {
|
|
52065
55216
|
};
|
52066
55217
|
__name(TileLoader, "TileLoader");
|
52067
55218
|
|
52068
|
-
// ../../node_modules/.pnpm/@glazed+datamodel@0.3.1/node_modules/@glazed/datamodel/dist/index.js
|
55219
|
+
// ../../node_modules/.pnpm/@glazed+datamodel@0.3.1_@opentelemetry+api@1.1.0/node_modules/@glazed/datamodel/dist/index.js
|
52069
55220
|
function _checkPrivateRedeclaration3(obj, privateCollection) {
|
52070
55221
|
if (privateCollection.has(obj)) {
|
52071
55222
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52185,7 +55336,7 @@ var DataModel = class {
|
|
52185
55336
|
};
|
52186
55337
|
__name(DataModel, "DataModel");
|
52187
55338
|
|
52188
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55339
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/proxy.js
|
52189
55340
|
function _checkPrivateRedeclaration4(obj, privateCollection) {
|
52190
55341
|
if (privateCollection.has(obj)) {
|
52191
55342
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52331,7 +55482,7 @@ var TileProxy = class {
|
|
52331
55482
|
};
|
52332
55483
|
__name(TileProxy, "TileProxy");
|
52333
55484
|
|
52334
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55485
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/utils.js
|
52335
55486
|
var didRegex = /^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;
|
52336
55487
|
function isDIDstring(did) {
|
52337
55488
|
return didRegex.test(did);
|
@@ -52354,7 +55505,7 @@ function getIDXMetadata(did) {
|
|
52354
55505
|
}
|
52355
55506
|
__name(getIDXMetadata, "getIDXMetadata");
|
52356
55507
|
|
52357
|
-
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.
|
55508
|
+
// ../../node_modules/.pnpm/@glazed+did-datastore@0.3.2_@opentelemetry+api@1.1.0/node_modules/@glazed/did-datastore/dist/index.js
|
52358
55509
|
function _checkPrivateRedeclaration5(obj, privateCollection) {
|
52359
55510
|
if (privateCollection.has(obj)) {
|
52360
55511
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
@@ -52751,13 +55902,13 @@ var DIDDataStore = class {
|
|
52751
55902
|
};
|
52752
55903
|
__name(DIDDataStore, "DIDDataStore");
|
52753
55904
|
|
52754
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/utils.js
|
55905
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/utils.js
|
52755
55906
|
function typeStreamID(streamId) {
|
52756
55907
|
return typeof streamId === "string" ? StreamID.fromString(streamId) : streamId;
|
52757
55908
|
}
|
52758
55909
|
__name(typeStreamID, "typeStreamID");
|
52759
55910
|
|
52760
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/document.js
|
55911
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/document.js
|
52761
55912
|
var Document = class extends Observable {
|
52762
55913
|
constructor(initial, _apiUrl, syncInterval) {
|
52763
55914
|
super((subscriber) => {
|
@@ -52856,7 +56007,7 @@ var Document = class extends Observable {
|
|
52856
56007
|
};
|
52857
56008
|
__name(Document, "Document");
|
52858
56009
|
|
52859
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.1.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
56010
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.1.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
52860
56011
|
var import_lodash4 = __toESM(require_lodash(), 1);
|
52861
56012
|
var __decorate5 = function(decorators, target, key2, desc) {
|
52862
56013
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
@@ -52975,7 +56126,7 @@ Caip10Link = Caip10Link_1 = __decorate5([
|
|
52975
56126
|
StreamStatic()
|
52976
56127
|
], Caip10Link);
|
52977
56128
|
|
52978
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model@0.3.0/node_modules/@ceramicnetwork/stream-model/lib/model.js
|
56129
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model@0.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-model/lib/model.js
|
52979
56130
|
var import_random4 = __toESM(require_random(), 1);
|
52980
56131
|
init_cid();
|
52981
56132
|
init_digest();
|
@@ -53176,7 +56327,7 @@ Model = Model_1 = __decorate6([
|
|
53176
56327
|
StreamStatic()
|
53177
56328
|
], Model);
|
53178
56329
|
|
53179
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.3.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
56330
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
53180
56331
|
var import_random5 = __toESM(require_random(), 1);
|
53181
56332
|
var __decorate7 = function(decorators, target, key2, desc) {
|
53182
56333
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
|
@@ -53331,7 +56482,7 @@ ModelInstanceDocument = ModelInstanceDocument_1 = __decorate7([
|
|
53331
56482
|
StreamStatic()
|
53332
56483
|
], ModelInstanceDocument);
|
53333
56484
|
|
53334
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/remote-pin-api.js
|
56485
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/remote-pin-api.js
|
53335
56486
|
var RemotePinApi = class {
|
53336
56487
|
constructor(_apiUrl) {
|
53337
56488
|
this._apiUrl = _apiUrl;
|
@@ -53384,7 +56535,7 @@ var RemotePinApi = class {
|
|
53384
56535
|
};
|
53385
56536
|
__name(RemotePinApi, "RemotePinApi");
|
53386
56537
|
|
53387
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/remote-index-api.js
|
56538
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/remote-index-api.js
|
53388
56539
|
var RemoteIndexApi = class {
|
53389
56540
|
constructor(apiUrl) {
|
53390
56541
|
this._fetchJson = fetchJson;
|
@@ -53412,7 +56563,7 @@ var RemoteIndexApi = class {
|
|
53412
56563
|
};
|
53413
56564
|
__name(RemoteIndexApi, "RemoteIndexApi");
|
53414
56565
|
|
53415
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0/node_modules/@ceramicnetwork/http-client/lib/ceramic-http-client.js
|
56566
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+http-client@2.3.0_@opentelemetry+api@1.1.0/node_modules/@ceramicnetwork/http-client/lib/ceramic-http-client.js
|
53416
56567
|
var API_PATH = "/api/v0/";
|
53417
56568
|
var CERAMIC_HOST = "http://localhost:7007";
|
53418
56569
|
var DEFAULT_CLIENT_CONFIG = {
|
@@ -53506,14 +56657,14 @@ var CeramicClient = class {
|
|
53506
56657
|
return __async(this, arguments, function* (streamId, commit, opts = {}) {
|
53507
56658
|
opts = __spreadValues(__spreadValues({}, DEFAULT_APPLY_COMMIT_OPTS), opts);
|
53508
56659
|
const effectiveStreamId = typeStreamID(streamId);
|
53509
|
-
const
|
56660
|
+
const document2 = yield Document.applyCommit(this._apiUrl, effectiveStreamId, commit, opts, this._config.syncInterval);
|
53510
56661
|
const fromCache = this._streamCache.get(effectiveStreamId.toString());
|
53511
56662
|
if (fromCache) {
|
53512
|
-
fromCache.next(
|
53513
|
-
return this.buildStreamFromDocument(
|
56663
|
+
fromCache.next(document2.state);
|
56664
|
+
return this.buildStreamFromDocument(document2);
|
53514
56665
|
} else {
|
53515
|
-
this._streamCache.set(effectiveStreamId.toString(),
|
53516
|
-
return this.buildStreamFromDocument(
|
56666
|
+
this._streamCache.set(effectiveStreamId.toString(), document2);
|
56667
|
+
return this.buildStreamFromDocument(document2);
|
53517
56668
|
}
|
53518
56669
|
});
|
53519
56670
|
}
|
@@ -53680,6 +56831,11 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
|
|
53680
56831
|
};
|
53681
56832
|
}), "getIDXPlugin");
|
53682
56833
|
|
56834
|
+
// ../learn-card-helpers/dist/helpers.esm.js
|
56835
|
+
var __defProp2 = Object.defineProperty;
|
56836
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
56837
|
+
var isHex = /* @__PURE__ */ __name2((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
56838
|
+
|
53683
56839
|
// src/wallet/plugins/didkey/helpers.ts
|
53684
56840
|
var ED25519_METHODS = ["key", "tz", "pkh:tz", "pkh:tezos", "pkh:sol", "pkh:solana"];
|
53685
56841
|
var SECP256K1_METHODS = [
|
@@ -53696,7 +56852,6 @@ var SECP256K1_METHODS = [
|
|
53696
56852
|
"pkh:eip155",
|
53697
56853
|
"pkh:bip122"
|
53698
56854
|
];
|
53699
|
-
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
53700
56855
|
var getAlgorithmForDidMethod = /* @__PURE__ */ __name((didMethod) => {
|
53701
56856
|
if (ED25519_METHODS.includes(didMethod))
|
53702
56857
|
return "ed25519";
|
@@ -53747,50 +56902,50 @@ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async(void 0, n
|
|
53747
56902
|
|
53748
56903
|
// src/wallet/plugins/vc/issueCredential.ts
|
53749
56904
|
var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
|
53750
|
-
return (
|
56905
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (wallet, credential, signingOptions = {}) {
|
53751
56906
|
const kp = wallet.pluginMethods.getSubjectKeypair();
|
53752
56907
|
if (!kp)
|
53753
56908
|
throw new Error("Cannot issue credential: Could not get subject keypair");
|
53754
|
-
const options = {
|
56909
|
+
const options = __spreadValues({
|
53755
56910
|
verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
|
53756
56911
|
proofPurpose: "assertionMethod"
|
53757
|
-
};
|
56912
|
+
}, signingOptions);
|
53758
56913
|
return initWallet.pluginMethods.issueCredential(credential, options, kp);
|
53759
56914
|
});
|
53760
56915
|
}, "issueCredential");
|
53761
56916
|
|
53762
56917
|
// src/wallet/plugins/vc/verifyCredential.ts
|
53763
56918
|
var verifyCredential3 = /* @__PURE__ */ __name((initWallet) => {
|
53764
|
-
return (
|
53765
|
-
return initWallet.pluginMethods.verifyCredential(credential);
|
56919
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, credential, options = {}) {
|
56920
|
+
return initWallet.pluginMethods.verifyCredential(credential, options);
|
53766
56921
|
});
|
53767
56922
|
}, "verifyCredential");
|
53768
56923
|
|
53769
56924
|
// src/wallet/plugins/vc/issuePresentation.ts
|
53770
56925
|
var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
|
53771
|
-
return (
|
56926
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (wallet, presentation, signingOptions = {}) {
|
53772
56927
|
const kp = wallet.pluginMethods.getSubjectKeypair();
|
53773
56928
|
if (!kp)
|
53774
56929
|
throw new Error("Cannot issue credential: Could not get subject keypair");
|
53775
|
-
const options = {
|
56930
|
+
const options = __spreadValues({
|
53776
56931
|
verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
|
53777
56932
|
proofPurpose: "assertionMethod"
|
53778
|
-
};
|
56933
|
+
}, signingOptions);
|
53779
56934
|
return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
|
53780
56935
|
});
|
53781
56936
|
}, "issuePresentation");
|
53782
56937
|
|
53783
56938
|
// src/wallet/plugins/vc/verifyPresentation.ts
|
53784
56939
|
var verifyPresentation2 = /* @__PURE__ */ __name((initWallet) => {
|
53785
|
-
return (
|
53786
|
-
return initWallet.pluginMethods.verifyPresentation(presentation);
|
56940
|
+
return (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (_wallet, presentation, options = {}) {
|
56941
|
+
return initWallet.pluginMethods.verifyPresentation(presentation, options);
|
53787
56942
|
});
|
53788
56943
|
}, "verifyPresentation");
|
53789
56944
|
|
53790
56945
|
// src/wallet/plugins/vc/vc.ts
|
53791
56946
|
var getVCPlugin = /* @__PURE__ */ __name((wallet) => {
|
53792
56947
|
return {
|
53793
|
-
pluginMethods:
|
56948
|
+
pluginMethods: {
|
53794
56949
|
issueCredential: issueCredential2(wallet),
|
53795
56950
|
verifyCredential: verifyCredential3(wallet),
|
53796
56951
|
issuePresentation: issuePresentation2(wallet),
|
@@ -53816,11 +56971,12 @@ var getVCPlugin = /* @__PURE__ */ __name((wallet) => {
|
|
53816
56971
|
verifiableCredential: credential
|
53817
56972
|
};
|
53818
56973
|
})
|
53819
|
-
}
|
56974
|
+
}
|
53820
56975
|
};
|
53821
56976
|
}, "getVCPlugin");
|
53822
56977
|
|
53823
56978
|
// src/wallet/plugins/EthereumPlugin/index.ts
|
56979
|
+
var import_buffer = __toESM(require_buffer2());
|
53824
56980
|
import { ethers as ethers2 } from "ethers";
|
53825
56981
|
|
53826
56982
|
// src/wallet/plugins/EthereumPlugin/helpers.ts
|
@@ -53888,7 +57044,7 @@ var ERC20ABI = require_erc20_abi();
|
|
53888
57044
|
var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
|
53889
57045
|
let { infuraProjectId, network = "mainnet" } = config2;
|
53890
57046
|
const secpKeypair = initWallet.pluginMethods.getSubjectKeypair("secp256k1");
|
53891
|
-
const privateKey = Buffer.from(secpKeypair.d, "base64").toString("hex");
|
57047
|
+
const privateKey = import_buffer.Buffer.from(secpKeypair.d, "base64").toString("hex");
|
53892
57048
|
let ethersWallet = new ethers2.Wallet(privateKey);
|
53893
57049
|
const publicKey = ethersWallet.address;
|
53894
57050
|
const getProvider = /* @__PURE__ */ __name(() => {
|
@@ -54627,11 +57783,11 @@ var Transformer = class {
|
|
54627
57783
|
}
|
54628
57784
|
_getDocument(_0) {
|
54629
57785
|
return __async(this, arguments, function* ({ url }) {
|
54630
|
-
const { document } = yield this.documentLoader(url);
|
54631
|
-
if (typeof
|
54632
|
-
return JSON.parse(
|
57786
|
+
const { document: document2 } = yield this.documentLoader(url);
|
57787
|
+
if (typeof document2 === "string") {
|
57788
|
+
return JSON.parse(document2);
|
54633
57789
|
}
|
54634
|
-
return
|
57790
|
+
return document2;
|
54635
57791
|
});
|
54636
57792
|
}
|
54637
57793
|
_getTermType({ activeCtx, def }) {
|
@@ -57170,11 +60326,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57170
60326
|
const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
|
57171
60327
|
const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
|
57172
60328
|
const didkeyAndVCWallet = yield didkeyWallet.addPlugin(getVCPlugin(didkeyWallet));
|
57173
|
-
const templateWallet = yield didkeyAndVCWallet.addPlugin(getVCTemplatesPlugin(
|
60329
|
+
const templateWallet = yield didkeyAndVCWallet.addPlugin(getVCTemplatesPlugin());
|
57174
60330
|
const idxWallet = yield templateWallet.addPlugin(yield getIDXPlugin(templateWallet, ceramicIdx));
|
57175
60331
|
const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
|
57176
60332
|
const ethWallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
|
57177
|
-
const
|
60333
|
+
const vpqrWallet = yield ethWallet.addPlugin(getVpqrPlugin(ethWallet));
|
60334
|
+
const wallet = yield vpqrWallet.addPlugin(yield getCHAPIPlugin());
|
57178
60335
|
return {
|
57179
60336
|
_wallet: wallet,
|
57180
60337
|
did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
|
@@ -57209,7 +60366,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
|
|
57209
60366
|
transferTokens: wallet.pluginMethods.transferTokens,
|
57210
60367
|
getCurrentNetwork: wallet.pluginMethods.getCurrentNetwork,
|
57211
60368
|
changeNetwork: wallet.pluginMethods.changeNetwork,
|
57212
|
-
addInfuraProjectId: wallet.pluginMethods.addInfuraProjectId
|
60369
|
+
addInfuraProjectId: wallet.pluginMethods.addInfuraProjectId,
|
60370
|
+
installChapiHandler: wallet.pluginMethods.installChapiHandler,
|
60371
|
+
activateChapiHandler: wallet.pluginMethods.activateChapiHandler,
|
60372
|
+
receiveChapiEvent: wallet.pluginMethods.receiveChapiEvent,
|
60373
|
+
storePresentationViaChapi: wallet.pluginMethods.storePresentationViaChapi,
|
60374
|
+
storeCredentialViaChapiDidAuth: wallet.pluginMethods.storeCredentialViaChapiDidAuth
|
57213
60375
|
};
|
57214
60376
|
}), "walletFromKey");
|
57215
60377
|
|
@@ -57229,6 +60391,7 @@ export {
|
|
57229
60391
|
ExpirationPlugin,
|
57230
60392
|
emptyWallet,
|
57231
60393
|
generateWallet,
|
60394
|
+
getCHAPIPlugin,
|
57232
60395
|
getDidKeyPlugin,
|
57233
60396
|
getDidKitPlugin,
|
57234
60397
|
getEthereumPlugin,
|
@@ -57240,6 +60403,47 @@ export {
|
|
57240
60403
|
seedToId,
|
57241
60404
|
walletFromKey
|
57242
60405
|
};
|
60406
|
+
/*!
|
60407
|
+
* A CredentialHandlerRegistration provides a CredentialManager to enable Web
|
60408
|
+
* apps to register Profiles that can be presented to websites.
|
60409
|
+
*
|
60410
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60411
|
+
*/
|
60412
|
+
/*!
|
60413
|
+
* A CredentialRequestEvent is emitted when a request has been made for
|
60414
|
+
* credentials.
|
60415
|
+
*
|
60416
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60417
|
+
*/
|
60418
|
+
/*!
|
60419
|
+
* A CredentialStoreEvent is emitted when a request has been made to
|
60420
|
+
* store a credential.
|
60421
|
+
*
|
60422
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60423
|
+
*/
|
60424
|
+
/*!
|
60425
|
+
* A WebApp is a remote application that runs in a WebAppContext.
|
60426
|
+
*
|
60427
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60428
|
+
*/
|
60429
|
+
/*!
|
60430
|
+
* A WebCredential is a Credential that can be retrieved from or stored by a
|
60431
|
+
* "credential handler" that runs in a third party Web application.
|
60432
|
+
*
|
60433
|
+
* Copyright (c) 2017-2021 Digital Bazaar, Inc. All rights reserved.
|
60434
|
+
*/
|
60435
|
+
/*!
|
60436
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60437
|
+
*/
|
60438
|
+
/*!
|
60439
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
60440
|
+
*/
|
60441
|
+
/*!
|
60442
|
+
* Copyright (c) 2017-2022 Digital Bazaar, Inc. All rights reserved.
|
60443
|
+
*/
|
60444
|
+
/*!
|
60445
|
+
* Copyright (c) 2018-2022 Digital Bazaar, Inc. All rights reserved.
|
60446
|
+
*/
|
57243
60447
|
/*!
|
57244
60448
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
57245
60449
|
*/
|
@@ -57252,6 +60456,36 @@ export {
|
|
57252
60456
|
/*!
|
57253
60457
|
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
|
57254
60458
|
*/
|
60459
|
+
/*!
|
60460
|
+
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
|
60461
|
+
*/
|
60462
|
+
/*!
|
60463
|
+
* JSON-RPC for Web Request Polyfills.
|
60464
|
+
*
|
60465
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60466
|
+
*/
|
60467
|
+
/*!
|
60468
|
+
* The buffer module from node.js, for the browser.
|
60469
|
+
*
|
60470
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
60471
|
+
* @license MIT
|
60472
|
+
*/
|
60473
|
+
/*!
|
60474
|
+
* The core CredentialHandler class.
|
60475
|
+
*
|
60476
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60477
|
+
*/
|
60478
|
+
/*!
|
60479
|
+
* Utilities for Web Request RPC.
|
60480
|
+
*
|
60481
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
60482
|
+
*/
|
60483
|
+
/*!
|
60484
|
+
* Wrapper for native CredentialsContainer that uses remote Credential Mediator
|
60485
|
+
* for WebCredential-related operations.
|
60486
|
+
*
|
60487
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
60488
|
+
*/
|
57255
60489
|
/*!
|
57256
60490
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
57257
60491
|
* (c) 2017-2021 Joachim Wester
|
@@ -57262,6 +60496,7 @@ export {
|
|
57262
60496
|
* (c) 2017-2022 Joachim Wester
|
57263
60497
|
* MIT licensed
|
57264
60498
|
*/
|
60499
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
57265
60500
|
/**
|
57266
60501
|
* @module QRCode
|
57267
60502
|
* @package @nuintun/qrcode
|