@nmshd/runtime 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib-web/nmshd.runtime.js
CHANGED
|
@@ -331,11 +331,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
331
331
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
332
332
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
333
333
|
exports.buildInformation = {
|
|
334
|
-
version: "1.0.
|
|
335
|
-
build: "
|
|
336
|
-
date: "2021-11-
|
|
337
|
-
commit: "
|
|
338
|
-
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.5","@nmshd/content":"1.0.4","@nmshd/crypto":"1.0.4","@nmshd/transport":"1.0
|
|
334
|
+
version: "1.0.8",
|
|
335
|
+
build: "12",
|
|
336
|
+
date: "2021-11-24T08:32:50+00:00",
|
|
337
|
+
commit: "386da401efb261b7825cd45d2ba5fc74ded89b43",
|
|
338
|
+
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.5","@nmshd/content":"1.0.4","@nmshd/crypto":"1.0.4","@nmshd/transport":"1.1.0","ajv":"^8.8.2","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","luxon":"^2.1.1","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
339
339
|
libraries: {
|
|
340
340
|
serval: ts_serval_1.buildInformation,
|
|
341
341
|
consumption: consumption_1.buildInformation,
|
|
@@ -17522,14 +17522,14 @@ const def = {
|
|
|
17522
17522
|
if (max === undefined && min === 1) {
|
|
17523
17523
|
validateItems(valid, () => gen.if(valid, () => gen.break()));
|
|
17524
17524
|
}
|
|
17525
|
+
else if (min === 0) {
|
|
17526
|
+
gen.let(valid, true);
|
|
17527
|
+
if (max !== undefined)
|
|
17528
|
+
gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount);
|
|
17529
|
+
}
|
|
17525
17530
|
else {
|
|
17526
17531
|
gen.let(valid, false);
|
|
17527
|
-
|
|
17528
|
-
gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount, () => gen.assign(valid, true));
|
|
17529
|
-
}
|
|
17530
|
-
else {
|
|
17531
|
-
validateItemsWithCount();
|
|
17532
|
-
}
|
|
17532
|
+
validateItemsWithCount();
|
|
17533
17533
|
}
|
|
17534
17534
|
cxt.result(valid, () => cxt.reset());
|
|
17535
17535
|
function validateItemsWithCount() {
|
|
@@ -18322,9 +18322,10 @@ const newRegExp = (0, codegen_1._) `new RegExp`;
|
|
|
18322
18322
|
function usePattern({ gen, it: { opts } }, pattern) {
|
|
18323
18323
|
const u = opts.unicodeRegExp ? "u" : "";
|
|
18324
18324
|
const { regExp } = opts.code;
|
|
18325
|
+
const rx = regExp(pattern, u);
|
|
18325
18326
|
return gen.scopeValue("pattern", {
|
|
18326
|
-
key:
|
|
18327
|
-
ref:
|
|
18327
|
+
key: rx.toString(),
|
|
18328
|
+
ref: rx,
|
|
18328
18329
|
code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`,
|
|
18329
18330
|
});
|
|
18330
18331
|
}
|
|
@@ -19364,1995 +19365,6 @@ const def = {
|
|
|
19364
19365
|
exports["default"] = def;
|
|
19365
19366
|
//# sourceMappingURL=uniqueItems.js.map
|
|
19366
19367
|
|
|
19367
|
-
/***/ }),
|
|
19368
|
-
|
|
19369
|
-
/***/ "./node_modules/base64-js/index.js":
|
|
19370
|
-
/*!*****************************************!*\
|
|
19371
|
-
!*** ./node_modules/base64-js/index.js ***!
|
|
19372
|
-
\*****************************************/
|
|
19373
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
19374
|
-
|
|
19375
|
-
"use strict";
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
exports.byteLength = byteLength
|
|
19379
|
-
exports.toByteArray = toByteArray
|
|
19380
|
-
exports.fromByteArray = fromByteArray
|
|
19381
|
-
|
|
19382
|
-
var lookup = []
|
|
19383
|
-
var revLookup = []
|
|
19384
|
-
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
|
19385
|
-
|
|
19386
|
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
|
19387
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
19388
|
-
lookup[i] = code[i]
|
|
19389
|
-
revLookup[code.charCodeAt(i)] = i
|
|
19390
|
-
}
|
|
19391
|
-
|
|
19392
|
-
// Support decoding URL-safe base64 strings, as Node.js does.
|
|
19393
|
-
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
19394
|
-
revLookup['-'.charCodeAt(0)] = 62
|
|
19395
|
-
revLookup['_'.charCodeAt(0)] = 63
|
|
19396
|
-
|
|
19397
|
-
function getLens (b64) {
|
|
19398
|
-
var len = b64.length
|
|
19399
|
-
|
|
19400
|
-
if (len % 4 > 0) {
|
|
19401
|
-
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
19402
|
-
}
|
|
19403
|
-
|
|
19404
|
-
// Trim off extra bytes after placeholder bytes are found
|
|
19405
|
-
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
19406
|
-
var validLen = b64.indexOf('=')
|
|
19407
|
-
if (validLen === -1) validLen = len
|
|
19408
|
-
|
|
19409
|
-
var placeHoldersLen = validLen === len
|
|
19410
|
-
? 0
|
|
19411
|
-
: 4 - (validLen % 4)
|
|
19412
|
-
|
|
19413
|
-
return [validLen, placeHoldersLen]
|
|
19414
|
-
}
|
|
19415
|
-
|
|
19416
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
19417
|
-
function byteLength (b64) {
|
|
19418
|
-
var lens = getLens(b64)
|
|
19419
|
-
var validLen = lens[0]
|
|
19420
|
-
var placeHoldersLen = lens[1]
|
|
19421
|
-
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
19422
|
-
}
|
|
19423
|
-
|
|
19424
|
-
function _byteLength (b64, validLen, placeHoldersLen) {
|
|
19425
|
-
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
19426
|
-
}
|
|
19427
|
-
|
|
19428
|
-
function toByteArray (b64) {
|
|
19429
|
-
var tmp
|
|
19430
|
-
var lens = getLens(b64)
|
|
19431
|
-
var validLen = lens[0]
|
|
19432
|
-
var placeHoldersLen = lens[1]
|
|
19433
|
-
|
|
19434
|
-
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
|
19435
|
-
|
|
19436
|
-
var curByte = 0
|
|
19437
|
-
|
|
19438
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
19439
|
-
var len = placeHoldersLen > 0
|
|
19440
|
-
? validLen - 4
|
|
19441
|
-
: validLen
|
|
19442
|
-
|
|
19443
|
-
var i
|
|
19444
|
-
for (i = 0; i < len; i += 4) {
|
|
19445
|
-
tmp =
|
|
19446
|
-
(revLookup[b64.charCodeAt(i)] << 18) |
|
|
19447
|
-
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
|
19448
|
-
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
|
19449
|
-
revLookup[b64.charCodeAt(i + 3)]
|
|
19450
|
-
arr[curByte++] = (tmp >> 16) & 0xFF
|
|
19451
|
-
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
19452
|
-
arr[curByte++] = tmp & 0xFF
|
|
19453
|
-
}
|
|
19454
|
-
|
|
19455
|
-
if (placeHoldersLen === 2) {
|
|
19456
|
-
tmp =
|
|
19457
|
-
(revLookup[b64.charCodeAt(i)] << 2) |
|
|
19458
|
-
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
|
19459
|
-
arr[curByte++] = tmp & 0xFF
|
|
19460
|
-
}
|
|
19461
|
-
|
|
19462
|
-
if (placeHoldersLen === 1) {
|
|
19463
|
-
tmp =
|
|
19464
|
-
(revLookup[b64.charCodeAt(i)] << 10) |
|
|
19465
|
-
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
|
19466
|
-
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
|
19467
|
-
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
19468
|
-
arr[curByte++] = tmp & 0xFF
|
|
19469
|
-
}
|
|
19470
|
-
|
|
19471
|
-
return arr
|
|
19472
|
-
}
|
|
19473
|
-
|
|
19474
|
-
function tripletToBase64 (num) {
|
|
19475
|
-
return lookup[num >> 18 & 0x3F] +
|
|
19476
|
-
lookup[num >> 12 & 0x3F] +
|
|
19477
|
-
lookup[num >> 6 & 0x3F] +
|
|
19478
|
-
lookup[num & 0x3F]
|
|
19479
|
-
}
|
|
19480
|
-
|
|
19481
|
-
function encodeChunk (uint8, start, end) {
|
|
19482
|
-
var tmp
|
|
19483
|
-
var output = []
|
|
19484
|
-
for (var i = start; i < end; i += 3) {
|
|
19485
|
-
tmp =
|
|
19486
|
-
((uint8[i] << 16) & 0xFF0000) +
|
|
19487
|
-
((uint8[i + 1] << 8) & 0xFF00) +
|
|
19488
|
-
(uint8[i + 2] & 0xFF)
|
|
19489
|
-
output.push(tripletToBase64(tmp))
|
|
19490
|
-
}
|
|
19491
|
-
return output.join('')
|
|
19492
|
-
}
|
|
19493
|
-
|
|
19494
|
-
function fromByteArray (uint8) {
|
|
19495
|
-
var tmp
|
|
19496
|
-
var len = uint8.length
|
|
19497
|
-
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
|
19498
|
-
var parts = []
|
|
19499
|
-
var maxChunkLength = 16383 // must be multiple of 3
|
|
19500
|
-
|
|
19501
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
19502
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
19503
|
-
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
|
19504
|
-
}
|
|
19505
|
-
|
|
19506
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
19507
|
-
if (extraBytes === 1) {
|
|
19508
|
-
tmp = uint8[len - 1]
|
|
19509
|
-
parts.push(
|
|
19510
|
-
lookup[tmp >> 2] +
|
|
19511
|
-
lookup[(tmp << 4) & 0x3F] +
|
|
19512
|
-
'=='
|
|
19513
|
-
)
|
|
19514
|
-
} else if (extraBytes === 2) {
|
|
19515
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
|
19516
|
-
parts.push(
|
|
19517
|
-
lookup[tmp >> 10] +
|
|
19518
|
-
lookup[(tmp >> 4) & 0x3F] +
|
|
19519
|
-
lookup[(tmp << 2) & 0x3F] +
|
|
19520
|
-
'='
|
|
19521
|
-
)
|
|
19522
|
-
}
|
|
19523
|
-
|
|
19524
|
-
return parts.join('')
|
|
19525
|
-
}
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
/***/ }),
|
|
19529
|
-
|
|
19530
|
-
/***/ "./node_modules/buffer/index.js":
|
|
19531
|
-
/*!**************************************!*\
|
|
19532
|
-
!*** ./node_modules/buffer/index.js ***!
|
|
19533
|
-
\**************************************/
|
|
19534
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
19535
|
-
|
|
19536
|
-
"use strict";
|
|
19537
|
-
/*!
|
|
19538
|
-
* The buffer module from node.js, for the browser.
|
|
19539
|
-
*
|
|
19540
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
19541
|
-
* @license MIT
|
|
19542
|
-
*/
|
|
19543
|
-
/* eslint-disable no-proto */
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
|
|
19548
|
-
var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
|
|
19549
|
-
var customInspectSymbol =
|
|
19550
|
-
(typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
|
|
19551
|
-
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
19552
|
-
: null
|
|
19553
|
-
|
|
19554
|
-
exports.Buffer = Buffer
|
|
19555
|
-
exports.SlowBuffer = SlowBuffer
|
|
19556
|
-
exports.INSPECT_MAX_BYTES = 50
|
|
19557
|
-
|
|
19558
|
-
var K_MAX_LENGTH = 0x7fffffff
|
|
19559
|
-
exports.kMaxLength = K_MAX_LENGTH
|
|
19560
|
-
|
|
19561
|
-
/**
|
|
19562
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
19563
|
-
* === true Use Uint8Array implementation (fastest)
|
|
19564
|
-
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
|
19565
|
-
* implementation (most compatible, even IE6)
|
|
19566
|
-
*
|
|
19567
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
19568
|
-
* Opera 11.6+, iOS 4.2+.
|
|
19569
|
-
*
|
|
19570
|
-
* We report that the browser does not support typed arrays if the are not subclassable
|
|
19571
|
-
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
|
19572
|
-
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
19573
|
-
* for __proto__ and has a buggy typed array implementation.
|
|
19574
|
-
*/
|
|
19575
|
-
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
|
19576
|
-
|
|
19577
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
|
19578
|
-
typeof console.error === 'function') {
|
|
19579
|
-
console.error(
|
|
19580
|
-
'This browser lacks typed array (Uint8Array) support which is required by ' +
|
|
19581
|
-
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
|
19582
|
-
)
|
|
19583
|
-
}
|
|
19584
|
-
|
|
19585
|
-
function typedArraySupport () {
|
|
19586
|
-
// Can typed array instances can be augmented?
|
|
19587
|
-
try {
|
|
19588
|
-
var arr = new Uint8Array(1)
|
|
19589
|
-
var proto = { foo: function () { return 42 } }
|
|
19590
|
-
Object.setPrototypeOf(proto, Uint8Array.prototype)
|
|
19591
|
-
Object.setPrototypeOf(arr, proto)
|
|
19592
|
-
return arr.foo() === 42
|
|
19593
|
-
} catch (e) {
|
|
19594
|
-
return false
|
|
19595
|
-
}
|
|
19596
|
-
}
|
|
19597
|
-
|
|
19598
|
-
Object.defineProperty(Buffer.prototype, 'parent', {
|
|
19599
|
-
enumerable: true,
|
|
19600
|
-
get: function () {
|
|
19601
|
-
if (!Buffer.isBuffer(this)) return undefined
|
|
19602
|
-
return this.buffer
|
|
19603
|
-
}
|
|
19604
|
-
})
|
|
19605
|
-
|
|
19606
|
-
Object.defineProperty(Buffer.prototype, 'offset', {
|
|
19607
|
-
enumerable: true,
|
|
19608
|
-
get: function () {
|
|
19609
|
-
if (!Buffer.isBuffer(this)) return undefined
|
|
19610
|
-
return this.byteOffset
|
|
19611
|
-
}
|
|
19612
|
-
})
|
|
19613
|
-
|
|
19614
|
-
function createBuffer (length) {
|
|
19615
|
-
if (length > K_MAX_LENGTH) {
|
|
19616
|
-
throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
|
19617
|
-
}
|
|
19618
|
-
// Return an augmented `Uint8Array` instance
|
|
19619
|
-
var buf = new Uint8Array(length)
|
|
19620
|
-
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
19621
|
-
return buf
|
|
19622
|
-
}
|
|
19623
|
-
|
|
19624
|
-
/**
|
|
19625
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
19626
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
19627
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
19628
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
19629
|
-
* returns a single octet.
|
|
19630
|
-
*
|
|
19631
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
19632
|
-
*/
|
|
19633
|
-
|
|
19634
|
-
function Buffer (arg, encodingOrOffset, length) {
|
|
19635
|
-
// Common case.
|
|
19636
|
-
if (typeof arg === 'number') {
|
|
19637
|
-
if (typeof encodingOrOffset === 'string') {
|
|
19638
|
-
throw new TypeError(
|
|
19639
|
-
'The "string" argument must be of type string. Received type number'
|
|
19640
|
-
)
|
|
19641
|
-
}
|
|
19642
|
-
return allocUnsafe(arg)
|
|
19643
|
-
}
|
|
19644
|
-
return from(arg, encodingOrOffset, length)
|
|
19645
|
-
}
|
|
19646
|
-
|
|
19647
|
-
Buffer.poolSize = 8192 // not used by this implementation
|
|
19648
|
-
|
|
19649
|
-
function from (value, encodingOrOffset, length) {
|
|
19650
|
-
if (typeof value === 'string') {
|
|
19651
|
-
return fromString(value, encodingOrOffset)
|
|
19652
|
-
}
|
|
19653
|
-
|
|
19654
|
-
if (ArrayBuffer.isView(value)) {
|
|
19655
|
-
return fromArrayView(value)
|
|
19656
|
-
}
|
|
19657
|
-
|
|
19658
|
-
if (value == null) {
|
|
19659
|
-
throw new TypeError(
|
|
19660
|
-
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
|
19661
|
-
'or Array-like Object. Received type ' + (typeof value)
|
|
19662
|
-
)
|
|
19663
|
-
}
|
|
19664
|
-
|
|
19665
|
-
if (isInstance(value, ArrayBuffer) ||
|
|
19666
|
-
(value && isInstance(value.buffer, ArrayBuffer))) {
|
|
19667
|
-
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
19668
|
-
}
|
|
19669
|
-
|
|
19670
|
-
if (typeof SharedArrayBuffer !== 'undefined' &&
|
|
19671
|
-
(isInstance(value, SharedArrayBuffer) ||
|
|
19672
|
-
(value && isInstance(value.buffer, SharedArrayBuffer)))) {
|
|
19673
|
-
return fromArrayBuffer(value, encodingOrOffset, length)
|
|
19674
|
-
}
|
|
19675
|
-
|
|
19676
|
-
if (typeof value === 'number') {
|
|
19677
|
-
throw new TypeError(
|
|
19678
|
-
'The "value" argument must not be of type number. Received type number'
|
|
19679
|
-
)
|
|
19680
|
-
}
|
|
19681
|
-
|
|
19682
|
-
var valueOf = value.valueOf && value.valueOf()
|
|
19683
|
-
if (valueOf != null && valueOf !== value) {
|
|
19684
|
-
return Buffer.from(valueOf, encodingOrOffset, length)
|
|
19685
|
-
}
|
|
19686
|
-
|
|
19687
|
-
var b = fromObject(value)
|
|
19688
|
-
if (b) return b
|
|
19689
|
-
|
|
19690
|
-
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
|
19691
|
-
typeof value[Symbol.toPrimitive] === 'function') {
|
|
19692
|
-
return Buffer.from(
|
|
19693
|
-
value[Symbol.toPrimitive]('string'), encodingOrOffset, length
|
|
19694
|
-
)
|
|
19695
|
-
}
|
|
19696
|
-
|
|
19697
|
-
throw new TypeError(
|
|
19698
|
-
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
|
19699
|
-
'or Array-like Object. Received type ' + (typeof value)
|
|
19700
|
-
)
|
|
19701
|
-
}
|
|
19702
|
-
|
|
19703
|
-
/**
|
|
19704
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
19705
|
-
* if value is a number.
|
|
19706
|
-
* Buffer.from(str[, encoding])
|
|
19707
|
-
* Buffer.from(array)
|
|
19708
|
-
* Buffer.from(buffer)
|
|
19709
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
19710
|
-
**/
|
|
19711
|
-
Buffer.from = function (value, encodingOrOffset, length) {
|
|
19712
|
-
return from(value, encodingOrOffset, length)
|
|
19713
|
-
}
|
|
19714
|
-
|
|
19715
|
-
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
|
19716
|
-
// https://github.com/feross/buffer/pull/148
|
|
19717
|
-
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
|
|
19718
|
-
Object.setPrototypeOf(Buffer, Uint8Array)
|
|
19719
|
-
|
|
19720
|
-
function assertSize (size) {
|
|
19721
|
-
if (typeof size !== 'number') {
|
|
19722
|
-
throw new TypeError('"size" argument must be of type number')
|
|
19723
|
-
} else if (size < 0) {
|
|
19724
|
-
throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
|
19725
|
-
}
|
|
19726
|
-
}
|
|
19727
|
-
|
|
19728
|
-
function alloc (size, fill, encoding) {
|
|
19729
|
-
assertSize(size)
|
|
19730
|
-
if (size <= 0) {
|
|
19731
|
-
return createBuffer(size)
|
|
19732
|
-
}
|
|
19733
|
-
if (fill !== undefined) {
|
|
19734
|
-
// Only pay attention to encoding if it's a string. This
|
|
19735
|
-
// prevents accidentally sending in a number that would
|
|
19736
|
-
// be interpreted as a start offset.
|
|
19737
|
-
return typeof encoding === 'string'
|
|
19738
|
-
? createBuffer(size).fill(fill, encoding)
|
|
19739
|
-
: createBuffer(size).fill(fill)
|
|
19740
|
-
}
|
|
19741
|
-
return createBuffer(size)
|
|
19742
|
-
}
|
|
19743
|
-
|
|
19744
|
-
/**
|
|
19745
|
-
* Creates a new filled Buffer instance.
|
|
19746
|
-
* alloc(size[, fill[, encoding]])
|
|
19747
|
-
**/
|
|
19748
|
-
Buffer.alloc = function (size, fill, encoding) {
|
|
19749
|
-
return alloc(size, fill, encoding)
|
|
19750
|
-
}
|
|
19751
|
-
|
|
19752
|
-
function allocUnsafe (size) {
|
|
19753
|
-
assertSize(size)
|
|
19754
|
-
return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
|
19755
|
-
}
|
|
19756
|
-
|
|
19757
|
-
/**
|
|
19758
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
19759
|
-
* */
|
|
19760
|
-
Buffer.allocUnsafe = function (size) {
|
|
19761
|
-
return allocUnsafe(size)
|
|
19762
|
-
}
|
|
19763
|
-
/**
|
|
19764
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
19765
|
-
*/
|
|
19766
|
-
Buffer.allocUnsafeSlow = function (size) {
|
|
19767
|
-
return allocUnsafe(size)
|
|
19768
|
-
}
|
|
19769
|
-
|
|
19770
|
-
function fromString (string, encoding) {
|
|
19771
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
19772
|
-
encoding = 'utf8'
|
|
19773
|
-
}
|
|
19774
|
-
|
|
19775
|
-
if (!Buffer.isEncoding(encoding)) {
|
|
19776
|
-
throw new TypeError('Unknown encoding: ' + encoding)
|
|
19777
|
-
}
|
|
19778
|
-
|
|
19779
|
-
var length = byteLength(string, encoding) | 0
|
|
19780
|
-
var buf = createBuffer(length)
|
|
19781
|
-
|
|
19782
|
-
var actual = buf.write(string, encoding)
|
|
19783
|
-
|
|
19784
|
-
if (actual !== length) {
|
|
19785
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
19786
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
19787
|
-
// 'abxxcd' will be treated as 'ab')
|
|
19788
|
-
buf = buf.slice(0, actual)
|
|
19789
|
-
}
|
|
19790
|
-
|
|
19791
|
-
return buf
|
|
19792
|
-
}
|
|
19793
|
-
|
|
19794
|
-
function fromArrayLike (array) {
|
|
19795
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
19796
|
-
var buf = createBuffer(length)
|
|
19797
|
-
for (var i = 0; i < length; i += 1) {
|
|
19798
|
-
buf[i] = array[i] & 255
|
|
19799
|
-
}
|
|
19800
|
-
return buf
|
|
19801
|
-
}
|
|
19802
|
-
|
|
19803
|
-
function fromArrayView (arrayView) {
|
|
19804
|
-
if (isInstance(arrayView, Uint8Array)) {
|
|
19805
|
-
var copy = new Uint8Array(arrayView)
|
|
19806
|
-
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
|
|
19807
|
-
}
|
|
19808
|
-
return fromArrayLike(arrayView)
|
|
19809
|
-
}
|
|
19810
|
-
|
|
19811
|
-
function fromArrayBuffer (array, byteOffset, length) {
|
|
19812
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
19813
|
-
throw new RangeError('"offset" is outside of buffer bounds')
|
|
19814
|
-
}
|
|
19815
|
-
|
|
19816
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
19817
|
-
throw new RangeError('"length" is outside of buffer bounds')
|
|
19818
|
-
}
|
|
19819
|
-
|
|
19820
|
-
var buf
|
|
19821
|
-
if (byteOffset === undefined && length === undefined) {
|
|
19822
|
-
buf = new Uint8Array(array)
|
|
19823
|
-
} else if (length === undefined) {
|
|
19824
|
-
buf = new Uint8Array(array, byteOffset)
|
|
19825
|
-
} else {
|
|
19826
|
-
buf = new Uint8Array(array, byteOffset, length)
|
|
19827
|
-
}
|
|
19828
|
-
|
|
19829
|
-
// Return an augmented `Uint8Array` instance
|
|
19830
|
-
Object.setPrototypeOf(buf, Buffer.prototype)
|
|
19831
|
-
|
|
19832
|
-
return buf
|
|
19833
|
-
}
|
|
19834
|
-
|
|
19835
|
-
function fromObject (obj) {
|
|
19836
|
-
if (Buffer.isBuffer(obj)) {
|
|
19837
|
-
var len = checked(obj.length) | 0
|
|
19838
|
-
var buf = createBuffer(len)
|
|
19839
|
-
|
|
19840
|
-
if (buf.length === 0) {
|
|
19841
|
-
return buf
|
|
19842
|
-
}
|
|
19843
|
-
|
|
19844
|
-
obj.copy(buf, 0, 0, len)
|
|
19845
|
-
return buf
|
|
19846
|
-
}
|
|
19847
|
-
|
|
19848
|
-
if (obj.length !== undefined) {
|
|
19849
|
-
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
|
19850
|
-
return createBuffer(0)
|
|
19851
|
-
}
|
|
19852
|
-
return fromArrayLike(obj)
|
|
19853
|
-
}
|
|
19854
|
-
|
|
19855
|
-
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
|
19856
|
-
return fromArrayLike(obj.data)
|
|
19857
|
-
}
|
|
19858
|
-
}
|
|
19859
|
-
|
|
19860
|
-
function checked (length) {
|
|
19861
|
-
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
|
19862
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
19863
|
-
if (length >= K_MAX_LENGTH) {
|
|
19864
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
19865
|
-
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
|
19866
|
-
}
|
|
19867
|
-
return length | 0
|
|
19868
|
-
}
|
|
19869
|
-
|
|
19870
|
-
function SlowBuffer (length) {
|
|
19871
|
-
if (+length != length) { // eslint-disable-line eqeqeq
|
|
19872
|
-
length = 0
|
|
19873
|
-
}
|
|
19874
|
-
return Buffer.alloc(+length)
|
|
19875
|
-
}
|
|
19876
|
-
|
|
19877
|
-
Buffer.isBuffer = function isBuffer (b) {
|
|
19878
|
-
return b != null && b._isBuffer === true &&
|
|
19879
|
-
b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
|
|
19880
|
-
}
|
|
19881
|
-
|
|
19882
|
-
Buffer.compare = function compare (a, b) {
|
|
19883
|
-
if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
|
19884
|
-
if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
|
19885
|
-
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
19886
|
-
throw new TypeError(
|
|
19887
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
19888
|
-
)
|
|
19889
|
-
}
|
|
19890
|
-
|
|
19891
|
-
if (a === b) return 0
|
|
19892
|
-
|
|
19893
|
-
var x = a.length
|
|
19894
|
-
var y = b.length
|
|
19895
|
-
|
|
19896
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
19897
|
-
if (a[i] !== b[i]) {
|
|
19898
|
-
x = a[i]
|
|
19899
|
-
y = b[i]
|
|
19900
|
-
break
|
|
19901
|
-
}
|
|
19902
|
-
}
|
|
19903
|
-
|
|
19904
|
-
if (x < y) return -1
|
|
19905
|
-
if (y < x) return 1
|
|
19906
|
-
return 0
|
|
19907
|
-
}
|
|
19908
|
-
|
|
19909
|
-
Buffer.isEncoding = function isEncoding (encoding) {
|
|
19910
|
-
switch (String(encoding).toLowerCase()) {
|
|
19911
|
-
case 'hex':
|
|
19912
|
-
case 'utf8':
|
|
19913
|
-
case 'utf-8':
|
|
19914
|
-
case 'ascii':
|
|
19915
|
-
case 'latin1':
|
|
19916
|
-
case 'binary':
|
|
19917
|
-
case 'base64':
|
|
19918
|
-
case 'ucs2':
|
|
19919
|
-
case 'ucs-2':
|
|
19920
|
-
case 'utf16le':
|
|
19921
|
-
case 'utf-16le':
|
|
19922
|
-
return true
|
|
19923
|
-
default:
|
|
19924
|
-
return false
|
|
19925
|
-
}
|
|
19926
|
-
}
|
|
19927
|
-
|
|
19928
|
-
Buffer.concat = function concat (list, length) {
|
|
19929
|
-
if (!Array.isArray(list)) {
|
|
19930
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
19931
|
-
}
|
|
19932
|
-
|
|
19933
|
-
if (list.length === 0) {
|
|
19934
|
-
return Buffer.alloc(0)
|
|
19935
|
-
}
|
|
19936
|
-
|
|
19937
|
-
var i
|
|
19938
|
-
if (length === undefined) {
|
|
19939
|
-
length = 0
|
|
19940
|
-
for (i = 0; i < list.length; ++i) {
|
|
19941
|
-
length += list[i].length
|
|
19942
|
-
}
|
|
19943
|
-
}
|
|
19944
|
-
|
|
19945
|
-
var buffer = Buffer.allocUnsafe(length)
|
|
19946
|
-
var pos = 0
|
|
19947
|
-
for (i = 0; i < list.length; ++i) {
|
|
19948
|
-
var buf = list[i]
|
|
19949
|
-
if (isInstance(buf, Uint8Array)) {
|
|
19950
|
-
if (pos + buf.length > buffer.length) {
|
|
19951
|
-
Buffer.from(buf).copy(buffer, pos)
|
|
19952
|
-
} else {
|
|
19953
|
-
Uint8Array.prototype.set.call(
|
|
19954
|
-
buffer,
|
|
19955
|
-
buf,
|
|
19956
|
-
pos
|
|
19957
|
-
)
|
|
19958
|
-
}
|
|
19959
|
-
} else if (!Buffer.isBuffer(buf)) {
|
|
19960
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
19961
|
-
} else {
|
|
19962
|
-
buf.copy(buffer, pos)
|
|
19963
|
-
}
|
|
19964
|
-
pos += buf.length
|
|
19965
|
-
}
|
|
19966
|
-
return buffer
|
|
19967
|
-
}
|
|
19968
|
-
|
|
19969
|
-
function byteLength (string, encoding) {
|
|
19970
|
-
if (Buffer.isBuffer(string)) {
|
|
19971
|
-
return string.length
|
|
19972
|
-
}
|
|
19973
|
-
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
19974
|
-
return string.byteLength
|
|
19975
|
-
}
|
|
19976
|
-
if (typeof string !== 'string') {
|
|
19977
|
-
throw new TypeError(
|
|
19978
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
|
19979
|
-
'Received type ' + typeof string
|
|
19980
|
-
)
|
|
19981
|
-
}
|
|
19982
|
-
|
|
19983
|
-
var len = string.length
|
|
19984
|
-
var mustMatch = (arguments.length > 2 && arguments[2] === true)
|
|
19985
|
-
if (!mustMatch && len === 0) return 0
|
|
19986
|
-
|
|
19987
|
-
// Use a for loop to avoid recursion
|
|
19988
|
-
var loweredCase = false
|
|
19989
|
-
for (;;) {
|
|
19990
|
-
switch (encoding) {
|
|
19991
|
-
case 'ascii':
|
|
19992
|
-
case 'latin1':
|
|
19993
|
-
case 'binary':
|
|
19994
|
-
return len
|
|
19995
|
-
case 'utf8':
|
|
19996
|
-
case 'utf-8':
|
|
19997
|
-
return utf8ToBytes(string).length
|
|
19998
|
-
case 'ucs2':
|
|
19999
|
-
case 'ucs-2':
|
|
20000
|
-
case 'utf16le':
|
|
20001
|
-
case 'utf-16le':
|
|
20002
|
-
return len * 2
|
|
20003
|
-
case 'hex':
|
|
20004
|
-
return len >>> 1
|
|
20005
|
-
case 'base64':
|
|
20006
|
-
return base64ToBytes(string).length
|
|
20007
|
-
default:
|
|
20008
|
-
if (loweredCase) {
|
|
20009
|
-
return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
|
|
20010
|
-
}
|
|
20011
|
-
encoding = ('' + encoding).toLowerCase()
|
|
20012
|
-
loweredCase = true
|
|
20013
|
-
}
|
|
20014
|
-
}
|
|
20015
|
-
}
|
|
20016
|
-
Buffer.byteLength = byteLength
|
|
20017
|
-
|
|
20018
|
-
function slowToString (encoding, start, end) {
|
|
20019
|
-
var loweredCase = false
|
|
20020
|
-
|
|
20021
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
20022
|
-
// property of a typed array.
|
|
20023
|
-
|
|
20024
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
20025
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
20026
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
20027
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
20028
|
-
if (start === undefined || start < 0) {
|
|
20029
|
-
start = 0
|
|
20030
|
-
}
|
|
20031
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
20032
|
-
// coercion fail below.
|
|
20033
|
-
if (start > this.length) {
|
|
20034
|
-
return ''
|
|
20035
|
-
}
|
|
20036
|
-
|
|
20037
|
-
if (end === undefined || end > this.length) {
|
|
20038
|
-
end = this.length
|
|
20039
|
-
}
|
|
20040
|
-
|
|
20041
|
-
if (end <= 0) {
|
|
20042
|
-
return ''
|
|
20043
|
-
}
|
|
20044
|
-
|
|
20045
|
-
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
|
20046
|
-
end >>>= 0
|
|
20047
|
-
start >>>= 0
|
|
20048
|
-
|
|
20049
|
-
if (end <= start) {
|
|
20050
|
-
return ''
|
|
20051
|
-
}
|
|
20052
|
-
|
|
20053
|
-
if (!encoding) encoding = 'utf8'
|
|
20054
|
-
|
|
20055
|
-
while (true) {
|
|
20056
|
-
switch (encoding) {
|
|
20057
|
-
case 'hex':
|
|
20058
|
-
return hexSlice(this, start, end)
|
|
20059
|
-
|
|
20060
|
-
case 'utf8':
|
|
20061
|
-
case 'utf-8':
|
|
20062
|
-
return utf8Slice(this, start, end)
|
|
20063
|
-
|
|
20064
|
-
case 'ascii':
|
|
20065
|
-
return asciiSlice(this, start, end)
|
|
20066
|
-
|
|
20067
|
-
case 'latin1':
|
|
20068
|
-
case 'binary':
|
|
20069
|
-
return latin1Slice(this, start, end)
|
|
20070
|
-
|
|
20071
|
-
case 'base64':
|
|
20072
|
-
return base64Slice(this, start, end)
|
|
20073
|
-
|
|
20074
|
-
case 'ucs2':
|
|
20075
|
-
case 'ucs-2':
|
|
20076
|
-
case 'utf16le':
|
|
20077
|
-
case 'utf-16le':
|
|
20078
|
-
return utf16leSlice(this, start, end)
|
|
20079
|
-
|
|
20080
|
-
default:
|
|
20081
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
20082
|
-
encoding = (encoding + '').toLowerCase()
|
|
20083
|
-
loweredCase = true
|
|
20084
|
-
}
|
|
20085
|
-
}
|
|
20086
|
-
}
|
|
20087
|
-
|
|
20088
|
-
// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
|
|
20089
|
-
// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
|
|
20090
|
-
// reliably in a browserify context because there could be multiple different
|
|
20091
|
-
// copies of the 'buffer' package in use. This method works even for Buffer
|
|
20092
|
-
// instances that were created from another copy of the `buffer` package.
|
|
20093
|
-
// See: https://github.com/feross/buffer/issues/154
|
|
20094
|
-
Buffer.prototype._isBuffer = true
|
|
20095
|
-
|
|
20096
|
-
function swap (b, n, m) {
|
|
20097
|
-
var i = b[n]
|
|
20098
|
-
b[n] = b[m]
|
|
20099
|
-
b[m] = i
|
|
20100
|
-
}
|
|
20101
|
-
|
|
20102
|
-
Buffer.prototype.swap16 = function swap16 () {
|
|
20103
|
-
var len = this.length
|
|
20104
|
-
if (len % 2 !== 0) {
|
|
20105
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
20106
|
-
}
|
|
20107
|
-
for (var i = 0; i < len; i += 2) {
|
|
20108
|
-
swap(this, i, i + 1)
|
|
20109
|
-
}
|
|
20110
|
-
return this
|
|
20111
|
-
}
|
|
20112
|
-
|
|
20113
|
-
Buffer.prototype.swap32 = function swap32 () {
|
|
20114
|
-
var len = this.length
|
|
20115
|
-
if (len % 4 !== 0) {
|
|
20116
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
20117
|
-
}
|
|
20118
|
-
for (var i = 0; i < len; i += 4) {
|
|
20119
|
-
swap(this, i, i + 3)
|
|
20120
|
-
swap(this, i + 1, i + 2)
|
|
20121
|
-
}
|
|
20122
|
-
return this
|
|
20123
|
-
}
|
|
20124
|
-
|
|
20125
|
-
Buffer.prototype.swap64 = function swap64 () {
|
|
20126
|
-
var len = this.length
|
|
20127
|
-
if (len % 8 !== 0) {
|
|
20128
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
20129
|
-
}
|
|
20130
|
-
for (var i = 0; i < len; i += 8) {
|
|
20131
|
-
swap(this, i, i + 7)
|
|
20132
|
-
swap(this, i + 1, i + 6)
|
|
20133
|
-
swap(this, i + 2, i + 5)
|
|
20134
|
-
swap(this, i + 3, i + 4)
|
|
20135
|
-
}
|
|
20136
|
-
return this
|
|
20137
|
-
}
|
|
20138
|
-
|
|
20139
|
-
Buffer.prototype.toString = function toString () {
|
|
20140
|
-
var length = this.length
|
|
20141
|
-
if (length === 0) return ''
|
|
20142
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
20143
|
-
return slowToString.apply(this, arguments)
|
|
20144
|
-
}
|
|
20145
|
-
|
|
20146
|
-
Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
|
20147
|
-
|
|
20148
|
-
Buffer.prototype.equals = function equals (b) {
|
|
20149
|
-
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
20150
|
-
if (this === b) return true
|
|
20151
|
-
return Buffer.compare(this, b) === 0
|
|
20152
|
-
}
|
|
20153
|
-
|
|
20154
|
-
Buffer.prototype.inspect = function inspect () {
|
|
20155
|
-
var str = ''
|
|
20156
|
-
var max = exports.INSPECT_MAX_BYTES
|
|
20157
|
-
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
|
20158
|
-
if (this.length > max) str += ' ... '
|
|
20159
|
-
return '<Buffer ' + str + '>'
|
|
20160
|
-
}
|
|
20161
|
-
if (customInspectSymbol) {
|
|
20162
|
-
Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
|
|
20163
|
-
}
|
|
20164
|
-
|
|
20165
|
-
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
20166
|
-
if (isInstance(target, Uint8Array)) {
|
|
20167
|
-
target = Buffer.from(target, target.offset, target.byteLength)
|
|
20168
|
-
}
|
|
20169
|
-
if (!Buffer.isBuffer(target)) {
|
|
20170
|
-
throw new TypeError(
|
|
20171
|
-
'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
|
20172
|
-
'Received type ' + (typeof target)
|
|
20173
|
-
)
|
|
20174
|
-
}
|
|
20175
|
-
|
|
20176
|
-
if (start === undefined) {
|
|
20177
|
-
start = 0
|
|
20178
|
-
}
|
|
20179
|
-
if (end === undefined) {
|
|
20180
|
-
end = target ? target.length : 0
|
|
20181
|
-
}
|
|
20182
|
-
if (thisStart === undefined) {
|
|
20183
|
-
thisStart = 0
|
|
20184
|
-
}
|
|
20185
|
-
if (thisEnd === undefined) {
|
|
20186
|
-
thisEnd = this.length
|
|
20187
|
-
}
|
|
20188
|
-
|
|
20189
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
20190
|
-
throw new RangeError('out of range index')
|
|
20191
|
-
}
|
|
20192
|
-
|
|
20193
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
20194
|
-
return 0
|
|
20195
|
-
}
|
|
20196
|
-
if (thisStart >= thisEnd) {
|
|
20197
|
-
return -1
|
|
20198
|
-
}
|
|
20199
|
-
if (start >= end) {
|
|
20200
|
-
return 1
|
|
20201
|
-
}
|
|
20202
|
-
|
|
20203
|
-
start >>>= 0
|
|
20204
|
-
end >>>= 0
|
|
20205
|
-
thisStart >>>= 0
|
|
20206
|
-
thisEnd >>>= 0
|
|
20207
|
-
|
|
20208
|
-
if (this === target) return 0
|
|
20209
|
-
|
|
20210
|
-
var x = thisEnd - thisStart
|
|
20211
|
-
var y = end - start
|
|
20212
|
-
var len = Math.min(x, y)
|
|
20213
|
-
|
|
20214
|
-
var thisCopy = this.slice(thisStart, thisEnd)
|
|
20215
|
-
var targetCopy = target.slice(start, end)
|
|
20216
|
-
|
|
20217
|
-
for (var i = 0; i < len; ++i) {
|
|
20218
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
20219
|
-
x = thisCopy[i]
|
|
20220
|
-
y = targetCopy[i]
|
|
20221
|
-
break
|
|
20222
|
-
}
|
|
20223
|
-
}
|
|
20224
|
-
|
|
20225
|
-
if (x < y) return -1
|
|
20226
|
-
if (y < x) return 1
|
|
20227
|
-
return 0
|
|
20228
|
-
}
|
|
20229
|
-
|
|
20230
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
20231
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
20232
|
-
//
|
|
20233
|
-
// Arguments:
|
|
20234
|
-
// - buffer - a Buffer to search
|
|
20235
|
-
// - val - a string, Buffer, or number
|
|
20236
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
20237
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
20238
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
20239
|
-
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
20240
|
-
// Empty buffer means no match
|
|
20241
|
-
if (buffer.length === 0) return -1
|
|
20242
|
-
|
|
20243
|
-
// Normalize byteOffset
|
|
20244
|
-
if (typeof byteOffset === 'string') {
|
|
20245
|
-
encoding = byteOffset
|
|
20246
|
-
byteOffset = 0
|
|
20247
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
20248
|
-
byteOffset = 0x7fffffff
|
|
20249
|
-
} else if (byteOffset < -0x80000000) {
|
|
20250
|
-
byteOffset = -0x80000000
|
|
20251
|
-
}
|
|
20252
|
-
byteOffset = +byteOffset // Coerce to Number.
|
|
20253
|
-
if (numberIsNaN(byteOffset)) {
|
|
20254
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
20255
|
-
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
20256
|
-
}
|
|
20257
|
-
|
|
20258
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
20259
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
|
20260
|
-
if (byteOffset >= buffer.length) {
|
|
20261
|
-
if (dir) return -1
|
|
20262
|
-
else byteOffset = buffer.length - 1
|
|
20263
|
-
} else if (byteOffset < 0) {
|
|
20264
|
-
if (dir) byteOffset = 0
|
|
20265
|
-
else return -1
|
|
20266
|
-
}
|
|
20267
|
-
|
|
20268
|
-
// Normalize val
|
|
20269
|
-
if (typeof val === 'string') {
|
|
20270
|
-
val = Buffer.from(val, encoding)
|
|
20271
|
-
}
|
|
20272
|
-
|
|
20273
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
20274
|
-
if (Buffer.isBuffer(val)) {
|
|
20275
|
-
// Special case: looking for empty string/buffer always fails
|
|
20276
|
-
if (val.length === 0) {
|
|
20277
|
-
return -1
|
|
20278
|
-
}
|
|
20279
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
20280
|
-
} else if (typeof val === 'number') {
|
|
20281
|
-
val = val & 0xFF // Search for a byte value [0-255]
|
|
20282
|
-
if (typeof Uint8Array.prototype.indexOf === 'function') {
|
|
20283
|
-
if (dir) {
|
|
20284
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
20285
|
-
} else {
|
|
20286
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
20287
|
-
}
|
|
20288
|
-
}
|
|
20289
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
|
|
20290
|
-
}
|
|
20291
|
-
|
|
20292
|
-
throw new TypeError('val must be string, number or Buffer')
|
|
20293
|
-
}
|
|
20294
|
-
|
|
20295
|
-
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
20296
|
-
var indexSize = 1
|
|
20297
|
-
var arrLength = arr.length
|
|
20298
|
-
var valLength = val.length
|
|
20299
|
-
|
|
20300
|
-
if (encoding !== undefined) {
|
|
20301
|
-
encoding = String(encoding).toLowerCase()
|
|
20302
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
20303
|
-
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
20304
|
-
if (arr.length < 2 || val.length < 2) {
|
|
20305
|
-
return -1
|
|
20306
|
-
}
|
|
20307
|
-
indexSize = 2
|
|
20308
|
-
arrLength /= 2
|
|
20309
|
-
valLength /= 2
|
|
20310
|
-
byteOffset /= 2
|
|
20311
|
-
}
|
|
20312
|
-
}
|
|
20313
|
-
|
|
20314
|
-
function read (buf, i) {
|
|
20315
|
-
if (indexSize === 1) {
|
|
20316
|
-
return buf[i]
|
|
20317
|
-
} else {
|
|
20318
|
-
return buf.readUInt16BE(i * indexSize)
|
|
20319
|
-
}
|
|
20320
|
-
}
|
|
20321
|
-
|
|
20322
|
-
var i
|
|
20323
|
-
if (dir) {
|
|
20324
|
-
var foundIndex = -1
|
|
20325
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
20326
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
20327
|
-
if (foundIndex === -1) foundIndex = i
|
|
20328
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
20329
|
-
} else {
|
|
20330
|
-
if (foundIndex !== -1) i -= i - foundIndex
|
|
20331
|
-
foundIndex = -1
|
|
20332
|
-
}
|
|
20333
|
-
}
|
|
20334
|
-
} else {
|
|
20335
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
20336
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
20337
|
-
var found = true
|
|
20338
|
-
for (var j = 0; j < valLength; j++) {
|
|
20339
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
20340
|
-
found = false
|
|
20341
|
-
break
|
|
20342
|
-
}
|
|
20343
|
-
}
|
|
20344
|
-
if (found) return i
|
|
20345
|
-
}
|
|
20346
|
-
}
|
|
20347
|
-
|
|
20348
|
-
return -1
|
|
20349
|
-
}
|
|
20350
|
-
|
|
20351
|
-
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
20352
|
-
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
20353
|
-
}
|
|
20354
|
-
|
|
20355
|
-
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
20356
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
20357
|
-
}
|
|
20358
|
-
|
|
20359
|
-
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
20360
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
20361
|
-
}
|
|
20362
|
-
|
|
20363
|
-
function hexWrite (buf, string, offset, length) {
|
|
20364
|
-
offset = Number(offset) || 0
|
|
20365
|
-
var remaining = buf.length - offset
|
|
20366
|
-
if (!length) {
|
|
20367
|
-
length = remaining
|
|
20368
|
-
} else {
|
|
20369
|
-
length = Number(length)
|
|
20370
|
-
if (length > remaining) {
|
|
20371
|
-
length = remaining
|
|
20372
|
-
}
|
|
20373
|
-
}
|
|
20374
|
-
|
|
20375
|
-
var strLen = string.length
|
|
20376
|
-
|
|
20377
|
-
if (length > strLen / 2) {
|
|
20378
|
-
length = strLen / 2
|
|
20379
|
-
}
|
|
20380
|
-
for (var i = 0; i < length; ++i) {
|
|
20381
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
20382
|
-
if (numberIsNaN(parsed)) return i
|
|
20383
|
-
buf[offset + i] = parsed
|
|
20384
|
-
}
|
|
20385
|
-
return i
|
|
20386
|
-
}
|
|
20387
|
-
|
|
20388
|
-
function utf8Write (buf, string, offset, length) {
|
|
20389
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
20390
|
-
}
|
|
20391
|
-
|
|
20392
|
-
function asciiWrite (buf, string, offset, length) {
|
|
20393
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
20394
|
-
}
|
|
20395
|
-
|
|
20396
|
-
function base64Write (buf, string, offset, length) {
|
|
20397
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
20398
|
-
}
|
|
20399
|
-
|
|
20400
|
-
function ucs2Write (buf, string, offset, length) {
|
|
20401
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
20402
|
-
}
|
|
20403
|
-
|
|
20404
|
-
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
20405
|
-
// Buffer#write(string)
|
|
20406
|
-
if (offset === undefined) {
|
|
20407
|
-
encoding = 'utf8'
|
|
20408
|
-
length = this.length
|
|
20409
|
-
offset = 0
|
|
20410
|
-
// Buffer#write(string, encoding)
|
|
20411
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
20412
|
-
encoding = offset
|
|
20413
|
-
length = this.length
|
|
20414
|
-
offset = 0
|
|
20415
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
20416
|
-
} else if (isFinite(offset)) {
|
|
20417
|
-
offset = offset >>> 0
|
|
20418
|
-
if (isFinite(length)) {
|
|
20419
|
-
length = length >>> 0
|
|
20420
|
-
if (encoding === undefined) encoding = 'utf8'
|
|
20421
|
-
} else {
|
|
20422
|
-
encoding = length
|
|
20423
|
-
length = undefined
|
|
20424
|
-
}
|
|
20425
|
-
} else {
|
|
20426
|
-
throw new Error(
|
|
20427
|
-
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
20428
|
-
)
|
|
20429
|
-
}
|
|
20430
|
-
|
|
20431
|
-
var remaining = this.length - offset
|
|
20432
|
-
if (length === undefined || length > remaining) length = remaining
|
|
20433
|
-
|
|
20434
|
-
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
20435
|
-
throw new RangeError('Attempt to write outside buffer bounds')
|
|
20436
|
-
}
|
|
20437
|
-
|
|
20438
|
-
if (!encoding) encoding = 'utf8'
|
|
20439
|
-
|
|
20440
|
-
var loweredCase = false
|
|
20441
|
-
for (;;) {
|
|
20442
|
-
switch (encoding) {
|
|
20443
|
-
case 'hex':
|
|
20444
|
-
return hexWrite(this, string, offset, length)
|
|
20445
|
-
|
|
20446
|
-
case 'utf8':
|
|
20447
|
-
case 'utf-8':
|
|
20448
|
-
return utf8Write(this, string, offset, length)
|
|
20449
|
-
|
|
20450
|
-
case 'ascii':
|
|
20451
|
-
case 'latin1':
|
|
20452
|
-
case 'binary':
|
|
20453
|
-
return asciiWrite(this, string, offset, length)
|
|
20454
|
-
|
|
20455
|
-
case 'base64':
|
|
20456
|
-
// Warning: maxLength not taken into account in base64Write
|
|
20457
|
-
return base64Write(this, string, offset, length)
|
|
20458
|
-
|
|
20459
|
-
case 'ucs2':
|
|
20460
|
-
case 'ucs-2':
|
|
20461
|
-
case 'utf16le':
|
|
20462
|
-
case 'utf-16le':
|
|
20463
|
-
return ucs2Write(this, string, offset, length)
|
|
20464
|
-
|
|
20465
|
-
default:
|
|
20466
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
20467
|
-
encoding = ('' + encoding).toLowerCase()
|
|
20468
|
-
loweredCase = true
|
|
20469
|
-
}
|
|
20470
|
-
}
|
|
20471
|
-
}
|
|
20472
|
-
|
|
20473
|
-
Buffer.prototype.toJSON = function toJSON () {
|
|
20474
|
-
return {
|
|
20475
|
-
type: 'Buffer',
|
|
20476
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
20477
|
-
}
|
|
20478
|
-
}
|
|
20479
|
-
|
|
20480
|
-
function base64Slice (buf, start, end) {
|
|
20481
|
-
if (start === 0 && end === buf.length) {
|
|
20482
|
-
return base64.fromByteArray(buf)
|
|
20483
|
-
} else {
|
|
20484
|
-
return base64.fromByteArray(buf.slice(start, end))
|
|
20485
|
-
}
|
|
20486
|
-
}
|
|
20487
|
-
|
|
20488
|
-
function utf8Slice (buf, start, end) {
|
|
20489
|
-
end = Math.min(buf.length, end)
|
|
20490
|
-
var res = []
|
|
20491
|
-
|
|
20492
|
-
var i = start
|
|
20493
|
-
while (i < end) {
|
|
20494
|
-
var firstByte = buf[i]
|
|
20495
|
-
var codePoint = null
|
|
20496
|
-
var bytesPerSequence = (firstByte > 0xEF)
|
|
20497
|
-
? 4
|
|
20498
|
-
: (firstByte > 0xDF)
|
|
20499
|
-
? 3
|
|
20500
|
-
: (firstByte > 0xBF)
|
|
20501
|
-
? 2
|
|
20502
|
-
: 1
|
|
20503
|
-
|
|
20504
|
-
if (i + bytesPerSequence <= end) {
|
|
20505
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint
|
|
20506
|
-
|
|
20507
|
-
switch (bytesPerSequence) {
|
|
20508
|
-
case 1:
|
|
20509
|
-
if (firstByte < 0x80) {
|
|
20510
|
-
codePoint = firstByte
|
|
20511
|
-
}
|
|
20512
|
-
break
|
|
20513
|
-
case 2:
|
|
20514
|
-
secondByte = buf[i + 1]
|
|
20515
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
20516
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
20517
|
-
if (tempCodePoint > 0x7F) {
|
|
20518
|
-
codePoint = tempCodePoint
|
|
20519
|
-
}
|
|
20520
|
-
}
|
|
20521
|
-
break
|
|
20522
|
-
case 3:
|
|
20523
|
-
secondByte = buf[i + 1]
|
|
20524
|
-
thirdByte = buf[i + 2]
|
|
20525
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
20526
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
20527
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
20528
|
-
codePoint = tempCodePoint
|
|
20529
|
-
}
|
|
20530
|
-
}
|
|
20531
|
-
break
|
|
20532
|
-
case 4:
|
|
20533
|
-
secondByte = buf[i + 1]
|
|
20534
|
-
thirdByte = buf[i + 2]
|
|
20535
|
-
fourthByte = buf[i + 3]
|
|
20536
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
20537
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
20538
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
20539
|
-
codePoint = tempCodePoint
|
|
20540
|
-
}
|
|
20541
|
-
}
|
|
20542
|
-
}
|
|
20543
|
-
}
|
|
20544
|
-
|
|
20545
|
-
if (codePoint === null) {
|
|
20546
|
-
// we did not generate a valid codePoint so insert a
|
|
20547
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
20548
|
-
codePoint = 0xFFFD
|
|
20549
|
-
bytesPerSequence = 1
|
|
20550
|
-
} else if (codePoint > 0xFFFF) {
|
|
20551
|
-
// encode to utf16 (surrogate pair dance)
|
|
20552
|
-
codePoint -= 0x10000
|
|
20553
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
20554
|
-
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
20555
|
-
}
|
|
20556
|
-
|
|
20557
|
-
res.push(codePoint)
|
|
20558
|
-
i += bytesPerSequence
|
|
20559
|
-
}
|
|
20560
|
-
|
|
20561
|
-
return decodeCodePointsArray(res)
|
|
20562
|
-
}
|
|
20563
|
-
|
|
20564
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
20565
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
20566
|
-
// We go 1 magnitude less, for safety
|
|
20567
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000
|
|
20568
|
-
|
|
20569
|
-
function decodeCodePointsArray (codePoints) {
|
|
20570
|
-
var len = codePoints.length
|
|
20571
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
20572
|
-
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
20573
|
-
}
|
|
20574
|
-
|
|
20575
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
20576
|
-
var res = ''
|
|
20577
|
-
var i = 0
|
|
20578
|
-
while (i < len) {
|
|
20579
|
-
res += String.fromCharCode.apply(
|
|
20580
|
-
String,
|
|
20581
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
20582
|
-
)
|
|
20583
|
-
}
|
|
20584
|
-
return res
|
|
20585
|
-
}
|
|
20586
|
-
|
|
20587
|
-
function asciiSlice (buf, start, end) {
|
|
20588
|
-
var ret = ''
|
|
20589
|
-
end = Math.min(buf.length, end)
|
|
20590
|
-
|
|
20591
|
-
for (var i = start; i < end; ++i) {
|
|
20592
|
-
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
20593
|
-
}
|
|
20594
|
-
return ret
|
|
20595
|
-
}
|
|
20596
|
-
|
|
20597
|
-
function latin1Slice (buf, start, end) {
|
|
20598
|
-
var ret = ''
|
|
20599
|
-
end = Math.min(buf.length, end)
|
|
20600
|
-
|
|
20601
|
-
for (var i = start; i < end; ++i) {
|
|
20602
|
-
ret += String.fromCharCode(buf[i])
|
|
20603
|
-
}
|
|
20604
|
-
return ret
|
|
20605
|
-
}
|
|
20606
|
-
|
|
20607
|
-
function hexSlice (buf, start, end) {
|
|
20608
|
-
var len = buf.length
|
|
20609
|
-
|
|
20610
|
-
if (!start || start < 0) start = 0
|
|
20611
|
-
if (!end || end < 0 || end > len) end = len
|
|
20612
|
-
|
|
20613
|
-
var out = ''
|
|
20614
|
-
for (var i = start; i < end; ++i) {
|
|
20615
|
-
out += hexSliceLookupTable[buf[i]]
|
|
20616
|
-
}
|
|
20617
|
-
return out
|
|
20618
|
-
}
|
|
20619
|
-
|
|
20620
|
-
function utf16leSlice (buf, start, end) {
|
|
20621
|
-
var bytes = buf.slice(start, end)
|
|
20622
|
-
var res = ''
|
|
20623
|
-
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
|
20624
|
-
for (var i = 0; i < bytes.length - 1; i += 2) {
|
|
20625
|
-
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
|
20626
|
-
}
|
|
20627
|
-
return res
|
|
20628
|
-
}
|
|
20629
|
-
|
|
20630
|
-
Buffer.prototype.slice = function slice (start, end) {
|
|
20631
|
-
var len = this.length
|
|
20632
|
-
start = ~~start
|
|
20633
|
-
end = end === undefined ? len : ~~end
|
|
20634
|
-
|
|
20635
|
-
if (start < 0) {
|
|
20636
|
-
start += len
|
|
20637
|
-
if (start < 0) start = 0
|
|
20638
|
-
} else if (start > len) {
|
|
20639
|
-
start = len
|
|
20640
|
-
}
|
|
20641
|
-
|
|
20642
|
-
if (end < 0) {
|
|
20643
|
-
end += len
|
|
20644
|
-
if (end < 0) end = 0
|
|
20645
|
-
} else if (end > len) {
|
|
20646
|
-
end = len
|
|
20647
|
-
}
|
|
20648
|
-
|
|
20649
|
-
if (end < start) end = start
|
|
20650
|
-
|
|
20651
|
-
var newBuf = this.subarray(start, end)
|
|
20652
|
-
// Return an augmented `Uint8Array` instance
|
|
20653
|
-
Object.setPrototypeOf(newBuf, Buffer.prototype)
|
|
20654
|
-
|
|
20655
|
-
return newBuf
|
|
20656
|
-
}
|
|
20657
|
-
|
|
20658
|
-
/*
|
|
20659
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
20660
|
-
*/
|
|
20661
|
-
function checkOffset (offset, ext, length) {
|
|
20662
|
-
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
20663
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
20664
|
-
}
|
|
20665
|
-
|
|
20666
|
-
Buffer.prototype.readUintLE =
|
|
20667
|
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
20668
|
-
offset = offset >>> 0
|
|
20669
|
-
byteLength = byteLength >>> 0
|
|
20670
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
20671
|
-
|
|
20672
|
-
var val = this[offset]
|
|
20673
|
-
var mul = 1
|
|
20674
|
-
var i = 0
|
|
20675
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
20676
|
-
val += this[offset + i] * mul
|
|
20677
|
-
}
|
|
20678
|
-
|
|
20679
|
-
return val
|
|
20680
|
-
}
|
|
20681
|
-
|
|
20682
|
-
Buffer.prototype.readUintBE =
|
|
20683
|
-
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
20684
|
-
offset = offset >>> 0
|
|
20685
|
-
byteLength = byteLength >>> 0
|
|
20686
|
-
if (!noAssert) {
|
|
20687
|
-
checkOffset(offset, byteLength, this.length)
|
|
20688
|
-
}
|
|
20689
|
-
|
|
20690
|
-
var val = this[offset + --byteLength]
|
|
20691
|
-
var mul = 1
|
|
20692
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
20693
|
-
val += this[offset + --byteLength] * mul
|
|
20694
|
-
}
|
|
20695
|
-
|
|
20696
|
-
return val
|
|
20697
|
-
}
|
|
20698
|
-
|
|
20699
|
-
Buffer.prototype.readUint8 =
|
|
20700
|
-
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
20701
|
-
offset = offset >>> 0
|
|
20702
|
-
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
20703
|
-
return this[offset]
|
|
20704
|
-
}
|
|
20705
|
-
|
|
20706
|
-
Buffer.prototype.readUint16LE =
|
|
20707
|
-
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
20708
|
-
offset = offset >>> 0
|
|
20709
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
20710
|
-
return this[offset] | (this[offset + 1] << 8)
|
|
20711
|
-
}
|
|
20712
|
-
|
|
20713
|
-
Buffer.prototype.readUint16BE =
|
|
20714
|
-
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
20715
|
-
offset = offset >>> 0
|
|
20716
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
20717
|
-
return (this[offset] << 8) | this[offset + 1]
|
|
20718
|
-
}
|
|
20719
|
-
|
|
20720
|
-
Buffer.prototype.readUint32LE =
|
|
20721
|
-
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
20722
|
-
offset = offset >>> 0
|
|
20723
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20724
|
-
|
|
20725
|
-
return ((this[offset]) |
|
|
20726
|
-
(this[offset + 1] << 8) |
|
|
20727
|
-
(this[offset + 2] << 16)) +
|
|
20728
|
-
(this[offset + 3] * 0x1000000)
|
|
20729
|
-
}
|
|
20730
|
-
|
|
20731
|
-
Buffer.prototype.readUint32BE =
|
|
20732
|
-
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
20733
|
-
offset = offset >>> 0
|
|
20734
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20735
|
-
|
|
20736
|
-
return (this[offset] * 0x1000000) +
|
|
20737
|
-
((this[offset + 1] << 16) |
|
|
20738
|
-
(this[offset + 2] << 8) |
|
|
20739
|
-
this[offset + 3])
|
|
20740
|
-
}
|
|
20741
|
-
|
|
20742
|
-
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
20743
|
-
offset = offset >>> 0
|
|
20744
|
-
byteLength = byteLength >>> 0
|
|
20745
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
20746
|
-
|
|
20747
|
-
var val = this[offset]
|
|
20748
|
-
var mul = 1
|
|
20749
|
-
var i = 0
|
|
20750
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
20751
|
-
val += this[offset + i] * mul
|
|
20752
|
-
}
|
|
20753
|
-
mul *= 0x80
|
|
20754
|
-
|
|
20755
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
20756
|
-
|
|
20757
|
-
return val
|
|
20758
|
-
}
|
|
20759
|
-
|
|
20760
|
-
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
20761
|
-
offset = offset >>> 0
|
|
20762
|
-
byteLength = byteLength >>> 0
|
|
20763
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
20764
|
-
|
|
20765
|
-
var i = byteLength
|
|
20766
|
-
var mul = 1
|
|
20767
|
-
var val = this[offset + --i]
|
|
20768
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
20769
|
-
val += this[offset + --i] * mul
|
|
20770
|
-
}
|
|
20771
|
-
mul *= 0x80
|
|
20772
|
-
|
|
20773
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
20774
|
-
|
|
20775
|
-
return val
|
|
20776
|
-
}
|
|
20777
|
-
|
|
20778
|
-
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
20779
|
-
offset = offset >>> 0
|
|
20780
|
-
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
20781
|
-
if (!(this[offset] & 0x80)) return (this[offset])
|
|
20782
|
-
return ((0xff - this[offset] + 1) * -1)
|
|
20783
|
-
}
|
|
20784
|
-
|
|
20785
|
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
20786
|
-
offset = offset >>> 0
|
|
20787
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
20788
|
-
var val = this[offset] | (this[offset + 1] << 8)
|
|
20789
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
20790
|
-
}
|
|
20791
|
-
|
|
20792
|
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
20793
|
-
offset = offset >>> 0
|
|
20794
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
20795
|
-
var val = this[offset + 1] | (this[offset] << 8)
|
|
20796
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
20797
|
-
}
|
|
20798
|
-
|
|
20799
|
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
20800
|
-
offset = offset >>> 0
|
|
20801
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20802
|
-
|
|
20803
|
-
return (this[offset]) |
|
|
20804
|
-
(this[offset + 1] << 8) |
|
|
20805
|
-
(this[offset + 2] << 16) |
|
|
20806
|
-
(this[offset + 3] << 24)
|
|
20807
|
-
}
|
|
20808
|
-
|
|
20809
|
-
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
20810
|
-
offset = offset >>> 0
|
|
20811
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20812
|
-
|
|
20813
|
-
return (this[offset] << 24) |
|
|
20814
|
-
(this[offset + 1] << 16) |
|
|
20815
|
-
(this[offset + 2] << 8) |
|
|
20816
|
-
(this[offset + 3])
|
|
20817
|
-
}
|
|
20818
|
-
|
|
20819
|
-
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
20820
|
-
offset = offset >>> 0
|
|
20821
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20822
|
-
return ieee754.read(this, offset, true, 23, 4)
|
|
20823
|
-
}
|
|
20824
|
-
|
|
20825
|
-
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
20826
|
-
offset = offset >>> 0
|
|
20827
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
20828
|
-
return ieee754.read(this, offset, false, 23, 4)
|
|
20829
|
-
}
|
|
20830
|
-
|
|
20831
|
-
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
20832
|
-
offset = offset >>> 0
|
|
20833
|
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
20834
|
-
return ieee754.read(this, offset, true, 52, 8)
|
|
20835
|
-
}
|
|
20836
|
-
|
|
20837
|
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
20838
|
-
offset = offset >>> 0
|
|
20839
|
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
20840
|
-
return ieee754.read(this, offset, false, 52, 8)
|
|
20841
|
-
}
|
|
20842
|
-
|
|
20843
|
-
function checkInt (buf, value, offset, ext, max, min) {
|
|
20844
|
-
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
20845
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
20846
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
20847
|
-
}
|
|
20848
|
-
|
|
20849
|
-
Buffer.prototype.writeUintLE =
|
|
20850
|
-
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
20851
|
-
value = +value
|
|
20852
|
-
offset = offset >>> 0
|
|
20853
|
-
byteLength = byteLength >>> 0
|
|
20854
|
-
if (!noAssert) {
|
|
20855
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
20856
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
20857
|
-
}
|
|
20858
|
-
|
|
20859
|
-
var mul = 1
|
|
20860
|
-
var i = 0
|
|
20861
|
-
this[offset] = value & 0xFF
|
|
20862
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
20863
|
-
this[offset + i] = (value / mul) & 0xFF
|
|
20864
|
-
}
|
|
20865
|
-
|
|
20866
|
-
return offset + byteLength
|
|
20867
|
-
}
|
|
20868
|
-
|
|
20869
|
-
Buffer.prototype.writeUintBE =
|
|
20870
|
-
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
20871
|
-
value = +value
|
|
20872
|
-
offset = offset >>> 0
|
|
20873
|
-
byteLength = byteLength >>> 0
|
|
20874
|
-
if (!noAssert) {
|
|
20875
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
20876
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
20877
|
-
}
|
|
20878
|
-
|
|
20879
|
-
var i = byteLength - 1
|
|
20880
|
-
var mul = 1
|
|
20881
|
-
this[offset + i] = value & 0xFF
|
|
20882
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
20883
|
-
this[offset + i] = (value / mul) & 0xFF
|
|
20884
|
-
}
|
|
20885
|
-
|
|
20886
|
-
return offset + byteLength
|
|
20887
|
-
}
|
|
20888
|
-
|
|
20889
|
-
Buffer.prototype.writeUint8 =
|
|
20890
|
-
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
20891
|
-
value = +value
|
|
20892
|
-
offset = offset >>> 0
|
|
20893
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
|
20894
|
-
this[offset] = (value & 0xff)
|
|
20895
|
-
return offset + 1
|
|
20896
|
-
}
|
|
20897
|
-
|
|
20898
|
-
Buffer.prototype.writeUint16LE =
|
|
20899
|
-
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
20900
|
-
value = +value
|
|
20901
|
-
offset = offset >>> 0
|
|
20902
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
20903
|
-
this[offset] = (value & 0xff)
|
|
20904
|
-
this[offset + 1] = (value >>> 8)
|
|
20905
|
-
return offset + 2
|
|
20906
|
-
}
|
|
20907
|
-
|
|
20908
|
-
Buffer.prototype.writeUint16BE =
|
|
20909
|
-
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
20910
|
-
value = +value
|
|
20911
|
-
offset = offset >>> 0
|
|
20912
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
20913
|
-
this[offset] = (value >>> 8)
|
|
20914
|
-
this[offset + 1] = (value & 0xff)
|
|
20915
|
-
return offset + 2
|
|
20916
|
-
}
|
|
20917
|
-
|
|
20918
|
-
Buffer.prototype.writeUint32LE =
|
|
20919
|
-
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
20920
|
-
value = +value
|
|
20921
|
-
offset = offset >>> 0
|
|
20922
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
20923
|
-
this[offset + 3] = (value >>> 24)
|
|
20924
|
-
this[offset + 2] = (value >>> 16)
|
|
20925
|
-
this[offset + 1] = (value >>> 8)
|
|
20926
|
-
this[offset] = (value & 0xff)
|
|
20927
|
-
return offset + 4
|
|
20928
|
-
}
|
|
20929
|
-
|
|
20930
|
-
Buffer.prototype.writeUint32BE =
|
|
20931
|
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
20932
|
-
value = +value
|
|
20933
|
-
offset = offset >>> 0
|
|
20934
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
20935
|
-
this[offset] = (value >>> 24)
|
|
20936
|
-
this[offset + 1] = (value >>> 16)
|
|
20937
|
-
this[offset + 2] = (value >>> 8)
|
|
20938
|
-
this[offset + 3] = (value & 0xff)
|
|
20939
|
-
return offset + 4
|
|
20940
|
-
}
|
|
20941
|
-
|
|
20942
|
-
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
20943
|
-
value = +value
|
|
20944
|
-
offset = offset >>> 0
|
|
20945
|
-
if (!noAssert) {
|
|
20946
|
-
var limit = Math.pow(2, (8 * byteLength) - 1)
|
|
20947
|
-
|
|
20948
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
20949
|
-
}
|
|
20950
|
-
|
|
20951
|
-
var i = 0
|
|
20952
|
-
var mul = 1
|
|
20953
|
-
var sub = 0
|
|
20954
|
-
this[offset] = value & 0xFF
|
|
20955
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
20956
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
20957
|
-
sub = 1
|
|
20958
|
-
}
|
|
20959
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
20960
|
-
}
|
|
20961
|
-
|
|
20962
|
-
return offset + byteLength
|
|
20963
|
-
}
|
|
20964
|
-
|
|
20965
|
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
20966
|
-
value = +value
|
|
20967
|
-
offset = offset >>> 0
|
|
20968
|
-
if (!noAssert) {
|
|
20969
|
-
var limit = Math.pow(2, (8 * byteLength) - 1)
|
|
20970
|
-
|
|
20971
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
20972
|
-
}
|
|
20973
|
-
|
|
20974
|
-
var i = byteLength - 1
|
|
20975
|
-
var mul = 1
|
|
20976
|
-
var sub = 0
|
|
20977
|
-
this[offset + i] = value & 0xFF
|
|
20978
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
20979
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
20980
|
-
sub = 1
|
|
20981
|
-
}
|
|
20982
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
20983
|
-
}
|
|
20984
|
-
|
|
20985
|
-
return offset + byteLength
|
|
20986
|
-
}
|
|
20987
|
-
|
|
20988
|
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
20989
|
-
value = +value
|
|
20990
|
-
offset = offset >>> 0
|
|
20991
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
20992
|
-
if (value < 0) value = 0xff + value + 1
|
|
20993
|
-
this[offset] = (value & 0xff)
|
|
20994
|
-
return offset + 1
|
|
20995
|
-
}
|
|
20996
|
-
|
|
20997
|
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
20998
|
-
value = +value
|
|
20999
|
-
offset = offset >>> 0
|
|
21000
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
21001
|
-
this[offset] = (value & 0xff)
|
|
21002
|
-
this[offset + 1] = (value >>> 8)
|
|
21003
|
-
return offset + 2
|
|
21004
|
-
}
|
|
21005
|
-
|
|
21006
|
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
21007
|
-
value = +value
|
|
21008
|
-
offset = offset >>> 0
|
|
21009
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
21010
|
-
this[offset] = (value >>> 8)
|
|
21011
|
-
this[offset + 1] = (value & 0xff)
|
|
21012
|
-
return offset + 2
|
|
21013
|
-
}
|
|
21014
|
-
|
|
21015
|
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
21016
|
-
value = +value
|
|
21017
|
-
offset = offset >>> 0
|
|
21018
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
21019
|
-
this[offset] = (value & 0xff)
|
|
21020
|
-
this[offset + 1] = (value >>> 8)
|
|
21021
|
-
this[offset + 2] = (value >>> 16)
|
|
21022
|
-
this[offset + 3] = (value >>> 24)
|
|
21023
|
-
return offset + 4
|
|
21024
|
-
}
|
|
21025
|
-
|
|
21026
|
-
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
21027
|
-
value = +value
|
|
21028
|
-
offset = offset >>> 0
|
|
21029
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
21030
|
-
if (value < 0) value = 0xffffffff + value + 1
|
|
21031
|
-
this[offset] = (value >>> 24)
|
|
21032
|
-
this[offset + 1] = (value >>> 16)
|
|
21033
|
-
this[offset + 2] = (value >>> 8)
|
|
21034
|
-
this[offset + 3] = (value & 0xff)
|
|
21035
|
-
return offset + 4
|
|
21036
|
-
}
|
|
21037
|
-
|
|
21038
|
-
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
21039
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
21040
|
-
if (offset < 0) throw new RangeError('Index out of range')
|
|
21041
|
-
}
|
|
21042
|
-
|
|
21043
|
-
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
21044
|
-
value = +value
|
|
21045
|
-
offset = offset >>> 0
|
|
21046
|
-
if (!noAssert) {
|
|
21047
|
-
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
21048
|
-
}
|
|
21049
|
-
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
21050
|
-
return offset + 4
|
|
21051
|
-
}
|
|
21052
|
-
|
|
21053
|
-
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
21054
|
-
return writeFloat(this, value, offset, true, noAssert)
|
|
21055
|
-
}
|
|
21056
|
-
|
|
21057
|
-
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
21058
|
-
return writeFloat(this, value, offset, false, noAssert)
|
|
21059
|
-
}
|
|
21060
|
-
|
|
21061
|
-
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
21062
|
-
value = +value
|
|
21063
|
-
offset = offset >>> 0
|
|
21064
|
-
if (!noAssert) {
|
|
21065
|
-
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
|
21066
|
-
}
|
|
21067
|
-
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
21068
|
-
return offset + 8
|
|
21069
|
-
}
|
|
21070
|
-
|
|
21071
|
-
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
21072
|
-
return writeDouble(this, value, offset, true, noAssert)
|
|
21073
|
-
}
|
|
21074
|
-
|
|
21075
|
-
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
21076
|
-
return writeDouble(this, value, offset, false, noAssert)
|
|
21077
|
-
}
|
|
21078
|
-
|
|
21079
|
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
21080
|
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
21081
|
-
if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
|
|
21082
|
-
if (!start) start = 0
|
|
21083
|
-
if (!end && end !== 0) end = this.length
|
|
21084
|
-
if (targetStart >= target.length) targetStart = target.length
|
|
21085
|
-
if (!targetStart) targetStart = 0
|
|
21086
|
-
if (end > 0 && end < start) end = start
|
|
21087
|
-
|
|
21088
|
-
// Copy 0 bytes; we're done
|
|
21089
|
-
if (end === start) return 0
|
|
21090
|
-
if (target.length === 0 || this.length === 0) return 0
|
|
21091
|
-
|
|
21092
|
-
// Fatal error conditions
|
|
21093
|
-
if (targetStart < 0) {
|
|
21094
|
-
throw new RangeError('targetStart out of bounds')
|
|
21095
|
-
}
|
|
21096
|
-
if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
|
|
21097
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
21098
|
-
|
|
21099
|
-
// Are we oob?
|
|
21100
|
-
if (end > this.length) end = this.length
|
|
21101
|
-
if (target.length - targetStart < end - start) {
|
|
21102
|
-
end = target.length - targetStart + start
|
|
21103
|
-
}
|
|
21104
|
-
|
|
21105
|
-
var len = end - start
|
|
21106
|
-
|
|
21107
|
-
if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
|
21108
|
-
// Use built-in when available, missing from IE11
|
|
21109
|
-
this.copyWithin(targetStart, start, end)
|
|
21110
|
-
} else {
|
|
21111
|
-
Uint8Array.prototype.set.call(
|
|
21112
|
-
target,
|
|
21113
|
-
this.subarray(start, end),
|
|
21114
|
-
targetStart
|
|
21115
|
-
)
|
|
21116
|
-
}
|
|
21117
|
-
|
|
21118
|
-
return len
|
|
21119
|
-
}
|
|
21120
|
-
|
|
21121
|
-
// Usage:
|
|
21122
|
-
// buffer.fill(number[, offset[, end]])
|
|
21123
|
-
// buffer.fill(buffer[, offset[, end]])
|
|
21124
|
-
// buffer.fill(string[, offset[, end]][, encoding])
|
|
21125
|
-
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
21126
|
-
// Handle string cases:
|
|
21127
|
-
if (typeof val === 'string') {
|
|
21128
|
-
if (typeof start === 'string') {
|
|
21129
|
-
encoding = start
|
|
21130
|
-
start = 0
|
|
21131
|
-
end = this.length
|
|
21132
|
-
} else if (typeof end === 'string') {
|
|
21133
|
-
encoding = end
|
|
21134
|
-
end = this.length
|
|
21135
|
-
}
|
|
21136
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
21137
|
-
throw new TypeError('encoding must be a string')
|
|
21138
|
-
}
|
|
21139
|
-
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
21140
|
-
throw new TypeError('Unknown encoding: ' + encoding)
|
|
21141
|
-
}
|
|
21142
|
-
if (val.length === 1) {
|
|
21143
|
-
var code = val.charCodeAt(0)
|
|
21144
|
-
if ((encoding === 'utf8' && code < 128) ||
|
|
21145
|
-
encoding === 'latin1') {
|
|
21146
|
-
// Fast path: If `val` fits into a single byte, use that numeric value.
|
|
21147
|
-
val = code
|
|
21148
|
-
}
|
|
21149
|
-
}
|
|
21150
|
-
} else if (typeof val === 'number') {
|
|
21151
|
-
val = val & 255
|
|
21152
|
-
} else if (typeof val === 'boolean') {
|
|
21153
|
-
val = Number(val)
|
|
21154
|
-
}
|
|
21155
|
-
|
|
21156
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
21157
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
21158
|
-
throw new RangeError('Out of range index')
|
|
21159
|
-
}
|
|
21160
|
-
|
|
21161
|
-
if (end <= start) {
|
|
21162
|
-
return this
|
|
21163
|
-
}
|
|
21164
|
-
|
|
21165
|
-
start = start >>> 0
|
|
21166
|
-
end = end === undefined ? this.length : end >>> 0
|
|
21167
|
-
|
|
21168
|
-
if (!val) val = 0
|
|
21169
|
-
|
|
21170
|
-
var i
|
|
21171
|
-
if (typeof val === 'number') {
|
|
21172
|
-
for (i = start; i < end; ++i) {
|
|
21173
|
-
this[i] = val
|
|
21174
|
-
}
|
|
21175
|
-
} else {
|
|
21176
|
-
var bytes = Buffer.isBuffer(val)
|
|
21177
|
-
? val
|
|
21178
|
-
: Buffer.from(val, encoding)
|
|
21179
|
-
var len = bytes.length
|
|
21180
|
-
if (len === 0) {
|
|
21181
|
-
throw new TypeError('The value "' + val +
|
|
21182
|
-
'" is invalid for argument "value"')
|
|
21183
|
-
}
|
|
21184
|
-
for (i = 0; i < end - start; ++i) {
|
|
21185
|
-
this[i + start] = bytes[i % len]
|
|
21186
|
-
}
|
|
21187
|
-
}
|
|
21188
|
-
|
|
21189
|
-
return this
|
|
21190
|
-
}
|
|
21191
|
-
|
|
21192
|
-
// HELPER FUNCTIONS
|
|
21193
|
-
// ================
|
|
21194
|
-
|
|
21195
|
-
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
|
21196
|
-
|
|
21197
|
-
function base64clean (str) {
|
|
21198
|
-
// Node takes equal signs as end of the Base64 encoding
|
|
21199
|
-
str = str.split('=')[0]
|
|
21200
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
21201
|
-
str = str.trim().replace(INVALID_BASE64_RE, '')
|
|
21202
|
-
// Node converts strings with length < 2 to ''
|
|
21203
|
-
if (str.length < 2) return ''
|
|
21204
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
21205
|
-
while (str.length % 4 !== 0) {
|
|
21206
|
-
str = str + '='
|
|
21207
|
-
}
|
|
21208
|
-
return str
|
|
21209
|
-
}
|
|
21210
|
-
|
|
21211
|
-
function utf8ToBytes (string, units) {
|
|
21212
|
-
units = units || Infinity
|
|
21213
|
-
var codePoint
|
|
21214
|
-
var length = string.length
|
|
21215
|
-
var leadSurrogate = null
|
|
21216
|
-
var bytes = []
|
|
21217
|
-
|
|
21218
|
-
for (var i = 0; i < length; ++i) {
|
|
21219
|
-
codePoint = string.charCodeAt(i)
|
|
21220
|
-
|
|
21221
|
-
// is surrogate component
|
|
21222
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
21223
|
-
// last char was a lead
|
|
21224
|
-
if (!leadSurrogate) {
|
|
21225
|
-
// no lead yet
|
|
21226
|
-
if (codePoint > 0xDBFF) {
|
|
21227
|
-
// unexpected trail
|
|
21228
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
21229
|
-
continue
|
|
21230
|
-
} else if (i + 1 === length) {
|
|
21231
|
-
// unpaired lead
|
|
21232
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
21233
|
-
continue
|
|
21234
|
-
}
|
|
21235
|
-
|
|
21236
|
-
// valid lead
|
|
21237
|
-
leadSurrogate = codePoint
|
|
21238
|
-
|
|
21239
|
-
continue
|
|
21240
|
-
}
|
|
21241
|
-
|
|
21242
|
-
// 2 leads in a row
|
|
21243
|
-
if (codePoint < 0xDC00) {
|
|
21244
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
21245
|
-
leadSurrogate = codePoint
|
|
21246
|
-
continue
|
|
21247
|
-
}
|
|
21248
|
-
|
|
21249
|
-
// valid surrogate pair
|
|
21250
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
|
21251
|
-
} else if (leadSurrogate) {
|
|
21252
|
-
// valid bmp char, but last char was a lead
|
|
21253
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
21254
|
-
}
|
|
21255
|
-
|
|
21256
|
-
leadSurrogate = null
|
|
21257
|
-
|
|
21258
|
-
// encode utf8
|
|
21259
|
-
if (codePoint < 0x80) {
|
|
21260
|
-
if ((units -= 1) < 0) break
|
|
21261
|
-
bytes.push(codePoint)
|
|
21262
|
-
} else if (codePoint < 0x800) {
|
|
21263
|
-
if ((units -= 2) < 0) break
|
|
21264
|
-
bytes.push(
|
|
21265
|
-
codePoint >> 0x6 | 0xC0,
|
|
21266
|
-
codePoint & 0x3F | 0x80
|
|
21267
|
-
)
|
|
21268
|
-
} else if (codePoint < 0x10000) {
|
|
21269
|
-
if ((units -= 3) < 0) break
|
|
21270
|
-
bytes.push(
|
|
21271
|
-
codePoint >> 0xC | 0xE0,
|
|
21272
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
21273
|
-
codePoint & 0x3F | 0x80
|
|
21274
|
-
)
|
|
21275
|
-
} else if (codePoint < 0x110000) {
|
|
21276
|
-
if ((units -= 4) < 0) break
|
|
21277
|
-
bytes.push(
|
|
21278
|
-
codePoint >> 0x12 | 0xF0,
|
|
21279
|
-
codePoint >> 0xC & 0x3F | 0x80,
|
|
21280
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
21281
|
-
codePoint & 0x3F | 0x80
|
|
21282
|
-
)
|
|
21283
|
-
} else {
|
|
21284
|
-
throw new Error('Invalid code point')
|
|
21285
|
-
}
|
|
21286
|
-
}
|
|
21287
|
-
|
|
21288
|
-
return bytes
|
|
21289
|
-
}
|
|
21290
|
-
|
|
21291
|
-
function asciiToBytes (str) {
|
|
21292
|
-
var byteArray = []
|
|
21293
|
-
for (var i = 0; i < str.length; ++i) {
|
|
21294
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
21295
|
-
byteArray.push(str.charCodeAt(i) & 0xFF)
|
|
21296
|
-
}
|
|
21297
|
-
return byteArray
|
|
21298
|
-
}
|
|
21299
|
-
|
|
21300
|
-
function utf16leToBytes (str, units) {
|
|
21301
|
-
var c, hi, lo
|
|
21302
|
-
var byteArray = []
|
|
21303
|
-
for (var i = 0; i < str.length; ++i) {
|
|
21304
|
-
if ((units -= 2) < 0) break
|
|
21305
|
-
|
|
21306
|
-
c = str.charCodeAt(i)
|
|
21307
|
-
hi = c >> 8
|
|
21308
|
-
lo = c % 256
|
|
21309
|
-
byteArray.push(lo)
|
|
21310
|
-
byteArray.push(hi)
|
|
21311
|
-
}
|
|
21312
|
-
|
|
21313
|
-
return byteArray
|
|
21314
|
-
}
|
|
21315
|
-
|
|
21316
|
-
function base64ToBytes (str) {
|
|
21317
|
-
return base64.toByteArray(base64clean(str))
|
|
21318
|
-
}
|
|
21319
|
-
|
|
21320
|
-
function blitBuffer (src, dst, offset, length) {
|
|
21321
|
-
for (var i = 0; i < length; ++i) {
|
|
21322
|
-
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
21323
|
-
dst[i + offset] = src[i]
|
|
21324
|
-
}
|
|
21325
|
-
return i
|
|
21326
|
-
}
|
|
21327
|
-
|
|
21328
|
-
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
|
|
21329
|
-
// the `instanceof` check but they should be treated as of that type.
|
|
21330
|
-
// See: https://github.com/feross/buffer/issues/166
|
|
21331
|
-
function isInstance (obj, type) {
|
|
21332
|
-
return obj instanceof type ||
|
|
21333
|
-
(obj != null && obj.constructor != null && obj.constructor.name != null &&
|
|
21334
|
-
obj.constructor.name === type.name)
|
|
21335
|
-
}
|
|
21336
|
-
function numberIsNaN (obj) {
|
|
21337
|
-
// For IE11 support
|
|
21338
|
-
return obj !== obj // eslint-disable-line no-self-compare
|
|
21339
|
-
}
|
|
21340
|
-
|
|
21341
|
-
// Create lookup table for `toString('hex')`
|
|
21342
|
-
// See: https://github.com/feross/buffer/issues/219
|
|
21343
|
-
var hexSliceLookupTable = (function () {
|
|
21344
|
-
var alphabet = '0123456789abcdef'
|
|
21345
|
-
var table = new Array(256)
|
|
21346
|
-
for (var i = 0; i < 16; ++i) {
|
|
21347
|
-
var i16 = i * 16
|
|
21348
|
-
for (var j = 0; j < 16; ++j) {
|
|
21349
|
-
table[i16 + j] = alphabet[i] + alphabet[j]
|
|
21350
|
-
}
|
|
21351
|
-
}
|
|
21352
|
-
return table
|
|
21353
|
-
})()
|
|
21354
|
-
|
|
21355
|
-
|
|
21356
19368
|
/***/ }),
|
|
21357
19369
|
|
|
21358
19370
|
/***/ "./node_modules/dijkstrajs/dijkstra.js":
|
|
@@ -21529,6 +19541,72 @@ if (true) {
|
|
|
21529
19541
|
}
|
|
21530
19542
|
|
|
21531
19543
|
|
|
19544
|
+
/***/ }),
|
|
19545
|
+
|
|
19546
|
+
/***/ "./node_modules/encode-utf8/index.js":
|
|
19547
|
+
/*!*******************************************!*\
|
|
19548
|
+
!*** ./node_modules/encode-utf8/index.js ***!
|
|
19549
|
+
\*******************************************/
|
|
19550
|
+
/***/ ((module) => {
|
|
19551
|
+
|
|
19552
|
+
"use strict";
|
|
19553
|
+
|
|
19554
|
+
|
|
19555
|
+
module.exports = function encodeUtf8 (input) {
|
|
19556
|
+
var result = []
|
|
19557
|
+
var size = input.length
|
|
19558
|
+
|
|
19559
|
+
for (var index = 0; index < size; index++) {
|
|
19560
|
+
var point = input.charCodeAt(index)
|
|
19561
|
+
|
|
19562
|
+
if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {
|
|
19563
|
+
var second = input.charCodeAt(index + 1)
|
|
19564
|
+
|
|
19565
|
+
if (second >= 0xDC00 && second <= 0xDFFF) {
|
|
19566
|
+
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
19567
|
+
point = (point - 0xD800) * 0x400 + second - 0xDC00 + 0x10000
|
|
19568
|
+
index += 1
|
|
19569
|
+
}
|
|
19570
|
+
}
|
|
19571
|
+
|
|
19572
|
+
// US-ASCII
|
|
19573
|
+
if (point < 0x80) {
|
|
19574
|
+
result.push(point)
|
|
19575
|
+
continue
|
|
19576
|
+
}
|
|
19577
|
+
|
|
19578
|
+
// 2-byte UTF-8
|
|
19579
|
+
if (point < 0x800) {
|
|
19580
|
+
result.push((point >> 6) | 192)
|
|
19581
|
+
result.push((point & 63) | 128)
|
|
19582
|
+
continue
|
|
19583
|
+
}
|
|
19584
|
+
|
|
19585
|
+
// 3-byte UTF-8
|
|
19586
|
+
if (point < 0xD800 || (point >= 0xE000 && point < 0x10000)) {
|
|
19587
|
+
result.push((point >> 12) | 224)
|
|
19588
|
+
result.push(((point >> 6) & 63) | 128)
|
|
19589
|
+
result.push((point & 63) | 128)
|
|
19590
|
+
continue
|
|
19591
|
+
}
|
|
19592
|
+
|
|
19593
|
+
// 4-byte UTF-8
|
|
19594
|
+
if (point >= 0x10000 && point <= 0x10FFFF) {
|
|
19595
|
+
result.push((point >> 18) | 240)
|
|
19596
|
+
result.push(((point >> 12) & 63) | 128)
|
|
19597
|
+
result.push(((point >> 6) & 63) | 128)
|
|
19598
|
+
result.push((point & 63) | 128)
|
|
19599
|
+
continue
|
|
19600
|
+
}
|
|
19601
|
+
|
|
19602
|
+
// Invalid character
|
|
19603
|
+
result.push(0xEF, 0xBF, 0xBD)
|
|
19604
|
+
}
|
|
19605
|
+
|
|
19606
|
+
return new Uint8Array(result).buffer
|
|
19607
|
+
}
|
|
19608
|
+
|
|
19609
|
+
|
|
21532
19610
|
/***/ }),
|
|
21533
19611
|
|
|
21534
19612
|
/***/ "./node_modules/eventemitter2/lib/eventemitter2.js":
|
|
@@ -26205,116 +24283,6 @@ __export(__webpack_require__(/*! ./IsNumberValidator */ "./node_modules/fluent-t
|
|
|
26205
24283
|
__export(__webpack_require__(/*! ./IsStringValidator */ "./node_modules/fluent-ts-validator/validators/type-based/IsStringValidator.js"));
|
|
26206
24284
|
//# sourceMappingURL=index.js.map
|
|
26207
24285
|
|
|
26208
|
-
/***/ }),
|
|
26209
|
-
|
|
26210
|
-
/***/ "./node_modules/ieee754/index.js":
|
|
26211
|
-
/*!***************************************!*\
|
|
26212
|
-
!*** ./node_modules/ieee754/index.js ***!
|
|
26213
|
-
\***************************************/
|
|
26214
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
26215
|
-
|
|
26216
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
26217
|
-
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
26218
|
-
var e, m
|
|
26219
|
-
var eLen = (nBytes * 8) - mLen - 1
|
|
26220
|
-
var eMax = (1 << eLen) - 1
|
|
26221
|
-
var eBias = eMax >> 1
|
|
26222
|
-
var nBits = -7
|
|
26223
|
-
var i = isLE ? (nBytes - 1) : 0
|
|
26224
|
-
var d = isLE ? -1 : 1
|
|
26225
|
-
var s = buffer[offset + i]
|
|
26226
|
-
|
|
26227
|
-
i += d
|
|
26228
|
-
|
|
26229
|
-
e = s & ((1 << (-nBits)) - 1)
|
|
26230
|
-
s >>= (-nBits)
|
|
26231
|
-
nBits += eLen
|
|
26232
|
-
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
26233
|
-
|
|
26234
|
-
m = e & ((1 << (-nBits)) - 1)
|
|
26235
|
-
e >>= (-nBits)
|
|
26236
|
-
nBits += mLen
|
|
26237
|
-
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
26238
|
-
|
|
26239
|
-
if (e === 0) {
|
|
26240
|
-
e = 1 - eBias
|
|
26241
|
-
} else if (e === eMax) {
|
|
26242
|
-
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
26243
|
-
} else {
|
|
26244
|
-
m = m + Math.pow(2, mLen)
|
|
26245
|
-
e = e - eBias
|
|
26246
|
-
}
|
|
26247
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
26248
|
-
}
|
|
26249
|
-
|
|
26250
|
-
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
26251
|
-
var e, m, c
|
|
26252
|
-
var eLen = (nBytes * 8) - mLen - 1
|
|
26253
|
-
var eMax = (1 << eLen) - 1
|
|
26254
|
-
var eBias = eMax >> 1
|
|
26255
|
-
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
26256
|
-
var i = isLE ? 0 : (nBytes - 1)
|
|
26257
|
-
var d = isLE ? 1 : -1
|
|
26258
|
-
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
26259
|
-
|
|
26260
|
-
value = Math.abs(value)
|
|
26261
|
-
|
|
26262
|
-
if (isNaN(value) || value === Infinity) {
|
|
26263
|
-
m = isNaN(value) ? 1 : 0
|
|
26264
|
-
e = eMax
|
|
26265
|
-
} else {
|
|
26266
|
-
e = Math.floor(Math.log(value) / Math.LN2)
|
|
26267
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
26268
|
-
e--
|
|
26269
|
-
c *= 2
|
|
26270
|
-
}
|
|
26271
|
-
if (e + eBias >= 1) {
|
|
26272
|
-
value += rt / c
|
|
26273
|
-
} else {
|
|
26274
|
-
value += rt * Math.pow(2, 1 - eBias)
|
|
26275
|
-
}
|
|
26276
|
-
if (value * c >= 2) {
|
|
26277
|
-
e++
|
|
26278
|
-
c /= 2
|
|
26279
|
-
}
|
|
26280
|
-
|
|
26281
|
-
if (e + eBias >= eMax) {
|
|
26282
|
-
m = 0
|
|
26283
|
-
e = eMax
|
|
26284
|
-
} else if (e + eBias >= 1) {
|
|
26285
|
-
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
26286
|
-
e = e + eBias
|
|
26287
|
-
} else {
|
|
26288
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
26289
|
-
e = 0
|
|
26290
|
-
}
|
|
26291
|
-
}
|
|
26292
|
-
|
|
26293
|
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
26294
|
-
|
|
26295
|
-
e = (e << mLen) | m
|
|
26296
|
-
eLen += mLen
|
|
26297
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
26298
|
-
|
|
26299
|
-
buffer[offset + i - d] |= s * 128
|
|
26300
|
-
}
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
/***/ }),
|
|
26304
|
-
|
|
26305
|
-
/***/ "./node_modules/isarray/index.js":
|
|
26306
|
-
/*!***************************************!*\
|
|
26307
|
-
!*** ./node_modules/isarray/index.js ***!
|
|
26308
|
-
\***************************************/
|
|
26309
|
-
/***/ ((module) => {
|
|
26310
|
-
|
|
26311
|
-
var toString = {}.toString;
|
|
26312
|
-
|
|
26313
|
-
module.exports = Array.isArray || function (arr) {
|
|
26314
|
-
return toString.call(arr) == '[object Array]';
|
|
26315
|
-
};
|
|
26316
|
-
|
|
26317
|
-
|
|
26318
24286
|
/***/ }),
|
|
26319
24287
|
|
|
26320
24288
|
/***/ "./node_modules/json-schema-traverse/index.js":
|
|
@@ -36734,16 +34702,16 @@ exports.Zone = Zone;
|
|
|
36734
34702
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
36735
34703
|
|
|
36736
34704
|
|
|
36737
|
-
|
|
34705
|
+
const canPromise = __webpack_require__(/*! ./can-promise */ "./node_modules/qrcode/lib/can-promise.js")
|
|
36738
34706
|
|
|
36739
|
-
|
|
36740
|
-
|
|
36741
|
-
|
|
34707
|
+
const QRCode = __webpack_require__(/*! ./core/qrcode */ "./node_modules/qrcode/lib/core/qrcode.js")
|
|
34708
|
+
const CanvasRenderer = __webpack_require__(/*! ./renderer/canvas */ "./node_modules/qrcode/lib/renderer/canvas.js")
|
|
34709
|
+
const SvgRenderer = __webpack_require__(/*! ./renderer/svg-tag.js */ "./node_modules/qrcode/lib/renderer/svg-tag.js")
|
|
36742
34710
|
|
|
36743
34711
|
function renderCanvas (renderFunc, canvas, text, opts, cb) {
|
|
36744
|
-
|
|
36745
|
-
|
|
36746
|
-
|
|
34712
|
+
const args = [].slice.call(arguments, 1)
|
|
34713
|
+
const argsNum = args.length
|
|
34714
|
+
const isLastArgCb = typeof args[argsNum - 1] === 'function'
|
|
36747
34715
|
|
|
36748
34716
|
if (!isLastArgCb && !canPromise()) {
|
|
36749
34717
|
throw new Error('Callback required as last argument')
|
|
@@ -36785,7 +34753,7 @@ function renderCanvas (renderFunc, canvas, text, opts, cb) {
|
|
|
36785
34753
|
|
|
36786
34754
|
return new Promise(function (resolve, reject) {
|
|
36787
34755
|
try {
|
|
36788
|
-
|
|
34756
|
+
const data = QRCode.create(text, opts)
|
|
36789
34757
|
resolve(renderFunc(data, canvas, opts))
|
|
36790
34758
|
} catch (e) {
|
|
36791
34759
|
reject(e)
|
|
@@ -36794,7 +34762,7 @@ function renderCanvas (renderFunc, canvas, text, opts, cb) {
|
|
|
36794
34762
|
}
|
|
36795
34763
|
|
|
36796
34764
|
try {
|
|
36797
|
-
|
|
34765
|
+
const data = QRCode.create(text, opts)
|
|
36798
34766
|
cb(null, renderFunc(data, canvas, opts))
|
|
36799
34767
|
} catch (e) {
|
|
36800
34768
|
cb(e)
|
|
@@ -36846,7 +34814,7 @@ module.exports = function () {
|
|
|
36846
34814
|
* and their number depends on the symbol version.
|
|
36847
34815
|
*/
|
|
36848
34816
|
|
|
36849
|
-
|
|
34817
|
+
const getSymbolSize = (__webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js").getSymbolSize)
|
|
36850
34818
|
|
|
36851
34819
|
/**
|
|
36852
34820
|
* Calculate the row/column coordinates of the center module of each alignment pattern
|
|
@@ -36865,12 +34833,12 @@ var getSymbolSize = (__webpack_require__(/*! ./utils */ "./node_modules/qrcode/l
|
|
|
36865
34833
|
exports.getRowColCoords = function getRowColCoords (version) {
|
|
36866
34834
|
if (version === 1) return []
|
|
36867
34835
|
|
|
36868
|
-
|
|
36869
|
-
|
|
36870
|
-
|
|
36871
|
-
|
|
34836
|
+
const posCount = Math.floor(version / 7) + 2
|
|
34837
|
+
const size = getSymbolSize(version)
|
|
34838
|
+
const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2
|
|
34839
|
+
const positions = [size - 7] // Last coord is always (size - 7)
|
|
36872
34840
|
|
|
36873
|
-
for (
|
|
34841
|
+
for (let i = 1; i < posCount - 1; i++) {
|
|
36874
34842
|
positions[i] = positions[i - 1] - intervals
|
|
36875
34843
|
}
|
|
36876
34844
|
|
|
@@ -36893,21 +34861,21 @@ exports.getRowColCoords = function getRowColCoords (version) {
|
|
|
36893
34861
|
* Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
|
|
36894
34862
|
* and are not therefore used for alignment patterns.
|
|
36895
34863
|
*
|
|
36896
|
-
*
|
|
34864
|
+
* let pos = getPositions(7)
|
|
36897
34865
|
* // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
|
|
36898
34866
|
*
|
|
36899
34867
|
* @param {Number} version QR Code version
|
|
36900
34868
|
* @return {Array} Array of coordinates
|
|
36901
34869
|
*/
|
|
36902
34870
|
exports.getPositions = function getPositions (version) {
|
|
36903
|
-
|
|
36904
|
-
|
|
36905
|
-
|
|
34871
|
+
const coords = []
|
|
34872
|
+
const pos = exports.getRowColCoords(version)
|
|
34873
|
+
const posLength = pos.length
|
|
36906
34874
|
|
|
36907
|
-
for (
|
|
36908
|
-
for (
|
|
34875
|
+
for (let i = 0; i < posLength; i++) {
|
|
34876
|
+
for (let j = 0; j < posLength; j++) {
|
|
36909
34877
|
// Skip if position is occupied by finder patterns
|
|
36910
|
-
if ((i === 0 && j === 0) ||
|
|
34878
|
+
if ((i === 0 && j === 0) || // top-left
|
|
36911
34879
|
(i === 0 && j === posLength - 1) || // bottom-left
|
|
36912
34880
|
(i === posLength - 1 && j === 0)) { // top-right
|
|
36913
34881
|
continue
|
|
@@ -36929,7 +34897,7 @@ exports.getPositions = function getPositions (version) {
|
|
|
36929
34897
|
\***********************************************************/
|
|
36930
34898
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
36931
34899
|
|
|
36932
|
-
|
|
34900
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
36933
34901
|
|
|
36934
34902
|
/**
|
|
36935
34903
|
* Array of characters available in alphanumeric mode
|
|
@@ -36940,7 +34908,7 @@ var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mod
|
|
|
36940
34908
|
*
|
|
36941
34909
|
* @type {Array}
|
|
36942
34910
|
*/
|
|
36943
|
-
|
|
34911
|
+
const ALPHA_NUM_CHARS = [
|
|
36944
34912
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
36945
34913
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
36946
34914
|
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
|
@@ -36965,13 +34933,13 @@ AlphanumericData.prototype.getBitsLength = function getBitsLength () {
|
|
|
36965
34933
|
}
|
|
36966
34934
|
|
|
36967
34935
|
AlphanumericData.prototype.write = function write (bitBuffer) {
|
|
36968
|
-
|
|
34936
|
+
let i
|
|
36969
34937
|
|
|
36970
34938
|
// Input data characters are divided into groups of two characters
|
|
36971
34939
|
// and encoded as 11-bit binary codes.
|
|
36972
34940
|
for (i = 0; i + 2 <= this.data.length; i += 2) {
|
|
36973
34941
|
// The character value of the first character is multiplied by 45
|
|
36974
|
-
|
|
34942
|
+
let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45
|
|
36975
34943
|
|
|
36976
34944
|
// The character value of the second digit is added to the product
|
|
36977
34945
|
value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])
|
|
@@ -37006,12 +34974,12 @@ function BitBuffer () {
|
|
|
37006
34974
|
BitBuffer.prototype = {
|
|
37007
34975
|
|
|
37008
34976
|
get: function (index) {
|
|
37009
|
-
|
|
34977
|
+
const bufIndex = Math.floor(index / 8)
|
|
37010
34978
|
return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
|
|
37011
34979
|
},
|
|
37012
34980
|
|
|
37013
34981
|
put: function (num, length) {
|
|
37014
|
-
for (
|
|
34982
|
+
for (let i = 0; i < length; i++) {
|
|
37015
34983
|
this.putBit(((num >>> (length - i - 1)) & 1) === 1)
|
|
37016
34984
|
}
|
|
37017
34985
|
},
|
|
@@ -37021,7 +34989,7 @@ BitBuffer.prototype = {
|
|
|
37021
34989
|
},
|
|
37022
34990
|
|
|
37023
34991
|
putBit: function (bit) {
|
|
37024
|
-
|
|
34992
|
+
const bufIndex = Math.floor(this.length / 8)
|
|
37025
34993
|
if (this.buffer.length <= bufIndex) {
|
|
37026
34994
|
this.buffer.push(0)
|
|
37027
34995
|
}
|
|
@@ -37043,9 +35011,7 @@ module.exports = BitBuffer
|
|
|
37043
35011
|
/*!****************************************************!*\
|
|
37044
35012
|
!*** ./node_modules/qrcode/lib/core/bit-matrix.js ***!
|
|
37045
35013
|
\****************************************************/
|
|
37046
|
-
/***/ ((module
|
|
37047
|
-
|
|
37048
|
-
var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
|
|
35014
|
+
/***/ ((module) => {
|
|
37049
35015
|
|
|
37050
35016
|
/**
|
|
37051
35017
|
* Helper class to handle QR Code symbol modules
|
|
@@ -37058,8 +35024,8 @@ function BitMatrix (size) {
|
|
|
37058
35024
|
}
|
|
37059
35025
|
|
|
37060
35026
|
this.size = size
|
|
37061
|
-
this.data =
|
|
37062
|
-
this.reservedBit =
|
|
35027
|
+
this.data = new Uint8Array(size * size)
|
|
35028
|
+
this.reservedBit = new Uint8Array(size * size)
|
|
37063
35029
|
}
|
|
37064
35030
|
|
|
37065
35031
|
/**
|
|
@@ -37072,7 +35038,7 @@ function BitMatrix (size) {
|
|
|
37072
35038
|
* @param {Boolean} reserved
|
|
37073
35039
|
*/
|
|
37074
35040
|
BitMatrix.prototype.set = function (row, col, value, reserved) {
|
|
37075
|
-
|
|
35041
|
+
const index = row * this.size + col
|
|
37076
35042
|
this.data[index] = value
|
|
37077
35043
|
if (reserved) this.reservedBit[index] = true
|
|
37078
35044
|
}
|
|
@@ -37122,12 +35088,12 @@ module.exports = BitMatrix
|
|
|
37122
35088
|
\***************************************************/
|
|
37123
35089
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
37124
35090
|
|
|
37125
|
-
|
|
37126
|
-
|
|
35091
|
+
const encodeUtf8 = __webpack_require__(/*! encode-utf8 */ "./node_modules/encode-utf8/index.js")
|
|
35092
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
37127
35093
|
|
|
37128
35094
|
function ByteData (data) {
|
|
37129
35095
|
this.mode = Mode.BYTE
|
|
37130
|
-
this.data =
|
|
35096
|
+
this.data = new Uint8Array(encodeUtf8(data))
|
|
37131
35097
|
}
|
|
37132
35098
|
|
|
37133
35099
|
ByteData.getBitsLength = function getBitsLength (length) {
|
|
@@ -37143,7 +35109,7 @@ ByteData.prototype.getBitsLength = function getBitsLength () {
|
|
|
37143
35109
|
}
|
|
37144
35110
|
|
|
37145
35111
|
ByteData.prototype.write = function (bitBuffer) {
|
|
37146
|
-
for (
|
|
35112
|
+
for (let i = 0, l = this.data.length; i < l; i++) {
|
|
37147
35113
|
bitBuffer.put(this.data[i], 8)
|
|
37148
35114
|
}
|
|
37149
35115
|
}
|
|
@@ -37159,9 +35125,9 @@ module.exports = ByteData
|
|
|
37159
35125
|
\***************************************************************/
|
|
37160
35126
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37161
35127
|
|
|
37162
|
-
|
|
35128
|
+
const ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
|
37163
35129
|
|
|
37164
|
-
|
|
35130
|
+
const EC_BLOCKS_TABLE = [
|
|
37165
35131
|
// L M Q H
|
|
37166
35132
|
1, 1, 1, 1,
|
|
37167
35133
|
1, 1, 1, 1,
|
|
@@ -37205,7 +35171,7 @@ var EC_BLOCKS_TABLE = [
|
|
|
37205
35171
|
25, 49, 68, 81
|
|
37206
35172
|
]
|
|
37207
35173
|
|
|
37208
|
-
|
|
35174
|
+
const EC_CODEWORDS_TABLE = [
|
|
37209
35175
|
// L M Q H
|
|
37210
35176
|
7, 10, 13, 17,
|
|
37211
35177
|
10, 16, 22, 28,
|
|
@@ -37314,7 +35280,7 @@ function fromString (string) {
|
|
|
37314
35280
|
throw new Error('Param is not a string')
|
|
37315
35281
|
}
|
|
37316
35282
|
|
|
37317
|
-
|
|
35283
|
+
const lcStr = string.toLowerCase()
|
|
37318
35284
|
|
|
37319
35285
|
switch (lcStr) {
|
|
37320
35286
|
case 'l':
|
|
@@ -37364,8 +35330,8 @@ exports.from = function from (value, defaultValue) {
|
|
|
37364
35330
|
\********************************************************/
|
|
37365
35331
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37366
35332
|
|
|
37367
|
-
|
|
37368
|
-
|
|
35333
|
+
const getSymbolSize = (__webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js").getSymbolSize)
|
|
35334
|
+
const FINDER_PATTERN_SIZE = 7
|
|
37369
35335
|
|
|
37370
35336
|
/**
|
|
37371
35337
|
* Returns an array containing the positions of each finder pattern.
|
|
@@ -37375,7 +35341,7 @@ var FINDER_PATTERN_SIZE = 7
|
|
|
37375
35341
|
* @return {Array} Array of coordinates
|
|
37376
35342
|
*/
|
|
37377
35343
|
exports.getPositions = function getPositions (version) {
|
|
37378
|
-
|
|
35344
|
+
const size = getSymbolSize(version)
|
|
37379
35345
|
|
|
37380
35346
|
return [
|
|
37381
35347
|
// top-left
|
|
@@ -37396,11 +35362,11 @@ exports.getPositions = function getPositions (version) {
|
|
|
37396
35362
|
\*****************************************************/
|
|
37397
35363
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37398
35364
|
|
|
37399
|
-
|
|
35365
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js")
|
|
37400
35366
|
|
|
37401
|
-
|
|
37402
|
-
|
|
37403
|
-
|
|
35367
|
+
const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)
|
|
35368
|
+
const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)
|
|
35369
|
+
const G15_BCH = Utils.getBCHDigit(G15)
|
|
37404
35370
|
|
|
37405
35371
|
/**
|
|
37406
35372
|
* Returns format information with relative error correction bits
|
|
@@ -37413,8 +35379,8 @@ var G15_BCH = Utils.getBCHDigit(G15)
|
|
|
37413
35379
|
* @return {Number} Encoded format information bits
|
|
37414
35380
|
*/
|
|
37415
35381
|
exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
|
|
37416
|
-
|
|
37417
|
-
|
|
35382
|
+
const data = ((errorCorrectionLevel.bit << 3) | mask)
|
|
35383
|
+
let d = data << 10
|
|
37418
35384
|
|
|
37419
35385
|
while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
|
|
37420
35386
|
d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))
|
|
@@ -37433,12 +35399,10 @@ exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
|
|
|
37433
35399
|
/*!******************************************************!*\
|
|
37434
35400
|
!*** ./node_modules/qrcode/lib/core/galois-field.js ***!
|
|
37435
35401
|
\******************************************************/
|
|
37436
|
-
/***/ ((__unused_webpack_module, exports
|
|
37437
|
-
|
|
37438
|
-
var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
|
|
35402
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
37439
35403
|
|
|
37440
|
-
|
|
37441
|
-
|
|
35404
|
+
const EXP_TABLE = new Uint8Array(512)
|
|
35405
|
+
const LOG_TABLE = new Uint8Array(256)
|
|
37442
35406
|
/**
|
|
37443
35407
|
* Precompute the log and anti-log tables for faster computation later
|
|
37444
35408
|
*
|
|
@@ -37448,8 +35412,8 @@ var LOG_TABLE = BufferUtil.alloc(256)
|
|
|
37448
35412
|
* ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
|
|
37449
35413
|
*/
|
|
37450
35414
|
;(function initTables () {
|
|
37451
|
-
|
|
37452
|
-
for (
|
|
35415
|
+
let x = 1
|
|
35416
|
+
for (let i = 0; i < 255; i++) {
|
|
37453
35417
|
EXP_TABLE[i] = x
|
|
37454
35418
|
LOG_TABLE[x] = i
|
|
37455
35419
|
|
|
@@ -37466,7 +35430,7 @@ var LOG_TABLE = BufferUtil.alloc(256)
|
|
|
37466
35430
|
// stay inside the bounds (because we will mainly use this table for the multiplication of
|
|
37467
35431
|
// two GF numbers, no more).
|
|
37468
35432
|
// @see {@link mul}
|
|
37469
|
-
for (i = 255; i < 512; i++) {
|
|
35433
|
+
for (let i = 255; i < 512; i++) {
|
|
37470
35434
|
EXP_TABLE[i] = EXP_TABLE[i - 255]
|
|
37471
35435
|
}
|
|
37472
35436
|
}())
|
|
@@ -37516,8 +35480,8 @@ exports.mul = function mul (x, y) {
|
|
|
37516
35480
|
\****************************************************/
|
|
37517
35481
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
37518
35482
|
|
|
37519
|
-
|
|
37520
|
-
|
|
35483
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
35484
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js")
|
|
37521
35485
|
|
|
37522
35486
|
function KanjiData (data) {
|
|
37523
35487
|
this.mode = Mode.KANJI
|
|
@@ -37537,13 +35501,13 @@ KanjiData.prototype.getBitsLength = function getBitsLength () {
|
|
|
37537
35501
|
}
|
|
37538
35502
|
|
|
37539
35503
|
KanjiData.prototype.write = function (bitBuffer) {
|
|
37540
|
-
|
|
35504
|
+
let i
|
|
37541
35505
|
|
|
37542
35506
|
// In the Shift JIS system, Kanji characters are represented by a two byte combination.
|
|
37543
35507
|
// These byte values are shifted from the JIS X 0208 values.
|
|
37544
35508
|
// JIS X 0208 gives details of the shift coded representation.
|
|
37545
35509
|
for (i = 0; i < this.data.length; i++) {
|
|
37546
|
-
|
|
35510
|
+
let value = Utils.toSJIS(this.data[i])
|
|
37547
35511
|
|
|
37548
35512
|
// For characters with Shift JIS values from 0x8140 to 0x9FFC:
|
|
37549
35513
|
if (value >= 0x8140 && value <= 0x9FFC) {
|
|
@@ -37599,7 +35563,7 @@ exports.Patterns = {
|
|
|
37599
35563
|
* Weighted penalty scores for the undesirable features
|
|
37600
35564
|
* @type {Object}
|
|
37601
35565
|
*/
|
|
37602
|
-
|
|
35566
|
+
const PenaltyScores = {
|
|
37603
35567
|
N1: 3,
|
|
37604
35568
|
N2: 3,
|
|
37605
35569
|
N3: 40,
|
|
@@ -37635,19 +35599,19 @@ exports.from = function from (value) {
|
|
|
37635
35599
|
* i is the amount by which the number of adjacent modules of the same color exceeds 5
|
|
37636
35600
|
*/
|
|
37637
35601
|
exports.getPenaltyN1 = function getPenaltyN1 (data) {
|
|
37638
|
-
|
|
37639
|
-
|
|
37640
|
-
|
|
37641
|
-
|
|
37642
|
-
|
|
37643
|
-
|
|
37644
|
-
|
|
37645
|
-
for (
|
|
35602
|
+
const size = data.size
|
|
35603
|
+
let points = 0
|
|
35604
|
+
let sameCountCol = 0
|
|
35605
|
+
let sameCountRow = 0
|
|
35606
|
+
let lastCol = null
|
|
35607
|
+
let lastRow = null
|
|
35608
|
+
|
|
35609
|
+
for (let row = 0; row < size; row++) {
|
|
37646
35610
|
sameCountCol = sameCountRow = 0
|
|
37647
35611
|
lastCol = lastRow = null
|
|
37648
35612
|
|
|
37649
|
-
for (
|
|
37650
|
-
|
|
35613
|
+
for (let col = 0; col < size; col++) {
|
|
35614
|
+
let module = data.get(row, col)
|
|
37651
35615
|
if (module === lastCol) {
|
|
37652
35616
|
sameCountCol++
|
|
37653
35617
|
} else {
|
|
@@ -37679,12 +35643,12 @@ exports.getPenaltyN1 = function getPenaltyN1 (data) {
|
|
|
37679
35643
|
* Points: N2 * (m - 1) * (n - 1)
|
|
37680
35644
|
*/
|
|
37681
35645
|
exports.getPenaltyN2 = function getPenaltyN2 (data) {
|
|
37682
|
-
|
|
37683
|
-
|
|
35646
|
+
const size = data.size
|
|
35647
|
+
let points = 0
|
|
37684
35648
|
|
|
37685
|
-
for (
|
|
37686
|
-
for (
|
|
37687
|
-
|
|
35649
|
+
for (let row = 0; row < size - 1; row++) {
|
|
35650
|
+
for (let col = 0; col < size - 1; col++) {
|
|
35651
|
+
const last = data.get(row, col) +
|
|
37688
35652
|
data.get(row, col + 1) +
|
|
37689
35653
|
data.get(row + 1, col) +
|
|
37690
35654
|
data.get(row + 1, col + 1)
|
|
@@ -37703,14 +35667,14 @@ exports.getPenaltyN2 = function getPenaltyN2 (data) {
|
|
|
37703
35667
|
* Points: N3 * number of pattern found
|
|
37704
35668
|
*/
|
|
37705
35669
|
exports.getPenaltyN3 = function getPenaltyN3 (data) {
|
|
37706
|
-
|
|
37707
|
-
|
|
37708
|
-
|
|
37709
|
-
|
|
35670
|
+
const size = data.size
|
|
35671
|
+
let points = 0
|
|
35672
|
+
let bitsCol = 0
|
|
35673
|
+
let bitsRow = 0
|
|
37710
35674
|
|
|
37711
|
-
for (
|
|
35675
|
+
for (let row = 0; row < size; row++) {
|
|
37712
35676
|
bitsCol = bitsRow = 0
|
|
37713
|
-
for (
|
|
35677
|
+
for (let col = 0; col < size; col++) {
|
|
37714
35678
|
bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)
|
|
37715
35679
|
if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++
|
|
37716
35680
|
|
|
@@ -37731,12 +35695,12 @@ exports.getPenaltyN3 = function getPenaltyN3 (data) {
|
|
|
37731
35695
|
* in the symbol from 50% in steps of 5%
|
|
37732
35696
|
*/
|
|
37733
35697
|
exports.getPenaltyN4 = function getPenaltyN4 (data) {
|
|
37734
|
-
|
|
37735
|
-
|
|
35698
|
+
let darkCount = 0
|
|
35699
|
+
const modulesCount = data.data.length
|
|
37736
35700
|
|
|
37737
|
-
for (
|
|
35701
|
+
for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]
|
|
37738
35702
|
|
|
37739
|
-
|
|
35703
|
+
const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)
|
|
37740
35704
|
|
|
37741
35705
|
return k * PenaltyScores.N4
|
|
37742
35706
|
}
|
|
@@ -37771,10 +35735,10 @@ function getMaskAt (maskPattern, i, j) {
|
|
|
37771
35735
|
* @param {BitMatrix} data BitMatrix data
|
|
37772
35736
|
*/
|
|
37773
35737
|
exports.applyMask = function applyMask (pattern, data) {
|
|
37774
|
-
|
|
35738
|
+
const size = data.size
|
|
37775
35739
|
|
|
37776
|
-
for (
|
|
37777
|
-
for (
|
|
35740
|
+
for (let col = 0; col < size; col++) {
|
|
35741
|
+
for (let row = 0; row < size; row++) {
|
|
37778
35742
|
if (data.isReserved(row, col)) continue
|
|
37779
35743
|
data.xor(row, col, getMaskAt(pattern, row, col))
|
|
37780
35744
|
}
|
|
@@ -37788,16 +35752,16 @@ exports.applyMask = function applyMask (pattern, data) {
|
|
|
37788
35752
|
* @return {Number} Mask pattern reference number
|
|
37789
35753
|
*/
|
|
37790
35754
|
exports.getBestMask = function getBestMask (data, setupFormatFunc) {
|
|
37791
|
-
|
|
37792
|
-
|
|
37793
|
-
|
|
35755
|
+
const numPatterns = Object.keys(exports.Patterns).length
|
|
35756
|
+
let bestPattern = 0
|
|
35757
|
+
let lowerPenalty = Infinity
|
|
37794
35758
|
|
|
37795
|
-
for (
|
|
35759
|
+
for (let p = 0; p < numPatterns; p++) {
|
|
37796
35760
|
setupFormatFunc(p)
|
|
37797
35761
|
exports.applyMask(p, data)
|
|
37798
35762
|
|
|
37799
35763
|
// Calculate penalty
|
|
37800
|
-
|
|
35764
|
+
const penalty =
|
|
37801
35765
|
exports.getPenaltyN1(data) +
|
|
37802
35766
|
exports.getPenaltyN2(data) +
|
|
37803
35767
|
exports.getPenaltyN3(data) +
|
|
@@ -37824,8 +35788,8 @@ exports.getBestMask = function getBestMask (data, setupFormatFunc) {
|
|
|
37824
35788
|
\**********************************************/
|
|
37825
35789
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37826
35790
|
|
|
37827
|
-
|
|
37828
|
-
|
|
35791
|
+
const VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
|
|
35792
|
+
const Regex = __webpack_require__(/*! ./regex */ "./node_modules/qrcode/lib/core/regex.js")
|
|
37829
35793
|
|
|
37830
35794
|
/**
|
|
37831
35795
|
* Numeric mode encodes data from the decimal digit set (0 - 9)
|
|
@@ -37956,7 +35920,7 @@ function fromString (string) {
|
|
|
37956
35920
|
throw new Error('Param is not a string')
|
|
37957
35921
|
}
|
|
37958
35922
|
|
|
37959
|
-
|
|
35923
|
+
const lcStr = string.toLowerCase()
|
|
37960
35924
|
|
|
37961
35925
|
switch (lcStr) {
|
|
37962
35926
|
case 'numeric':
|
|
@@ -38001,7 +35965,7 @@ exports.from = function from (value, defaultValue) {
|
|
|
38001
35965
|
\******************************************************/
|
|
38002
35966
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38003
35967
|
|
|
38004
|
-
|
|
35968
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
38005
35969
|
|
|
38006
35970
|
function NumericData (data) {
|
|
38007
35971
|
this.mode = Mode.NUMERIC
|
|
@@ -38021,7 +35985,7 @@ NumericData.prototype.getBitsLength = function getBitsLength () {
|
|
|
38021
35985
|
}
|
|
38022
35986
|
|
|
38023
35987
|
NumericData.prototype.write = function write (bitBuffer) {
|
|
38024
|
-
|
|
35988
|
+
let i, group, value
|
|
38025
35989
|
|
|
38026
35990
|
// The input data string is divided into groups of three digits,
|
|
38027
35991
|
// and each group is converted to its 10-bit binary equivalent.
|
|
@@ -38034,7 +35998,7 @@ NumericData.prototype.write = function write (bitBuffer) {
|
|
|
38034
35998
|
|
|
38035
35999
|
// If the number of input digits is not an exact multiple of three,
|
|
38036
36000
|
// the final one or two digits are converted to 4 or 7 bits respectively.
|
|
38037
|
-
|
|
36001
|
+
const remainingNum = this.data.length - i
|
|
38038
36002
|
if (remainingNum > 0) {
|
|
38039
36003
|
group = this.data.substr(i)
|
|
38040
36004
|
value = parseInt(group, 10)
|
|
@@ -38054,21 +36018,20 @@ module.exports = NumericData
|
|
|
38054
36018
|
\****************************************************/
|
|
38055
36019
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
38056
36020
|
|
|
38057
|
-
|
|
38058
|
-
var GF = __webpack_require__(/*! ./galois-field */ "./node_modules/qrcode/lib/core/galois-field.js")
|
|
36021
|
+
const GF = __webpack_require__(/*! ./galois-field */ "./node_modules/qrcode/lib/core/galois-field.js")
|
|
38059
36022
|
|
|
38060
36023
|
/**
|
|
38061
36024
|
* Multiplies two polynomials inside Galois Field
|
|
38062
36025
|
*
|
|
38063
|
-
* @param {
|
|
38064
|
-
* @param {
|
|
38065
|
-
* @return {
|
|
36026
|
+
* @param {Uint8Array} p1 Polynomial
|
|
36027
|
+
* @param {Uint8Array} p2 Polynomial
|
|
36028
|
+
* @return {Uint8Array} Product of p1 and p2
|
|
38066
36029
|
*/
|
|
38067
36030
|
exports.mul = function mul (p1, p2) {
|
|
38068
|
-
|
|
36031
|
+
const coeff = new Uint8Array(p1.length + p2.length - 1)
|
|
38069
36032
|
|
|
38070
|
-
for (
|
|
38071
|
-
for (
|
|
36033
|
+
for (let i = 0; i < p1.length; i++) {
|
|
36034
|
+
for (let j = 0; j < p2.length; j++) {
|
|
38072
36035
|
coeff[i + j] ^= GF.mul(p1[i], p2[j])
|
|
38073
36036
|
}
|
|
38074
36037
|
}
|
|
@@ -38079,22 +36042,22 @@ exports.mul = function mul (p1, p2) {
|
|
|
38079
36042
|
/**
|
|
38080
36043
|
* Calculate the remainder of polynomials division
|
|
38081
36044
|
*
|
|
38082
|
-
* @param {
|
|
38083
|
-
* @param {
|
|
38084
|
-
* @return {
|
|
36045
|
+
* @param {Uint8Array} divident Polynomial
|
|
36046
|
+
* @param {Uint8Array} divisor Polynomial
|
|
36047
|
+
* @return {Uint8Array} Remainder
|
|
38085
36048
|
*/
|
|
38086
36049
|
exports.mod = function mod (divident, divisor) {
|
|
38087
|
-
|
|
36050
|
+
let result = new Uint8Array(divident)
|
|
38088
36051
|
|
|
38089
36052
|
while ((result.length - divisor.length) >= 0) {
|
|
38090
|
-
|
|
36053
|
+
const coeff = result[0]
|
|
38091
36054
|
|
|
38092
|
-
for (
|
|
36055
|
+
for (let i = 0; i < divisor.length; i++) {
|
|
38093
36056
|
result[i] ^= GF.mul(divisor[i], coeff)
|
|
38094
36057
|
}
|
|
38095
36058
|
|
|
38096
36059
|
// remove all zeros from buffer head
|
|
38097
|
-
|
|
36060
|
+
let offset = 0
|
|
38098
36061
|
while (offset < result.length && result[offset] === 0) offset++
|
|
38099
36062
|
result = result.slice(offset)
|
|
38100
36063
|
}
|
|
@@ -38107,12 +36070,12 @@ exports.mod = function mod (divident, divisor) {
|
|
|
38107
36070
|
* (used by Reed-Solomon encoder)
|
|
38108
36071
|
*
|
|
38109
36072
|
* @param {Number} degree Degree of the generator polynomial
|
|
38110
|
-
* @return {
|
|
36073
|
+
* @return {Uint8Array} Buffer containing polynomial coefficients
|
|
38111
36074
|
*/
|
|
38112
36075
|
exports.generateECPolynomial = function generateECPolynomial (degree) {
|
|
38113
|
-
|
|
38114
|
-
for (
|
|
38115
|
-
poly = exports.mul(poly, [1, GF.exp(i)])
|
|
36076
|
+
let poly = new Uint8Array([1])
|
|
36077
|
+
for (let i = 0; i < degree; i++) {
|
|
36078
|
+
poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]))
|
|
38116
36079
|
}
|
|
38117
36080
|
|
|
38118
36081
|
return poly
|
|
@@ -38127,21 +36090,19 @@ exports.generateECPolynomial = function generateECPolynomial (degree) {
|
|
|
38127
36090
|
\************************************************/
|
|
38128
36091
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
38129
36092
|
|
|
38130
|
-
|
|
38131
|
-
|
|
38132
|
-
|
|
38133
|
-
|
|
38134
|
-
|
|
38135
|
-
|
|
38136
|
-
|
|
38137
|
-
|
|
38138
|
-
|
|
38139
|
-
|
|
38140
|
-
|
|
38141
|
-
|
|
38142
|
-
|
|
38143
|
-
var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
|
|
38144
|
-
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
|
36093
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js")
|
|
36094
|
+
const ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
|
36095
|
+
const BitBuffer = __webpack_require__(/*! ./bit-buffer */ "./node_modules/qrcode/lib/core/bit-buffer.js")
|
|
36096
|
+
const BitMatrix = __webpack_require__(/*! ./bit-matrix */ "./node_modules/qrcode/lib/core/bit-matrix.js")
|
|
36097
|
+
const AlignmentPattern = __webpack_require__(/*! ./alignment-pattern */ "./node_modules/qrcode/lib/core/alignment-pattern.js")
|
|
36098
|
+
const FinderPattern = __webpack_require__(/*! ./finder-pattern */ "./node_modules/qrcode/lib/core/finder-pattern.js")
|
|
36099
|
+
const MaskPattern = __webpack_require__(/*! ./mask-pattern */ "./node_modules/qrcode/lib/core/mask-pattern.js")
|
|
36100
|
+
const ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/qrcode/lib/core/error-correction-code.js")
|
|
36101
|
+
const ReedSolomonEncoder = __webpack_require__(/*! ./reed-solomon-encoder */ "./node_modules/qrcode/lib/core/reed-solomon-encoder.js")
|
|
36102
|
+
const Version = __webpack_require__(/*! ./version */ "./node_modules/qrcode/lib/core/version.js")
|
|
36103
|
+
const FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js")
|
|
36104
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
36105
|
+
const Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
|
|
38145
36106
|
|
|
38146
36107
|
/**
|
|
38147
36108
|
* QRCode for JavaScript
|
|
@@ -38176,17 +36137,17 @@ var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.j
|
|
|
38176
36137
|
* @param {Number} version QR Code version
|
|
38177
36138
|
*/
|
|
38178
36139
|
function setupFinderPattern (matrix, version) {
|
|
38179
|
-
|
|
38180
|
-
|
|
36140
|
+
const size = matrix.size
|
|
36141
|
+
const pos = FinderPattern.getPositions(version)
|
|
38181
36142
|
|
|
38182
|
-
for (
|
|
38183
|
-
|
|
38184
|
-
|
|
36143
|
+
for (let i = 0; i < pos.length; i++) {
|
|
36144
|
+
const row = pos[i][0]
|
|
36145
|
+
const col = pos[i][1]
|
|
38185
36146
|
|
|
38186
|
-
for (
|
|
36147
|
+
for (let r = -1; r <= 7; r++) {
|
|
38187
36148
|
if (row + r <= -1 || size <= row + r) continue
|
|
38188
36149
|
|
|
38189
|
-
for (
|
|
36150
|
+
for (let c = -1; c <= 7; c++) {
|
|
38190
36151
|
if (col + c <= -1 || size <= col + c) continue
|
|
38191
36152
|
|
|
38192
36153
|
if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
|
|
@@ -38209,10 +36170,10 @@ function setupFinderPattern (matrix, version) {
|
|
|
38209
36170
|
* @param {BitMatrix} matrix Modules matrix
|
|
38210
36171
|
*/
|
|
38211
36172
|
function setupTimingPattern (matrix) {
|
|
38212
|
-
|
|
36173
|
+
const size = matrix.size
|
|
38213
36174
|
|
|
38214
|
-
for (
|
|
38215
|
-
|
|
36175
|
+
for (let r = 8; r < size - 8; r++) {
|
|
36176
|
+
const value = r % 2 === 0
|
|
38216
36177
|
matrix.set(r, 6, value, true)
|
|
38217
36178
|
matrix.set(6, r, value, true)
|
|
38218
36179
|
}
|
|
@@ -38227,14 +36188,14 @@ function setupTimingPattern (matrix) {
|
|
|
38227
36188
|
* @param {Number} version QR Code version
|
|
38228
36189
|
*/
|
|
38229
36190
|
function setupAlignmentPattern (matrix, version) {
|
|
38230
|
-
|
|
36191
|
+
const pos = AlignmentPattern.getPositions(version)
|
|
38231
36192
|
|
|
38232
|
-
for (
|
|
38233
|
-
|
|
38234
|
-
|
|
36193
|
+
for (let i = 0; i < pos.length; i++) {
|
|
36194
|
+
const row = pos[i][0]
|
|
36195
|
+
const col = pos[i][1]
|
|
38235
36196
|
|
|
38236
|
-
for (
|
|
38237
|
-
for (
|
|
36197
|
+
for (let r = -2; r <= 2; r++) {
|
|
36198
|
+
for (let c = -2; c <= 2; c++) {
|
|
38238
36199
|
if (r === -2 || r === 2 || c === -2 || c === 2 ||
|
|
38239
36200
|
(r === 0 && c === 0)) {
|
|
38240
36201
|
matrix.set(row + r, col + c, true, true)
|
|
@@ -38253,11 +36214,11 @@ function setupAlignmentPattern (matrix, version) {
|
|
|
38253
36214
|
* @param {Number} version QR Code version
|
|
38254
36215
|
*/
|
|
38255
36216
|
function setupVersionInfo (matrix, version) {
|
|
38256
|
-
|
|
38257
|
-
|
|
38258
|
-
|
|
36217
|
+
const size = matrix.size
|
|
36218
|
+
const bits = Version.getEncodedBits(version)
|
|
36219
|
+
let row, col, mod
|
|
38259
36220
|
|
|
38260
|
-
for (
|
|
36221
|
+
for (let i = 0; i < 18; i++) {
|
|
38261
36222
|
row = Math.floor(i / 3)
|
|
38262
36223
|
col = i % 3 + size - 8 - 3
|
|
38263
36224
|
mod = ((bits >> i) & 1) === 1
|
|
@@ -38275,9 +36236,9 @@ function setupVersionInfo (matrix, version) {
|
|
|
38275
36236
|
* @param {Number} maskPattern Mask pattern reference value
|
|
38276
36237
|
*/
|
|
38277
36238
|
function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
|
|
38278
|
-
|
|
38279
|
-
|
|
38280
|
-
|
|
36239
|
+
const size = matrix.size
|
|
36240
|
+
const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)
|
|
36241
|
+
let i, mod
|
|
38281
36242
|
|
|
38282
36243
|
for (i = 0; i < 15; i++) {
|
|
38283
36244
|
mod = ((bits >> i) & 1) === 1
|
|
@@ -38308,23 +36269,23 @@ function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
|
|
|
38308
36269
|
/**
|
|
38309
36270
|
* Add encoded data bits to matrix
|
|
38310
36271
|
*
|
|
38311
|
-
* @param {BitMatrix}
|
|
38312
|
-
* @param {
|
|
36272
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
36273
|
+
* @param {Uint8Array} data Data codewords
|
|
38313
36274
|
*/
|
|
38314
36275
|
function setupData (matrix, data) {
|
|
38315
|
-
|
|
38316
|
-
|
|
38317
|
-
|
|
38318
|
-
|
|
38319
|
-
|
|
36276
|
+
const size = matrix.size
|
|
36277
|
+
let inc = -1
|
|
36278
|
+
let row = size - 1
|
|
36279
|
+
let bitIndex = 7
|
|
36280
|
+
let byteIndex = 0
|
|
38320
36281
|
|
|
38321
|
-
for (
|
|
36282
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
38322
36283
|
if (col === 6) col--
|
|
38323
36284
|
|
|
38324
36285
|
while (true) {
|
|
38325
|
-
for (
|
|
36286
|
+
for (let c = 0; c < 2; c++) {
|
|
38326
36287
|
if (!matrix.isReserved(row, col - c)) {
|
|
38327
|
-
|
|
36288
|
+
let dark = false
|
|
38328
36289
|
|
|
38329
36290
|
if (byteIndex < data.length) {
|
|
38330
36291
|
dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)
|
|
@@ -38357,11 +36318,11 @@ function setupData (matrix, data) {
|
|
|
38357
36318
|
* @param {Number} version QR Code version
|
|
38358
36319
|
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
38359
36320
|
* @param {ByteData} data Data input
|
|
38360
|
-
* @return {
|
|
36321
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
38361
36322
|
*/
|
|
38362
36323
|
function createData (version, errorCorrectionLevel, segments) {
|
|
38363
36324
|
// Prepare data buffer
|
|
38364
|
-
|
|
36325
|
+
const buffer = new BitBuffer()
|
|
38365
36326
|
|
|
38366
36327
|
segments.forEach(function (data) {
|
|
38367
36328
|
// prefix data with mode indicator (4 bits)
|
|
@@ -38381,9 +36342,9 @@ function createData (version, errorCorrectionLevel, segments) {
|
|
|
38381
36342
|
})
|
|
38382
36343
|
|
|
38383
36344
|
// Calculate required number of bits
|
|
38384
|
-
|
|
38385
|
-
|
|
38386
|
-
|
|
36345
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
36346
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
36347
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
|
|
38387
36348
|
|
|
38388
36349
|
// Add a terminator.
|
|
38389
36350
|
// If the bit string is shorter than the total number of required bits,
|
|
@@ -38407,8 +36368,8 @@ function createData (version, errorCorrectionLevel, segments) {
|
|
|
38407
36368
|
// Extend the buffer to fill the data capacity of the symbol corresponding to
|
|
38408
36369
|
// the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
|
|
38409
36370
|
// and 00010001 (0x11) alternately.
|
|
38410
|
-
|
|
38411
|
-
for (
|
|
36371
|
+
const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8
|
|
36372
|
+
for (let i = 0; i < remainingByte; i++) {
|
|
38412
36373
|
buffer.put(i % 2 ? 0x11 : 0xEC, 8)
|
|
38413
36374
|
}
|
|
38414
36375
|
|
|
@@ -38422,45 +36383,45 @@ function createData (version, errorCorrectionLevel, segments) {
|
|
|
38422
36383
|
* @param {BitBuffer} bitBuffer Data to encode
|
|
38423
36384
|
* @param {Number} version QR Code version
|
|
38424
36385
|
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
38425
|
-
* @return {
|
|
36386
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
38426
36387
|
*/
|
|
38427
36388
|
function createCodewords (bitBuffer, version, errorCorrectionLevel) {
|
|
38428
36389
|
// Total codewords for this QR code version (Data + Error correction)
|
|
38429
|
-
|
|
36390
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
38430
36391
|
|
|
38431
36392
|
// Total number of error correction codewords
|
|
38432
|
-
|
|
36393
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
38433
36394
|
|
|
38434
36395
|
// Total number of data codewords
|
|
38435
|
-
|
|
36396
|
+
const dataTotalCodewords = totalCodewords - ecTotalCodewords
|
|
38436
36397
|
|
|
38437
36398
|
// Total number of blocks
|
|
38438
|
-
|
|
36399
|
+
const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)
|
|
38439
36400
|
|
|
38440
36401
|
// Calculate how many blocks each group should contain
|
|
38441
|
-
|
|
38442
|
-
|
|
36402
|
+
const blocksInGroup2 = totalCodewords % ecTotalBlocks
|
|
36403
|
+
const blocksInGroup1 = ecTotalBlocks - blocksInGroup2
|
|
38443
36404
|
|
|
38444
|
-
|
|
36405
|
+
const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)
|
|
38445
36406
|
|
|
38446
|
-
|
|
38447
|
-
|
|
36407
|
+
const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)
|
|
36408
|
+
const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1
|
|
38448
36409
|
|
|
38449
36410
|
// Number of EC codewords is the same for both groups
|
|
38450
|
-
|
|
36411
|
+
const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1
|
|
38451
36412
|
|
|
38452
36413
|
// Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
|
|
38453
|
-
|
|
36414
|
+
const rs = new ReedSolomonEncoder(ecCount)
|
|
38454
36415
|
|
|
38455
|
-
|
|
38456
|
-
|
|
38457
|
-
|
|
38458
|
-
|
|
38459
|
-
|
|
36416
|
+
let offset = 0
|
|
36417
|
+
const dcData = new Array(ecTotalBlocks)
|
|
36418
|
+
const ecData = new Array(ecTotalBlocks)
|
|
36419
|
+
let maxDataSize = 0
|
|
36420
|
+
const buffer = new Uint8Array(bitBuffer.buffer)
|
|
38460
36421
|
|
|
38461
36422
|
// Divide the buffer into the required number of blocks
|
|
38462
|
-
for (
|
|
38463
|
-
|
|
36423
|
+
for (let b = 0; b < ecTotalBlocks; b++) {
|
|
36424
|
+
const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2
|
|
38464
36425
|
|
|
38465
36426
|
// extract a block of data from buffer
|
|
38466
36427
|
dcData[b] = buffer.slice(offset, offset + dataSize)
|
|
@@ -38474,9 +36435,9 @@ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
|
|
|
38474
36435
|
|
|
38475
36436
|
// Create final data
|
|
38476
36437
|
// Interleave the data and error correction codewords from each block
|
|
38477
|
-
|
|
38478
|
-
|
|
38479
|
-
|
|
36438
|
+
const data = new Uint8Array(totalCodewords)
|
|
36439
|
+
let index = 0
|
|
36440
|
+
let i, r
|
|
38480
36441
|
|
|
38481
36442
|
// Add data codewords
|
|
38482
36443
|
for (i = 0; i < maxDataSize; i++) {
|
|
@@ -38507,19 +36468,18 @@ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
|
|
|
38507
36468
|
* @return {Object} Object containing symbol data
|
|
38508
36469
|
*/
|
|
38509
36470
|
function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
|
|
38510
|
-
|
|
36471
|
+
let segments
|
|
38511
36472
|
|
|
38512
|
-
if (isArray(data)) {
|
|
36473
|
+
if (Array.isArray(data)) {
|
|
38513
36474
|
segments = Segments.fromArray(data)
|
|
38514
36475
|
} else if (typeof data === 'string') {
|
|
38515
|
-
|
|
36476
|
+
let estimatedVersion = version
|
|
38516
36477
|
|
|
38517
36478
|
if (!estimatedVersion) {
|
|
38518
|
-
|
|
36479
|
+
const rawSegments = Segments.rawSplit(data)
|
|
38519
36480
|
|
|
38520
36481
|
// Estimate best version that can contain raw splitted segments
|
|
38521
|
-
estimatedVersion = Version.getBestVersionForData(rawSegments,
|
|
38522
|
-
errorCorrectionLevel)
|
|
36482
|
+
estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)
|
|
38523
36483
|
}
|
|
38524
36484
|
|
|
38525
36485
|
// Build optimized segments
|
|
@@ -38530,8 +36490,7 @@ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
|
|
|
38530
36490
|
}
|
|
38531
36491
|
|
|
38532
36492
|
// Get the min version that can contain data
|
|
38533
|
-
|
|
38534
|
-
errorCorrectionLevel)
|
|
36493
|
+
const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)
|
|
38535
36494
|
|
|
38536
36495
|
// If no version is found, data cannot be stored
|
|
38537
36496
|
if (!bestVersion) {
|
|
@@ -38550,11 +36509,11 @@ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
|
|
|
38550
36509
|
)
|
|
38551
36510
|
}
|
|
38552
36511
|
|
|
38553
|
-
|
|
36512
|
+
const dataBits = createData(version, errorCorrectionLevel, segments)
|
|
38554
36513
|
|
|
38555
36514
|
// Allocate matrix buffer
|
|
38556
|
-
|
|
38557
|
-
|
|
36515
|
+
const moduleCount = Utils.getSymbolSize(version)
|
|
36516
|
+
const modules = new BitMatrix(moduleCount)
|
|
38558
36517
|
|
|
38559
36518
|
// Add function modules
|
|
38560
36519
|
setupFinderPattern(modules, version)
|
|
@@ -38609,9 +36568,9 @@ exports.create = function create (data, options) {
|
|
|
38609
36568
|
throw new Error('No input text')
|
|
38610
36569
|
}
|
|
38611
36570
|
|
|
38612
|
-
|
|
38613
|
-
|
|
38614
|
-
|
|
36571
|
+
let errorCorrectionLevel = ECLevel.M
|
|
36572
|
+
let version
|
|
36573
|
+
let mask
|
|
38615
36574
|
|
|
38616
36575
|
if (typeof options !== 'undefined') {
|
|
38617
36576
|
// Use higher error correction level as default
|
|
@@ -38636,9 +36595,7 @@ exports.create = function create (data, options) {
|
|
|
38636
36595
|
\**************************************************************/
|
|
38637
36596
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38638
36597
|
|
|
38639
|
-
|
|
38640
|
-
var Polynomial = __webpack_require__(/*! ./polynomial */ "./node_modules/qrcode/lib/core/polynomial.js")
|
|
38641
|
-
var Buffer = (__webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer)
|
|
36598
|
+
const Polynomial = __webpack_require__(/*! ./polynomial */ "./node_modules/qrcode/lib/core/polynomial.js")
|
|
38642
36599
|
|
|
38643
36600
|
function ReedSolomonEncoder (degree) {
|
|
38644
36601
|
this.genPoly = undefined
|
|
@@ -38662,8 +36619,8 @@ ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
|
|
|
38662
36619
|
/**
|
|
38663
36620
|
* Encodes a chunk of data
|
|
38664
36621
|
*
|
|
38665
|
-
* @param {
|
|
38666
|
-
* @return {
|
|
36622
|
+
* @param {Uint8Array} data Buffer containing input data
|
|
36623
|
+
* @return {Uint8Array} Buffer containing encoded data
|
|
38667
36624
|
*/
|
|
38668
36625
|
ReedSolomonEncoder.prototype.encode = function encode (data) {
|
|
38669
36626
|
if (!this.genPoly) {
|
|
@@ -38672,20 +36629,20 @@ ReedSolomonEncoder.prototype.encode = function encode (data) {
|
|
|
38672
36629
|
|
|
38673
36630
|
// Calculate EC for this data block
|
|
38674
36631
|
// extends data size to data+genPoly size
|
|
38675
|
-
|
|
38676
|
-
|
|
36632
|
+
const paddedData = new Uint8Array(data.length + this.degree)
|
|
36633
|
+
paddedData.set(data)
|
|
38677
36634
|
|
|
38678
36635
|
// The error correction codewords are the remainder after dividing the data codewords
|
|
38679
36636
|
// by a generator polynomial
|
|
38680
|
-
|
|
36637
|
+
const remainder = Polynomial.mod(paddedData, this.genPoly)
|
|
38681
36638
|
|
|
38682
36639
|
// return EC data blocks (last n byte, where n is the degree of genPoly)
|
|
38683
36640
|
// If coefficients number in remainder are less than genPoly degree,
|
|
38684
36641
|
// pad with 0s to the left to reach the needed number of coefficients
|
|
38685
|
-
|
|
36642
|
+
const start = this.degree - remainder.length
|
|
38686
36643
|
if (start > 0) {
|
|
38687
|
-
|
|
38688
|
-
|
|
36644
|
+
const buff = new Uint8Array(this.degree)
|
|
36645
|
+
buff.set(remainder, start)
|
|
38689
36646
|
|
|
38690
36647
|
return buff
|
|
38691
36648
|
}
|
|
@@ -38704,15 +36661,15 @@ module.exports = ReedSolomonEncoder
|
|
|
38704
36661
|
\***********************************************/
|
|
38705
36662
|
/***/ ((__unused_webpack_module, exports) => {
|
|
38706
36663
|
|
|
38707
|
-
|
|
38708
|
-
|
|
38709
|
-
|
|
36664
|
+
const numeric = '[0-9]+'
|
|
36665
|
+
const alphanumeric = '[A-Z $%*+\\-./:]+'
|
|
36666
|
+
let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
|
|
38710
36667
|
'[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
|
|
38711
36668
|
'[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
|
|
38712
36669
|
'[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'
|
|
38713
36670
|
kanji = kanji.replace(/u/g, '\\u')
|
|
38714
36671
|
|
|
38715
|
-
|
|
36672
|
+
const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'
|
|
38716
36673
|
|
|
38717
36674
|
exports.KANJI = new RegExp(kanji, 'g')
|
|
38718
36675
|
exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
|
|
@@ -38720,9 +36677,9 @@ exports.BYTE = new RegExp(byte, 'g')
|
|
|
38720
36677
|
exports.NUMERIC = new RegExp(numeric, 'g')
|
|
38721
36678
|
exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
|
|
38722
36679
|
|
|
38723
|
-
|
|
38724
|
-
|
|
38725
|
-
|
|
36680
|
+
const TEST_KANJI = new RegExp('^' + kanji + '$')
|
|
36681
|
+
const TEST_NUMERIC = new RegExp('^' + numeric + '$')
|
|
36682
|
+
const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$')
|
|
38726
36683
|
|
|
38727
36684
|
exports.testKanji = function testKanji (str) {
|
|
38728
36685
|
return TEST_KANJI.test(str)
|
|
@@ -38745,14 +36702,14 @@ exports.testAlphanumeric = function testAlphanumeric (str) {
|
|
|
38745
36702
|
\**************************************************/
|
|
38746
36703
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
38747
36704
|
|
|
38748
|
-
|
|
38749
|
-
|
|
38750
|
-
|
|
38751
|
-
|
|
38752
|
-
|
|
38753
|
-
|
|
38754
|
-
|
|
38755
|
-
|
|
36705
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
36706
|
+
const NumericData = __webpack_require__(/*! ./numeric-data */ "./node_modules/qrcode/lib/core/numeric-data.js")
|
|
36707
|
+
const AlphanumericData = __webpack_require__(/*! ./alphanumeric-data */ "./node_modules/qrcode/lib/core/alphanumeric-data.js")
|
|
36708
|
+
const ByteData = __webpack_require__(/*! ./byte-data */ "./node_modules/qrcode/lib/core/byte-data.js")
|
|
36709
|
+
const KanjiData = __webpack_require__(/*! ./kanji-data */ "./node_modules/qrcode/lib/core/kanji-data.js")
|
|
36710
|
+
const Regex = __webpack_require__(/*! ./regex */ "./node_modules/qrcode/lib/core/regex.js")
|
|
36711
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js")
|
|
36712
|
+
const dijkstra = __webpack_require__(/*! dijkstrajs */ "./node_modules/dijkstrajs/dijkstra.js")
|
|
38756
36713
|
|
|
38757
36714
|
/**
|
|
38758
36715
|
* Returns UTF8 byte length
|
|
@@ -38773,8 +36730,8 @@ function getStringByteLength (str) {
|
|
|
38773
36730
|
* @return {Array} Array of object with segments data
|
|
38774
36731
|
*/
|
|
38775
36732
|
function getSegments (regex, mode, str) {
|
|
38776
|
-
|
|
38777
|
-
|
|
36733
|
+
const segments = []
|
|
36734
|
+
let result
|
|
38778
36735
|
|
|
38779
36736
|
while ((result = regex.exec(str)) !== null) {
|
|
38780
36737
|
segments.push({
|
|
@@ -38796,10 +36753,10 @@ function getSegments (regex, mode, str) {
|
|
|
38796
36753
|
* @return {Array} Array of object with segments data
|
|
38797
36754
|
*/
|
|
38798
36755
|
function getSegmentsFromString (dataStr) {
|
|
38799
|
-
|
|
38800
|
-
|
|
38801
|
-
|
|
38802
|
-
|
|
36756
|
+
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)
|
|
36757
|
+
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)
|
|
36758
|
+
let byteSegs
|
|
36759
|
+
let kanjiSegs
|
|
38803
36760
|
|
|
38804
36761
|
if (Utils.isKanjiModeEnabled()) {
|
|
38805
36762
|
byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)
|
|
@@ -38809,7 +36766,7 @@ function getSegmentsFromString (dataStr) {
|
|
|
38809
36766
|
kanjiSegs = []
|
|
38810
36767
|
}
|
|
38811
36768
|
|
|
38812
|
-
|
|
36769
|
+
const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)
|
|
38813
36770
|
|
|
38814
36771
|
return segs
|
|
38815
36772
|
.sort(function (s1, s2) {
|
|
@@ -38853,7 +36810,7 @@ function getSegmentBitsLength (length, mode) {
|
|
|
38853
36810
|
*/
|
|
38854
36811
|
function mergeSegments (segs) {
|
|
38855
36812
|
return segs.reduce(function (acc, curr) {
|
|
38856
|
-
|
|
36813
|
+
const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null
|
|
38857
36814
|
if (prevSeg && prevSeg.mode === curr.mode) {
|
|
38858
36815
|
acc[acc.length - 1].data += curr.data
|
|
38859
36816
|
return acc
|
|
@@ -38881,9 +36838,9 @@ function mergeSegments (segs) {
|
|
|
38881
36838
|
* @return {Array} Array of object with segments data
|
|
38882
36839
|
*/
|
|
38883
36840
|
function buildNodes (segs) {
|
|
38884
|
-
|
|
38885
|
-
for (
|
|
38886
|
-
|
|
36841
|
+
const nodes = []
|
|
36842
|
+
for (let i = 0; i < segs.length; i++) {
|
|
36843
|
+
const seg = segs[i]
|
|
38887
36844
|
|
|
38888
36845
|
switch (seg.mode) {
|
|
38889
36846
|
case Mode.NUMERIC:
|
|
@@ -38925,24 +36882,24 @@ function buildNodes (segs) {
|
|
|
38925
36882
|
* @return {Object} Graph of all possible segments
|
|
38926
36883
|
*/
|
|
38927
36884
|
function buildGraph (nodes, version) {
|
|
38928
|
-
|
|
38929
|
-
|
|
38930
|
-
|
|
36885
|
+
const table = {}
|
|
36886
|
+
const graph = { start: {} }
|
|
36887
|
+
let prevNodeIds = ['start']
|
|
38931
36888
|
|
|
38932
|
-
for (
|
|
38933
|
-
|
|
38934
|
-
|
|
36889
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
36890
|
+
const nodeGroup = nodes[i]
|
|
36891
|
+
const currentNodeIds = []
|
|
38935
36892
|
|
|
38936
|
-
for (
|
|
38937
|
-
|
|
38938
|
-
|
|
36893
|
+
for (let j = 0; j < nodeGroup.length; j++) {
|
|
36894
|
+
const node = nodeGroup[j]
|
|
36895
|
+
const key = '' + i + j
|
|
38939
36896
|
|
|
38940
36897
|
currentNodeIds.push(key)
|
|
38941
36898
|
table[key] = { node: node, lastCount: 0 }
|
|
38942
36899
|
graph[key] = {}
|
|
38943
36900
|
|
|
38944
|
-
for (
|
|
38945
|
-
|
|
36901
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
36902
|
+
const prevNodeId = prevNodeIds[n]
|
|
38946
36903
|
|
|
38947
36904
|
if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
|
|
38948
36905
|
graph[prevNodeId][key] =
|
|
@@ -38962,8 +36919,8 @@ function buildGraph (nodes, version) {
|
|
|
38962
36919
|
prevNodeIds = currentNodeIds
|
|
38963
36920
|
}
|
|
38964
36921
|
|
|
38965
|
-
for (n = 0; n < prevNodeIds.length; n++) {
|
|
38966
|
-
graph[prevNodeIds[n]]
|
|
36922
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
36923
|
+
graph[prevNodeIds[n]].end = 0
|
|
38967
36924
|
}
|
|
38968
36925
|
|
|
38969
36926
|
return { map: graph, table: table }
|
|
@@ -38978,8 +36935,8 @@ function buildGraph (nodes, version) {
|
|
|
38978
36935
|
* @return {Segment} Segment
|
|
38979
36936
|
*/
|
|
38980
36937
|
function buildSingleSegment (data, modesHint) {
|
|
38981
|
-
|
|
38982
|
-
|
|
36938
|
+
let mode
|
|
36939
|
+
const bestMode = Mode.getBestModeForData(data)
|
|
38983
36940
|
|
|
38984
36941
|
mode = Mode.from(modesHint, bestMode)
|
|
38985
36942
|
|
|
@@ -39046,14 +37003,14 @@ exports.fromArray = function fromArray (array) {
|
|
|
39046
37003
|
* @return {Array} Array of segments
|
|
39047
37004
|
*/
|
|
39048
37005
|
exports.fromString = function fromString (data, version) {
|
|
39049
|
-
|
|
37006
|
+
const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())
|
|
39050
37007
|
|
|
39051
|
-
|
|
39052
|
-
|
|
39053
|
-
|
|
37008
|
+
const nodes = buildNodes(segs)
|
|
37009
|
+
const graph = buildGraph(nodes, version)
|
|
37010
|
+
const path = dijkstra.find_path(graph.map, 'start', 'end')
|
|
39054
37011
|
|
|
39055
|
-
|
|
39056
|
-
for (
|
|
37012
|
+
const optimizedSegs = []
|
|
37013
|
+
for (let i = 1; i < path.length - 1; i++) {
|
|
39057
37014
|
optimizedSegs.push(graph.table[path[i]].node)
|
|
39058
37015
|
}
|
|
39059
37016
|
|
|
@@ -39085,8 +37042,8 @@ exports.rawSplit = function rawSplit (data) {
|
|
|
39085
37042
|
\***********************************************/
|
|
39086
37043
|
/***/ ((__unused_webpack_module, exports) => {
|
|
39087
37044
|
|
|
39088
|
-
|
|
39089
|
-
|
|
37045
|
+
let toSJISFunction
|
|
37046
|
+
const CODEWORDS_COUNT = [
|
|
39090
37047
|
0, // Not used
|
|
39091
37048
|
26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
|
|
39092
37049
|
404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
|
|
@@ -39123,7 +37080,7 @@ exports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
|
|
|
39123
37080
|
* @return {Number} Encoded value
|
|
39124
37081
|
*/
|
|
39125
37082
|
exports.getBCHDigit = function (data) {
|
|
39126
|
-
|
|
37083
|
+
let digit = 0
|
|
39127
37084
|
|
|
39128
37085
|
while (data !== 0) {
|
|
39129
37086
|
digit++
|
|
@@ -39177,19 +37134,18 @@ exports.isValid = function isValid (version) {
|
|
|
39177
37134
|
\*************************************************/
|
|
39178
37135
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
39179
37136
|
|
|
39180
|
-
|
|
39181
|
-
|
|
39182
|
-
|
|
39183
|
-
|
|
39184
|
-
|
|
39185
|
-
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
|
37137
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js")
|
|
37138
|
+
const ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/qrcode/lib/core/error-correction-code.js")
|
|
37139
|
+
const ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
|
37140
|
+
const Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
|
37141
|
+
const VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
|
|
39186
37142
|
|
|
39187
37143
|
// Generator polynomial used to encode version information
|
|
39188
|
-
|
|
39189
|
-
|
|
37144
|
+
const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
|
|
37145
|
+
const G18_BCH = Utils.getBCHDigit(G18)
|
|
39190
37146
|
|
|
39191
37147
|
function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
|
|
39192
|
-
for (
|
|
37148
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
39193
37149
|
if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
|
|
39194
37150
|
return currentVersion
|
|
39195
37151
|
}
|
|
@@ -39204,10 +37160,10 @@ function getReservedBitsCount (mode, version) {
|
|
|
39204
37160
|
}
|
|
39205
37161
|
|
|
39206
37162
|
function getTotalBitsFromDataArray (segments, version) {
|
|
39207
|
-
|
|
37163
|
+
let totalBits = 0
|
|
39208
37164
|
|
|
39209
37165
|
segments.forEach(function (data) {
|
|
39210
|
-
|
|
37166
|
+
const reservedBits = getReservedBitsCount(data.mode, version)
|
|
39211
37167
|
totalBits += reservedBits + data.getBitsLength()
|
|
39212
37168
|
})
|
|
39213
37169
|
|
|
@@ -39215,8 +37171,8 @@ function getTotalBitsFromDataArray (segments, version) {
|
|
|
39215
37171
|
}
|
|
39216
37172
|
|
|
39217
37173
|
function getBestVersionForMixedData (segments, errorCorrectionLevel) {
|
|
39218
|
-
for (
|
|
39219
|
-
|
|
37174
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
|
|
37175
|
+
const length = getTotalBitsFromDataArray(segments, currentVersion)
|
|
39220
37176
|
if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
|
|
39221
37177
|
return currentVersion
|
|
39222
37178
|
}
|
|
@@ -39259,17 +37215,17 @@ exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode)
|
|
|
39259
37215
|
if (typeof mode === 'undefined') mode = Mode.BYTE
|
|
39260
37216
|
|
|
39261
37217
|
// Total codewords for this QR code version (Data + Error correction)
|
|
39262
|
-
|
|
37218
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version)
|
|
39263
37219
|
|
|
39264
37220
|
// Total number of error correction codewords
|
|
39265
|
-
|
|
37221
|
+
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
|
|
39266
37222
|
|
|
39267
37223
|
// Total number of data codewords
|
|
39268
|
-
|
|
37224
|
+
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
|
|
39269
37225
|
|
|
39270
37226
|
if (mode === Mode.MIXED) return dataTotalCodewordsBits
|
|
39271
37227
|
|
|
39272
|
-
|
|
37228
|
+
const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)
|
|
39273
37229
|
|
|
39274
37230
|
// Return max number of storable codewords
|
|
39275
37231
|
switch (mode) {
|
|
@@ -39297,11 +37253,11 @@ exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode)
|
|
|
39297
37253
|
* @return {Number} QR Code version
|
|
39298
37254
|
*/
|
|
39299
37255
|
exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
|
|
39300
|
-
|
|
37256
|
+
let seg
|
|
39301
37257
|
|
|
39302
|
-
|
|
37258
|
+
const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)
|
|
39303
37259
|
|
|
39304
|
-
if (isArray(data)) {
|
|
37260
|
+
if (Array.isArray(data)) {
|
|
39305
37261
|
if (data.length > 1) {
|
|
39306
37262
|
return getBestVersionForMixedData(data, ecl)
|
|
39307
37263
|
}
|
|
@@ -39333,7 +37289,7 @@ exports.getEncodedBits = function getEncodedBits (version) {
|
|
|
39333
37289
|
throw new Error('Invalid QR Code version')
|
|
39334
37290
|
}
|
|
39335
37291
|
|
|
39336
|
-
|
|
37292
|
+
let d = version << 12
|
|
39337
37293
|
|
|
39338
37294
|
while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
|
|
39339
37295
|
d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))
|
|
@@ -39351,7 +37307,7 @@ exports.getEncodedBits = function getEncodedBits (version) {
|
|
|
39351
37307
|
\****************************************************/
|
|
39352
37308
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
39353
37309
|
|
|
39354
|
-
|
|
37310
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/renderer/utils.js")
|
|
39355
37311
|
|
|
39356
37312
|
function clearCanvas (ctx, canvas, size) {
|
|
39357
37313
|
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
|
@@ -39372,8 +37328,8 @@ function getCanvasElement () {
|
|
|
39372
37328
|
}
|
|
39373
37329
|
|
|
39374
37330
|
exports.render = function render (qrData, canvas, options) {
|
|
39375
|
-
|
|
39376
|
-
|
|
37331
|
+
let opts = options
|
|
37332
|
+
let canvasEl = canvas
|
|
39377
37333
|
|
|
39378
37334
|
if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
|
|
39379
37335
|
opts = canvas
|
|
@@ -39385,10 +37341,10 @@ exports.render = function render (qrData, canvas, options) {
|
|
|
39385
37341
|
}
|
|
39386
37342
|
|
|
39387
37343
|
opts = Utils.getOptions(opts)
|
|
39388
|
-
|
|
37344
|
+
const size = Utils.getImageWidth(qrData.modules.size, opts)
|
|
39389
37345
|
|
|
39390
|
-
|
|
39391
|
-
|
|
37346
|
+
const ctx = canvasEl.getContext('2d')
|
|
37347
|
+
const image = ctx.createImageData(size, size)
|
|
39392
37348
|
Utils.qrToImageData(image.data, qrData, opts)
|
|
39393
37349
|
|
|
39394
37350
|
clearCanvas(ctx, canvasEl, size)
|
|
@@ -39398,7 +37354,7 @@ exports.render = function render (qrData, canvas, options) {
|
|
|
39398
37354
|
}
|
|
39399
37355
|
|
|
39400
37356
|
exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
|
|
39401
|
-
|
|
37357
|
+
let opts = options
|
|
39402
37358
|
|
|
39403
37359
|
if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
|
|
39404
37360
|
opts = canvas
|
|
@@ -39407,10 +37363,10 @@ exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
|
|
|
39407
37363
|
|
|
39408
37364
|
if (!opts) opts = {}
|
|
39409
37365
|
|
|
39410
|
-
|
|
37366
|
+
const canvasEl = exports.render(qrData, canvas, opts)
|
|
39411
37367
|
|
|
39412
|
-
|
|
39413
|
-
|
|
37368
|
+
const type = opts.type || 'image/png'
|
|
37369
|
+
const rendererOpts = opts.rendererOpts || {}
|
|
39414
37370
|
|
|
39415
37371
|
return canvasEl.toDataURL(type, rendererOpts.quality)
|
|
39416
37372
|
}
|
|
@@ -39424,11 +37380,11 @@ exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
|
|
|
39424
37380
|
\*****************************************************/
|
|
39425
37381
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
39426
37382
|
|
|
39427
|
-
|
|
37383
|
+
const Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/renderer/utils.js")
|
|
39428
37384
|
|
|
39429
37385
|
function getColorAttrib (color, attrib) {
|
|
39430
|
-
|
|
39431
|
-
|
|
37386
|
+
const alpha = color.a / 255
|
|
37387
|
+
const str = attrib + '="' + color.hex + '"'
|
|
39432
37388
|
|
|
39433
37389
|
return alpha < 1
|
|
39434
37390
|
? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
|
|
@@ -39436,21 +37392,21 @@ function getColorAttrib (color, attrib) {
|
|
|
39436
37392
|
}
|
|
39437
37393
|
|
|
39438
37394
|
function svgCmd (cmd, x, y) {
|
|
39439
|
-
|
|
37395
|
+
let str = cmd + x
|
|
39440
37396
|
if (typeof y !== 'undefined') str += ' ' + y
|
|
39441
37397
|
|
|
39442
37398
|
return str
|
|
39443
37399
|
}
|
|
39444
37400
|
|
|
39445
37401
|
function qrToPath (data, size, margin) {
|
|
39446
|
-
|
|
39447
|
-
|
|
39448
|
-
|
|
39449
|
-
|
|
37402
|
+
let path = ''
|
|
37403
|
+
let moveBy = 0
|
|
37404
|
+
let newRow = false
|
|
37405
|
+
let lineLength = 0
|
|
39450
37406
|
|
|
39451
|
-
for (
|
|
39452
|
-
|
|
39453
|
-
|
|
37407
|
+
for (let i = 0; i < data.length; i++) {
|
|
37408
|
+
const col = Math.floor(i % size)
|
|
37409
|
+
const row = Math.floor(i / size)
|
|
39454
37410
|
|
|
39455
37411
|
if (!col && !newRow) newRow = true
|
|
39456
37412
|
|
|
@@ -39479,25 +37435,25 @@ function qrToPath (data, size, margin) {
|
|
|
39479
37435
|
}
|
|
39480
37436
|
|
|
39481
37437
|
exports.render = function render (qrData, options, cb) {
|
|
39482
|
-
|
|
39483
|
-
|
|
39484
|
-
|
|
39485
|
-
|
|
37438
|
+
const opts = Utils.getOptions(options)
|
|
37439
|
+
const size = qrData.modules.size
|
|
37440
|
+
const data = qrData.modules.data
|
|
37441
|
+
const qrcodesize = size + opts.margin * 2
|
|
39486
37442
|
|
|
39487
|
-
|
|
37443
|
+
const bg = !opts.color.light.a
|
|
39488
37444
|
? ''
|
|
39489
37445
|
: '<path ' + getColorAttrib(opts.color.light, 'fill') +
|
|
39490
37446
|
' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>'
|
|
39491
37447
|
|
|
39492
|
-
|
|
37448
|
+
const path =
|
|
39493
37449
|
'<path ' + getColorAttrib(opts.color.dark, 'stroke') +
|
|
39494
37450
|
' d="' + qrToPath(data, size, opts.margin) + '"/>'
|
|
39495
37451
|
|
|
39496
|
-
|
|
37452
|
+
const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"'
|
|
39497
37453
|
|
|
39498
|
-
|
|
37454
|
+
const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" '
|
|
39499
37455
|
|
|
39500
|
-
|
|
37456
|
+
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n'
|
|
39501
37457
|
|
|
39502
37458
|
if (typeof cb === 'function') {
|
|
39503
37459
|
cb(null, svgTag)
|
|
@@ -39524,7 +37480,7 @@ function hex2rgba (hex) {
|
|
|
39524
37480
|
throw new Error('Color should be defined as hex string')
|
|
39525
37481
|
}
|
|
39526
37482
|
|
|
39527
|
-
|
|
37483
|
+
let hexCode = hex.slice().replace('#', '').split('')
|
|
39528
37484
|
if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
|
|
39529
37485
|
throw new Error('Invalid hex color: ' + hex)
|
|
39530
37486
|
}
|
|
@@ -39539,7 +37495,7 @@ function hex2rgba (hex) {
|
|
|
39539
37495
|
// Add default alpha value
|
|
39540
37496
|
if (hexCode.length === 6) hexCode.push('F', 'F')
|
|
39541
37497
|
|
|
39542
|
-
|
|
37498
|
+
const hexValue = parseInt(hexCode.join(''), 16)
|
|
39543
37499
|
|
|
39544
37500
|
return {
|
|
39545
37501
|
r: (hexValue >> 24) & 255,
|
|
@@ -39554,12 +37510,14 @@ exports.getOptions = function getOptions (options) {
|
|
|
39554
37510
|
if (!options) options = {}
|
|
39555
37511
|
if (!options.color) options.color = {}
|
|
39556
37512
|
|
|
39557
|
-
|
|
37513
|
+
const margin = typeof options.margin === 'undefined' ||
|
|
39558
37514
|
options.margin === null ||
|
|
39559
|
-
options.margin < 0
|
|
37515
|
+
options.margin < 0
|
|
37516
|
+
? 4
|
|
37517
|
+
: options.margin
|
|
39560
37518
|
|
|
39561
|
-
|
|
39562
|
-
|
|
37519
|
+
const width = options.width && options.width >= 21 ? options.width : undefined
|
|
37520
|
+
const scale = options.scale || 4
|
|
39563
37521
|
|
|
39564
37522
|
return {
|
|
39565
37523
|
width: width,
|
|
@@ -39581,27 +37539,27 @@ exports.getScale = function getScale (qrSize, opts) {
|
|
|
39581
37539
|
}
|
|
39582
37540
|
|
|
39583
37541
|
exports.getImageWidth = function getImageWidth (qrSize, opts) {
|
|
39584
|
-
|
|
37542
|
+
const scale = exports.getScale(qrSize, opts)
|
|
39585
37543
|
return Math.floor((qrSize + opts.margin * 2) * scale)
|
|
39586
37544
|
}
|
|
39587
37545
|
|
|
39588
37546
|
exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
|
39589
|
-
|
|
39590
|
-
|
|
39591
|
-
|
|
39592
|
-
|
|
39593
|
-
|
|
39594
|
-
|
|
39595
|
-
|
|
39596
|
-
for (
|
|
39597
|
-
for (
|
|
39598
|
-
|
|
39599
|
-
|
|
37547
|
+
const size = qr.modules.size
|
|
37548
|
+
const data = qr.modules.data
|
|
37549
|
+
const scale = exports.getScale(size, opts)
|
|
37550
|
+
const symbolSize = Math.floor((size + opts.margin * 2) * scale)
|
|
37551
|
+
const scaledMargin = opts.margin * scale
|
|
37552
|
+
const palette = [opts.color.light, opts.color.dark]
|
|
37553
|
+
|
|
37554
|
+
for (let i = 0; i < symbolSize; i++) {
|
|
37555
|
+
for (let j = 0; j < symbolSize; j++) {
|
|
37556
|
+
let posDst = (i * symbolSize + j) * 4
|
|
37557
|
+
let pxColor = opts.color.light
|
|
39600
37558
|
|
|
39601
37559
|
if (i >= scaledMargin && j >= scaledMargin &&
|
|
39602
37560
|
i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
|
|
39603
|
-
|
|
39604
|
-
|
|
37561
|
+
const iSrc = Math.floor((i - scaledMargin) / scale)
|
|
37562
|
+
const jSrc = Math.floor((j - scaledMargin) / scale)
|
|
39605
37563
|
pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]
|
|
39606
37564
|
}
|
|
39607
37565
|
|
|
@@ -39614,537 +37572,6 @@ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
|
|
39614
37572
|
}
|
|
39615
37573
|
|
|
39616
37574
|
|
|
39617
|
-
/***/ }),
|
|
39618
|
-
|
|
39619
|
-
/***/ "./node_modules/qrcode/lib/utils/typedarray-buffer.js":
|
|
39620
|
-
/*!************************************************************!*\
|
|
39621
|
-
!*** ./node_modules/qrcode/lib/utils/typedarray-buffer.js ***!
|
|
39622
|
-
\************************************************************/
|
|
39623
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
39624
|
-
|
|
39625
|
-
"use strict";
|
|
39626
|
-
/**
|
|
39627
|
-
* Implementation of a subset of node.js Buffer methods for the browser.
|
|
39628
|
-
* Based on https://github.com/feross/buffer
|
|
39629
|
-
*/
|
|
39630
|
-
|
|
39631
|
-
/* eslint-disable no-proto */
|
|
39632
|
-
|
|
39633
|
-
|
|
39634
|
-
|
|
39635
|
-
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
|
39636
|
-
|
|
39637
|
-
function typedArraySupport () {
|
|
39638
|
-
// Can typed array instances be augmented?
|
|
39639
|
-
try {
|
|
39640
|
-
var arr = new Uint8Array(1)
|
|
39641
|
-
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
|
39642
|
-
return arr.foo() === 42
|
|
39643
|
-
} catch (e) {
|
|
39644
|
-
return false
|
|
39645
|
-
}
|
|
39646
|
-
}
|
|
39647
|
-
|
|
39648
|
-
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
|
39649
|
-
|
|
39650
|
-
var K_MAX_LENGTH = Buffer.TYPED_ARRAY_SUPPORT
|
|
39651
|
-
? 0x7fffffff
|
|
39652
|
-
: 0x3fffffff
|
|
39653
|
-
|
|
39654
|
-
function Buffer (arg, offset, length) {
|
|
39655
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
39656
|
-
return new Buffer(arg, offset, length)
|
|
39657
|
-
}
|
|
39658
|
-
|
|
39659
|
-
if (typeof arg === 'number') {
|
|
39660
|
-
return allocUnsafe(this, arg)
|
|
39661
|
-
}
|
|
39662
|
-
|
|
39663
|
-
return from(this, arg, offset, length)
|
|
39664
|
-
}
|
|
39665
|
-
|
|
39666
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
39667
|
-
Buffer.prototype.__proto__ = Uint8Array.prototype
|
|
39668
|
-
Buffer.__proto__ = Uint8Array
|
|
39669
|
-
|
|
39670
|
-
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
|
39671
|
-
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
39672
|
-
Buffer[Symbol.species] === Buffer) {
|
|
39673
|
-
Object.defineProperty(Buffer, Symbol.species, {
|
|
39674
|
-
value: null,
|
|
39675
|
-
configurable: true,
|
|
39676
|
-
enumerable: false,
|
|
39677
|
-
writable: false
|
|
39678
|
-
})
|
|
39679
|
-
}
|
|
39680
|
-
}
|
|
39681
|
-
|
|
39682
|
-
function checked (length) {
|
|
39683
|
-
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
|
39684
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
39685
|
-
if (length >= K_MAX_LENGTH) {
|
|
39686
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
39687
|
-
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
|
39688
|
-
}
|
|
39689
|
-
return length | 0
|
|
39690
|
-
}
|
|
39691
|
-
|
|
39692
|
-
function isnan (val) {
|
|
39693
|
-
return val !== val // eslint-disable-line no-self-compare
|
|
39694
|
-
}
|
|
39695
|
-
|
|
39696
|
-
function createBuffer (that, length) {
|
|
39697
|
-
var buf
|
|
39698
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
39699
|
-
buf = new Uint8Array(length)
|
|
39700
|
-
buf.__proto__ = Buffer.prototype
|
|
39701
|
-
} else {
|
|
39702
|
-
// Fallback: Return an object instance of the Buffer class
|
|
39703
|
-
buf = that
|
|
39704
|
-
if (buf === null) {
|
|
39705
|
-
buf = new Buffer(length)
|
|
39706
|
-
}
|
|
39707
|
-
buf.length = length
|
|
39708
|
-
}
|
|
39709
|
-
|
|
39710
|
-
return buf
|
|
39711
|
-
}
|
|
39712
|
-
|
|
39713
|
-
function allocUnsafe (that, size) {
|
|
39714
|
-
var buf = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
|
39715
|
-
|
|
39716
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
39717
|
-
for (var i = 0; i < size; ++i) {
|
|
39718
|
-
buf[i] = 0
|
|
39719
|
-
}
|
|
39720
|
-
}
|
|
39721
|
-
|
|
39722
|
-
return buf
|
|
39723
|
-
}
|
|
39724
|
-
|
|
39725
|
-
function fromString (that, string) {
|
|
39726
|
-
var length = byteLength(string) | 0
|
|
39727
|
-
var buf = createBuffer(that, length)
|
|
39728
|
-
|
|
39729
|
-
var actual = buf.write(string)
|
|
39730
|
-
|
|
39731
|
-
if (actual !== length) {
|
|
39732
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
39733
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
39734
|
-
// 'abxxcd' will be treated as 'ab')
|
|
39735
|
-
buf = buf.slice(0, actual)
|
|
39736
|
-
}
|
|
39737
|
-
|
|
39738
|
-
return buf
|
|
39739
|
-
}
|
|
39740
|
-
|
|
39741
|
-
function fromArrayLike (that, array) {
|
|
39742
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
39743
|
-
var buf = createBuffer(that, length)
|
|
39744
|
-
for (var i = 0; i < length; i += 1) {
|
|
39745
|
-
buf[i] = array[i] & 255
|
|
39746
|
-
}
|
|
39747
|
-
return buf
|
|
39748
|
-
}
|
|
39749
|
-
|
|
39750
|
-
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
39751
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
39752
|
-
throw new RangeError('\'offset\' is out of bounds')
|
|
39753
|
-
}
|
|
39754
|
-
|
|
39755
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
39756
|
-
throw new RangeError('\'length\' is out of bounds')
|
|
39757
|
-
}
|
|
39758
|
-
|
|
39759
|
-
var buf
|
|
39760
|
-
if (byteOffset === undefined && length === undefined) {
|
|
39761
|
-
buf = new Uint8Array(array)
|
|
39762
|
-
} else if (length === undefined) {
|
|
39763
|
-
buf = new Uint8Array(array, byteOffset)
|
|
39764
|
-
} else {
|
|
39765
|
-
buf = new Uint8Array(array, byteOffset, length)
|
|
39766
|
-
}
|
|
39767
|
-
|
|
39768
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
39769
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
39770
|
-
buf.__proto__ = Buffer.prototype
|
|
39771
|
-
} else {
|
|
39772
|
-
// Fallback: Return an object instance of the Buffer class
|
|
39773
|
-
buf = fromArrayLike(that, buf)
|
|
39774
|
-
}
|
|
39775
|
-
|
|
39776
|
-
return buf
|
|
39777
|
-
}
|
|
39778
|
-
|
|
39779
|
-
function fromObject (that, obj) {
|
|
39780
|
-
if (Buffer.isBuffer(obj)) {
|
|
39781
|
-
var len = checked(obj.length) | 0
|
|
39782
|
-
var buf = createBuffer(that, len)
|
|
39783
|
-
|
|
39784
|
-
if (buf.length === 0) {
|
|
39785
|
-
return buf
|
|
39786
|
-
}
|
|
39787
|
-
|
|
39788
|
-
obj.copy(buf, 0, 0, len)
|
|
39789
|
-
return buf
|
|
39790
|
-
}
|
|
39791
|
-
|
|
39792
|
-
if (obj) {
|
|
39793
|
-
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
39794
|
-
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
39795
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
39796
|
-
return createBuffer(that, 0)
|
|
39797
|
-
}
|
|
39798
|
-
return fromArrayLike(that, obj)
|
|
39799
|
-
}
|
|
39800
|
-
|
|
39801
|
-
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
|
39802
|
-
return fromArrayLike(that, obj.data)
|
|
39803
|
-
}
|
|
39804
|
-
}
|
|
39805
|
-
|
|
39806
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
39807
|
-
}
|
|
39808
|
-
|
|
39809
|
-
function utf8ToBytes (string, units) {
|
|
39810
|
-
units = units || Infinity
|
|
39811
|
-
var codePoint
|
|
39812
|
-
var length = string.length
|
|
39813
|
-
var leadSurrogate = null
|
|
39814
|
-
var bytes = []
|
|
39815
|
-
|
|
39816
|
-
for (var i = 0; i < length; ++i) {
|
|
39817
|
-
codePoint = string.charCodeAt(i)
|
|
39818
|
-
|
|
39819
|
-
// is surrogate component
|
|
39820
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
39821
|
-
// last char was a lead
|
|
39822
|
-
if (!leadSurrogate) {
|
|
39823
|
-
// no lead yet
|
|
39824
|
-
if (codePoint > 0xDBFF) {
|
|
39825
|
-
// unexpected trail
|
|
39826
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
39827
|
-
continue
|
|
39828
|
-
} else if (i + 1 === length) {
|
|
39829
|
-
// unpaired lead
|
|
39830
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
39831
|
-
continue
|
|
39832
|
-
}
|
|
39833
|
-
|
|
39834
|
-
// valid lead
|
|
39835
|
-
leadSurrogate = codePoint
|
|
39836
|
-
|
|
39837
|
-
continue
|
|
39838
|
-
}
|
|
39839
|
-
|
|
39840
|
-
// 2 leads in a row
|
|
39841
|
-
if (codePoint < 0xDC00) {
|
|
39842
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
39843
|
-
leadSurrogate = codePoint
|
|
39844
|
-
continue
|
|
39845
|
-
}
|
|
39846
|
-
|
|
39847
|
-
// valid surrogate pair
|
|
39848
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
|
39849
|
-
} else if (leadSurrogate) {
|
|
39850
|
-
// valid bmp char, but last char was a lead
|
|
39851
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
39852
|
-
}
|
|
39853
|
-
|
|
39854
|
-
leadSurrogate = null
|
|
39855
|
-
|
|
39856
|
-
// encode utf8
|
|
39857
|
-
if (codePoint < 0x80) {
|
|
39858
|
-
if ((units -= 1) < 0) break
|
|
39859
|
-
bytes.push(codePoint)
|
|
39860
|
-
} else if (codePoint < 0x800) {
|
|
39861
|
-
if ((units -= 2) < 0) break
|
|
39862
|
-
bytes.push(
|
|
39863
|
-
codePoint >> 0x6 | 0xC0,
|
|
39864
|
-
codePoint & 0x3F | 0x80
|
|
39865
|
-
)
|
|
39866
|
-
} else if (codePoint < 0x10000) {
|
|
39867
|
-
if ((units -= 3) < 0) break
|
|
39868
|
-
bytes.push(
|
|
39869
|
-
codePoint >> 0xC | 0xE0,
|
|
39870
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
39871
|
-
codePoint & 0x3F | 0x80
|
|
39872
|
-
)
|
|
39873
|
-
} else if (codePoint < 0x110000) {
|
|
39874
|
-
if ((units -= 4) < 0) break
|
|
39875
|
-
bytes.push(
|
|
39876
|
-
codePoint >> 0x12 | 0xF0,
|
|
39877
|
-
codePoint >> 0xC & 0x3F | 0x80,
|
|
39878
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
39879
|
-
codePoint & 0x3F | 0x80
|
|
39880
|
-
)
|
|
39881
|
-
} else {
|
|
39882
|
-
throw new Error('Invalid code point')
|
|
39883
|
-
}
|
|
39884
|
-
}
|
|
39885
|
-
|
|
39886
|
-
return bytes
|
|
39887
|
-
}
|
|
39888
|
-
|
|
39889
|
-
function byteLength (string) {
|
|
39890
|
-
if (Buffer.isBuffer(string)) {
|
|
39891
|
-
return string.length
|
|
39892
|
-
}
|
|
39893
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
39894
|
-
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
39895
|
-
return string.byteLength
|
|
39896
|
-
}
|
|
39897
|
-
if (typeof string !== 'string') {
|
|
39898
|
-
string = '' + string
|
|
39899
|
-
}
|
|
39900
|
-
|
|
39901
|
-
var len = string.length
|
|
39902
|
-
if (len === 0) return 0
|
|
39903
|
-
|
|
39904
|
-
return utf8ToBytes(string).length
|
|
39905
|
-
}
|
|
39906
|
-
|
|
39907
|
-
function blitBuffer (src, dst, offset, length) {
|
|
39908
|
-
for (var i = 0; i < length; ++i) {
|
|
39909
|
-
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
39910
|
-
dst[i + offset] = src[i]
|
|
39911
|
-
}
|
|
39912
|
-
return i
|
|
39913
|
-
}
|
|
39914
|
-
|
|
39915
|
-
function utf8Write (buf, string, offset, length) {
|
|
39916
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
39917
|
-
}
|
|
39918
|
-
|
|
39919
|
-
function from (that, value, offset, length) {
|
|
39920
|
-
if (typeof value === 'number') {
|
|
39921
|
-
throw new TypeError('"value" argument must not be a number')
|
|
39922
|
-
}
|
|
39923
|
-
|
|
39924
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
39925
|
-
return fromArrayBuffer(that, value, offset, length)
|
|
39926
|
-
}
|
|
39927
|
-
|
|
39928
|
-
if (typeof value === 'string') {
|
|
39929
|
-
return fromString(that, value, offset)
|
|
39930
|
-
}
|
|
39931
|
-
|
|
39932
|
-
return fromObject(that, value)
|
|
39933
|
-
}
|
|
39934
|
-
|
|
39935
|
-
Buffer.prototype.write = function write (string, offset, length) {
|
|
39936
|
-
// Buffer#write(string)
|
|
39937
|
-
if (offset === undefined) {
|
|
39938
|
-
length = this.length
|
|
39939
|
-
offset = 0
|
|
39940
|
-
// Buffer#write(string, encoding)
|
|
39941
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
39942
|
-
length = this.length
|
|
39943
|
-
offset = 0
|
|
39944
|
-
// Buffer#write(string, offset[, length])
|
|
39945
|
-
} else if (isFinite(offset)) {
|
|
39946
|
-
offset = offset | 0
|
|
39947
|
-
if (isFinite(length)) {
|
|
39948
|
-
length = length | 0
|
|
39949
|
-
} else {
|
|
39950
|
-
length = undefined
|
|
39951
|
-
}
|
|
39952
|
-
}
|
|
39953
|
-
|
|
39954
|
-
var remaining = this.length - offset
|
|
39955
|
-
if (length === undefined || length > remaining) length = remaining
|
|
39956
|
-
|
|
39957
|
-
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
39958
|
-
throw new RangeError('Attempt to write outside buffer bounds')
|
|
39959
|
-
}
|
|
39960
|
-
|
|
39961
|
-
return utf8Write(this, string, offset, length)
|
|
39962
|
-
}
|
|
39963
|
-
|
|
39964
|
-
Buffer.prototype.slice = function slice (start, end) {
|
|
39965
|
-
var len = this.length
|
|
39966
|
-
start = ~~start
|
|
39967
|
-
end = end === undefined ? len : ~~end
|
|
39968
|
-
|
|
39969
|
-
if (start < 0) {
|
|
39970
|
-
start += len
|
|
39971
|
-
if (start < 0) start = 0
|
|
39972
|
-
} else if (start > len) {
|
|
39973
|
-
start = len
|
|
39974
|
-
}
|
|
39975
|
-
|
|
39976
|
-
if (end < 0) {
|
|
39977
|
-
end += len
|
|
39978
|
-
if (end < 0) end = 0
|
|
39979
|
-
} else if (end > len) {
|
|
39980
|
-
end = len
|
|
39981
|
-
}
|
|
39982
|
-
|
|
39983
|
-
if (end < start) end = start
|
|
39984
|
-
|
|
39985
|
-
var newBuf
|
|
39986
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
39987
|
-
newBuf = this.subarray(start, end)
|
|
39988
|
-
// Return an augmented `Uint8Array` instance
|
|
39989
|
-
newBuf.__proto__ = Buffer.prototype
|
|
39990
|
-
} else {
|
|
39991
|
-
var sliceLen = end - start
|
|
39992
|
-
newBuf = new Buffer(sliceLen, undefined)
|
|
39993
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
39994
|
-
newBuf[i] = this[i + start]
|
|
39995
|
-
}
|
|
39996
|
-
}
|
|
39997
|
-
|
|
39998
|
-
return newBuf
|
|
39999
|
-
}
|
|
40000
|
-
|
|
40001
|
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
40002
|
-
if (!start) start = 0
|
|
40003
|
-
if (!end && end !== 0) end = this.length
|
|
40004
|
-
if (targetStart >= target.length) targetStart = target.length
|
|
40005
|
-
if (!targetStart) targetStart = 0
|
|
40006
|
-
if (end > 0 && end < start) end = start
|
|
40007
|
-
|
|
40008
|
-
// Copy 0 bytes; we're done
|
|
40009
|
-
if (end === start) return 0
|
|
40010
|
-
if (target.length === 0 || this.length === 0) return 0
|
|
40011
|
-
|
|
40012
|
-
// Fatal error conditions
|
|
40013
|
-
if (targetStart < 0) {
|
|
40014
|
-
throw new RangeError('targetStart out of bounds')
|
|
40015
|
-
}
|
|
40016
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
40017
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
40018
|
-
|
|
40019
|
-
// Are we oob?
|
|
40020
|
-
if (end > this.length) end = this.length
|
|
40021
|
-
if (target.length - targetStart < end - start) {
|
|
40022
|
-
end = target.length - targetStart + start
|
|
40023
|
-
}
|
|
40024
|
-
|
|
40025
|
-
var len = end - start
|
|
40026
|
-
var i
|
|
40027
|
-
|
|
40028
|
-
if (this === target && start < targetStart && targetStart < end) {
|
|
40029
|
-
// descending copy from end
|
|
40030
|
-
for (i = len - 1; i >= 0; --i) {
|
|
40031
|
-
target[i + targetStart] = this[i + start]
|
|
40032
|
-
}
|
|
40033
|
-
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
40034
|
-
// ascending copy from start
|
|
40035
|
-
for (i = 0; i < len; ++i) {
|
|
40036
|
-
target[i + targetStart] = this[i + start]
|
|
40037
|
-
}
|
|
40038
|
-
} else {
|
|
40039
|
-
Uint8Array.prototype.set.call(
|
|
40040
|
-
target,
|
|
40041
|
-
this.subarray(start, start + len),
|
|
40042
|
-
targetStart
|
|
40043
|
-
)
|
|
40044
|
-
}
|
|
40045
|
-
|
|
40046
|
-
return len
|
|
40047
|
-
}
|
|
40048
|
-
|
|
40049
|
-
Buffer.prototype.fill = function fill (val, start, end) {
|
|
40050
|
-
// Handle string cases:
|
|
40051
|
-
if (typeof val === 'string') {
|
|
40052
|
-
if (typeof start === 'string') {
|
|
40053
|
-
start = 0
|
|
40054
|
-
end = this.length
|
|
40055
|
-
} else if (typeof end === 'string') {
|
|
40056
|
-
end = this.length
|
|
40057
|
-
}
|
|
40058
|
-
if (val.length === 1) {
|
|
40059
|
-
var code = val.charCodeAt(0)
|
|
40060
|
-
if (code < 256) {
|
|
40061
|
-
val = code
|
|
40062
|
-
}
|
|
40063
|
-
}
|
|
40064
|
-
} else if (typeof val === 'number') {
|
|
40065
|
-
val = val & 255
|
|
40066
|
-
}
|
|
40067
|
-
|
|
40068
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
40069
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
40070
|
-
throw new RangeError('Out of range index')
|
|
40071
|
-
}
|
|
40072
|
-
|
|
40073
|
-
if (end <= start) {
|
|
40074
|
-
return this
|
|
40075
|
-
}
|
|
40076
|
-
|
|
40077
|
-
start = start >>> 0
|
|
40078
|
-
end = end === undefined ? this.length : end >>> 0
|
|
40079
|
-
|
|
40080
|
-
if (!val) val = 0
|
|
40081
|
-
|
|
40082
|
-
var i
|
|
40083
|
-
if (typeof val === 'number') {
|
|
40084
|
-
for (i = start; i < end; ++i) {
|
|
40085
|
-
this[i] = val
|
|
40086
|
-
}
|
|
40087
|
-
} else {
|
|
40088
|
-
var bytes = Buffer.isBuffer(val)
|
|
40089
|
-
? val
|
|
40090
|
-
: new Buffer(val)
|
|
40091
|
-
var len = bytes.length
|
|
40092
|
-
for (i = 0; i < end - start; ++i) {
|
|
40093
|
-
this[i + start] = bytes[i % len]
|
|
40094
|
-
}
|
|
40095
|
-
}
|
|
40096
|
-
|
|
40097
|
-
return this
|
|
40098
|
-
}
|
|
40099
|
-
|
|
40100
|
-
Buffer.concat = function concat (list, length) {
|
|
40101
|
-
if (!isArray(list)) {
|
|
40102
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
40103
|
-
}
|
|
40104
|
-
|
|
40105
|
-
if (list.length === 0) {
|
|
40106
|
-
return createBuffer(null, 0)
|
|
40107
|
-
}
|
|
40108
|
-
|
|
40109
|
-
var i
|
|
40110
|
-
if (length === undefined) {
|
|
40111
|
-
length = 0
|
|
40112
|
-
for (i = 0; i < list.length; ++i) {
|
|
40113
|
-
length += list[i].length
|
|
40114
|
-
}
|
|
40115
|
-
}
|
|
40116
|
-
|
|
40117
|
-
var buffer = allocUnsafe(null, length)
|
|
40118
|
-
var pos = 0
|
|
40119
|
-
for (i = 0; i < list.length; ++i) {
|
|
40120
|
-
var buf = list[i]
|
|
40121
|
-
if (!Buffer.isBuffer(buf)) {
|
|
40122
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
40123
|
-
}
|
|
40124
|
-
buf.copy(buffer, pos)
|
|
40125
|
-
pos += buf.length
|
|
40126
|
-
}
|
|
40127
|
-
return buffer
|
|
40128
|
-
}
|
|
40129
|
-
|
|
40130
|
-
Buffer.byteLength = byteLength
|
|
40131
|
-
|
|
40132
|
-
Buffer.prototype._isBuffer = true
|
|
40133
|
-
Buffer.isBuffer = function isBuffer (b) {
|
|
40134
|
-
return !!(b != null && b._isBuffer)
|
|
40135
|
-
}
|
|
40136
|
-
|
|
40137
|
-
module.exports.alloc = function (size) {
|
|
40138
|
-
var buffer = new Buffer(size)
|
|
40139
|
-
buffer.fill(0)
|
|
40140
|
-
return buffer
|
|
40141
|
-
}
|
|
40142
|
-
|
|
40143
|
-
module.exports.from = function (data) {
|
|
40144
|
-
return new Buffer(data)
|
|
40145
|
-
}
|
|
40146
|
-
|
|
40147
|
-
|
|
40148
37575
|
/***/ }),
|
|
40149
37576
|
|
|
40150
37577
|
/***/ "./node_modules/reflect-metadata/Reflect.js":
|