@microsoft/teams-js 2.32.0-beta.0 → 2.32.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/_virtual/_polyfill-node.buffer.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.global.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.os.js +1 -1
- package/dist/esm/_virtual/_polyfill-node.process.js +1 -1
- package/dist/esm/_virtual/_polyfill-node.util.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/utils.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +1025 -62
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/packages/teams-js/src/internal/uint8array-extras/uint8array-extras.js +0 -1
@@ -11,6 +11,164 @@
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
12
12
|
/******/ var __webpack_modules__ = ({
|
13
13
|
|
14
|
+
/***/ 933:
|
15
|
+
/***/ ((__unused_webpack_module, exports) => {
|
16
|
+
|
17
|
+
"use strict";
|
18
|
+
|
19
|
+
|
20
|
+
exports.byteLength = byteLength
|
21
|
+
exports.toByteArray = toByteArray
|
22
|
+
exports.fromByteArray = fromByteArray
|
23
|
+
|
24
|
+
var lookup = []
|
25
|
+
var revLookup = []
|
26
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
27
|
+
|
28
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
29
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
30
|
+
lookup[i] = code[i]
|
31
|
+
revLookup[code.charCodeAt(i)] = i
|
32
|
+
}
|
33
|
+
|
34
|
+
// Support decoding URL-safe base64 strings, as Node.js does.
|
35
|
+
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
36
|
+
revLookup['-'.charCodeAt(0)] = 62
|
37
|
+
revLookup['_'.charCodeAt(0)] = 63
|
38
|
+
|
39
|
+
function getLens (b64) {
|
40
|
+
var len = b64.length
|
41
|
+
|
42
|
+
if (len % 4 > 0) {
|
43
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
44
|
+
}
|
45
|
+
|
46
|
+
// Trim off extra bytes after placeholder bytes are found
|
47
|
+
// See: https://github.com/beatgammit/base64-js/issues/42
|
48
|
+
var validLen = b64.indexOf('=')
|
49
|
+
if (validLen === -1) validLen = len
|
50
|
+
|
51
|
+
var placeHoldersLen = validLen === len
|
52
|
+
? 0
|
53
|
+
: 4 - (validLen % 4)
|
54
|
+
|
55
|
+
return [validLen, placeHoldersLen]
|
56
|
+
}
|
57
|
+
|
58
|
+
// base64 is 4/3 + up to two characters of the original data
|
59
|
+
function byteLength (b64) {
|
60
|
+
var lens = getLens(b64)
|
61
|
+
var validLen = lens[0]
|
62
|
+
var placeHoldersLen = lens[1]
|
63
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
64
|
+
}
|
65
|
+
|
66
|
+
function _byteLength (b64, validLen, placeHoldersLen) {
|
67
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
68
|
+
}
|
69
|
+
|
70
|
+
function toByteArray (b64) {
|
71
|
+
var tmp
|
72
|
+
var lens = getLens(b64)
|
73
|
+
var validLen = lens[0]
|
74
|
+
var placeHoldersLen = lens[1]
|
75
|
+
|
76
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
77
|
+
|
78
|
+
var curByte = 0
|
79
|
+
|
80
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
81
|
+
var len = placeHoldersLen > 0
|
82
|
+
? validLen - 4
|
83
|
+
: validLen
|
84
|
+
|
85
|
+
var i
|
86
|
+
for (i = 0; i < len; i += 4) {
|
87
|
+
tmp =
|
88
|
+
(revLookup[b64.charCodeAt(i)] << 18) |
|
89
|
+
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
90
|
+
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
91
|
+
revLookup[b64.charCodeAt(i + 3)]
|
92
|
+
arr[curByte++] = (tmp >> 16) & 0xFF
|
93
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
94
|
+
arr[curByte++] = tmp & 0xFF
|
95
|
+
}
|
96
|
+
|
97
|
+
if (placeHoldersLen === 2) {
|
98
|
+
tmp =
|
99
|
+
(revLookup[b64.charCodeAt(i)] << 2) |
|
100
|
+
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
101
|
+
arr[curByte++] = tmp & 0xFF
|
102
|
+
}
|
103
|
+
|
104
|
+
if (placeHoldersLen === 1) {
|
105
|
+
tmp =
|
106
|
+
(revLookup[b64.charCodeAt(i)] << 10) |
|
107
|
+
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
108
|
+
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
109
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
110
|
+
arr[curByte++] = tmp & 0xFF
|
111
|
+
}
|
112
|
+
|
113
|
+
return arr
|
114
|
+
}
|
115
|
+
|
116
|
+
function tripletToBase64 (num) {
|
117
|
+
return lookup[num >> 18 & 0x3F] +
|
118
|
+
lookup[num >> 12 & 0x3F] +
|
119
|
+
lookup[num >> 6 & 0x3F] +
|
120
|
+
lookup[num & 0x3F]
|
121
|
+
}
|
122
|
+
|
123
|
+
function encodeChunk (uint8, start, end) {
|
124
|
+
var tmp
|
125
|
+
var output = []
|
126
|
+
for (var i = start; i < end; i += 3) {
|
127
|
+
tmp =
|
128
|
+
((uint8[i] << 16) & 0xFF0000) +
|
129
|
+
((uint8[i + 1] << 8) & 0xFF00) +
|
130
|
+
(uint8[i + 2] & 0xFF)
|
131
|
+
output.push(tripletToBase64(tmp))
|
132
|
+
}
|
133
|
+
return output.join('')
|
134
|
+
}
|
135
|
+
|
136
|
+
function fromByteArray (uint8) {
|
137
|
+
var tmp
|
138
|
+
var len = uint8.length
|
139
|
+
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
140
|
+
var parts = []
|
141
|
+
var maxChunkLength = 16383 // must be multiple of 3
|
142
|
+
|
143
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
144
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
145
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
146
|
+
}
|
147
|
+
|
148
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
149
|
+
if (extraBytes === 1) {
|
150
|
+
tmp = uint8[len - 1]
|
151
|
+
parts.push(
|
152
|
+
lookup[tmp >> 2] +
|
153
|
+
lookup[(tmp << 4) & 0x3F] +
|
154
|
+
'=='
|
155
|
+
)
|
156
|
+
} else if (extraBytes === 2) {
|
157
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
158
|
+
parts.push(
|
159
|
+
lookup[tmp >> 10] +
|
160
|
+
lookup[(tmp >> 4) & 0x3F] +
|
161
|
+
lookup[(tmp << 2) & 0x3F] +
|
162
|
+
'='
|
163
|
+
)
|
164
|
+
}
|
165
|
+
|
166
|
+
return parts.join('')
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
/***/ }),
|
171
|
+
|
14
172
|
/***/ 815:
|
15
173
|
/***/ ((module, exports, __webpack_require__) => {
|
16
174
|
|
@@ -1795,6 +1953,870 @@ __webpack_require__.d(marketplace_namespaceObject, {
|
|
1795
1953
|
|
1796
1954
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
|
1797
1955
|
var browser = __webpack_require__(815);
|
1956
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
1957
|
+
var base64_js = __webpack_require__(933);
|
1958
|
+
;// ../../node_modules/.pnpm/skeleton-buffer@file+skeleton-buffer/node_modules/skeleton-buffer/index.js
|
1959
|
+
|
1960
|
+
|
1961
|
+
const _Buffer = Buffer;
|
1962
|
+
|
1963
|
+
|
1964
|
+
const K_MAX_LENGTH = 0x7fffffff;
|
1965
|
+
|
1966
|
+
/**
|
1967
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
1968
|
+
* === true Use Uint8Array implementation (fastest)
|
1969
|
+
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
1970
|
+
* implementation (most compatible, even IE6)
|
1971
|
+
*
|
1972
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
1973
|
+
* Opera 11.6+, iOS 4.2+.
|
1974
|
+
*
|
1975
|
+
* We report that the browser does not support typed arrays if the are not subclassable
|
1976
|
+
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
1977
|
+
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
1978
|
+
* for __proto__ and has a buggy typed array implementation.
|
1979
|
+
*/
|
1980
|
+
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
1981
|
+
|
1982
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') {
|
1983
|
+
console.error('This browser lacks typed array (Uint8Array) support which is required');
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
function typedArraySupport() {
|
1987
|
+
// Can typed array instances can be augmented?
|
1988
|
+
try {
|
1989
|
+
const arr = new Uint8Array(1);
|
1990
|
+
const proto = {
|
1991
|
+
foo: function () {
|
1992
|
+
return 42;
|
1993
|
+
},
|
1994
|
+
};
|
1995
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
1996
|
+
Object.setPrototypeOf(arr, proto);
|
1997
|
+
return arr.foo() === 42;
|
1998
|
+
} catch (e) {
|
1999
|
+
return false;
|
2000
|
+
}
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
/**
|
2004
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
2005
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
2006
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
2007
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
2008
|
+
* returns a single octet.
|
2009
|
+
*
|
2010
|
+
* The `Uint8Array` prototype remains unmodified.
|
2011
|
+
*/
|
2012
|
+
|
2013
|
+
function Buffer(arg, encodingOrOffset, length) {
|
2014
|
+
// Common case.
|
2015
|
+
if (typeof arg === 'number') {
|
2016
|
+
if (typeof encodingOrOffset === 'string') {
|
2017
|
+
throw new TypeError('The "string" argument must be of type string. Received type number');
|
2018
|
+
}
|
2019
|
+
return allocUnsafe(arg);
|
2020
|
+
}
|
2021
|
+
return from(arg, encodingOrOffset, length);
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
/**
|
2025
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
2026
|
+
* if value is a number.
|
2027
|
+
* Buffer.from(str[, encoding])
|
2028
|
+
* Buffer.from(array)
|
2029
|
+
* Buffer.from(buffer)
|
2030
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
2031
|
+
**/
|
2032
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
2033
|
+
return from(value, encodingOrOffset, length);
|
2034
|
+
};
|
2035
|
+
|
2036
|
+
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
2037
|
+
// https://github.com/feross/buffer/pull/148
|
2038
|
+
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
|
2039
|
+
Object.setPrototypeOf(Buffer, Uint8Array);
|
2040
|
+
|
2041
|
+
function from(value, encodingOrOffset, length) {
|
2042
|
+
if (typeof value === 'string') {
|
2043
|
+
return fromString(value, encodingOrOffset);
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
if (ArrayBuffer.isView(value)) {
|
2047
|
+
return fromArrayView(value);
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
if (value == null) {
|
2051
|
+
throw new TypeError(
|
2052
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
2053
|
+
'or Array-like Object. Received type ' +
|
2054
|
+
typeof value,
|
2055
|
+
);
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
if (isInstance(value, ArrayBuffer) || (value && isInstance(value.buffer, ArrayBuffer))) {
|
2059
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
if (
|
2063
|
+
typeof SharedArrayBuffer !== 'undefined' &&
|
2064
|
+
(isInstance(value, SharedArrayBuffer) || (value && isInstance(value.buffer, SharedArrayBuffer)))
|
2065
|
+
) {
|
2066
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
2067
|
+
}
|
2068
|
+
|
2069
|
+
if (typeof value === 'number') {
|
2070
|
+
throw new TypeError('The "value" argument must not be of type number. Received type number');
|
2071
|
+
}
|
2072
|
+
|
2073
|
+
const valueOf = value.valueOf && value.valueOf();
|
2074
|
+
if (valueOf != null && valueOf !== value) {
|
2075
|
+
return Buffer.from(valueOf, encodingOrOffset, length);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
const b = fromObject(value);
|
2079
|
+
if (b) {
|
2080
|
+
return b;
|
2081
|
+
}
|
2082
|
+
|
2083
|
+
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') {
|
2084
|
+
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length);
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
throw new TypeError(
|
2088
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
2089
|
+
'or Array-like Object. Received type ' +
|
2090
|
+
typeof value,
|
2091
|
+
);
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
function allocUnsafe(size) {
|
2095
|
+
assertSize(size);
|
2096
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
function assertSize(size) {
|
2100
|
+
if (typeof size !== 'number') {
|
2101
|
+
throw new TypeError('"size" argument must be of type number');
|
2102
|
+
} else if (size < 0) {
|
2103
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
2104
|
+
}
|
2105
|
+
}
|
2106
|
+
|
2107
|
+
function createBuffer(length) {
|
2108
|
+
if (length > K_MAX_LENGTH) {
|
2109
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
2110
|
+
}
|
2111
|
+
// Return an augmented `Uint8Array` instance
|
2112
|
+
const buf = new Uint8Array(length);
|
2113
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
2114
|
+
return buf;
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
function checked(length) {
|
2118
|
+
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
2119
|
+
// length is NaN (which is otherwise coerced to zero.)
|
2120
|
+
if (length >= K_MAX_LENGTH) {
|
2121
|
+
throw new RangeError(
|
2122
|
+
'Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes',
|
2123
|
+
);
|
2124
|
+
}
|
2125
|
+
return length | 0;
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
function fromString(string, encoding) {
|
2129
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
2130
|
+
encoding = 'utf8';
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
if (!Buffer.isEncoding(encoding)) {
|
2134
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
const length = byteLength(string, encoding) | 0;
|
2138
|
+
let buf = createBuffer(length);
|
2139
|
+
|
2140
|
+
const actual = buf.write(string, encoding);
|
2141
|
+
|
2142
|
+
if (actual !== length) {
|
2143
|
+
// Writing a hex string, for example, that contains invalid characters will
|
2144
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
2145
|
+
// 'abxxcd' will be treated as 'ab')
|
2146
|
+
buf = buf.slice(0, actual);
|
2147
|
+
}
|
2148
|
+
|
2149
|
+
return buf;
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
Buffer.isEncoding = function isEncoding(encoding) {
|
2153
|
+
switch (String(encoding).toLowerCase()) {
|
2154
|
+
case 'hex':
|
2155
|
+
case 'utf8':
|
2156
|
+
case 'utf-8':
|
2157
|
+
case 'ascii':
|
2158
|
+
case 'latin1':
|
2159
|
+
case 'binary':
|
2160
|
+
case 'base64':
|
2161
|
+
case 'ucs2':
|
2162
|
+
case 'ucs-2':
|
2163
|
+
case 'utf16le':
|
2164
|
+
case 'utf-16le':
|
2165
|
+
return true;
|
2166
|
+
default:
|
2167
|
+
return false;
|
2168
|
+
}
|
2169
|
+
};
|
2170
|
+
|
2171
|
+
function byteLength(string, encoding) {
|
2172
|
+
if (Buffer.isBuffer(string)) {
|
2173
|
+
return string.length;
|
2174
|
+
}
|
2175
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
2176
|
+
return string.byteLength;
|
2177
|
+
}
|
2178
|
+
if (typeof string !== 'string') {
|
2179
|
+
throw new TypeError(
|
2180
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + typeof string,
|
2181
|
+
);
|
2182
|
+
}
|
2183
|
+
|
2184
|
+
const len = string.length;
|
2185
|
+
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
2186
|
+
if (!mustMatch && len === 0) {
|
2187
|
+
return 0;
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
// Use a for loop to avoid recursion
|
2191
|
+
let loweredCase = false;
|
2192
|
+
for (;;) {
|
2193
|
+
switch (encoding) {
|
2194
|
+
case 'ascii':
|
2195
|
+
case 'latin1':
|
2196
|
+
case 'binary':
|
2197
|
+
return len;
|
2198
|
+
case 'utf8':
|
2199
|
+
case 'utf-8':
|
2200
|
+
return utf8ToBytes(string).length;
|
2201
|
+
case 'ucs2':
|
2202
|
+
case 'ucs-2':
|
2203
|
+
case 'utf16le':
|
2204
|
+
case 'utf-16le':
|
2205
|
+
return len * 2;
|
2206
|
+
case 'hex':
|
2207
|
+
return len >>> 1;
|
2208
|
+
case 'base64':
|
2209
|
+
return base64ToBytes(string).length;
|
2210
|
+
default:
|
2211
|
+
if (loweredCase) {
|
2212
|
+
return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
|
2213
|
+
}
|
2214
|
+
encoding = ('' + encoding).toLowerCase();
|
2215
|
+
loweredCase = true;
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
}
|
2219
|
+
|
2220
|
+
Buffer.isBuffer = function isBuffer(b) {
|
2221
|
+
return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
|
2222
|
+
};
|
2223
|
+
|
2224
|
+
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
|
2225
|
+
// the `instanceof` check but they should be treated as of that type.
|
2226
|
+
// See: https://github.com/feross/buffer/issues/166
|
2227
|
+
function isInstance(obj, type) {
|
2228
|
+
return (
|
2229
|
+
obj instanceof type ||
|
2230
|
+
(obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name)
|
2231
|
+
);
|
2232
|
+
}
|
2233
|
+
|
2234
|
+
function utf8ToBytes(string, units) {
|
2235
|
+
units = units || Infinity;
|
2236
|
+
let codePoint;
|
2237
|
+
const length = string.length;
|
2238
|
+
let leadSurrogate = null;
|
2239
|
+
const bytes = [];
|
2240
|
+
|
2241
|
+
for (let i = 0; i < length; ++i) {
|
2242
|
+
codePoint = string.charCodeAt(i);
|
2243
|
+
|
2244
|
+
// is surrogate component
|
2245
|
+
if (codePoint > 0xd7ff && codePoint < 0xe000) {
|
2246
|
+
// last char was a lead
|
2247
|
+
if (!leadSurrogate) {
|
2248
|
+
// no lead yet
|
2249
|
+
if (codePoint > 0xdbff) {
|
2250
|
+
// unexpected trail
|
2251
|
+
if ((units -= 3) > -1) {
|
2252
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2253
|
+
}
|
2254
|
+
continue;
|
2255
|
+
} else if (i + 1 === length) {
|
2256
|
+
// unpaired lead
|
2257
|
+
if ((units -= 3) > -1) {
|
2258
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2259
|
+
}
|
2260
|
+
continue;
|
2261
|
+
}
|
2262
|
+
|
2263
|
+
// valid lead
|
2264
|
+
leadSurrogate = codePoint;
|
2265
|
+
|
2266
|
+
continue;
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
// 2 leads in a row
|
2270
|
+
if (codePoint < 0xdc00) {
|
2271
|
+
if ((units -= 3) > -1) {
|
2272
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2273
|
+
}
|
2274
|
+
leadSurrogate = codePoint;
|
2275
|
+
continue;
|
2276
|
+
}
|
2277
|
+
|
2278
|
+
// valid surrogate pair
|
2279
|
+
codePoint = (((leadSurrogate - 0xd800) << 10) | (codePoint - 0xdc00)) + 0x10000;
|
2280
|
+
} else if (leadSurrogate) {
|
2281
|
+
// valid bmp char, but last char was a lead
|
2282
|
+
if ((units -= 3) > -1) {
|
2283
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2284
|
+
}
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
leadSurrogate = null;
|
2288
|
+
|
2289
|
+
// encode utf8
|
2290
|
+
if (codePoint < 0x80) {
|
2291
|
+
if ((units -= 1) < 0) {
|
2292
|
+
break;
|
2293
|
+
}
|
2294
|
+
bytes.push(codePoint);
|
2295
|
+
} else if (codePoint < 0x800) {
|
2296
|
+
if ((units -= 2) < 0) {
|
2297
|
+
break;
|
2298
|
+
}
|
2299
|
+
bytes.push((codePoint >> 0x6) | 0xc0, (codePoint & 0x3f) | 0x80);
|
2300
|
+
} else if (codePoint < 0x10000) {
|
2301
|
+
if ((units -= 3) < 0) {
|
2302
|
+
break;
|
2303
|
+
}
|
2304
|
+
bytes.push((codePoint >> 0xc) | 0xe0, ((codePoint >> 0x6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
2305
|
+
} else if (codePoint < 0x110000) {
|
2306
|
+
if ((units -= 4) < 0) {
|
2307
|
+
break;
|
2308
|
+
}
|
2309
|
+
bytes.push(
|
2310
|
+
(codePoint >> 0x12) | 0xf0,
|
2311
|
+
((codePoint >> 0xc) & 0x3f) | 0x80,
|
2312
|
+
((codePoint >> 0x6) & 0x3f) | 0x80,
|
2313
|
+
(codePoint & 0x3f) | 0x80,
|
2314
|
+
);
|
2315
|
+
} else {
|
2316
|
+
throw new Error('Invalid code point');
|
2317
|
+
}
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
return bytes;
|
2321
|
+
}
|
2322
|
+
|
2323
|
+
function base64ToBytes(str) {
|
2324
|
+
return base64_js.toByteArray(base64clean(str));
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
2328
|
+
|
2329
|
+
function base64clean(str) {
|
2330
|
+
// Node takes equal signs as end of the Base64 encoding
|
2331
|
+
str = str.split('=')[0];
|
2332
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
2333
|
+
str = str.trim().replace(INVALID_BASE64_RE, '');
|
2334
|
+
// Node converts strings with length < 2 to ''
|
2335
|
+
if (str.length < 2) {
|
2336
|
+
return '';
|
2337
|
+
}
|
2338
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
2339
|
+
while (str.length % 4 !== 0) {
|
2340
|
+
str = str + '=';
|
2341
|
+
}
|
2342
|
+
return str;
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
function fromArrayView(arrayView) {
|
2346
|
+
if (isInstance(arrayView, Uint8Array)) {
|
2347
|
+
const copy = new Uint8Array(arrayView);
|
2348
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
2349
|
+
}
|
2350
|
+
return fromArrayLike(arrayView);
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
function fromArrayBuffer(array, byteOffset, length) {
|
2354
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
2355
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
2359
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
2360
|
+
}
|
2361
|
+
|
2362
|
+
let buf;
|
2363
|
+
if (byteOffset === undefined && length === undefined) {
|
2364
|
+
buf = new Uint8Array(array);
|
2365
|
+
} else if (length === undefined) {
|
2366
|
+
buf = new Uint8Array(array, byteOffset);
|
2367
|
+
} else {
|
2368
|
+
buf = new Uint8Array(array, byteOffset, length);
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
// Return an augmented `Uint8Array` instance
|
2372
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
2373
|
+
|
2374
|
+
return buf;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
function fromArrayLike(array) {
|
2378
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0;
|
2379
|
+
const buf = createBuffer(length);
|
2380
|
+
for (let i = 0; i < length; i += 1) {
|
2381
|
+
buf[i] = array[i] & 255;
|
2382
|
+
}
|
2383
|
+
return buf;
|
2384
|
+
}
|
2385
|
+
|
2386
|
+
Buffer.prototype.toString = function toString() {
|
2387
|
+
const length = this.length;
|
2388
|
+
if (length === 0) {
|
2389
|
+
return '';
|
2390
|
+
}
|
2391
|
+
if (arguments.length === 0) {
|
2392
|
+
return utf8Slice(this, 0, length);
|
2393
|
+
}
|
2394
|
+
return slowToString.apply(this, arguments);
|
2395
|
+
};
|
2396
|
+
|
2397
|
+
function utf8Slice(buf, start, end) {
|
2398
|
+
end = Math.min(buf.length, end);
|
2399
|
+
const res = [];
|
2400
|
+
|
2401
|
+
let i = start;
|
2402
|
+
while (i < end) {
|
2403
|
+
const firstByte = buf[i];
|
2404
|
+
let codePoint = null;
|
2405
|
+
let bytesPerSequence = firstByte > 0xef ? 4 : firstByte > 0xdf ? 3 : firstByte > 0xbf ? 2 : 1;
|
2406
|
+
|
2407
|
+
if (i + bytesPerSequence <= end) {
|
2408
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
2409
|
+
|
2410
|
+
switch (bytesPerSequence) {
|
2411
|
+
case 1:
|
2412
|
+
if (firstByte < 0x80) {
|
2413
|
+
codePoint = firstByte;
|
2414
|
+
}
|
2415
|
+
break;
|
2416
|
+
case 2:
|
2417
|
+
secondByte = buf[i + 1];
|
2418
|
+
if ((secondByte & 0xc0) === 0x80) {
|
2419
|
+
tempCodePoint = ((firstByte & 0x1f) << 0x6) | (secondByte & 0x3f);
|
2420
|
+
if (tempCodePoint > 0x7f) {
|
2421
|
+
codePoint = tempCodePoint;
|
2422
|
+
}
|
2423
|
+
}
|
2424
|
+
break;
|
2425
|
+
case 3:
|
2426
|
+
secondByte = buf[i + 1];
|
2427
|
+
thirdByte = buf[i + 2];
|
2428
|
+
if ((secondByte & 0xc0) === 0x80 && (thirdByte & 0xc0) === 0x80) {
|
2429
|
+
tempCodePoint = ((firstByte & 0xf) << 0xc) | ((secondByte & 0x3f) << 0x6) | (thirdByte & 0x3f);
|
2430
|
+
if (tempCodePoint > 0x7ff && (tempCodePoint < 0xd800 || tempCodePoint > 0xdfff)) {
|
2431
|
+
codePoint = tempCodePoint;
|
2432
|
+
}
|
2433
|
+
}
|
2434
|
+
break;
|
2435
|
+
case 4:
|
2436
|
+
secondByte = buf[i + 1];
|
2437
|
+
thirdByte = buf[i + 2];
|
2438
|
+
fourthByte = buf[i + 3];
|
2439
|
+
if ((secondByte & 0xc0) === 0x80 && (thirdByte & 0xc0) === 0x80 && (fourthByte & 0xc0) === 0x80) {
|
2440
|
+
tempCodePoint =
|
2441
|
+
((firstByte & 0xf) << 0x12) |
|
2442
|
+
((secondByte & 0x3f) << 0xc) |
|
2443
|
+
((thirdByte & 0x3f) << 0x6) |
|
2444
|
+
(fourthByte & 0x3f);
|
2445
|
+
if (tempCodePoint > 0xffff && tempCodePoint < 0x110000) {
|
2446
|
+
codePoint = tempCodePoint;
|
2447
|
+
}
|
2448
|
+
}
|
2449
|
+
}
|
2450
|
+
}
|
2451
|
+
|
2452
|
+
if (codePoint === null) {
|
2453
|
+
// we did not generate a valid codePoint so insert a
|
2454
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
2455
|
+
codePoint = 0xfffd;
|
2456
|
+
bytesPerSequence = 1;
|
2457
|
+
} else if (codePoint > 0xffff) {
|
2458
|
+
// encode to utf16 (surrogate pair dance)
|
2459
|
+
codePoint -= 0x10000;
|
2460
|
+
res.push(((codePoint >>> 10) & 0x3ff) | 0xd800);
|
2461
|
+
codePoint = 0xdc00 | (codePoint & 0x3ff);
|
2462
|
+
}
|
2463
|
+
|
2464
|
+
res.push(codePoint);
|
2465
|
+
i += bytesPerSequence;
|
2466
|
+
}
|
2467
|
+
|
2468
|
+
return decodeCodePointsArray(res);
|
2469
|
+
}
|
2470
|
+
|
2471
|
+
function slowToString(encoding, start, end) {
|
2472
|
+
let loweredCase = false;
|
2473
|
+
|
2474
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
2475
|
+
// property of a typed array.
|
2476
|
+
|
2477
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
2478
|
+
// to their upper/lower bounds if the value passed is out of range.
|
2479
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
2480
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
2481
|
+
if (start === undefined || start < 0) {
|
2482
|
+
start = 0;
|
2483
|
+
}
|
2484
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
2485
|
+
// coercion fail below.
|
2486
|
+
if (start > this.length) {
|
2487
|
+
return '';
|
2488
|
+
}
|
2489
|
+
|
2490
|
+
if (end === undefined || end > this.length) {
|
2491
|
+
end = this.length;
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
if (end <= 0) {
|
2495
|
+
return '';
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
2499
|
+
end >>>= 0;
|
2500
|
+
start >>>= 0;
|
2501
|
+
|
2502
|
+
if (end <= start) {
|
2503
|
+
return '';
|
2504
|
+
}
|
2505
|
+
|
2506
|
+
if (!encoding) {
|
2507
|
+
encoding = 'utf8';
|
2508
|
+
}
|
2509
|
+
|
2510
|
+
// eslint-disable-next-line no-constant-condition
|
2511
|
+
while (true) {
|
2512
|
+
switch (encoding) {
|
2513
|
+
case 'hex':
|
2514
|
+
return hexSlice(this, start, end);
|
2515
|
+
|
2516
|
+
case 'utf8':
|
2517
|
+
case 'utf-8':
|
2518
|
+
return utf8Slice(this, start, end);
|
2519
|
+
|
2520
|
+
case 'ascii':
|
2521
|
+
return asciiSlice(this, start, end);
|
2522
|
+
|
2523
|
+
case 'latin1':
|
2524
|
+
case 'binary':
|
2525
|
+
return latin1Slice(this, start, end);
|
2526
|
+
|
2527
|
+
case 'base64':
|
2528
|
+
return base64Slice(this, start, end);
|
2529
|
+
|
2530
|
+
case 'ucs2':
|
2531
|
+
case 'ucs-2':
|
2532
|
+
case 'utf16le':
|
2533
|
+
case 'utf-16le':
|
2534
|
+
return utf16leSlice(this, start, end);
|
2535
|
+
|
2536
|
+
default:
|
2537
|
+
if (loweredCase) {
|
2538
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2539
|
+
}
|
2540
|
+
encoding = (encoding + '').toLowerCase();
|
2541
|
+
loweredCase = true;
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
}
|
2545
|
+
|
2546
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
2547
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
2548
|
+
// We go 1 magnitude less, for safety
|
2549
|
+
const MAX_ARGUMENTS_LENGTH = 0x1000;
|
2550
|
+
|
2551
|
+
function decodeCodePointsArray(codePoints) {
|
2552
|
+
const len = codePoints.length;
|
2553
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
2554
|
+
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
2555
|
+
}
|
2556
|
+
|
2557
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
2558
|
+
let res = '';
|
2559
|
+
let i = 0;
|
2560
|
+
while (i < len) {
|
2561
|
+
res += String.fromCharCode.apply(String, codePoints.slice(i, (i += MAX_ARGUMENTS_LENGTH)));
|
2562
|
+
}
|
2563
|
+
return res;
|
2564
|
+
}
|
2565
|
+
|
2566
|
+
function hexSlice(buf, start, end) {
|
2567
|
+
const len = buf.length;
|
2568
|
+
|
2569
|
+
if (!start || start < 0) {
|
2570
|
+
start = 0;
|
2571
|
+
}
|
2572
|
+
if (!end || end < 0 || end > len) {
|
2573
|
+
end = len;
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
let out = '';
|
2577
|
+
for (let i = start; i < end; ++i) {
|
2578
|
+
out += hexSliceLookupTable[buf[i]];
|
2579
|
+
}
|
2580
|
+
return out;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
function asciiSlice(buf, start, end) {
|
2584
|
+
let ret = '';
|
2585
|
+
end = Math.min(buf.length, end);
|
2586
|
+
|
2587
|
+
for (let i = start; i < end; ++i) {
|
2588
|
+
ret += String.fromCharCode(buf[i] & 0x7f);
|
2589
|
+
}
|
2590
|
+
return ret;
|
2591
|
+
}
|
2592
|
+
|
2593
|
+
function latin1Slice(buf, start, end) {
|
2594
|
+
let ret = '';
|
2595
|
+
end = Math.min(buf.length, end);
|
2596
|
+
|
2597
|
+
for (let i = start; i < end; ++i) {
|
2598
|
+
ret += String.fromCharCode(buf[i]);
|
2599
|
+
}
|
2600
|
+
return ret;
|
2601
|
+
}
|
2602
|
+
|
2603
|
+
function base64Slice(buf, start, end) {
|
2604
|
+
if (start === 0 && end === buf.length) {
|
2605
|
+
return base64_js.fromByteArray(buf);
|
2606
|
+
} else {
|
2607
|
+
return base64_js.fromByteArray(buf.slice(start, end));
|
2608
|
+
}
|
2609
|
+
}
|
2610
|
+
|
2611
|
+
function utf16leSlice(buf, start, end) {
|
2612
|
+
const bytes = buf.slice(start, end);
|
2613
|
+
let res = '';
|
2614
|
+
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
2615
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
2616
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
2617
|
+
}
|
2618
|
+
return res;
|
2619
|
+
}
|
2620
|
+
|
2621
|
+
Buffer.prototype.write = function write(string, offset, length, encoding) {
|
2622
|
+
// Buffer#write(string)
|
2623
|
+
if (offset === undefined) {
|
2624
|
+
encoding = 'utf8';
|
2625
|
+
length = this.length;
|
2626
|
+
offset = 0;
|
2627
|
+
// Buffer#write(string, encoding)
|
2628
|
+
} else if (length === undefined && typeof offset === 'string') {
|
2629
|
+
encoding = offset;
|
2630
|
+
length = this.length;
|
2631
|
+
offset = 0;
|
2632
|
+
// Buffer#write(string, offset[, length][, encoding])
|
2633
|
+
} else if (isFinite(offset)) {
|
2634
|
+
offset = offset >>> 0;
|
2635
|
+
if (isFinite(length)) {
|
2636
|
+
length = length >>> 0;
|
2637
|
+
if (encoding === undefined) {
|
2638
|
+
encoding = 'utf8';
|
2639
|
+
}
|
2640
|
+
} else {
|
2641
|
+
encoding = length;
|
2642
|
+
length = undefined;
|
2643
|
+
}
|
2644
|
+
} else {
|
2645
|
+
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
2646
|
+
}
|
2647
|
+
|
2648
|
+
const remaining = this.length - offset;
|
2649
|
+
if (length === undefined || length > remaining) {
|
2650
|
+
length = remaining;
|
2651
|
+
}
|
2652
|
+
|
2653
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
2654
|
+
throw new RangeError('Attempt to write outside buffer bounds');
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
if (!encoding) {
|
2658
|
+
encoding = 'utf8';
|
2659
|
+
}
|
2660
|
+
|
2661
|
+
let loweredCase = false;
|
2662
|
+
for (;;) {
|
2663
|
+
switch (encoding) {
|
2664
|
+
case 'hex':
|
2665
|
+
return hexWrite(this, string, offset, length);
|
2666
|
+
|
2667
|
+
case 'utf8':
|
2668
|
+
case 'utf-8':
|
2669
|
+
return utf8Write(this, string, offset, length);
|
2670
|
+
|
2671
|
+
case 'ascii':
|
2672
|
+
case 'latin1':
|
2673
|
+
case 'binary':
|
2674
|
+
return asciiWrite(this, string, offset, length);
|
2675
|
+
|
2676
|
+
case 'base64':
|
2677
|
+
// Warning: maxLength not taken into account in base64Write
|
2678
|
+
return base64Write(this, string, offset, length);
|
2679
|
+
|
2680
|
+
case 'ucs2':
|
2681
|
+
case 'ucs-2':
|
2682
|
+
case 'utf16le':
|
2683
|
+
case 'utf-16le':
|
2684
|
+
return ucs2Write(this, string, offset, length);
|
2685
|
+
|
2686
|
+
default:
|
2687
|
+
if (loweredCase) {
|
2688
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2689
|
+
}
|
2690
|
+
encoding = ('' + encoding).toLowerCase();
|
2691
|
+
loweredCase = true;
|
2692
|
+
}
|
2693
|
+
}
|
2694
|
+
};
|
2695
|
+
|
2696
|
+
function hexWrite(buf, string, offset, length) {
|
2697
|
+
offset = Number(offset) || 0;
|
2698
|
+
const remaining = buf.length - offset;
|
2699
|
+
if (!length) {
|
2700
|
+
length = remaining;
|
2701
|
+
} else {
|
2702
|
+
length = Number(length);
|
2703
|
+
if (length > remaining) {
|
2704
|
+
length = remaining;
|
2705
|
+
}
|
2706
|
+
}
|
2707
|
+
|
2708
|
+
const strLen = string.length;
|
2709
|
+
|
2710
|
+
if (length > strLen / 2) {
|
2711
|
+
length = strLen / 2;
|
2712
|
+
}
|
2713
|
+
let i;
|
2714
|
+
for (i = 0; i < length; ++i) {
|
2715
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
2716
|
+
if (numberIsNaN(parsed)) {
|
2717
|
+
return i;
|
2718
|
+
}
|
2719
|
+
buf[offset + i] = parsed;
|
2720
|
+
}
|
2721
|
+
return i;
|
2722
|
+
}
|
2723
|
+
|
2724
|
+
function utf8Write(buf, string, offset, length) {
|
2725
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
2726
|
+
}
|
2727
|
+
|
2728
|
+
function asciiWrite(buf, string, offset, length) {
|
2729
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
2730
|
+
}
|
2731
|
+
|
2732
|
+
function base64Write(buf, string, offset, length) {
|
2733
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
2734
|
+
}
|
2735
|
+
|
2736
|
+
function ucs2Write(buf, string, offset, length) {
|
2737
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
2738
|
+
}
|
2739
|
+
|
2740
|
+
function asciiToBytes(str) {
|
2741
|
+
const byteArray = [];
|
2742
|
+
for (let i = 0; i < str.length; ++i) {
|
2743
|
+
// Node's code seems to be doing this and not & 0x7F..
|
2744
|
+
byteArray.push(str.charCodeAt(i) & 0xff);
|
2745
|
+
}
|
2746
|
+
return byteArray;
|
2747
|
+
}
|
2748
|
+
|
2749
|
+
function utf16leToBytes(str, units) {
|
2750
|
+
let c, hi, lo;
|
2751
|
+
const byteArray = [];
|
2752
|
+
for (let i = 0; i < str.length; ++i) {
|
2753
|
+
if ((units -= 2) < 0) {
|
2754
|
+
break;
|
2755
|
+
}
|
2756
|
+
|
2757
|
+
c = str.charCodeAt(i);
|
2758
|
+
hi = c >> 8;
|
2759
|
+
lo = c % 256;
|
2760
|
+
byteArray.push(lo);
|
2761
|
+
byteArray.push(hi);
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
return byteArray;
|
2765
|
+
}
|
2766
|
+
|
2767
|
+
function blitBuffer(src, dst, offset, length) {
|
2768
|
+
let i;
|
2769
|
+
for (i = 0; i < length; ++i) {
|
2770
|
+
if (i + offset >= dst.length || i >= src.length) {
|
2771
|
+
break;
|
2772
|
+
}
|
2773
|
+
dst[i + offset] = src[i];
|
2774
|
+
}
|
2775
|
+
return i;
|
2776
|
+
}
|
2777
|
+
|
2778
|
+
function numberIsNaN(obj) {
|
2779
|
+
// For IE11 support
|
2780
|
+
return obj !== obj; // eslint-disable-line no-self-compare
|
2781
|
+
}
|
2782
|
+
|
2783
|
+
const hexSliceLookupTable = (function () {
|
2784
|
+
const alphabet = '0123456789abcdef';
|
2785
|
+
const table = new Array(256);
|
2786
|
+
for (let i = 0; i < 16; ++i) {
|
2787
|
+
const i16 = i * 16;
|
2788
|
+
for (let j = 0; j < 16; ++j) {
|
2789
|
+
table[i16 + j] = alphabet[i] + alphabet[j];
|
2790
|
+
}
|
2791
|
+
}
|
2792
|
+
return table;
|
2793
|
+
})();
|
2794
|
+
|
2795
|
+
function fromObject(obj) {
|
2796
|
+
if (Buffer.isBuffer(obj)) {
|
2797
|
+
const len = checked(obj.length) | 0;
|
2798
|
+
const buf = createBuffer(len);
|
2799
|
+
|
2800
|
+
if (buf.length === 0) {
|
2801
|
+
return buf;
|
2802
|
+
}
|
2803
|
+
|
2804
|
+
obj.copy(buf, 0, 0, len);
|
2805
|
+
return buf;
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
if (obj.length !== undefined) {
|
2809
|
+
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
2810
|
+
return createBuffer(0);
|
2811
|
+
}
|
2812
|
+
return fromArrayLike(obj);
|
2813
|
+
}
|
2814
|
+
|
2815
|
+
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
2816
|
+
return fromArrayLike(obj.data);
|
2817
|
+
}
|
2818
|
+
}
|
2819
|
+
|
1798
2820
|
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js
|
1799
2821
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
1800
2822
|
/* harmony default export */ const esm_browser_native = ({
|
@@ -2292,65 +3314,6 @@ const errorInvalidCount = new Error('Invalid input count: Must supply a valid im
|
|
2292
3314
|
*/
|
2293
3315
|
const errorInvalidResponse = new Error('Invalid response: Received more images than the specified max limit in the response.');
|
2294
3316
|
|
2295
|
-
;// ./src/internal/uint8array-extras/uint8array-extras.ts
|
2296
|
-
const objectToString = Object.prototype.toString;
|
2297
|
-
const uint8ArrayStringified = '[object Uint8Array]';
|
2298
|
-
const arrayBufferStringified = '[object ArrayBuffer]';
|
2299
|
-
const cachedDecoders = {
|
2300
|
-
utf8: new globalThis.TextDecoder('utf8'),
|
2301
|
-
};
|
2302
|
-
function isType(value, typeConstructor, typeStringified) {
|
2303
|
-
if (!value) {
|
2304
|
-
return false;
|
2305
|
-
}
|
2306
|
-
if (value.constructor === typeConstructor) {
|
2307
|
-
return true;
|
2308
|
-
}
|
2309
|
-
return objectToString.call(value) === typeStringified;
|
2310
|
-
}
|
2311
|
-
function isUint8Array(value) {
|
2312
|
-
return isType(value, Uint8Array, uint8ArrayStringified);
|
2313
|
-
}
|
2314
|
-
function isArrayBuffer(value) {
|
2315
|
-
return isType(value, ArrayBuffer, arrayBufferStringified);
|
2316
|
-
}
|
2317
|
-
function assertString(value) {
|
2318
|
-
if (typeof value !== 'string') {
|
2319
|
-
throw new TypeError(`Expected \`string\`, got \`${typeof value}\``);
|
2320
|
-
}
|
2321
|
-
}
|
2322
|
-
function base64ToUint8Array(base64String) {
|
2323
|
-
assertString(base64String);
|
2324
|
-
return Uint8Array.from(globalThis.atob(base64UrlToBase64(base64String)), (x) => {
|
2325
|
-
const codePoint = x.codePointAt(0);
|
2326
|
-
if (codePoint === undefined) {
|
2327
|
-
throw new Error('Invalid character encountered');
|
2328
|
-
}
|
2329
|
-
return codePoint;
|
2330
|
-
});
|
2331
|
-
}
|
2332
|
-
function base64UrlToBase64(base64url) {
|
2333
|
-
return base64url.replaceAll('-', '+').replaceAll('_', '/');
|
2334
|
-
}
|
2335
|
-
function uint8ArrayToString(array, encoding = 'utf8') {
|
2336
|
-
var _a;
|
2337
|
-
assertUint8ArrayOrArrayBuffer(array);
|
2338
|
-
(_a = cachedDecoders[encoding]) !== null && _a !== void 0 ? _a : (cachedDecoders[encoding] = new globalThis.TextDecoder(encoding));
|
2339
|
-
return cachedDecoders[encoding].decode(array);
|
2340
|
-
}
|
2341
|
-
function base64ToString(base64String) {
|
2342
|
-
assertString(base64String);
|
2343
|
-
return uint8ArrayToString(base64ToUint8Array(base64String));
|
2344
|
-
}
|
2345
|
-
function assertUint8ArrayOrArrayBuffer(value) {
|
2346
|
-
if (!isUint8ArrayOrArrayBuffer(value)) {
|
2347
|
-
throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof value}\``);
|
2348
|
-
}
|
2349
|
-
}
|
2350
|
-
function isUint8ArrayOrArrayBuffer(value) {
|
2351
|
-
return isUint8Array(value) || isArrayBuffer(value);
|
2352
|
-
}
|
2353
|
-
|
2354
3317
|
;// ./src/internal/utils.ts
|
2355
3318
|
/* eslint-disable @typescript-eslint/ban-types */
|
2356
3319
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
@@ -2640,14 +3603,14 @@ function base64ToBlob(mimeType, base64String) {
|
|
2640
3603
|
* constructor expects binary data.
|
2641
3604
|
*/
|
2642
3605
|
if (mimeType.startsWith('image/')) {
|
2643
|
-
const byteCharacters =
|
3606
|
+
const byteCharacters = atob(base64String);
|
2644
3607
|
const byteArray = new Uint8Array(byteCharacters.length);
|
2645
3608
|
for (let i = 0; i < byteCharacters.length; i++) {
|
2646
3609
|
byteArray[i] = byteCharacters.charCodeAt(i);
|
2647
3610
|
}
|
2648
3611
|
resolve(new Blob([byteArray], { type: mimeType }));
|
2649
3612
|
}
|
2650
|
-
const byteCharacters =
|
3613
|
+
const byteCharacters = _Buffer.from(base64String, 'base64').toString();
|
2651
3614
|
resolve(new Blob([byteCharacters], { type: mimeType }));
|
2652
3615
|
});
|
2653
3616
|
}
|
@@ -3475,7 +4438,7 @@ function isSerializable(arg) {
|
|
3475
4438
|
* @hidden
|
3476
4439
|
* Package version.
|
3477
4440
|
*/
|
3478
|
-
const version = "2.32.0-beta.
|
4441
|
+
const version = "2.32.0-beta.1";
|
3479
4442
|
|
3480
4443
|
;// ./src/internal/internalAPIs.ts
|
3481
4444
|
|