@powersync/web 0.0.0-dev-20260112083235 → 0.0.0-dev-20260120150240

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +4 -16
  2. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +1 -1
  3. package/dist/{_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js} +5 -17
  4. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +1 -0
  5. package/dist/{_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js} +5 -17
  6. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +1 -0
  7. package/dist/index.umd.js +4267 -43185
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/worker/SharedSyncImplementation.umd.js +300 -2110
  10. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  11. package/dist/worker/WASQLiteDB.umd.js +299 -2109
  12. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  13. package/dist/worker/{node_modules_bson_lib_bson_mjs.umd.js → node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js} +6 -6
  14. package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +1 -0
  15. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +44 -0
  16. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js.map +1 -0
  17. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +44 -0
  18. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js.map +1 -0
  19. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +44 -0
  20. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +1 -0
  21. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +44 -0
  22. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -0
  23. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js} +24 -24
  24. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +1 -0
  25. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js} +18 -18
  26. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +1 -0
  27. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js} +18 -18
  28. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js.map +1 -0
  29. package/lib/package.json +11 -10
  30. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +1 -1
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +6 -5
  33. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js.map +0 -1
  34. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js.map +0 -1
  35. package/dist/worker/node_modules_bson_lib_bson_mjs.umd.js.map +0 -1
  36. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +0 -44
  37. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +0 -1
  38. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +0 -44
  39. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +0 -1
  40. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +0 -44
  41. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +0 -1
  42. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
  43. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
  44. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +0 -1
  45. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +0 -1
  46. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +0 -1
@@ -3,10 +3,10 @@ var sdk_web;
3
3
  /******/ "use strict";
4
4
  /******/ var __webpack_modules__ = ({
5
5
 
6
- /***/ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js"
7
- /*!*******************************************************************!*\
8
- !*** ../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js ***!
9
- \*******************************************************************/
6
+ /***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js"
7
+ /*!*******************************************************************************************************************!*\
8
+ !*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js ***!
9
+ \*******************************************************************************************************************/
10
10
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
11
11
 
12
12
  __webpack_require__.r(__webpack_exports__);
@@ -246,7 +246,7 @@ __webpack_require__.r(__webpack_exports__);
246
246
  /* harmony export */ SQLITE_WARNING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_WARNING),
247
247
  /* harmony export */ SQLiteError: () => (/* binding */ SQLiteError)
248
248
  /* harmony export */ });
249
- /* harmony import */ var _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sqlite-constants.js */ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js");
249
+ /* harmony import */ var _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sqlite-constants.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js");
250
250
  // Copyright 2021 Roy T. Hashimoto. All Rights Reserved.
251
251
 
252
252
 
@@ -1198,10 +1198,10 @@ function decl(s) {
1198
1198
 
1199
1199
  /***/ },
1200
1200
 
1201
- /***/ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js"
1202
- /*!*************************************************************************!*\
1203
- !*** ../../node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js ***!
1204
- \*************************************************************************/
1201
+ /***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js"
1202
+ /*!*************************************************************************************************************************!*\
1203
+ !*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js ***!
1204
+ \*************************************************************************************************************************/
1205
1205
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1206
1206
 
1207
1207
  __webpack_require__.r(__webpack_exports__);
@@ -1717,10 +1717,10 @@ const SQLITE_PREPARE_NO_VTAB = 0x04;
1717
1717
 
1718
1718
  /***/ },
1719
1719
 
1720
- /***/ "../../node_modules/async-mutex/index.mjs"
1721
- /*!************************************************!*\
1722
- !*** ../../node_modules/async-mutex/index.mjs ***!
1723
- \************************************************/
1720
+ /***/ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs"
1721
+ /*!*************************************************************************************!*\
1722
+ !*** ../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs ***!
1723
+ \*************************************************************************************/
1724
1724
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1725
1725
 
1726
1726
  __webpack_require__.r(__webpack_exports__);
@@ -2028,10 +2028,10 @@ function tryAcquire(sync, alreadyAcquiredError = E_ALREADY_LOCKED) {
2028
2028
 
2029
2029
  /***/ },
2030
2030
 
2031
- /***/ "../../node_modules/comlink/dist/esm/comlink.mjs"
2032
- /*!*******************************************************!*\
2033
- !*** ../../node_modules/comlink/dist/esm/comlink.mjs ***!
2034
- \*******************************************************/
2031
+ /***/ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs"
2032
+ /*!****************************************************************************************!*\
2033
+ !*** ../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs ***!
2034
+ \****************************************************************************************/
2035
2035
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
2036
2036
 
2037
2037
  __webpack_require__.r(__webpack_exports__);
@@ -2472,6 +2472,7 @@ __webpack_require__.r(__webpack_exports__);
2472
2472
  /* harmony export */ OplogEntry: () => (/* binding */ OplogEntry),
2473
2473
  /* harmony export */ PSInternalTable: () => (/* binding */ PSInternalTable),
2474
2474
  /* harmony export */ PowerSyncControlCommand: () => (/* binding */ PowerSyncControlCommand),
2475
+ /* harmony export */ RawTable: () => (/* binding */ RawTable),
2475
2476
  /* harmony export */ RowUpdateType: () => (/* binding */ RowUpdateType),
2476
2477
  /* harmony export */ Schema: () => (/* binding */ Schema),
2477
2478
  /* harmony export */ SqliteBucketStorage: () => (/* binding */ SqliteBucketStorage),
@@ -2509,7 +2510,7 @@ __webpack_require__.r(__webpack_exports__);
2509
2510
  /* harmony export */ sanitizeSQL: () => (/* binding */ sanitizeSQL),
2510
2511
  /* harmony export */ sanitizeUUID: () => (/* binding */ sanitizeUUID)
2511
2512
  /* harmony export */ });
2512
- /* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! async-mutex */ "../../node_modules/async-mutex/index.mjs");
2513
+ /* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! async-mutex */ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs");
2513
2514
 
2514
2515
 
2515
2516
  function getDefaultExportFromCjs (x) {
@@ -4599,7 +4600,7 @@ class SyncDataBucket {
4599
4600
  }
4600
4601
  }
4601
4602
 
4602
- var buffer$1 = {};
4603
+ var buffer = {};
4603
4604
 
4604
4605
  var base64Js = {};
4605
4606
 
