@reachfive/identity-ui 1.20.1 → 1.20.2
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/CHANGELOG.md +9 -1
- package/cjs/identity-ui.js +1936 -4
- package/es/identity-ui.js +1936 -4
- package/package.json +2 -1
- package/umd/identity-ui.js +1937 -4
- package/umd/identity-ui.min.js +1 -1
package/es/identity-ui.js
CHANGED
|
@@ -14,7 +14,6 @@ import { isEqual } from 'lodash-es';
|
|
|
14
14
|
import { DateTime } from 'luxon';
|
|
15
15
|
import { isLower, isUpper, isDigit } from 'char-info';
|
|
16
16
|
import zxcvbn from '@reachfive/zxcvbn';
|
|
17
|
-
import 'Buffer';
|
|
18
17
|
|
|
19
18
|
function ownKeys(object, enumerableOnly) {
|
|
20
19
|
var keys = Object.keys(object);
|
|
@@ -4128,7 +4127,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
4128
4127
|
}
|
|
4129
4128
|
|
|
4130
4129
|
/** Built-in value references. */
|
|
4131
|
-
var Uint8Array = root.Uint8Array;
|
|
4130
|
+
var Uint8Array$1 = root.Uint8Array;
|
|
4132
4131
|
|
|
4133
4132
|
/**
|
|
4134
4133
|
* Converts `map` to its key-value pairs.
|
|
@@ -4193,7 +4192,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
4193
4192
|
object = object.buffer;
|
|
4194
4193
|
other = other.buffer;
|
|
4195
4194
|
case arrayBufferTag:
|
|
4196
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
4195
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
|
|
4197
4196
|
return false;
|
|
4198
4197
|
}
|
|
4199
4198
|
return true;
|
|
@@ -7825,7 +7824,7 @@ function initCloneArray(array) {
|
|
|
7825
7824
|
*/
|
|
7826
7825
|
function cloneArrayBuffer(arrayBuffer) {
|
|
7827
7826
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
7828
|
-
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
7827
|
+
new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
|
|
7829
7828
|
return result;
|
|
7830
7829
|
}
|
|
7831
7830
|
|
|
@@ -12751,6 +12750,1939 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12751
12750
|
return UiClient;
|
|
12752
12751
|
}();
|
|
12753
12752
|
|
|
12753
|
+
var byteLength_1 = byteLength;
|
|
12754
|
+
var toByteArray_1 = toByteArray;
|
|
12755
|
+
var fromByteArray_1 = fromByteArray;
|
|
12756
|
+
var lookup = [];
|
|
12757
|
+
var revLookup = [];
|
|
12758
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
12759
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
12760
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
|
12761
|
+
lookup[i] = code[i];
|
|
12762
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
12763
|
+
}
|
|
12764
|
+
|
|
12765
|
+
// Support decoding URL-safe base64 strings, as Node.js does.
|
|
12766
|
+
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
12767
|
+
revLookup['-'.charCodeAt(0)] = 62;
|
|
12768
|
+
revLookup['_'.charCodeAt(0)] = 63;
|
|
12769
|
+
function getLens(b64) {
|
|
12770
|
+
var len = b64.length;
|
|
12771
|
+
if (len % 4 > 0) {
|
|
12772
|
+
throw new Error('Invalid string. Length must be a multiple of 4');
|
|
12773
|
+
}
|
|
12774
|
+
|
|
12775
|
+
// Trim off extra bytes after placeholder bytes are found
|
|
12776
|
+
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
12777
|
+
var validLen = b64.indexOf('=');
|
|
12778
|
+
if (validLen === -1) validLen = len;
|
|
12779
|
+
var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
|
12780
|
+
return [validLen, placeHoldersLen];
|
|
12781
|
+
}
|
|
12782
|
+
|
|
12783
|
+
// base64 is 4/3 + up to two characters of the original data
|
|
12784
|
+
function byteLength(b64) {
|
|
12785
|
+
var lens = getLens(b64);
|
|
12786
|
+
var validLen = lens[0];
|
|
12787
|
+
var placeHoldersLen = lens[1];
|
|
12788
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
12789
|
+
}
|
|
12790
|
+
function _byteLength(b64, validLen, placeHoldersLen) {
|
|
12791
|
+
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
|
|
12792
|
+
}
|
|
12793
|
+
function toByteArray(b64) {
|
|
12794
|
+
var tmp;
|
|
12795
|
+
var lens = getLens(b64);
|
|
12796
|
+
var validLen = lens[0];
|
|
12797
|
+
var placeHoldersLen = lens[1];
|
|
12798
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
|
|
12799
|
+
var curByte = 0;
|
|
12800
|
+
|
|
12801
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
|
12802
|
+
var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
|
|
12803
|
+
var i;
|
|
12804
|
+
for (i = 0; i < len; i += 4) {
|
|
12805
|
+
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
12806
|
+
arr[curByte++] = tmp >> 16 & 0xFF;
|
|
12807
|
+
arr[curByte++] = tmp >> 8 & 0xFF;
|
|
12808
|
+
arr[curByte++] = tmp & 0xFF;
|
|
12809
|
+
}
|
|
12810
|
+
if (placeHoldersLen === 2) {
|
|
12811
|
+
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
12812
|
+
arr[curByte++] = tmp & 0xFF;
|
|
12813
|
+
}
|
|
12814
|
+
if (placeHoldersLen === 1) {
|
|
12815
|
+
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
12816
|
+
arr[curByte++] = tmp >> 8 & 0xFF;
|
|
12817
|
+
arr[curByte++] = tmp & 0xFF;
|
|
12818
|
+
}
|
|
12819
|
+
return arr;
|
|
12820
|
+
}
|
|
12821
|
+
function tripletToBase64(num) {
|
|
12822
|
+
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
|
|
12823
|
+
}
|
|
12824
|
+
function encodeChunk(uint8, start, end) {
|
|
12825
|
+
var tmp;
|
|
12826
|
+
var output = [];
|
|
12827
|
+
for (var i = start; i < end; i += 3) {
|
|
12828
|
+
tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
|
|
12829
|
+
output.push(tripletToBase64(tmp));
|
|
12830
|
+
}
|
|
12831
|
+
return output.join('');
|
|
12832
|
+
}
|
|
12833
|
+
function fromByteArray(uint8) {
|
|
12834
|
+
var tmp;
|
|
12835
|
+
var len = uint8.length;
|
|
12836
|
+
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
12837
|
+
var parts = [];
|
|
12838
|
+
var maxChunkLength = 16383; // must be multiple of 3
|
|
12839
|
+
|
|
12840
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
12841
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
12842
|
+
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
12843
|
+
}
|
|
12844
|
+
|
|
12845
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
12846
|
+
if (extraBytes === 1) {
|
|
12847
|
+
tmp = uint8[len - 1];
|
|
12848
|
+
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');
|
|
12849
|
+
} else if (extraBytes === 2) {
|
|
12850
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
12851
|
+
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
|
|
12852
|
+
}
|
|
12853
|
+
return parts.join('');
|
|
12854
|
+
}
|
|
12855
|
+
var base64Js = {
|
|
12856
|
+
byteLength: byteLength_1,
|
|
12857
|
+
toByteArray: toByteArray_1,
|
|
12858
|
+
fromByteArray: fromByteArray_1
|
|
12859
|
+
};
|
|
12860
|
+
|
|
12861
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
12862
|
+
var read = function read(buffer, offset, isLE, mLen, nBytes) {
|
|
12863
|
+
var e, m;
|
|
12864
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
12865
|
+
var eMax = (1 << eLen) - 1;
|
|
12866
|
+
var eBias = eMax >> 1;
|
|
12867
|
+
var nBits = -7;
|
|
12868
|
+
var i = isLE ? nBytes - 1 : 0;
|
|
12869
|
+
var d = isLE ? -1 : 1;
|
|
12870
|
+
var s = buffer[offset + i];
|
|
12871
|
+
i += d;
|
|
12872
|
+
e = s & (1 << -nBits) - 1;
|
|
12873
|
+
s >>= -nBits;
|
|
12874
|
+
nBits += eLen;
|
|
12875
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12876
|
+
m = e & (1 << -nBits) - 1;
|
|
12877
|
+
e >>= -nBits;
|
|
12878
|
+
nBits += mLen;
|
|
12879
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12880
|
+
if (e === 0) {
|
|
12881
|
+
e = 1 - eBias;
|
|
12882
|
+
} else if (e === eMax) {
|
|
12883
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
12884
|
+
} else {
|
|
12885
|
+
m = m + Math.pow(2, mLen);
|
|
12886
|
+
e = e - eBias;
|
|
12887
|
+
}
|
|
12888
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
12889
|
+
};
|
|
12890
|
+
var write = function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
12891
|
+
var e, m, c;
|
|
12892
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
12893
|
+
var eMax = (1 << eLen) - 1;
|
|
12894
|
+
var eBias = eMax >> 1;
|
|
12895
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
12896
|
+
var i = isLE ? 0 : nBytes - 1;
|
|
12897
|
+
var d = isLE ? 1 : -1;
|
|
12898
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
12899
|
+
value = Math.abs(value);
|
|
12900
|
+
if (isNaN(value) || value === Infinity) {
|
|
12901
|
+
m = isNaN(value) ? 1 : 0;
|
|
12902
|
+
e = eMax;
|
|
12903
|
+
} else {
|
|
12904
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
12905
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
12906
|
+
e--;
|
|
12907
|
+
c *= 2;
|
|
12908
|
+
}
|
|
12909
|
+
if (e + eBias >= 1) {
|
|
12910
|
+
value += rt / c;
|
|
12911
|
+
} else {
|
|
12912
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
12913
|
+
}
|
|
12914
|
+
if (value * c >= 2) {
|
|
12915
|
+
e++;
|
|
12916
|
+
c /= 2;
|
|
12917
|
+
}
|
|
12918
|
+
if (e + eBias >= eMax) {
|
|
12919
|
+
m = 0;
|
|
12920
|
+
e = eMax;
|
|
12921
|
+
} else if (e + eBias >= 1) {
|
|
12922
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
12923
|
+
e = e + eBias;
|
|
12924
|
+
} else {
|
|
12925
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
12926
|
+
e = 0;
|
|
12927
|
+
}
|
|
12928
|
+
}
|
|
12929
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
12930
|
+
e = e << mLen | m;
|
|
12931
|
+
eLen += mLen;
|
|
12932
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
12933
|
+
buffer[offset + i - d] |= s * 128;
|
|
12934
|
+
};
|
|
12935
|
+
var ieee754 = {
|
|
12936
|
+
read: read,
|
|
12937
|
+
write: write
|
|
12938
|
+
};
|
|
12939
|
+
|
|
12940
|
+
var buffer = createCommonjsModule(function (module, exports) {
|
|
12941
|
+
|
|
12942
|
+
var customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation
|
|
12943
|
+
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
|
|
12944
|
+
: null;
|
|
12945
|
+
exports.Buffer = Buffer;
|
|
12946
|
+
exports.SlowBuffer = SlowBuffer;
|
|
12947
|
+
exports.INSPECT_MAX_BYTES = 50;
|
|
12948
|
+
var K_MAX_LENGTH = 0x7fffffff;
|
|
12949
|
+
exports.kMaxLength = K_MAX_LENGTH;
|
|
12950
|
+
|
|
12951
|
+
/**
|
|
12952
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
12953
|
+
* === true Use Uint8Array implementation (fastest)
|
|
12954
|
+
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
|
12955
|
+
* implementation (most compatible, even IE6)
|
|
12956
|
+
*
|
|
12957
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
12958
|
+
* Opera 11.6+, iOS 4.2+.
|
|
12959
|
+
*
|
|
12960
|
+
* We report that the browser does not support typed arrays if the are not subclassable
|
|
12961
|
+
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
|
12962
|
+
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
|
12963
|
+
* for __proto__ and has a buggy typed array implementation.
|
|
12964
|
+
*/
|
|
12965
|
+
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
|
12966
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
12967
|
+
console.error('This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.');
|
|
12968
|
+
}
|
|
12969
|
+
function typedArraySupport() {
|
|
12970
|
+
// Can typed array instances can be augmented?
|
|
12971
|
+
try {
|
|
12972
|
+
var arr = new Uint8Array(1);
|
|
12973
|
+
var proto = {
|
|
12974
|
+
foo: function foo() {
|
|
12975
|
+
return 42;
|
|
12976
|
+
}
|
|
12977
|
+
};
|
|
12978
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
|
12979
|
+
Object.setPrototypeOf(arr, proto);
|
|
12980
|
+
return arr.foo() === 42;
|
|
12981
|
+
} catch (e) {
|
|
12982
|
+
return false;
|
|
12983
|
+
}
|
|
12984
|
+
}
|
|
12985
|
+
Object.defineProperty(Buffer.prototype, 'parent', {
|
|
12986
|
+
enumerable: true,
|
|
12987
|
+
get: function get() {
|
|
12988
|
+
if (!Buffer.isBuffer(this)) return undefined;
|
|
12989
|
+
return this.buffer;
|
|
12990
|
+
}
|
|
12991
|
+
});
|
|
12992
|
+
Object.defineProperty(Buffer.prototype, 'offset', {
|
|
12993
|
+
enumerable: true,
|
|
12994
|
+
get: function get() {
|
|
12995
|
+
if (!Buffer.isBuffer(this)) return undefined;
|
|
12996
|
+
return this.byteOffset;
|
|
12997
|
+
}
|
|
12998
|
+
});
|
|
12999
|
+
function createBuffer(length) {
|
|
13000
|
+
if (length > K_MAX_LENGTH) {
|
|
13001
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
|
13002
|
+
}
|
|
13003
|
+
// Return an augmented `Uint8Array` instance
|
|
13004
|
+
var buf = new Uint8Array(length);
|
|
13005
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
|
13006
|
+
return buf;
|
|
13007
|
+
}
|
|
13008
|
+
|
|
13009
|
+
/**
|
|
13010
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
13011
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
13012
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
13013
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
13014
|
+
* returns a single octet.
|
|
13015
|
+
*
|
|
13016
|
+
* The `Uint8Array` prototype remains unmodified.
|
|
13017
|
+
*/
|
|
13018
|
+
|
|
13019
|
+
function Buffer(arg, encodingOrOffset, length) {
|
|
13020
|
+
// Common case.
|
|
13021
|
+
if (typeof arg === 'number') {
|
|
13022
|
+
if (typeof encodingOrOffset === 'string') {
|
|
13023
|
+
throw new TypeError('The "string" argument must be of type string. Received type number');
|
|
13024
|
+
}
|
|
13025
|
+
return allocUnsafe(arg);
|
|
13026
|
+
}
|
|
13027
|
+
return from(arg, encodingOrOffset, length);
|
|
13028
|
+
}
|
|
13029
|
+
Buffer.poolSize = 8192; // not used by this implementation
|
|
13030
|
+
|
|
13031
|
+
function from(value, encodingOrOffset, length) {
|
|
13032
|
+
if (typeof value === 'string') {
|
|
13033
|
+
return fromString(value, encodingOrOffset);
|
|
13034
|
+
}
|
|
13035
|
+
if (ArrayBuffer.isView(value)) {
|
|
13036
|
+
return fromArrayView(value);
|
|
13037
|
+
}
|
|
13038
|
+
if (value == null) {
|
|
13039
|
+
throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof(value));
|
|
13040
|
+
}
|
|
13041
|
+
if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
|
|
13042
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
13043
|
+
}
|
|
13044
|
+
if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
|
|
13045
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
13046
|
+
}
|
|
13047
|
+
if (typeof value === 'number') {
|
|
13048
|
+
throw new TypeError('The "value" argument must not be of type number. Received type number');
|
|
13049
|
+
}
|
|
13050
|
+
var valueOf = value.valueOf && value.valueOf();
|
|
13051
|
+
if (valueOf != null && valueOf !== value) {
|
|
13052
|
+
return Buffer.from(valueOf, encodingOrOffset, length);
|
|
13053
|
+
}
|
|
13054
|
+
var b = fromObject(value);
|
|
13055
|
+
if (b) return b;
|
|
13056
|
+
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') {
|
|
13057
|
+
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length);
|
|
13058
|
+
}
|
|
13059
|
+
throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + _typeof(value));
|
|
13060
|
+
}
|
|
13061
|
+
|
|
13062
|
+
/**
|
|
13063
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
13064
|
+
* if value is a number.
|
|
13065
|
+
* Buffer.from(str[, encoding])
|
|
13066
|
+
* Buffer.from(array)
|
|
13067
|
+
* Buffer.from(buffer)
|
|
13068
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
13069
|
+
**/
|
|
13070
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
|
13071
|
+
return from(value, encodingOrOffset, length);
|
|
13072
|
+
};
|
|
13073
|
+
|
|
13074
|
+
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
|
13075
|
+
// https://github.com/feross/buffer/pull/148
|
|
13076
|
+
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
|
|
13077
|
+
Object.setPrototypeOf(Buffer, Uint8Array);
|
|
13078
|
+
function assertSize(size) {
|
|
13079
|
+
if (typeof size !== 'number') {
|
|
13080
|
+
throw new TypeError('"size" argument must be of type number');
|
|
13081
|
+
} else if (size < 0) {
|
|
13082
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
13083
|
+
}
|
|
13084
|
+
}
|
|
13085
|
+
function alloc(size, fill, encoding) {
|
|
13086
|
+
assertSize(size);
|
|
13087
|
+
if (size <= 0) {
|
|
13088
|
+
return createBuffer(size);
|
|
13089
|
+
}
|
|
13090
|
+
if (fill !== undefined) {
|
|
13091
|
+
// Only pay attention to encoding if it's a string. This
|
|
13092
|
+
// prevents accidentally sending in a number that would
|
|
13093
|
+
// be interpreted as a start offset.
|
|
13094
|
+
return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
|
|
13095
|
+
}
|
|
13096
|
+
return createBuffer(size);
|
|
13097
|
+
}
|
|
13098
|
+
|
|
13099
|
+
/**
|
|
13100
|
+
* Creates a new filled Buffer instance.
|
|
13101
|
+
* alloc(size[, fill[, encoding]])
|
|
13102
|
+
**/
|
|
13103
|
+
Buffer.alloc = function (size, fill, encoding) {
|
|
13104
|
+
return alloc(size, fill, encoding);
|
|
13105
|
+
};
|
|
13106
|
+
function allocUnsafe(size) {
|
|
13107
|
+
assertSize(size);
|
|
13108
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
|
13109
|
+
}
|
|
13110
|
+
|
|
13111
|
+
/**
|
|
13112
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13113
|
+
* */
|
|
13114
|
+
Buffer.allocUnsafe = function (size) {
|
|
13115
|
+
return allocUnsafe(size);
|
|
13116
|
+
};
|
|
13117
|
+
/**
|
|
13118
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13119
|
+
*/
|
|
13120
|
+
Buffer.allocUnsafeSlow = function (size) {
|
|
13121
|
+
return allocUnsafe(size);
|
|
13122
|
+
};
|
|
13123
|
+
function fromString(string, encoding) {
|
|
13124
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
|
13125
|
+
encoding = 'utf8';
|
|
13126
|
+
}
|
|
13127
|
+
if (!Buffer.isEncoding(encoding)) {
|
|
13128
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
|
13129
|
+
}
|
|
13130
|
+
var length = byteLength(string, encoding) | 0;
|
|
13131
|
+
var buf = createBuffer(length);
|
|
13132
|
+
var actual = buf.write(string, encoding);
|
|
13133
|
+
if (actual !== length) {
|
|
13134
|
+
// Writing a hex string, for example, that contains invalid characters will
|
|
13135
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
|
13136
|
+
// 'abxxcd' will be treated as 'ab')
|
|
13137
|
+
buf = buf.slice(0, actual);
|
|
13138
|
+
}
|
|
13139
|
+
return buf;
|
|
13140
|
+
}
|
|
13141
|
+
function fromArrayLike(array) {
|
|
13142
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
13143
|
+
var buf = createBuffer(length);
|
|
13144
|
+
for (var i = 0; i < length; i += 1) {
|
|
13145
|
+
buf[i] = array[i] & 255;
|
|
13146
|
+
}
|
|
13147
|
+
return buf;
|
|
13148
|
+
}
|
|
13149
|
+
function fromArrayView(arrayView) {
|
|
13150
|
+
if (isInstance(arrayView, Uint8Array)) {
|
|
13151
|
+
var copy = new Uint8Array(arrayView);
|
|
13152
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
|
13153
|
+
}
|
|
13154
|
+
return fromArrayLike(arrayView);
|
|
13155
|
+
}
|
|
13156
|
+
function fromArrayBuffer(array, byteOffset, length) {
|
|
13157
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
13158
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
13159
|
+
}
|
|
13160
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
13161
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
13162
|
+
}
|
|
13163
|
+
var buf;
|
|
13164
|
+
if (byteOffset === undefined && length === undefined) {
|
|
13165
|
+
buf = new Uint8Array(array);
|
|
13166
|
+
} else if (length === undefined) {
|
|
13167
|
+
buf = new Uint8Array(array, byteOffset);
|
|
13168
|
+
} else {
|
|
13169
|
+
buf = new Uint8Array(array, byteOffset, length);
|
|
13170
|
+
}
|
|
13171
|
+
|
|
13172
|
+
// Return an augmented `Uint8Array` instance
|
|
13173
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
|
13174
|
+
return buf;
|
|
13175
|
+
}
|
|
13176
|
+
function fromObject(obj) {
|
|
13177
|
+
if (Buffer.isBuffer(obj)) {
|
|
13178
|
+
var len = checked(obj.length) | 0;
|
|
13179
|
+
var buf = createBuffer(len);
|
|
13180
|
+
if (buf.length === 0) {
|
|
13181
|
+
return buf;
|
|
13182
|
+
}
|
|
13183
|
+
obj.copy(buf, 0, 0, len);
|
|
13184
|
+
return buf;
|
|
13185
|
+
}
|
|
13186
|
+
if (obj.length !== undefined) {
|
|
13187
|
+
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
|
13188
|
+
return createBuffer(0);
|
|
13189
|
+
}
|
|
13190
|
+
return fromArrayLike(obj);
|
|
13191
|
+
}
|
|
13192
|
+
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
|
13193
|
+
return fromArrayLike(obj.data);
|
|
13194
|
+
}
|
|
13195
|
+
}
|
|
13196
|
+
function checked(length) {
|
|
13197
|
+
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
|
13198
|
+
// length is NaN (which is otherwise coerced to zero.)
|
|
13199
|
+
if (length >= K_MAX_LENGTH) {
|
|
13200
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes');
|
|
13201
|
+
}
|
|
13202
|
+
return length | 0;
|
|
13203
|
+
}
|
|
13204
|
+
function SlowBuffer(length) {
|
|
13205
|
+
if (+length != length) {
|
|
13206
|
+
// eslint-disable-line eqeqeq
|
|
13207
|
+
length = 0;
|
|
13208
|
+
}
|
|
13209
|
+
return Buffer.alloc(+length);
|
|
13210
|
+
}
|
|
13211
|
+
Buffer.isBuffer = function isBuffer(b) {
|
|
13212
|
+
return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
|
|
13213
|
+
};
|
|
13214
|
+
|
|
13215
|
+
Buffer.compare = function compare(a, b) {
|
|
13216
|
+
if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
|
|
13217
|
+
if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
|
|
13218
|
+
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
13219
|
+
throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
|
|
13220
|
+
}
|
|
13221
|
+
if (a === b) return 0;
|
|
13222
|
+
var x = a.length;
|
|
13223
|
+
var y = b.length;
|
|
13224
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
13225
|
+
if (a[i] !== b[i]) {
|
|
13226
|
+
x = a[i];
|
|
13227
|
+
y = b[i];
|
|
13228
|
+
break;
|
|
13229
|
+
}
|
|
13230
|
+
}
|
|
13231
|
+
if (x < y) return -1;
|
|
13232
|
+
if (y < x) return 1;
|
|
13233
|
+
return 0;
|
|
13234
|
+
};
|
|
13235
|
+
Buffer.isEncoding = function isEncoding(encoding) {
|
|
13236
|
+
switch (String(encoding).toLowerCase()) {
|
|
13237
|
+
case 'hex':
|
|
13238
|
+
case 'utf8':
|
|
13239
|
+
case 'utf-8':
|
|
13240
|
+
case 'ascii':
|
|
13241
|
+
case 'latin1':
|
|
13242
|
+
case 'binary':
|
|
13243
|
+
case 'base64':
|
|
13244
|
+
case 'ucs2':
|
|
13245
|
+
case 'ucs-2':
|
|
13246
|
+
case 'utf16le':
|
|
13247
|
+
case 'utf-16le':
|
|
13248
|
+
return true;
|
|
13249
|
+
default:
|
|
13250
|
+
return false;
|
|
13251
|
+
}
|
|
13252
|
+
};
|
|
13253
|
+
Buffer.concat = function concat(list, length) {
|
|
13254
|
+
if (!Array.isArray(list)) {
|
|
13255
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13256
|
+
}
|
|
13257
|
+
if (list.length === 0) {
|
|
13258
|
+
return Buffer.alloc(0);
|
|
13259
|
+
}
|
|
13260
|
+
var i;
|
|
13261
|
+
if (length === undefined) {
|
|
13262
|
+
length = 0;
|
|
13263
|
+
for (i = 0; i < list.length; ++i) {
|
|
13264
|
+
length += list[i].length;
|
|
13265
|
+
}
|
|
13266
|
+
}
|
|
13267
|
+
var buffer = Buffer.allocUnsafe(length);
|
|
13268
|
+
var pos = 0;
|
|
13269
|
+
for (i = 0; i < list.length; ++i) {
|
|
13270
|
+
var buf = list[i];
|
|
13271
|
+
if (isInstance(buf, Uint8Array)) {
|
|
13272
|
+
if (pos + buf.length > buffer.length) {
|
|
13273
|
+
if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
|
|
13274
|
+
buf.copy(buffer, pos);
|
|
13275
|
+
} else {
|
|
13276
|
+
Uint8Array.prototype.set.call(buffer, buf, pos);
|
|
13277
|
+
}
|
|
13278
|
+
} else if (!Buffer.isBuffer(buf)) {
|
|
13279
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13280
|
+
} else {
|
|
13281
|
+
buf.copy(buffer, pos);
|
|
13282
|
+
}
|
|
13283
|
+
pos += buf.length;
|
|
13284
|
+
}
|
|
13285
|
+
return buffer;
|
|
13286
|
+
};
|
|
13287
|
+
function byteLength(string, encoding) {
|
|
13288
|
+
if (Buffer.isBuffer(string)) {
|
|
13289
|
+
return string.length;
|
|
13290
|
+
}
|
|
13291
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
|
13292
|
+
return string.byteLength;
|
|
13293
|
+
}
|
|
13294
|
+
if (typeof string !== 'string') {
|
|
13295
|
+
throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + _typeof(string));
|
|
13296
|
+
}
|
|
13297
|
+
var len = string.length;
|
|
13298
|
+
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
13299
|
+
if (!mustMatch && len === 0) return 0;
|
|
13300
|
+
|
|
13301
|
+
// Use a for loop to avoid recursion
|
|
13302
|
+
var loweredCase = false;
|
|
13303
|
+
for (;;) {
|
|
13304
|
+
switch (encoding) {
|
|
13305
|
+
case 'ascii':
|
|
13306
|
+
case 'latin1':
|
|
13307
|
+
case 'binary':
|
|
13308
|
+
return len;
|
|
13309
|
+
case 'utf8':
|
|
13310
|
+
case 'utf-8':
|
|
13311
|
+
return utf8ToBytes(string).length;
|
|
13312
|
+
case 'ucs2':
|
|
13313
|
+
case 'ucs-2':
|
|
13314
|
+
case 'utf16le':
|
|
13315
|
+
case 'utf-16le':
|
|
13316
|
+
return len * 2;
|
|
13317
|
+
case 'hex':
|
|
13318
|
+
return len >>> 1;
|
|
13319
|
+
case 'base64':
|
|
13320
|
+
return base64ToBytes(string).length;
|
|
13321
|
+
default:
|
|
13322
|
+
if (loweredCase) {
|
|
13323
|
+
return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
|
|
13324
|
+
}
|
|
13325
|
+
|
|
13326
|
+
encoding = ('' + encoding).toLowerCase();
|
|
13327
|
+
loweredCase = true;
|
|
13328
|
+
}
|
|
13329
|
+
}
|
|
13330
|
+
}
|
|
13331
|
+
Buffer.byteLength = byteLength;
|
|
13332
|
+
function slowToString(encoding, start, end) {
|
|
13333
|
+
var loweredCase = false;
|
|
13334
|
+
|
|
13335
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
13336
|
+
// property of a typed array.
|
|
13337
|
+
|
|
13338
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
13339
|
+
// to their upper/lower bounds if the value passed is out of range.
|
|
13340
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
13341
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
13342
|
+
if (start === undefined || start < 0) {
|
|
13343
|
+
start = 0;
|
|
13344
|
+
}
|
|
13345
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
|
13346
|
+
// coercion fail below.
|
|
13347
|
+
if (start > this.length) {
|
|
13348
|
+
return '';
|
|
13349
|
+
}
|
|
13350
|
+
if (end === undefined || end > this.length) {
|
|
13351
|
+
end = this.length;
|
|
13352
|
+
}
|
|
13353
|
+
if (end <= 0) {
|
|
13354
|
+
return '';
|
|
13355
|
+
}
|
|
13356
|
+
|
|
13357
|
+
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
|
13358
|
+
end >>>= 0;
|
|
13359
|
+
start >>>= 0;
|
|
13360
|
+
if (end <= start) {
|
|
13361
|
+
return '';
|
|
13362
|
+
}
|
|
13363
|
+
if (!encoding) encoding = 'utf8';
|
|
13364
|
+
while (true) {
|
|
13365
|
+
switch (encoding) {
|
|
13366
|
+
case 'hex':
|
|
13367
|
+
return hexSlice(this, start, end);
|
|
13368
|
+
case 'utf8':
|
|
13369
|
+
case 'utf-8':
|
|
13370
|
+
return utf8Slice(this, start, end);
|
|
13371
|
+
case 'ascii':
|
|
13372
|
+
return asciiSlice(this, start, end);
|
|
13373
|
+
case 'latin1':
|
|
13374
|
+
case 'binary':
|
|
13375
|
+
return latin1Slice(this, start, end);
|
|
13376
|
+
case 'base64':
|
|
13377
|
+
return base64Slice(this, start, end);
|
|
13378
|
+
case 'ucs2':
|
|
13379
|
+
case 'ucs-2':
|
|
13380
|
+
case 'utf16le':
|
|
13381
|
+
case 'utf-16le':
|
|
13382
|
+
return utf16leSlice(this, start, end);
|
|
13383
|
+
default:
|
|
13384
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13385
|
+
encoding = (encoding + '').toLowerCase();
|
|
13386
|
+
loweredCase = true;
|
|
13387
|
+
}
|
|
13388
|
+
}
|
|
13389
|
+
}
|
|
13390
|
+
|
|
13391
|
+
// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
|
|
13392
|
+
// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
|
|
13393
|
+
// reliably in a browserify context because there could be multiple different
|
|
13394
|
+
// copies of the 'buffer' package in use. This method works even for Buffer
|
|
13395
|
+
// instances that were created from another copy of the `buffer` package.
|
|
13396
|
+
// See: https://github.com/feross/buffer/issues/154
|
|
13397
|
+
Buffer.prototype._isBuffer = true;
|
|
13398
|
+
function swap(b, n, m) {
|
|
13399
|
+
var i = b[n];
|
|
13400
|
+
b[n] = b[m];
|
|
13401
|
+
b[m] = i;
|
|
13402
|
+
}
|
|
13403
|
+
Buffer.prototype.swap16 = function swap16() {
|
|
13404
|
+
var len = this.length;
|
|
13405
|
+
if (len % 2 !== 0) {
|
|
13406
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits');
|
|
13407
|
+
}
|
|
13408
|
+
for (var i = 0; i < len; i += 2) {
|
|
13409
|
+
swap(this, i, i + 1);
|
|
13410
|
+
}
|
|
13411
|
+
return this;
|
|
13412
|
+
};
|
|
13413
|
+
Buffer.prototype.swap32 = function swap32() {
|
|
13414
|
+
var len = this.length;
|
|
13415
|
+
if (len % 4 !== 0) {
|
|
13416
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits');
|
|
13417
|
+
}
|
|
13418
|
+
for (var i = 0; i < len; i += 4) {
|
|
13419
|
+
swap(this, i, i + 3);
|
|
13420
|
+
swap(this, i + 1, i + 2);
|
|
13421
|
+
}
|
|
13422
|
+
return this;
|
|
13423
|
+
};
|
|
13424
|
+
Buffer.prototype.swap64 = function swap64() {
|
|
13425
|
+
var len = this.length;
|
|
13426
|
+
if (len % 8 !== 0) {
|
|
13427
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits');
|
|
13428
|
+
}
|
|
13429
|
+
for (var i = 0; i < len; i += 8) {
|
|
13430
|
+
swap(this, i, i + 7);
|
|
13431
|
+
swap(this, i + 1, i + 6);
|
|
13432
|
+
swap(this, i + 2, i + 5);
|
|
13433
|
+
swap(this, i + 3, i + 4);
|
|
13434
|
+
}
|
|
13435
|
+
return this;
|
|
13436
|
+
};
|
|
13437
|
+
Buffer.prototype.toString = function toString() {
|
|
13438
|
+
var length = this.length;
|
|
13439
|
+
if (length === 0) return '';
|
|
13440
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
13441
|
+
return slowToString.apply(this, arguments);
|
|
13442
|
+
};
|
|
13443
|
+
Buffer.prototype.toLocaleString = Buffer.prototype.toString;
|
|
13444
|
+
Buffer.prototype.equals = function equals(b) {
|
|
13445
|
+
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');
|
|
13446
|
+
if (this === b) return true;
|
|
13447
|
+
return Buffer.compare(this, b) === 0;
|
|
13448
|
+
};
|
|
13449
|
+
Buffer.prototype.inspect = function inspect() {
|
|
13450
|
+
var str = '';
|
|
13451
|
+
var max = exports.INSPECT_MAX_BYTES;
|
|
13452
|
+
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
|
|
13453
|
+
if (this.length > max) str += ' ... ';
|
|
13454
|
+
return '<Buffer ' + str + '>';
|
|
13455
|
+
};
|
|
13456
|
+
if (customInspectSymbol) {
|
|
13457
|
+
Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
|
|
13458
|
+
}
|
|
13459
|
+
Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
13460
|
+
if (isInstance(target, Uint8Array)) {
|
|
13461
|
+
target = Buffer.from(target, target.offset, target.byteLength);
|
|
13462
|
+
}
|
|
13463
|
+
if (!Buffer.isBuffer(target)) {
|
|
13464
|
+
throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + _typeof(target));
|
|
13465
|
+
}
|
|
13466
|
+
if (start === undefined) {
|
|
13467
|
+
start = 0;
|
|
13468
|
+
}
|
|
13469
|
+
if (end === undefined) {
|
|
13470
|
+
end = target ? target.length : 0;
|
|
13471
|
+
}
|
|
13472
|
+
if (thisStart === undefined) {
|
|
13473
|
+
thisStart = 0;
|
|
13474
|
+
}
|
|
13475
|
+
if (thisEnd === undefined) {
|
|
13476
|
+
thisEnd = this.length;
|
|
13477
|
+
}
|
|
13478
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
13479
|
+
throw new RangeError('out of range index');
|
|
13480
|
+
}
|
|
13481
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
13482
|
+
return 0;
|
|
13483
|
+
}
|
|
13484
|
+
if (thisStart >= thisEnd) {
|
|
13485
|
+
return -1;
|
|
13486
|
+
}
|
|
13487
|
+
if (start >= end) {
|
|
13488
|
+
return 1;
|
|
13489
|
+
}
|
|
13490
|
+
start >>>= 0;
|
|
13491
|
+
end >>>= 0;
|
|
13492
|
+
thisStart >>>= 0;
|
|
13493
|
+
thisEnd >>>= 0;
|
|
13494
|
+
if (this === target) return 0;
|
|
13495
|
+
var x = thisEnd - thisStart;
|
|
13496
|
+
var y = end - start;
|
|
13497
|
+
var len = Math.min(x, y);
|
|
13498
|
+
var thisCopy = this.slice(thisStart, thisEnd);
|
|
13499
|
+
var targetCopy = target.slice(start, end);
|
|
13500
|
+
for (var i = 0; i < len; ++i) {
|
|
13501
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
13502
|
+
x = thisCopy[i];
|
|
13503
|
+
y = targetCopy[i];
|
|
13504
|
+
break;
|
|
13505
|
+
}
|
|
13506
|
+
}
|
|
13507
|
+
if (x < y) return -1;
|
|
13508
|
+
if (y < x) return 1;
|
|
13509
|
+
return 0;
|
|
13510
|
+
};
|
|
13511
|
+
|
|
13512
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
13513
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
13514
|
+
//
|
|
13515
|
+
// Arguments:
|
|
13516
|
+
// - buffer - a Buffer to search
|
|
13517
|
+
// - val - a string, Buffer, or number
|
|
13518
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
13519
|
+
// - encoding - an optional encoding, relevant is val is a string
|
|
13520
|
+
// - dir - true for indexOf, false for lastIndexOf
|
|
13521
|
+
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
13522
|
+
// Empty buffer means no match
|
|
13523
|
+
if (buffer.length === 0) return -1;
|
|
13524
|
+
|
|
13525
|
+
// Normalize byteOffset
|
|
13526
|
+
if (typeof byteOffset === 'string') {
|
|
13527
|
+
encoding = byteOffset;
|
|
13528
|
+
byteOffset = 0;
|
|
13529
|
+
} else if (byteOffset > 0x7fffffff) {
|
|
13530
|
+
byteOffset = 0x7fffffff;
|
|
13531
|
+
} else if (byteOffset < -0x80000000) {
|
|
13532
|
+
byteOffset = -0x80000000;
|
|
13533
|
+
}
|
|
13534
|
+
byteOffset = +byteOffset; // Coerce to Number.
|
|
13535
|
+
if (numberIsNaN(byteOffset)) {
|
|
13536
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
13537
|
+
byteOffset = dir ? 0 : buffer.length - 1;
|
|
13538
|
+
}
|
|
13539
|
+
|
|
13540
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
13541
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
13542
|
+
if (byteOffset >= buffer.length) {
|
|
13543
|
+
if (dir) return -1;else byteOffset = buffer.length - 1;
|
|
13544
|
+
} else if (byteOffset < 0) {
|
|
13545
|
+
if (dir) byteOffset = 0;else return -1;
|
|
13546
|
+
}
|
|
13547
|
+
|
|
13548
|
+
// Normalize val
|
|
13549
|
+
if (typeof val === 'string') {
|
|
13550
|
+
val = Buffer.from(val, encoding);
|
|
13551
|
+
}
|
|
13552
|
+
|
|
13553
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
13554
|
+
if (Buffer.isBuffer(val)) {
|
|
13555
|
+
// Special case: looking for empty string/buffer always fails
|
|
13556
|
+
if (val.length === 0) {
|
|
13557
|
+
return -1;
|
|
13558
|
+
}
|
|
13559
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
13560
|
+
} else if (typeof val === 'number') {
|
|
13561
|
+
val = val & 0xFF; // Search for a byte value [0-255]
|
|
13562
|
+
if (typeof Uint8Array.prototype.indexOf === 'function') {
|
|
13563
|
+
if (dir) {
|
|
13564
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
13565
|
+
} else {
|
|
13566
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
13567
|
+
}
|
|
13568
|
+
}
|
|
13569
|
+
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
13570
|
+
}
|
|
13571
|
+
throw new TypeError('val must be string, number or Buffer');
|
|
13572
|
+
}
|
|
13573
|
+
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
13574
|
+
var indexSize = 1;
|
|
13575
|
+
var arrLength = arr.length;
|
|
13576
|
+
var valLength = val.length;
|
|
13577
|
+
if (encoding !== undefined) {
|
|
13578
|
+
encoding = String(encoding).toLowerCase();
|
|
13579
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
13580
|
+
if (arr.length < 2 || val.length < 2) {
|
|
13581
|
+
return -1;
|
|
13582
|
+
}
|
|
13583
|
+
indexSize = 2;
|
|
13584
|
+
arrLength /= 2;
|
|
13585
|
+
valLength /= 2;
|
|
13586
|
+
byteOffset /= 2;
|
|
13587
|
+
}
|
|
13588
|
+
}
|
|
13589
|
+
function read(buf, i) {
|
|
13590
|
+
if (indexSize === 1) {
|
|
13591
|
+
return buf[i];
|
|
13592
|
+
} else {
|
|
13593
|
+
return buf.readUInt16BE(i * indexSize);
|
|
13594
|
+
}
|
|
13595
|
+
}
|
|
13596
|
+
var i;
|
|
13597
|
+
if (dir) {
|
|
13598
|
+
var foundIndex = -1;
|
|
13599
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
13600
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
13601
|
+
if (foundIndex === -1) foundIndex = i;
|
|
13602
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
13603
|
+
} else {
|
|
13604
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
13605
|
+
foundIndex = -1;
|
|
13606
|
+
}
|
|
13607
|
+
}
|
|
13608
|
+
} else {
|
|
13609
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
13610
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
13611
|
+
var found = true;
|
|
13612
|
+
for (var j = 0; j < valLength; j++) {
|
|
13613
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
13614
|
+
found = false;
|
|
13615
|
+
break;
|
|
13616
|
+
}
|
|
13617
|
+
}
|
|
13618
|
+
if (found) return i;
|
|
13619
|
+
}
|
|
13620
|
+
}
|
|
13621
|
+
return -1;
|
|
13622
|
+
}
|
|
13623
|
+
Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
13624
|
+
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
13625
|
+
};
|
|
13626
|
+
Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
13627
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
13628
|
+
};
|
|
13629
|
+
Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
13630
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
13631
|
+
};
|
|
13632
|
+
function hexWrite(buf, string, offset, length) {
|
|
13633
|
+
offset = Number(offset) || 0;
|
|
13634
|
+
var remaining = buf.length - offset;
|
|
13635
|
+
if (!length) {
|
|
13636
|
+
length = remaining;
|
|
13637
|
+
} else {
|
|
13638
|
+
length = Number(length);
|
|
13639
|
+
if (length > remaining) {
|
|
13640
|
+
length = remaining;
|
|
13641
|
+
}
|
|
13642
|
+
}
|
|
13643
|
+
var strLen = string.length;
|
|
13644
|
+
if (length > strLen / 2) {
|
|
13645
|
+
length = strLen / 2;
|
|
13646
|
+
}
|
|
13647
|
+
var i;
|
|
13648
|
+
for (i = 0; i < length; ++i) {
|
|
13649
|
+
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
13650
|
+
if (numberIsNaN(parsed)) return i;
|
|
13651
|
+
buf[offset + i] = parsed;
|
|
13652
|
+
}
|
|
13653
|
+
return i;
|
|
13654
|
+
}
|
|
13655
|
+
function utf8Write(buf, string, offset, length) {
|
|
13656
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
13657
|
+
}
|
|
13658
|
+
function asciiWrite(buf, string, offset, length) {
|
|
13659
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
13660
|
+
}
|
|
13661
|
+
function base64Write(buf, string, offset, length) {
|
|
13662
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
13663
|
+
}
|
|
13664
|
+
function ucs2Write(buf, string, offset, length) {
|
|
13665
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
13666
|
+
}
|
|
13667
|
+
Buffer.prototype.write = function write(string, offset, length, encoding) {
|
|
13668
|
+
// Buffer#write(string)
|
|
13669
|
+
if (offset === undefined) {
|
|
13670
|
+
encoding = 'utf8';
|
|
13671
|
+
length = this.length;
|
|
13672
|
+
offset = 0;
|
|
13673
|
+
// Buffer#write(string, encoding)
|
|
13674
|
+
} else if (length === undefined && typeof offset === 'string') {
|
|
13675
|
+
encoding = offset;
|
|
13676
|
+
length = this.length;
|
|
13677
|
+
offset = 0;
|
|
13678
|
+
// Buffer#write(string, offset[, length][, encoding])
|
|
13679
|
+
} else if (isFinite(offset)) {
|
|
13680
|
+
offset = offset >>> 0;
|
|
13681
|
+
if (isFinite(length)) {
|
|
13682
|
+
length = length >>> 0;
|
|
13683
|
+
if (encoding === undefined) encoding = 'utf8';
|
|
13684
|
+
} else {
|
|
13685
|
+
encoding = length;
|
|
13686
|
+
length = undefined;
|
|
13687
|
+
}
|
|
13688
|
+
} else {
|
|
13689
|
+
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
|
13690
|
+
}
|
|
13691
|
+
var remaining = this.length - offset;
|
|
13692
|
+
if (length === undefined || length > remaining) length = remaining;
|
|
13693
|
+
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
13694
|
+
throw new RangeError('Attempt to write outside buffer bounds');
|
|
13695
|
+
}
|
|
13696
|
+
if (!encoding) encoding = 'utf8';
|
|
13697
|
+
var loweredCase = false;
|
|
13698
|
+
for (;;) {
|
|
13699
|
+
switch (encoding) {
|
|
13700
|
+
case 'hex':
|
|
13701
|
+
return hexWrite(this, string, offset, length);
|
|
13702
|
+
case 'utf8':
|
|
13703
|
+
case 'utf-8':
|
|
13704
|
+
return utf8Write(this, string, offset, length);
|
|
13705
|
+
case 'ascii':
|
|
13706
|
+
case 'latin1':
|
|
13707
|
+
case 'binary':
|
|
13708
|
+
return asciiWrite(this, string, offset, length);
|
|
13709
|
+
case 'base64':
|
|
13710
|
+
// Warning: maxLength not taken into account in base64Write
|
|
13711
|
+
return base64Write(this, string, offset, length);
|
|
13712
|
+
case 'ucs2':
|
|
13713
|
+
case 'ucs-2':
|
|
13714
|
+
case 'utf16le':
|
|
13715
|
+
case 'utf-16le':
|
|
13716
|
+
return ucs2Write(this, string, offset, length);
|
|
13717
|
+
default:
|
|
13718
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13719
|
+
encoding = ('' + encoding).toLowerCase();
|
|
13720
|
+
loweredCase = true;
|
|
13721
|
+
}
|
|
13722
|
+
}
|
|
13723
|
+
};
|
|
13724
|
+
Buffer.prototype.toJSON = function toJSON() {
|
|
13725
|
+
return {
|
|
13726
|
+
type: 'Buffer',
|
|
13727
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
13728
|
+
};
|
|
13729
|
+
};
|
|
13730
|
+
function base64Slice(buf, start, end) {
|
|
13731
|
+
if (start === 0 && end === buf.length) {
|
|
13732
|
+
return base64Js.fromByteArray(buf);
|
|
13733
|
+
} else {
|
|
13734
|
+
return base64Js.fromByteArray(buf.slice(start, end));
|
|
13735
|
+
}
|
|
13736
|
+
}
|
|
13737
|
+
function utf8Slice(buf, start, end) {
|
|
13738
|
+
end = Math.min(buf.length, end);
|
|
13739
|
+
var res = [];
|
|
13740
|
+
var i = start;
|
|
13741
|
+
while (i < end) {
|
|
13742
|
+
var firstByte = buf[i];
|
|
13743
|
+
var codePoint = null;
|
|
13744
|
+
var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
|
|
13745
|
+
if (i + bytesPerSequence <= end) {
|
|
13746
|
+
var secondByte = void 0,
|
|
13747
|
+
thirdByte = void 0,
|
|
13748
|
+
fourthByte = void 0,
|
|
13749
|
+
tempCodePoint = void 0;
|
|
13750
|
+
switch (bytesPerSequence) {
|
|
13751
|
+
case 1:
|
|
13752
|
+
if (firstByte < 0x80) {
|
|
13753
|
+
codePoint = firstByte;
|
|
13754
|
+
}
|
|
13755
|
+
break;
|
|
13756
|
+
case 2:
|
|
13757
|
+
secondByte = buf[i + 1];
|
|
13758
|
+
if ((secondByte & 0xC0) === 0x80) {
|
|
13759
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
|
|
13760
|
+
if (tempCodePoint > 0x7F) {
|
|
13761
|
+
codePoint = tempCodePoint;
|
|
13762
|
+
}
|
|
13763
|
+
}
|
|
13764
|
+
break;
|
|
13765
|
+
case 3:
|
|
13766
|
+
secondByte = buf[i + 1];
|
|
13767
|
+
thirdByte = buf[i + 2];
|
|
13768
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
13769
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
|
|
13770
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
13771
|
+
codePoint = tempCodePoint;
|
|
13772
|
+
}
|
|
13773
|
+
}
|
|
13774
|
+
break;
|
|
13775
|
+
case 4:
|
|
13776
|
+
secondByte = buf[i + 1];
|
|
13777
|
+
thirdByte = buf[i + 2];
|
|
13778
|
+
fourthByte = buf[i + 3];
|
|
13779
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
13780
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
|
|
13781
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
13782
|
+
codePoint = tempCodePoint;
|
|
13783
|
+
}
|
|
13784
|
+
}
|
|
13785
|
+
}
|
|
13786
|
+
}
|
|
13787
|
+
if (codePoint === null) {
|
|
13788
|
+
// we did not generate a valid codePoint so insert a
|
|
13789
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
|
13790
|
+
codePoint = 0xFFFD;
|
|
13791
|
+
bytesPerSequence = 1;
|
|
13792
|
+
} else if (codePoint > 0xFFFF) {
|
|
13793
|
+
// encode to utf16 (surrogate pair dance)
|
|
13794
|
+
codePoint -= 0x10000;
|
|
13795
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
13796
|
+
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
13797
|
+
}
|
|
13798
|
+
res.push(codePoint);
|
|
13799
|
+
i += bytesPerSequence;
|
|
13800
|
+
}
|
|
13801
|
+
return decodeCodePointsArray(res);
|
|
13802
|
+
}
|
|
13803
|
+
|
|
13804
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
13805
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
|
13806
|
+
// We go 1 magnitude less, for safety
|
|
13807
|
+
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
13808
|
+
function decodeCodePointsArray(codePoints) {
|
|
13809
|
+
var len = codePoints.length;
|
|
13810
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
13811
|
+
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
|
13812
|
+
}
|
|
13813
|
+
|
|
13814
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
|
13815
|
+
var res = '';
|
|
13816
|
+
var i = 0;
|
|
13817
|
+
while (i < len) {
|
|
13818
|
+
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
|
|
13819
|
+
}
|
|
13820
|
+
return res;
|
|
13821
|
+
}
|
|
13822
|
+
function asciiSlice(buf, start, end) {
|
|
13823
|
+
var ret = '';
|
|
13824
|
+
end = Math.min(buf.length, end);
|
|
13825
|
+
for (var i = start; i < end; ++i) {
|
|
13826
|
+
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
13827
|
+
}
|
|
13828
|
+
return ret;
|
|
13829
|
+
}
|
|
13830
|
+
function latin1Slice(buf, start, end) {
|
|
13831
|
+
var ret = '';
|
|
13832
|
+
end = Math.min(buf.length, end);
|
|
13833
|
+
for (var i = start; i < end; ++i) {
|
|
13834
|
+
ret += String.fromCharCode(buf[i]);
|
|
13835
|
+
}
|
|
13836
|
+
return ret;
|
|
13837
|
+
}
|
|
13838
|
+
function hexSlice(buf, start, end) {
|
|
13839
|
+
var len = buf.length;
|
|
13840
|
+
if (!start || start < 0) start = 0;
|
|
13841
|
+
if (!end || end < 0 || end > len) end = len;
|
|
13842
|
+
var out = '';
|
|
13843
|
+
for (var i = start; i < end; ++i) {
|
|
13844
|
+
out += hexSliceLookupTable[buf[i]];
|
|
13845
|
+
}
|
|
13846
|
+
return out;
|
|
13847
|
+
}
|
|
13848
|
+
function utf16leSlice(buf, start, end) {
|
|
13849
|
+
var bytes = buf.slice(start, end);
|
|
13850
|
+
var res = '';
|
|
13851
|
+
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
|
13852
|
+
for (var i = 0; i < bytes.length - 1; i += 2) {
|
|
13853
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
13854
|
+
}
|
|
13855
|
+
return res;
|
|
13856
|
+
}
|
|
13857
|
+
Buffer.prototype.slice = function slice(start, end) {
|
|
13858
|
+
var len = this.length;
|
|
13859
|
+
start = ~~start;
|
|
13860
|
+
end = end === undefined ? len : ~~end;
|
|
13861
|
+
if (start < 0) {
|
|
13862
|
+
start += len;
|
|
13863
|
+
if (start < 0) start = 0;
|
|
13864
|
+
} else if (start > len) {
|
|
13865
|
+
start = len;
|
|
13866
|
+
}
|
|
13867
|
+
if (end < 0) {
|
|
13868
|
+
end += len;
|
|
13869
|
+
if (end < 0) end = 0;
|
|
13870
|
+
} else if (end > len) {
|
|
13871
|
+
end = len;
|
|
13872
|
+
}
|
|
13873
|
+
if (end < start) end = start;
|
|
13874
|
+
var newBuf = this.subarray(start, end);
|
|
13875
|
+
// Return an augmented `Uint8Array` instance
|
|
13876
|
+
Object.setPrototypeOf(newBuf, Buffer.prototype);
|
|
13877
|
+
return newBuf;
|
|
13878
|
+
};
|
|
13879
|
+
|
|
13880
|
+
/*
|
|
13881
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
13882
|
+
*/
|
|
13883
|
+
function checkOffset(offset, ext, length) {
|
|
13884
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
|
|
13885
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
|
|
13886
|
+
}
|
|
13887
|
+
Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
|
|
13888
|
+
offset = offset >>> 0;
|
|
13889
|
+
byteLength = byteLength >>> 0;
|
|
13890
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13891
|
+
var val = this[offset];
|
|
13892
|
+
var mul = 1;
|
|
13893
|
+
var i = 0;
|
|
13894
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
13895
|
+
val += this[offset + i] * mul;
|
|
13896
|
+
}
|
|
13897
|
+
return val;
|
|
13898
|
+
};
|
|
13899
|
+
Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
|
|
13900
|
+
offset = offset >>> 0;
|
|
13901
|
+
byteLength = byteLength >>> 0;
|
|
13902
|
+
if (!noAssert) {
|
|
13903
|
+
checkOffset(offset, byteLength, this.length);
|
|
13904
|
+
}
|
|
13905
|
+
var val = this[offset + --byteLength];
|
|
13906
|
+
var mul = 1;
|
|
13907
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
|
13908
|
+
val += this[offset + --byteLength] * mul;
|
|
13909
|
+
}
|
|
13910
|
+
return val;
|
|
13911
|
+
};
|
|
13912
|
+
Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
13913
|
+
offset = offset >>> 0;
|
|
13914
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13915
|
+
return this[offset];
|
|
13916
|
+
};
|
|
13917
|
+
Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
13918
|
+
offset = offset >>> 0;
|
|
13919
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13920
|
+
return this[offset] | this[offset + 1] << 8;
|
|
13921
|
+
};
|
|
13922
|
+
Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
13923
|
+
offset = offset >>> 0;
|
|
13924
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13925
|
+
return this[offset] << 8 | this[offset + 1];
|
|
13926
|
+
};
|
|
13927
|
+
Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
13928
|
+
offset = offset >>> 0;
|
|
13929
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13930
|
+
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
|
|
13931
|
+
};
|
|
13932
|
+
Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
13933
|
+
offset = offset >>> 0;
|
|
13934
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13935
|
+
return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
13936
|
+
};
|
|
13937
|
+
Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
|
|
13938
|
+
offset = offset >>> 0;
|
|
13939
|
+
validateNumber(offset, 'offset');
|
|
13940
|
+
var first = this[offset];
|
|
13941
|
+
var last = this[offset + 7];
|
|
13942
|
+
if (first === undefined || last === undefined) {
|
|
13943
|
+
boundsError(offset, this.length - 8);
|
|
13944
|
+
}
|
|
13945
|
+
var lo = first + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 24);
|
|
13946
|
+
var hi = this[++offset] + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + last * Math.pow(2, 24);
|
|
13947
|
+
return BigInt(lo) + (BigInt(hi) << BigInt(32));
|
|
13948
|
+
});
|
|
13949
|
+
Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
|
|
13950
|
+
offset = offset >>> 0;
|
|
13951
|
+
validateNumber(offset, 'offset');
|
|
13952
|
+
var first = this[offset];
|
|
13953
|
+
var last = this[offset + 7];
|
|
13954
|
+
if (first === undefined || last === undefined) {
|
|
13955
|
+
boundsError(offset, this.length - 8);
|
|
13956
|
+
}
|
|
13957
|
+
var hi = first * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + this[++offset];
|
|
13958
|
+
var lo = this[++offset] * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + last;
|
|
13959
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
13960
|
+
});
|
|
13961
|
+
Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
|
|
13962
|
+
offset = offset >>> 0;
|
|
13963
|
+
byteLength = byteLength >>> 0;
|
|
13964
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13965
|
+
var val = this[offset];
|
|
13966
|
+
var mul = 1;
|
|
13967
|
+
var i = 0;
|
|
13968
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
13969
|
+
val += this[offset + i] * mul;
|
|
13970
|
+
}
|
|
13971
|
+
mul *= 0x80;
|
|
13972
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13973
|
+
return val;
|
|
13974
|
+
};
|
|
13975
|
+
Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
|
|
13976
|
+
offset = offset >>> 0;
|
|
13977
|
+
byteLength = byteLength >>> 0;
|
|
13978
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13979
|
+
var i = byteLength;
|
|
13980
|
+
var mul = 1;
|
|
13981
|
+
var val = this[offset + --i];
|
|
13982
|
+
while (i > 0 && (mul *= 0x100)) {
|
|
13983
|
+
val += this[offset + --i] * mul;
|
|
13984
|
+
}
|
|
13985
|
+
mul *= 0x80;
|
|
13986
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13987
|
+
return val;
|
|
13988
|
+
};
|
|
13989
|
+
Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
13990
|
+
offset = offset >>> 0;
|
|
13991
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13992
|
+
if (!(this[offset] & 0x80)) return this[offset];
|
|
13993
|
+
return (0xff - this[offset] + 1) * -1;
|
|
13994
|
+
};
|
|
13995
|
+
Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
13996
|
+
offset = offset >>> 0;
|
|
13997
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13998
|
+
var val = this[offset] | this[offset + 1] << 8;
|
|
13999
|
+
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
14000
|
+
};
|
|
14001
|
+
Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
14002
|
+
offset = offset >>> 0;
|
|
14003
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
14004
|
+
var val = this[offset + 1] | this[offset] << 8;
|
|
14005
|
+
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
14006
|
+
};
|
|
14007
|
+
Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
14008
|
+
offset = offset >>> 0;
|
|
14009
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
14010
|
+
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
14011
|
+
};
|
|
14012
|
+
Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
14013
|
+
offset = offset >>> 0;
|
|
14014
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
14015
|
+
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
14016
|
+
};
|
|
14017
|
+
Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
|
|
14018
|
+
offset = offset >>> 0;
|
|
14019
|
+
validateNumber(offset, 'offset');
|
|
14020
|
+
var first = this[offset];
|
|
14021
|
+
var last = this[offset + 7];
|
|
14022
|
+
if (first === undefined || last === undefined) {
|
|
14023
|
+
boundsError(offset, this.length - 8);
|
|
14024
|
+
}
|
|
14025
|
+
var val = this[offset + 4] + this[offset + 5] * Math.pow(2, 8) + this[offset + 6] * Math.pow(2, 16) + (last << 24); // Overflow
|
|
14026
|
+
|
|
14027
|
+
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * Math.pow(2, 8) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 24));
|
|
14028
|
+
});
|
|
14029
|
+
Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
|
|
14030
|
+
offset = offset >>> 0;
|
|
14031
|
+
validateNumber(offset, 'offset');
|
|
14032
|
+
var first = this[offset];
|
|
14033
|
+
var last = this[offset + 7];
|
|
14034
|
+
if (first === undefined || last === undefined) {
|
|
14035
|
+
boundsError(offset, this.length - 8);
|
|
14036
|
+
}
|
|
14037
|
+
var val = (first << 24) +
|
|
14038
|
+
// Overflow
|
|
14039
|
+
this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + this[++offset];
|
|
14040
|
+
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * Math.pow(2, 24) + this[++offset] * Math.pow(2, 16) + this[++offset] * Math.pow(2, 8) + last);
|
|
14041
|
+
});
|
|
14042
|
+
Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
14043
|
+
offset = offset >>> 0;
|
|
14044
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
14045
|
+
return ieee754.read(this, offset, true, 23, 4);
|
|
14046
|
+
};
|
|
14047
|
+
Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
14048
|
+
offset = offset >>> 0;
|
|
14049
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
14050
|
+
return ieee754.read(this, offset, false, 23, 4);
|
|
14051
|
+
};
|
|
14052
|
+
Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
14053
|
+
offset = offset >>> 0;
|
|
14054
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
14055
|
+
return ieee754.read(this, offset, true, 52, 8);
|
|
14056
|
+
};
|
|
14057
|
+
Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
14058
|
+
offset = offset >>> 0;
|
|
14059
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
14060
|
+
return ieee754.read(this, offset, false, 52, 8);
|
|
14061
|
+
};
|
|
14062
|
+
function checkInt(buf, value, offset, ext, max, min) {
|
|
14063
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
14064
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
14065
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
14066
|
+
}
|
|
14067
|
+
Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
|
|
14068
|
+
value = +value;
|
|
14069
|
+
offset = offset >>> 0;
|
|
14070
|
+
byteLength = byteLength >>> 0;
|
|
14071
|
+
if (!noAssert) {
|
|
14072
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
14073
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
14074
|
+
}
|
|
14075
|
+
var mul = 1;
|
|
14076
|
+
var i = 0;
|
|
14077
|
+
this[offset] = value & 0xFF;
|
|
14078
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
14079
|
+
this[offset + i] = value / mul & 0xFF;
|
|
14080
|
+
}
|
|
14081
|
+
return offset + byteLength;
|
|
14082
|
+
};
|
|
14083
|
+
Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
|
|
14084
|
+
value = +value;
|
|
14085
|
+
offset = offset >>> 0;
|
|
14086
|
+
byteLength = byteLength >>> 0;
|
|
14087
|
+
if (!noAssert) {
|
|
14088
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
14089
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
14090
|
+
}
|
|
14091
|
+
var i = byteLength - 1;
|
|
14092
|
+
var mul = 1;
|
|
14093
|
+
this[offset + i] = value & 0xFF;
|
|
14094
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
14095
|
+
this[offset + i] = value / mul & 0xFF;
|
|
14096
|
+
}
|
|
14097
|
+
return offset + byteLength;
|
|
14098
|
+
};
|
|
14099
|
+
Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
14100
|
+
value = +value;
|
|
14101
|
+
offset = offset >>> 0;
|
|
14102
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
14103
|
+
this[offset] = value & 0xff;
|
|
14104
|
+
return offset + 1;
|
|
14105
|
+
};
|
|
14106
|
+
Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
14107
|
+
value = +value;
|
|
14108
|
+
offset = offset >>> 0;
|
|
14109
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
14110
|
+
this[offset] = value & 0xff;
|
|
14111
|
+
this[offset + 1] = value >>> 8;
|
|
14112
|
+
return offset + 2;
|
|
14113
|
+
};
|
|
14114
|
+
Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
14115
|
+
value = +value;
|
|
14116
|
+
offset = offset >>> 0;
|
|
14117
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
14118
|
+
this[offset] = value >>> 8;
|
|
14119
|
+
this[offset + 1] = value & 0xff;
|
|
14120
|
+
return offset + 2;
|
|
14121
|
+
};
|
|
14122
|
+
Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
14123
|
+
value = +value;
|
|
14124
|
+
offset = offset >>> 0;
|
|
14125
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14126
|
+
this[offset + 3] = value >>> 24;
|
|
14127
|
+
this[offset + 2] = value >>> 16;
|
|
14128
|
+
this[offset + 1] = value >>> 8;
|
|
14129
|
+
this[offset] = value & 0xff;
|
|
14130
|
+
return offset + 4;
|
|
14131
|
+
};
|
|
14132
|
+
Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
14133
|
+
value = +value;
|
|
14134
|
+
offset = offset >>> 0;
|
|
14135
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14136
|
+
this[offset] = value >>> 24;
|
|
14137
|
+
this[offset + 1] = value >>> 16;
|
|
14138
|
+
this[offset + 2] = value >>> 8;
|
|
14139
|
+
this[offset + 3] = value & 0xff;
|
|
14140
|
+
return offset + 4;
|
|
14141
|
+
};
|
|
14142
|
+
function wrtBigUInt64LE(buf, value, offset, min, max) {
|
|
14143
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
14144
|
+
var lo = Number(value & BigInt(0xffffffff));
|
|
14145
|
+
buf[offset++] = lo;
|
|
14146
|
+
lo = lo >> 8;
|
|
14147
|
+
buf[offset++] = lo;
|
|
14148
|
+
lo = lo >> 8;
|
|
14149
|
+
buf[offset++] = lo;
|
|
14150
|
+
lo = lo >> 8;
|
|
14151
|
+
buf[offset++] = lo;
|
|
14152
|
+
var hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
|
|
14153
|
+
buf[offset++] = hi;
|
|
14154
|
+
hi = hi >> 8;
|
|
14155
|
+
buf[offset++] = hi;
|
|
14156
|
+
hi = hi >> 8;
|
|
14157
|
+
buf[offset++] = hi;
|
|
14158
|
+
hi = hi >> 8;
|
|
14159
|
+
buf[offset++] = hi;
|
|
14160
|
+
return offset;
|
|
14161
|
+
}
|
|
14162
|
+
function wrtBigUInt64BE(buf, value, offset, min, max) {
|
|
14163
|
+
checkIntBI(value, min, max, buf, offset, 7);
|
|
14164
|
+
var lo = Number(value & BigInt(0xffffffff));
|
|
14165
|
+
buf[offset + 7] = lo;
|
|
14166
|
+
lo = lo >> 8;
|
|
14167
|
+
buf[offset + 6] = lo;
|
|
14168
|
+
lo = lo >> 8;
|
|
14169
|
+
buf[offset + 5] = lo;
|
|
14170
|
+
lo = lo >> 8;
|
|
14171
|
+
buf[offset + 4] = lo;
|
|
14172
|
+
var hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
|
|
14173
|
+
buf[offset + 3] = hi;
|
|
14174
|
+
hi = hi >> 8;
|
|
14175
|
+
buf[offset + 2] = hi;
|
|
14176
|
+
hi = hi >> 8;
|
|
14177
|
+
buf[offset + 1] = hi;
|
|
14178
|
+
hi = hi >> 8;
|
|
14179
|
+
buf[offset] = hi;
|
|
14180
|
+
return offset + 8;
|
|
14181
|
+
}
|
|
14182
|
+
Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value) {
|
|
14183
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14184
|
+
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'));
|
|
14185
|
+
});
|
|
14186
|
+
Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value) {
|
|
14187
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14188
|
+
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'));
|
|
14189
|
+
});
|
|
14190
|
+
Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
|
|
14191
|
+
value = +value;
|
|
14192
|
+
offset = offset >>> 0;
|
|
14193
|
+
if (!noAssert) {
|
|
14194
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14195
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14196
|
+
}
|
|
14197
|
+
var i = 0;
|
|
14198
|
+
var mul = 1;
|
|
14199
|
+
var sub = 0;
|
|
14200
|
+
this[offset] = value & 0xFF;
|
|
14201
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
14202
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
14203
|
+
sub = 1;
|
|
14204
|
+
}
|
|
14205
|
+
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14206
|
+
}
|
|
14207
|
+
return offset + byteLength;
|
|
14208
|
+
};
|
|
14209
|
+
Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
|
|
14210
|
+
value = +value;
|
|
14211
|
+
offset = offset >>> 0;
|
|
14212
|
+
if (!noAssert) {
|
|
14213
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14214
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14215
|
+
}
|
|
14216
|
+
var i = byteLength - 1;
|
|
14217
|
+
var mul = 1;
|
|
14218
|
+
var sub = 0;
|
|
14219
|
+
this[offset + i] = value & 0xFF;
|
|
14220
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
14221
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
14222
|
+
sub = 1;
|
|
14223
|
+
}
|
|
14224
|
+
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14225
|
+
}
|
|
14226
|
+
return offset + byteLength;
|
|
14227
|
+
};
|
|
14228
|
+
Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
14229
|
+
value = +value;
|
|
14230
|
+
offset = offset >>> 0;
|
|
14231
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
14232
|
+
if (value < 0) value = 0xff + value + 1;
|
|
14233
|
+
this[offset] = value & 0xff;
|
|
14234
|
+
return offset + 1;
|
|
14235
|
+
};
|
|
14236
|
+
Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
14237
|
+
value = +value;
|
|
14238
|
+
offset = offset >>> 0;
|
|
14239
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14240
|
+
this[offset] = value & 0xff;
|
|
14241
|
+
this[offset + 1] = value >>> 8;
|
|
14242
|
+
return offset + 2;
|
|
14243
|
+
};
|
|
14244
|
+
Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
14245
|
+
value = +value;
|
|
14246
|
+
offset = offset >>> 0;
|
|
14247
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14248
|
+
this[offset] = value >>> 8;
|
|
14249
|
+
this[offset + 1] = value & 0xff;
|
|
14250
|
+
return offset + 2;
|
|
14251
|
+
};
|
|
14252
|
+
Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
14253
|
+
value = +value;
|
|
14254
|
+
offset = offset >>> 0;
|
|
14255
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14256
|
+
this[offset] = value & 0xff;
|
|
14257
|
+
this[offset + 1] = value >>> 8;
|
|
14258
|
+
this[offset + 2] = value >>> 16;
|
|
14259
|
+
this[offset + 3] = value >>> 24;
|
|
14260
|
+
return offset + 4;
|
|
14261
|
+
};
|
|
14262
|
+
Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
14263
|
+
value = +value;
|
|
14264
|
+
offset = offset >>> 0;
|
|
14265
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14266
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
14267
|
+
this[offset] = value >>> 24;
|
|
14268
|
+
this[offset + 1] = value >>> 16;
|
|
14269
|
+
this[offset + 2] = value >>> 8;
|
|
14270
|
+
this[offset + 3] = value & 0xff;
|
|
14271
|
+
return offset + 4;
|
|
14272
|
+
};
|
|
14273
|
+
Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value) {
|
|
14274
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14275
|
+
return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'));
|
|
14276
|
+
});
|
|
14277
|
+
Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value) {
|
|
14278
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14279
|
+
return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'));
|
|
14280
|
+
});
|
|
14281
|
+
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
14282
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
14283
|
+
if (offset < 0) throw new RangeError('Index out of range');
|
|
14284
|
+
}
|
|
14285
|
+
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
14286
|
+
value = +value;
|
|
14287
|
+
offset = offset >>> 0;
|
|
14288
|
+
if (!noAssert) {
|
|
14289
|
+
checkIEEE754(buf, value, offset, 4);
|
|
14290
|
+
}
|
|
14291
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4);
|
|
14292
|
+
return offset + 4;
|
|
14293
|
+
}
|
|
14294
|
+
Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
14295
|
+
return writeFloat(this, value, offset, true, noAssert);
|
|
14296
|
+
};
|
|
14297
|
+
Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
14298
|
+
return writeFloat(this, value, offset, false, noAssert);
|
|
14299
|
+
};
|
|
14300
|
+
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
14301
|
+
value = +value;
|
|
14302
|
+
offset = offset >>> 0;
|
|
14303
|
+
if (!noAssert) {
|
|
14304
|
+
checkIEEE754(buf, value, offset, 8);
|
|
14305
|
+
}
|
|
14306
|
+
ieee754.write(buf, value, offset, littleEndian, 52, 8);
|
|
14307
|
+
return offset + 8;
|
|
14308
|
+
}
|
|
14309
|
+
Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
14310
|
+
return writeDouble(this, value, offset, true, noAssert);
|
|
14311
|
+
};
|
|
14312
|
+
Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
14313
|
+
return writeDouble(this, value, offset, false, noAssert);
|
|
14314
|
+
};
|
|
14315
|
+
|
|
14316
|
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
14317
|
+
Buffer.prototype.copy = function copy(target, targetStart, start, end) {
|
|
14318
|
+
if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer');
|
|
14319
|
+
if (!start) start = 0;
|
|
14320
|
+
if (!end && end !== 0) end = this.length;
|
|
14321
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
14322
|
+
if (!targetStart) targetStart = 0;
|
|
14323
|
+
if (end > 0 && end < start) end = start;
|
|
14324
|
+
|
|
14325
|
+
// Copy 0 bytes; we're done
|
|
14326
|
+
if (end === start) return 0;
|
|
14327
|
+
if (target.length === 0 || this.length === 0) return 0;
|
|
14328
|
+
|
|
14329
|
+
// Fatal error conditions
|
|
14330
|
+
if (targetStart < 0) {
|
|
14331
|
+
throw new RangeError('targetStart out of bounds');
|
|
14332
|
+
}
|
|
14333
|
+
if (start < 0 || start >= this.length) throw new RangeError('Index out of range');
|
|
14334
|
+
if (end < 0) throw new RangeError('sourceEnd out of bounds');
|
|
14335
|
+
|
|
14336
|
+
// Are we oob?
|
|
14337
|
+
if (end > this.length) end = this.length;
|
|
14338
|
+
if (target.length - targetStart < end - start) {
|
|
14339
|
+
end = target.length - targetStart + start;
|
|
14340
|
+
}
|
|
14341
|
+
var len = end - start;
|
|
14342
|
+
if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
|
14343
|
+
// Use built-in when available, missing from IE11
|
|
14344
|
+
this.copyWithin(targetStart, start, end);
|
|
14345
|
+
} else {
|
|
14346
|
+
Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
|
|
14347
|
+
}
|
|
14348
|
+
return len;
|
|
14349
|
+
};
|
|
14350
|
+
|
|
14351
|
+
// Usage:
|
|
14352
|
+
// buffer.fill(number[, offset[, end]])
|
|
14353
|
+
// buffer.fill(buffer[, offset[, end]])
|
|
14354
|
+
// buffer.fill(string[, offset[, end]][, encoding])
|
|
14355
|
+
Buffer.prototype.fill = function fill(val, start, end, encoding) {
|
|
14356
|
+
// Handle string cases:
|
|
14357
|
+
if (typeof val === 'string') {
|
|
14358
|
+
if (typeof start === 'string') {
|
|
14359
|
+
encoding = start;
|
|
14360
|
+
start = 0;
|
|
14361
|
+
end = this.length;
|
|
14362
|
+
} else if (typeof end === 'string') {
|
|
14363
|
+
encoding = end;
|
|
14364
|
+
end = this.length;
|
|
14365
|
+
}
|
|
14366
|
+
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
14367
|
+
throw new TypeError('encoding must be a string');
|
|
14368
|
+
}
|
|
14369
|
+
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
14370
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
|
14371
|
+
}
|
|
14372
|
+
if (val.length === 1) {
|
|
14373
|
+
var code = val.charCodeAt(0);
|
|
14374
|
+
if (encoding === 'utf8' && code < 128 || encoding === 'latin1') {
|
|
14375
|
+
// Fast path: If `val` fits into a single byte, use that numeric value.
|
|
14376
|
+
val = code;
|
|
14377
|
+
}
|
|
14378
|
+
}
|
|
14379
|
+
} else if (typeof val === 'number') {
|
|
14380
|
+
val = val & 255;
|
|
14381
|
+
} else if (typeof val === 'boolean') {
|
|
14382
|
+
val = Number(val);
|
|
14383
|
+
}
|
|
14384
|
+
|
|
14385
|
+
// Invalid ranges are not set to a default, so can range check early.
|
|
14386
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
14387
|
+
throw new RangeError('Out of range index');
|
|
14388
|
+
}
|
|
14389
|
+
if (end <= start) {
|
|
14390
|
+
return this;
|
|
14391
|
+
}
|
|
14392
|
+
start = start >>> 0;
|
|
14393
|
+
end = end === undefined ? this.length : end >>> 0;
|
|
14394
|
+
if (!val) val = 0;
|
|
14395
|
+
var i;
|
|
14396
|
+
if (typeof val === 'number') {
|
|
14397
|
+
for (i = start; i < end; ++i) {
|
|
14398
|
+
this[i] = val;
|
|
14399
|
+
}
|
|
14400
|
+
} else {
|
|
14401
|
+
var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
|
|
14402
|
+
var len = bytes.length;
|
|
14403
|
+
if (len === 0) {
|
|
14404
|
+
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
|
|
14405
|
+
}
|
|
14406
|
+
for (i = 0; i < end - start; ++i) {
|
|
14407
|
+
this[i + start] = bytes[i % len];
|
|
14408
|
+
}
|
|
14409
|
+
}
|
|
14410
|
+
return this;
|
|
14411
|
+
};
|
|
14412
|
+
|
|
14413
|
+
// CUSTOM ERRORS
|
|
14414
|
+
// =============
|
|
14415
|
+
|
|
14416
|
+
// Simplified versions from Node, changed for Buffer-only usage
|
|
14417
|
+
var errors = {};
|
|
14418
|
+
function E(sym, getMessage, Base) {
|
|
14419
|
+
errors[sym] = /*#__PURE__*/function (_Base) {
|
|
14420
|
+
_inherits(NodeError, _Base);
|
|
14421
|
+
var _super = _createSuper(NodeError);
|
|
14422
|
+
function NodeError() {
|
|
14423
|
+
var _this;
|
|
14424
|
+
_classCallCheck(this, NodeError);
|
|
14425
|
+
_this = _super.call(this);
|
|
14426
|
+
Object.defineProperty(_assertThisInitialized(_this), 'message', {
|
|
14427
|
+
value: getMessage.apply(_assertThisInitialized(_this), arguments),
|
|
14428
|
+
writable: true,
|
|
14429
|
+
configurable: true
|
|
14430
|
+
});
|
|
14431
|
+
|
|
14432
|
+
// Add the error code to the name to include it in the stack trace.
|
|
14433
|
+
_this.name = "".concat(_this.name, " [").concat(sym, "]");
|
|
14434
|
+
// Access the stack to generate the error message including the error code
|
|
14435
|
+
// from the name.
|
|
14436
|
+
_this.stack; // eslint-disable-line no-unused-expressions
|
|
14437
|
+
// Reset the name to the actual name.
|
|
14438
|
+
delete _this.name;
|
|
14439
|
+
return _this;
|
|
14440
|
+
}
|
|
14441
|
+
_createClass(NodeError, [{
|
|
14442
|
+
key: "code",
|
|
14443
|
+
get: function get() {
|
|
14444
|
+
return sym;
|
|
14445
|
+
},
|
|
14446
|
+
set: function set(value) {
|
|
14447
|
+
Object.defineProperty(this, 'code', {
|
|
14448
|
+
configurable: true,
|
|
14449
|
+
enumerable: true,
|
|
14450
|
+
value: value,
|
|
14451
|
+
writable: true
|
|
14452
|
+
});
|
|
14453
|
+
}
|
|
14454
|
+
}, {
|
|
14455
|
+
key: "toString",
|
|
14456
|
+
value: function toString() {
|
|
14457
|
+
return "".concat(this.name, " [").concat(sym, "]: ").concat(this.message);
|
|
14458
|
+
}
|
|
14459
|
+
}]);
|
|
14460
|
+
return NodeError;
|
|
14461
|
+
}(Base);
|
|
14462
|
+
}
|
|
14463
|
+
E('ERR_BUFFER_OUT_OF_BOUNDS', function (name) {
|
|
14464
|
+
if (name) {
|
|
14465
|
+
return "".concat(name, " is outside of buffer bounds");
|
|
14466
|
+
}
|
|
14467
|
+
return 'Attempt to access memory outside buffer bounds';
|
|
14468
|
+
}, RangeError);
|
|
14469
|
+
E('ERR_INVALID_ARG_TYPE', function (name, actual) {
|
|
14470
|
+
return "The \"".concat(name, "\" argument must be of type number. Received type ").concat(_typeof(actual));
|
|
14471
|
+
}, TypeError);
|
|
14472
|
+
E('ERR_OUT_OF_RANGE', function (str, range, input) {
|
|
14473
|
+
var msg = "The value of \"".concat(str, "\" is out of range.");
|
|
14474
|
+
var received = input;
|
|
14475
|
+
if (Number.isInteger(input) && Math.abs(input) > Math.pow(2, 32)) {
|
|
14476
|
+
received = addNumericalSeparator(String(input));
|
|
14477
|
+
} else if (typeof input === 'bigint') {
|
|
14478
|
+
received = String(input);
|
|
14479
|
+
if (input > Math.pow(BigInt(2), BigInt(32)) || input < -Math.pow(BigInt(2), BigInt(32))) {
|
|
14480
|
+
received = addNumericalSeparator(received);
|
|
14481
|
+
}
|
|
14482
|
+
received += 'n';
|
|
14483
|
+
}
|
|
14484
|
+
msg += " It must be ".concat(range, ". Received ").concat(received);
|
|
14485
|
+
return msg;
|
|
14486
|
+
}, RangeError);
|
|
14487
|
+
function addNumericalSeparator(val) {
|
|
14488
|
+
var res = '';
|
|
14489
|
+
var i = val.length;
|
|
14490
|
+
var start = val[0] === '-' ? 1 : 0;
|
|
14491
|
+
for (; i >= start + 4; i -= 3) {
|
|
14492
|
+
res = "_".concat(val.slice(i - 3, i)).concat(res);
|
|
14493
|
+
}
|
|
14494
|
+
return "".concat(val.slice(0, i)).concat(res);
|
|
14495
|
+
}
|
|
14496
|
+
|
|
14497
|
+
// CHECK FUNCTIONS
|
|
14498
|
+
// ===============
|
|
14499
|
+
|
|
14500
|
+
function checkBounds(buf, offset, byteLength) {
|
|
14501
|
+
validateNumber(offset, 'offset');
|
|
14502
|
+
if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
|
|
14503
|
+
boundsError(offset, buf.length - (byteLength + 1));
|
|
14504
|
+
}
|
|
14505
|
+
}
|
|
14506
|
+
function checkIntBI(value, min, max, buf, offset, byteLength) {
|
|
14507
|
+
if (value > max || value < min) {
|
|
14508
|
+
var n = typeof min === 'bigint' ? 'n' : '';
|
|
14509
|
+
var range;
|
|
14510
|
+
if (byteLength > 3) {
|
|
14511
|
+
if (min === 0 || min === BigInt(0)) {
|
|
14512
|
+
range = ">= 0".concat(n, " and < 2").concat(n, " ** ").concat((byteLength + 1) * 8).concat(n);
|
|
14513
|
+
} else {
|
|
14514
|
+
range = ">= -(2".concat(n, " ** ").concat((byteLength + 1) * 8 - 1).concat(n, ") and < 2 ** ") + "".concat((byteLength + 1) * 8 - 1).concat(n);
|
|
14515
|
+
}
|
|
14516
|
+
} else {
|
|
14517
|
+
range = ">= ".concat(min).concat(n, " and <= ").concat(max).concat(n);
|
|
14518
|
+
}
|
|
14519
|
+
throw new errors.ERR_OUT_OF_RANGE('value', range, value);
|
|
14520
|
+
}
|
|
14521
|
+
checkBounds(buf, offset, byteLength);
|
|
14522
|
+
}
|
|
14523
|
+
function validateNumber(value, name) {
|
|
14524
|
+
if (typeof value !== 'number') {
|
|
14525
|
+
throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value);
|
|
14526
|
+
}
|
|
14527
|
+
}
|
|
14528
|
+
function boundsError(value, length, type) {
|
|
14529
|
+
if (Math.floor(value) !== value) {
|
|
14530
|
+
validateNumber(value, type);
|
|
14531
|
+
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value);
|
|
14532
|
+
}
|
|
14533
|
+
if (length < 0) {
|
|
14534
|
+
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
|
|
14535
|
+
}
|
|
14536
|
+
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', ">= ".concat(type ? 1 : 0, " and <= ").concat(length), value);
|
|
14537
|
+
}
|
|
14538
|
+
|
|
14539
|
+
// HELPER FUNCTIONS
|
|
14540
|
+
// ================
|
|
14541
|
+
|
|
14542
|
+
var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
14543
|
+
function base64clean(str) {
|
|
14544
|
+
// Node takes equal signs as end of the Base64 encoding
|
|
14545
|
+
str = str.split('=')[0];
|
|
14546
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
14547
|
+
str = str.trim().replace(INVALID_BASE64_RE, '');
|
|
14548
|
+
// Node converts strings with length < 2 to ''
|
|
14549
|
+
if (str.length < 2) return '';
|
|
14550
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
14551
|
+
while (str.length % 4 !== 0) {
|
|
14552
|
+
str = str + '=';
|
|
14553
|
+
}
|
|
14554
|
+
return str;
|
|
14555
|
+
}
|
|
14556
|
+
function utf8ToBytes(string, units) {
|
|
14557
|
+
units = units || Infinity;
|
|
14558
|
+
var codePoint;
|
|
14559
|
+
var length = string.length;
|
|
14560
|
+
var leadSurrogate = null;
|
|
14561
|
+
var bytes = [];
|
|
14562
|
+
for (var i = 0; i < length; ++i) {
|
|
14563
|
+
codePoint = string.charCodeAt(i);
|
|
14564
|
+
|
|
14565
|
+
// is surrogate component
|
|
14566
|
+
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
14567
|
+
// last char was a lead
|
|
14568
|
+
if (!leadSurrogate) {
|
|
14569
|
+
// no lead yet
|
|
14570
|
+
if (codePoint > 0xDBFF) {
|
|
14571
|
+
// unexpected trail
|
|
14572
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14573
|
+
continue;
|
|
14574
|
+
} else if (i + 1 === length) {
|
|
14575
|
+
// unpaired lead
|
|
14576
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14577
|
+
continue;
|
|
14578
|
+
}
|
|
14579
|
+
|
|
14580
|
+
// valid lead
|
|
14581
|
+
leadSurrogate = codePoint;
|
|
14582
|
+
continue;
|
|
14583
|
+
}
|
|
14584
|
+
|
|
14585
|
+
// 2 leads in a row
|
|
14586
|
+
if (codePoint < 0xDC00) {
|
|
14587
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14588
|
+
leadSurrogate = codePoint;
|
|
14589
|
+
continue;
|
|
14590
|
+
}
|
|
14591
|
+
|
|
14592
|
+
// valid surrogate pair
|
|
14593
|
+
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
14594
|
+
} else if (leadSurrogate) {
|
|
14595
|
+
// valid bmp char, but last char was a lead
|
|
14596
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14597
|
+
}
|
|
14598
|
+
leadSurrogate = null;
|
|
14599
|
+
|
|
14600
|
+
// encode utf8
|
|
14601
|
+
if (codePoint < 0x80) {
|
|
14602
|
+
if ((units -= 1) < 0) break;
|
|
14603
|
+
bytes.push(codePoint);
|
|
14604
|
+
} else if (codePoint < 0x800) {
|
|
14605
|
+
if ((units -= 2) < 0) break;
|
|
14606
|
+
bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
|
|
14607
|
+
} else if (codePoint < 0x10000) {
|
|
14608
|
+
if ((units -= 3) < 0) break;
|
|
14609
|
+
bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14610
|
+
} else if (codePoint < 0x110000) {
|
|
14611
|
+
if ((units -= 4) < 0) break;
|
|
14612
|
+
bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14613
|
+
} else {
|
|
14614
|
+
throw new Error('Invalid code point');
|
|
14615
|
+
}
|
|
14616
|
+
}
|
|
14617
|
+
return bytes;
|
|
14618
|
+
}
|
|
14619
|
+
function asciiToBytes(str) {
|
|
14620
|
+
var byteArray = [];
|
|
14621
|
+
for (var i = 0; i < str.length; ++i) {
|
|
14622
|
+
// Node's code seems to be doing this and not & 0x7F..
|
|
14623
|
+
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
14624
|
+
}
|
|
14625
|
+
return byteArray;
|
|
14626
|
+
}
|
|
14627
|
+
function utf16leToBytes(str, units) {
|
|
14628
|
+
var c, hi, lo;
|
|
14629
|
+
var byteArray = [];
|
|
14630
|
+
for (var i = 0; i < str.length; ++i) {
|
|
14631
|
+
if ((units -= 2) < 0) break;
|
|
14632
|
+
c = str.charCodeAt(i);
|
|
14633
|
+
hi = c >> 8;
|
|
14634
|
+
lo = c % 256;
|
|
14635
|
+
byteArray.push(lo);
|
|
14636
|
+
byteArray.push(hi);
|
|
14637
|
+
}
|
|
14638
|
+
return byteArray;
|
|
14639
|
+
}
|
|
14640
|
+
function base64ToBytes(str) {
|
|
14641
|
+
return base64Js.toByteArray(base64clean(str));
|
|
14642
|
+
}
|
|
14643
|
+
function blitBuffer(src, dst, offset, length) {
|
|
14644
|
+
var i;
|
|
14645
|
+
for (i = 0; i < length; ++i) {
|
|
14646
|
+
if (i + offset >= dst.length || i >= src.length) break;
|
|
14647
|
+
dst[i + offset] = src[i];
|
|
14648
|
+
}
|
|
14649
|
+
return i;
|
|
14650
|
+
}
|
|
14651
|
+
|
|
14652
|
+
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
|
|
14653
|
+
// the `instanceof` check but they should be treated as of that type.
|
|
14654
|
+
// See: https://github.com/feross/buffer/issues/166
|
|
14655
|
+
function isInstance(obj, type) {
|
|
14656
|
+
return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
|
|
14657
|
+
}
|
|
14658
|
+
function numberIsNaN(obj) {
|
|
14659
|
+
// For IE11 support
|
|
14660
|
+
return obj !== obj; // eslint-disable-line no-self-compare
|
|
14661
|
+
}
|
|
14662
|
+
|
|
14663
|
+
// Create lookup table for `toString('hex')`
|
|
14664
|
+
// See: https://github.com/feross/buffer/issues/219
|
|
14665
|
+
var hexSliceLookupTable = function () {
|
|
14666
|
+
var alphabet = '0123456789abcdef';
|
|
14667
|
+
var table = new Array(256);
|
|
14668
|
+
for (var i = 0; i < 16; ++i) {
|
|
14669
|
+
var i16 = i * 16;
|
|
14670
|
+
for (var j = 0; j < 16; ++j) {
|
|
14671
|
+
table[i16 + j] = alphabet[i] + alphabet[j];
|
|
14672
|
+
}
|
|
14673
|
+
}
|
|
14674
|
+
return table;
|
|
14675
|
+
}();
|
|
14676
|
+
|
|
14677
|
+
// Return not function with Error if BigInt not supported
|
|
14678
|
+
function defineBigIntMethod(fn) {
|
|
14679
|
+
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn;
|
|
14680
|
+
}
|
|
14681
|
+
function BufferBigIntNotDefined() {
|
|
14682
|
+
throw new Error('BigInt not supported');
|
|
14683
|
+
}
|
|
14684
|
+
});
|
|
14685
|
+
|
|
12754
14686
|
/**
|
|
12755
14687
|
* return an decoded URL Safe Base64 as UTF-8 encoded string
|
|
12756
14688
|
*/
|