UNPKG

67.6 kBJavaScriptView Raw
1(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iso31661 = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2(function (Buffer){
3"use strict";var countries=Buffer("Wwp7ImFscGhhMiI6IlRXIiwiYWxwaGEzIjoiVFdOIn0KLAp7ImFscGhhMiI6IkFGIiwiYWxwaGEzIjoiQUZHIn0KLAp7ImFscGhhMiI6IkFMIiwiYWxwaGEzIjoiQUxCIn0KLAp7ImFscGhhMiI6IkRaIiwiYWxwaGEzIjoiRFpBIn0KLAp7ImFscGhhMiI6IkFTIiwiYWxwaGEzIjoiQVNNIn0KLAp7ImFscGhhMiI6IkFEIiwiYWxwaGEzIjoiQU5EIn0KLAp7ImFscGhhMiI6IkFPIiwiYWxwaGEzIjoiQUdPIn0KLAp7ImFscGhhMiI6IkFJIiwiYWxwaGEzIjoiQUlBIn0KLAp7ImFscGhhMiI6IkFRIiwiYWxwaGEzIjoiQVRBIn0KLAp7ImFscGhhMiI6IkFHIiwiYWxwaGEzIjoiQVRHIn0KLAp7ImFscGhhMiI6IkFSIiwiYWxwaGEzIjoiQVJHIn0KLAp7ImFscGhhMiI6IkFNIiwiYWxwaGEzIjoiQVJNIn0KLAp7ImFscGhhMiI6IkFXIiwiYWxwaGEzIjoiQUJXIn0KLAp7ImFscG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YWxwaGEzIjoiVEtNIn0KLAp7ImFscGhhMiI6IlRDIiwiYWxwaGEzIjoiVENBIn0KLAp7ImFscGhhMiI6IlRWIiwiYWxwaGEzIjoiVFVWIn0KLAp7ImFscGhhMiI6IlVHIiwiYWxwaGEzIjoiVUdBIn0KLAp7ImFscGhhMiI6IlVBIiwiYWxwaGEzIjoiVUtSIn0KLAp7ImFscGhhMiI6IkFFIiwiYWxwaGEzIjoiQVJFIn0KLAp7ImFscGhhMiI6IkdCIiwiYWxwaGEzIjoiR0JSIn0KLAp7ImFscGhhMiI6IlRaIiwiYWxwaGEzIjoiVFpBIn0KLAp7ImFscGhhMiI6IlVNIiwiYWxwaGEzIjoiVU1JIn0KLAp7ImFscGhhMiI6IlZJIiwiYWxwaGEzIjoiVklSIn0KLAp7ImFscGhhMiI6IlVTIiwiYWxwaGEzIjoiVVNBIn0KLAp7ImFscGhhMiI6IlVZIiwiYWxwaGEzIjoiVVJZIn0KLAp7ImFscGhhMiI6IlVaIiwiYWxwaGEzIjoiVVpCIn0KLAp7ImFscGhhMiI6IlZVIiwiYWxwaGEzIjoiVlVUIn0KLAp7ImFscGhhMiI6IlZFIiwiYWxwaGEzIjoiVkVOIn0KLAp7ImFscGhhMiI6IlZOIiwiYWxwaGEzIjoiVk5NIn0KLAp7ImFscGhhMiI6IldGIiwiYWxwaGEzIjoiV0xGIn0KLAp7ImFscGhhMiI6IkVIIiwiYWxwaGEzIjoiRVNIIn0KLAp7ImFscGhhMiI6IllFIiwiYWxwaGEzIjoiWUVNIn0KLAp7ImFscGhhMiI6IlpNIiwiYWxwaGEzIjoiWk1CIn0KLAp7ImFscGhhMiI6IlpXIiwiYWxwaGEzIjoiWldFIn0KLAp7ImFscGhhMiI6IkFYIiwiYWxwaGEzIjoiQUxBIn0KXQo=","base64"),ISOCodes=JSON.parse(countries);module.exports=function(){var a="",b=function(b){return b&&1<b.length&&(a=b),3===a.length?ISOCodes.filter(function(b){return b.alpha3===a})[0].alpha2:a},c=function(b){return b&&1<b.length&&(a=b),2===a.length?ISOCodes.filter(function(b){return b.alpha2===a})[0].alpha3:a},d=function(b){return"string"==typeof b?(a=b.toUpperCase(),this):a},e=function(b){return"string"==typeof b?(a=b.split("-").pop().toUpperCase(),this):a};return{from:d,fromLocale:e,is2:function(a){return ISOCodes.some(function(b){return b.alpha2===a})},is3:function(a){return ISOCodes.some(function(b){return b.alpha3===a})},list:function(){return ISOCodes},to2:b,to3:c}}();
4}).call(this,require("buffer").Buffer)
5},{"buffer":3}],2:[function(require,module,exports){
6'use strict'
7
8exports.byteLength = byteLength
9exports.toByteArray = toByteArray
10exports.fromByteArray = fromByteArray
11
12var lookup = []
13var revLookup = []
14var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
15
16var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
17for (var i = 0, len = code.length; i < len; ++i) {
18 lookup[i] = code[i]
19 revLookup[code.charCodeAt(i)] = i
20}
21
22// Support decoding URL-safe base64 strings, as Node.js does.
23// See: https://en.wikipedia.org/wiki/Base64#URL_applications
24revLookup['-'.charCodeAt(0)] = 62
25revLookup['_'.charCodeAt(0)] = 63
26
27function getLens (b64) {
28 var len = b64.length
29
30 if (len % 4 > 0) {
31 throw new Error('Invalid string. Length must be a multiple of 4')
32 }
33
34 // Trim off extra bytes after placeholder bytes are found
35 // See: https://github.com/beatgammit/base64-js/issues/42
36 var validLen = b64.indexOf('=')
37 if (validLen === -1) validLen = len
38
39 var placeHoldersLen = validLen === len
40 ? 0
41 : 4 - (validLen % 4)
42
43 return [validLen, placeHoldersLen]
44}
45
46// base64 is 4/3 + up to two characters of the original data
47function byteLength (b64) {
48 var lens = getLens(b64)
49 var validLen = lens[0]
50 var placeHoldersLen = lens[1]
51 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
52}
53
54function _byteLength (b64, validLen, placeHoldersLen) {
55 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
56}
57
58function toByteArray (b64) {
59 var tmp
60 var lens = getLens(b64)
61 var validLen = lens[0]
62 var placeHoldersLen = lens[1]
63
64 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
65
66 var curByte = 0
67
68 // if there are placeholders, only get up to the last complete 4 chars
69 var len = placeHoldersLen > 0
70 ? validLen - 4
71 : validLen
72
73 for (var i = 0; i < len; i += 4) {
74 tmp =
75 (revLookup[b64.charCodeAt(i)] << 18) |
76 (revLookup[b64.charCodeAt(i + 1)] << 12) |
77 (revLookup[b64.charCodeAt(i + 2)] << 6) |
78 revLookup[b64.charCodeAt(i + 3)]
79 arr[curByte++] = (tmp >> 16) & 0xFF
80 arr[curByte++] = (tmp >> 8) & 0xFF
81 arr[curByte++] = tmp & 0xFF
82 }
83
84 if (placeHoldersLen === 2) {
85 tmp =
86 (revLookup[b64.charCodeAt(i)] << 2) |
87 (revLookup[b64.charCodeAt(i + 1)] >> 4)
88 arr[curByte++] = tmp & 0xFF
89 }
90
91 if (placeHoldersLen === 1) {
92 tmp =
93 (revLookup[b64.charCodeAt(i)] << 10) |
94 (revLookup[b64.charCodeAt(i + 1)] << 4) |
95 (revLookup[b64.charCodeAt(i + 2)] >> 2)
96 arr[curByte++] = (tmp >> 8) & 0xFF
97 arr[curByte++] = tmp & 0xFF
98 }
99
100 return arr
101}
102
103function tripletToBase64 (num) {
104 return lookup[num >> 18 & 0x3F] +
105 lookup[num >> 12 & 0x3F] +
106 lookup[num >> 6 & 0x3F] +
107 lookup[num & 0x3F]
108}
109
110function encodeChunk (uint8, start, end) {
111 var tmp
112 var output = []
113 for (var i = start; i < end; i += 3) {
114 tmp =
115 ((uint8[i] << 16) & 0xFF0000) +
116 ((uint8[i + 1] << 8) & 0xFF00) +
117 (uint8[i + 2] & 0xFF)
118 output.push(tripletToBase64(tmp))
119 }
120 return output.join('')
121}
122
123function fromByteArray (uint8) {
124 var tmp
125 var len = uint8.length
126 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
127 var parts = []
128 var maxChunkLength = 16383 // must be multiple of 3
129
130 // go through the array every three bytes, we'll deal with trailing stuff later
131 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
132 parts.push(encodeChunk(
133 uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
134 ))
135 }
136
137 // pad the end with zeros, but make sure to not forget the extra bytes
138 if (extraBytes === 1) {
139 tmp = uint8[len - 1]
140 parts.push(
141 lookup[tmp >> 2] +
142 lookup[(tmp << 4) & 0x3F] +
143 '=='
144 )
145 } else if (extraBytes === 2) {
146 tmp = (uint8[len - 2] << 8) + uint8[len - 1]
147 parts.push(
148 lookup[tmp >> 10] +
149 lookup[(tmp >> 4) & 0x3F] +
150 lookup[(tmp << 2) & 0x3F] +
151 '='
152 )
153 }
154
155 return parts.join('')
156}
157
158},{}],3:[function(require,module,exports){
159/*!
160 * The buffer module from node.js, for the browser.
161 *
162 * @author Feross Aboukhadijeh <https://feross.org>
163 * @license MIT
164 */
165/* eslint-disable no-proto */
166
167'use strict'
168
169var base64 = require('base64-js')
170var ieee754 = require('ieee754')
171
172exports.Buffer = Buffer
173exports.SlowBuffer = SlowBuffer
174exports.INSPECT_MAX_BYTES = 50
175
176var K_MAX_LENGTH = 0x7fffffff
177exports.kMaxLength = K_MAX_LENGTH
178
179/**
180 * If `Buffer.TYPED_ARRAY_SUPPORT`:
181 * === true Use Uint8Array implementation (fastest)
182 * === false Print warning and recommend using `buffer` v4.x which has an Object
183 * implementation (most compatible, even IE6)
184 *
185 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
186 * Opera 11.6+, iOS 4.2+.
187 *
188 * We report that the browser does not support typed arrays if the are not subclassable
189 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
190 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
191 * for __proto__ and has a buggy typed array implementation.
192 */
193Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
194
195if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
196 typeof console.error === 'function') {
197 console.error(
198 'This browser lacks typed array (Uint8Array) support which is required by ' +
199 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
200 )
201}
202
203function typedArraySupport () {
204 // Can typed array instances can be augmented?
205 try {
206 var arr = new Uint8Array(1)
207 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
208 return arr.foo() === 42
209 } catch (e) {
210 return false
211 }
212}
213
214Object.defineProperty(Buffer.prototype, 'parent', {
215 enumerable: true,
216 get: function () {
217 if (!Buffer.isBuffer(this)) return undefined
218 return this.buffer
219 }
220})
221
222Object.defineProperty(Buffer.prototype, 'offset', {
223 enumerable: true,
224 get: function () {
225 if (!Buffer.isBuffer(this)) return undefined
226 return this.byteOffset
227 }
228})
229
230function createBuffer (length) {
231 if (length > K_MAX_LENGTH) {
232 throw new RangeError('The value "' + length + '" is invalid for option "size"')
233 }
234 // Return an augmented `Uint8Array` instance
235 var buf = new Uint8Array(length)
236 buf.__proto__ = Buffer.prototype
237 return buf
238}
239
240/**
241 * The Buffer constructor returns instances of `Uint8Array` that have their
242 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
243 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
244 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
245 * returns a single octet.
246 *
247 * The `Uint8Array` prototype remains unmodified.
248 */
249
250function Buffer (arg, encodingOrOffset, length) {
251 // Common case.
252 if (typeof arg === 'number') {
253 if (typeof encodingOrOffset === 'string') {
254 throw new TypeError(
255 'The "string" argument must be of type string. Received type number'
256 )
257 }
258 return allocUnsafe(arg)
259 }
260 return from(arg, encodingOrOffset, length)
261}
262
263// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
264if (typeof Symbol !== 'undefined' && Symbol.species != null &&
265 Buffer[Symbol.species] === Buffer) {
266 Object.defineProperty(Buffer, Symbol.species, {
267 value: null,
268 configurable: true,
269 enumerable: false,
270 writable: false
271 })
272}
273
274Buffer.poolSize = 8192 // not used by this implementation
275
276function from (value, encodingOrOffset, length) {
277 if (typeof value === 'string') {
278 return fromString(value, encodingOrOffset)
279 }
280
281 if (ArrayBuffer.isView(value)) {
282 return fromArrayLike(value)
283 }
284
285 if (value == null) {
286 throw TypeError(
287 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
288 'or Array-like Object. Received type ' + (typeof value)
289 )
290 }
291
292 if (isInstance(value, ArrayBuffer) ||
293 (value && isInstance(value.buffer, ArrayBuffer))) {
294 return fromArrayBuffer(value, encodingOrOffset, length)
295 }
296
297 if (typeof value === 'number') {
298 throw new TypeError(
299 'The "value" argument must not be of type number. Received type number'
300 )
301 }
302
303 var valueOf = value.valueOf && value.valueOf()
304 if (valueOf != null && valueOf !== value) {
305 return Buffer.from(valueOf, encodingOrOffset, length)
306 }
307
308 var b = fromObject(value)
309 if (b) return b
310
311 if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
312 typeof value[Symbol.toPrimitive] === 'function') {
313 return Buffer.from(
314 value[Symbol.toPrimitive]('string'), encodingOrOffset, length
315 )
316 }
317
318 throw new TypeError(
319 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
320 'or Array-like Object. Received type ' + (typeof value)
321 )
322}
323
324/**
325 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
326 * if value is a number.
327 * Buffer.from(str[, encoding])
328 * Buffer.from(array)
329 * Buffer.from(buffer)
330 * Buffer.from(arrayBuffer[, byteOffset[, length]])
331 **/
332Buffer.from = function (value, encodingOrOffset, length) {
333 return from(value, encodingOrOffset, length)
334}
335
336// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
337// https://github.com/feross/buffer/pull/148
338Buffer.prototype.__proto__ = Uint8Array.prototype
339Buffer.__proto__ = Uint8Array
340
341function assertSize (size) {
342 if (typeof size !== 'number') {
343 throw new TypeError('"size" argument must be of type number')
344 } else if (size < 0) {
345 throw new RangeError('The value "' + size + '" is invalid for option "size"')
346 }
347}
348
349function alloc (size, fill, encoding) {
350 assertSize(size)
351 if (size <= 0) {
352 return createBuffer(size)
353 }
354 if (fill !== undefined) {
355 // Only pay attention to encoding if it's a string. This
356 // prevents accidentally sending in a number that would
357 // be interpretted as a start offset.
358 return typeof encoding === 'string'
359 ? createBuffer(size).fill(fill, encoding)
360 : createBuffer(size).fill(fill)
361 }
362 return createBuffer(size)
363}
364
365/**
366 * Creates a new filled Buffer instance.
367 * alloc(size[, fill[, encoding]])
368 **/
369Buffer.alloc = function (size, fill, encoding) {
370 return alloc(size, fill, encoding)
371}
372
373function allocUnsafe (size) {
374 assertSize(size)
375 return createBuffer(size < 0 ? 0 : checked(size) | 0)
376}
377
378/**
379 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
380 * */
381Buffer.allocUnsafe = function (size) {
382 return allocUnsafe(size)
383}
384/**
385 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
386 */
387Buffer.allocUnsafeSlow = function (size) {
388 return allocUnsafe(size)
389}
390
391function fromString (string, encoding) {
392 if (typeof encoding !== 'string' || encoding === '') {
393 encoding = 'utf8'
394 }
395
396 if (!Buffer.isEncoding(encoding)) {
397 throw new TypeError('Unknown encoding: ' + encoding)
398 }
399
400 var length = byteLength(string, encoding) | 0
401 var buf = createBuffer(length)
402
403 var actual = buf.write(string, encoding)
404
405 if (actual !== length) {
406 // Writing a hex string, for example, that contains invalid characters will
407 // cause everything after the first invalid character to be ignored. (e.g.
408 // 'abxxcd' will be treated as 'ab')
409 buf = buf.slice(0, actual)
410 }
411
412 return buf
413}
414
415function fromArrayLike (array) {
416 var length = array.length < 0 ? 0 : checked(array.length) | 0
417 var buf = createBuffer(length)
418 for (var i = 0; i < length; i += 1) {
419 buf[i] = array[i] & 255
420 }
421 return buf
422}
423
424function fromArrayBuffer (array, byteOffset, length) {
425 if (byteOffset < 0 || array.byteLength < byteOffset) {
426 throw new RangeError('"offset" is outside of buffer bounds')
427 }
428
429 if (array.byteLength < byteOffset + (length || 0)) {
430 throw new RangeError('"length" is outside of buffer bounds')
431 }
432
433 var buf
434 if (byteOffset === undefined && length === undefined) {
435 buf = new Uint8Array(array)
436 } else if (length === undefined) {
437 buf = new Uint8Array(array, byteOffset)
438 } else {
439 buf = new Uint8Array(array, byteOffset, length)
440 }
441
442 // Return an augmented `Uint8Array` instance
443 buf.__proto__ = Buffer.prototype
444 return buf
445}
446
447function fromObject (obj) {
448 if (Buffer.isBuffer(obj)) {
449 var len = checked(obj.length) | 0
450 var buf = createBuffer(len)
451
452 if (buf.length === 0) {
453 return buf
454 }
455
456 obj.copy(buf, 0, 0, len)
457 return buf
458 }
459
460 if (obj.length !== undefined) {
461 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
462 return createBuffer(0)
463 }
464 return fromArrayLike(obj)
465 }
466
467 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
468 return fromArrayLike(obj.data)
469 }
470}
471
472function checked (length) {
473 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
474 // length is NaN (which is otherwise coerced to zero.)
475 if (length >= K_MAX_LENGTH) {
476 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
477 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
478 }
479 return length | 0
480}
481
482function SlowBuffer (length) {
483 if (+length != length) { // eslint-disable-line eqeqeq
484 length = 0
485 }
486 return Buffer.alloc(+length)
487}
488
489Buffer.isBuffer = function isBuffer (b) {
490 return b != null && b._isBuffer === true &&
491 b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
492}
493
494Buffer.compare = function compare (a, b) {
495 if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
496 if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
497 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
498 throw new TypeError(
499 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
500 )
501 }
502
503 if (a === b) return 0
504
505 var x = a.length
506 var y = b.length
507
508 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
509 if (a[i] !== b[i]) {
510 x = a[i]
511 y = b[i]
512 break
513 }
514 }
515
516 if (x < y) return -1
517 if (y < x) return 1
518 return 0
519}
520
521Buffer.isEncoding = function isEncoding (encoding) {
522 switch (String(encoding).toLowerCase()) {
523 case 'hex':
524 case 'utf8':
525 case 'utf-8':
526 case 'ascii':
527 case 'latin1':
528 case 'binary':
529 case 'base64':
530 case 'ucs2':
531 case 'ucs-2':
532 case 'utf16le':
533 case 'utf-16le':
534 return true
535 default:
536 return false
537 }
538}
539
540Buffer.concat = function concat (list, length) {
541 if (!Array.isArray(list)) {
542 throw new TypeError('"list" argument must be an Array of Buffers')
543 }
544
545 if (list.length === 0) {
546 return Buffer.alloc(0)
547 }
548
549 var i
550 if (length === undefined) {
551 length = 0
552 for (i = 0; i < list.length; ++i) {
553 length += list[i].length
554 }
555 }
556
557 var buffer = Buffer.allocUnsafe(length)
558 var pos = 0
559 for (i = 0; i < list.length; ++i) {
560 var buf = list[i]
561 if (isInstance(buf, Uint8Array)) {
562 buf = Buffer.from(buf)
563 }
564 if (!Buffer.isBuffer(buf)) {
565 throw new TypeError('"list" argument must be an Array of Buffers')
566 }
567 buf.copy(buffer, pos)
568 pos += buf.length
569 }
570 return buffer
571}
572
573function byteLength (string, encoding) {
574 if (Buffer.isBuffer(string)) {
575 return string.length
576 }
577 if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
578 return string.byteLength
579 }
580 if (typeof string !== 'string') {
581 throw new TypeError(
582 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
583 'Received type ' + typeof string
584 )
585 }
586
587 var len = string.length
588 var mustMatch = (arguments.length > 2 && arguments[2] === true)
589 if (!mustMatch && len === 0) return 0
590
591 // Use a for loop to avoid recursion
592 var loweredCase = false
593 for (;;) {
594 switch (encoding) {
595 case 'ascii':
596 case 'latin1':
597 case 'binary':
598 return len
599 case 'utf8':
600 case 'utf-8':
601 return utf8ToBytes(string).length
602 case 'ucs2':
603 case 'ucs-2':
604 case 'utf16le':
605 case 'utf-16le':
606 return len * 2
607 case 'hex':
608 return len >>> 1
609 case 'base64':
610 return base64ToBytes(string).length
611 default:
612 if (loweredCase) {
613 return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
614 }
615 encoding = ('' + encoding).toLowerCase()
616 loweredCase = true
617 }
618 }
619}
620Buffer.byteLength = byteLength
621
622function slowToString (encoding, start, end) {
623 var loweredCase = false
624
625 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
626 // property of a typed array.
627
628 // This behaves neither like String nor Uint8Array in that we set start/end
629 // to their upper/lower bounds if the value passed is out of range.
630 // undefined is handled specially as per ECMA-262 6th Edition,
631 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
632 if (start === undefined || start < 0) {
633 start = 0
634 }
635 // Return early if start > this.length. Done here to prevent potential uint32
636 // coercion fail below.
637 if (start > this.length) {
638 return ''
639 }
640
641 if (end === undefined || end > this.length) {
642 end = this.length
643 }
644
645 if (end <= 0) {
646 return ''
647 }
648
649 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
650 end >>>= 0
651 start >>>= 0
652
653 if (end <= start) {
654 return ''
655 }
656
657 if (!encoding) encoding = 'utf8'
658
659 while (true) {
660 switch (encoding) {
661 case 'hex':
662 return hexSlice(this, start, end)
663
664 case 'utf8':
665 case 'utf-8':
666 return utf8Slice(this, start, end)
667
668 case 'ascii':
669 return asciiSlice(this, start, end)
670
671 case 'latin1':
672 case 'binary':
673 return latin1Slice(this, start, end)
674
675 case 'base64':
676 return base64Slice(this, start, end)
677
678 case 'ucs2':
679 case 'ucs-2':
680 case 'utf16le':
681 case 'utf-16le':
682 return utf16leSlice(this, start, end)
683
684 default:
685 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
686 encoding = (encoding + '').toLowerCase()
687 loweredCase = true
688 }
689 }
690}
691
692// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
693// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
694// reliably in a browserify context because there could be multiple different
695// copies of the 'buffer' package in use. This method works even for Buffer
696// instances that were created from another copy of the `buffer` package.
697// See: https://github.com/feross/buffer/issues/154
698Buffer.prototype._isBuffer = true
699
700function swap (b, n, m) {
701 var i = b[n]
702 b[n] = b[m]
703 b[m] = i
704}
705
706Buffer.prototype.swap16 = function swap16 () {
707 var len = this.length
708 if (len % 2 !== 0) {
709 throw new RangeError('Buffer size must be a multiple of 16-bits')
710 }
711 for (var i = 0; i < len; i += 2) {
712 swap(this, i, i + 1)
713 }
714 return this
715}
716
717Buffer.prototype.swap32 = function swap32 () {
718 var len = this.length
719 if (len % 4 !== 0) {
720 throw new RangeError('Buffer size must be a multiple of 32-bits')
721 }
722 for (var i = 0; i < len; i += 4) {
723 swap(this, i, i + 3)
724 swap(this, i + 1, i + 2)
725 }
726 return this
727}
728
729Buffer.prototype.swap64 = function swap64 () {
730 var len = this.length
731 if (len % 8 !== 0) {
732 throw new RangeError('Buffer size must be a multiple of 64-bits')
733 }
734 for (var i = 0; i < len; i += 8) {
735 swap(this, i, i + 7)
736 swap(this, i + 1, i + 6)
737 swap(this, i + 2, i + 5)
738 swap(this, i + 3, i + 4)
739 }
740 return this
741}
742
743Buffer.prototype.toString = function toString () {
744 var length = this.length
745 if (length === 0) return ''
746 if (arguments.length === 0) return utf8Slice(this, 0, length)
747 return slowToString.apply(this, arguments)
748}
749
750Buffer.prototype.toLocaleString = Buffer.prototype.toString
751
752Buffer.prototype.equals = function equals (b) {
753 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
754 if (this === b) return true
755 return Buffer.compare(this, b) === 0
756}
757
758Buffer.prototype.inspect = function inspect () {
759 var str = ''
760 var max = exports.INSPECT_MAX_BYTES
761 str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
762 if (this.length > max) str += ' ... '
763 return '<Buffer ' + str + '>'
764}
765
766Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
767 if (isInstance(target, Uint8Array)) {
768 target = Buffer.from(target, target.offset, target.byteLength)
769 }
770 if (!Buffer.isBuffer(target)) {
771 throw new TypeError(
772 'The "target" argument must be one of type Buffer or Uint8Array. ' +
773 'Received type ' + (typeof target)
774 )
775 }
776
777 if (start === undefined) {
778 start = 0
779 }
780 if (end === undefined) {
781 end = target ? target.length : 0
782 }
783 if (thisStart === undefined) {
784 thisStart = 0
785 }
786 if (thisEnd === undefined) {
787 thisEnd = this.length
788 }
789
790 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
791 throw new RangeError('out of range index')
792 }
793
794 if (thisStart >= thisEnd && start >= end) {
795 return 0
796 }
797 if (thisStart >= thisEnd) {
798 return -1
799 }
800 if (start >= end) {
801 return 1
802 }
803
804 start >>>= 0
805 end >>>= 0
806 thisStart >>>= 0
807 thisEnd >>>= 0
808
809 if (this === target) return 0
810
811 var x = thisEnd - thisStart
812 var y = end - start
813 var len = Math.min(x, y)
814
815 var thisCopy = this.slice(thisStart, thisEnd)
816 var targetCopy = target.slice(start, end)
817
818 for (var i = 0; i < len; ++i) {
819 if (thisCopy[i] !== targetCopy[i]) {
820 x = thisCopy[i]
821 y = targetCopy[i]
822 break
823 }
824 }
825
826 if (x < y) return -1
827 if (y < x) return 1
828 return 0
829}
830
831// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
832// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
833//
834// Arguments:
835// - buffer - a Buffer to search
836// - val - a string, Buffer, or number
837// - byteOffset - an index into `buffer`; will be clamped to an int32
838// - encoding - an optional encoding, relevant is val is a string
839// - dir - true for indexOf, false for lastIndexOf
840function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
841 // Empty buffer means no match
842 if (buffer.length === 0) return -1
843
844 // Normalize byteOffset
845 if (typeof byteOffset === 'string') {
846 encoding = byteOffset
847 byteOffset = 0
848 } else if (byteOffset > 0x7fffffff) {
849 byteOffset = 0x7fffffff
850 } else if (byteOffset < -0x80000000) {
851 byteOffset = -0x80000000
852 }
853 byteOffset = +byteOffset // Coerce to Number.
854 if (numberIsNaN(byteOffset)) {
855 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
856 byteOffset = dir ? 0 : (buffer.length - 1)
857 }
858
859 // Normalize byteOffset: negative offsets start from the end of the buffer
860 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
861 if (byteOffset >= buffer.length) {
862 if (dir) return -1
863 else byteOffset = buffer.length - 1
864 } else if (byteOffset < 0) {
865 if (dir) byteOffset = 0
866 else return -1
867 }
868
869 // Normalize val
870 if (typeof val === 'string') {
871 val = Buffer.from(val, encoding)
872 }
873
874 // Finally, search either indexOf (if dir is true) or lastIndexOf
875 if (Buffer.isBuffer(val)) {
876 // Special case: looking for empty string/buffer always fails
877 if (val.length === 0) {
878 return -1
879 }
880 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
881 } else if (typeof val === 'number') {
882 val = val & 0xFF // Search for a byte value [0-255]
883 if (typeof Uint8Array.prototype.indexOf === 'function') {
884 if (dir) {
885 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
886 } else {
887 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
888 }
889 }
890 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
891 }
892
893 throw new TypeError('val must be string, number or Buffer')
894}
895
896function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
897 var indexSize = 1
898 var arrLength = arr.length
899 var valLength = val.length
900
901 if (encoding !== undefined) {
902 encoding = String(encoding).toLowerCase()
903 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
904 encoding === 'utf16le' || encoding === 'utf-16le') {
905 if (arr.length < 2 || val.length < 2) {
906 return -1
907 }
908 indexSize = 2
909 arrLength /= 2
910 valLength /= 2
911 byteOffset /= 2
912 }
913 }
914
915 function read (buf, i) {
916 if (indexSize === 1) {
917 return buf[i]
918 } else {
919 return buf.readUInt16BE(i * indexSize)
920 }
921 }
922
923 var i
924 if (dir) {
925 var foundIndex = -1
926 for (i = byteOffset; i < arrLength; i++) {
927 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
928 if (foundIndex === -1) foundIndex = i
929 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
930 } else {
931 if (foundIndex !== -1) i -= i - foundIndex
932 foundIndex = -1
933 }
934 }
935 } else {
936 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
937 for (i = byteOffset; i >= 0; i--) {
938 var found = true
939 for (var j = 0; j < valLength; j++) {
940 if (read(arr, i + j) !== read(val, j)) {
941 found = false
942 break
943 }
944 }
945 if (found) return i
946 }
947 }
948
949 return -1
950}
951
952Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
953 return this.indexOf(val, byteOffset, encoding) !== -1
954}
955
956Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
957 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
958}
959
960Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
961 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
962}
963
964function hexWrite (buf, string, offset, length) {
965 offset = Number(offset) || 0
966 var remaining = buf.length - offset
967 if (!length) {
968 length = remaining
969 } else {
970 length = Number(length)
971 if (length > remaining) {
972 length = remaining
973 }
974 }
975
976 var strLen = string.length
977
978 if (length > strLen / 2) {
979 length = strLen / 2
980 }
981 for (var i = 0; i < length; ++i) {
982 var parsed = parseInt(string.substr(i * 2, 2), 16)
983 if (numberIsNaN(parsed)) return i
984 buf[offset + i] = parsed
985 }
986 return i
987}
988
989function utf8Write (buf, string, offset, length) {
990 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
991}
992
993function asciiWrite (buf, string, offset, length) {
994 return blitBuffer(asciiToBytes(string), buf, offset, length)
995}
996
997function latin1Write (buf, string, offset, length) {
998 return asciiWrite(buf, string, offset, length)
999}
1000
1001function base64Write (buf, string, offset, length) {
1002 return blitBuffer(base64ToBytes(string), buf, offset, length)
1003}
1004
1005function ucs2Write (buf, string, offset, length) {
1006 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1007}
1008
1009Buffer.prototype.write = function write (string, offset, length, encoding) {
1010 // Buffer#write(string)
1011 if (offset === undefined) {
1012 encoding = 'utf8'
1013 length = this.length
1014 offset = 0
1015 // Buffer#write(string, encoding)
1016 } else if (length === undefined && typeof offset === 'string') {
1017 encoding = offset
1018 length = this.length
1019 offset = 0
1020 // Buffer#write(string, offset[, length][, encoding])
1021 } else if (isFinite(offset)) {
1022 offset = offset >>> 0
1023 if (isFinite(length)) {
1024 length = length >>> 0
1025 if (encoding === undefined) encoding = 'utf8'
1026 } else {
1027 encoding = length
1028 length = undefined
1029 }
1030 } else {
1031 throw new Error(
1032 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1033 )
1034 }
1035
1036 var remaining = this.length - offset
1037 if (length === undefined || length > remaining) length = remaining
1038
1039 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1040 throw new RangeError('Attempt to write outside buffer bounds')
1041 }
1042
1043 if (!encoding) encoding = 'utf8'
1044
1045 var loweredCase = false
1046 for (;;) {
1047 switch (encoding) {
1048 case 'hex':
1049 return hexWrite(this, string, offset, length)
1050
1051 case 'utf8':
1052 case 'utf-8':
1053 return utf8Write(this, string, offset, length)
1054
1055 case 'ascii':
1056 return asciiWrite(this, string, offset, length)
1057
1058 case 'latin1':
1059 case 'binary':
1060 return latin1Write(this, string, offset, length)
1061
1062 case 'base64':
1063 // Warning: maxLength not taken into account in base64Write
1064 return base64Write(this, string, offset, length)
1065
1066 case 'ucs2':
1067 case 'ucs-2':
1068 case 'utf16le':
1069 case 'utf-16le':
1070 return ucs2Write(this, string, offset, length)
1071
1072 default:
1073 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1074 encoding = ('' + encoding).toLowerCase()
1075 loweredCase = true
1076 }
1077 }
1078}
1079
1080Buffer.prototype.toJSON = function toJSON () {
1081 return {
1082 type: 'Buffer',
1083 data: Array.prototype.slice.call(this._arr || this, 0)
1084 }
1085}
1086
1087function base64Slice (buf, start, end) {
1088 if (start === 0 && end === buf.length) {
1089 return base64.fromByteArray(buf)
1090 } else {
1091 return base64.fromByteArray(buf.slice(start, end))
1092 }
1093}
1094
1095function utf8Slice (buf, start, end) {
1096 end = Math.min(buf.length, end)
1097 var res = []
1098
1099 var i = start
1100 while (i < end) {
1101 var firstByte = buf[i]
1102 var codePoint = null
1103 var bytesPerSequence = (firstByte > 0xEF) ? 4
1104 : (firstByte > 0xDF) ? 3
1105 : (firstByte > 0xBF) ? 2
1106 : 1
1107
1108 if (i + bytesPerSequence <= end) {
1109 var secondByte, thirdByte, fourthByte, tempCodePoint
1110
1111 switch (bytesPerSequence) {
1112 case 1:
1113 if (firstByte < 0x80) {
1114 codePoint = firstByte
1115 }
1116 break
1117 case 2:
1118 secondByte = buf[i + 1]
1119 if ((secondByte & 0xC0) === 0x80) {
1120 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
1121 if (tempCodePoint > 0x7F) {
1122 codePoint = tempCodePoint
1123 }
1124 }
1125 break
1126 case 3:
1127 secondByte = buf[i + 1]
1128 thirdByte = buf[i + 2]
1129 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1130 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
1131 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1132 codePoint = tempCodePoint
1133 }
1134 }
1135 break
1136 case 4:
1137 secondByte = buf[i + 1]
1138 thirdByte = buf[i + 2]
1139 fourthByte = buf[i + 3]
1140 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1141 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
1142 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1143 codePoint = tempCodePoint
1144 }
1145 }
1146 }
1147 }
1148
1149 if (codePoint === null) {
1150 // we did not generate a valid codePoint so insert a
1151 // replacement char (U+FFFD) and advance only 1 byte
1152 codePoint = 0xFFFD
1153 bytesPerSequence = 1
1154 } else if (codePoint > 0xFFFF) {
1155 // encode to utf16 (surrogate pair dance)
1156 codePoint -= 0x10000
1157 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
1158 codePoint = 0xDC00 | codePoint & 0x3FF
1159 }
1160
1161 res.push(codePoint)
1162 i += bytesPerSequence
1163 }
1164
1165 return decodeCodePointsArray(res)
1166}
1167
1168// Based on http://stackoverflow.com/a/22747272/680742, the browser with
1169// the lowest limit is Chrome, with 0x10000 args.
1170// We go 1 magnitude less, for safety
1171var MAX_ARGUMENTS_LENGTH = 0x1000
1172
1173function decodeCodePointsArray (codePoints) {
1174 var len = codePoints.length
1175 if (len <= MAX_ARGUMENTS_LENGTH) {
1176 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1177 }
1178
1179 // Decode in chunks to avoid "call stack size exceeded".
1180 var res = ''
1181 var i = 0
1182 while (i < len) {
1183 res += String.fromCharCode.apply(
1184 String,
1185 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1186 )
1187 }
1188 return res
1189}
1190
1191function asciiSlice (buf, start, end) {
1192 var ret = ''
1193 end = Math.min(buf.length, end)
1194
1195 for (var i = start; i < end; ++i) {
1196 ret += String.fromCharCode(buf[i] & 0x7F)
1197 }
1198 return ret
1199}
1200
1201function latin1Slice (buf, start, end) {
1202 var ret = ''
1203 end = Math.min(buf.length, end)
1204
1205 for (var i = start; i < end; ++i) {
1206 ret += String.fromCharCode(buf[i])
1207 }
1208 return ret
1209}
1210
1211function hexSlice (buf, start, end) {
1212 var len = buf.length
1213
1214 if (!start || start < 0) start = 0
1215 if (!end || end < 0 || end > len) end = len
1216
1217 var out = ''
1218 for (var i = start; i < end; ++i) {
1219 out += toHex(buf[i])
1220 }
1221 return out
1222}
1223
1224function utf16leSlice (buf, start, end) {
1225 var bytes = buf.slice(start, end)
1226 var res = ''
1227 for (var i = 0; i < bytes.length; i += 2) {
1228 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
1229 }
1230 return res
1231}
1232
1233Buffer.prototype.slice = function slice (start, end) {
1234 var len = this.length
1235 start = ~~start
1236 end = end === undefined ? len : ~~end
1237
1238 if (start < 0) {
1239 start += len
1240 if (start < 0) start = 0
1241 } else if (start > len) {
1242 start = len
1243 }
1244
1245 if (end < 0) {
1246 end += len
1247 if (end < 0) end = 0
1248 } else if (end > len) {
1249 end = len
1250 }
1251
1252 if (end < start) end = start
1253
1254 var newBuf = this.subarray(start, end)
1255 // Return an augmented `Uint8Array` instance
1256 newBuf.__proto__ = Buffer.prototype
1257 return newBuf
1258}
1259
1260/*
1261 * Need to make sure that buffer isn't trying to write out of bounds.
1262 */
1263function checkOffset (offset, ext, length) {
1264 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1265 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1266}
1267
1268Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1269 offset = offset >>> 0
1270 byteLength = byteLength >>> 0
1271 if (!noAssert) checkOffset(offset, byteLength, this.length)
1272
1273 var val = this[offset]
1274 var mul = 1
1275 var i = 0
1276 while (++i < byteLength && (mul *= 0x100)) {
1277 val += this[offset + i] * mul
1278 }
1279
1280 return val
1281}
1282
1283Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1284 offset = offset >>> 0
1285 byteLength = byteLength >>> 0
1286 if (!noAssert) {
1287 checkOffset(offset, byteLength, this.length)
1288 }
1289
1290 var val = this[offset + --byteLength]
1291 var mul = 1
1292 while (byteLength > 0 && (mul *= 0x100)) {
1293 val += this[offset + --byteLength] * mul
1294 }
1295
1296 return val
1297}
1298
1299Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1300 offset = offset >>> 0
1301 if (!noAssert) checkOffset(offset, 1, this.length)
1302 return this[offset]
1303}
1304
1305Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1306 offset = offset >>> 0
1307 if (!noAssert) checkOffset(offset, 2, this.length)
1308 return this[offset] | (this[offset + 1] << 8)
1309}
1310
1311Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1312 offset = offset >>> 0
1313 if (!noAssert) checkOffset(offset, 2, this.length)
1314 return (this[offset] << 8) | this[offset + 1]
1315}
1316
1317Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1318 offset = offset >>> 0
1319 if (!noAssert) checkOffset(offset, 4, this.length)
1320
1321 return ((this[offset]) |
1322 (this[offset + 1] << 8) |
1323 (this[offset + 2] << 16)) +
1324 (this[offset + 3] * 0x1000000)
1325}
1326
1327Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1328 offset = offset >>> 0
1329 if (!noAssert) checkOffset(offset, 4, this.length)
1330
1331 return (this[offset] * 0x1000000) +
1332 ((this[offset + 1] << 16) |
1333 (this[offset + 2] << 8) |
1334 this[offset + 3])
1335}
1336
1337Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1338 offset = offset >>> 0
1339 byteLength = byteLength >>> 0
1340 if (!noAssert) checkOffset(offset, byteLength, this.length)
1341
1342 var val = this[offset]
1343 var mul = 1
1344 var i = 0
1345 while (++i < byteLength && (mul *= 0x100)) {
1346 val += this[offset + i] * mul
1347 }
1348 mul *= 0x80
1349
1350 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1351
1352 return val
1353}
1354
1355Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1356 offset = offset >>> 0
1357 byteLength = byteLength >>> 0
1358 if (!noAssert) checkOffset(offset, byteLength, this.length)
1359
1360 var i = byteLength
1361 var mul = 1
1362 var val = this[offset + --i]
1363 while (i > 0 && (mul *= 0x100)) {
1364 val += this[offset + --i] * mul
1365 }
1366 mul *= 0x80
1367
1368 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
1369
1370 return val
1371}
1372
1373Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1374 offset = offset >>> 0
1375 if (!noAssert) checkOffset(offset, 1, this.length)
1376 if (!(this[offset] & 0x80)) return (this[offset])
1377 return ((0xff - this[offset] + 1) * -1)
1378}
1379
1380Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1381 offset = offset >>> 0
1382 if (!noAssert) checkOffset(offset, 2, this.length)
1383 var val = this[offset] | (this[offset + 1] << 8)
1384 return (val & 0x8000) ? val | 0xFFFF0000 : val
1385}
1386
1387Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1388 offset = offset >>> 0
1389 if (!noAssert) checkOffset(offset, 2, this.length)
1390 var val = this[offset + 1] | (this[offset] << 8)
1391 return (val & 0x8000) ? val | 0xFFFF0000 : val
1392}
1393
1394Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1395 offset = offset >>> 0
1396 if (!noAssert) checkOffset(offset, 4, this.length)
1397
1398 return (this[offset]) |
1399 (this[offset + 1] << 8) |
1400 (this[offset + 2] << 16) |
1401 (this[offset + 3] << 24)
1402}
1403
1404Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1405 offset = offset >>> 0
1406 if (!noAssert) checkOffset(offset, 4, this.length)
1407
1408 return (this[offset] << 24) |
1409 (this[offset + 1] << 16) |
1410 (this[offset + 2] << 8) |
1411 (this[offset + 3])
1412}
1413
1414Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1415 offset = offset >>> 0
1416 if (!noAssert) checkOffset(offset, 4, this.length)
1417 return ieee754.read(this, offset, true, 23, 4)
1418}
1419
1420Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1421 offset = offset >>> 0
1422 if (!noAssert) checkOffset(offset, 4, this.length)
1423 return ieee754.read(this, offset, false, 23, 4)
1424}
1425
1426Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1427 offset = offset >>> 0
1428 if (!noAssert) checkOffset(offset, 8, this.length)
1429 return ieee754.read(this, offset, true, 52, 8)
1430}
1431
1432Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1433 offset = offset >>> 0
1434 if (!noAssert) checkOffset(offset, 8, this.length)
1435 return ieee754.read(this, offset, false, 52, 8)
1436}
1437
1438function checkInt (buf, value, offset, ext, max, min) {
1439 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1440 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1441 if (offset + ext > buf.length) throw new RangeError('Index out of range')
1442}
1443
1444Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1445 value = +value
1446 offset = offset >>> 0
1447 byteLength = byteLength >>> 0
1448 if (!noAssert) {
1449 var maxBytes = Math.pow(2, 8 * byteLength) - 1
1450 checkInt(this, value, offset, byteLength, maxBytes, 0)
1451 }
1452
1453 var mul = 1
1454 var i = 0
1455 this[offset] = value & 0xFF
1456 while (++i < byteLength && (mul *= 0x100)) {
1457 this[offset + i] = (value / mul) & 0xFF
1458 }
1459
1460 return offset + byteLength
1461}
1462
1463Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1464 value = +value
1465 offset = offset >>> 0
1466 byteLength = byteLength >>> 0
1467 if (!noAssert) {
1468 var maxBytes = Math.pow(2, 8 * byteLength) - 1
1469 checkInt(this, value, offset, byteLength, maxBytes, 0)
1470 }
1471
1472 var i = byteLength - 1
1473 var mul = 1
1474 this[offset + i] = value & 0xFF
1475 while (--i >= 0 && (mul *= 0x100)) {
1476 this[offset + i] = (value / mul) & 0xFF
1477 }
1478
1479 return offset + byteLength
1480}
1481
1482Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1483 value = +value
1484 offset = offset >>> 0
1485 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
1486 this[offset] = (value & 0xff)
1487 return offset + 1
1488}
1489
1490Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1491 value = +value
1492 offset = offset >>> 0
1493 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1494 this[offset] = (value & 0xff)
1495 this[offset + 1] = (value >>> 8)
1496 return offset + 2
1497}
1498
1499Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1500 value = +value
1501 offset = offset >>> 0
1502 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
1503 this[offset] = (value >>> 8)
1504 this[offset + 1] = (value & 0xff)
1505 return offset + 2
1506}
1507
1508Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1509 value = +value
1510 offset = offset >>> 0
1511 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1512 this[offset + 3] = (value >>> 24)
1513 this[offset + 2] = (value >>> 16)
1514 this[offset + 1] = (value >>> 8)
1515 this[offset] = (value & 0xff)
1516 return offset + 4
1517}
1518
1519Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1520 value = +value
1521 offset = offset >>> 0
1522 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
1523 this[offset] = (value >>> 24)
1524 this[offset + 1] = (value >>> 16)
1525 this[offset + 2] = (value >>> 8)
1526 this[offset + 3] = (value & 0xff)
1527 return offset + 4
1528}
1529
1530Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1531 value = +value
1532 offset = offset >>> 0
1533 if (!noAssert) {
1534 var limit = Math.pow(2, (8 * byteLength) - 1)
1535
1536 checkInt(this, value, offset, byteLength, limit - 1, -limit)
1537 }
1538
1539 var i = 0
1540 var mul = 1
1541 var sub = 0
1542 this[offset] = value & 0xFF
1543 while (++i < byteLength && (mul *= 0x100)) {
1544 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1545 sub = 1
1546 }
1547 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1548 }
1549
1550 return offset + byteLength
1551}
1552
1553Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1554 value = +value
1555 offset = offset >>> 0
1556 if (!noAssert) {
1557 var limit = Math.pow(2, (8 * byteLength) - 1)
1558
1559 checkInt(this, value, offset, byteLength, limit - 1, -limit)
1560 }
1561
1562 var i = byteLength - 1
1563 var mul = 1
1564 var sub = 0
1565 this[offset + i] = value & 0xFF
1566 while (--i >= 0 && (mul *= 0x100)) {
1567 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1568 sub = 1
1569 }
1570 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
1571 }
1572
1573 return offset + byteLength
1574}
1575
1576Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1577 value = +value
1578 offset = offset >>> 0
1579 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
1580 if (value < 0) value = 0xff + value + 1
1581 this[offset] = (value & 0xff)
1582 return offset + 1
1583}
1584
1585Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1586 value = +value
1587 offset = offset >>> 0
1588 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1589 this[offset] = (value & 0xff)
1590 this[offset + 1] = (value >>> 8)
1591 return offset + 2
1592}
1593
1594Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1595 value = +value
1596 offset = offset >>> 0
1597 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
1598 this[offset] = (value >>> 8)
1599 this[offset + 1] = (value & 0xff)
1600 return offset + 2
1601}
1602
1603Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1604 value = +value
1605 offset = offset >>> 0
1606 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1607 this[offset] = (value & 0xff)
1608 this[offset + 1] = (value >>> 8)
1609 this[offset + 2] = (value >>> 16)
1610 this[offset + 3] = (value >>> 24)
1611 return offset + 4
1612}
1613
1614Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1615 value = +value
1616 offset = offset >>> 0
1617 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
1618 if (value < 0) value = 0xffffffff + value + 1
1619 this[offset] = (value >>> 24)
1620 this[offset + 1] = (value >>> 16)
1621 this[offset + 2] = (value >>> 8)
1622 this[offset + 3] = (value & 0xff)
1623 return offset + 4
1624}
1625
1626function checkIEEE754 (buf, value, offset, ext, max, min) {
1627 if (offset + ext > buf.length) throw new RangeError('Index out of range')
1628 if (offset < 0) throw new RangeError('Index out of range')
1629}
1630
1631function writeFloat (buf, value, offset, littleEndian, noAssert) {
1632 value = +value
1633 offset = offset >>> 0
1634 if (!noAssert) {
1635 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
1636 }
1637 ieee754.write(buf, value, offset, littleEndian, 23, 4)
1638 return offset + 4
1639}
1640
1641Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1642 return writeFloat(this, value, offset, true, noAssert)
1643}
1644
1645Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1646 return writeFloat(this, value, offset, false, noAssert)
1647}
1648
1649function writeDouble (buf, value, offset, littleEndian, noAssert) {
1650 value = +value
1651 offset = offset >>> 0
1652 if (!noAssert) {
1653 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
1654 }
1655 ieee754.write(buf, value, offset, littleEndian, 52, 8)
1656 return offset + 8
1657}
1658
1659Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1660 return writeDouble(this, value, offset, true, noAssert)
1661}
1662
1663Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1664 return writeDouble(this, value, offset, false, noAssert)
1665}
1666
1667// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1668Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1669 if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
1670 if (!start) start = 0
1671 if (!end && end !== 0) end = this.length
1672 if (targetStart >= target.length) targetStart = target.length
1673 if (!targetStart) targetStart = 0
1674 if (end > 0 && end < start) end = start
1675
1676 // Copy 0 bytes; we're done
1677 if (end === start) return 0
1678 if (target.length === 0 || this.length === 0) return 0
1679
1680 // Fatal error conditions
1681 if (targetStart < 0) {
1682 throw new RangeError('targetStart out of bounds')
1683 }
1684 if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
1685 if (end < 0) throw new RangeError('sourceEnd out of bounds')
1686
1687 // Are we oob?
1688 if (end > this.length) end = this.length
1689 if (target.length - targetStart < end - start) {
1690 end = target.length - targetStart + start
1691 }
1692
1693 var len = end - start
1694
1695 if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
1696 // Use built-in when available, missing from IE11
1697 this.copyWithin(targetStart, start, end)
1698 } else if (this === target && start < targetStart && targetStart < end) {
1699 // descending copy from end
1700 for (var i = len - 1; i >= 0; --i) {
1701 target[i + targetStart] = this[i + start]
1702 }
1703 } else {
1704 Uint8Array.prototype.set.call(
1705 target,
1706 this.subarray(start, end),
1707 targetStart
1708 )
1709 }
1710
1711 return len
1712}
1713
1714// Usage:
1715// buffer.fill(number[, offset[, end]])
1716// buffer.fill(buffer[, offset[, end]])
1717// buffer.fill(string[, offset[, end]][, encoding])
1718Buffer.prototype.fill = function fill (val, start, end, encoding) {
1719 // Handle string cases:
1720 if (typeof val === 'string') {
1721 if (typeof start === 'string') {
1722 encoding = start
1723 start = 0
1724 end = this.length
1725 } else if (typeof end === 'string') {
1726 encoding = end
1727 end = this.length
1728 }
1729 if (encoding !== undefined && typeof encoding !== 'string') {
1730 throw new TypeError('encoding must be a string')
1731 }
1732 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1733 throw new TypeError('Unknown encoding: ' + encoding)
1734 }
1735 if (val.length === 1) {
1736 var code = val.charCodeAt(0)
1737 if ((encoding === 'utf8' && code < 128) ||
1738 encoding === 'latin1') {
1739 // Fast path: If `val` fits into a single byte, use that numeric value.
1740 val = code
1741 }
1742 }
1743 } else if (typeof val === 'number') {
1744 val = val & 255
1745 }
1746
1747 // Invalid ranges are not set to a default, so can range check early.
1748 if (start < 0 || this.length < start || this.length < end) {
1749 throw new RangeError('Out of range index')
1750 }
1751
1752 if (end <= start) {
1753 return this
1754 }
1755
1756 start = start >>> 0
1757 end = end === undefined ? this.length : end >>> 0
1758
1759 if (!val) val = 0
1760
1761 var i
1762 if (typeof val === 'number') {
1763 for (i = start; i < end; ++i) {
1764 this[i] = val
1765 }
1766 } else {
1767 var bytes = Buffer.isBuffer(val)
1768 ? val
1769 : Buffer.from(val, encoding)
1770 var len = bytes.length
1771 if (len === 0) {
1772 throw new TypeError('The value "' + val +
1773 '" is invalid for argument "value"')
1774 }
1775 for (i = 0; i < end - start; ++i) {
1776 this[i + start] = bytes[i % len]
1777 }
1778 }
1779
1780 return this
1781}
1782
1783// HELPER FUNCTIONS
1784// ================
1785
1786var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
1787
1788function base64clean (str) {
1789 // Node takes equal signs as end of the Base64 encoding
1790 str = str.split('=')[0]
1791 // Node strips out invalid characters like \n and \t from the string, base64-js does not
1792 str = str.trim().replace(INVALID_BASE64_RE, '')
1793 // Node converts strings with length < 2 to ''
1794 if (str.length < 2) return ''
1795 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1796 while (str.length % 4 !== 0) {
1797 str = str + '='
1798 }
1799 return str
1800}
1801
1802function toHex (n) {
1803 if (n < 16) return '0' + n.toString(16)
1804 return n.toString(16)
1805}
1806
1807function utf8ToBytes (string, units) {
1808 units = units || Infinity
1809 var codePoint
1810 var length = string.length
1811 var leadSurrogate = null
1812 var bytes = []
1813
1814 for (var i = 0; i < length; ++i) {
1815 codePoint = string.charCodeAt(i)
1816
1817 // is surrogate component
1818 if (codePoint > 0xD7FF && codePoint < 0xE000) {
1819 // last char was a lead
1820 if (!leadSurrogate) {
1821 // no lead yet
1822 if (codePoint > 0xDBFF) {
1823 // unexpected trail
1824 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1825 continue
1826 } else if (i + 1 === length) {
1827 // unpaired lead
1828 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1829 continue
1830 }
1831
1832 // valid lead
1833 leadSurrogate = codePoint
1834
1835 continue
1836 }
1837
1838 // 2 leads in a row
1839 if (codePoint < 0xDC00) {
1840 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1841 leadSurrogate = codePoint
1842 continue
1843 }
1844
1845 // valid surrogate pair
1846 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
1847 } else if (leadSurrogate) {
1848 // valid bmp char, but last char was a lead
1849 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
1850 }
1851
1852 leadSurrogate = null
1853
1854 // encode utf8
1855 if (codePoint < 0x80) {
1856 if ((units -= 1) < 0) break
1857 bytes.push(codePoint)
1858 } else if (codePoint < 0x800) {
1859 if ((units -= 2) < 0) break
1860 bytes.push(
1861 codePoint >> 0x6 | 0xC0,
1862 codePoint & 0x3F | 0x80
1863 )
1864 } else if (codePoint < 0x10000) {
1865 if ((units -= 3) < 0) break
1866 bytes.push(
1867 codePoint >> 0xC | 0xE0,
1868 codePoint >> 0x6 & 0x3F | 0x80,
1869 codePoint & 0x3F | 0x80
1870 )
1871 } else if (codePoint < 0x110000) {
1872 if ((units -= 4) < 0) break
1873 bytes.push(
1874 codePoint >> 0x12 | 0xF0,
1875 codePoint >> 0xC & 0x3F | 0x80,
1876 codePoint >> 0x6 & 0x3F | 0x80,
1877 codePoint & 0x3F | 0x80
1878 )
1879 } else {
1880 throw new Error('Invalid code point')
1881 }
1882 }
1883
1884 return bytes
1885}
1886
1887function asciiToBytes (str) {
1888 var byteArray = []
1889 for (var i = 0; i < str.length; ++i) {
1890 // Node's code seems to be doing this and not & 0x7F..
1891 byteArray.push(str.charCodeAt(i) & 0xFF)
1892 }
1893 return byteArray
1894}
1895
1896function utf16leToBytes (str, units) {
1897 var c, hi, lo
1898 var byteArray = []
1899 for (var i = 0; i < str.length; ++i) {
1900 if ((units -= 2) < 0) break
1901
1902 c = str.charCodeAt(i)
1903 hi = c >> 8
1904 lo = c % 256
1905 byteArray.push(lo)
1906 byteArray.push(hi)
1907 }
1908
1909 return byteArray
1910}
1911
1912function base64ToBytes (str) {
1913 return base64.toByteArray(base64clean(str))
1914}
1915
1916function blitBuffer (src, dst, offset, length) {
1917 for (var i = 0; i < length; ++i) {
1918 if ((i + offset >= dst.length) || (i >= src.length)) break
1919 dst[i + offset] = src[i]
1920 }
1921 return i
1922}
1923
1924// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
1925// the `instanceof` check but they should be treated as of that type.
1926// See: https://github.com/feross/buffer/issues/166
1927function isInstance (obj, type) {
1928 return obj instanceof type ||
1929 (obj != null && obj.constructor != null && obj.constructor.name != null &&
1930 obj.constructor.name === type.name)
1931}
1932function numberIsNaN (obj) {
1933 // For IE11 support
1934 return obj !== obj // eslint-disable-line no-self-compare
1935}
1936
1937},{"base64-js":2,"ieee754":4}],4:[function(require,module,exports){
1938exports.read = function (buffer, offset, isLE, mLen, nBytes) {
1939 var e, m
1940 var eLen = (nBytes * 8) - mLen - 1
1941 var eMax = (1 << eLen) - 1
1942 var eBias = eMax >> 1
1943 var nBits = -7
1944 var i = isLE ? (nBytes - 1) : 0
1945 var d = isLE ? -1 : 1
1946 var s = buffer[offset + i]
1947
1948 i += d
1949
1950 e = s & ((1 << (-nBits)) - 1)
1951 s >>= (-nBits)
1952 nBits += eLen
1953 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
1954
1955 m = e & ((1 << (-nBits)) - 1)
1956 e >>= (-nBits)
1957 nBits += mLen
1958 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
1959
1960 if (e === 0) {
1961 e = 1 - eBias
1962 } else if (e === eMax) {
1963 return m ? NaN : ((s ? -1 : 1) * Infinity)
1964 } else {
1965 m = m + Math.pow(2, mLen)
1966 e = e - eBias
1967 }
1968 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
1969}
1970
1971exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
1972 var e, m, c
1973 var eLen = (nBytes * 8) - mLen - 1
1974 var eMax = (1 << eLen) - 1
1975 var eBias = eMax >> 1
1976 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
1977 var i = isLE ? 0 : (nBytes - 1)
1978 var d = isLE ? 1 : -1
1979 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
1980
1981 value = Math.abs(value)
1982
1983 if (isNaN(value) || value === Infinity) {
1984 m = isNaN(value) ? 1 : 0
1985 e = eMax
1986 } else {
1987 e = Math.floor(Math.log(value) / Math.LN2)
1988 if (value * (c = Math.pow(2, -e)) < 1) {
1989 e--
1990 c *= 2
1991 }
1992 if (e + eBias >= 1) {
1993 value += rt / c
1994 } else {
1995 value += rt * Math.pow(2, 1 - eBias)
1996 }
1997 if (value * c >= 2) {
1998 e++
1999 c /= 2
2000 }
2001
2002 if (e + eBias >= eMax) {
2003 m = 0
2004 e = eMax
2005 } else if (e + eBias >= 1) {
2006 m = ((value * c) - 1) * Math.pow(2, mLen)
2007 e = e + eBias
2008 } else {
2009 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
2010 e = 0
2011 }
2012 }
2013
2014 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
2015
2016 e = (e << mLen) | m
2017 eLen += mLen
2018 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
2019
2020 buffer[offset + i - d] |= s * 128
2021}
2022
2023},{}]},{},[1])(1)
2024});