@elizaos/cli 1.0.16 → 1.0.18

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 (35) hide show
  1. package/dist/assets/index-BXWgVSUO.css +1 -0
  2. package/dist/assets/index-BXWgVSUO.css.br +0 -0
  3. package/dist/assets/{index-EfDd1Y35.js → index-BtIQw5Dh.js} +1095 -4658
  4. package/dist/assets/index-BtIQw5Dh.js.br +0 -0
  5. package/dist/assets/{index-EfDd1Y35.js.map → index-BtIQw5Dh.js.map} +1 -1
  6. package/dist/assets/{index-BBiLesJT.js → index-Dgo_cOqK.js} +28 -28
  7. package/dist/assets/index-Dgo_cOqK.js.br +0 -0
  8. package/dist/assets/{index-BBiLesJT.js.map → index-Dgo_cOqK.js.map} +1 -1
  9. package/dist/assets/{vendor-DS2z8upE.js → vendor-Dp9Dttv5.js} +2529 -24
  10. package/dist/assets/vendor-Dp9Dttv5.js.br +0 -0
  11. package/dist/assets/vendor-Dp9Dttv5.js.map +1 -0
  12. package/dist/{chunk-OK5O2MHJ.js → chunk-ED42YJZA.js} +46 -5
  13. package/dist/{chunk-UVBNT4WP.js → chunk-JVEHLVLY.js} +2 -2
  14. package/dist/{chunk-PRO6QOLZ.js → chunk-OEHDDUQ4.js} +1 -1
  15. package/dist/commands/agent/actions/index.js +1 -1
  16. package/dist/commands/agent/index.js +1 -1
  17. package/dist/commands/create/actions/index.js +2 -2
  18. package/dist/commands/create/index.js +3 -3
  19. package/dist/index.html +3 -3
  20. package/dist/index.js +260 -40
  21. package/dist/migration-guides/completion-requirements.md +1 -1
  22. package/dist/{plugin-creator-ZCOZ3UCT.js → plugin-creator-4QMSSR4X.js} +72 -74
  23. package/dist/{registry-FBPEGL2T.js → registry-NIGTUGFP.js} +1 -1
  24. package/dist/templates/project-starter/package.json +4 -4
  25. package/dist/templates/project-tee-starter/package.json +3 -3
  26. package/dist/{utils-I3EA43DE.js → utils-TW6X75NO.js} +1 -1
  27. package/package.json +5 -7
  28. package/templates/project-starter/package.json +4 -4
  29. package/templates/project-tee-starter/package.json +3 -3
  30. package/dist/assets/index-BBiLesJT.js.br +0 -0
  31. package/dist/assets/index-DxW_jg81.css +0 -1
  32. package/dist/assets/index-DxW_jg81.css.br +0 -0
  33. package/dist/assets/index-EfDd1Y35.js.br +0 -0
  34. package/dist/assets/vendor-DS2z8upE.js.br +0 -0
  35. package/dist/assets/vendor-DS2z8upE.js.map +0 -1
@@ -16,7 +16,7 @@ function _mergeNamespaces(n, m) {
16
16
  return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' }));
17
17
  }
18
18
 