@@ -4863,11 +4864,11 @@ function requireIeee754 () {
4863
4864
  * @license MIT
4864
4865
  */
4865
4866
 
4866
- var hasRequiredBuffer$1;
4867
+ var hasRequiredBuffer;
4867
4868
 
4868
- function requireBuffer$1 () {
4869
- if (hasRequiredBuffer$1) return buffer$1;
4870
- hasRequiredBuffer$1 = 1;
4869
+ function requireBuffer () {
4870
+ if (hasRequiredBuffer) return buffer;
4871
+ hasRequiredBuffer = 1;
4871
4872
  (function (exports$1) {
4872
4873
 
4873
4874
  const base64 = requireBase64Js();
@@ -6373,2028 +6374,48 @@ function requireBuffer$1 () {
6373
6374
  return offset
6374
6375
  }
6375
6376
 
6376
- function wrtBigUInt64BE (buf, value, offset, min, max) {
6377
- checkIntBI(value, min, max, buf, offset, 7);
6378
-
6379
- let lo = Number(value & BigInt(0xffffffff));
6380
- buf[offset + 7] = lo;
6381
- lo = lo >> 8;
6382
- buf[offset + 6] = lo;
6383
- lo = lo >> 8;
6384
- buf[offset + 5] = lo;
6385
- lo = lo >> 8;
6386
- buf[offset + 4] = lo;
6387
- let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
6388
- buf[offset + 3] = hi;
6389
- hi = hi >> 8;
6390
- buf[offset + 2] = hi;
6391
- hi = hi >> 8;
6392
- buf[offset + 1] = hi;
6393
- hi = hi >> 8;
6394
- buf[offset] = hi;
6395
- return offset + 8
6396
- }
6397
-
6398
- Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
6399
- return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
6400
- });
6401
-
6402
- Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
6403
- return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
6404
- });
6405
-
6406
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
6407
- value = +value;
6408
- offset = offset >>> 0;
6409
- if (!noAssert) {
6410
- const limit = Math.pow(2, (8 * byteLength) - 1);
6411
-
6412
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
6413
- }
6414
-
6415
- let i = 0;
6416
- let mul = 1;
6417
- let sub = 0;
6418
- this[offset] = value & 0xFF;
6419
- while (++i < byteLength && (mul *= 0x100)) {
6420
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
6421
- sub = 1;
6422
- }
6423
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
6424
- }
6425
-
6426
- return offset + byteLength
6427
- };
6428
-
6429
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
6430
- value = +value;
6431
- offset = offset >>> 0;
6432
- if (!noAssert) {
6433
- const limit = Math.pow(2, (8 * byteLength) - 1);
6434
-
6435
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
6436
- }
6437
-
6438
- let i = byteLength - 1;
6439
- let mul = 1;
6440
- let sub = 0;
6441
- this[offset + i] = value & 0xFF;
6442
- while (--i >= 0 && (mul *= 0x100)) {
6443
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
6444
- sub = 1;
6445
- }
6446
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
6447
- }
6448
-
6449
- return offset + byteLength
6450
- };
6451
-
6452
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
6453
- value = +value;
6454
- offset = offset >>> 0;
6455
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
6456
- if (value < 0) value = 0xff + value + 1;
6457
- this[offset] = (value & 0xff);
6458
- return offset + 1
6459
- };
6460
-
6461
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
6462
- value = +value;
6463
- offset = offset >>> 0;
6464
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
6465
- this[offset] = (value & 0xff);
6466
- this[offset + 1] = (value >>> 8);
6467
- return offset + 2
6468
- };
6469
-
6470
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
6471
- value = +value;
6472
- offset = offset >>> 0;
6473
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
6474
- this[offset] = (value >>> 8);
6475
- this[offset + 1] = (value & 0xff);
6476
- return offset + 2
6477
- };
6478
-
6479
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
6480
- value = +value;
6481
- offset = offset >>> 0;
6482
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
6483
- this[offset] = (value & 0xff);
6484
- this[offset + 1] = (value >>> 8);
6485
- this[offset + 2] = (value >>> 16);
6486
- this[offset + 3] = (value >>> 24);
6487
- return offset + 4
6488
- };
6489
-
6490
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
6491
- value = +value;
6492
- offset = offset >>> 0;
6493
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
6494
- if (value < 0) value = 0xffffffff + value + 1;
6495
- this[offset] = (value >>> 24);
6496
- this[offset + 1] = (value >>> 16);
6497
- this[offset + 2] = (value >>> 8);
6498
- this[offset + 3] = (value & 0xff);
6499
- return offset + 4
6500
- };
6501
-
6502
- Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
6503
- return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
6504
- });
6505
-
6506
- Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
6507
- return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
6508
- });
6509
-
6510
- function checkIEEE754 (buf, value, offset, ext, max, min) {
6511
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
6512
- if (offset < 0) throw new RangeError('Index out of range')
6513
- }
6514
-
6515
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
6516
- value = +value;
6517
- offset = offset >>> 0;
6518
- if (!noAssert) {
6519
- checkIEEE754(buf, value, offset, 4);
6520
- }
6521
- ieee754.write(buf, value, offset, littleEndian, 23, 4);
6522
- return offset + 4
6523
- }
6524
-
6525
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
6526
- return writeFloat(this, value, offset, true, noAssert)
6527
- };
6528
-
6529
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
6530
- return writeFloat(this, value, offset, false, noAssert)
6531
- };
6532
-
6533
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
6534
- value = +value;
6535
- offset = offset >>> 0;
6536
- if (!noAssert) {
6537
- checkIEEE754(buf, value, offset, 8);
6538
- }
6539
- ieee754.write(buf, value, offset, littleEndian, 52, 8);
6540
- return offset + 8
6541
- }
6542
-
6543
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
6544
- return writeDouble(this, value, offset, true, noAssert)
6545
- };
6546
-
6547
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
6548
- return writeDouble(this, value, offset, false, noAssert)
6549
- };
6550
-
6551
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
6552
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
6553
- if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
6554
- if (!start) start = 0;
6555
- if (!end && end !== 0) end = this.length;
6556
- if (targetStart >= target.length) targetStart = target.length;
6557
- if (!targetStart) targetStart = 0;
6558
- if (end > 0 && end < start) end = start;
6559
-
6560
- // Copy 0 bytes; we're done
6561
- if (end === start) return 0
6562
- if (target.length === 0 || this.length === 0) return 0
6563
-
6564
- // Fatal error conditions
6565
- if (targetStart < 0) {
6566
- throw new RangeError('targetStart out of bounds')
6567
- }
6568
- if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
6569
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
6570
-
6571
- // Are we oob?
6572
- if (end > this.length) end = this.length;
6573
- if (target.length - targetStart < end - start) {
6574
- end = target.length - targetStart + start;
6575
- }
6576
-
6577
- const len = end - start;
6578
-
6579
- if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
6580
- // Use built-in when available, missing from IE11
6581
- this.copyWithin(targetStart, start, end);
6582
- } else {
6583
- Uint8Array.prototype.set.call(
6584
- target,
6585
- this.subarray(start, end),
6586
- targetStart
6587
- );
6588
- }
6589
-
6590
- return len
6591
- };
6592
-
6593
- // Usage:
6594
- // buffer.fill(number[, offset[, end]])
6595
- // buffer.fill(buffer[, offset[, end]])
6596
- // buffer.fill(string[, offset[, end]][, encoding])
6597
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
6598
- // Handle string cases:
6599
- if (typeof val === 'string') {
6600
- if (typeof start === 'string') {
6601
- encoding = start;
6602
- start = 0;
6603
- end = this.length;
6604
- } else if (typeof end === 'string') {
6605
- encoding = end;
6606
- end = this.length;
6607
- }
6608
- if (encoding !== undefined && typeof encoding !== 'string') {
6609
- throw new TypeError('encoding must be a string')
6610
- }
6611
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
6612
- throw new TypeError('Unknown encoding: ' + encoding)
6613
- }
6614
- if (val.length === 1) {
6615
- const code = val.charCodeAt(0);
6616
- if ((encoding === 'utf8' && code < 128) ||
6617
- encoding === 'latin1') {
6618
- // Fast path: If `val` fits into a single byte, use that numeric value.
6619
- val = code;
6620
- }
6621
- }
6622
- } else if (typeof val === 'number') {
6623
- val = val & 255;
6624
- } else if (typeof val === 'boolean') {
6625
- val = Number(val);
6626
- }
6627
-
6628
- // Invalid ranges are not set to a default, so can range check early.
6629
- if (start < 0 || this.length < start || this.length < end) {
6630
- throw new RangeError('Out of range index')
6631
- }
6632
-
6633
- if (end <= start) {
6634
- return this
6635
- }
6636
-
6637
- start = start >>> 0;
6638
- end = end === undefined ? this.length : end >>> 0;
6639
-
6640
- if (!val) val = 0;
6641
-
6642
- let i;
6643
- if (typeof val === 'number') {
6644
- for (i = start; i < end; ++i) {
6645
- this[i] = val;
6646
- }
6647
- } else {
6648
- const bytes = Buffer.isBuffer(val)
6649
- ? val
6650
- : Buffer.from(val, encoding);
6651
- const len = bytes.length;
6652
- if (len === 0) {
6653
- throw new TypeError('The value "' + val +
6654
- '" is invalid for argument "value"')
6655
- }
6656
- for (i = 0; i < end - start; ++i) {
6657
- this[i + start] = bytes[i % len];
6658
- }
6659
- }
6660
-
6661
- return this
6662
- };
6663
-
6664
- // CUSTOM ERRORS
6665
- // =============
6666
-
6667
- // Simplified versions from Node, changed for Buffer-only usage
6668
- const errors = {};
6669
- function E (sym, getMessage, Base) {
6670
- errors[sym] = class NodeError extends Base {
6671
- constructor () {
6672
- super();
6673
-
6674
- Object.defineProperty(this, 'message', {
6675
- value: getMessage.apply(this, arguments),
6676
- writable: true,
6677
- configurable: true
6678
- });
6679
-
6680
- // Add the error code to the name to include it in the stack trace.
6681
- this.name = `${this.name} [${sym}]`;
6682
- // Access the stack to generate the error message including the error code
6683
- // from the name.
6684
- this.stack; // eslint-disable-line no-unused-expressions
6685
- // Reset the name to the actual name.
6686
- delete this.name;
6687
- }
6688
-
6689
- get code () {
6690
- return sym
6691
- }
6692
-
6693
- set code (value) {
6694
- Object.defineProperty(this, 'code', {
6695
- configurable: true,
6696
- enumerable: true,
6697
- value,
6698
- writable: true
6699
- });
6700
- }
6701
-
6702
- toString () {
6703
- return `${this.name} [${sym}]: ${this.message}`
6704
- }
6705
- };
6706
- }
6707
-
6708
- E('ERR_BUFFER_OUT_OF_BOUNDS',
6709
- function (name) {
6710
- if (name) {
6711
- return `${name} is outside of buffer bounds`
6712
- }
6713
-
6714
- return 'Attempt to access memory outside buffer bounds'
6715
- }, RangeError);
6716
- E('ERR_INVALID_ARG_TYPE',
6717
- function (name, actual) {
6718
- return `The "${name}" argument must be of type number. Received type ${typeof actual}`
6719
- }, TypeError);
6720
- E('ERR_OUT_OF_RANGE',
6721
- function (str, range, input) {
6722
- let msg = `The value of "${str}" is out of range.`;
6723
- let received = input;
6724
- if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
6725
- received = addNumericalSeparator(String(input));
6726
- } else if (typeof input === 'bigint') {
6727
- received = String(input);
6728
- if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
6729
- received = addNumericalSeparator(received);
6730
- }
6731
- received += 'n';
6732
- }
6733
- msg += ` It must be ${range}. Received ${received}`;
6734
- return msg
6735
- }, RangeError);
6736
-
6737
- function addNumericalSeparator (val) {
6738
- let res = '';
6739
- let i = val.length;
6740
- const start = val[0] === '-' ? 1 : 0;
6741
- for (; i >= start + 4; i -= 3) {
6742
- res = `_${val.slice(i - 3, i)}${res}`;
6743
- }
6744
- return `${val.slice(0, i)}${res}`
6745
- }
6746
-
6747
- // CHECK FUNCTIONS
6748
- // ===============
6749
-
6750
- function checkBounds (buf, offset, byteLength) {
6751
- validateNumber(offset, 'offset');
6752
- if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
6753
- boundsError(offset, buf.length - (byteLength + 1));
6754
- }
6755
- }
6756
-
6757
- function checkIntBI (value, min, max, buf, offset, byteLength) {
6758
- if (value > max || value < min) {
6759
- const n = typeof min === 'bigint' ? 'n' : '';
6760
- let range;
6761
- {
6762
- if (min === 0 || min === BigInt(0)) {
6763
- range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
6764
- } else {
6765
- range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
6766
- `${(byteLength + 1) * 8 - 1}${n}`;
6767
- }
6768
- }
6769
- throw new errors.ERR_OUT_OF_RANGE('value', range, value)
6770
- }
6771
- checkBounds(buf, offset, byteLength);
6772
- }
6773
-
6774
- function validateNumber (value, name) {
6775
- if (typeof value !== 'number') {
6776
- throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
6777
- }
6778
- }
6779
-
6780
- function boundsError (value, length, type) {
6781
- if (Math.floor(value) !== value) {
6782
- validateNumber(value, type);
6783
- throw new errors.ERR_OUT_OF_RANGE('offset', 'an integer', value)
6784
- }
6785
-
6786
- if (length < 0) {
6787
- throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
6788
- }
6789
-
6790
- throw new errors.ERR_OUT_OF_RANGE('offset',
6791
- `>= ${0} and <= ${length}`,
6792
- value)
6793
- }
6794
-
6795
- // HELPER FUNCTIONS
6796
- // ================
6797
-
6798
- const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
6799
-
6800
- function base64clean (str) {
6801
- // Node takes equal signs as end of the Base64 encoding
6802
- str = str.split('=')[0];
6803
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
6804
- str = str.trim().replace(INVALID_BASE64_RE, '');
6805
- // Node converts strings with length < 2 to ''
6806
- if (str.length < 2) return ''
6807
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
6808
- while (str.length % 4 !== 0) {
6809
- str = str + '=';
6810
- }
6811
- return str
6812
- }
6813
-
6814
- function utf8ToBytes (string, units) {
6815
- units = units || Infinity;
6816
- let codePoint;
6817
- const length = string.length;
6818
- let leadSurrogate = null;
6819
- const bytes = [];
6820
-
6821
- for (let i = 0; i < length; ++i) {
6822
- codePoint = string.charCodeAt(i);
6823
-
6824
- // is surrogate component
6825
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
6826
- // last char was a lead
6827
- if (!leadSurrogate) {
6828
- // no lead yet
6829
- if (codePoint > 0xDBFF) {
6830
- // unexpected trail
6831
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
6832
- continue
6833
- } else if (i + 1 === length) {
6834
- // unpaired lead
6835
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
6836
- continue
6837
- }
6838
-
6839
- // valid lead
6840
- leadSurrogate = codePoint;
6841
-
6842
- continue
6843
- }
6844
-
6845
- // 2 leads in a row
6846
- if (codePoint < 0xDC00) {
6847
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
6848
- leadSurrogate = codePoint;
6849
- continue
6850
- }
6851
-
6852
- // valid surrogate pair
6853
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
6854
- } else if (leadSurrogate) {
6855
- // valid bmp char, but last char was a lead
6856
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
6857
- }
6858
-
6859
- leadSurrogate = null;
6860
-
6861
- // encode utf8
6862
- if (codePoint < 0x80) {
6863
- if ((units -= 1) < 0) break
6864
- bytes.push(codePoint);
6865
- } else if (codePoint < 0x800) {
6866
- if ((units -= 2) < 0) break
6867
- bytes.push(
6868
- codePoint >> 0x6 | 0xC0,
6869
- codePoint & 0x3F | 0x80
6870
- );
6871
- } else if (codePoint < 0x10000) {
6872
- if ((units -= 3) < 0) break
6873
- bytes.push(
6874
- codePoint >> 0xC | 0xE0,
6875
- codePoint >> 0x6 & 0x3F | 0x80,
6876
- codePoint & 0x3F | 0x80
6877
- );
6878
- } else if (codePoint < 0x110000) {
6879
- if ((units -= 4) < 0) break
6880
- bytes.push(
6881
- codePoint >> 0x12 | 0xF0,
6882
- codePoint >> 0xC & 0x3F | 0x80,
6883
- codePoint >> 0x6 & 0x3F | 0x80,
6884
- codePoint & 0x3F | 0x80
6885
- );
6886
- } else {
6887
- throw new Error('Invalid code point')
6888
- }
6889
- }
6890
-
6891
- return bytes
6892
- }
6893
-
6894
- function asciiToBytes (str) {
6895
- const byteArray = [];
6896
- for (let i = 0; i < str.length; ++i) {
6897
- // Node's code seems to be doing this and not & 0x7F..
6898
- byteArray.push(str.charCodeAt(i) & 0xFF);
6899
- }
6900
- return byteArray
6901
- }
6902
-
6903
- function utf16leToBytes (str, units) {
6904
- let c, hi, lo;
6905
- const byteArray = [];
6906
- for (let i = 0; i < str.length; ++i) {
6907
- if ((units -= 2) < 0) break
6908
-
6909
- c = str.charCodeAt(i);
6910
- hi = c >> 8;
6911
- lo = c % 256;
6912
- byteArray.push(lo);
6913
- byteArray.push(hi);
6914
- }
6915
-
6916
- return byteArray
6917
- }
6918
-
6919
- function base64ToBytes (str) {
6920
- return base64.toByteArray(base64clean(str))
6921
- }
6922
-
6923
- function blitBuffer (src, dst, offset, length) {
6924
- let i;
6925
- for (i = 0; i < length; ++i) {
6926
- if ((i + offset >= dst.length) || (i >= src.length)) break
6927
- dst[i + offset] = src[i];
6928
- }
6929
- return i
6930
- }
6931
-
6932
- // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
6933
- // the `instanceof` check but they should be treated as of that type.
6934
- // See: https://github.com/feross/buffer/issues/166
6935
- function isInstance (obj, type) {
6936
- return obj instanceof type ||
6937
- (obj != null && obj.constructor != null && obj.constructor.name != null &&
6938
- obj.constructor.name === type.name)
6939
- }
6940
- function numberIsNaN (obj) {
6941
- // For IE11 support
6942
- return obj !== obj // eslint-disable-line no-self-compare
6943
- }
6944
-
6945
- // Create lookup table for `toString('hex')`
6946
- // See: https://github.com/feross/buffer/issues/219
6947
- const hexSliceLookupTable = (function () {
6948
- const alphabet = '0123456789abcdef';
6949
- const table = new Array(256);
6950
- for (let i = 0; i < 16; ++i) {
6951
- const i16 = i * 16;
6952
- for (let j = 0; j < 16; ++j) {
6953
- table[i16 + j] = alphabet[i] + alphabet[j];
6954
- }
6955
- }
6956
- return table
6957
- })();
6958
-
6959
- // Return not function with Error if BigInt not supported
6960
- function defineBigIntMethod (fn) {
6961
- return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
6962
- }
6963
-
6964
- function BufferBigIntNotDefined () {
6965
- throw new Error('BigInt not supported')
6966
- }
6967
- } (buffer$1));
6968
- return buffer$1;
6969
- }
6970
-
6971
- var bufferExports$1 = requireBuffer$1();
6972
-
6973
- var dist = {};
6974
-
6975
- var buffer = {};
6976
-
6977
- /*!
6978
- * The buffer module from node.js, for the browser.
6979
- *
6980
- * @author Feross Aboukhadijeh <https://feross.org>
6981
- * @license MIT
6982
- */
6983
-
6984
- var hasRequiredBuffer;
6985
-
6986
- function requireBuffer () {
6987
- if (hasRequiredBuffer) return buffer;
6988
- hasRequiredBuffer = 1;
6989
- (function (exports$1) {
6990
-
6991
- var base64 = requireBase64Js();
6992
- var ieee754 = requireIeee754();
6993
- var customInspectSymbol =
6994
- (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
6995
- ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
6996
- : null;
6997
-
6998
- exports$1.Buffer = Buffer;
6999
- exports$1.SlowBuffer = SlowBuffer;
7000
- exports$1.INSPECT_MAX_BYTES = 50;
7001
-
7002
- var K_MAX_LENGTH = 0x7fffffff;
7003
- exports$1.kMaxLength = K_MAX_LENGTH;
7004
-
7005
- /**
7006
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
7007
- * === true Use Uint8Array implementation (fastest)
7008
- * === false Print warning and recommend using `buffer` v4.x which has an Object
7009
- * implementation (most compatible, even IE6)
7010
- *
7011
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
7012
- * Opera 11.6+, iOS 4.2+.
7013
- *
7014
- * We report that the browser does not support typed arrays if the are not subclassable
7015
- * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
7016
- * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
7017
- * for __proto__ and has a buggy typed array implementation.
7018
- */
7019
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
7020
-
7021
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
7022
- typeof console.error === 'function') {
7023
- console.error(
7024
- 'This browser lacks typed array (Uint8Array) support which is required by ' +
7025
- '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
7026
- );
7027
- }
7028
-
7029
- function typedArraySupport () {
7030
- // Can typed array instances can be augmented?
7031
- try {
7032
- var arr = new Uint8Array(1);
7033
- var proto = { foo: function () { return 42 } };
7034
- Object.setPrototypeOf(proto, Uint8Array.prototype);
7035
- Object.setPrototypeOf(arr, proto);
7036
- return arr.foo() === 42
7037
- } catch (e) {
7038
- return false
7039
- }
7040
- }
7041
-
7042
- Object.defineProperty(Buffer.prototype, 'parent', {
7043
- enumerable: true,
7044
- get: function () {
7045
- if (!Buffer.isBuffer(this)) return undefined
7046
- return this.buffer
7047
- }
7048
- });
7049
-
7050
- Object.defineProperty(Buffer.prototype, 'offset', {
7051
- enumerable: true,
7052
- get: function () {
7053
- if (!Buffer.isBuffer(this)) return undefined
7054
- return this.byteOffset
7055
- }
7056
- });
7057
-
7058
- function createBuffer (length) {
7059
- if (length > K_MAX_LENGTH) {
7060
- throw new RangeError('The value "' + length + '" is invalid for option "size"')
7061
- }
7062
- // Return an augmented `Uint8Array` instance
7063
- var buf = new Uint8Array(length);
7064
- Object.setPrototypeOf(buf, Buffer.prototype);
7065
- return buf
7066
- }
7067
-
7068
- /**
7069
- * The Buffer constructor returns instances of `Uint8Array` that have their
7070
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
7071
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
7072
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
7073
- * returns a single octet.
7074
- *
7075
- * The `Uint8Array` prototype remains unmodified.
7076
- */
7077
-
7078
- function Buffer (arg, encodingOrOffset, length) {
7079
- // Common case.
7080
- if (typeof arg === 'number') {
7081
- if (typeof encodingOrOffset === 'string') {
7082
- throw new TypeError(
7083
- 'The "string" argument must be of type string. Received type number'
7084
- )
7085
- }
7086
- return allocUnsafe(arg)
7087
- }
7088
- return from(arg, encodingOrOffset, length)
7089
- }
7090
-
7091
- Buffer.poolSize = 8192; // not used by this implementation
7092
-
7093
- function from (value, encodingOrOffset, length) {
7094
- if (typeof value === 'string') {
7095
- return fromString(value, encodingOrOffset)
7096
- }
7097
-
7098
- if (ArrayBuffer.isView(value)) {
7099
- return fromArrayView(value)
7100
- }
7101
-
7102
- if (value == null) {
7103
- throw new TypeError(
7104
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
7105
- 'or Array-like Object. Received type ' + (typeof value)
7106
- )
7107
- }
7108
-
7109
- if (isInstance(value, ArrayBuffer) ||
7110
- (value && isInstance(value.buffer, ArrayBuffer))) {
7111
- return fromArrayBuffer(value, encodingOrOffset, length)
7112
- }
7113
-
7114
- if (typeof SharedArrayBuffer !== 'undefined' &&
7115
- (isInstance(value, SharedArrayBuffer) ||
7116
- (value && isInstance(value.buffer, SharedArrayBuffer)))) {
7117
- return fromArrayBuffer(value, encodingOrOffset, length)
7118
- }
7119
-
7120
- if (typeof value === 'number') {
7121
- throw new TypeError(
7122
- 'The "value" argument must not be of type number. Received type number'
7123
- )
7124
- }
7125
-
7126
- var valueOf = value.valueOf && value.valueOf();
7127
- if (valueOf != null && valueOf !== value) {
7128
- return Buffer.from(valueOf, encodingOrOffset, length)
7129
- }
7130
-
7131
- var b = fromObject(value);
7132
- if (b) return b
7133
-
7134
- if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
7135
- typeof value[Symbol.toPrimitive] === 'function') {
7136
- return Buffer.from(
7137
- value[Symbol.toPrimitive]('string'), encodingOrOffset, length
7138
- )
7139
- }
7140
-
7141
- throw new TypeError(
7142
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
7143
- 'or Array-like Object. Received type ' + (typeof value)
7144
- )
7145
- }
7146
-
7147
- /**
7148
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
7149
- * if value is a number.
7150
- * Buffer.from(str[, encoding])
7151
- * Buffer.from(array)
7152
- * Buffer.from(buffer)
7153
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
7154
- **/
7155
- Buffer.from = function (value, encodingOrOffset, length) {
7156
- return from(value, encodingOrOffset, length)
7157
- };
7158
-
7159
- // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
7160
- // https://github.com/feross/buffer/pull/148
7161
- Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
7162
- Object.setPrototypeOf(Buffer, Uint8Array);
7163
-
7164
- function assertSize (size) {
7165
- if (typeof size !== 'number') {
7166
- throw new TypeError('"size" argument must be of type number')
7167
- } else if (size < 0) {
7168
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
7169
- }
7170
- }
7171
-
7172
- function alloc (size, fill, encoding) {
7173
- assertSize(size);
7174
- if (size <= 0) {
7175
- return createBuffer(size)
7176
- }
7177
- if (fill !== undefined) {
7178
- // Only pay attention to encoding if it's a string. This
7179
- // prevents accidentally sending in a number that would
7180
- // be interpreted as a start offset.
7181
- return typeof encoding === 'string'
7182
- ? createBuffer(size).fill(fill, encoding)
7183
- : createBuffer(size).fill(fill)
7184
- }
7185
- return createBuffer(size)
7186
- }
7187
-
7188
- /**
7189
- * Creates a new filled Buffer instance.
7190
- * alloc(size[, fill[, encoding]])
7191
- **/
7192
- Buffer.alloc = function (size, fill, encoding) {
7193
- return alloc(size, fill, encoding)
7194
- };
7195
-
7196
- function allocUnsafe (size) {
7197
- assertSize(size);
7198
- return createBuffer(size < 0 ? 0 : checked(size) | 0)
7199
- }
7200
-
7201
- /**
7202
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
7203
- * */
7204
- Buffer.allocUnsafe = function (size) {
7205
- return allocUnsafe(size)
7206
- };
7207
- /**
7208
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
7209
- */
7210
- Buffer.allocUnsafeSlow = function (size) {
7211
- return allocUnsafe(size)
7212
- };
7213
-
7214
- function fromString (string, encoding) {
7215
- if (typeof encoding !== 'string' || encoding === '') {
7216
- encoding = 'utf8';
7217
- }
7218
-
7219
- if (!Buffer.isEncoding(encoding)) {
7220
- throw new TypeError('Unknown encoding: ' + encoding)
7221
- }
7222
-
7223
- var length = byteLength(string, encoding) | 0;
7224
- var buf = createBuffer(length);
7225
-
7226
- var actual = buf.write(string, encoding);
7227
-
7228
- if (actual !== length) {
7229
- // Writing a hex string, for example, that contains invalid characters will
7230
- // cause everything after the first invalid character to be ignored. (e.g.
7231
- // 'abxxcd' will be treated as 'ab')
7232
- buf = buf.slice(0, actual);
7233
- }
7234
-
7235
- return buf
7236
- }
7237
-
7238
- function fromArrayLike (array) {
7239
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
7240
- var buf = createBuffer(length);
7241
- for (var i = 0; i < length; i += 1) {
7242
- buf[i] = array[i] & 255;
7243
- }
7244
- return buf
7245
- }
7246
-
7247
- function fromArrayView (arrayView) {
7248
- if (isInstance(arrayView, Uint8Array)) {
7249
- var copy = new Uint8Array(arrayView);
7250
- return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
7251
- }
7252
- return fromArrayLike(arrayView)
7253
- }
7254
-
7255
- function fromArrayBuffer (array, byteOffset, length) {
7256
- if (byteOffset < 0 || array.byteLength < byteOffset) {
7257
- throw new RangeError('"offset" is outside of buffer bounds')
7258
- }
7259
-
7260
- if (array.byteLength < byteOffset + (length || 0)) {
7261
- throw new RangeError('"length" is outside of buffer bounds')
7262
- }
7263
-
7264
- var buf;
7265
- if (byteOffset === undefined && length === undefined) {
7266
- buf = new Uint8Array(array);
7267
- } else if (length === undefined) {
7268
- buf = new Uint8Array(array, byteOffset);
7269
- } else {
7270
- buf = new Uint8Array(array, byteOffset, length);
7271
- }
7272
-
7273
- // Return an augmented `Uint8Array` instance
7274
- Object.setPrototypeOf(buf, Buffer.prototype);
7275
-
7276
- return buf
7277
- }
7278
-
7279
- function fromObject (obj) {
7280
- if (Buffer.isBuffer(obj)) {
7281
- var len = checked(obj.length) | 0;
7282
- var buf = createBuffer(len);
7283
-
7284
- if (buf.length === 0) {
7285
- return buf
7286
- }
7287
-
7288
- obj.copy(buf, 0, 0, len);
7289
- return buf
7290
- }
7291
-
7292
- if (obj.length !== undefined) {
7293
- if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
7294
- return createBuffer(0)
7295
- }
7296
- return fromArrayLike(obj)
7297
- }
7298
-
7299
- if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
7300
- return fromArrayLike(obj.data)
7301
- }
7302
- }
7303
-
7304
- function checked (length) {
7305
- // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
7306
- // length is NaN (which is otherwise coerced to zero.)
7307
- if (length >= K_MAX_LENGTH) {
7308
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
7309
- 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
7310
- }
7311
- return length | 0
7312
- }
7313
-
7314
- function SlowBuffer (length) {
7315
- if (+length != length) { // eslint-disable-line eqeqeq
7316
- length = 0;
7317
- }
7318
- return Buffer.alloc(+length)
7319
- }
7320
-
7321
- Buffer.isBuffer = function isBuffer (b) {
7322
- return b != null && b._isBuffer === true &&
7323
- b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
7324
- };
7325
-
7326
- Buffer.compare = function compare (a, b) {
7327
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
7328
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
7329
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
7330
- throw new TypeError(
7331
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
7332
- )
7333
- }
7334
-
7335
- if (a === b) return 0
7336
-
7337
- var x = a.length;
7338
- var y = b.length;
7339
-
7340
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
7341
- if (a[i] !== b[i]) {
7342
- x = a[i];
7343
- y = b[i];
7344
- break
7345
- }
7346
- }
7347
-
7348
- if (x < y) return -1
7349
- if (y < x) return 1
7350
- return 0
7351
- };
7352
-
7353
- Buffer.isEncoding = function isEncoding (encoding) {
7354
- switch (String(encoding).toLowerCase()) {
7355
- case 'hex':
7356
- case 'utf8':
7357
- case 'utf-8':
7358
- case 'ascii':
7359
- case 'latin1':
7360
- case 'binary':
7361
- case 'base64':
7362
- case 'ucs2':
7363
- case 'ucs-2':
7364
- case 'utf16le':
7365
- case 'utf-16le':
7366
- return true
7367
- default:
7368
- return false
7369
- }
7370
- };
7371
-
7372
- Buffer.concat = function concat (list, length) {
7373
- if (!Array.isArray(list)) {
7374
- throw new TypeError('"list" argument must be an Array of Buffers')
7375
- }
7376
-
7377
- if (list.length === 0) {
7378
- return Buffer.alloc(0)
7379
- }
7380
-
7381
- var i;
7382
- if (length === undefined) {
7383
- length = 0;
7384
- for (i = 0; i < list.length; ++i) {
7385
- length += list[i].length;
7386
- }
7387
- }
7388
-
7389
- var buffer = Buffer.allocUnsafe(length);
7390
- var pos = 0;
7391
- for (i = 0; i < list.length; ++i) {
7392
- var buf = list[i];
7393
- if (isInstance(buf, Uint8Array)) {
7394
- if (pos + buf.length > buffer.length) {
7395
- Buffer.from(buf).copy(buffer, pos);
7396
- } else {
7397
- Uint8Array.prototype.set.call(
7398
- buffer,
7399
- buf,
7400
- pos
7401
- );
7402
- }
7403
- } else if (!Buffer.isBuffer(buf)) {
7404
- throw new TypeError('"list" argument must be an Array of Buffers')
7405
- } else {
7406
- buf.copy(buffer, pos);
7407
- }
7408
- pos += buf.length;
7409
- }
7410
- return buffer
7411
- };
7412
-
7413
- function byteLength (string, encoding) {
7414
- if (Buffer.isBuffer(string)) {
7415
- return string.length
7416
- }
7417
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
7418
- return string.byteLength
7419
- }
7420
- if (typeof string !== 'string') {
7421
- throw new TypeError(
7422
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
7423
- 'Received type ' + typeof string
7424
- )
7425
- }
7426
-
7427
- var len = string.length;
7428
- var mustMatch = (arguments.length > 2 && arguments[2] === true);
7429
- if (!mustMatch && len === 0) return 0
7430
-
7431
- // Use a for loop to avoid recursion
7432
- var loweredCase = false;
7433
- for (;;) {
7434
- switch (encoding) {
7435
- case 'ascii':
7436
- case 'latin1':
7437
- case 'binary':
7438
- return len
7439
- case 'utf8':
7440
- case 'utf-8':
7441
- return utf8ToBytes(string).length
7442
- case 'ucs2':
7443
- case 'ucs-2':
7444
- case 'utf16le':
7445
- case 'utf-16le':
7446
- return len * 2
7447
- case 'hex':
7448
- return len >>> 1
7449
- case 'base64':
7450
- return base64ToBytes(string).length
7451
- default:
7452
- if (loweredCase) {
7453
- return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
7454
- }
7455
- encoding = ('' + encoding).toLowerCase();
7456
- loweredCase = true;
7457
- }
7458
- }
7459
- }
7460
- Buffer.byteLength = byteLength;
7461
-
7462
- function slowToString (encoding, start, end) {
7463
- var loweredCase = false;
7464
-
7465
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
7466
- // property of a typed array.
7467
-
7468
- // This behaves neither like String nor Uint8Array in that we set start/end
7469
- // to their upper/lower bounds if the value passed is out of range.
7470
- // undefined is handled specially as per ECMA-262 6th Edition,
7471
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
7472
- if (start === undefined || start < 0) {
7473
- start = 0;
7474
- }
7475
- // Return early if start > this.length. Done here to prevent potential uint32
7476
- // coercion fail below.
7477
- if (start > this.length) {
7478
- return ''
7479
- }
7480
-
7481
- if (end === undefined || end > this.length) {
7482
- end = this.length;
7483
- }
7484
-
7485
- if (end <= 0) {
7486
- return ''
7487
- }
7488
-
7489
- // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
7490
- end >>>= 0;
7491
- start >>>= 0;
7492
-
7493
- if (end <= start) {
7494
- return ''
7495
- }
7496
-
7497
- if (!encoding) encoding = 'utf8';
7498
-
7499
- while (true) {
7500
- switch (encoding) {
7501
- case 'hex':
7502
- return hexSlice(this, start, end)
7503
-
7504
- case 'utf8':
7505
- case 'utf-8':
7506
- return utf8Slice(this, start, end)
7507
-
7508
- case 'ascii':
7509
- return asciiSlice(this, start, end)
7510
-
7511
- case 'latin1':
7512
- case 'binary':
7513
- return latin1Slice(this, start, end)
7514
-
7515
- case 'base64':
7516
- return base64Slice(this, start, end)
7517
-
7518
- case 'ucs2':
7519
- case 'ucs-2':
7520
- case 'utf16le':
7521
- case 'utf-16le':
7522
- return utf16leSlice(this, start, end)
7523
-
7524
- default:
7525
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
7526
- encoding = (encoding + '').toLowerCase();
7527
- loweredCase = true;
7528
- }
7529
- }
7530
- }
7531
-
7532
- // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
7533
- // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
7534
- // reliably in a browserify context because there could be multiple different
7535
- // copies of the 'buffer' package in use. This method works even for Buffer
7536
- // instances that were created from another copy of the `buffer` package.
7537
- // See: https://github.com/feross/buffer/issues/154
7538
- Buffer.prototype._isBuffer = true;
7539
-
7540
- function swap (b, n, m) {
7541
- var i = b[n];
7542
- b[n] = b[m];
7543
- b[m] = i;
7544
- }
7545
-
7546
- Buffer.prototype.swap16 = function swap16 () {
7547
- var len = this.length;
7548
- if (len % 2 !== 0) {
7549
- throw new RangeError('Buffer size must be a multiple of 16-bits')
7550
- }
7551
- for (var i = 0; i < len; i += 2) {
7552
- swap(this, i, i + 1);
7553
- }
7554
- return this
7555
- };
7556
-
7557
- Buffer.prototype.swap32 = function swap32 () {
7558
- var len = this.length;
7559
- if (len % 4 !== 0) {
7560
- throw new RangeError('Buffer size must be a multiple of 32-bits')
7561
- }
7562
- for (var i = 0; i < len; i += 4) {
7563
- swap(this, i, i + 3);
7564
- swap(this, i + 1, i + 2);
7565
- }
7566
- return this
7567
- };
7568
-
7569
- Buffer.prototype.swap64 = function swap64 () {
7570
- var len = this.length;
7571
- if (len % 8 !== 0) {
7572
- throw new RangeError('Buffer size must be a multiple of 64-bits')
7573
- }
7574
- for (var i = 0; i < len; i += 8) {
7575
- swap(this, i, i + 7);
7576
- swap(this, i + 1, i + 6);
7577
- swap(this, i + 2, i + 5);
7578
- swap(this, i + 3, i + 4);
7579
- }
7580
- return this
7581
- };
7582
-
7583
- Buffer.prototype.toString = function toString () {
7584
- var length = this.length;
7585
- if (length === 0) return ''
7586
- if (arguments.length === 0) return utf8Slice(this, 0, length)
7587
- return slowToString.apply(this, arguments)
7588
- };
7589
-
7590
- Buffer.prototype.toLocaleString = Buffer.prototype.toString;
7591
-
7592
- Buffer.prototype.equals = function equals (b) {
7593
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
7594
- if (this === b) return true
7595
- return Buffer.compare(this, b) === 0
7596
- };
7597
-
7598
- Buffer.prototype.inspect = function inspect () {
7599
- var str = '';
7600
- var max = exports$1.INSPECT_MAX_BYTES;
7601
- str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
7602
- if (this.length > max) str += ' ... ';
7603
- return '<Buffer ' + str + '>'
7604
- };
7605
- if (customInspectSymbol) {
7606
- Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
7607
- }
7608
-
7609
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
7610
- if (isInstance(target, Uint8Array)) {
7611
- target = Buffer.from(target, target.offset, target.byteLength);
7612
- }
7613
- if (!Buffer.isBuffer(target)) {
7614
- throw new TypeError(
7615
- 'The "target" argument must be one of type Buffer or Uint8Array. ' +
7616
- 'Received type ' + (typeof target)
7617
- )
7618
- }
7619
-
7620
- if (start === undefined) {
7621
- start = 0;
7622
- }
7623
- if (end === undefined) {
7624
- end = target ? target.length : 0;
7625
- }
7626
- if (thisStart === undefined) {
7627
- thisStart = 0;
7628
- }
7629
- if (thisEnd === undefined) {
7630
- thisEnd = this.length;
7631
- }
7632
-
7633
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
7634
- throw new RangeError('out of range index')
7635
- }
7636
-
7637
- if (thisStart >= thisEnd && start >= end) {
7638
- return 0
7639
- }
7640
- if (thisStart >= thisEnd) {
7641
- return -1
7642
- }
7643
- if (start >= end) {
7644
- return 1
7645
- }
7646
-
7647
- start >>>= 0;
7648
- end >>>= 0;
7649
- thisStart >>>= 0;
7650
- thisEnd >>>= 0;
7651
-
7652
- if (this === target) return 0
7653
-
7654
- var x = thisEnd - thisStart;
7655
- var y = end - start;
7656
- var len = Math.min(x, y);
7657
-
7658
- var thisCopy = this.slice(thisStart, thisEnd);
7659
- var targetCopy = target.slice(start, end);
7660
-
7661
- for (var i = 0; i < len; ++i) {
7662
- if (thisCopy[i] !== targetCopy[i]) {
7663
- x = thisCopy[i];
7664
- y = targetCopy[i];
7665
- break
7666
- }
7667
- }
7668
-
7669
- if (x < y) return -1
7670
- if (y < x) return 1
7671
- return 0
7672
- };
7673
-
7674
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
7675
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
7676
- //
7677
- // Arguments:
7678
- // - buffer - a Buffer to search
7679
- // - val - a string, Buffer, or number
7680
- // - byteOffset - an index into `buffer`; will be clamped to an int32
7681
- // - encoding - an optional encoding, relevant is val is a string
7682
- // - dir - true for indexOf, false for lastIndexOf
7683
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
7684
- // Empty buffer means no match
7685
- if (buffer.length === 0) return -1
7686
-
7687
- // Normalize byteOffset
7688
- if (typeof byteOffset === 'string') {
7689
- encoding = byteOffset;
7690
- byteOffset = 0;
7691
- } else if (byteOffset > 0x7fffffff) {
7692
- byteOffset = 0x7fffffff;
7693
- } else if (byteOffset < -2147483648) {
7694
- byteOffset = -2147483648;
7695
- }
7696
- byteOffset = +byteOffset; // Coerce to Number.
7697
- if (numberIsNaN(byteOffset)) {
7698
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
7699
- byteOffset = dir ? 0 : (buffer.length - 1);
7700
- }
7701
-
7702
- // Normalize byteOffset: negative offsets start from the end of the buffer
7703
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
7704
- if (byteOffset >= buffer.length) {
7705
- if (dir) return -1
7706
- else byteOffset = buffer.length - 1;
7707
- } else if (byteOffset < 0) {
7708
- if (dir) byteOffset = 0;
7709
- else return -1
7710
- }
7711
-
7712
- // Normalize val
7713
- if (typeof val === 'string') {
7714
- val = Buffer.from(val, encoding);
7715
- }
7716
-
7717
- // Finally, search either indexOf (if dir is true) or lastIndexOf
7718
- if (Buffer.isBuffer(val)) {
7719
- // Special case: looking for empty string/buffer always fails
7720
- if (val.length === 0) {
7721
- return -1
7722
- }
7723
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
7724
- } else if (typeof val === 'number') {
7725
- val = val & 0xFF; // Search for a byte value [0-255]
7726
- if (typeof Uint8Array.prototype.indexOf === 'function') {
7727
- if (dir) {
7728
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
7729
- } else {
7730
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
7731
- }
7732
- }
7733
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
7734
- }
7735
-
7736
- throw new TypeError('val must be string, number or Buffer')
7737
- }
7738
-
7739
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
7740
- var indexSize = 1;
7741
- var arrLength = arr.length;
7742
- var valLength = val.length;
7743
-
7744
- if (encoding !== undefined) {
7745
- encoding = String(encoding).toLowerCase();
7746
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
7747
- encoding === 'utf16le' || encoding === 'utf-16le') {
7748
- if (arr.length < 2 || val.length < 2) {
7749
- return -1
7750
- }
7751
- indexSize = 2;
7752
- arrLength /= 2;
7753
- valLength /= 2;
7754
- byteOffset /= 2;
7755
- }
7756
- }
7757
-
7758
- function read (buf, i) {
7759
- if (indexSize === 1) {
7760
- return buf[i]
7761
- } else {
7762
- return buf.readUInt16BE(i * indexSize)
7763
- }
7764
- }
7765
-
7766
- var i;
7767
- if (dir) {
7768
- var foundIndex = -1;
7769
- for (i = byteOffset; i < arrLength; i++) {
7770
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
7771
- if (foundIndex === -1) foundIndex = i;
7772
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
7773
- } else {
7774
- if (foundIndex !== -1) i -= i - foundIndex;
7775
- foundIndex = -1;
7776
- }
7777
- }
7778
- } else {
7779
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
7780
- for (i = byteOffset; i >= 0; i--) {
7781
- var found = true;
7782
- for (var j = 0; j < valLength; j++) {
7783
- if (read(arr, i + j) !== read(val, j)) {
7784
- found = false;
7785
- break
7786
- }
7787
- }
7788
- if (found) return i
7789
- }
7790
- }
7791
-
7792
- return -1
7793
- }
7794
-
7795
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
7796
- return this.indexOf(val, byteOffset, encoding) !== -1
7797
- };
7798
-
7799
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
7800
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
7801
- };
7802
-
7803
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
7804
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
7805
- };
7806
-
7807
- function hexWrite (buf, string, offset, length) {
7808
- offset = Number(offset) || 0;
7809
- var remaining = buf.length - offset;
7810
- if (!length) {
7811
- length = remaining;
7812
- } else {
7813
- length = Number(length);
7814
- if (length > remaining) {
7815
- length = remaining;
7816
- }
7817
- }
7818
-
7819
- var strLen = string.length;
7820
-
7821
- if (length > strLen / 2) {
7822
- length = strLen / 2;
7823
- }
7824
- for (var i = 0; i < length; ++i) {
7825
- var parsed = parseInt(string.substr(i * 2, 2), 16);
7826
- if (numberIsNaN(parsed)) return i
7827
- buf[offset + i] = parsed;
7828
- }
7829
- return i
7830
- }
7831
-
7832
- function utf8Write (buf, string, offset, length) {
7833
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
7834
- }
7835
-
7836
- function asciiWrite (buf, string, offset, length) {
7837
- return blitBuffer(asciiToBytes(string), buf, offset, length)
7838
- }
7839
-
7840
- function base64Write (buf, string, offset, length) {
7841
- return blitBuffer(base64ToBytes(string), buf, offset, length)
7842
- }
7843
-
7844
- function ucs2Write (buf, string, offset, length) {
7845
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
7846
- }
7847
-
7848
- Buffer.prototype.write = function write (string, offset, length, encoding) {
7849
- // Buffer#write(string)
7850
- if (offset === undefined) {
7851
- encoding = 'utf8';
7852
- length = this.length;
7853
- offset = 0;
7854
- // Buffer#write(string, encoding)
7855
- } else if (length === undefined && typeof offset === 'string') {
7856
- encoding = offset;
7857
- length = this.length;
7858
- offset = 0;
7859
- // Buffer#write(string, offset[, length][, encoding])
7860
- } else if (isFinite(offset)) {
7861
- offset = offset >>> 0;
7862
- if (isFinite(length)) {
7863
- length = length >>> 0;
7864
- if (encoding === undefined) encoding = 'utf8';
7865
- } else {
7866
- encoding = length;
7867
- length = undefined;
7868
- }
7869
- } else {
7870
- throw new Error(
7871
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
7872
- )
7873
- }
7874
-
7875
- var remaining = this.length - offset;
7876
- if (length === undefined || length > remaining) length = remaining;
7877
-
7878
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
7879
- throw new RangeError('Attempt to write outside buffer bounds')
7880
- }
7881
-
7882
- if (!encoding) encoding = 'utf8';
7883
-
7884
- var loweredCase = false;
7885
- for (;;) {
7886
- switch (encoding) {
7887
- case 'hex':
7888
- return hexWrite(this, string, offset, length)
7889
-
7890
- case 'utf8':
7891
- case 'utf-8':
7892
- return utf8Write(this, string, offset, length)
7893
-
7894
- case 'ascii':
7895
- case 'latin1':
7896
- case 'binary':
7897
- return asciiWrite(this, string, offset, length)
7898
-
7899
- case 'base64':
7900
- // Warning: maxLength not taken into account in base64Write
7901
- return base64Write(this, string, offset, length)
7902
-
7903
- case 'ucs2':
7904
- case 'ucs-2':
7905
- case 'utf16le':
7906
- case 'utf-16le':
7907
- return ucs2Write(this, string, offset, length)
7908
-
7909
- default:
7910
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
7911
- encoding = ('' + encoding).toLowerCase();
7912
- loweredCase = true;
7913
- }
7914
- }
7915
- };
7916
-
7917
- Buffer.prototype.toJSON = function toJSON () {
7918
- return {
7919
- type: 'Buffer',
7920
- data: Array.prototype.slice.call(this._arr || this, 0)
7921
- }
7922
- };
7923
-
7924
- function base64Slice (buf, start, end) {
7925
- if (start === 0 && end === buf.length) {
7926
- return base64.fromByteArray(buf)
7927
- } else {
7928
- return base64.fromByteArray(buf.slice(start, end))
7929
- }
7930
- }
7931
-
7932
- function utf8Slice (buf, start, end) {
7933
- end = Math.min(buf.length, end);
7934
- var res = [];
7935
-
7936
- var i = start;
7937
- while (i < end) {
7938
- var firstByte = buf[i];
7939
- var codePoint = null;
7940
- var bytesPerSequence = (firstByte > 0xEF)
7941
- ? 4
7942
- : (firstByte > 0xDF)
7943
- ? 3
7944
- : (firstByte > 0xBF)
7945
- ? 2
7946
- : 1;
7947
-
7948
- if (i + bytesPerSequence <= end) {
7949
- var secondByte, thirdByte, fourthByte, tempCodePoint;
7950
-
7951
- switch (bytesPerSequence) {
7952
- case 1:
7953
- if (firstByte < 0x80) {
7954
- codePoint = firstByte;
7955
- }
7956
- break
7957
- case 2:
7958
- secondByte = buf[i + 1];
7959
- if ((secondByte & 0xC0) === 0x80) {
7960
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
7961
- if (tempCodePoint > 0x7F) {
7962
- codePoint = tempCodePoint;
7963
- }
7964
- }
7965
- break
7966
- case 3:
7967
- secondByte = buf[i + 1];
7968
- thirdByte = buf[i + 2];
7969
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
7970
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
7971
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
7972
- codePoint = tempCodePoint;
7973
- }
7974
- }
7975
- break
7976
- case 4:
7977
- secondByte = buf[i + 1];
7978
- thirdByte = buf[i + 2];
7979
- fourthByte = buf[i + 3];
7980
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
7981
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
7982
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
7983
- codePoint = tempCodePoint;
7984
- }
7985
- }
7986
- }
7987
- }
7988
-
7989
- if (codePoint === null) {
7990
- // we did not generate a valid codePoint so insert a
7991
- // replacement char (U+FFFD) and advance only 1 byte
7992
- codePoint = 0xFFFD;
7993
- bytesPerSequence = 1;
7994
- } else if (codePoint > 0xFFFF) {
7995
- // encode to utf16 (surrogate pair dance)
7996
- codePoint -= 0x10000;
7997
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
7998
- codePoint = 0xDC00 | codePoint & 0x3FF;
7999
- }
8000
-
8001
- res.push(codePoint);
8002
- i += bytesPerSequence;
8003
- }
8004
-
8005
- return decodeCodePointsArray(res)
8006
- }
8007
-
8008
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
8009
- // the lowest limit is Chrome, with 0x10000 args.
8010
- // We go 1 magnitude less, for safety
8011
- var MAX_ARGUMENTS_LENGTH = 0x1000;
8012
-
8013
- function decodeCodePointsArray (codePoints) {
8014
- var len = codePoints.length;
8015
- if (len <= MAX_ARGUMENTS_LENGTH) {
8016
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
8017
- }
8018
-
8019
- // Decode in chunks to avoid "call stack size exceeded".
8020
- var res = '';
8021
- var i = 0;
8022
- while (i < len) {
8023
- res += String.fromCharCode.apply(
8024
- String,
8025
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
8026
- );
8027
- }
8028
- return res
8029
- }
8030
-
8031
- function asciiSlice (buf, start, end) {
8032
- var ret = '';
8033
- end = Math.min(buf.length, end);
8034
-
8035
- for (var i = start; i < end; ++i) {
8036
- ret += String.fromCharCode(buf[i] & 0x7F);
8037
- }
8038
- return ret
8039
- }
8040
-
8041
- function latin1Slice (buf, start, end) {
8042
- var ret = '';
8043
- end = Math.min(buf.length, end);
8044
-
8045
- for (var i = start; i < end; ++i) {
8046
- ret += String.fromCharCode(buf[i]);
8047
- }
8048
- return ret
8049
- }
8050
-
8051
- function hexSlice (buf, start, end) {
8052
- var len = buf.length;
8053
-
8054
- if (!start || start < 0) start = 0;
8055
- if (!end || end < 0 || end > len) end = len;
8056
-
8057
- var out = '';
8058
- for (var i = start; i < end; ++i) {
8059
- out += hexSliceLookupTable[buf[i]];
8060
- }
8061
- return out
8062
- }
8063
-
8064
- function utf16leSlice (buf, start, end) {
8065
- var bytes = buf.slice(start, end);
8066
- var res = '';
8067
- // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
8068
- for (var i = 0; i < bytes.length - 1; i += 2) {
8069
- res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));
8070
- }
8071
- return res
8072
- }
8073
-
8074
- Buffer.prototype.slice = function slice (start, end) {
8075
- var len = this.length;
8076
- start = ~~start;
8077
- end = end === undefined ? len : ~~end;
8078
-
8079
- if (start < 0) {
8080
- start += len;
8081
- if (start < 0) start = 0;
8082
- } else if (start > len) {
8083
- start = len;
8084
- }
8085
-
8086
- if (end < 0) {
8087
- end += len;
8088
- if (end < 0) end = 0;
8089
- } else if (end > len) {
8090
- end = len;
8091
- }
8092
-
8093
- if (end < start) end = start;
8094
-
8095
- var newBuf = this.subarray(start, end);
8096
- // Return an augmented `Uint8Array` instance
8097
- Object.setPrototypeOf(newBuf, Buffer.prototype);
8098
-
8099
- return newBuf
8100
- };
8101
-
8102
- /*
8103
- * Need to make sure that buffer isn't trying to write out of bounds.
8104
- */
8105
- function checkOffset (offset, ext, length) {
8106
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
8107
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
8108
- }
8109
-
8110
- Buffer.prototype.readUintLE =
8111
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
8112
- offset = offset >>> 0;
8113
- byteLength = byteLength >>> 0;
8114
- if (!noAssert) checkOffset(offset, byteLength, this.length);
8115
-
8116
- var val = this[offset];
8117
- var mul = 1;
8118
- var i = 0;
8119
- while (++i < byteLength && (mul *= 0x100)) {
8120
- val += this[offset + i] * mul;
8121
- }
8122
-
8123
- return val
8124
- };
8125
-
8126
- Buffer.prototype.readUintBE =
8127
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
8128
- offset = offset >>> 0;
8129
- byteLength = byteLength >>> 0;
8130
- if (!noAssert) {
8131
- checkOffset(offset, byteLength, this.length);
8132
- }
8133
-
8134
- var val = this[offset + --byteLength];
8135
- var mul = 1;
8136
- while (byteLength > 0 && (mul *= 0x100)) {
8137
- val += this[offset + --byteLength] * mul;
8138
- }
8139
-
8140
- return val
8141
- };
8142
-
8143
- Buffer.prototype.readUint8 =
8144
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
8145
- offset = offset >>> 0;
8146
- if (!noAssert) checkOffset(offset, 1, this.length);
8147
- return this[offset]
8148
- };
8149
-
8150
- Buffer.prototype.readUint16LE =
8151
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
8152
- offset = offset >>> 0;
8153
- if (!noAssert) checkOffset(offset, 2, this.length);
8154
- return this[offset] | (this[offset + 1] << 8)
8155
- };
8156
-
8157
- Buffer.prototype.readUint16BE =
8158
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
8159
- offset = offset >>> 0;
8160
- if (!noAssert) checkOffset(offset, 2, this.length);
8161
- return (this[offset] << 8) | this[offset + 1]
8162
- };
8163
-
8164
- Buffer.prototype.readUint32LE =
8165
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
8166
- offset = offset >>> 0;
8167
- if (!noAssert) checkOffset(offset, 4, this.length);
8168
-
8169
- return ((this[offset]) |
8170
- (this[offset + 1] << 8) |
8171
- (this[offset + 2] << 16)) +
8172
- (this[offset + 3] * 0x1000000)
8173
- };
8174
-
8175
- Buffer.prototype.readUint32BE =
8176
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
8177
- offset = offset >>> 0;
8178
- if (!noAssert) checkOffset(offset, 4, this.length);
8179
-
8180
- return (this[offset] * 0x1000000) +
8181
- ((this[offset + 1] << 16) |
8182
- (this[offset + 2] << 8) |
8183
- this[offset + 3])
8184
- };
8185
-
8186
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
8187
- offset = offset >>> 0;
8188
- byteLength = byteLength >>> 0;
8189
- if (!noAssert) checkOffset(offset, byteLength, this.length);
8190
-
8191
- var val = this[offset];
8192
- var mul = 1;
8193
- var i = 0;
8194
- while (++i < byteLength && (mul *= 0x100)) {
8195
- val += this[offset + i] * mul;
8196
- }
8197
- mul *= 0x80;
8198
-
8199
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
8200
-
8201
- return val
8202
- };
8203
-
8204
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
8205
- offset = offset >>> 0;
8206
- byteLength = byteLength >>> 0;
8207
- if (!noAssert) checkOffset(offset, byteLength, this.length);
8208
-
8209
- var i = byteLength;
8210
- var mul = 1;
8211
- var val = this[offset + --i];
8212
- while (i > 0 && (mul *= 0x100)) {
8213
- val += this[offset + --i] * mul;
8214
- }
8215
- mul *= 0x80;
8216
-
8217
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
8218
-
8219
- return val
8220
- };
8221
-
8222
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
8223
- offset = offset >>> 0;
8224
- if (!noAssert) checkOffset(offset, 1, this.length);
8225
- if (!(this[offset] & 0x80)) return (this[offset])
8226
- return ((0xff - this[offset] + 1) * -1)
8227
- };
8228
-
8229
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
8230
- offset = offset >>> 0;
8231
- if (!noAssert) checkOffset(offset, 2, this.length);
8232
- var val = this[offset] | (this[offset + 1] << 8);
8233
- return (val & 0x8000) ? val | 0xFFFF0000 : val
8234
- };
8235
-
8236
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
8237
- offset = offset >>> 0;
8238
- if (!noAssert) checkOffset(offset, 2, this.length);
8239
- var val = this[offset + 1] | (this[offset] << 8);
8240
- return (val & 0x8000) ? val | 0xFFFF0000 : val
8241
- };
8242
-
8243
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
8244
- offset = offset >>> 0;
8245
- if (!noAssert) checkOffset(offset, 4, this.length);
8246
-
8247
- return (this[offset]) |
8248
- (this[offset + 1] << 8) |
8249
- (this[offset + 2] << 16) |
8250
- (this[offset + 3] << 24)
8251
- };
8252
-
8253
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
8254
- offset = offset >>> 0;
8255
- if (!noAssert) checkOffset(offset, 4, this.length);
8256
-
8257
- return (this[offset] << 24) |
8258
- (this[offset + 1] << 16) |
8259
- (this[offset + 2] << 8) |
8260
- (this[offset + 3])
8261
- };
8262
-
8263
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
8264
- offset = offset >>> 0;
8265
- if (!noAssert) checkOffset(offset, 4, this.length);
8266
- return ieee754.read(this, offset, true, 23, 4)
8267
- };
8268
-
8269
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
8270
- offset = offset >>> 0;
8271
- if (!noAssert) checkOffset(offset, 4, this.length);
8272
- return ieee754.read(this, offset, false, 23, 4)
8273
- };
8274
-
8275
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
8276
- offset = offset >>> 0;
8277
- if (!noAssert) checkOffset(offset, 8, this.length);
8278
- return ieee754.read(this, offset, true, 52, 8)
8279
- };
8280
-
8281
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
8282
- offset = offset >>> 0;
8283
- if (!noAssert) checkOffset(offset, 8, this.length);
8284
- return ieee754.read(this, offset, false, 52, 8)
8285
- };
8286
-
8287
- function checkInt (buf, value, offset, ext, max, min) {
8288
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
8289
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
8290
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
8291
- }
8292
-
8293
- Buffer.prototype.writeUintLE =
8294
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
8295
- value = +value;
8296
- offset = offset >>> 0;
8297
- byteLength = byteLength >>> 0;
8298
- if (!noAssert) {
8299
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
8300
- checkInt(this, value, offset, byteLength, maxBytes, 0);
8301
- }
8302
-
8303
- var mul = 1;
8304
- var i = 0;
8305
- this[offset] = value & 0xFF;
8306
- while (++i < byteLength && (mul *= 0x100)) {
8307
- this[offset + i] = (value / mul) & 0xFF;
8308
- }
8309
-
8310
- return offset + byteLength
8311
- };
8312
-
8313
- Buffer.prototype.writeUintBE =
8314
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
8315
- value = +value;
8316
- offset = offset >>> 0;
8317
- byteLength = byteLength >>> 0;
8318
- if (!noAssert) {
8319
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
8320
- checkInt(this, value, offset, byteLength, maxBytes, 0);
8321
- }
8322
-
8323
- var i = byteLength - 1;
8324
- var mul = 1;
8325
- this[offset + i] = value & 0xFF;
8326
- while (--i >= 0 && (mul *= 0x100)) {
8327
- this[offset + i] = (value / mul) & 0xFF;
8328
- }
8329
-
8330
- return offset + byteLength
8331
- };
8332
-
8333
- Buffer.prototype.writeUint8 =
8334
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
8335
- value = +value;
8336
- offset = offset >>> 0;
8337
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
8338
- this[offset] = (value & 0xff);
8339
- return offset + 1
8340
- };
8341
-
8342
- Buffer.prototype.writeUint16LE =
8343
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
8344
- value = +value;
8345
- offset = offset >>> 0;
8346
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
8347
- this[offset] = (value & 0xff);
8348
- this[offset + 1] = (value >>> 8);
8349
- return offset + 2
8350
- };
8351
-
8352
- Buffer.prototype.writeUint16BE =
8353
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
8354
- value = +value;
8355
- offset = offset >>> 0;
8356
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
8357
- this[offset] = (value >>> 8);
8358
- this[offset + 1] = (value & 0xff);
8359
- return offset + 2
8360
- };
6377
+ function wrtBigUInt64BE (buf, value, offset, min, max) {
6378
+ checkIntBI(value, min, max, buf, offset, 7);
8361
6379
 
8362
- Buffer.prototype.writeUint32LE =
8363
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
8364
- value = +value;
8365
- offset = offset >>> 0;
8366
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
8367
- this[offset + 3] = (value >>> 24);
8368
- this[offset + 2] = (value >>> 16);
8369
- this[offset + 1] = (value >>> 8);
8370
- this[offset] = (value & 0xff);
8371
- return offset + 4
8372
- };
6380
+ let lo = Number(value & BigInt(0xffffffff));
6381
+ buf[offset + 7] = lo;
6382
+ lo = lo >> 8;
6383
+ buf[offset + 6] = lo;
6384
+ lo = lo >> 8;
6385
+ buf[offset + 5] = lo;
6386
+ lo = lo >> 8;
6387
+ buf[offset + 4] = lo;
6388
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
6389
+ buf[offset + 3] = hi;
6390
+ hi = hi >> 8;
6391
+ buf[offset + 2] = hi;
6392
+ hi = hi >> 8;
6393
+ buf[offset + 1] = hi;
6394
+ hi = hi >> 8;
6395
+ buf[offset] = hi;
6396
+ return offset + 8
6397
+ }
8373
6398
 
8374
- Buffer.prototype.writeUint32BE =
8375
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
8376
- value = +value;
8377
- offset = offset >>> 0;
8378
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
8379
- this[offset] = (value >>> 24);
8380
- this[offset + 1] = (value >>> 16);
8381
- this[offset + 2] = (value >>> 8);
8382
- this[offset + 3] = (value & 0xff);
8383
- return offset + 4
8384
- };
6399
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
6400
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
6401
+ });
6402
+
6403
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
6404
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
6405
+ });
8385
6406
 
8386
6407
  Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
8387
6408
  value = +value;
8388
6409
  offset = offset >>> 0;
8389
6410
  if (!noAssert) {
8390
- var limit = Math.pow(2, (8 * byteLength) - 1);
6411
+ const limit = Math.pow(2, (8 * byteLength) - 1);
8391
6412
 
8392
6413
  checkInt(this, value, offset, byteLength, limit - 1, -limit);
8393
6414
  }
8394
6415
 
8395
- var i = 0;
8396
- var mul = 1;
8397
- var sub = 0;
6416
+ let i = 0;
6417
+ let mul = 1;
6418
+ let sub = 0;
8398
6419
  this[offset] = value & 0xFF;
8399
6420
  while (++i < byteLength && (mul *= 0x100)) {
8400
6421
  if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
@@ -8410,14 +6431,14 @@ function requireBuffer () {
8410
6431
  value = +value;
8411
6432
  offset = offset >>> 0;
8412
6433
  if (!noAssert) {
8413
- var limit = Math.pow(2, (8 * byteLength) - 1);
6434
+ const limit = Math.pow(2, (8 * byteLength) - 1);
8414
6435
 
8415
6436
  checkInt(this, value, offset, byteLength, limit - 1, -limit);
8416
6437
  }
8417
6438
 
8418
- var i = byteLength - 1;
8419
- var mul = 1;
8420
- var sub = 0;
6439
+ let i = byteLength - 1;
6440
+ let mul = 1;
6441
+ let sub = 0;
8421
6442
  this[offset + i] = value & 0xFF;
8422
6443
  while (--i >= 0 && (mul *= 0x100)) {
8423
6444
  if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
@@ -8479,6 +6500,14 @@ function requireBuffer () {
8479
6500
  return offset + 4
8480
6501
  };
8481
6502
 
6503
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
6504
+ return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
6505
+ });
6506
+
6507
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
6508
+ return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
6509
+ });
6510
+
8482
6511
  function checkIEEE754 (buf, value, offset, ext, max, min) {
8483
6512
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
8484
6513
  if (offset < 0) throw new RangeError('Index out of range')
@@ -8546,7 +6575,7 @@ function requireBuffer () {
8546
6575
  end = target.length - targetStart + start;
8547
6576
  }
8548
6577
 
8549
- var len = end - start;
6578
+ const len = end - start;
8550
6579
 
8551
6580
  if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
8552
6581
  // Use built-in when available, missing from IE11
@@ -8584,7 +6613,7 @@ function requireBuffer () {
8584
6613
  throw new TypeError('Unknown encoding: ' + encoding)
8585
6614
  }
8586
6615
  if (val.length === 1) {
8587
- var code = val.charCodeAt(0);
6616
+ const code = val.charCodeAt(0);
8588
6617
  if ((encoding === 'utf8' && code < 128) ||
8589
6618
  encoding === 'latin1') {
8590
6619
  // Fast path: If `val` fits into a single byte, use that numeric value.
@@ -8611,16 +6640,16 @@ function requireBuffer () {
8611
6640
 
8612
6641
  if (!val) val = 0;
8613
6642
 
8614
- var i;
6643
+ let i;
8615
6644
  if (typeof val === 'number') {
8616
6645
  for (i = start; i < end; ++i) {
8617
6646
  this[i] = val;
8618
6647
  }
8619
6648
  } else {
8620
- var bytes = Buffer.isBuffer(val)
6649
+ const bytes = Buffer.isBuffer(val)
8621
6650
  ? val
8622
6651
  : Buffer.from(val, encoding);
8623
- var len = bytes.length;
6652
+ const len = bytes.length;
8624
6653
  if (len === 0) {
8625
6654
  throw new TypeError('The value "' + val +
8626
6655
  '" is invalid for argument "value"')
@@ -8633,10 +6662,141 @@ function requireBuffer () {
8633
6662
  return this
8634
6663
  };
8635
6664
 
6665
+ // CUSTOM ERRORS
6666
+ // =============
6667
+
6668
+ // Simplified versions from Node, changed for Buffer-only usage
6669
+ const errors = {};
6670
+ function E (sym, getMessage, Base) {
6671
+ errors[sym] = class NodeError extends Base {
6672
+ constructor () {
6673
+ super();
6674
+
6675
+ Object.defineProperty(this, 'message', {
6676
+ value: getMessage.apply(this, arguments),
6677
+ writable: true,
6678
+ configurable: true
6679
+ });
6680
+
6681
+ // Add the error code to the name to include it in the stack trace.
6682
+ this.name = `${this.name} [${sym}]`;
6683
+ // Access the stack to generate the error message including the error code
6684
+ // from the name.
6685
+ this.stack; // eslint-disable-line no-unused-expressions
6686
+ // Reset the name to the actual name.
6687
+ delete this.name;
6688
+ }
6689
+
6690
+ get code () {
6691
+ return sym
6692
+ }
6693
+
6694
+ set code (value) {
6695
+ Object.defineProperty(this, 'code', {
6696
+ configurable: true,
6697
+ enumerable: true,
6698
+ value,
6699
+ writable: true
6700
+ });
6701
+ }
6702
+
6703
+ toString () {
6704
+ return `${this.name} [${sym}]: ${this.message}`
6705
+ }
6706
+ };
6707
+ }
6708
+
6709
+ E('ERR_BUFFER_OUT_OF_BOUNDS',
6710
+ function (name) {
6711
+ if (name) {
6712
+ return `${name} is outside of buffer bounds`
6713
+ }
6714
+
6715
+ return 'Attempt to access memory outside buffer bounds'
6716
+ }, RangeError);
6717
+ E('ERR_INVALID_ARG_TYPE',
6718
+ function (name, actual) {
6719
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`
6720
+ }, TypeError);
6721
+ E('ERR_OUT_OF_RANGE',
6722
+ function (str, range, input) {
6723
+ let msg = `The value of "${str}" is out of range.`;
6724
+ let received = input;
6725
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
6726
+ received = addNumericalSeparator(String(input));
6727
+ } else if (typeof input === 'bigint') {
6728
+ received = String(input);
6729
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
6730
+ received = addNumericalSeparator(received);
6731
+ }
6732
+ received += 'n';
6733
+ }
6734
+ msg += ` It must be ${range}. Received ${received}`;
6735
+ return msg
6736
+ }, RangeError);
6737
+
6738
+ function addNumericalSeparator (val) {
6739
+ let res = '';
6740
+ let i = val.length;
6741
+ const start = val[0] === '-' ? 1 : 0;
6742
+ for (; i >= start + 4; i -= 3) {
6743
+ res = `_${val.slice(i - 3, i)}${res}`;
6744
+ }
6745
+ return `${val.slice(0, i)}${res}`
6746
+ }
6747
+
6748
+ // CHECK FUNCTIONS
6749
+ // ===============
6750
+
6751
+ function checkBounds (buf, offset, byteLength) {
6752
+ validateNumber(offset, 'offset');
6753
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
6754
+ boundsError(offset, buf.length - (byteLength + 1));
6755
+ }
6756
+ }
6757
+
6758
+ function checkIntBI (value, min, max, buf, offset, byteLength) {
6759
+ if (value > max || value < min) {
6760
+ const n = typeof min === 'bigint' ? 'n' : '';
6761
+ let range;
6762
+ {
6763
+ if (min === 0 || min === BigInt(0)) {
6764
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
6765
+ } else {
6766
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
6767
+ `${(byteLength + 1) * 8 - 1}${n}`;
6768
+ }
6769
+ }
6770
+ throw new errors.ERR_OUT_OF_RANGE('value', range, value)
6771
+ }
6772
+ checkBounds(buf, offset, byteLength);
6773
+ }
6774
+
6775
+ function validateNumber (value, name) {
6776
+ if (typeof value !== 'number') {
6777
+ throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
6778
+ }
6779
+ }
6780
+
6781
+ function boundsError (value, length, type) {
6782
+ if (Math.floor(value) !== value) {
6783
+ validateNumber(value, type);
6784
+ throw new errors.ERR_OUT_OF_RANGE('offset', 'an integer', value)
6785
+ }
6786
+
6787
+ if (length < 0) {
6788
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
6789
+ }
6790
+
6791
+ throw new errors.ERR_OUT_OF_RANGE('offset',
6792
+ `>= ${0} and <= ${length}`,
6793
+ value)
6794
+ }
6795
+
8636
6796
  // HELPER FUNCTIONS
8637
6797
  // ================
8638
6798
 
8639
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
6799
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
8640
6800
 
8641
6801
  function base64clean (str) {
8642
6802
  // Node takes equal signs as end of the Base64 encoding
@@ -8654,12 +6814,12 @@ function requireBuffer () {
8654
6814
 
8655
6815
  function utf8ToBytes (string, units) {
8656
6816
  units = units || Infinity;
8657
- var codePoint;
8658
- var length = string.length;
8659
- var leadSurrogate = null;
8660
- var bytes = [];
6817
+ let codePoint;
6818
+ const length = string.length;
6819
+ let leadSurrogate = null;
6820
+ const bytes = [];
8661
6821
 
8662
- for (var i = 0; i < length; ++i) {
6822
+ for (let i = 0; i < length; ++i) {
8663
6823
  codePoint = string.charCodeAt(i);
8664
6824
 
8665
6825
  // is surrogate component
@@ -8733,8 +6893,8 @@ function requireBuffer () {
8733
6893
  }
8734
6894
 
8735
6895
  function asciiToBytes (str) {
8736
- var byteArray = [];
8737
- for (var i = 0; i < str.length; ++i) {
6896
+ const byteArray = [];
6897
+ for (let i = 0; i < str.length; ++i) {
8738
6898
  // Node's code seems to be doing this and not & 0x7F..
8739
6899
  byteArray.push(str.charCodeAt(i) & 0xFF);
8740
6900
  }
@@ -8742,9 +6902,9 @@ function requireBuffer () {
8742
6902
  }
8743
6903
 
8744
6904
  function utf16leToBytes (str, units) {
8745
- var c, hi, lo;
8746
- var byteArray = [];
8747
- for (var i = 0; i < str.length; ++i) {
6905
+ let c, hi, lo;
6906
+ const byteArray = [];
6907
+ for (let i = 0; i < str.length; ++i) {
8748
6908
  if ((units -= 2) < 0) break
8749
6909
 
8750
6910
  c = str.charCodeAt(i);
@@ -8762,7 +6922,8 @@ function requireBuffer () {
8762
6922
  }
8763
6923
 
8764
6924
  function blitBuffer (src, dst, offset, length) {
8765
- for (var i = 0; i < length; ++i) {
6925
+ let i;
6926
+ for (i = 0; i < length; ++i) {
8766
6927
  if ((i + offset >= dst.length) || (i >= src.length)) break
8767
6928
  dst[i + offset] = src[i];
8768
6929
  }
@@ -8784,23 +6945,34 @@ function requireBuffer () {
8784
6945
 
8785
6946
  // Create lookup table for `toString('hex')`
8786
6947
  // See: https://github.com/feross/buffer/issues/219
8787
- var hexSliceLookupTable = (function () {
8788
- var alphabet = '0123456789abcdef';
8789
- var table = new Array(256);
8790
- for (var i = 0; i < 16; ++i) {
8791
- var i16 = i * 16;
8792
- for (var j = 0; j < 16; ++j) {
6948
+ const hexSliceLookupTable = (function () {
6949
+ const alphabet = '0123456789abcdef';
6950
+ const table = new Array(256);
6951
+ for (let i = 0; i < 16; ++i) {
6952
+ const i16 = i * 16;
6953
+ for (let j = 0; j < 16; ++j) {
8793
6954
  table[i16 + j] = alphabet[i] + alphabet[j];
8794
6955
  }
8795
6956
  }
8796
6957
  return table
8797
- })();
6958
+ })();
6959
+
6960
+ // Return not function with Error if BigInt not supported
6961
+ function defineBigIntMethod (fn) {
6962
+ return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
6963
+ }
6964
+
6965
+ function BufferBigIntNotDefined () {
6966
+ throw new Error('BigInt not supported')
6967
+ }
8798
6968
  } (buffer));
8799
6969
  return buffer;
8800
6970
  }
8801
6971
 
8802
6972
  var bufferExports = requireBuffer();
8803
6973
 
6974
+ var dist = {};
6975
+
8804
6976
  var Codecs = {};
8805
6977
 
8806
6978
  var Frames = {};
@@ -13654,6 +11826,16 @@ class DataStream extends BaseObserver {
13654
11826
  * @returns a Data payload or Null if the stream closed.
13655
11827
  */
13656
11828
  async read() {
11829
+ if (this.closed) {
11830
+ return null;
11831
+ }
11832
+ // Wait for any pending processing to complete first.
11833
+ // This ensures we register our listener before calling processQueue(),
11834
+ // avoiding a race where processQueue() sees no reader and returns early.
11835
+ if (this.processingPromise) {
11836
+ await this.processingPromise;
11837
+ }
11838
+ // Re-check after await - stream may have closed while we were waiting
13657
11839
  if (this.closed) {
13658
11840
  return null;
13659
11841
  }
@@ -13693,7 +11875,7 @@ class DataStream extends BaseObserver {
13693
11875
  }
13694
11876
  const promise = (this.processingPromise = this._processQueue());
13695
11877
  promise.finally(() => {
13696
- return (this.processingPromise = null);
11878
+ this.processingPromise = null;
13697
11879
  });
13698
11880
  return promise;
13699
11881
  }
@@ -13725,7 +11907,6 @@ class DataStream extends BaseObserver {
13725
11907
  this.notifyDataAdded = null;
13726
11908
  }
13727
11909
  if (this.dataQueue.length > 0) {
13728
- // Next tick
13729
11910
  setTimeout(() => this.processQueue());
13730
11911
  }
13731
11912
  }
@@ -14105,7 +12286,7 @@ class AbstractRemote {
14105
12286
  else {
14106
12287
  contents = JSON.stringify(js);
14107
12288
  }
14108
- return bufferExports$1.Buffer.from(contents);
12289
+ return bufferExports.Buffer.from(contents);
14109
12290
  }
14110
12291
  const syncQueueRequestSize = fetchStrategy == FetchStrategy.Buffered ? 10 : 1;
14111
12292
  const request = await this.buildRequest(path);
@@ -14345,7 +12526,11 @@ class AbstractRemote {
14345
12526
  };
14346
12527
  const stream = new DataStream({
14347
12528
  logger: this.logger,
14348
- mapLine: mapLine
12529
+ mapLine: mapLine,
12530
+ pressure: {
12531
+ highWaterMark: 20,
12532
+ lowWaterMark: 10
12533
+ }
14349
12534
  });
14350
12535
  abortSignal?.addEventListener('abort', () => {
14351
12536
  closeReader();
@@ -14353,42 +12538,47 @@ class AbstractRemote {
14353
12538
  });
14354
12539
  const decoder = this.createTextDecoder();
14355
12540
  let buffer = '';
14356
- const l = stream.registerListener({
14357
- lowWater: async () => {
14358
- if (stream.closed || abortSignal?.aborted || readerReleased) {
12541
+ const consumeStream = async () => {
12542
+ while (!stream.closed && !abortSignal?.aborted && !readerReleased) {
12543
+ const { done, value } = await reader.read();
12544
+ if (done) {
12545
+ const remaining = buffer.trim();
12546
+ if (remaining.length != 0) {
12547
+ stream.enqueueData(remaining);
12548
+ }
12549
+ stream.close();
12550
+ await closeReader();
14359
12551
  return;
14360
12552
  }
14361
- try {
14362
- let didCompleteLine = false;
14363
- while (!didCompleteLine) {
14364
- const { done, value } = await reader.read();
14365
- if (done) {
14366
- const remaining = buffer.trim();
14367
- if (remaining.length != 0) {
14368
- stream.enqueueData(remaining);
14369
- }
14370
- stream.close();
14371
- await closeReader();
14372
- return;
14373
- }
14374
- const data = decoder.decode(value, { stream: true });
14375
- buffer += data;
14376
- const lines = buffer.split('\n');
14377
- for (var i = 0; i < lines.length - 1; i++) {
14378
- var l = lines[i].trim();
14379
- if (l.length > 0) {
14380
- stream.enqueueData(l);
14381
- didCompleteLine = true;
14382
- }
14383
- }
14384
- buffer = lines[lines.length - 1];
12553
+ const data = decoder.decode(value, { stream: true });
12554
+ buffer += data;
12555
+ const lines = buffer.split('\n');
12556
+ for (var i = 0; i < lines.length - 1; i++) {
12557
+ var l = lines[i].trim();
12558
+ if (l.length > 0) {
12559
+ stream.enqueueData(l);
14385
12560
  }
14386
12561
  }
14387
- catch (ex) {
14388
- stream.close();
14389
- throw ex;
12562
+ buffer = lines[lines.length - 1];
12563
+ // Implement backpressure by waiting for the low water mark to be reached
12564
+ if (stream.dataQueue.length > stream.highWatermark) {
12565
+ await new Promise((resolve) => {
12566
+ const dispose = stream.registerListener({
12567
+ lowWater: async () => {
12568
+ resolve();
12569
+ dispose();
12570
+ },
12571
+ closed: () => {
12572
+ resolve();
12573
+ dispose();
12574
+ }
12575
+ });
12576
+ });
14390
12577
  }
14391
- },
12578
+ }
12579
+ };
12580
+ consumeStream().catch(ex => this.logger.error('Error consuming stream', ex));
12581
+ const l = stream.registerListener({
14392
12582
  closed: () => {
14393
12583
  closeReader();
14394
12584
  l?.();
@@ -17669,9 +15859,9 @@ __webpack_require__.r(__webpack_exports__);
17669
15859
  /* harmony export */ WASQLiteVFS: () => (/* binding */ WASQLiteVFS),
17670
15860
  /* harmony export */ WASqliteConnection: () => (/* binding */ WASqliteConnection)
17671
15861
  /* harmony export */ });
17672
- /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
15862
+ /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
17673
15863
  /* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
17674
- /* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! async-mutex */ "../../node_modules/async-mutex/index.mjs");
15864
+ /* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! async-mutex */ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs");
17675
15865
 
17676
15866
 
17677
15867
 
@@ -17688,28 +15878,28 @@ var WASQLiteVFS;
17688
15878
  * @internal
17689
15879
  */
17690
15880
  const AsyncWASQLiteModuleFactory = async () => {
17691
- const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs */ "../../node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs"));
15881
+ const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs"));
17692
15882
  return factory();
17693
15883
  };
17694
15884
  /**
17695
15885
  * @internal
17696
15886
  */
17697
15887
  const MultiCipherAsyncWASQLiteModuleFactory = async () => {
17698
- const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs */ "../../node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs"));
15888
+ const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs"));
17699
15889
  return factory();
17700
15890
  };
17701
15891
  /**
17702
15892
  * @internal
17703
15893
  */
17704
15894
  const SyncWASQLiteModuleFactory = async () => {
17705
- const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite.mjs */ "../../node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite.mjs"));
15895
+ const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite.mjs"));
17706
15896
  return factory();
17707
15897
  };
17708
15898
  /**
17709
15899
  * @internal
17710
15900
  */
17711
15901
  const MultiCipherSyncWASQLiteModuleFactory = async () => {
17712
- const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs */ "../../node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs"));
15902
+ const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs"));
17713
15903
  return factory();
17714
15904
  };
17715
15905
  /**
@@ -17724,7 +15914,7 @@ const DEFAULT_MODULE_FACTORIES = {
17724
15914
  else {
17725
15915
  module = await AsyncWASQLiteModuleFactory();
17726
15916
  }
17727
- const { IDBBatchAtomicVFS } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"));
15917
+ const { IDBBatchAtomicVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"));
17728
15918
  return {
17729
15919
  module,
17730
15920
  // @ts-expect-error The types for this static method are missing upstream
@@ -17740,7 +15930,7 @@ const DEFAULT_MODULE_FACTORIES = {
17740
15930
  module = await SyncWASQLiteModuleFactory();
17741
15931
  }
17742
15932
  // @ts-expect-error The types for this static method are missing upstream
17743
- const { AccessHandlePoolVFS } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"));
15933
+ const { AccessHandlePoolVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"));
17744
15934
  return {
17745
15935
  module,
17746
15936
  vfs: await AccessHandlePoolVFS.create(options.dbFileName, module)
@@ -17755,7 +15945,7 @@ const DEFAULT_MODULE_FACTORIES = {
17755
15945
  module = await SyncWASQLiteModuleFactory();
17756
15946
  }
17757
15947
  // @ts-expect-error The types for this static method are missing upstream
17758
- const { OPFSCoopSyncVFS } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"));
15948
+ const { OPFSCoopSyncVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"));
17759
15949
  const vfs = await OPFSCoopSyncVFS.create(options.dbFileName, module);
17760
15950
  return {
17761
15951
  module,
@@ -18211,7 +16401,7 @@ __webpack_require__.r(__webpack_exports__);
18211
16401
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
18212
16402
  /* harmony export */ WorkerWASQLiteConnection: () => (/* binding */ WorkerWASQLiteConnection)
18213
16403
  /* harmony export */ });
18214
- /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ "../../node_modules/comlink/dist/esm/comlink.mjs");
16404
+ /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs");
18215
16405
  /* harmony import */ var _db_adapters_wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/WASQLiteConnection.js */ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js");
18216
16406
 
18217
16407
 
@@ -18399,9 +16589,9 @@ var __webpack_exports__ = {};
18399
16589
  !*** ./lib/src/worker/db/WASQLiteDB.worker.js ***!
18400
16590
  \************************************************/
18401
16591
  __webpack_require__.r(__webpack_exports__);
18402
- /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
16592
+ /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.4.1/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
18403
16593
  /* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
18404
- /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "../../node_modules/comlink/dist/esm/comlink.mjs");
16594
+ /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs");
18405
16595
  /* harmony import */ var _shared_navigator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/navigator.js */ "./lib/src/shared/navigator.js");
18406
16596
  /* harmony import */ var _SharedWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SharedWASQLiteConnection.js */ "./lib/src/worker/db/SharedWASQLiteConnection.js");
18407
16597
  /* harmony import */ var _WorkerWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./WorkerWASQLiteConnection.js */ "./lib/src/worker/db/WorkerWASQLiteConnection.js");