19
- function getDefaultExportFromCjs$1(x) {
19
+ function getDefaultExportFromCjs(x) {
20
20
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
21
21
  }
22
22
  function getAugmentedNamespace(n) {
@@ -46,11 +46,2379 @@ function getAugmentedNamespace(n) {
46
46
 
47
47
  var react = {exports: {}};
48
48
 
49
- function getDefaultExportFromCjs(x) {
50
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
49
+ var dist$1 = {};
50
+
51
+ var bufferPolyfill = {};
52
+
53
+ var base64Js = {};
54
+
55
+ var hasRequiredBase64Js;
56
+
57
+ function requireBase64Js () {
58
+ if (hasRequiredBase64Js) return base64Js;
59
+ hasRequiredBase64Js = 1;
60
+
61
+ base64Js.byteLength = byteLength;
62
+ base64Js.toByteArray = toByteArray;
63
+ base64Js.fromByteArray = fromByteArray;
64
+
65
+ var lookup = [];
66
+ var revLookup = [];
67
+ var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
68
+
69
+ var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
70
+ for (var i = 0, len = code.length; i < len; ++i) {
71
+ lookup[i] = code[i];
72
+ revLookup[code.charCodeAt(i)] = i;
73
+ }
74
+
75
+ // Support decoding URL-safe base64 strings, as Node.js does.
76
+ // See: https://en.wikipedia.org/wiki/Base64#URL_applications
77
+ revLookup['-'.charCodeAt(0)] = 62;
78
+ revLookup['_'.charCodeAt(0)] = 63;
79
+
80
+ function getLens (b64) {
81
+ var len = b64.length;
82
+
83
+ if (len % 4 > 0) {
84
+ throw new Error('Invalid string. Length must be a multiple of 4')
85
+ }
86
+
87
+ // Trim off extra bytes after placeholder bytes are found
88
+ // See: https://github.com/beatgammit/base64-js/issues/42
89
+ var validLen = b64.indexOf('=');
90
+ if (validLen === -1) validLen = len;
91
+
92
+ var placeHoldersLen = validLen === len
93
+ ? 0
94
+ : 4 - (validLen % 4);
95
+
96
+ return [validLen, placeHoldersLen]
97
+ }
98
+
99
+ // base64 is 4/3 + up to two characters of the original data
100
+ function byteLength (b64) {
101
+ var lens = getLens(b64);
102
+ var validLen = lens[0];
103
+ var placeHoldersLen = lens[1];
104
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
105
+ }
106
+
107
+ function _byteLength (b64, validLen, placeHoldersLen) {
108
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
109
+ }
110
+
111
+ function toByteArray (b64) {
112
+ var tmp;
113
+ var lens = getLens(b64);
114
+ var validLen = lens[0];
115
+ var placeHoldersLen = lens[1];
116
+
117
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
118
+
119
+ var curByte = 0;
120
+
121
+ // if there are placeholders, only get up to the last complete 4 chars
122
+ var len = placeHoldersLen > 0
123
+ ? validLen - 4
124
+ : validLen;
125
+
126
+ var i;
127
+ for (i = 0; i < len; i += 4) {
128
+ tmp =
129
+ (revLookup[b64.charCodeAt(i)] << 18) |
130
+ (revLookup[b64.charCodeAt(i + 1)] << 12) |
131
+ (revLookup[b64.charCodeAt(i + 2)] << 6) |
132
+ revLookup[b64.charCodeAt(i + 3)];
133
+ arr[curByte++] = (tmp >> 16) & 0xFF;
134
+ arr[curByte++] = (tmp >> 8) & 0xFF;
135
+ arr[curByte++] = tmp & 0xFF;
136
+ }
137
+
138
+ if (placeHoldersLen === 2) {
139
+ tmp =
140
+ (revLookup[b64.charCodeAt(i)] << 2) |
141
+ (revLookup[b64.charCodeAt(i + 1)] >> 4);
142
+ arr[curByte++] = tmp & 0xFF;
143
+ }
144
+
145
+ if (placeHoldersLen === 1) {
146
+ tmp =
147
+ (revLookup[b64.charCodeAt(i)] << 10) |
148
+ (revLookup[b64.charCodeAt(i + 1)] << 4) |
149
+ (revLookup[b64.charCodeAt(i + 2)] >> 2);
150
+ arr[curByte++] = (tmp >> 8) & 0xFF;
151
+ arr[curByte++] = tmp & 0xFF;
152
+ }
153
+
154
+ return arr
155
+ }
156
+
157
+ function tripletToBase64 (num) {
158
+ return lookup[num >> 18 & 0x3F] +
159
+ lookup[num >> 12 & 0x3F] +
160
+ lookup[num >> 6 & 0x3F] +
161
+ lookup[num & 0x3F]
162
+ }
163
+
164
+ function encodeChunk (uint8, start, end) {
165
+ var tmp;
166
+ var output = [];
167
+ for (var i = start; i < end; i += 3) {
168
+ tmp =
169
+ ((uint8[i] << 16) & 0xFF0000) +
170
+ ((uint8[i + 1] << 8) & 0xFF00) +
171
+ (uint8[i + 2] & 0xFF);
172
+ output.push(tripletToBase64(tmp));
173
+ }
174
+ return output.join('')
175
+ }
176
+
177
+ function fromByteArray (uint8) {
178
+ var tmp;
179
+ var len = uint8.length;
180
+ var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
181
+ var parts = [];
182
+ var maxChunkLength = 16383; // must be multiple of 3
183
+
184
+ // go through the array every three bytes, we'll deal with trailing stuff later
185
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
186
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
187
+ }
188
+
189
+ // pad the end with zeros, but make sure to not forget the extra bytes
190
+ if (extraBytes === 1) {
191
+ tmp = uint8[len - 1];
192
+ parts.push(
193
+ lookup[tmp >> 2] +
194
+ lookup[(tmp << 4) & 0x3F] +
195
+ '=='
196
+ );
197
+ } else if (extraBytes === 2) {
198
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
199
+ parts.push(
200
+ lookup[tmp >> 10] +
201
+ lookup[(tmp >> 4) & 0x3F] +
202
+ lookup[(tmp << 2) & 0x3F] +
203
+ '='
204
+ );
205
+ }
206
+
207
+ return parts.join('')
208
+ }
209
+ return base64Js;
51
210
  }
52
- var browser = { exports: {} };
53
- var process = browser.exports = {};
211
+
212
+ var ieee754 = {};
213
+
214
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
215
+
216
+ var hasRequiredIeee754;
217
+
218
+ function requireIeee754 () {
219
+ if (hasRequiredIeee754) return ieee754;
220
+ hasRequiredIeee754 = 1;
221
+ ieee754.read = function (buffer, offset, isLE, mLen, nBytes) {
222
+ var e, m;
223
+ var eLen = (nBytes * 8) - mLen - 1;
224
+ var eMax = (1 << eLen) - 1;
225
+ var eBias = eMax >> 1;
226
+ var nBits = -7;
227
+ var i = isLE ? (nBytes - 1) : 0;
228
+ var d = isLE ? -1 : 1;
229
+ var s = buffer[offset + i];
230
+
231
+ i += d;
232
+
233
+ e = s & ((1 << (-nBits)) - 1);
234
+ s >>= (-nBits);
235
+ nBits += eLen;
236
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
237
+
238
+ m = e & ((1 << (-nBits)) - 1);
239
+ e >>= (-nBits);
240
+ nBits += mLen;
241
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
242
+
243
+ if (e === 0) {
244
+ e = 1 - eBias;
245
+ } else if (e === eMax) {
246
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
247
+ } else {
248
+ m = m + Math.pow(2, mLen);
249
+ e = e - eBias;
250
+ }
251
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
252
+ };
253
+
254
+ ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {
255
+ var e, m, c;
256
+ var eLen = (nBytes * 8) - mLen - 1;
257
+ var eMax = (1 << eLen) - 1;
258
+ var eBias = eMax >> 1;
259
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
260
+ var i = isLE ? 0 : (nBytes - 1);
261
+ var d = isLE ? 1 : -1;
262
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
263
+
264
+ value = Math.abs(value);
265
+
266
+ if (isNaN(value) || value === Infinity) {
267
+ m = isNaN(value) ? 1 : 0;
268
+ e = eMax;
269
+ } else {
270
+ e = Math.floor(Math.log(value) / Math.LN2);
271
+ if (value * (c = Math.pow(2, -e)) < 1) {
272
+ e--;
273
+ c *= 2;
274
+ }
275
+ if (e + eBias >= 1) {
276
+ value += rt / c;
277
+ } else {
278
+ value += rt * Math.pow(2, 1 - eBias);
279
+ }
280
+ if (value * c >= 2) {
281
+ e++;
282
+ c /= 2;
283
+ }
284
+
285
+ if (e + eBias >= eMax) {
286
+ m = 0;
287
+ e = eMax;
288
+ } else if (e + eBias >= 1) {
289
+ m = ((value * c) - 1) * Math.pow(2, mLen);
290
+ e = e + eBias;
291
+ } else {
292
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
293
+ e = 0;
294
+ }
295
+ }
296
+
297
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
298
+
299
+ e = (e << mLen) | m;
300
+ eLen += mLen;
301
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
302
+
303
+ buffer[offset + i - d] |= s * 128;
304
+ };
305
+ return ieee754;
306
+ }
307
+
308
+ /*!
309
+ * The buffer module from node.js, for the browser.
310
+ *
311
+ * @author Feross Aboukhadijeh <https://feross.org>
312
+ * @license MIT
313
+ */
314
+
315
+ var hasRequiredBufferPolyfill;
316
+
317
+ function requireBufferPolyfill () {
318
+ if (hasRequiredBufferPolyfill) return bufferPolyfill;
319
+ hasRequiredBufferPolyfill = 1;
320
+ (function (exports) {
321
+
322
+ const base64 = requireBase64Js();
323
+ const ieee754 = requireIeee754();
324
+ const customInspectSymbol =
325
+ (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
326
+ ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
327
+ : null;
328
+
329
+ exports.Buffer = Buffer;
330
+ exports.SlowBuffer = SlowBuffer;
331
+ exports.INSPECT_MAX_BYTES = 50;
332
+
333
+ const K_MAX_LENGTH = 0x7fffffff;
334
+ exports.kMaxLength = K_MAX_LENGTH;
335
+
336
+ /**
337
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
338
+ * === true Use Uint8Array implementation (fastest)
339
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
340
+ * implementation (most compatible, even IE6)
341
+ *
342
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
343
+ * Opera 11.6+, iOS 4.2+.
344
+ *
345
+ * We report that the browser does not support typed arrays if the are not subclassable
346
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
347
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
348
+ * for __proto__ and has a buggy typed array implementation.
349
+ */
350
+ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
351
+
352
+ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
353
+ typeof console.error === 'function') {
354
+ console.error(
355
+ 'This browser lacks typed array (Uint8Array) support which is required by ' +
356
+ '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
357
+ );
358
+ }
359
+
360
+ function typedArraySupport () {
361
+ // Can typed array instances can be augmented?
362
+ try {
363
+ const arr = new Uint8Array(1);
364
+ const proto = { foo: function () { return 42 } };
365
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
366
+ Object.setPrototypeOf(arr, proto);
367
+ return arr.foo() === 42
368
+ } catch (e) {
369
+ return false
370
+ }
371
+ }
372
+
373
+ Object.defineProperty(Buffer.prototype, 'parent', {
374
+ enumerable: true,
375
+ get: function () {
376
+ if (!Buffer.isBuffer(this)) return undefined
377
+ return this.buffer
378
+ }
379
+ });
380
+
381
+ Object.defineProperty(Buffer.prototype, 'offset', {
382
+ enumerable: true,
383
+ get: function () {
384
+ if (!Buffer.isBuffer(this)) return undefined
385
+ return this.byteOffset
386
+ }
387
+ });
388
+
389
+ function createBuffer (length) {
390
+ if (length > K_MAX_LENGTH) {
391
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
392
+ }
393
+ // Return an augmented `Uint8Array` instance
394
+ const buf = new Uint8Array(length);
395
+ Object.setPrototypeOf(buf, Buffer.prototype);
396
+ return buf
397
+ }
398
+
399
+ /**
400
+ * The Buffer constructor returns instances of `Uint8Array` that have their
401
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
402
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
403
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
404
+ * returns a single octet.
405
+ *
406
+ * The `Uint8Array` prototype remains unmodified.
407
+ */
408
+
409
+ function Buffer (arg, encodingOrOffset, length) {
410
+ // Common case.
411
+ if (typeof arg === 'number') {
412
+ if (typeof encodingOrOffset === 'string') {
413
+ throw new TypeError(
414
+ 'The "string" argument must be of type string. Received type number'
415
+ )
416
+ }
417
+ return allocUnsafe(arg)
418
+ }
419
+ return from(arg, encodingOrOffset, length)
420
+ }
421
+
422
+ Buffer.poolSize = 8192; // not used by this implementation
423
+
424
+ function from (value, encodingOrOffset, length) {
425
+ if (typeof value === 'string') {
426
+ return fromString(value, encodingOrOffset)
427
+ }
428
+
429
+ if (ArrayBuffer.isView(value)) {
430
+ return fromArrayView(value)
431
+ }
432
+
433
+ if (value == null) {
434
+ throw new TypeError(
435
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
436
+ 'or Array-like Object. Received type ' + (typeof value)
437
+ )
438
+ }
439
+
440
+ if (isInstance(value, ArrayBuffer) ||
441
+ (value && isInstance(value.buffer, ArrayBuffer))) {
442
+ return fromArrayBuffer(value, encodingOrOffset, length)
443
+ }
444
+
445
+ if (typeof SharedArrayBuffer !== 'undefined' &&
446
+ (isInstance(value, SharedArrayBuffer) ||
447
+ (value && isInstance(value.buffer, SharedArrayBuffer)))) {
448
+ return fromArrayBuffer(value, encodingOrOffset, length)
449
+ }
450
+
451
+ if (typeof value === 'number') {
452
+ throw new TypeError(
453
+ 'The "value" argument must not be of type number. Received type number'
454
+ )
455
+ }
456
+
457
+ const valueOf = value.valueOf && value.valueOf();
458
+ if (valueOf != null && valueOf !== value) {
459
+ return Buffer.from(valueOf, encodingOrOffset, length)
460
+ }
461
+
462
+ const b = fromObject(value);
463
+ if (b) return b
464
+
465
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
466
+ typeof value[Symbol.toPrimitive] === 'function') {
467
+ return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
468
+ }
469
+
470
+ throw new TypeError(
471
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
472
+ 'or Array-like Object. Received type ' + (typeof value)
473
+ )
474
+ }
475
+
476
+ /**
477
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
478
+ * if value is a number.
479
+ * Buffer.from(str[, encoding])
480
+ * Buffer.from(array)
481
+ * Buffer.from(buffer)
482
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
483
+ **/
484
+ Buffer.from = function (value, encodingOrOffset, length) {
485
+ return from(value, encodingOrOffset, length)
486
+ };
487
+
488
+ // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
489
+ // https://github.com/feross/buffer/pull/148
490
+ Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
491
+ Object.setPrototypeOf(Buffer, Uint8Array);
492
+
493
+ function assertSize (size) {
494
+ if (typeof size !== 'number') {
495
+ throw new TypeError('"size" argument must be of type number')
496
+ } else if (size < 0) {
497
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
498
+ }
499
+ }
500
+
501
+ function alloc (size, fill, encoding) {
502
+ assertSize(size);
503
+ if (size <= 0) {
504
+ return createBuffer(size)
505
+ }
506
+ if (fill !== undefined) {
507
+ // Only pay attention to encoding if it's a string. This
508
+ // prevents accidentally sending in a number that would
509
+ // be interpreted as a start offset.
510
+ return typeof encoding === 'string'
511
+ ? createBuffer(size).fill(fill, encoding)
512
+ : createBuffer(size).fill(fill)
513
+ }
514
+ return createBuffer(size)
515
+ }
516
+
517
+ /**
518
+ * Creates a new filled Buffer instance.
519
+ * alloc(size[, fill[, encoding]])
520
+ **/
521
+ Buffer.alloc = function (size, fill, encoding) {
522
+ return alloc(size, fill, encoding)
523
+ };
524
+
525
+ function allocUnsafe (size) {
526
+ assertSize(size);
527
+ return createBuffer(size < 0 ? 0 : checked(size) | 0)
528
+ }
529
+
530
+ /**
531
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
532
+ * */
533
+ Buffer.allocUnsafe = function (size) {
534
+ return allocUnsafe(size)
535
+ };
536
+ /**
537
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
538
+ */
539
+ Buffer.allocUnsafeSlow = function (size) {
540
+ return allocUnsafe(size)
541
+ };
542
+
543
+ function fromString (string, encoding) {
544
+ if (typeof encoding !== 'string' || encoding === '') {
545
+ encoding = 'utf8';
546
+ }
547
+
548
+ if (!Buffer.isEncoding(encoding)) {
549
+ throw new TypeError('Unknown encoding: ' + encoding)
550
+ }
551
+
552
+ const length = byteLength(string, encoding) | 0;
553
+ let buf = createBuffer(length);
554
+
555
+ const actual = buf.write(string, encoding);
556
+
557
+ if (actual !== length) {
558
+ // Writing a hex string, for example, that contains invalid characters will
559
+ // cause everything after the first invalid character to be ignored. (e.g.
560
+ // 'abxxcd' will be treated as 'ab')
561
+ buf = buf.slice(0, actual);
562
+ }
563
+
564
+ return buf
565
+ }
566
+
567
+ function fromArrayLike (array) {
568
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
569
+ const buf = createBuffer(length);
570
+ for (let i = 0; i < length; i += 1) {
571
+ buf[i] = array[i] & 255;
572
+ }
573
+ return buf
574
+ }
575
+
576
+ function fromArrayView (arrayView) {
577
+ if (isInstance(arrayView, Uint8Array)) {
578
+ const copy = new Uint8Array(arrayView);
579
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
580
+ }
581
+ return fromArrayLike(arrayView)
582
+ }
583
+
584
+ function fromArrayBuffer (array, byteOffset, length) {
585
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
586
+ throw new RangeError('"offset" is outside of buffer bounds')
587
+ }
588
+
589
+ if (array.byteLength < byteOffset + (length || 0)) {
590
+ throw new RangeError('"length" is outside of buffer bounds')
591
+ }
592
+
593
+ let buf;
594
+ if (byteOffset === undefined && length === undefined) {
595
+ buf = new Uint8Array(array);
596
+ } else if (length === undefined) {
597
+ buf = new Uint8Array(array, byteOffset);
598
+ } else {
599
+ buf = new Uint8Array(array, byteOffset, length);
600
+ }
601
+
602
+ // Return an augmented `Uint8Array` instance
603
+ Object.setPrototypeOf(buf, Buffer.prototype);
604
+
605
+ return buf
606
+ }
607
+
608
+ function fromObject (obj) {
609
+ if (Buffer.isBuffer(obj)) {
610
+ const len = checked(obj.length) | 0;
611
+ const buf = createBuffer(len);
612
+
613
+ if (buf.length === 0) {
614
+ return buf
615
+ }
616
+
617
+ obj.copy(buf, 0, 0, len);
618
+ return buf
619
+ }
620
+
621
+ if (obj.length !== undefined) {
622
+ if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
623
+ return createBuffer(0)
624
+ }
625
+ return fromArrayLike(obj)
626
+ }
627
+
628
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
629
+ return fromArrayLike(obj.data)
630
+ }
631
+ }
632
+
633
+ function checked (length) {
634
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
635
+ // length is NaN (which is otherwise coerced to zero.)
636
+ if (length >= K_MAX_LENGTH) {
637
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
638
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
639
+ }
640
+ return length | 0
641
+ }
642
+
643
+ function SlowBuffer (length) {
644
+ if (+length != length) { // eslint-disable-line eqeqeq
645
+ length = 0;
646
+ }
647
+ return Buffer.alloc(+length)
648
+ }
649
+
650
+ Buffer.isBuffer = function isBuffer (b) {
651
+ return b != null && b._isBuffer === true &&
652
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
653
+ };
654
+
655
+ Buffer.compare = function compare (a, b) {
656
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
657
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
658
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
659
+ throw new TypeError(
660
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
661
+ )
662
+ }
663
+
664
+ if (a === b) return 0
665
+
666
+ let x = a.length;
667
+ let y = b.length;
668
+
669
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
670
+ if (a[i] !== b[i]) {
671
+ x = a[i];
672
+ y = b[i];
673
+ break
674
+ }
675
+ }
676
+
677
+ if (x < y) return -1
678
+ if (y < x) return 1
679
+ return 0
680
+ };
681
+
682
+ Buffer.isEncoding = function isEncoding (encoding) {
683
+ switch (String(encoding).toLowerCase()) {
684
+ case 'hex':
685
+ case 'utf8':
686
+ case 'utf-8':
687
+ case 'ascii':
688
+ case 'latin1':
689
+ case 'binary':
690
+ case 'base64':
691
+ case 'ucs2':
692
+ case 'ucs-2':
693
+ case 'utf16le':
694
+ case 'utf-16le':
695
+ return true
696
+ default:
697
+ return false
698
+ }
699
+ };
700
+
701
+ Buffer.concat = function concat (list, length) {
702
+ if (!Array.isArray(list)) {
703
+ throw new TypeError('"list" argument must be an Array of Buffers')
704
+ }
705
+
706
+ if (list.length === 0) {
707
+ return Buffer.alloc(0)
708
+ }
709
+
710
+ let i;
711
+ if (length === undefined) {
712
+ length = 0;
713
+ for (i = 0; i < list.length; ++i) {
714
+ length += list[i].length;
715
+ }
716
+ }
717
+
718
+ const buffer = Buffer.allocUnsafe(length);
719
+ let pos = 0;
720
+ for (i = 0; i < list.length; ++i) {
721
+ let buf = list[i];
722
+ if (isInstance(buf, Uint8Array)) {
723
+ if (pos + buf.length > buffer.length) {
724
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
725
+ buf.copy(buffer, pos);
726
+ } else {
727
+ Uint8Array.prototype.set.call(
728
+ buffer,
729
+ buf,
730
+ pos
731
+ );
732
+ }
733
+ } else if (!Buffer.isBuffer(buf)) {
734
+ throw new TypeError('"list" argument must be an Array of Buffers')
735
+ } else {
736
+ buf.copy(buffer, pos);
737
+ }
738
+ pos += buf.length;
739
+ }
740
+ return buffer
741
+ };
742
+
743
+ function byteLength (string, encoding) {
744
+ if (Buffer.isBuffer(string)) {
745
+ return string.length
746
+ }
747
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
748
+ return string.byteLength
749
+ }
750
+ if (typeof string !== 'string') {
751
+ throw new TypeError(
752
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
753
+ 'Received type ' + typeof string
754
+ )
755
+ }
756
+
757
+ const len = string.length;
758
+ const mustMatch = (arguments.length > 2 && arguments[2] === true);
759
+ if (!mustMatch && len === 0) return 0
760
+
761
+ // Use a for loop to avoid recursion
762
+ let loweredCase = false;
763
+ for (;;) {
764
+ switch (encoding) {
765
+ case 'ascii':
766
+ case 'latin1':
767
+ case 'binary':
768
+ return len
769
+ case 'utf8':
770
+ case 'utf-8':
771
+ return utf8ToBytes(string).length
772
+ case 'ucs2':
773
+ case 'ucs-2':
774
+ case 'utf16le':
775
+ case 'utf-16le':
776
+ return len * 2
777
+ case 'hex':
778
+ return len >>> 1
779
+ case 'base64':
780
+ return base64ToBytes(string).length
781
+ default:
782
+ if (loweredCase) {
783
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
784
+ }
785
+ encoding = ('' + encoding).toLowerCase();
786
+ loweredCase = true;
787
+ }
788
+ }
789
+ }
790
+ Buffer.byteLength = byteLength;
791
+
792
+ function slowToString (encoding, start, end) {
793
+ let loweredCase = false;
794
+
795
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
796
+ // property of a typed array.
797
+
798
+ // This behaves neither like String nor Uint8Array in that we set start/end
799
+ // to their upper/lower bounds if the value passed is out of range.
800
+ // undefined is handled specially as per ECMA-262 6th Edition,
801
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
802
+ if (start === undefined || start < 0) {
803
+ start = 0;
804
+ }
805
+ // Return early if start > this.length. Done here to prevent potential uint32
806
+ // coercion fail below.
807
+ if (start > this.length) {
808
+ return ''
809
+ }
810
+
811
+ if (end === undefined || end > this.length) {
812
+ end = this.length;
813
+ }
814
+
815
+ if (end <= 0) {
816
+ return ''
817
+ }
818
+
819
+ // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
820
+ end >>>= 0;
821
+ start >>>= 0;
822
+
823
+ if (end <= start) {
824
+ return ''
825
+ }
826
+
827
+ if (!encoding) encoding = 'utf8';
828
+
829
+ while (true) {
830
+ switch (encoding) {
831
+ case 'hex':
832
+ return hexSlice(this, start, end)
833
+
834
+ case 'utf8':
835
+ case 'utf-8':
836
+ return utf8Slice(this, start, end)
837
+
838
+ case 'ascii':
839
+ return asciiSlice(this, start, end)
840
+
841
+ case 'latin1':
842
+ case 'binary':
843
+ return latin1Slice(this, start, end)
844
+
845
+ case 'base64':
846
+ return base64Slice(this, start, end)
847
+
848
+ case 'ucs2':
849
+ case 'ucs-2':
850
+ case 'utf16le':
851
+ case 'utf-16le':
852
+ return utf16leSlice(this, start, end)
853
+
854
+ default:
855
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
856
+ encoding = (encoding + '').toLowerCase();
857
+ loweredCase = true;
858
+ }
859
+ }
860
+ }
861
+
862
+ // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
863
+ // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
864
+ // reliably in a browserify context because there could be multiple different
865
+ // copies of the 'buffer' package in use. This method works even for Buffer
866
+ // instances that were created from another copy of the `buffer` package.
867
+ // See: https://github.com/feross/buffer/issues/154
868
+ Buffer.prototype._isBuffer = true;
869
+
870
+ function swap (b, n, m) {
871
+ const i = b[n];
872
+ b[n] = b[m];
873
+ b[m] = i;
874
+ }
875
+
876
+ Buffer.prototype.swap16 = function swap16 () {
877
+ const len = this.length;
878
+ if (len % 2 !== 0) {
879
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
880
+ }
881
+ for (let i = 0; i < len; i += 2) {
882
+ swap(this, i, i + 1);
883
+ }
884
+ return this
885
+ };
886
+
887
+ Buffer.prototype.swap32 = function swap32 () {
888
+ const len = this.length;
889
+ if (len % 4 !== 0) {
890
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
891
+ }
892
+ for (let i = 0; i < len; i += 4) {
893
+ swap(this, i, i + 3);
894
+ swap(this, i + 1, i + 2);
895
+ }
896
+ return this
897
+ };
898
+
899
+ Buffer.prototype.swap64 = function swap64 () {
900
+ const len = this.length;
901
+ if (len % 8 !== 0) {
902
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
903
+ }
904
+ for (let i = 0; i < len; i += 8) {
905
+ swap(this, i, i + 7);
906
+ swap(this, i + 1, i + 6);
907
+ swap(this, i + 2, i + 5);
908
+ swap(this, i + 3, i + 4);
909
+ }
910
+ return this
911
+ };
912
+
913
+ Buffer.prototype.toString = function toString () {
914
+ const length = this.length;
915
+ if (length === 0) return ''
916
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
917
+ return slowToString.apply(this, arguments)
918
+ };
919
+
920
+ Buffer.prototype.toLocaleString = Buffer.prototype.toString;
921
+
922
+ Buffer.prototype.equals = function equals (b) {
923
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
924
+ if (this === b) return true
925
+ return Buffer.compare(this, b) === 0
926
+ };
927
+
928
+ Buffer.prototype.inspect = function inspect () {
929
+ let str = '';
930
+ const max = exports.INSPECT_MAX_BYTES;
931
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
932
+ if (this.length > max) str += ' ... ';
933
+ return '<Buffer ' + str + '>'
934
+ };
935
+ if (customInspectSymbol) {
936
+ Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
937
+ }
938
+
939
+ Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
940
+ if (isInstance(target, Uint8Array)) {
941
+ target = Buffer.from(target, target.offset, target.byteLength);
942
+ }
943
+ if (!Buffer.isBuffer(target)) {
944
+ throw new TypeError(
945
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
946
+ 'Received type ' + (typeof target)
947
+ )
948
+ }
949
+
950
+ if (start === undefined) {
951
+ start = 0;
952
+ }
953
+ if (end === undefined) {
954
+ end = target ? target.length : 0;
955
+ }
956
+ if (thisStart === undefined) {
957
+ thisStart = 0;
958
+ }
959
+ if (thisEnd === undefined) {
960
+ thisEnd = this.length;
961
+ }
962
+
963
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
964
+ throw new RangeError('out of range index')
965
+ }
966
+
967
+ if (thisStart >= thisEnd && start >= end) {
968
+ return 0
969
+ }
970
+ if (thisStart >= thisEnd) {
971
+ return -1
972
+ }
973
+ if (start >= end) {
974
+ return 1
975
+ }
976
+
977
+ start >>>= 0;
978
+ end >>>= 0;
979
+ thisStart >>>= 0;
980
+ thisEnd >>>= 0;
981
+
982
+ if (this === target) return 0
983
+
984
+ let x = thisEnd - thisStart;
985
+ let y = end - start;
986
+ const len = Math.min(x, y);
987
+
988
+ const thisCopy = this.slice(thisStart, thisEnd);
989
+ const targetCopy = target.slice(start, end);
990
+
991
+ for (let i = 0; i < len; ++i) {
992
+ if (thisCopy[i] !== targetCopy[i]) {
993
+ x = thisCopy[i];
994
+ y = targetCopy[i];
995
+ break
996
+ }
997
+ }
998
+
999
+ if (x < y) return -1
1000
+ if (y < x) return 1
1001
+ return 0
1002
+ };
1003
+
1004
+ // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
1005
+ // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
1006
+ //
1007
+ // Arguments:
1008
+ // - buffer - a Buffer to search
1009
+ // - val - a string, Buffer, or number
1010
+ // - byteOffset - an index into `buffer`; will be clamped to an int32
1011
+ // - encoding - an optional encoding, relevant is val is a string
1012
+ // - dir - true for indexOf, false for lastIndexOf
1013
+ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
1014
+ // Empty buffer means no match
1015
+ if (buffer.length === 0) return -1
1016
+
1017
+ // Normalize byteOffset
1018
+ if (typeof byteOffset === 'string') {
1019
+ encoding = byteOffset;
1020
+ byteOffset = 0;
1021
+ } else if (byteOffset > 0x7fffffff) {
1022
+ byteOffset = 0x7fffffff;
1023
+ } else if (byteOffset < -2147483648) {
1024
+ byteOffset = -2147483648;
1025
+ }
1026
+ byteOffset = +byteOffset; // Coerce to Number.
1027
+ if (numberIsNaN(byteOffset)) {
1028
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
1029
+ byteOffset = dir ? 0 : (buffer.length - 1);
1030
+ }
1031
+
1032
+ // Normalize byteOffset: negative offsets start from the end of the buffer
1033
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
1034
+ if (byteOffset >= buffer.length) {
1035
+ if (dir) return -1
1036
+ else byteOffset = buffer.length - 1;
1037
+ } else if (byteOffset < 0) {
1038
+ if (dir) byteOffset = 0;
1039
+ else return -1
1040
+ }
1041
+
1042
+ // Normalize val
1043
+ if (typeof val === 'string') {
1044
+ val = Buffer.from(val, encoding);
1045
+ }
1046
+
1047
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
1048
+ if (Buffer.isBuffer(val)) {
1049
+ // Special case: looking for empty string/buffer always fails
1050
+ if (val.length === 0) {
1051
+ return -1
1052
+ }
1053
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
1054
+ } else if (typeof val === 'number') {
1055
+ val = val & 0xFF; // Search for a byte value [0-255]
1056
+ if (typeof Uint8Array.prototype.indexOf === 'function') {
1057
+ if (dir) {
1058
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
1059
+ } else {
1060
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
1061
+ }
1062
+ }
1063
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
1064
+ }
1065
+
1066
+ throw new TypeError('val must be string, number or Buffer')
1067
+ }
1068
+
1069
+ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
1070
+ let indexSize = 1;
1071
+ let arrLength = arr.length;
1072
+ let valLength = val.length;
1073
+
1074
+ if (encoding !== undefined) {
1075
+ encoding = String(encoding).toLowerCase();
1076
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
1077
+ encoding === 'utf16le' || encoding === 'utf-16le') {
1078
+ if (arr.length < 2 || val.length < 2) {
1079
+ return -1
1080
+ }
1081
+ indexSize = 2;
1082
+ arrLength /= 2;
1083
+ valLength /= 2;
1084
+ byteOffset /= 2;
1085
+ }
1086
+ }
1087
+
1088
+ function read (buf, i) {
1089
+ if (indexSize === 1) {
1090
+ return buf[i]
1091
+ } else {
1092
+ return buf.readUInt16BE(i * indexSize)
1093
+ }
1094
+ }
1095
+
1096
+ let i;
1097
+ if (dir) {
1098
+ let foundIndex = -1;
1099
+ for (i = byteOffset; i < arrLength; i++) {
1100
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1101
+ if (foundIndex === -1) foundIndex = i;
1102
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
1103
+ } else {
1104
+ if (foundIndex !== -1) i -= i - foundIndex;
1105
+ foundIndex = -1;
1106
+ }
1107
+ }
1108
+ } else {
1109
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
1110
+ for (i = byteOffset; i >= 0; i--) {
1111
+ let found = true;
1112
+ for (let j = 0; j < valLength; j++) {
1113
+ if (read(arr, i + j) !== read(val, j)) {
1114
+ found = false;
1115
+ break
1116
+ }
1117
+ }
1118
+ if (found) return i
1119
+ }
1120
+ }
1121
+
1122
+ return -1
1123
+ }
1124
+
1125
+ Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
1126
+ return this.indexOf(val, byteOffset, encoding) !== -1
1127
+ };
1128
+
1129
+ Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
1130
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
1131
+ };
1132
+
1133
+ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
1134
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
1135
+ };
1136
+
1137
+ function hexWrite (buf, string, offset, length) {
1138
+ offset = Number(offset) || 0;
1139
+ const remaining = buf.length - offset;
1140
+ if (!length) {
1141
+ length = remaining;
1142
+ } else {
1143
+ length = Number(length);
1144
+ if (length > remaining) {
1145
+ length = remaining;
1146
+ }
1147
+ }
1148
+
1149
+ const strLen = string.length;
1150
+
1151
+ if (length > strLen / 2) {
1152
+ length = strLen / 2;
1153
+ }
1154
+ let i;
1155
+ for (i = 0; i < length; ++i) {
1156
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
1157
+ if (numberIsNaN(parsed)) return i
1158
+ buf[offset + i] = parsed;
1159
+ }
1160
+ return i
1161
+ }
1162
+
1163
+ function utf8Write (buf, string, offset, length) {
1164
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1165
+ }
1166
+
1167
+ function asciiWrite (buf, string, offset, length) {
1168
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
1169
+ }
1170
+
1171
+ function base64Write (buf, string, offset, length) {
1172
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
1173
+ }
1174
+
1175
+ function ucs2Write (buf, string, offset, length) {
1176
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1177
+ }
1178
+
1179
+ Buffer.prototype.write = function write (string, offset, length, encoding) {
1180
+ // Buffer#write(string)
1181
+ if (offset === undefined) {
1182
+ encoding = 'utf8';
1183
+ length = this.length;
1184
+ offset = 0;
1185
+ // Buffer#write(string, encoding)
1186
+ } else if (length === undefined && typeof offset === 'string') {
1187
+ encoding = offset;
1188
+ length = this.length;
1189
+ offset = 0;
1190
+ // Buffer#write(string, offset[, length][, encoding])
1191
+ } else if (isFinite(offset)) {
1192
+ offset = offset >>> 0;
1193
+ if (isFinite(length)) {
1194
+ length = length >>> 0;
1195
+ if (encoding === undefined) encoding = 'utf8';
1196
+ } else {
1197
+ encoding = length;
1198
+ length = undefined;
1199
+ }
1200
+ } else {
1201
+ throw new Error(
1202
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1203
+ )
1204
+ }
1205
+
1206
+ const remaining = this.length - offset;
1207
+ if (length === undefined || length > remaining) length = remaining;
1208
+
1209
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1210
+ throw new RangeError('Attempt to write outside buffer bounds')
1211
+ }
1212
+
1213
+ if (!encoding) encoding = 'utf8';
1214
+
1215
+ let loweredCase = false;
1216
+ for (;;) {
1217
+ switch (encoding) {
1218
+ case 'hex':
1219
+ return hexWrite(this, string, offset, length)
1220
+
1221
+ case 'utf8':
1222
+ case 'utf-8':
1223
+ return utf8Write(this, string, offset, length)
1224
+
1225
+ case 'ascii':
1226
+ case 'latin1':
1227
+ case 'binary':
1228
+ return asciiWrite(this, string, offset, length)
1229
+
1230
+ case 'base64':
1231
+ // Warning: maxLength not taken into account in base64Write
1232
+ return base64Write(this, string, offset, length)
1233
+
1234
+ case 'ucs2':
1235
+ case 'ucs-2':
1236
+ case 'utf16le':
1237
+ case 'utf-16le':
1238
+ return ucs2Write(this, string, offset, length)
1239
+
1240
+ default:
1241
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1242
+ encoding = ('' + encoding).toLowerCase();
1243
+ loweredCase = true;
1244
+ }
1245
+ }
1246
+ };
1247
+
1248
+ Buffer.prototype.toJSON = function toJSON () {
1249
+ return {
1250
+ type: 'Buffer',
1251
+ data: Array.prototype.slice.call(this._arr || this, 0)
1252
+ }
1253
+ };
1254
+
1255
+ function base64Slice (buf, start, end) {
1256
+ if (start === 0 && end === buf.length) {
1257
+ return base64.fromByteArray(buf)
1258
+ } else {
1259
+ return base64.fromByteArray(buf.slice(start, end))
1260
+ }
1261
+ }
1262
+
1263
+ function utf8Slice (buf, start, end) {
1264
+ end = Math.min(buf.length, end);
1265
+ const res = [];
1266
+
1267
+ let i = start;
1268
+ while (i < end) {
1269
+ const firstByte = buf[i];
1270
+ let codePoint = null;
1271
+ let bytesPerSequence = (firstByte > 0xEF)
1272
+ ? 4
1273
+ : (firstByte > 0xDF)
1274
+ ? 3
1275
+ : (firstByte > 0xBF)
1276
+ ? 2
1277
+ : 1;
1278
+
1279
+ if (i + bytesPerSequence <= end) {
1280
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1281
+
1282
+ switch (bytesPerSequence) {
1283
+ case 1:
1284
+ if (firstByte < 0x80) {
1285
+ codePoint = firstByte;
1286
+ }
1287
+ break
1288
+ case 2:
1289
+ secondByte = buf[i + 1];
1290
+ if ((secondByte & 0xC0) === 0x80) {
1291
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
1292
+ if (tempCodePoint > 0x7F) {
1293
+ codePoint = tempCodePoint;
1294
+ }
1295
+ }
1296
+ break
1297
+ case 3:
1298
+ secondByte = buf[i + 1];
1299
+ thirdByte = buf[i + 2];
1300
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1301
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
1302
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1303
+ codePoint = tempCodePoint;
1304
+ }
1305
+ }
1306
+ break
1307
+ case 4:
1308
+ secondByte = buf[i + 1];
1309
+ thirdByte = buf[i + 2];
1310
+ fourthByte = buf[i + 3];
1311
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1312
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1313
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1314
+ codePoint = tempCodePoint;
1315
+ }
1316
+ }
1317
+ }
1318
+ }
1319
+
1320
+ if (codePoint === null) {
1321
+ // we did not generate a valid codePoint so insert a
1322
+ // replacement char (U+FFFD) and advance only 1 byte
1323
+ codePoint = 0xFFFD;
1324
+ bytesPerSequence = 1;
1325
+ } else if (codePoint > 0xFFFF) {
1326
+ // encode to utf16 (surrogate pair dance)
1327
+ codePoint -= 0x10000;
1328
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1329
+ codePoint = 0xDC00 | codePoint & 0x3FF;
1330
+ }
1331
+
1332
+ res.push(codePoint);
1333
+ i += bytesPerSequence;
1334
+ }
1335
+
1336
+ return decodeCodePointsArray(res)
1337
+ }
1338
+
1339
+ // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1340
+ // the lowest limit is Chrome, with 0x10000 args.
1341
+ // We go 1 magnitude less, for safety
1342
+ const MAX_ARGUMENTS_LENGTH = 0x1000;
1343
+
1344
+ function decodeCodePointsArray (codePoints) {
1345
+ const len = codePoints.length;
1346
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1347
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1348
+ }
1349
+
1350
+ // Decode in chunks to avoid "call stack size exceeded".
1351
+ let res = '';
1352
+ let i = 0;
1353
+ while (i < len) {
1354
+ res += String.fromCharCode.apply(
1355
+ String,
1356
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1357
+ );
1358
+ }
1359
+ return res
1360
+ }
1361
+
1362
+ function asciiSlice (buf, start, end) {
1363
+ let ret = '';
1364
+ end = Math.min(buf.length, end);
1365
+
1366
+ for (let i = start; i < end; ++i) {
1367
+ ret += String.fromCharCode(buf[i] & 0x7F);
1368
+ }
1369
+ return ret
1370
+ }
1371
+
1372
+ function latin1Slice (buf, start, end) {
1373
+ let ret = '';
1374
+ end = Math.min(buf.length, end);
1375
+
1376
+ for (let i = start; i < end; ++i) {
1377
+ ret += String.fromCharCode(buf[i]);
1378
+ }
1379
+ return ret
1380
+ }
1381
+
1382
+ function hexSlice (buf, start, end) {
1383
+ const len = buf.length;
1384
+
1385
+ if (!start || start < 0) start = 0;
1386
+ if (!end || end < 0 || end > len) end = len;
1387
+
1388
+ let out = '';
1389
+ for (let i = start; i < end; ++i) {
1390
+ out += hexSliceLookupTable[buf[i]];
1391
+ }
1392
+ return out
1393
+ }
1394
+
1395
+ function utf16leSlice (buf, start, end) {
1396
+ const bytes = buf.slice(start, end);
1397
+ let res = '';
1398
+ // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1399
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1400
+ res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));
1401
+ }
1402
+ return res
1403
+ }
1404
+
1405
+ Buffer.prototype.slice = function slice (start, end) {
1406
+ const len = this.length;
1407
+ start = ~~start;
1408
+ end = end === undefined ? len : ~~end;
1409
+
1410
+ if (start < 0) {
1411
+ start += len;
1412
+ if (start < 0) start = 0;
1413
+ } else if (start > len) {
1414
+ start = len;
1415
+ }
1416
+
1417
+ if (end < 0) {
1418
+ end += len;
1419
+ if (end < 0) end = 0;
1420
+ } else if (end > len) {
1421
+ end = len;
1422
+ }
1423
+
1424
+ if (end < start) end = start;
1425
+
1426
+ const newBuf = this.subarray(start, end);
1427
+ // Return an augmented `Uint8Array` instance
1428
+ Object.setPrototypeOf(newBuf, Buffer.prototype);
1429
+
1430
+ return newBuf
1431
+ };
1432
+
1433
+ /*
1434
+ * Need to make sure that buffer isn't trying to write out of bounds.
1435
+ */
1436
+ function checkOffset (offset, ext, length) {
1437
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1438
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1439
+ }
1440
+
1441
+ Buffer.prototype.readUintLE =
1442
+ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1443
+ offset = offset >>> 0;
1444
+ byteLength = byteLength >>> 0;
1445
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1446
+
1447
+ let val = this[offset];
1448
+ let mul = 1;
1449
+ let i = 0;
1450
+ while (++i < byteLength && (mul *= 0x100)) {
1451
+ val += this[offset + i] * mul;
1452
+ }
1453
+
1454
+ return val
1455
+ };
1456
+
1457
+ Buffer.prototype.readUintBE =
1458
+ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1459
+ offset = offset >>> 0;
1460
+ byteLength = byteLength >>> 0;
1461
+ if (!noAssert) {
1462
+ checkOffset(offset, byteLength, this.length);
1463
+ }
1464
+
1465
+ let val = this[offset + --byteLength];
1466
+ let mul = 1;
1467
+ while (byteLength > 0 && (mul *= 0x100)) {
1468
+ val += this[offset + --byteLength] * mul;
1469
+ }
1470
+
1471
+ return val
1472
+ };
1473
+
1474
+ Buffer.prototype.readUint8 =
1475
+ Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1476
+ offset = offset >>> 0;
1477
+ if (!noAssert) checkOffset(offset, 1, this.length);
1478
+ return this[offset]
1479
+ };
1480
+
1481
+ Buffer.prototype.readUint16LE =
1482
+ Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1483
+ offset = offset >>> 0;
1484
+ if (!noAssert) checkOffset(offset, 2, this.length);
1485
+ return this[offset] | (this[offset + 1] << 8)
1486
+ };
1487
+
1488
+ Buffer.prototype.readUint16BE =
1489
+ Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1490
+ offset = offset >>> 0;
1491
+ if (!noAssert) checkOffset(offset, 2, this.length);
1492
+ return (this[offset] << 8) | this[offset + 1]
1493
+ };
1494
+
1495
+ Buffer.prototype.readUint32LE =
1496
+ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1497
+ offset = offset >>> 0;
1498
+ if (!noAssert) checkOffset(offset, 4, this.length);
1499
+
1500
+ return ((this[offset]) |
1501
+ (this[offset + 1] << 8) |
1502
+ (this[offset + 2] << 16)) +
1503
+ (this[offset + 3] * 0x1000000)
1504
+ };
1505
+
1506
+ Buffer.prototype.readUint32BE =
1507
+ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1508
+ offset = offset >>> 0;
1509
+ if (!noAssert) checkOffset(offset, 4, this.length);
1510
+
1511
+ return (this[offset] * 0x1000000) +
1512
+ ((this[offset + 1] << 16) |
1513
+ (this[offset + 2] << 8) |
1514
+ this[offset + 3])
1515
+ };
1516
+
1517
+ Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
1518
+ offset = offset >>> 0;
1519
+ validateNumber(offset, 'offset');
1520
+ const first = this[offset];
1521
+ const last = this[offset + 7];
1522
+ if (first === undefined || last === undefined) {
1523
+ boundsError(offset, this.length - 8);
1524
+ }
1525
+
1526
+ const lo = first +
1527
+ this[++offset] * 2 ** 8 +
1528
+ this[++offset] * 2 ** 16 +
1529
+ this[++offset] * 2 ** 24;
1530
+
1531
+ const hi = this[++offset] +
1532
+ this[++offset] * 2 ** 8 +
1533
+ this[++offset] * 2 ** 16 +
1534
+ last * 2 ** 24;
1535
+
1536
+ return BigInt(lo) + (BigInt(hi) << BigInt(32))
1537
+ });
1538
+
1539
+ Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
1540
+ offset = offset >>> 0;
1541
+ validateNumber(offset, 'offset');
1542
+ const first = this[offset];
1543
+ const last = this[offset + 7];
1544
+ if (first === undefined || last === undefined) {
1545
+ boundsError(offset, this.length - 8);
1546
+ }
1547
+
1548
+ const hi = first * 2 ** 24 +
1549
+ this[++offset] * 2 ** 16 +
1550
+ this[++offset] * 2 ** 8 +
1551
+ this[++offset];
1552
+
1553
+ const lo = this[++offset] * 2 ** 24 +
1554
+ this[++offset] * 2 ** 16 +
1555
+ this[++offset] * 2 ** 8 +
1556
+ last;
1557
+
1558
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo)
1559
+ });
1560
+
1561
+ Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1562
+ offset = offset >>> 0;
1563
+ byteLength = byteLength >>> 0;
1564
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1565
+
1566
+ let val = this[offset];
1567
+ let mul = 1;
1568
+ let i = 0;
1569
+ while (++i < byteLength && (mul *= 0x100)) {
1570
+ val += this[offset + i] * mul;
1571
+ }
1572
+ mul *= 0x80;
1573
+
1574
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1575
+
1576
+ return val
1577
+ };
1578
+
1579
+ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1580
+ offset = offset >>> 0;
1581
+ byteLength = byteLength >>> 0;
1582
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1583
+
1584
+ let i = byteLength;
1585
+ let mul = 1;
1586
+ let val = this[offset + --i];
1587
+ while (i > 0 && (mul *= 0x100)) {
1588
+ val += this[offset + --i] * mul;
1589
+ }
1590
+ mul *= 0x80;
1591
+
1592
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1593
+
1594
+ return val
1595
+ };
1596
+
1597
+ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1598
+ offset = offset >>> 0;
1599
+ if (!noAssert) checkOffset(offset, 1, this.length);
1600
+ if (!(this[offset] & 0x80)) return (this[offset])
1601
+ return ((0xff - this[offset] + 1) * -1)
1602
+ };
1603
+
1604
+ Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1605
+ offset = offset >>> 0;
1606
+ if (!noAssert) checkOffset(offset, 2, this.length);
1607
+ const val = this[offset] | (this[offset + 1] << 8);
1608
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1609
+ };
1610
+
1611
+ Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1612
+ offset = offset >>> 0;
1613
+ if (!noAssert) checkOffset(offset, 2, this.length);
1614
+ const val = this[offset + 1] | (this[offset] << 8);
1615
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1616
+ };
1617
+
1618
+ Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1619
+ offset = offset >>> 0;
1620
+ if (!noAssert) checkOffset(offset, 4, this.length);
1621
+
1622
+ return (this[offset]) |
1623
+ (this[offset + 1] << 8) |
1624
+ (this[offset + 2] << 16) |
1625
+ (this[offset + 3] << 24)
1626
+ };
1627
+
1628
+ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1629
+ offset = offset >>> 0;
1630
+ if (!noAssert) checkOffset(offset, 4, this.length);
1631
+
1632
+ return (this[offset] << 24) |
1633
+ (this[offset + 1] << 16) |
1634
+ (this[offset + 2] << 8) |
1635
+ (this[offset + 3])
1636
+ };
1637
+
1638
+ Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
1639
+ offset = offset >>> 0;
1640
+ validateNumber(offset, 'offset');
1641
+ const first = this[offset];
1642
+ const last = this[offset + 7];
1643
+ if (first === undefined || last === undefined) {
1644
+ boundsError(offset, this.length - 8);
1645
+ }
1646
+
1647
+ const val = this[offset + 4] +
1648
+ this[offset + 5] * 2 ** 8 +
1649
+ this[offset + 6] * 2 ** 16 +
1650
+ (last << 24); // Overflow
1651
+
1652
+ return (BigInt(val) << BigInt(32)) +
1653
+ BigInt(first +
1654
+ this[++offset] * 2 ** 8 +
1655
+ this[++offset] * 2 ** 16 +
1656
+ this[++offset] * 2 ** 24)
1657
+ });
1658
+
1659
+ Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
1660
+ offset = offset >>> 0;
1661
+ validateNumber(offset, 'offset');
1662
+ const first = this[offset];
1663
+ const last = this[offset + 7];
1664
+ if (first === undefined || last === undefined) {
1665
+ boundsError(offset, this.length - 8);
1666
+ }
1667
+
1668
+ const val = (first << 24) + // Overflow
1669
+ this[++offset] * 2 ** 16 +
1670
+ this[++offset] * 2 ** 8 +
1671
+ this[++offset];
1672
+
1673
+ return (BigInt(val) << BigInt(32)) +
1674
+ BigInt(this[++offset] * 2 ** 24 +
1675
+ this[++offset] * 2 ** 16 +
1676
+ this[++offset] * 2 ** 8 +
1677
+ last)
1678
+ });
1679
+
1680
+ Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1681
+ offset = offset >>> 0;
1682
+ if (!noAssert) checkOffset(offset, 4, this.length);
1683
+ return ieee754.read(this, offset, true, 23, 4)
1684
+ };
1685
+
1686
+ Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1687
+ offset = offset >>> 0;
1688
+ if (!noAssert) checkOffset(offset, 4, this.length);
1689
+ return ieee754.read(this, offset, false, 23, 4)
1690
+ };
1691
+
1692
+ Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1693
+ offset = offset >>> 0;
1694
+ if (!noAssert) checkOffset(offset, 8, this.length);
1695
+ return ieee754.read(this, offset, true, 52, 8)
1696
+ };
1697
+
1698
+ Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1699
+ offset = offset >>> 0;
1700
+ if (!noAssert) checkOffset(offset, 8, this.length);
1701
+ return ieee754.read(this, offset, false, 52, 8)
1702
+ };
1703
+
1704
+ function checkInt (buf, value, offset, ext, max, min) {
1705
+ if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1706
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1707
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
1708
+ }
1709
+
1710
+ Buffer.prototype.writeUintLE =
1711
+ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1712
+ value = +value;
1713
+ offset = offset >>> 0;
1714
+ byteLength = byteLength >>> 0;
1715
+ if (!noAssert) {
1716
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1717
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1718
+ }
1719
+
1720
+ let mul = 1;
1721
+ let i = 0;
1722
+ this[offset] = value & 0xFF;
1723
+ while (++i < byteLength && (mul *= 0x100)) {
1724
+ this[offset + i] = (value / mul) & 0xFF;
1725
+ }
1726
+
1727
+ return offset + byteLength
1728
+ };
1729
+
1730
+ Buffer.prototype.writeUintBE =
1731
+ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1732
+ value = +value;
1733
+ offset = offset >>> 0;
1734
+ byteLength = byteLength >>> 0;
1735
+ if (!noAssert) {
1736
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1737
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1738
+ }
1739
+
1740
+ let i = byteLength - 1;
1741
+ let mul = 1;
1742
+ this[offset + i] = value & 0xFF;
1743
+ while (--i >= 0 && (mul *= 0x100)) {
1744
+ this[offset + i] = (value / mul) & 0xFF;
1745
+ }
1746
+
1747
+ return offset + byteLength
1748
+ };
1749
+
1750
+ Buffer.prototype.writeUint8 =
1751
+ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1752
+ value = +value;
1753
+ offset = offset >>> 0;
1754
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1755
+ this[offset] = (value & 0xff);
1756
+ return offset + 1
1757
+ };
1758
+
1759
+ Buffer.prototype.writeUint16LE =
1760
+ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1761
+ value = +value;
1762
+ offset = offset >>> 0;
1763
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1764
+ this[offset] = (value & 0xff);
1765
+ this[offset + 1] = (value >>> 8);
1766
+ return offset + 2
1767
+ };
1768
+
1769
+ Buffer.prototype.writeUint16BE =
1770
+ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1771
+ value = +value;
1772
+ offset = offset >>> 0;
1773
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1774
+ this[offset] = (value >>> 8);
1775
+ this[offset + 1] = (value & 0xff);
1776
+ return offset + 2
1777
+ };
1778
+
1779
+ Buffer.prototype.writeUint32LE =
1780
+ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1781
+ value = +value;
1782
+ offset = offset >>> 0;
1783
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1784
+ this[offset + 3] = (value >>> 24);
1785
+ this[offset + 2] = (value >>> 16);
1786
+ this[offset + 1] = (value >>> 8);
1787
+ this[offset] = (value & 0xff);
1788
+ return offset + 4
1789
+ };
1790
+
1791
+ Buffer.prototype.writeUint32BE =
1792
+ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1793
+ value = +value;
1794
+ offset = offset >>> 0;
1795
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1796
+ this[offset] = (value >>> 24);
1797
+ this[offset + 1] = (value >>> 16);
1798
+ this[offset + 2] = (value >>> 8);
1799
+ this[offset + 3] = (value & 0xff);
1800
+ return offset + 4
1801
+ };
1802
+
1803
+ function wrtBigUInt64LE (buf, value, offset, min, max) {
1804
+ checkIntBI(value, min, max, buf, offset, 7);
1805
+
1806
+ let lo = Number(value & BigInt(0xffffffff));
1807
+ buf[offset++] = lo;
1808
+ lo = lo >> 8;
1809
+ buf[offset++] = lo;
1810
+ lo = lo >> 8;
1811
+ buf[offset++] = lo;
1812
+ lo = lo >> 8;
1813
+ buf[offset++] = lo;
1814
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1815
+ buf[offset++] = hi;
1816
+ hi = hi >> 8;
1817
+ buf[offset++] = hi;
1818
+ hi = hi >> 8;
1819
+ buf[offset++] = hi;
1820
+ hi = hi >> 8;
1821
+ buf[offset++] = hi;
1822
+ return offset
1823
+ }
1824
+
1825
+ function wrtBigUInt64BE (buf, value, offset, min, max) {
1826
+ checkIntBI(value, min, max, buf, offset, 7);
1827
+
1828
+ let lo = Number(value & BigInt(0xffffffff));
1829
+ buf[offset + 7] = lo;
1830
+ lo = lo >> 8;
1831
+ buf[offset + 6] = lo;
1832
+ lo = lo >> 8;
1833
+ buf[offset + 5] = lo;
1834
+ lo = lo >> 8;
1835
+ buf[offset + 4] = lo;
1836
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1837
+ buf[offset + 3] = hi;
1838
+ hi = hi >> 8;
1839
+ buf[offset + 2] = hi;
1840
+ hi = hi >> 8;
1841
+ buf[offset + 1] = hi;
1842
+ hi = hi >> 8;
1843
+ buf[offset] = hi;
1844
+ return offset + 8
1845
+ }
1846
+
1847
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
1848
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1849
+ });
1850
+
1851
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
1852
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1853
+ });
1854
+
1855
+ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1856
+ value = +value;
1857
+ offset = offset >>> 0;
1858
+ if (!noAssert) {
1859
+ const limit = Math.pow(2, (8 * byteLength) - 1);
1860
+
1861
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1862
+ }
1863
+
1864
+ let i = 0;
1865
+ let mul = 1;
1866
+ let sub = 0;
1867
+ this[offset] = value & 0xFF;
1868
+ while (++i < byteLength && (mul *= 0x100)) {
1869
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1870
+ sub = 1;
1871
+ }
1872
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1873
+ }
1874
+
1875
+ return offset + byteLength
1876
+ };
1877
+
1878
+ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1879
+ value = +value;
1880
+ offset = offset >>> 0;
1881
+ if (!noAssert) {
1882
+ const limit = Math.pow(2, (8 * byteLength) - 1);
1883
+
1884
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1885
+ }
1886
+
1887
+ let i = byteLength - 1;
1888
+ let mul = 1;
1889
+ let sub = 0;
1890
+ this[offset + i] = value & 0xFF;
1891
+ while (--i >= 0 && (mul *= 0x100)) {
1892
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1893
+ sub = 1;
1894
+ }
1895
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1896
+ }
1897
+
1898
+ return offset + byteLength
1899
+ };
1900
+
1901
+ Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1902
+ value = +value;
1903
+ offset = offset >>> 0;
1904
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
1905
+ if (value < 0) value = 0xff + value + 1;
1906
+ this[offset] = (value & 0xff);
1907
+ return offset + 1
1908
+ };
1909
+
1910
+ Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1911
+ value = +value;
1912
+ offset = offset >>> 0;
1913
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
1914
+ this[offset] = (value & 0xff);
1915
+ this[offset + 1] = (value >>> 8);
1916
+ return offset + 2
1917
+ };
1918
+
1919
+ Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1920
+ value = +value;
1921
+ offset = offset >>> 0;
1922
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
1923
+ this[offset] = (value >>> 8);
1924
+ this[offset + 1] = (value & 0xff);
1925
+ return offset + 2
1926
+ };
1927
+
1928
+ Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1929
+ value = +value;
1930
+ offset = offset >>> 0;
1931
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
1932
+ this[offset] = (value & 0xff);
1933
+ this[offset + 1] = (value >>> 8);
1934
+ this[offset + 2] = (value >>> 16);
1935
+ this[offset + 3] = (value >>> 24);
1936
+ return offset + 4
1937
+ };
1938
+
1939
+ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1940
+ value = +value;
1941
+ offset = offset >>> 0;
1942
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
1943
+ if (value < 0) value = 0xffffffff + value + 1;
1944
+ this[offset] = (value >>> 24);
1945
+ this[offset + 1] = (value >>> 16);
1946
+ this[offset + 2] = (value >>> 8);
1947
+ this[offset + 3] = (value & 0xff);
1948
+ return offset + 4
1949
+ };
1950
+
1951
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
1952
+ return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1953
+ });
1954
+
1955
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
1956
+ return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1957
+ });
1958
+
1959
+ function checkIEEE754 (buf, value, offset, ext, max, min) {
1960
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
1961
+ if (offset < 0) throw new RangeError('Index out of range')
1962
+ }
1963
+
1964
+ function writeFloat (buf, value, offset, littleEndian, noAssert) {
1965
+ value = +value;
1966
+ offset = offset >>> 0;
1967
+ if (!noAssert) {
1968
+ checkIEEE754(buf, value, offset, 4);
1969
+ }
1970
+ ieee754.write(buf, value, offset, littleEndian, 23, 4);
1971
+ return offset + 4
1972
+ }
1973
+
1974
+ Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1975
+ return writeFloat(this, value, offset, true, noAssert)
1976
+ };
1977
+
1978
+ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1979
+ return writeFloat(this, value, offset, false, noAssert)
1980
+ };
1981
+
1982
+ function writeDouble (buf, value, offset, littleEndian, noAssert) {
1983
+ value = +value;
1984
+ offset = offset >>> 0;
1985
+ if (!noAssert) {
1986
+ checkIEEE754(buf, value, offset, 8);
1987
+ }
1988
+ ieee754.write(buf, value, offset, littleEndian, 52, 8);
1989
+ return offset + 8
1990
+ }
1991
+
1992
+ Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1993
+ return writeDouble(this, value, offset, true, noAssert)
1994
+ };
1995
+
1996
+ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1997
+ return writeDouble(this, value, offset, false, noAssert)
1998
+ };
1999
+
2000
+ // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
2001
+ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
2002
+ if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
2003
+ if (!start) start = 0;
2004
+ if (!end && end !== 0) end = this.length;
2005
+ if (targetStart >= target.length) targetStart = target.length;
2006
+ if (!targetStart) targetStart = 0;
2007
+ if (end > 0 && end < start) end = start;
2008
+
2009
+ // Copy 0 bytes; we're done
2010
+ if (end === start) return 0
2011
+ if (target.length === 0 || this.length === 0) return 0
2012
+
2013
+ // Fatal error conditions
2014
+ if (targetStart < 0) {
2015
+ throw new RangeError('targetStart out of bounds')
2016
+ }
2017
+ if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
2018
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
2019
+
2020
+ // Are we oob?
2021
+ if (end > this.length) end = this.length;
2022
+ if (target.length - targetStart < end - start) {
2023
+ end = target.length - targetStart + start;
2024
+ }
2025
+
2026
+ const len = end - start;
2027
+
2028
+ if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
2029
+ // Use built-in when available, missing from IE11
2030
+ this.copyWithin(targetStart, start, end);
2031
+ } else {
2032
+ Uint8Array.prototype.set.call(
2033
+ target,
2034
+ this.subarray(start, end),
2035
+ targetStart
2036
+ );
2037
+ }
2038
+
2039
+ return len
2040
+ };
2041
+
2042
+ // Usage:
2043
+ // buffer.fill(number[, offset[, end]])
2044
+ // buffer.fill(buffer[, offset[, end]])
2045
+ // buffer.fill(string[, offset[, end]][, encoding])
2046
+ Buffer.prototype.fill = function fill (val, start, end, encoding) {
2047
+ // Handle string cases:
2048
+ if (typeof val === 'string') {
2049
+ if (typeof start === 'string') {
2050
+ encoding = start;
2051
+ start = 0;
2052
+ end = this.length;
2053
+ } else if (typeof end === 'string') {
2054
+ encoding = end;
2055
+ end = this.length;
2056
+ }
2057
+ if (encoding !== undefined && typeof encoding !== 'string') {
2058
+ throw new TypeError('encoding must be a string')
2059
+ }
2060
+ if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
2061
+ throw new TypeError('Unknown encoding: ' + encoding)
2062
+ }
2063
+ if (val.length === 1) {
2064
+ const code = val.charCodeAt(0);
2065
+ if ((encoding === 'utf8' && code < 128) ||
2066
+ encoding === 'latin1') {
2067
+ // Fast path: If `val` fits into a single byte, use that numeric value.
2068
+ val = code;
2069
+ }
2070
+ }
2071
+ } else if (typeof val === 'number') {
2072
+ val = val & 255;
2073
+ } else if (typeof val === 'boolean') {
2074
+ val = Number(val);
2075
+ }
2076
+
2077
+ // Invalid ranges are not set to a default, so can range check early.
2078
+ if (start < 0 || this.length < start || this.length < end) {
2079
+ throw new RangeError('Out of range index')
2080
+ }
2081
+
2082
+ if (end <= start) {
2083
+ return this
2084
+ }
2085
+
2086
+ start = start >>> 0;
2087
+ end = end === undefined ? this.length : end >>> 0;
2088
+
2089
+ if (!val) val = 0;
2090
+
2091
+ let i;
2092
+ if (typeof val === 'number') {
2093
+ for (i = start; i < end; ++i) {
2094
+ this[i] = val;
2095
+ }
2096
+ } else {
2097
+ const bytes = Buffer.isBuffer(val)
2098
+ ? val
2099
+ : Buffer.from(val, encoding);
2100
+ const len = bytes.length;
2101
+ if (len === 0) {
2102
+ throw new TypeError('The value "' + val +
2103
+ '" is invalid for argument "value"')
2104
+ }
2105
+ for (i = 0; i < end - start; ++i) {
2106
+ this[i + start] = bytes[i % len];
2107
+ }
2108
+ }
2109
+
2110
+ return this
2111
+ };
2112
+
2113
+ // CUSTOM ERRORS
2114
+ // =============
2115
+
2116
+ // Simplified versions from Node, changed for Buffer-only usage
2117
+ const errors = {};
2118
+ function E (sym, getMessage, Base) {
2119
+ errors[sym] = class NodeError extends Base {
2120
+ constructor () {
2121
+ super();
2122
+
2123
+ Object.defineProperty(this, 'message', {
2124
+ value: getMessage.apply(this, arguments),
2125
+ writable: true,
2126
+ configurable: true
2127
+ });
2128
+
2129
+ // Add the error code to the name to include it in the stack trace.
2130
+ this.name = `${this.name} [${sym}]`;
2131
+ // Access the stack to generate the error message including the error code
2132
+ // from the name.
2133
+ this.stack; // eslint-disable-line no-unused-expressions
2134
+ // Reset the name to the actual name.
2135
+ delete this.name;
2136
+ }
2137
+
2138
+ get code () {
2139
+ return sym
2140
+ }
2141
+
2142
+ set code (value) {
2143
+ Object.defineProperty(this, 'code', {
2144
+ configurable: true,
2145
+ enumerable: true,
2146
+ value,
2147
+ writable: true
2148
+ });
2149
+ }
2150
+
2151
+ toString () {
2152
+ return `${this.name} [${sym}]: ${this.message}`
2153
+ }
2154
+ };
2155
+ }
2156
+
2157
+ E('ERR_BUFFER_OUT_OF_BOUNDS',
2158
+ function (name) {
2159
+ if (name) {
2160
+ return `${name} is outside of buffer bounds`
2161
+ }
2162
+
2163
+ return 'Attempt to access memory outside buffer bounds'
2164
+ }, RangeError);
2165
+ E('ERR_INVALID_ARG_TYPE',
2166
+ function (name, actual) {
2167
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`
2168
+ }, TypeError);
2169
+ E('ERR_OUT_OF_RANGE',
2170
+ function (str, range, input) {
2171
+ let msg = `The value of "${str}" is out of range.`;
2172
+ let received = input;
2173
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
2174
+ received = addNumericalSeparator(String(input));
2175
+ } else if (typeof input === 'bigint') {
2176
+ received = String(input);
2177
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
2178
+ received = addNumericalSeparator(received);
2179
+ }
2180
+ received += 'n';
2181
+ }
2182
+ msg += ` It must be ${range}. Received ${received}`;
2183
+ return msg
2184
+ }, RangeError);
2185
+
2186
+ function addNumericalSeparator (val) {
2187
+ let res = '';
2188
+ let i = val.length;
2189
+ const start = val[0] === '-' ? 1 : 0;
2190
+ for (; i >= start + 4; i -= 3) {
2191
+ res = `_${val.slice(i - 3, i)}${res}`;
2192
+ }
2193
+ return `${val.slice(0, i)}${res}`
2194
+ }
2195
+
2196
+ // CHECK FUNCTIONS
2197
+ // ===============
2198
+
2199
+ function checkBounds (buf, offset, byteLength) {
2200
+ validateNumber(offset, 'offset');
2201
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
2202
+ boundsError(offset, buf.length - (byteLength + 1));
2203
+ }
2204
+ }
2205
+
2206
+ function checkIntBI (value, min, max, buf, offset, byteLength) {
2207
+ if (value > max || value < min) {
2208
+ const n = typeof min === 'bigint' ? 'n' : '';
2209
+ let range;
2210
+ {
2211
+ if (min === 0 || min === BigInt(0)) {
2212
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
2213
+ } else {
2214
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
2215
+ `${(byteLength + 1) * 8 - 1}${n}`;
2216
+ }
2217
+ }
2218
+ throw new errors.ERR_OUT_OF_RANGE('value', range, value)
2219
+ }
2220
+ checkBounds(buf, offset, byteLength);
2221
+ }
2222
+
2223
+ function validateNumber (value, name) {
2224
+ if (typeof value !== 'number') {
2225
+ throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
2226
+ }
2227
+ }
2228
+
2229
+ function boundsError (value, length, type) {
2230
+ if (Math.floor(value) !== value) {
2231
+ validateNumber(value, type);
2232
+ throw new errors.ERR_OUT_OF_RANGE('offset', 'an integer', value)
2233
+ }
2234
+
2235
+ if (length < 0) {
2236
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
2237
+ }
2238
+
2239
+ throw new errors.ERR_OUT_OF_RANGE('offset',
2240
+ `>= ${0} and <= ${length}`,
2241
+ value)
2242
+ }
2243
+
2244
+ // HELPER FUNCTIONS
2245
+ // ================
2246
+
2247
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
2248
+
2249
+ function base64clean (str) {
2250
+ // Node takes equal signs as end of the Base64 encoding
2251
+ str = str.split('=')[0];
2252
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
2253
+ str = str.trim().replace(INVALID_BASE64_RE, '');
2254
+ // Node converts strings with length < 2 to ''
2255
+ if (str.length < 2) return ''
2256
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
2257
+ while (str.length % 4 !== 0) {
2258
+ str = str + '=';
2259
+ }
2260
+ return str
2261
+ }
2262
+
2263
+ function utf8ToBytes (string, units) {
2264
+ units = units || Infinity;
2265
+ let codePoint;
2266
+ const length = string.length;
2267
+ let leadSurrogate = null;
2268
+ const bytes = [];
2269
+
2270
+ for (let i = 0; i < length; ++i) {
2271
+ codePoint = string.charCodeAt(i);
2272
+
2273
+ // is surrogate component
2274
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
2275
+ // last char was a lead
2276
+ if (!leadSurrogate) {
2277
+ // no lead yet
2278
+ if (codePoint > 0xDBFF) {
2279
+ // unexpected trail
2280
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2281
+ continue
2282
+ } else if (i + 1 === length) {
2283
+ // unpaired lead
2284
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2285
+ continue
2286
+ }
2287
+
2288
+ // valid lead
2289
+ leadSurrogate = codePoint;
2290
+
2291
+ continue
2292
+ }
2293
+
2294
+ // 2 leads in a row
2295
+ if (codePoint < 0xDC00) {
2296
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2297
+ leadSurrogate = codePoint;
2298
+ continue
2299
+ }
2300
+
2301
+ // valid surrogate pair
2302
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
2303
+ } else if (leadSurrogate) {
2304
+ // valid bmp char, but last char was a lead
2305
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2306
+ }
2307
+
2308
+ leadSurrogate = null;
2309
+
2310
+ // encode utf8
2311
+ if (codePoint < 0x80) {
2312
+ if ((units -= 1) < 0) break
2313
+ bytes.push(codePoint);
2314
+ } else if (codePoint < 0x800) {
2315
+ if ((units -= 2) < 0) break
2316
+ bytes.push(
2317
+ codePoint >> 0x6 | 0xC0,
2318
+ codePoint & 0x3F | 0x80
2319
+ );
2320
+ } else if (codePoint < 0x10000) {
2321
+ if ((units -= 3) < 0) break
2322
+ bytes.push(
2323
+ codePoint >> 0xC | 0xE0,
2324
+ codePoint >> 0x6 & 0x3F | 0x80,
2325
+ codePoint & 0x3F | 0x80
2326
+ );
2327
+ } else if (codePoint < 0x110000) {
2328
+ if ((units -= 4) < 0) break
2329
+ bytes.push(
2330
+ codePoint >> 0x12 | 0xF0,
2331
+ codePoint >> 0xC & 0x3F | 0x80,
2332
+ codePoint >> 0x6 & 0x3F | 0x80,
2333
+ codePoint & 0x3F | 0x80
2334
+ );
2335
+ } else {
2336
+ throw new Error('Invalid code point')
2337
+ }
2338
+ }
2339
+
2340
+ return bytes
2341
+ }
2342
+
2343
+ function asciiToBytes (str) {
2344
+ const byteArray = [];
2345
+ for (let i = 0; i < str.length; ++i) {
2346
+ // Node's code seems to be doing this and not & 0x7F..
2347
+ byteArray.push(str.charCodeAt(i) & 0xFF);
2348
+ }
2349
+ return byteArray
2350
+ }
2351
+
2352
+ function utf16leToBytes (str, units) {
2353
+ let c, hi, lo;
2354
+ const byteArray = [];
2355
+ for (let i = 0; i < str.length; ++i) {
2356
+ if ((units -= 2) < 0) break
2357
+
2358
+ c = str.charCodeAt(i);
2359
+ hi = c >> 8;
2360
+ lo = c % 256;
2361
+ byteArray.push(lo);
2362
+ byteArray.push(hi);
2363
+ }
2364
+
2365
+ return byteArray
2366
+ }
2367
+
2368
+ function base64ToBytes (str) {
2369
+ return base64.toByteArray(base64clean(str))
2370
+ }
2371
+
2372
+ function blitBuffer (src, dst, offset, length) {
2373
+ let i;
2374
+ for (i = 0; i < length; ++i) {
2375
+ if ((i + offset >= dst.length) || (i >= src.length)) break
2376
+ dst[i + offset] = src[i];
2377
+ }
2378
+ return i
2379
+ }
2380
+
2381
+ // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
2382
+ // the `instanceof` check but they should be treated as of that type.
2383
+ // See: https://github.com/feross/buffer/issues/166
2384
+ function isInstance (obj, type) {
2385
+ return obj instanceof type ||
2386
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
2387
+ obj.constructor.name === type.name)
2388
+ }
2389
+ function numberIsNaN (obj) {
2390
+ // For IE11 support
2391
+ return obj !== obj // eslint-disable-line no-self-compare
2392
+ }
2393
+
2394
+ // Create lookup table for `toString('hex')`
2395
+ // See: https://github.com/feross/buffer/issues/219
2396
+ const hexSliceLookupTable = (function () {
2397
+ const alphabet = '0123456789abcdef';
2398
+ const table = new Array(256);
2399
+ for (let i = 0; i < 16; ++i) {
2400
+ const i16 = i * 16;
2401
+ for (let j = 0; j < 16; ++j) {
2402
+ table[i16 + j] = alphabet[i] + alphabet[j];
2403
+ }
2404
+ }
2405
+ return table
2406
+ })();
2407
+
2408
+ // Return not function with Error if BigInt not supported
2409
+ function defineBigIntMethod (fn) {
2410
+ return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
2411
+ }
2412
+
2413
+ function BufferBigIntNotDefined () {
2414
+ throw new Error('BigInt not supported')
2415
+ }
2416
+ } (bufferPolyfill));
2417
+ return bufferPolyfill;
2418
+ }
2419
+
2420
+ var browser$1 = { exports: {} };
2421
+ var process = browser$1.exports = {};
54
2422
  var cachedSetTimeout;
55
2423
  var cachedClearTimeout;
56
2424
  function defaultSetTimout() {
@@ -180,17 +2548,17 @@ process.env = {};
180
2548
  process.argv = [];
181
2549
  process.version = "";
182
2550
  process.versions = {};
183
- function noop() {
2551
+ function noop$1() {
184
2552
  }
185
- process.on = noop;
186
- process.addListener = noop;
187
- process.once = noop;
188
- process.off = noop;
189
- process.removeListener = noop;
190
- process.removeAllListeners = noop;
191
- process.emit = noop;
192
- process.prependListener = noop;
193
- process.prependOnceListener = noop;
2553
+ process.on = noop$1;
2554
+ process.addListener = noop$1;
2555
+ process.once = noop$1;
2556
+ process.off = noop$1;
2557
+ process.removeListener = noop$1;
2558
+ process.removeAllListeners = noop$1;
2559
+ process.emit = noop$1;
2560
+ process.prependListener = noop$1;
2561
+ process.prependOnceListener = noop$1;
194
2562
  process.listeners = function(name) {
195
2563
  return [];
196
2564
  };
@@ -206,8 +2574,145 @@ process.chdir = function(dir) {
206
2574
  process.umask = function() {
207
2575
  return 0;
208
2576
  };
209
- var browserExports = browser.exports;
210
- const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
2577
+ function noop() {
2578
+ }
2579
+ var browser = (
2580
+ /** @type {boolean} */
2581
+ browser$1.exports.browser
2582
+ );
2583
+ var emitWarning = noop;
2584
+ var binding = (
2585
+ /** @type {Function} */
2586
+ browser$1.exports.binding
2587
+ );
2588
+ var exit = noop;
2589
+ var pid = 1;
2590
+ var features = {};
2591
+ var kill = noop;
2592
+ var dlopen = noop;
2593
+ var uptime = noop;
2594
+ var memoryUsage = noop;
2595
+ var uvCounters = noop;
2596
+ var platform = "browser";
2597
+ var arch = "browser";
2598
+ var execPath = "browser";
2599
+ var execArgv = (
2600
+ /** @type {string[]} */
2601
+ []
2602
+ );
2603
+ var api = {
2604
+ nextTick: browser$1.exports.nextTick,
2605
+ title: browser$1.exports.title,
2606
+ browser,
2607
+ env: browser$1.exports.env,
2608
+ argv: browser$1.exports.argv,
2609
+ version: browser$1.exports.version,
2610
+ versions: browser$1.exports.versions,
2611
+ on: browser$1.exports.on,
2612
+ addListener: browser$1.exports.addListener,
2613
+ once: browser$1.exports.once,
2614
+ off: browser$1.exports.off,
2615
+ removeListener: browser$1.exports.removeListener,
2616
+ removeAllListeners: browser$1.exports.removeAllListeners,
2617
+ emit: browser$1.exports.emit,
2618
+ emitWarning,
2619
+ prependListener: browser$1.exports.prependListener,
2620
+ prependOnceListener: browser$1.exports.prependOnceListener,
2621
+ listeners: browser$1.exports.listeners,
2622
+ binding,
2623
+ cwd: browser$1.exports.cwd,
2624
+ chdir: browser$1.exports.chdir,
2625
+ umask: browser$1.exports.umask,
2626
+ exit,
2627
+ pid,
2628
+ features,
2629
+ kill,
2630
+ dlopen,
2631
+ uptime,
2632
+ memoryUsage,
2633
+ uvCounters,
2634
+ platform,
2635
+ arch,
2636
+ execPath,
2637
+ execArgv
2638
+ };
2639
+ var addListener = browser$1.exports.addListener;
2640
+ var argv = browser$1.exports.argv;
2641
+ var chdir = browser$1.exports.chdir;
2642
+ var cwd = browser$1.exports.cwd;
2643
+ var emit = browser$1.exports.emit;
2644
+ var env = browser$1.exports.env;
2645
+ var listeners = browser$1.exports.listeners;
2646
+ var nextTick = browser$1.exports.nextTick;
2647
+ var off = browser$1.exports.off;
2648
+ var on = browser$1.exports.on;
2649
+ var once = browser$1.exports.once;
2650
+ var prependListener = browser$1.exports.prependListener;
2651
+ var prependOnceListener = browser$1.exports.prependOnceListener;
2652
+ var removeAllListeners = browser$1.exports.removeAllListeners;
2653
+ var removeListener = browser$1.exports.removeListener;
2654
+ var title = browser$1.exports.title;
2655
+ var umask = browser$1.exports.umask;
2656
+ var version = browser$1.exports.version;
2657
+ var versions = browser$1.exports.versions;
2658
+
2659
+ const process$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2660
+ __proto__: null,
2661
+ addListener,
2662
+ arch,
2663
+ argv,
2664
+ binding,
2665
+ browser,
2666
+ chdir,
2667
+ cwd,
2668
+ default: api,
2669
+ dlopen,
2670
+ emit,
2671
+ emitWarning,
2672
+ env,
2673
+ execArgv,
2674
+ execPath,
2675
+ exit,
2676
+ features,
2677
+ kill,
2678
+ listeners,
2679
+ memoryUsage,
2680
+ nextTick,
2681
+ off,
2682
+ on,
2683
+ once,
2684
+ pid,
2685
+ platform,
2686
+ prependListener,
2687
+ prependOnceListener,
2688
+ removeAllListeners,
2689
+ removeListener,
2690
+ title,
2691
+ umask,
2692
+ uptime,
2693
+ uvCounters,
2694
+ version,
2695
+ versions
2696
+ }, Symbol.toStringTag, { value: 'Module' }));
2697
+
2698
+ const require$$1 = /*@__PURE__*/getAugmentedNamespace(process$1);
2699
+
2700
+ var hasRequiredDist$1;
2701
+
2702
+ function requireDist$1 () {
2703
+ if (hasRequiredDist$1) return dist$1;
2704
+ hasRequiredDist$1 = 1;
2705
+ (function (exports) {
2706
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2707
+ const t = requireBufferPolyfill(), r = require$$1, o = (e) => e && e.__esModule ? e : { default: e }, l = o(r), u = globalThis || void 0 || self;
2708
+ Object.defineProperty(exports, "Buffer", { enumerable: true, get: () => t.Buffer });
2709
+ Object.defineProperty(exports, "process", { enumerable: true, get: () => l.default });
2710
+ exports.global = u;
2711
+ } (dist$1));
2712
+ return dist$1;
2713
+ }
2714
+
2715
+ var distExports = requireDist$1();
211
2716
 
212
2717
  var react_production = {};
213
2718
 
@@ -514,10 +3019,10 @@ function requireReact_production () {
514
3019
  });
515
3020
  if (!window.dispatchEvent(event)) return;
516
3021
  } else if (
517
- "object" === typeof process$1 &&
518
- "function" === typeof process$1.emit
3022
+ "object" === typeof distExports.process &&
3023
+ "function" === typeof distExports.process.emit
519
3024
  ) {
520
- process$1.emit("uncaughtException", error);
3025
+ distExports.process.emit("uncaughtException", error);
521
3026
  return;
522
3027
  }
523
3028
  console.error(error);
@@ -766,7 +3271,7 @@ function requireReact () {
766
3271
  }
767
3272
 
768
3273
  var reactExports = requireReact();
769
- const React = /*@__PURE__*/getDefaultExportFromCjs$1(reactExports);
3274
+ const React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
770
3275
 
771
3276
  const React$1 = /*#__PURE__*/_mergeNamespaces({
772
3277
  __proto__: null,
@@ -1017,7 +3522,7 @@ function requireReactDom () {
1017
3522
  }
1018
3523
 
1019
3524
  var reactDomExports = requireReactDom();
1020
- const ReactDOM = /*@__PURE__*/getDefaultExportFromCjs$1(reactDomExports);
3525
+ const ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports);
1021
3526
 
1022
3527
  var dist = {};
1023
3528
 
@@ -3378,5 +5883,5 @@ function useViewTransitionState(to, opts = {}) {
3378
5883
  304
3379
5884
  ]);
3380
5885
 
3381
- export { BrowserRouter as B, Link as L, NavLink as N, React$1 as R, requireReactDom as a, reactExports as b, reactDomExports as c, ReactDOM as d, React as e, useLocation as f, getDefaultExportFromCjs$1 as g, useParams as h, useSearchParams as i, Routes as j, Route as k, getAugmentedNamespace as l, process$1 as p, requireReact as r, useNavigate as u };
3382
- //# sourceMappingURL=vendor-DS2z8upE.js.map
5886
+ export { BrowserRouter as B, Link as L, NavLink as N, React$1 as R, requireReactDom as a, reactExports as b, reactDomExports as c, distExports as d, ReactDOM as e, React as f, getDefaultExportFromCjs as g, requireBufferPolyfill as h, requireBase64Js as i, useLocation as j, useParams as k, useSearchParams as l, Routes as m, Route as n, getAugmentedNamespace as o, requireReact as r, useNavigate as u };
5887
+ //# sourceMappingURL=vendor-Dp9Dttv5.js.map