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
.groestlcoinjs
= 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
){
3 // base-x encoding / decoding
4 // Copyright (c) 2018 base-x contributors
5 // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
6 // Distributed under the MIT software license, see the accompanying
7 // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9 var _Buffer
= require('safe-buffer').Buffer
10 function base (ALPHABET
) {
11 if (ALPHABET
.length
>= 255) { throw new TypeError('Alphabet too long') }
12 var BASE_MAP
= new Uint8Array(256)
14 for (var i
= 0; i
< ALPHABET
.length
; i
++) {
15 var x
= ALPHABET
.charAt(i
)
16 var xc
= x
.charCodeAt(0)
17 if (BASE_MAP
[xc
] !== 255) { throw new TypeError(x
+ ' is ambiguous') }
20 var BASE
= ALPHABET
.length
21 var LEADER
= ALPHABET
.charAt(0)
22 var FACTOR
= Math
.log(BASE
) / Math
.log(256) // log(BASE) / log(256), rounded up
23 var iFACTOR
= Math
.log(256) / Math
.log(BASE
) // log(256) / log(BASE), rounded up
24 function encode (source
) {
25 if (!_Buffer
.isBuffer(source
)) { throw new TypeError('Expected Buffer') }
26 if (source
.length
=== 0) { return '' }
27 // Skip & count leading zeroes.
31 var pend
= source
.length
32 while (pbegin
!== pend
&& source
[pbegin
] === 0) {
36 // Allocate enough space in big-endian base58 representation.
37 var size
= ((pend
- pbegin
) * iFACTOR
+ 1) >>> 0
38 var b58
= new Uint8Array(size
)
40 while (pbegin
!== pend
) {
41 var carry
= source
[pbegin
]
42 // Apply "b58 = b58 * 256 + ch".
44 for (var it1
= size
- 1; (carry
!== 0 || i
< length
) && (it1
!== -1); it1
--, i
++) {
45 carry
+= (256 * b58
[it1
]) >>> 0
46 b58
[it1
] = (carry
% BASE
) >>> 0
47 carry
= (carry
/ BASE
) >>> 0
49 if (carry
!== 0) { throw new Error('Non-zero carry') }
53 // Skip leading zeroes in base58 result.
54 var it2
= size
- length
55 while (it2
!== size
&& b58
[it2
] === 0) {
58 // Translate the result into a string.
59 var str
= LEADER
.repeat(zeroes
)
60 for (; it2
< size
; ++it2
) { str
+= ALPHABET
.charAt(b58
[it2
]) }
63 function decodeUnsafe (source
) {
64 if (typeof source
!== 'string') { throw new TypeError('Expected String') }
65 if (source
.length
=== 0) { return _Buffer
.alloc(0) }
67 // Skip leading spaces.
68 if (source
[psz
] === ' ') { return }
69 // Skip and count leading '1's.
72 while (source
[psz
] === LEADER
) {
76 // Allocate enough space in big-endian base256 representation.
77 var size
= (((source
.length
- psz
) * FACTOR
) + 1) >>> 0 // log(58) / log(256), rounded up.
78 var b256
= new Uint8Array(size
)
79 // Process the characters.
82 var carry
= BASE_MAP
[source
.charCodeAt(psz
)]
84 if (carry
=== 255) { return }
86 for (var it3
= size
- 1; (carry
!== 0 || i
< length
) && (it3
!== -1); it3
--, i
++) {
87 carry
+= (BASE
* b256
[it3
]) >>> 0
88 b256
[it3
] = (carry
% 256) >>> 0
89 carry
= (carry
/ 256) >>> 0
91 if (carry
!== 0) { throw new Error('Non-zero carry') }
95 // Skip trailing spaces.
96 if (source
[psz
] === ' ') { return }
97 // Skip leading zeroes in b256.
98 var it4
= size
- length
99 while (it4
!== size
&& b256
[it4
] === 0) {
102 var vch
= _Buffer
.allocUnsafe(zeroes
+ (size
- it4
))
103 vch
.fill(0x00, 0, zeroes
)
105 while (it4
!== size
) {
106 vch
[j
++] = b256
[it4
++]
110 function decode (string
) {
111 var buffer
= decodeUnsafe(string
)
112 if (buffer
) { return buffer
}
113 throw new Error('Non-base' + BASE
+ ' character')
117 decodeUnsafe: decodeUnsafe
,
121 module
.exports
= base
123 },{"safe-buffer":38}],2:[function(require
,module
,exports
){
125 var ALPHABET
= 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'
127 // pre-compute lookup table
128 var ALPHABET_MAP
= {}
129 for (var z
= 0; z
< ALPHABET
.length
; z
++) {
130 var x
= ALPHABET
.charAt(z
)
132 if (ALPHABET_MAP
[x
] !== undefined) throw new TypeError(x
+ ' is ambiguous')
136 function polymodStep (pre
) {
138 return ((pre
& 0x1FFFFFF) << 5) ^
139 (-((b
>> 0) & 1) & 0x3b6a57b2) ^
140 (-((b
>> 1) & 1) & 0x26508e6d) ^
141 (-((b
>> 2) & 1) & 0x1ea119fa) ^
142 (-((b
>> 3) & 1) & 0x3d4233dd) ^
143 (-((b
>> 4) & 1) & 0x2a1462b3)
146 function prefixChk (prefix
) {
148 for (var i
= 0; i
< prefix
.length
; ++i
) {
149 var c
= prefix
.charCodeAt(i
)
150 if (c
< 33 || c
> 126) throw new Error('Invalid prefix (' + prefix
+ ')')
152 chk
= polymodStep(chk
) ^ (c
>> 5)
154 chk
= polymodStep(chk
)
156 for (i
= 0; i
< prefix
.length
; ++i
) {
157 var v
= prefix
.charCodeAt(i
)
158 chk
= polymodStep(chk
) ^ (v
& 0x1f)
163 function encode (prefix
, words
, LIMIT
) {
165 if ((prefix
.length
+ 7 + words
.length
) > LIMIT
) throw new TypeError('Exceeds length limit')
167 prefix
= prefix
.toLowerCase()
170 var chk
= prefixChk(prefix
)
171 var result
= prefix
+ '1'
172 for (var i
= 0; i
< words
.length
; ++i
) {
174 if ((x
>> 5) !== 0) throw new Error('Non 5-bit word')
176 chk
= polymodStep(chk
) ^ x
177 result
+= ALPHABET
.charAt(x
)
180 for (i
= 0; i
< 6; ++i
) {
181 chk
= polymodStep(chk
)
185 for (i
= 0; i
< 6; ++i
) {
186 var v
= (chk
>> ((5 - i
) * 5)) & 0x1f
187 result
+= ALPHABET
.charAt(v
)
193 function decode (str
, LIMIT
) {
195 if (str
.length
< 8) throw new TypeError(str
+ ' too short')
196 if (str
.length
> LIMIT
) throw new TypeError('Exceeds length limit')
198 // don't allow mixed case
199 var lowered
= str
.toLowerCase()
200 var uppered
= str
.toUpperCase()
201 if (str
!== lowered
&& str
!== uppered
) throw new Error('Mixed-case string ' + str
)
204 var split
= str
.lastIndexOf('1')
205 if (split
=== -1) throw new Error('No separator character for ' + str
)
206 if (split
=== 0) throw new Error('Missing prefix for ' + str
)
208 var prefix
= str
.slice(0, split
)
209 var wordChars
= str
.slice(split
+ 1)
210 if (wordChars
.length
< 6) throw new Error('Data too short')
212 var chk
= prefixChk(prefix
)
214 for (var i
= 0; i
< wordChars
.length
; ++i
) {
215 var c
= wordChars
.charAt(i
)
216 var v
= ALPHABET_MAP
[c
]
217 if (v
=== undefined) throw new Error('Unknown character ' + c
)
218 chk
= polymodStep(chk
) ^ v
220 // not in the checksum?
221 if (i
+ 6 >= wordChars
.length
) continue
225 if (chk
!== 1) throw new Error('Invalid checksum for ' + str
)
226 return { prefix: prefix
, words: words
}
229 function convert (data
, inBits
, outBits
, pad
) {
232 var maxV
= (1 << outBits
) - 1
235 for (var i
= 0; i
< data
.length
; ++i
) {
236 value
= (value
<< inBits
) | data
[i
]
239 while (bits
>= outBits
) {
241 result
.push((value
>> bits
) & maxV
)
247 result
.push((value
<< (outBits
- bits
)) & maxV
)
250 if (bits
>= inBits
) throw new Error('Excess padding')
251 if ((value
<< (outBits
- bits
)) & maxV
) throw new Error('Non-zero padding')
257 function toWords (bytes
) {
258 return convert(bytes
, 8, 5, true)
261 function fromWords (words
) {
262 return convert(words
, 5, 8, false)
272 },{}],3:[function(require
,module
,exports
){
273 // (public) Constructor
274 function BigInteger(a
, b
, c
) {
275 if (!(this instanceof BigInteger
))
276 return new BigInteger(a
, b
, c
)
279 if ("number" == typeof a
) this.fromNumber(a
, b
, c
)
280 else if (b
== null && "string" != typeof a
) this.fromString(a
, 256)
281 else this.fromString(a
, b
)
285 var proto
= BigInteger
.prototype
287 // duck-typed isBigInteger
288 proto
.__bigi
= require('../package.json').version
289 BigInteger
.isBigInteger = function (obj
, check_ver
) {
290 return obj
&& obj
.__bigi
&& (!check_ver
|| obj
.__bigi
=== proto
.__bigi
)
296 // am: Compute w_j += (x*this_i), propagate carries,
297 // c is initial carry, returns final carry.
298 // c < 3*dvalue, x < 2*dvalue, this_i < dvalue
299 // We need to select the fastest one that works in this environment.
301 // am1: use a single mult and divide to get the high bits,
302 // max digit bits should be 26 because
303 // max internal value = 2*dvalue^2-2*dvalue (< 2^53)
304 function am1(i
, x
, w
, j
, c
, n
) {
306 var v
= x
* this[i
++] + w
[j
] + c
307 c
= Math
.floor(v
/ 0x4000000)
308 w
[j
++] = v
& 0x3ffffff
312 // am2 avoids a big mult-and-extract completely.
313 // Max digit bits should be <= 30 because we do bitwise ops
314 // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
315 function am2(i
, x
, w
, j
, c
, n
) {
319 var l
= this[i
] & 0x7fff
320 var h
= this[i
++] >> 15
321 var m
= xh
* l
+ h
* xl
322 l
= xl
* l
+ ((m
& 0x7fff) << 15) + w
[j
] + (c
& 0x3fffffff)
323 c
= (l
>>> 30) + (m
>>> 15) + xh
* h
+ (c
>>> 30)
324 w
[j
++] = l
& 0x3fffffff
328 // Alternately, set max digit bits to 28 since some
329 // browsers slow down when dealing with 32-bit numbers.
330 function am3(i
, x
, w
, j
, c
, n
) {
334 var l
= this[i
] & 0x3fff
335 var h
= this[i
++] >> 14
336 var m
= xh
* l
+ h
* xl
337 l
= xl
* l
+ ((m
& 0x3fff) << 14) + w
[j
] + c
338 c
= (l
>> 28) + (m
>> 14) + xh
* h
339 w
[j
++] = l
& 0xfffffff
345 BigInteger
.prototype.am
= am1
348 BigInteger
.prototype.DB
= dbits
349 BigInteger
.prototype.DM
= ((1 << dbits
) - 1)
350 var DV
= BigInteger
.prototype.DV
= (1 << dbits
)
353 BigInteger
.prototype.FV
= Math
.pow(2, BI_FP
)
354 BigInteger
.prototype.F1
= BI_FP
- dbits
355 BigInteger
.prototype.F2
= 2 * dbits
- BI_FP
358 var BI_RM
= "0123456789abcdefghijklmnopqrstuvwxyz"
359 var BI_RC
= new Array()
361 rr
= "0".charCodeAt(0)
362 for (vv
= 0; vv
<= 9; ++vv
) BI_RC
[rr
++] = vv
363 rr
= "a".charCodeAt(0)
364 for (vv
= 10; vv
< 36; ++vv
) BI_RC
[rr
++] = vv
365 rr
= "A".charCodeAt(0)
366 for (vv
= 10; vv
< 36; ++vv
) BI_RC
[rr
++] = vv
368 function int2char(n
) {
369 return BI_RM
.charAt(n
)
372 function intAt(s
, i
) {
373 var c
= BI_RC
[s
.charCodeAt(i
)]
374 return (c
== null) ? -1 : c
377 // (protected) copy this to r
378 function bnpCopyTo(r
) {
379 for (var i
= this.t
- 1; i
>= 0; --i
) r
[i
] = this[i
]
384 // (protected) set from integer value x, -DV <= x < DV
385 function bnpFromInt(x
) {
387 this.s
= (x
< 0) ? -1 : 0
388 if (x
> 0) this[0] = x
389 else if (x
< -1) this[0] = x
+ DV
393 // return bigint initialized to value
395 var r
= new BigInteger()
400 // (protected) set from string and radix
401 function bnpFromString(s
, b
) {
406 else if (b
== 8) k
= 3
407 else if (b
== 256) k
= 8; // byte array
408 else if (b
== 2) k
= 1
409 else if (b
== 32) k
= 5
410 else if (b
== 4) k
= 2
421 var x
= (k
== 8) ? s
[i
] & 0xff : intAt(s
, i
)
423 if (s
.charAt(i
) == "-") mi
= true
429 else if (sh
+ k
> self
.DB
) {
430 self
[self
.t
- 1] |= (x
& ((1 << (self
.DB
- sh
)) - 1)) << sh
431 self
[self
.t
++] = (x
>> (self
.DB
- sh
))
433 self
[self
.t
- 1] |= x
<< sh
435 if (sh
>= self
.DB
) sh
-= self
.DB
437 if (k
== 8 && (s
[0] & 0x80) != 0) {
439 if (sh
> 0) self
[self
.t
- 1] |= ((1 << (self
.DB
- sh
)) - 1) << sh
442 if (mi
) BigInteger
.ZERO
.subTo(self
, self
)
445 // (protected) clamp off excess high words
446 function bnpClamp() {
447 var c
= this.s
& this.DM
448 while (this.t
> 0 && this[this.t
- 1] == c
)--this.t
451 // (public) return string representation in given radix
452 function bnToString(b
) {
454 if (self
.s
< 0) return "-" + self
.negate()
458 else if (b
== 8) k
= 3
459 else if (b
== 2) k
= 1
460 else if (b
== 32) k
= 5
461 else if (b
== 4) k
= 2
462 else return self
.toRadix(b
)
463 var km
= (1 << k
) - 1,
467 var p
= self
.DB
- (i
* self
.DB
) % k
469 if (p
< self
.DB
&& (d
= self
[i
] >> p
) > 0) {
475 d
= (self
[i
] & ((1 << p
) - 1)) << (k
- p
)
476 d
|= self
[--i
] >> (p
+= self
.DB
- k
)
478 d
= (self
[i
] >> (p
-= k
)) & km
485 if (m
) r
+= int2char(d
)
492 function bnNegate() {
493 var r
= new BigInteger()
494 BigInteger
.ZERO
.subTo(this, r
)
500 return (this.s
< 0) ? this.negate() : this
503 // (public) return + if this > a, - if this < a, 0 if equal
504 function bnCompareTo(a
) {
509 if (r
!= 0) return (this.s
< 0) ? -r : r
511 if ((r
= this[i
] - a
[i
]) != 0) return r
515 // returns bit length of the integer x
519 if ((t
= x
>>> 16) != 0) {
523 if ((t
= x
>> 8) != 0) {
527 if ((t
= x
>> 4) != 0) {
531 if ((t
= x
>> 2) != 0) {
535 if ((t
= x
>> 1) != 0) {
542 // (public) return the number of bits in "this"
543 function bnBitLength() {
544 if (this.t
<= 0) return 0
545 return this.DB
* (this.t
- 1) + nbits(this[this.t
- 1] ^ (this.s
& this.DM
))
548 // (public) return the number of bytes in "this"
549 function bnByteLength() {
550 return this.bitLength() >> 3
553 // (protected) r = this << n*DB
554 function bnpDLShiftTo(n
, r
) {
556 for (i
= this.t
- 1; i
>= 0; --i
) r
[i
+ n
] = this[i
]
557 for (i
= n
- 1; i
>= 0; --i
) r
[i
] = 0
562 // (protected) r = this >> n*DB
563 function bnpDRShiftTo(n
, r
) {
564 for (var i
= n
; i
< this.t
; ++i
) r
[i
- n
] = this[i
]
565 r
.t
= Math
.max(this.t
- n
, 0)
569 // (protected) r = this << n
570 function bnpLShiftTo(n
, r
) {
573 var cbs
= self
.DB
- bs
574 var bm
= (1 << cbs
) - 1
575 var ds
= Math
.floor(n
/ self
.DB
),
576 c
= (self
.s
<< bs
) & self
.DM
,
578 for (i
= self
.t
- 1; i
>= 0; --i
) {
579 r
[i
+ ds
+ 1] = (self
[i
] >> cbs
) | c
580 c
= (self
[i
] & bm
) << bs
582 for (i
= ds
- 1; i
>= 0; --i
) r
[i
] = 0
584 r
.t
= self
.t
+ ds
+ 1
589 // (protected) r = this >> n
590 function bnpRShiftTo(n
, r
) {
593 var ds
= Math
.floor(n
/ self
.DB
)
599 var cbs
= self
.DB
- bs
600 var bm
= (1 << bs
) - 1
601 r
[0] = self
[ds
] >> bs
602 for (var i
= ds
+ 1; i
< self
.t
; ++i
) {
603 r
[i
- ds
- 1] |= (self
[i
] & bm
) << cbs
604 r
[i
- ds
] = self
[i
] >> bs
606 if (bs
> 0) r
[self
.t
- ds
- 1] |= (self
.s
& bm
) << cbs
611 // (protected) r = this - a
612 function bnpSubTo(a
, r
) {
616 m
= Math
.min(a
.t
, self
.t
)
639 r
.s
= (c
< 0) ? -1 : 0
640 if (c
< -1) r
[i
++] = self
.DV
+ c
641 else if (c
> 0) r
[i
++] = c
646 // (protected) r = this * a, r != this,a (HAC 14.12)
647 // "this" should be the larger one if appropriate.
648 function bnpMultiplyTo(a
, r
) {
653 while (--i
>= 0) r
[i
] = 0
654 for (i
= 0; i
< y
.t
; ++i
) r
[i
+ x
.t
] = x
.am(0, y
[i
], r
, i
, 0, x
.t
)
657 if (this.s
!= a
.s
) BigInteger
.ZERO
.subTo(r
, r
)
660 // (protected) r = this^2, r != this (HAC 14.16)
661 function bnpSquareTo(r
) {
663 var i
= r
.t
= 2 * x
.t
664 while (--i
>= 0) r
[i
] = 0
665 for (i
= 0; i
< x
.t
- 1; ++i
) {
666 var c
= x
.am(i
, x
[i
], r
, 2 * i
, 0, 1)
667 if ((r
[i
+ x
.t
] += x
.am(i
+ 1, 2 * x
[i
], r
, 2 * i
+ 1, c
, x
.t
- i
- 1)) >= x
.DV
) {
672 if (r
.t
> 0) r
[r
.t
- 1] += x
.am(i
, x
[i
], r
, 2 * i
, 0, 1)
677 // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
678 // r != q, this != m. q or r may be null.
679 function bnpDivRemTo(m
, q
, r
) {
682 if (pm
.t
<= 0) return
685 if (q
!= null) q
.fromInt(0)
686 if (r
!= null) self
.copyTo(r
)
689 if (r
== null) r
= new BigInteger()
690 var y
= new BigInteger(),
693 var nsh
= self
.DB
- nbits(pm
[pm
.t
- 1]); // normalize modulus
704 var yt
= y0
* (1 << self
.F1
) + ((ys
> 1) ? y
[ys
- 2] >> self
.F2 : 0)
705 var d1
= self
.FV
/ yt
,
706 d2
= (1 << self
.F1
) / yt
,
710 t
= (q
== null) ? new BigInteger() : q
712 if (r
.compareTo(t
) >= 0) {
716 BigInteger
.ONE
.dlShiftTo(ys
, t
)
717 t
.subTo(y
, y
); // "negative" y so we can replace sub with am later
718 while (y
.t
< ys
) y
[y
.t
++] = 0
720 // Estimate quotient digit
721 var qd
= (r
[--i
] == y0
) ? self
.DM : Math
.floor(r
[i
] * d1
+ (r
[i
- 1] + e
) * d2
)
722 if ((r
[i
] += y
.am(0, qd
, r
, j
, 0, ys
)) < qd
) { // Try it out
725 while (r
[i
] < --qd
) r
.subTo(t
, r
)
730 if (ts
!= ms
) BigInteger
.ZERO
.subTo(q
, q
)
734 if (nsh
> 0) r
.rShiftTo(nsh
, r
); // Denormalize remainder
735 if (ts
< 0) BigInteger
.ZERO
.subTo(r
, r
)
738 // (public) this mod a
740 var r
= new BigInteger()
742 .divRemTo(a
, null, r
)
743 if (this.s
< 0 && r
.compareTo(BigInteger
.ZERO
) > 0) a
.subTo(r
, r
)
747 // Modular reduction using "classic" algorithm
748 function Classic(m
) {
752 function cConvert(x
) {
753 if (x
.s
< 0 || x
.compareTo(this.m
) >= 0) return x
.mod(this.m
)
757 function cRevert(x
) {
761 function cReduce(x
) {
762 x
.divRemTo(this.m
, null, x
)
765 function cMulTo(x
, y
, r
) {
770 function cSqrTo(x
, r
) {
775 Classic
.prototype.convert
= cConvert
776 Classic
.prototype.revert
= cRevert
777 Classic
.prototype.reduce
= cReduce
778 Classic
.prototype.mulTo
= cMulTo
779 Classic
.prototype.sqrTo
= cSqrTo
781 // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
785 // xy(2-xy) = (1+km)(1-km)
786 // x[y(2-xy)] = 1-k^2m^2
787 // x[y(2-xy)] == 1 (mod m^2)
788 // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
789 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
790 // JS multiply "overflows" differently from C/C++, so care is needed here.
791 function bnpInvDigit() {
792 if (this.t
< 1) return 0
794 if ((x
& 1) == 0) return 0
795 var y
= x
& 3; // y == 1/x mod 2^2
796 y
= (y
* (2 - (x
& 0xf) * y
)) & 0xf; // y == 1/x mod 2^4
797 y
= (y
* (2 - (x
& 0xff) * y
)) & 0xff; // y == 1/x mod 2^8
798 y
= (y
* (2 - (((x
& 0xffff) * y
) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
799 // last step - calculate inverse mod DV directly
800 // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
801 y
= (y
* (2 - x
* y
% this.DV
)) % this.DV
; // y == 1/x mod 2^dbits
802 // we really want the negative inverse, and -DV < y < DV
803 return (y
> 0) ? this.DV
- y : -y
806 // Montgomery reduction
807 function Montgomery(m
) {
809 this.mp
= m
.invDigit()
810 this.mpl
= this.mp
& 0x7fff
811 this.mph
= this.mp
>> 15
812 this.um
= (1 << (m
.DB
- 15)) - 1
817 function montConvert(x
) {
818 var r
= new BigInteger()
820 .dlShiftTo(this.m
.t
, r
)
821 r
.divRemTo(this.m
, null, r
)
822 if (x
.s
< 0 && r
.compareTo(BigInteger
.ZERO
) > 0) this.m
.subTo(r
, r
)
827 function montRevert(x
) {
828 var r
= new BigInteger()
834 // x = x/R mod m (HAC 14.32)
835 function montReduce(x
) {
836 while (x
.t
<= this.mt2
) // pad x so am has enough room later
838 for (var i
= 0; i
< this.m
.t
; ++i
) {
839 // faster way of calculating u0 = x[i]*mp mod DV
840 var j
= x
[i
] & 0x7fff
841 var u0
= (j
* this.mpl
+ (((j
* this.mph
+ (x
[i
] >> 15) * this.mpl
) & this.um
) << 15)) & x
.DM
842 // use am to combine the multiply-shift-add into one call
844 x
[j
] += this.m
.am(0, u0
, x
, i
, 0, this.m
.t
)
846 while (x
[j
] >= x
.DV
) {
852 x
.drShiftTo(this.m
.t
, x
)
853 if (x
.compareTo(this.m
) >= 0) x
.subTo(this.m
, x
)
856 // r = "x^2/R mod m"; x != r
857 function montSqrTo(x
, r
) {
862 // r = "xy/R mod m"; x,y != r
863 function montMulTo(x
, y
, r
) {
868 Montgomery
.prototype.convert
= montConvert
869 Montgomery
.prototype.revert
= montRevert
870 Montgomery
.prototype.reduce
= montReduce
871 Montgomery
.prototype.mulTo
= montMulTo
872 Montgomery
.prototype.sqrTo
= montSqrTo
874 // (protected) true iff this is even
875 function bnpIsEven() {
876 return ((this.t
> 0) ? (this[0] & 1) : this.s
) == 0
879 // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
880 function bnpExp(e
, z
) {
881 if (e
> 0xffffffff || e
< 1) return BigInteger
.ONE
882 var r
= new BigInteger(),
883 r2
= new BigInteger(),
889 if ((e
& (1 << i
)) > 0) z
.mulTo(r2
, g
, r
)
899 // (public) this^e % m, 0 <= e < 2^32
900 function bnModPowInt(e
, m
) {
902 if (e
< 256 || m
.isEven()) z
= new Classic(m
)
903 else z
= new Montgomery(m
)
904 return this.exp(e
, z
)
908 proto
.copyTo
= bnpCopyTo
909 proto
.fromInt
= bnpFromInt
910 proto
.fromString
= bnpFromString
911 proto
.clamp
= bnpClamp
912 proto
.dlShiftTo
= bnpDLShiftTo
913 proto
.drShiftTo
= bnpDRShiftTo
914 proto
.lShiftTo
= bnpLShiftTo
915 proto
.rShiftTo
= bnpRShiftTo
916 proto
.subTo
= bnpSubTo
917 proto
.multiplyTo
= bnpMultiplyTo
918 proto
.squareTo
= bnpSquareTo
919 proto
.divRemTo
= bnpDivRemTo
920 proto
.invDigit
= bnpInvDigit
921 proto
.isEven
= bnpIsEven
925 proto
.toString
= bnToString
926 proto
.negate
= bnNegate
928 proto
.compareTo
= bnCompareTo
929 proto
.bitLength
= bnBitLength
930 proto
.byteLength
= bnByteLength
932 proto
.modPowInt
= bnModPowInt
936 var r
= new BigInteger()
941 // (public) return value as integer
942 function bnIntValue() {
944 if (this.t
== 1) return this[0] - this.DV
945 else if (this.t
== 0) return -1
946 } else if (this.t
== 1) return this[0]
947 else if (this.t
== 0) return 0
948 // assumes 16 < DB < 32
949 return ((this[1] & ((1 << (32 - this.DB
)) - 1)) << this.DB
) | this[0]
952 // (public) return value as byte
953 function bnByteValue() {
954 return (this.t
== 0) ? this.s : (this[0] << 24) >> 24
957 // (public) return value as short (assumes DB>=16)
958 function bnShortValue() {
959 return (this.t
== 0) ? this.s : (this[0] << 16) >> 16
962 // (protected) return x s.t. r^x < DV
963 function bnpChunkSize(r
) {
964 return Math
.floor(Math
.LN2
* this.DB
/ Math
.log(r
))
967 // (public) 0 if this == 0, 1 if this > 0
968 function bnSigNum() {
969 if (this.s
< 0) return -1
970 else if (this.t
<= 0 || (this.t
== 1 && this[0] <= 0)) return 0
974 // (protected) convert to radix string
975 function bnpToRadix(b
) {
976 if (b
== null) b
= 10
977 if (this.signum() == 0 || b
< 2 || b
> 36) return "0"
978 var cs
= this.chunkSize(b
)
979 var a
= Math
.pow(b
, cs
)
981 y
= new BigInteger(),
982 z
= new BigInteger(),
984 this.divRemTo(d
, y
, z
)
985 while (y
.signum() > 0) {
986 r
= (a
+ z
.intValue())
995 // (protected) convert from radix string
996 function bnpFromRadix(s
, b
) {
999 if (b
== null) b
= 10
1000 var cs
= self
.chunkSize(b
)
1001 var d
= Math
.pow(b
, cs
),
1005 for (var i
= 0; i
< s
.length
; ++i
) {
1008 if (s
.charAt(i
) == "-" && self
.signum() == 0) mi
= true
1014 self
.dAddOffset(w
, 0)
1020 self
.dMultiply(Math
.pow(b
, j
))
1021 self
.dAddOffset(w
, 0)
1023 if (mi
) BigInteger
.ZERO
.subTo(self
, self
)
1026 // (protected) alternate constructor
1027 function bnpFromNumber(a
, b
, c
) {
1029 if ("number" == typeof b
) {
1030 // new BigInteger(int,int,RNG)
1031 if (a
< 2) self
.fromInt(1)
1033 self
.fromNumber(a
, c
)
1034 if (!self
.testBit(a
- 1)) // force MSB set
1035 self
.bitwiseTo(BigInteger
.ONE
.shiftLeft(a
- 1), op_or
, self
)
1036 if (self
.isEven()) self
.dAddOffset(1, 0); // force odd
1037 while (!self
.isProbablePrime(b
)) {
1038 self
.dAddOffset(2, 0)
1039 if (self
.bitLength() > a
) self
.subTo(BigInteger
.ONE
.shiftLeft(a
- 1), self
)
1043 // new BigInteger(int,RNG)
1044 var x
= new Array(),
1046 x
.length
= (a
>> 3) + 1
1048 if (t
> 0) x
[0] &= ((1 << t
) - 1)
1050 self
.fromString(x
, 256)
1054 // (public) convert to bigendian byte array
1055 function bnToByteArray() {
1060 var p
= self
.DB
- (i
* self
.DB
) % 8,
1063 if (p
< self
.DB
&& (d
= self
[i
] >> p
) != (self
.s
& self
.DM
) >> p
)
1064 r
[k
++] = d
| (self
.s
<< (self
.DB
- p
))
1067 d
= (self
[i
] & ((1 << p
) - 1)) << (8 - p
)
1068 d
|= self
[--i
] >> (p
+= self
.DB
- 8)
1070 d
= (self
[i
] >> (p
-= 8)) & 0xff
1076 if ((d
& 0x80) != 0) d
|= -256
1077 if (k
=== 0 && (self
.s
& 0x80) != (d
& 0x80))++k
1078 if (k
> 0 || d
!= self
.s
) r
[k
++] = d
1084 function bnEquals(a
) {
1085 return (this.compareTo(a
) == 0)
1089 return (this.compareTo(a
) < 0) ? this : a
1093 return (this.compareTo(a
) > 0) ? this : a
1096 // (protected) r = this op a (bitwise)
1097 function bnpBitwiseTo(a
, op
, r
) {
1099 var i
, f
, m
= Math
.min(a
.t
, self
.t
)
1100 for (i
= 0; i
< m
; ++i
) r
[i
] = op(self
[i
], a
[i
])
1103 for (i
= m
; i
< self
.t
; ++i
) r
[i
] = op(self
[i
], f
)
1106 f
= self
.s
& self
.DM
1107 for (i
= m
; i
< a
.t
; ++i
) r
[i
] = op(f
, a
[i
])
1110 r
.s
= op(self
.s
, a
.s
)
1114 // (public) this & a
1115 function op_and(x
, y
) {
1120 var r
= new BigInteger()
1121 this.bitwiseTo(a
, op_and
, r
)
1125 // (public) this | a
1126 function op_or(x
, y
) {
1131 var r
= new BigInteger()
1132 this.bitwiseTo(a
, op_or
, r
)
1136 // (public) this ^ a
1137 function op_xor(x
, y
) {
1142 var r
= new BigInteger()
1143 this.bitwiseTo(a
, op_xor
, r
)
1147 // (public) this & ~a
1148 function op_andnot(x
, y
) {
1152 function bnAndNot(a
) {
1153 var r
= new BigInteger()
1154 this.bitwiseTo(a
, op_andnot
, r
)
1160 var r
= new BigInteger()
1161 for (var i
= 0; i
< this.t
; ++i
) r
[i
] = this.DM
& ~this[i
]
1167 // (public) this << n
1168 function bnShiftLeft(n
) {
1169 var r
= new BigInteger()
1170 if (n
< 0) this.rShiftTo(-n
, r
)
1171 else this.lShiftTo(n
, r
)
1175 // (public) this >> n
1176 function bnShiftRight(n
) {
1177 var r
= new BigInteger()
1178 if (n
< 0) this.lShiftTo(-n
, r
)
1179 else this.rShiftTo(n
, r
)
1183 // return index of lowest 1-bit in x, x < 2^31
1185 if (x
== 0) return -1
1187 if ((x
& 0xffff) == 0) {
1191 if ((x
& 0xff) == 0) {
1195 if ((x
& 0xf) == 0) {
1203 if ((x
& 1) == 0)++r
1207 // (public) returns index of lowest 1-bit (or -1 if none)
1208 function bnGetLowestSetBit() {
1209 for (var i
= 0; i
< this.t
; ++i
)
1210 if (this[i
] != 0) return i
* this.DB
+ lbit(this[i
])
1211 if (this.s
< 0) return this.t
* this.DB
1215 // return number of 1 bits in x
1225 // (public) return number of set bits
1226 function bnBitCount() {
1228 x
= this.s
& this.DM
1229 for (var i
= 0; i
< this.t
; ++i
) r
+= cbit(this[i
] ^ x
)
1233 // (public) true iff nth bit is set
1234 function bnTestBit(n
) {
1235 var j
= Math
.floor(n
/ this.DB
)
1236 if (j
>= this.t
) return (this.s
!= 0)
1237 return ((this[j
] & (1 << (n
% this.DB
))) != 0)
1240 // (protected) this op (1<<n)
1241 function bnpChangeBit(n
, op
) {
1242 var r
= BigInteger
.ONE
.shiftLeft(n
)
1243 this.bitwiseTo(r
, op
, r
)
1247 // (public) this | (1<<n)
1248 function bnSetBit(n
) {
1249 return this.changeBit(n
, op_or
)
1252 // (public) this & ~(1<<n)
1253 function bnClearBit(n
) {
1254 return this.changeBit(n
, op_andnot
)
1257 // (public) this ^ (1<<n)
1258 function bnFlipBit(n
) {
1259 return this.changeBit(n
, op_xor
)
1262 // (protected) r = this + a
1263 function bnpAddTo(a
, r
) {
1268 m
= Math
.min(a
.t
, self
.t
)
1271 r
[i
++] = c
& self
.DM
1276 while (i
< self
.t
) {
1278 r
[i
++] = c
& self
.DM
1286 r
[i
++] = c
& self
.DM
1291 r
.s
= (c
< 0) ? -1 : 0
1292 if (c
> 0) r
[i
++] = c
1293 else if (c
< -1) r
[i
++] = self
.DV
+ c
1298 // (public) this + a
1300 var r
= new BigInteger()
1305 // (public) this - a
1306 function bnSubtract(a
) {
1307 var r
= new BigInteger()
1312 // (public) this * a
1313 function bnMultiply(a
) {
1314 var r
= new BigInteger()
1315 this.multiplyTo(a
, r
)
1320 function bnSquare() {
1321 var r
= new BigInteger()
1326 // (public) this / a
1327 function bnDivide(a
) {
1328 var r
= new BigInteger()
1329 this.divRemTo(a
, r
, null)
1333 // (public) this % a
1334 function bnRemainder(a
) {
1335 var r
= new BigInteger()
1336 this.divRemTo(a
, null, r
)
1340 // (public) [this/a,this%a]
1341 function bnDivideAndRemainder(a
) {
1342 var q
= new BigInteger(),
1343 r
= new BigInteger()
1344 this.divRemTo(a
, q
, r
)
1345 return new Array(q
, r
)
1348 // (protected) this *= n, this >= 0, 1 < n < DV
1349 function bnpDMultiply(n
) {
1350 this[this.t
] = this.am(0, n
- 1, this, 0, 0, this.t
)
1355 // (protected) this += n << w words, this >= 0
1356 function bnpDAddOffset(n
, w
) {
1358 while (this.t
<= w
) this[this.t
++] = 0
1360 while (this[w
] >= this.DV
) {
1362 if (++w
>= this.t
) this[this.t
++] = 0
1368 function NullExp() {}
1374 function nMulTo(x
, y
, r
) {
1378 function nSqrTo(x
, r
) {
1382 NullExp
.prototype.convert
= nNop
1383 NullExp
.prototype.revert
= nNop
1384 NullExp
.prototype.mulTo
= nMulTo
1385 NullExp
.prototype.sqrTo
= nSqrTo
1389 return this.exp(e
, new NullExp())
1392 // (protected) r = lower n words of "this * a", a.t <= n
1393 // "this" should be the larger one if appropriate.
1394 function bnpMultiplyLowerTo(a
, n
, r
) {
1395 var i
= Math
.min(this.t
+ a
.t
, n
)
1396 r
.s
= 0; // assumes a,this >= 0
1398 while (i
> 0) r
[--i
] = 0
1400 for (j
= r
.t
- this.t
; i
< j
; ++i
) r
[i
+ this.t
] = this.am(0, a
[i
], r
, i
, 0, this.t
)
1401 for (j
= Math
.min(a
.t
, n
); i
< j
; ++i
) this.am(0, a
[i
], r
, i
, 0, n
- i
)
1405 // (protected) r = "this * a" without lower n words, n > 0
1406 // "this" should be the larger one if appropriate.
1407 function bnpMultiplyUpperTo(a
, n
, r
) {
1409 var i
= r
.t
= this.t
+ a
.t
- n
1410 r
.s
= 0; // assumes a,this >= 0
1411 while (--i
>= 0) r
[i
] = 0
1412 for (i
= Math
.max(n
- this.t
, 0); i
< a
.t
; ++i
)
1413 r
[this.t
+ i
- n
] = this.am(n
- i
, a
[i
], r
, 0, 0, this.t
+ i
- n
)
1418 // Barrett modular reduction
1419 function Barrett(m
) {
1421 this.r2
= new BigInteger()
1422 this.q3
= new BigInteger()
1423 BigInteger
.ONE
.dlShiftTo(2 * m
.t
, this.r2
)
1424 this.mu
= this.r2
.divide(m
)
1428 function barrettConvert(x
) {
1429 if (x
.s
< 0 || x
.t
> 2 * this.m
.t
) return x
.mod(this.m
)
1430 else if (x
.compareTo(this.m
) < 0) return x
1432 var r
= new BigInteger()
1439 function barrettRevert(x
) {
1443 // x = x mod m (HAC 14.42)
1444 function barrettReduce(x
) {
1446 x
.drShiftTo(self
.m
.t
- 1, self
.r2
)
1447 if (x
.t
> self
.m
.t
+ 1) {
1451 self
.mu
.multiplyUpperTo(self
.r2
, self
.m
.t
+ 1, self
.q3
)
1452 self
.m
.multiplyLowerTo(self
.q3
, self
.m
.t
+ 1, self
.r2
)
1453 while (x
.compareTo(self
.r2
) < 0) x
.dAddOffset(1, self
.m
.t
+ 1)
1455 while (x
.compareTo(self
.m
) >= 0) x
.subTo(self
.m
, x
)
1458 // r = x^2 mod m; x != r
1459 function barrettSqrTo(x
, r
) {
1464 // r = x*y mod m; x,y != r
1465 function barrettMulTo(x
, y
, r
) {
1470 Barrett
.prototype.convert
= barrettConvert
1471 Barrett
.prototype.revert
= barrettRevert
1472 Barrett
.prototype.reduce
= barrettReduce
1473 Barrett
.prototype.mulTo
= barrettMulTo
1474 Barrett
.prototype.sqrTo
= barrettSqrTo
1476 // (public) this^e % m (HAC 14.85)
1477 function bnModPow(e
, m
) {
1478 var i
= e
.bitLength(),
1481 if (i
<= 0) return r
1482 else if (i
< 18) k
= 1
1483 else if (i
< 48) k
= 3
1484 else if (i
< 144) k
= 4
1485 else if (i
< 768) k
= 5
1489 else if (m
.isEven())
1492 z
= new Montgomery(m
)
1495 var g
= new Array(),
1499 g
[1] = z
.convert(this)
1501 var g2
= new BigInteger()
1504 g
[n
] = new BigInteger()
1505 z
.mulTo(g2
, g
[n
- 2], g
[n
])
1512 r2
= new BigInteger(),
1516 if (i
>= k1
) w
= (e
[j
] >> (i
- k1
)) & km
1518 w
= (e
[j
] & ((1 << (i
+ 1)) - 1)) << (k1
- i
)
1519 if (j
> 0) w
|= e
[j
- 1] >> (this.DB
+ i
- k1
)
1523 while ((w
& 1) == 0) {
1531 if (is1
) { // ret == 1, don't bother squaring or multiplying it
1540 if (n
> 0) z
.sqrTo(r
, r2
)
1546 z
.mulTo(r2
, g
[w
], r
)
1549 while (j
>= 0 && (e
[j
] & (1 << i
)) == 0) {
1563 // (public) gcd(this,a) (HAC 14.54)
1565 var x
= (this.s
< 0) ? this.negate() : this.clone()
1566 var y
= (a
.s
< 0) ? a
.negate() : a
.clone()
1567 if (x
.compareTo(y
) < 0) {
1572 var i
= x
.getLowestSetBit(),
1573 g
= y
.getLowestSetBit()
1580 while (x
.signum() > 0) {
1581 if ((i
= x
.getLowestSetBit()) > 0) x
.rShiftTo(i
, x
)
1582 if ((i
= y
.getLowestSetBit()) > 0) y
.rShiftTo(i
, y
)
1583 if (x
.compareTo(y
) >= 0) {
1591 if (g
> 0) y
.lShiftTo(g
, y
)
1595 // (protected) this % n, n < 2^26
1596 function bnpModInt(n
) {
1597 if (n
<= 0) return 0
1598 var d
= this.DV
% n
,
1599 r
= (this.s
< 0) ? n
- 1 : 0
1601 if (d
== 0) r
= this[0] % n
1603 for (var i
= this.t
- 1; i
>= 0; --i
) r
= (d
* r
+ this[i
]) % n
1607 // (public) 1/this % m (HAC 14.61)
1608 function bnModInverse(m
) {
1610 if (this.signum() === 0) throw new Error('division by zero')
1611 if ((this.isEven() && ac
) || m
.signum() == 0) return BigInteger
.ZERO
1618 while (u
.signum() != 0) {
1619 while (u
.isEven()) {
1622 if (!a
.isEven() || !b
.isEven()) {
1627 } else if (!b
.isEven()) b
.subTo(m
, b
)
1630 while (v
.isEven()) {
1633 if (!c
.isEven() || !d
.isEven()) {
1638 } else if (!d
.isEven()) d
.subTo(m
, d
)
1641 if (u
.compareTo(v
) >= 0) {
1643 if (ac
) a
.subTo(c
, a
)
1647 if (ac
) c
.subTo(a
, c
)
1651 if (v
.compareTo(BigInteger
.ONE
) != 0) return BigInteger
.ZERO
1652 while (d
.compareTo(m
) >= 0) d
.subTo(m
, d
)
1653 while (d
.signum() < 0) d
.addTo(m
, d
)
1658 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
1659 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
1660 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
1661 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
1662 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
1663 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
1664 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
1665 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
1666 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
1667 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
1668 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
1671 var lplim
= (1 << 26) / lowprimes
[lowprimes
.length
- 1]
1673 // (public) test primality with certainty >= 1-.5^t
1674 function bnIsProbablePrime(t
) {
1675 var i
, x
= this.abs()
1676 if (x
.t
== 1 && x
[0] <= lowprimes
[lowprimes
.length
- 1]) {
1677 for (i
= 0; i
< lowprimes
.length
; ++i
)
1678 if (x
[0] == lowprimes
[i
]) return true
1681 if (x
.isEven()) return false
1683 while (i
< lowprimes
.length
) {
1684 var m
= lowprimes
[i
],
1686 while (j
< lowprimes
.length
&& m
< lplim
) m
*= lowprimes
[j
++]
1688 while (i
< j
) if (m
% lowprimes
[i
++] == 0) return false
1690 return x
.millerRabin(t
)
1693 // (protected) true if probably prime (HAC 4.24, Miller-Rabin)
1694 function bnpMillerRabin(t
) {
1695 var n1
= this.subtract(BigInteger
.ONE
)
1696 var k
= n1
.getLowestSetBit()
1697 if (k
<= 0) return false
1698 var r
= n1
.shiftRight(k
)
1700 if (t
> lowprimes
.length
) t
= lowprimes
.length
1701 var a
= new BigInteger(null)
1703 for (var i
= 0; i
< t
; ++i
) {
1705 j
= lowprimes
[Math
.floor(Math
.random() * lowprimes
.length
)]
1706 if (bases
.indexOf(j
) == -1) break
1710 var y
= a
.modPow(r
, this)
1711 if (y
.compareTo(BigInteger
.ONE
) != 0 && y
.compareTo(n1
) != 0) {
1713 while (j
++ < k
&& y
.compareTo(n1
) != 0) {
1714 y
= y
.modPowInt(2, this)
1715 if (y
.compareTo(BigInteger
.ONE
) == 0) return false
1717 if (y
.compareTo(n1
) != 0) return false
1724 proto
.chunkSize
= bnpChunkSize
1725 proto
.toRadix
= bnpToRadix
1726 proto
.fromRadix
= bnpFromRadix
1727 proto
.fromNumber
= bnpFromNumber
1728 proto
.bitwiseTo
= bnpBitwiseTo
1729 proto
.changeBit
= bnpChangeBit
1730 proto
.addTo
= bnpAddTo
1731 proto
.dMultiply
= bnpDMultiply
1732 proto
.dAddOffset
= bnpDAddOffset
1733 proto
.multiplyLowerTo
= bnpMultiplyLowerTo
1734 proto
.multiplyUpperTo
= bnpMultiplyUpperTo
1735 proto
.modInt
= bnpModInt
1736 proto
.millerRabin
= bnpMillerRabin
1739 proto
.clone
= bnClone
1740 proto
.intValue
= bnIntValue
1741 proto
.byteValue
= bnByteValue
1742 proto
.shortValue
= bnShortValue
1743 proto
.signum
= bnSigNum
1744 proto
.toByteArray
= bnToByteArray
1745 proto
.equals
= bnEquals
1751 proto
.andNot
= bnAndNot
1753 proto
.shiftLeft
= bnShiftLeft
1754 proto
.shiftRight
= bnShiftRight
1755 proto
.getLowestSetBit
= bnGetLowestSetBit
1756 proto
.bitCount
= bnBitCount
1757 proto
.testBit
= bnTestBit
1758 proto
.setBit
= bnSetBit
1759 proto
.clearBit
= bnClearBit
1760 proto
.flipBit
= bnFlipBit
1762 proto
.subtract
= bnSubtract
1763 proto
.multiply
= bnMultiply
1764 proto
.divide
= bnDivide
1765 proto
.remainder
= bnRemainder
1766 proto
.divideAndRemainder
= bnDivideAndRemainder
1767 proto
.modPow
= bnModPow
1768 proto
.modInverse
= bnModInverse
1771 proto
.isProbablePrime
= bnIsProbablePrime
1773 // JSBN-specific extension
1774 proto
.square
= bnSquare
1777 BigInteger
.ZERO
= nbv(0)
1778 BigInteger
.ONE
= nbv(1)
1779 BigInteger
.valueOf
= nbv
1781 module
.exports
= BigInteger
1783 },{"../package.json":6}],4:[function(require
,module
,exports
){
1785 // FIXME: Kind of a weird way to throw exceptions, consider removing
1786 var assert
= require('assert')
1787 var BigInteger
= require('./bigi')
1790 * Turns a byte array into a big integer.
1792 * This function will interpret a byte array as a big integer in big
1795 BigInteger
.fromByteArrayUnsigned = function(byteArray
) {
1796 // BigInteger expects a DER integer conformant byte array
1797 if (byteArray
[0] & 0x80) {
1798 return new BigInteger([0].concat(byteArray
))
1801 return new BigInteger(byteArray
)
1805 * Returns a byte array representation of the big integer.
1807 * This returns the absolute of the contained value in big endian
1808 * form. A value of zero results in an empty array.
1810 BigInteger
.prototype.toByteArrayUnsigned = function() {
1811 var byteArray
= this.toByteArray()
1812 return byteArray
[0] === 0 ? byteArray
.slice(1) : byteArray
1815 BigInteger
.fromDERInteger = function(byteArray
) {
1816 return new BigInteger(byteArray
)
1820 * Converts BigInteger to a DER integer representation.
1822 * The format for this value uses the most significant bit as a sign
1823 * bit. If the most significant bit is already set and the integer is
1824 * positive, a 0x00 is prepended.
1840 * -62300 => 0xff0ca4
1842 BigInteger
.prototype.toDERInteger
= BigInteger
.prototype.toByteArray
1844 BigInteger
.fromBuffer = function(buffer
) {
1845 // BigInteger expects a DER integer conformant byte array
1846 if (buffer
[0] & 0x80) {
1847 var byteArray
= Array
.prototype.slice
.call(buffer
)
1849 return new BigInteger([0].concat(byteArray
))
1852 return new BigInteger(buffer
)
1855 BigInteger
.fromHex = function(hex
) {
1856 if (hex
=== '') return BigInteger
.ZERO
1858 assert
.equal(hex
, hex
.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')
1859 assert
.equal(hex
.length
% 2, 0, 'Incomplete hex')
1860 return new BigInteger(hex
, 16)
1863 BigInteger
.prototype.toBuffer = function(size
) {
1864 var byteArray
= this.toByteArrayUnsigned()
1867 var padding
= size
- byteArray
.length
1868 while (zeros
.length
< padding
) zeros
.push(0)
1870 return new Buffer(zeros
.concat(byteArray
))
1873 BigInteger
.prototype.toHex = function(size
) {
1874 return this.toBuffer(size
).toString('hex')
1877 }).call(this,require("buffer").Buffer
)
1878 },{"./bigi":3,"assert":90,"buffer":96}],5:[function(require
,module
,exports
){
1879 var BigInteger
= require('./bigi')
1882 require('./convert')
1884 module
.exports
= BigInteger
1885 },{"./bigi":3,"./convert":4}],6:[function(require
,module
,exports
){
1890 "/home/hashengineering/hashengineering/groestlcoinjs-lib"
1893 "_from": "bigi@>=1.4.0 <2.0.0",
1894 "_id": "bigi@1.4.2",
1896 "_installable": true,
1897 "_location": "/bigi",
1898 "_nodeVersion": "6.1.0",
1899 "_npmOperationalInternal": {
1900 "host": "packages-12-west.internal.npmjs.com",
1901 "tmp": "tmp/bigi-1.4.2.tgz_1469584192413_0.6801238611806184"
1904 "email": "jprichardson@gmail.com",
1905 "name": "jprichardson"
1907 "_npmVersion": "3.8.6",
1908 "_phantomChildren": {},
1911 "raw": "bigi@^1.4.0",
1912 "rawSpec": "^1.4.0",
1914 "spec": ">=1.4.0 <2.0.0",
1920 "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
1921 "_shasum": "9c665a95f88b8b08fc05cfd731f561859d725825",
1922 "_shrinkwrap": null,
1923 "_spec": "bigi@^1.4.0",
1924 "_where": "/home/hashengineering/hashengineering/groestlcoinjs-lib",
1926 "url": "https://github.com/cryptocoinjs/bigi/issues"
1929 "description": "Big integers.",
1930 "devDependencies": {
1931 "coveralls": "^2.11.2",
1932 "istanbul": "^0.3.5",
1939 "shasum": "9c665a95f88b8b08fc05cfd731f561859d725825",
1940 "tarball": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz"
1942 "gitHead": "c25308081c896ff84702303722bf5ecd8b3f78e3",
1943 "homepage": "https://github.com/cryptocoinjs/bigi#readme",
1961 "main": "./lib/index.js",
1964 "name": "midnightlightning",
1965 "email": "boydb@midnightdesign.ws"
1968 "name": "sidazhang",
1969 "email": "sidazhang89@gmail.com"
1973 "email": "npm@shesek.info"
1976 "name": "jprichardson",
1977 "email": "jprichardson@gmail.com"
1981 "optionalDependencies": {},
1982 "readme": "ERROR: No README data found!",
1985 "url": "git+https://github.com/cryptocoinjs/bigi.git"
1988 "browser-test": "mochify --wd -R spec",
1989 "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
1990 "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info",
1991 "jshint": "jshint --config jshint.json lib/*.js ; true",
1992 "test": "_mocha -- test/*.js",
1997 "android-browser/4.2..latest",
2001 "iphone/6.0..latest",
2002 "safari/6.0..latest"
2004 "files": "test/*.js",
2010 },{}],7:[function(require
,module
,exports
){
2011 // Reference https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki
2012 // Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
2013 // NOTE: SIGHASH byte ignored AND restricted, truncate before use
2015 var Buffer
= require('safe-buffer').Buffer
2017 function check (buffer
) {
2018 if (buffer
.length
< 8) return false
2019 if (buffer
.length
> 72) return false
2020 if (buffer
[0] !== 0x30) return false
2021 if (buffer
[1] !== buffer
.length
- 2) return false
2022 if (buffer
[2] !== 0x02) return false
2024 var lenR
= buffer
[3]
2025 if (lenR
=== 0) return false
2026 if (5 + lenR
>= buffer
.length
) return false
2027 if (buffer
[4 + lenR
] !== 0x02) return false
2029 var lenS
= buffer
[5 + lenR
]
2030 if (lenS
=== 0) return false
2031 if ((6 + lenR
+ lenS
) !== buffer
.length
) return false
2033 if (buffer
[4] & 0x80) return false
2034 if (lenR
> 1 && (buffer
[4] === 0x00) && !(buffer
[5] & 0x80)) return false
2036 if (buffer
[lenR
+ 6] & 0x80) return false
2037 if (lenS
> 1 && (buffer
[lenR
+ 6] === 0x00) && !(buffer
[lenR
+ 7] & 0x80)) return false
2041 function decode (buffer
) {
2042 if (buffer
.length
< 8) throw new Error('DER sequence length is too short')
2043 if (buffer
.length
> 72) throw new Error('DER sequence length is too long')
2044 if (buffer
[0] !== 0x30) throw new Error('Expected DER sequence')
2045 if (buffer
[1] !== buffer
.length
- 2) throw new Error('DER sequence length is invalid')
2046 if (buffer
[2] !== 0x02) throw new Error('Expected DER integer')
2048 var lenR
= buffer
[3]
2049 if (lenR
=== 0) throw new Error('R length is zero')
2050 if (5 + lenR
>= buffer
.length
) throw new Error('R length is too long')
2051 if (buffer
[4 + lenR
] !== 0x02) throw new Error('Expected DER integer (2)')
2053 var lenS
= buffer
[5 + lenR
]
2054 if (lenS
=== 0) throw new Error('S length is zero')
2055 if ((6 + lenR
+ lenS
) !== buffer
.length
) throw new Error('S length is invalid')
2057 if (buffer
[4] & 0x80) throw new Error('R value is negative')
2058 if (lenR
> 1 && (buffer
[4] === 0x00) && !(buffer
[5] & 0x80)) throw new Error('R value excessively padded')
2060 if (buffer
[lenR
+ 6] & 0x80) throw new Error('S value is negative')
2061 if (lenS
> 1 && (buffer
[lenR
+ 6] === 0x00) && !(buffer
[lenR
+ 7] & 0x80)) throw new Error('S value excessively padded')
2063 // non-BIP66 - extract R, S values
2065 r: buffer
.slice(4, 4 + lenR
),
2066 s: buffer
.slice(6 + lenR
)
2071 * Expects r and s to be positive DER integers.
2073 * The DER format uses the most significant bit as a sign bit (& 0x80).
2074 * If the significant bit is set AND the integer is positive, a 0x00 is prepended.
2090 * -62300 => 0xff0ca4
2092 function encode (r
, s
) {
2095 if (lenR
=== 0) throw new Error('R length is zero')
2096 if (lenS
=== 0) throw new Error('S length is zero')
2097 if (lenR
> 33) throw new Error('R length is too long')
2098 if (lenS
> 33) throw new Error('S length is too long')
2099 if (r
[0] & 0x80) throw new Error('R value is negative')
2100 if (s
[0] & 0x80) throw new Error('S value is negative')
2101 if (lenR
> 1 && (r
[0] === 0x00) && !(r
[1] & 0x80)) throw new Error('R value excessively padded')
2102 if (lenS
> 1 && (s
[0] === 0x00) && !(s
[1] & 0x80)) throw new Error('S value excessively padded')
2104 var signature
= Buffer
.allocUnsafe(6 + lenR
+ lenS
)
2106 // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
2108 signature
[1] = signature
.length
- 2
2110 signature
[3] = r
.length
2111 r
.copy(signature
, 4)
2112 signature
[4 + lenR
] = 0x02
2113 signature
[5 + lenR
] = s
.length
2114 s
.copy(signature
, 6 + lenR
)
2125 },{"safe-buffer":38}],8:[function(require
,module
,exports
){
2163 "OP_TOALTSTACK": 107,
2164 "OP_FROMALTSTACK": 108,
2194 "OP_EQUALVERIFY": 136,
2195 "OP_RESERVED1": 137,
2196 "OP_RESERVED2": 138,
2205 "OP_0NOTEQUAL": 146,
2217 "OP_NUMEQUALVERIFY": 157,
2218 "OP_NUMNOTEQUAL": 158,
2220 "OP_GREATERTHAN": 160,
2221 "OP_LESSTHANOREQUAL": 161,
2222 "OP_GREATERTHANOREQUAL": 162,
2228 "OP_RIPEMD160": 166,
2233 "OP_CODESEPARATOR": 171,
2235 "OP_CHECKSIGVERIFY": 173,
2236 "OP_CHECKMULTISIG": 174,
2237 "OP_CHECKMULTISIGVERIFY": 175,
2242 "OP_CHECKLOCKTIMEVERIFY": 177,
2245 "OP_CHECKSEQUENCEVERIFY": 178,
2255 "OP_PUBKEYHASH": 253,
2257 "OP_INVALIDOPCODE": 255
2260 },{}],9:[function(require
,module
,exports
){
2261 var OPS
= require('./index.json')
2264 for (var op
in OPS
) {
2269 module
.exports
= map
2271 },{"./index.json":8}],10:[function(require
,module
,exports
){
2272 var basex
= require('base-x')
2273 var ALPHABET
= '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
2275 module
.exports
= basex(ALPHABET
)
2277 },{"base-x":1}],11:[function(require
,module
,exports
){
2280 var base58
= require('bs58')
2281 var Buffer
= require('safe-buffer').Buffer
2283 module
.exports = function (checksumFn
) {
2284 // Encode a buffer as a base58-check encoded string
2285 function encode (payload
) {
2286 var checksum
= checksumFn(payload
)
2288 return base58
.encode(Buffer
.concat([
2291 ], payload
.length
+ 4))
2294 function decodeRaw (buffer
) {
2295 var payload
= buffer
.slice(0, -4)
2296 var checksum
= buffer
.slice(-4)
2297 var newChecksum
= checksumFn(payload
)
2299 if (checksum
[0] ^ newChecksum
[0] |
2300 checksum
[1] ^ newChecksum
[1] |
2301 checksum
[2] ^ newChecksum
[2] |
2302 checksum
[3] ^ newChecksum
[3]) return
2307 // Decode a base58-check encoded string to a buffer, no result if checksum is wrong
2308 function decodeUnsafe (string
) {
2309 var buffer
= base58
.decodeUnsafe(string
)
2312 return decodeRaw(buffer
)
2315 function decode (string
) {
2316 var buffer
= base58
.decode(string
)
2317 var payload
= decodeRaw(buffer
, checksumFn
)
2318 if (!payload
) throw new Error('Invalid checksum')
2325 decodeUnsafe: decodeUnsafe
2329 },{"bs58":10,"safe-buffer":38}],12:[function(require
,module
,exports
){
2333 var createHash
= require('create-hash')
2334 var bs58grscheckBase
= require('./base')
2335 var groestlhash
= require('groestl-hash-js')
2337 // GROESTL512(GROESTL512(buffer))
2338 function groestl (buffer
) {
2339 return Buffer(groestlhash
.groestl_2(buffer
, 1, 1))
2342 module
.exports
= bs58grscheckBase(groestl
)
2344 }).call(this,require("buffer").Buffer
)
2345 },{"./base":11,"buffer":96,"create-hash":14,"groestl-hash-js":27}],13:[function(require
,module
,exports
){
2346 var Buffer
= require('safe-buffer').Buffer
2347 var Transform
= require('stream').Transform
2348 var StringDecoder
= require('string_decoder').StringDecoder
2349 var inherits
= require('inherits')
2351 function CipherBase (hashMode
) {
2352 Transform
.call(this)
2353 this.hashMode
= typeof hashMode
=== 'string'
2354 if (this.hashMode
) {
2355 this[hashMode
] = this._finalOrDigest
2357 this.final
= this._finalOrDigest
2360 this.__final
= this._final
2363 this._decoder
= null
2364 this._encoding
= null
2366 inherits(CipherBase
, Transform
)
2368 CipherBase
.prototype.update = function (data
, inputEnc
, outputEnc
) {
2369 if (typeof data
=== 'string') {
2370 data
= Buffer
.from(data
, inputEnc
)
2373 var outData
= this._update(data
)
2374 if (this.hashMode
) return this
2377 outData
= this._toString(outData
, outputEnc
)
2383 CipherBase
.prototype.setAutoPadding = function () {}
2384 CipherBase
.prototype.getAuthTag = function () {
2385 throw new Error('trying to get auth tag in unsupported state')
2388 CipherBase
.prototype.setAuthTag = function () {
2389 throw new Error('trying to set auth tag in unsupported state')
2392 CipherBase
.prototype.setAAD = function () {
2393 throw new Error('trying to set aad in unsupported state')
2396 CipherBase
.prototype._transform = function (data
, _
, next
) {
2399 if (this.hashMode
) {
2402 this.push(this._update(data
))
2410 CipherBase
.prototype._flush = function (done
) {
2413 this.push(this.__final())
2420 CipherBase
.prototype._finalOrDigest = function (outputEnc
) {
2421 var outData
= this.__final() || Buffer
.alloc(0)
2423 outData
= this._toString(outData
, outputEnc
, true)
2428 CipherBase
.prototype._toString = function (value
, enc
, fin
) {
2429 if (!this._decoder
) {
2430 this._decoder
= new StringDecoder(enc
)
2431 this._encoding
= enc
2434 if (this._encoding
!== enc
) throw new Error('can\'t switch encodings')
2436 var out
= this._decoder
.write(value
)
2438 out
+= this._decoder
.end()
2444 module
.exports
= CipherBase
2446 },{"inherits":32,"safe-buffer":38,"stream":122,"string_decoder":123}],14:[function(require
,module
,exports
){
2448 var inherits
= require('inherits')
2449 var MD5
= require('md5.js')
2450 var RIPEMD160
= require('ripemd160')
2451 var sha
= require('sha.js')
2452 var Base
= require('cipher-base')
2454 function Hash (hash
) {
2455 Base
.call(this, 'digest')
2460 inherits(Hash
, Base
)
2462 Hash
.prototype._update = function (data
) {
2463 this._hash
.update(data
)
2466 Hash
.prototype._final = function () {
2467 return this._hash
.digest()
2470 module
.exports
= function createHash (alg
) {
2471 alg
= alg
.toLowerCase()
2472 if (alg
=== 'md5') return new MD5()
2473 if (alg
=== 'rmd160' || alg
=== 'ripemd160') return new RIPEMD160()
2475 return new Hash(sha(alg
))
2478 },{"cipher-base":13,"inherits":32,"md5.js":33,"ripemd160":37,"sha.js":40}],15:[function(require
,module
,exports
){
2479 var MD5
= require('md5.js')
2481 module
.exports = function (buffer
) {
2482 return new MD5().update(buffer
).digest()
2485 },{"md5.js":33}],16:[function(require
,module
,exports
){
2487 var inherits
= require('inherits')
2488 var Legacy
= require('./legacy')
2489 var Base
= require('cipher-base')
2490 var Buffer
= require('safe-buffer').Buffer
2491 var md5
= require('create-hash/md5')
2492 var RIPEMD160
= require('ripemd160')
2494 var sha
= require('sha.js')
2496 var ZEROS
= Buffer
.alloc(128)
2498 function Hmac (alg
, key
) {
2499 Base
.call(this, 'digest')
2500 if (typeof key
=== 'string') {
2501 key
= Buffer
.from(key
)
2504 var blocksize
= (alg
=== 'sha512' || alg
=== 'sha384') ? 128 : 64
2508 if (key
.length
> blocksize
) {
2509 var hash
= alg
=== 'rmd160' ? new RIPEMD160() : sha(alg
)
2510 key
= hash
.update(key
).digest()
2511 } else if (key
.length
< blocksize
) {
2512 key
= Buffer
.concat([key
, ZEROS
], blocksize
)
2515 var ipad
= this._ipad
= Buffer
.allocUnsafe(blocksize
)
2516 var opad
= this._opad
= Buffer
.allocUnsafe(blocksize
)
2518 for (var i
= 0; i
< blocksize
; i
++) {
2519 ipad
[i
] = key
[i
] ^ 0x36
2520 opad
[i
] = key
[i
] ^ 0x5C
2522 this._hash
= alg
=== 'rmd160' ? new RIPEMD160() : sha(alg
)
2523 this._hash
.update(ipad
)
2526 inherits(Hmac
, Base
)
2528 Hmac
.prototype._update = function (data
) {
2529 this._hash
.update(data
)
2532 Hmac
.prototype._final = function () {
2533 var h
= this._hash
.digest()
2534 var hash
= this._alg
=== 'rmd160' ? new RIPEMD160() : sha(this._alg
)
2535 return hash
.update(this._opad
).update(h
).digest()
2538 module
.exports
= function createHmac (alg
, key
) {
2539 alg
= alg
.toLowerCase()
2540 if (alg
=== 'rmd160' || alg
=== 'ripemd160') {
2541 return new Hmac('rmd160', key
)
2543 if (alg
=== 'md5') {
2544 return new Legacy(md5
, key
)
2546 return new Hmac(alg
, key
)
2549 },{"./legacy":17,"cipher-base":13,"create-hash/md5":15,"inherits":32,"ripemd160":37,"safe-buffer":38,"sha.js":40}],17:[function(require
,module
,exports
){
2551 var inherits
= require('inherits')
2552 var Buffer
= require('safe-buffer').Buffer
2554 var Base
= require('cipher-base')
2556 var ZEROS
= Buffer
.alloc(128)
2559 function Hmac (alg
, key
) {
2560 Base
.call(this, 'digest')
2561 if (typeof key
=== 'string') {
2562 key
= Buffer
.from(key
)
2568 if (key
.length
> blocksize
) {
2570 } else if (key
.length
< blocksize
) {
2571 key
= Buffer
.concat([key
, ZEROS
], blocksize
)
2574 var ipad
= this._ipad
= Buffer
.allocUnsafe(blocksize
)
2575 var opad
= this._opad
= Buffer
.allocUnsafe(blocksize
)
2577 for (var i
= 0; i
< blocksize
; i
++) {
2578 ipad
[i
] = key
[i
] ^ 0x36
2579 opad
[i
] = key
[i
] ^ 0x5C
2585 inherits(Hmac
, Base
)
2587 Hmac
.prototype._update = function (data
) {
2588 this._hash
.push(data
)
2591 Hmac
.prototype._final = function () {
2592 var h
= this._alg(Buffer
.concat(this._hash
))
2593 return this._alg(Buffer
.concat([this._opad
, h
]))
2595 module
.exports
= Hmac
2597 },{"cipher-base":13,"inherits":32,"safe-buffer":38}],18:[function(require
,module
,exports
){
2598 var assert
= require('assert')
2599 var BigInteger
= require('bigi')
2601 var Point
= require('./point')
2603 function Curve (p
, a
, b
, Gx
, Gy
, n
, h
) {
2607 this.G
= Point
.fromAffine(this, Gx
, Gy
)
2611 this.infinity
= new Point(this, null, null, BigInteger
.ZERO
)
2614 this.pOverFour
= p
.add(BigInteger
.ONE
).shiftRight(2)
2616 // determine size of p in bytes
2617 this.pLength
= Math
.floor((this.p
.bitLength() + 7) / 8)
2620 Curve
.prototype.pointFromX = function (isOdd
, x
) {
2621 var alpha
= x
.pow(3).add(this.a
.multiply(x
)).add(this.b
).mod(this.p
)
2622 var beta
= alpha
.modPow(this.pOverFour
, this.p
) // XXX: not compatible with all curves
2625 if (beta
.isEven() ^ !isOdd
) {
2626 y
= this.p
.subtract(y
) // -y % p
2629 return Point
.fromAffine(this, x
, y
)
2632 Curve
.prototype.isInfinity = function (Q
) {
2633 if (Q
=== this.infinity
) return true
2635 return Q
.z
.signum() === 0 && Q
.y
.signum() !== 0
2638 Curve
.prototype.isOnCurve = function (Q
) {
2639 if (this.isInfinity(Q
)) return true
2647 // Check that xQ and yQ are integers in the interval [0, p - 1]
2648 if (x
.signum() < 0 || x
.compareTo(p
) >= 0) return false
2649 if (y
.signum() < 0 || y
.compareTo(p
) >= 0) return false
2651 // and check that y^2 = x^3 + ax + b (mod p)
2652 var lhs
= y
.square().mod(p
)
2653 var rhs
= x
.pow(3).add(a
.multiply(x
)).add(b
).mod(p
)
2654 return lhs
.equals(rhs
)
2658 * Validate an elliptic curve point.
2660 * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive
2662 Curve
.prototype.validate = function (Q
) {
2664 assert(!this.isInfinity(Q
), 'Point is at infinity')
2665 assert(this.isOnCurve(Q
), 'Point is not on the curve')
2667 // Check nQ = O (where Q is a scalar multiple of G)
2668 var nQ
= Q
.multiply(this.n
)
2669 assert(this.isInfinity(nQ
), 'Point is not a scalar multiple of G')
2674 module
.exports
= Curve
2676 },{"./point":22,"assert":90,"bigi":25}],19:[function(require
,module
,exports
){
2679 "p": "fffffffdffffffffffffffffffffffff",
2680 "a": "fffffffdfffffffffffffffffffffffc",
2681 "b": "e87579c11079f43dd824993c2cee5ed3",
2682 "n": "fffffffe0000000075a30d1b9038a115",
2684 "Gx": "161ff7528b899b2d0c28607ca52c5b86",
2685 "Gy": "cf5ac8395bafeb13c02da292dded7a83"
2688 "p": "fffffffffffffffffffffffffffffffeffffac73",
2691 "n": "0100000000000000000001b8fa16dfab9aca16b6b3",
2693 "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",
2694 "Gy": "938cf935318fdced6bc28286531733c3f03c4fee"
2697 "p": "ffffffffffffffffffffffffffffffff7fffffff",
2698 "a": "ffffffffffffffffffffffffffffffff7ffffffc",
2699 "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45",
2700 "n": "0100000000000000000001f4c8f927aed3ca752257",
2702 "Gx": "4a96b5688ef573284664698968c38bb913cbfc82",
2703 "Gy": "23a628553168947d59dcc912042351377ac5fb32"
2706 "p": "fffffffffffffffffffffffffffffffffffffffeffffee37",
2709 "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d",
2711 "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",
2712 "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"
2715 "p": "fffffffffffffffffffffffffffffffeffffffffffffffff",
2716 "a": "fffffffffffffffffffffffffffffffefffffffffffffffc",
2717 "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",
2718 "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831",
2720 "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
2721 "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
2724 "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
2727 "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
2729 "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
2730 "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
2733 "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",
2734 "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",
2735 "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",
2736 "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",
2738 "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
2739 "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"
2743 },{}],20:[function(require
,module
,exports
){
2744 var Point
= require('./point')
2745 var Curve
= require('./curve')
2747 var getCurveByName
= require('./names')
2752 getCurveByName: getCurveByName
2755 },{"./curve":18,"./names":21,"./point":22}],21:[function(require
,module
,exports
){
2756 var BigInteger
= require('bigi')
2758 var curves
= require('./curves.json')
2759 var Curve
= require('./curve')
2761 function getCurveByName (name
) {
2762 var curve
= curves
[name
]
2763 if (!curve
) return null
2765 var p
= new BigInteger(curve
.p
, 16)
2766 var a
= new BigInteger(curve
.a
, 16)
2767 var b
= new BigInteger(curve
.b
, 16)
2768 var n
= new BigInteger(curve
.n
, 16)
2769 var h
= new BigInteger(curve
.h
, 16)
2770 var Gx
= new BigInteger(curve
.Gx
, 16)
2771 var Gy
= new BigInteger(curve
.Gy
, 16)
2773 return new Curve(p
, a
, b
, Gx
, Gy
, n
, h
)
2776 module
.exports
= getCurveByName
2778 },{"./curve":18,"./curves.json":19,"bigi":25}],22:[function(require
,module
,exports
){
2779 var assert
= require('assert')
2780 var Buffer
= require('safe-buffer').Buffer
2781 var BigInteger
= require('bigi')
2783 var THREE
= BigInteger
.valueOf(3)
2785 function Point (curve
, x
, y
, z
) {
2786 assert
.notStrictEqual(z
, undefined, 'Missing Z coordinate')
2794 this.compressed
= true
2797 Object
.defineProperty(Point
.prototype, 'zInv', {
2799 if (this._zInv
=== null) {
2800 this._zInv
= this.z
.modInverse(this.curve
.p
)
2807 Object
.defineProperty(Point
.prototype, 'affineX', {
2809 return this.x
.multiply(this.zInv
).mod(this.curve
.p
)
2813 Object
.defineProperty(Point
.prototype, 'affineY', {
2815 return this.y
.multiply(this.zInv
).mod(this.curve
.p
)
2819 Point
.fromAffine = function (curve
, x
, y
) {
2820 return new Point(curve
, x
, y
, BigInteger
.ONE
)
2823 Point
.prototype.equals = function (other
) {
2824 if (other
=== this) return true
2825 if (this.curve
.isInfinity(this)) return this.curve
.isInfinity(other
)
2826 if (this.curve
.isInfinity(other
)) return this.curve
.isInfinity(this)
2828 // u = Y2 * Z1 - Y1 * Z2
2829 var u
= other
.y
.multiply(this.z
).subtract(this.y
.multiply(other
.z
)).mod(this.curve
.p
)
2831 if (u
.signum() !== 0) return false
2833 // v = X2 * Z1 - X1 * Z2
2834 var v
= other
.x
.multiply(this.z
).subtract(this.x
.multiply(other
.z
)).mod(this.curve
.p
)
2836 return v
.signum() === 0
2839 Point
.prototype.negate = function () {
2840 var y
= this.curve
.p
.subtract(this.y
)
2842 return new Point(this.curve
, this.x
, y
, this.z
)
2845 Point
.prototype.add = function (b
) {
2846 if (this.curve
.isInfinity(this)) return b
2847 if (this.curve
.isInfinity(b
)) return this
2854 // u = Y2 * Z1 - Y1 * Z2
2855 var u
= y2
.multiply(this.z
).subtract(y1
.multiply(b
.z
)).mod(this.curve
.p
)
2856 // v = X2 * Z1 - X1 * Z2
2857 var v
= x2
.multiply(this.z
).subtract(x1
.multiply(b
.z
)).mod(this.curve
.p
)
2859 if (v
.signum() === 0) {
2860 if (u
.signum() === 0) {
2861 return this.twice() // this == b, so double
2864 return this.curve
.infinity
// this = -b, so infinity
2868 var v3
= v2
.multiply(v
)
2869 var x1v2
= x1
.multiply(v2
)
2870 var zu2
= u
.square().multiply(this.z
)
2872 // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
2873 var x3
= zu2
.subtract(x1v2
.shiftLeft(1)).multiply(b
.z
).subtract(v3
).multiply(v
).mod(this.curve
.p
)
2874 // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
2875 var y3
= x1v2
.multiply(THREE
).multiply(u
).subtract(y1
.multiply(v3
)).subtract(zu2
.multiply(u
)).multiply(b
.z
).add(u
.multiply(v3
)).mod(this.curve
.p
)
2876 // z3 = v^3 * z1 * z2
2877 var z3
= v3
.multiply(this.z
).multiply(b
.z
).mod(this.curve
.p
)
2879 return new Point(this.curve
, x3
, y3
, z3
)
2882 Point
.prototype.twice = function () {
2883 if (this.curve
.isInfinity(this)) return this
2884 if (this.y
.signum() === 0) return this.curve
.infinity
2889 var y1z1
= y1
.multiply(this.z
).mod(this.curve
.p
)
2890 var y1sqz1
= y1z1
.multiply(y1
).mod(this.curve
.p
)
2891 var a
= this.curve
.a
2893 // w = 3 * x1^2 + a * z1^2
2894 var w
= x1
.square().multiply(THREE
)
2896 if (a
.signum() !== 0) {
2897 w
= w
.add(this.z
.square().multiply(a
))
2900 w
= w
.mod(this.curve
.p
)
2901 // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
2902 var x3
= w
.square().subtract(x1
.shiftLeft(3).multiply(y1sqz1
)).shiftLeft(1).multiply(y1z1
).mod(this.curve
.p
)
2903 // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
2904 var y3
= w
.multiply(THREE
).multiply(x1
).subtract(y1sqz1
.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1
).subtract(w
.pow(3)).mod(this.curve
.p
)
2905 // z3 = 8 * (y1 * z1)^3
2906 var z3
= y1z1
.pow(3).shiftLeft(3).mod(this.curve
.p
)
2908 return new Point(this.curve
, x3
, y3
, z3
)
2911 // Simple NAF (Non-Adjacent Form) multiplication algorithm
2912 // TODO: modularize the multiplication algorithm
2913 Point
.prototype.multiply = function (k
) {
2914 if (this.curve
.isInfinity(this)) return this
2915 if (k
.signum() === 0) return this.curve
.infinity
2918 var h
= e
.multiply(THREE
)
2920 var neg
= this.negate()
2923 for (var i
= h
.bitLength() - 2; i
> 0; --i
) {
2924 var hBit
= h
.testBit(i
)
2925 var eBit
= e
.testBit(i
)
2929 if (hBit
!== eBit
) {
2930 R
= R
.add(hBit
? this : neg
)
2937 // Compute this*j + x*k (simultaneous multiplication)
2938 Point
.prototype.multiplyTwo = function (j
, x
, k
) {
2939 var i
= Math
.max(j
.bitLength(), k
.bitLength()) - 1
2940 var R
= this.curve
.infinity
2941 var both
= this.add(x
)
2944 var jBit
= j
.testBit(i
)
2945 var kBit
= k
.testBit(i
)
2964 Point
.prototype.getEncoded = function (compressed
) {
2965 if (compressed
== null) compressed
= this.compressed
2966 if (this.curve
.isInfinity(this)) return Buffer
.alloc(1, 0) // Infinity point encoded is simply '00'
2968 var x
= this.affineX
2969 var y
= this.affineY
2970 var byteLength
= this.curve
.pLength
2975 buffer
= Buffer
.allocUnsafe(1 + byteLength
)
2976 buffer
.writeUInt8(y
.isEven() ? 0x02 : 0x03, 0)
2980 buffer
= Buffer
.allocUnsafe(1 + byteLength
+ byteLength
)
2981 buffer
.writeUInt8(0x04, 0)
2983 y
.toBuffer(byteLength
).copy(buffer
, 1 + byteLength
)
2986 x
.toBuffer(byteLength
).copy(buffer
, 1)
2991 Point
.decodeFrom = function (curve
, buffer
) {
2992 var type
= buffer
.readUInt8(0)
2993 var compressed
= (type
!== 4)
2995 var byteLength
= Math
.floor((curve
.p
.bitLength() + 7) / 8)
2996 var x
= BigInteger
.fromBuffer(buffer
.slice(1, 1 + byteLength
))
3000 assert
.equal(buffer
.length
, byteLength
+ 1, 'Invalid sequence length')
3001 assert(type
=== 0x02 || type
=== 0x03, 'Invalid sequence tag')
3003 var isOdd
= (type
=== 0x03)
3004 Q
= curve
.pointFromX(isOdd
, x
)
3006 assert
.equal(buffer
.length
, 1 + byteLength
+ byteLength
, 'Invalid sequence length')
3008 var y
= BigInteger
.fromBuffer(buffer
.slice(1 + byteLength
))
3009 Q
= Point
.fromAffine(curve
, x
, y
)
3012 Q
.compressed
= compressed
3016 Point
.prototype.toString = function () {
3017 if (this.curve
.isInfinity(this)) return '(INFINITY)'
3019 return '(' + this.affineX
.toString() + ',' + this.affineY
.toString() + ')'
3022 module
.exports
= Point
3024 },{"assert":90,"bigi":25,"safe-buffer":38}],23:[function(require
,module
,exports
){
3025 arguments
[4][3][0].apply(exports
,arguments
)
3026 },{"../package.json":26,"dup":3}],24:[function(require
,module
,exports
){
3027 arguments
[4][4][0].apply(exports
,arguments
)
3028 },{"./bigi":23,"assert":90,"buffer":96,"dup":4}],25:[function(require
,module
,exports
){
3029 arguments
[4][5][0].apply(exports
,arguments
)
3030 },{"./bigi":23,"./convert":24,"dup":5}],26:[function(require
,module
,exports
){
3035 "/home/hashengineering/hashengineering/groestlcoinjs-lib/node_modules/ecurve"
3038 "_from": "bigi@>=1.1.0 <2.0.0",
3039 "_id": "bigi@1.4.2",
3041 "_installable": true,
3042 "_location": "/ecurve/bigi",
3043 "_nodeVersion": "6.1.0",
3044 "_npmOperationalInternal": {
3045 "host": "packages-12-west.internal.npmjs.com",
3046 "tmp": "tmp/bigi-1.4.2.tgz_1469584192413_0.6801238611806184"
3049 "email": "jprichardson@gmail.com",
3050 "name": "jprichardson"
3052 "_npmVersion": "3.8.6",
3053 "_phantomChildren": {},
3056 "raw": "bigi@^1.1.0",
3057 "rawSpec": "^1.1.0",
3059 "spec": ">=1.1.0 <2.0.0",
3065 "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
3066 "_shasum": "9c665a95f88b8b08fc05cfd731f561859d725825",
3067 "_shrinkwrap": null,
3068 "_spec": "bigi@^1.1.0",
3069 "_where": "/home/hashengineering/hashengineering/groestlcoinjs-lib/node_modules/ecurve",
3071 "url": "https://github.com/cryptocoinjs/bigi/issues"
3074 "description": "Big integers.",
3075 "devDependencies": {
3076 "coveralls": "^2.11.2",
3077 "istanbul": "^0.3.5",
3084 "shasum": "9c665a95f88b8b08fc05cfd731f561859d725825",
3085 "tarball": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz"
3087 "gitHead": "c25308081c896ff84702303722bf5ecd8b3f78e3",
3088 "homepage": "https://github.com/cryptocoinjs/bigi#readme",
3106 "main": "./lib/index.js",
3109 "name": "midnightlightning",
3110 "email": "boydb@midnightdesign.ws"
3113 "name": "sidazhang",
3114 "email": "sidazhang89@gmail.com"
3118 "email": "npm@shesek.info"
3121 "name": "jprichardson",
3122 "email": "jprichardson@gmail.com"
3126 "optionalDependencies": {},
3127 "readme": "ERROR: No README data found!",
3130 "url": "git+https://github.com/cryptocoinjs/bigi.git"
3133 "browser-test": "mochify --wd -R spec",
3134 "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
3135 "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info",
3136 "jshint": "jshint --config jshint.json lib/*.js ; true",
3137 "test": "_mocha -- test/*.js",
3142 "android-browser/4.2..latest",
3146 "iphone/6.0..latest",
3147 "safari/6.0..latest"
3149 "files": "test/*.js",
3155 },{}],27:[function(require
,module
,exports
){
3158 var groestl
= require('./lib/groestl');
3159 var h
= require('./lib/helper');
3161 var x11hash
= module
.exports
;
3163 module
.exports
.groestl512 = function(str
,format
, output
) {
3164 return groestl(str
,format
,output
);
3167 module
.exports
.groestl = function(str
,format
, output
) {
3168 var a
= groestl(str
,format
,2);
3173 else if (output
=== 1) {
3174 return h
.int32Buffer2Bytes(a
);
3177 return h
.int32ArrayToHexString(a
);
3181 module
.exports
.groestl_2 = function(str
,format
, output
) {
3182 var a
= groestl(str
,format
,2);
3188 else if (output
=== 1) {
3189 return h
.int32Buffer2Bytes(a
);
3192 return h
.int32ArrayToHexString(a
);
3195 },{"./lib/groestl":28,"./lib/helper":29}],28:[function(require
,module
,exports
){
3196 /////////////////////////////////////
3197 //////////// groestl ///////////////
3199 //// Written by Quantum Explorer ////
3200 ////////// Dash Foundation //////////
3201 /// Released under the MIT License //
3202 /////////////////////////////////////
3204 var o
= require('./op');
3205 var h
= require('./helper');
3207 var T0
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3208 var T1
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3209 var T2
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3210 var T3
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3211 var T4
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3212 var T5
= h
.bytes2Int64Buffer(h
.b64Decode("pfSXpcbGMvSEl+uE+Phvl5mwx5nu7l6wjYz3jfb2eowNF+UN///oF73ct73W1grcscinsd7eFshU/DlUkZFt/FDwwFBgYJDwAwUEAwICBwWp4Iepzs4u4H2HrH1WVtGHGSvVGefnzCtipnFitbUTpuYxmuZNTXwxmrXDmuzsWbVFzwVFj49Az528Pp0fH6O8QMAJQImJScCHku+H+vpokhU/xRXv79A/6yZ/67KylCbJQAfJjo7OQAsd7Qv7++Yd7C+C7EFBbi9nqX1ns7Maqf0cvv1fX0Mc6iWK6kVFYCW/2ka/IyP52vcCpvdTU1EClqHTluTkRaFb7S1bm5t27cJd6sJ1dShdHCTZHOHhxSSu6XquPT3U6Wq+mGpMTPK+Wu7YWmxsgu5Bw/xBfn69wwIG8QL19fMGT9EdT4ODUtFc5NBcaGiM5PQHovRRUVYHNFy5NNHRjVwIGOkI+fnhGJOu35Pi4kyuc5VNc6urPpVT9cRTYmKX9T9BVD8qKmtBDBQQDAgIHBRS9jFSlZVj9mWvjGVGRumvXuIhXp2df+IoeGAoMDBIeKH4bqE3N8/4DxEUDwoKGxG1xF61Ly/rxAkbHAkODhUbNlpINiQkflqbtjabGxuttj1HpT3f35hHJmqBJs3Np2ppu5xpTk71u81M/s1/fzNMn7rPn+rqULobLSQbEhI/LZ65Op4dHaS5dJywdFhYxJwucmguNDRGci13bC02NkF3ss2jstzcEc3uKXPutLSdKfsWtvtbW00W9gFT9qSkpQFN1+xNdnah12GjdWG3txSjzkn6zn19NEl7jaR7UlLfjT5CoT7d3Z9CcZO8cV5ezZOXoiaXExOxovUEV/WmpqIEaLhpaLm5AbgAAAAAAAAAACx0mSzBwbV0YKCAYEBA4KAfId0f4+PCIchD8sh5eTpD7Sx37ba2miy+2bO+1NQN2UbKAUaNjUfK2XDO2WdnF3BL3eRLcnKv3d55M96UlO151Gcr1JiY/2foI3vosLCTI0reEUqFhVvea71ta7u7Br0qfpEqxcW7fuU0nuVPT3s0FjrBFu3t1zrFVBfFhobSVNdiL9eamvhiVf/MVWZmmf+UpyKUERG2p89KD8+KisBKEDDJEOnp2TAGCggGBAQOCoGY54H+/maY8Atb8KCgqwtEzPBEeHi0zLrVSrolJfDV4z6W40tLdT7zDl/zoqKsDv4Zuv5dXUQZwFsbwICA21uKhQqKBQWAha3sfq0/P9PsvN9CvCEh/t9I2OBIcHCo2AQM+QTx8f0M33rG32NjGXrBWO7Bd3cvWHWfRXWvrzCfY6WEY0JC56UwUEAwICBwUBou0Rrl5csuDhLhDv397xJtt2Vtv78It0zUGUyBgVXUFDwwFBgYJDw1X0w1JiZ5Xy9xnS/Dw7Jx4Thn4b6+hjii/WqiNTXI/cxPC8yIiMdPOUtcOS4uZUtX+T1Xk5Nq+fINqvJVVVgNgp3jgvz8YZ1HyfRHenqzyazvi6zIyCfv5zJv57q6iDIrfWQrMjJPfZWk15Xm5kKkoPuboMDAO/uYszKYGRmqs9FoJ9GenvZof4Fdf6OjIoFmqohmRETuqn6CqH5UVNaCq+Z2qzs73eaDnhaDCwuVnspFA8qMjMlFKXuVKcfHvHvTbtbTa2sFbjxEUDwoKGxEeYtVeaenLIviPWPivLyBPR0nLB0WFjEndppBdq2tN5o7Ta0729uWTVb6yFZkZJ76TtLoTnR0ptIeIigeFBQ2Itt2P9uSkuR2Ch4YCgwMEh5stJBsSEj8tOQ3a+S4uI83XeclXZ+feOdusmFuvb0Psu8qhu9DQ2kqpvGTpsTENfGo43KoOTna46T3YqQxMcb3N1m9N9PTilmLhv+L8vJ0hjJWsTLV1YNWQ8UNQ4uLTsVZ69xZbm6F67fCr7fa2hjCjI8CjAEBjo9krHlksbEdrNJtI9KcnPFt4DuS4ElJcju0x6u02Ngfx/oVQ/qsrLkVBwn9B/Pz+gklb4Ulz8+gb6/qj6/KyiDqjonzjvT0fYnpII7pR0dnIBgoIBgQEDgo1WTe1W9vC2SIg/uI8PBzg2+xlG9KSvuxcpa4clxcypYkbHAkODhUbPEIrvFXV18Ix1Lmx3NzIVJR8zVRl5dk8yNljSPLy65lfIRZfKGhJYScv8uc6OhXvyFjfCE+Pl1j3Xw33ZaW6nzcf8LcYWEef4aRGoYNDZyRhZQehQ8Pm5SQq9uQ4OBLq0LG+EJ8fLrGxFfixHFxJleq5YOqzMwp5dhzO9iQkONzBQ8MBQYGCQ8BA/UB9/f0AxI2OBIcHCo2o/6fo8LCPP5f4dRfamqL4fkQR/murr4Q0GvS0GlpAmuRqC6RFxe/qFjoKViZmXHoJ2l0Jzo6U2m50E65Jyf30DhIqTjZ2ZFIEzXNE+vr3jWzzlazKyvlzjNVRDMiIndVu9a/u9LSBNZwkElwqak5kImADokHB4eAp/JmpzMzwfK2wVq2LS3swSJmeCI8PFpmkq0qkhUVuK0gYIkgycmpYEnbFUmHh1zb/xpP/6qqsBp4iKB4UFDYiHqOUXqlpSuOj4oGjwMDiYr4E7L4WVlKE4CbEoAJCZKbFzk0FxoaIznadcraZWUQdTFTtTHX14RTxlETxoSE1VG407u40NAD08NeH8OCgtxesMtSsCkp4st3mbR3WlrDmREzPBEeHi0zy0b2y3t7PUb8H0v8qKi3H9Zh2tZtbQxhOk5YOiwsYk4="));
3213 var T6
= h
.bytes2Int64Buffer(h
.b64Decode("9KX0l6XGxjKXhJfrhPj4b7CZsMeZ7u5ejI2M94329noXDRflDf//6Ny93Le91tYKyLHIp7He3hb8VPw5VJGRbfBQ8MBQYGCQBQMFBAMCAgfgqeCHqc7OLod9h6x9VlbRKxkr1Rnn58ymYqZxYrW1EzHmMZrmTU18tZq1w5rs7FnPRc8FRY+PQLydvD6dHx+jwEDACUCJiUmSh5Lvh/r6aD8VP8UV7+/QJusmf+uyspRAyUAHyY6Ozh0LHe0L+/vmL+wvguxBQW6pZ6l9Z7OzGhz9HL79X19DJeoliupFRWDav9pGvyMj+QL3Aqb3U1NRoZah05bk5EXtW+0tW5ubdl3CXerCdXUoJBwk2Rzh4cXprul6rj091L5qvphqTEzy7lru2FpsbILDQcP8QX5+vQYCBvEC9fXz0U/RHU+Dg1LkXOTQXGhojAf0B6L0UVFWXDRcuTTR0Y0YCBjpCPn54a6Trt+T4uJMlXOVTXOrqz71U/XEU2Jil0E/QVQ/KiprFAwUEAwICBz2UvYxUpWVY69lr4xlRkbp4l7iIV6dnX94KHhgKDAwSPih+G6hNzfPEQ8RFA8KChvEtcRetS8v6xsJGxwJDg4VWjZaSDYkJH62m7Y2mxsbrUc9R6U939+YaiZqgSbNzae7abucaU5O9UzNTP7Nf38zup+6z5/q6lAtGy0kGxISP7meuTqeHR2knHScsHRYWMRyLnJoLjQ0Rnctd2wtNjZBzbLNo7Lc3BEp7ilz7rS0nRb7Frb7W1tNAfYBU/akpKXXTdfsTXZ2oaNho3Vht7cUSc5J+s59fTSNe42ke1JS30I+QqE+3d2fk3GTvHFeXs2il6ImlxMTsQT1BFf1pqaiuGi4aWi5uQEAAAAAAAAAAHQsdJkswcG1oGCggGBAQOAhHyHdH+PjwkPIQ/LIeXk6LO0sd+22tprZvtmzvtTUDcpGygFGjY1HcNlwztlnZxfdS93kS3Jyr3neeTPelJTtZ9RnK9SYmP8j6CN76LCwk95K3hFKhYVbvWu9bWu7uwZ+Kn6RKsXFuzTlNJ7lT097OhY6wRbt7ddUxVQXxYaG0mLXYi/Xmpr4/1X/zFVmZpmnlKcilBERtkrPSg/PiorAMBAwyRDp6dkKBgoIBgQEDpiBmOeB/v5mC/ALW/CgoKvMRMzwRHh4tNW61Uq6JSXwPuM+luNLS3UO8w5f86KirBn+Gbr+XV1EW8BbG8CAgNuFioUKigUFgOyt7H6tPz/T37zfQrwhIf7YSNjgSHBwqAwEDPkE8fH9et96xt9jYxlYwVjuwXd3L591n0V1r68wpWOlhGNCQudQMFBAMCAgcC4aLtEa5eXLEg4S4Q79/e+3bbdlbb+/CNRM1BlMgYFVPBQ8MBQYGCRfNV9MNSYmeXEvcZ0vw8OyOOE4Z+G+vob9ov1qojU1yE/MTwvMiIjHSzlLXDkuLmX5V/k9V5OTag3yDaryVVVYnYKd44L8/GHJR8n0R3p6s++s74usyMgnMucyb+e6uoh9K31kKzIyT6SVpNeV5uZC+6D7m6DAwDuzmLMymBkZqmjRaCfRnp72gX+BXX+joyKqZqqIZkRE7oJ+gqh+VFTW5qvmdqs7O92eg54WgwsLlUXKRQPKjIzJeyl7lSnHx7xu027W02trBUQ8RFA8KChsi3mLVXmnpyw94j1j4ry8gScdJywdFhYxmnaaQXatrTdNO02tO9vblvpW+shWZGSe0k7S6E50dKYiHiIoHhQUNnbbdj/bkpLkHgoeGAoMDBK0bLSQbEhI/DfkN2vkuLiP513nJV2fn3iybrJhbr29DyrvKobvQ0Np8abxk6bExDXjqONyqDk52vek92KkMTHGWTdZvTfT04qGi4b/i/LydFYyVrEy1dWDxUPFDUOLi07rWevcWW5uhcK3wq+32toYj4yPAowBAY6sZKx5ZLGxHW3SbSPSnJzxO+A7kuBJSXLHtMertNjYHxX6FUP6rKy5CQcJ/Qfz8/pvJW+FJc/PoOqv6o+vysogiY6J84709H0g6SCO6UdHZygYKCAYEBA4ZNVk3tVvbwuDiIP7iPDwc7FvsZRvSkr7lnKWuHJcXMpsJGxwJDg4VAjxCK7xV1dfUsdS5sdzcyHzUfM1UZeXZGUjZY0jy8uuhHyEWXyhoSW/nL/LnOjoV2MhY3whPj5dfN18N92Wlup/3H/C3GFhHpGGkRqGDQ2clIWUHoUPD5urkKvbkODgS8ZCxvhCfHy6V8RX4sRxcSblquWDqszMKXPYczvYkJDjDwUPDAUGBgkDAQP1Aff39DYSNjgSHBwq/qP+n6PCwjzhX+HUX2pqixD5EEf5rq6+a9Br0tBpaQKokagukRcXv+hY6ClYmZlxaSdpdCc6OlPQudBOuScn90g4SKk42dmRNRM1zRPr697Os85Wsysr5VUzVUQzIiJ31rvWv7vS0gSQcJBJcKmpOYCJgA6JBweH8qfyZqczM8HBtsFati0t7GYiZngiPDxarZKtKpIVFbhgIGCJIMnJqdtJ2xVJh4dcGv8aT/+qqrCIeIigeFBQ2I56jlF6paUrio+KBo8DA4kT+BOy+FlZSpuAmxKACQmSORc5NBcaGiN12nXK2mVlEFMxU7Ux19eEUcZRE8aEhNXTuNO7uNDQA17DXh/DgoLcy7DLUrApKeKZd5m0d1pawzMRMzwRHh4tRstG9st7ez0f/B9L/Kiot2HWYdrWbW0MTjpOWDosLGI="));
3214 var T7
= h
.bytes2Int64Buffer(h
.b64Decode("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"));
3217 // o.u(0xc632f4a5, 0xf497a5c6), o.u(0xf86f9784, 0x97eb84f8),
3218 // o.u(0xee5eb099, 0xb0c799ee), o.u(0xf67a8c8d, 0x8cf78df6),
3219 // o.u(0xffe8170d, 0x17e50dff), o.u(0xd60adcbd, 0xdcb7bdd6),
3220 // o.u(0xde16c8b1, 0xc8a7b1de), o.u(0x916dfc54, 0xfc395491),
3221 // o.u(0x6090f050, 0xf0c05060), o.u(0x02070503, 0x05040302),
3222 // o.u(0xce2ee0a9, 0xe087a9ce), o.u(0x56d1877d, 0x87ac7d56),
3223 // o.u(0xe7cc2b19, 0x2bd519e7), o.u(0xb513a662, 0xa67162b5),
3224 // o.u(0x4d7c31e6, 0x319ae64d), o.u(0xec59b59a, 0xb5c39aec),
3225 // o.u(0x8f40cf45, 0xcf05458f), o.u(0x1fa3bc9d, 0xbc3e9d1f),
3226 // o.u(0x8949c040, 0xc0094089), o.u(0xfa689287, 0x92ef87fa),
3227 // o.u(0xefd03f15, 0x3fc515ef), o.u(0xb29426eb, 0x267febb2),
3228 // o.u(0x8ece40c9, 0x4007c98e), o.u(0xfbe61d0b, 0x1ded0bfb),
3229 // o.u(0x416e2fec, 0x2f82ec41), o.u(0xb31aa967, 0xa97d67b3),
3230 // o.u(0x5f431cfd, 0x1cbefd5f), o.u(0x456025ea, 0x258aea45),
3231 // o.u(0x23f9dabf, 0xda46bf23), o.u(0x535102f7, 0x02a6f753),
3232 // o.u(0xe445a196, 0xa1d396e4), o.u(0x9b76ed5b, 0xed2d5b9b),
3233 // o.u(0x75285dc2, 0x5deac275), o.u(0xe1c5241c, 0x24d91ce1),
3234 // o.u(0x3dd4e9ae, 0xe97aae3d), o.u(0x4cf2be6a, 0xbe986a4c),
3235 // o.u(0x6c82ee5a, 0xeed85a6c), o.u(0x7ebdc341, 0xc3fc417e),
3236 // o.u(0xf5f30602, 0x06f102f5), o.u(0x8352d14f, 0xd11d4f83),
3237 // o.u(0x688ce45c, 0xe4d05c68), o.u(0x515607f4, 0x07a2f451),
3238 // o.u(0xd18d5c34, 0x5cb934d1), o.u(0xf9e11808, 0x18e908f9),
3239 // o.u(0xe24cae93, 0xaedf93e2), o.u(0xab3e9573, 0x954d73ab),
3240 // o.u(0x6297f553, 0xf5c45362), o.u(0x2a6b413f, 0x41543f2a),
3241 // o.u(0x081c140c, 0x14100c08), o.u(0x9563f652, 0xf6315295),
3242 // o.u(0x46e9af65, 0xaf8c6546), o.u(0x9d7fe25e, 0xe2215e9d),
3243 // o.u(0x30487828, 0x78602830), o.u(0x37cff8a1, 0xf86ea137),
3244 // o.u(0x0a1b110f, 0x11140f0a), o.u(0x2febc4b5, 0xc45eb52f),
3245 // o.u(0x0e151b09, 0x1b1c090e), o.u(0x247e5a36, 0x5a483624),
3246 // o.u(0x1badb69b, 0xb6369b1b), o.u(0xdf98473d, 0x47a53ddf),
3247 // o.u(0xcda76a26, 0x6a8126cd), o.u(0x4ef5bb69, 0xbb9c694e),
3248 // o.u(0x7f334ccd, 0x4cfecd7f), o.u(0xea50ba9f, 0xbacf9fea),
3249 // o.u(0x123f2d1b, 0x2d241b12), o.u(0x1da4b99e, 0xb93a9e1d),
3250 // o.u(0x58c49c74, 0x9cb07458), o.u(0x3446722e, 0x72682e34),
3251 // o.u(0x3641772d, 0x776c2d36), o.u(0xdc11cdb2, 0xcda3b2dc),
3252 // o.u(0xb49d29ee, 0x2973eeb4), o.u(0x5b4d16fb, 0x16b6fb5b),
3253 // o.u(0xa4a501f6, 0x0153f6a4), o.u(0x76a1d74d, 0xd7ec4d76),
3254 // o.u(0xb714a361, 0xa37561b7), o.u(0x7d3449ce, 0x49face7d),
3255 // o.u(0x52df8d7b, 0x8da47b52), o.u(0xdd9f423e, 0x42a13edd),
3256 // o.u(0x5ecd9371, 0x93bc715e), o.u(0x13b1a297, 0xa2269713),
3257 // o.u(0xa6a204f5, 0x0457f5a6), o.u(0xb901b868, 0xb86968b9),
3258 // o.u(0x00000000, 0x00000000), o.u(0xc1b5742c, 0x74992cc1),
3259 // o.u(0x40e0a060, 0xa0806040), o.u(0xe3c2211f, 0x21dd1fe3),
3260 // o.u(0x793a43c8, 0x43f2c879), o.u(0xb69a2ced, 0x2c77edb6),
3261 // o.u(0xd40dd9be, 0xd9b3bed4), o.u(0x8d47ca46, 0xca01468d),
3262 // o.u(0x671770d9, 0x70ced967), o.u(0x72afdd4b, 0xdde44b72),
3263 // o.u(0x94ed79de, 0x7933de94), o.u(0x98ff67d4, 0x672bd498),
3264 // o.u(0xb09323e8, 0x237be8b0), o.u(0x855bde4a, 0xde114a85),
3265 // o.u(0xbb06bd6b, 0xbd6d6bbb), o.u(0xc5bb7e2a, 0x7e912ac5),
3266 // o.u(0x4f7b34e5, 0x349ee54f), o.u(0xedd73a16, 0x3ac116ed),
3267 // o.u(0x86d254c5, 0x5417c586), o.u(0x9af862d7, 0x622fd79a),
3268 // o.u(0x6699ff55, 0xffcc5566), o.u(0x11b6a794, 0xa7229411),
3269 // o.u(0x8ac04acf, 0x4a0fcf8a), o.u(0xe9d93010, 0x30c910e9),
3270 // o.u(0x040e0a06, 0x0a080604), o.u(0xfe669881, 0x98e781fe),
3271 // o.u(0xa0ab0bf0, 0x0b5bf0a0), o.u(0x78b4cc44, 0xccf04478),
3272 // o.u(0x25f0d5ba, 0xd54aba25), o.u(0x4b753ee3, 0x3e96e34b),
3273 // o.u(0xa2ac0ef3, 0x0e5ff3a2), o.u(0x5d4419fe, 0x19bafe5d),
3274 // o.u(0x80db5bc0, 0x5b1bc080), o.u(0x0580858a, 0x850a8a05),
3275 // o.u(0x3fd3ecad, 0xec7ead3f), o.u(0x21fedfbc, 0xdf42bc21),
3276 // o.u(0x70a8d848, 0xd8e04870), o.u(0xf1fd0c04, 0x0cf904f1),
3277 // o.u(0x63197adf, 0x7ac6df63), o.u(0x772f58c1, 0x58eec177),
3278 // o.u(0xaf309f75, 0x9f4575af), o.u(0x42e7a563, 0xa5846342),
3279 // o.u(0x20705030, 0x50403020), o.u(0xe5cb2e1a, 0x2ed11ae5),
3280 // o.u(0xfdef120e, 0x12e10efd), o.u(0xbf08b76d, 0xb7656dbf),
3281 // o.u(0x8155d44c, 0xd4194c81), o.u(0x18243c14, 0x3c301418),
3282 // o.u(0x26795f35, 0x5f4c3526), o.u(0xc3b2712f, 0x719d2fc3),
3283 // o.u(0xbe8638e1, 0x3867e1be), o.u(0x35c8fda2, 0xfd6aa235),
3284 // o.u(0x88c74fcc, 0x4f0bcc88), o.u(0x2e654b39, 0x4b5c392e),
3285 // o.u(0x936af957, 0xf93d5793), o.u(0x55580df2, 0x0daaf255),
3286 // o.u(0xfc619d82, 0x9de382fc), o.u(0x7ab3c947, 0xc9f4477a),
3287 // o.u(0xc827efac, 0xef8bacc8), o.u(0xba8832e7, 0x326fe7ba),
3288 // o.u(0x324f7d2b, 0x7d642b32), o.u(0xe642a495, 0xa4d795e6),
3289 // o.u(0xc03bfba0, 0xfb9ba0c0), o.u(0x19aab398, 0xb3329819),
3290 // o.u(0x9ef668d1, 0x6827d19e), o.u(0xa322817f, 0x815d7fa3),
3291 // o.u(0x44eeaa66, 0xaa886644), o.u(0x54d6827e, 0x82a87e54),
3292 // o.u(0x3bdde6ab, 0xe676ab3b), o.u(0x0b959e83, 0x9e16830b),
3293 // o.u(0x8cc945ca, 0x4503ca8c), o.u(0xc7bc7b29, 0x7b9529c7),
3294 // o.u(0x6b056ed3, 0x6ed6d36b), o.u(0x286c443c, 0x44503c28),
3295 // o.u(0xa72c8b79, 0x8b5579a7), o.u(0xbc813de2, 0x3d63e2bc),
3296 // o.u(0x1631271d, 0x272c1d16), o.u(0xad379a76, 0x9a4176ad),
3297 // o.u(0xdb964d3b, 0x4dad3bdb), o.u(0x649efa56, 0xfac85664),
3298 // o.u(0x74a6d24e, 0xd2e84e74), o.u(0x1436221e, 0x22281e14),
3299 // o.u(0x92e476db, 0x763fdb92), o.u(0x0c121e0a, 0x1e180a0c),
3300 // o.u(0x48fcb46c, 0xb4906c48), o.u(0xb88f37e4, 0x376be4b8),
3301 // o.u(0x9f78e75d, 0xe7255d9f), o.u(0xbd0fb26e, 0xb2616ebd),
3302 // o.u(0x43692aef, 0x2a86ef43), o.u(0xc435f1a6, 0xf193a6c4),
3303 // o.u(0x39dae3a8, 0xe372a839), o.u(0x31c6f7a4, 0xf762a431),
3304 // o.u(0xd38a5937, 0x59bd37d3), o.u(0xf274868b, 0x86ff8bf2),
3305 // o.u(0xd5835632, 0x56b132d5), o.u(0x8b4ec543, 0xc50d438b),
3306 // o.u(0x6e85eb59, 0xebdc596e), o.u(0xda18c2b7, 0xc2afb7da),
3307 // o.u(0x018e8f8c, 0x8f028c01), o.u(0xb11dac64, 0xac7964b1),
3308 // o.u(0x9cf16dd2, 0x6d23d29c), o.u(0x49723be0, 0x3b92e049),
3309 // o.u(0xd81fc7b4, 0xc7abb4d8), o.u(0xacb915fa, 0x1543faac),
3310 // o.u(0xf3fa0907, 0x09fd07f3), o.u(0xcfa06f25, 0x6f8525cf),
3311 // o.u(0xca20eaaf, 0xea8fafca), o.u(0xf47d898e, 0x89f38ef4),
3312 // o.u(0x476720e9, 0x208ee947), o.u(0x10382818, 0x28201810),
3313 // o.u(0x6f0b64d5, 0x64ded56f), o.u(0xf0738388, 0x83fb88f0),
3314 // o.u(0x4afbb16f, 0xb1946f4a), o.u(0x5cca9672, 0x96b8725c),
3315 // o.u(0x38546c24, 0x6c702438), o.u(0x575f08f1, 0x08aef157),
3316 // o.u(0x732152c7, 0x52e6c773), o.u(0x9764f351, 0xf3355197),
3317 // o.u(0xcbae6523, 0x658d23cb), o.u(0xa125847c, 0x84597ca1),
3318 // o.u(0xe857bf9c, 0xbfcb9ce8), o.u(0x3e5d6321, 0x637c213e),
3319 // o.u(0x96ea7cdd, 0x7c37dd96), o.u(0x611e7fdc, 0x7fc2dc61),
3320 // o.u(0x0d9c9186, 0x911a860d), o.u(0x0f9b9485, 0x941e850f),
3321 // o.u(0xe04bab90, 0xabdb90e0), o.u(0x7cbac642, 0xc6f8427c),
3322 // o.u(0x712657c4, 0x57e2c471), o.u(0xcc29e5aa, 0xe583aacc),
3323 // o.u(0x90e373d8, 0x733bd890), o.u(0x06090f05, 0x0f0c0506),
3324 // o.u(0xf7f40301, 0x03f501f7), o.u(0x1c2a3612, 0x3638121c),
3325 // o.u(0xc23cfea3, 0xfe9fa3c2), o.u(0x6a8be15f, 0xe1d45f6a),
3326 // o.u(0xaebe10f9, 0x1047f9ae), o.u(0x69026bd0, 0x6bd2d069),
3327 // o.u(0x17bfa891, 0xa82e9117), o.u(0x9971e858, 0xe8295899),
3328 // o.u(0x3a536927, 0x6974273a), o.u(0x27f7d0b9, 0xd04eb927),
3329 // o.u(0xd9914838, 0x48a938d9), o.u(0xebde3513, 0x35cd13eb),
3330 // o.u(0x2be5ceb3, 0xce56b32b), o.u(0x22775533, 0x55443322),
3331 // o.u(0xd204d6bb, 0xd6bfbbd2), o.u(0xa9399070, 0x904970a9),
3332 // o.u(0x07878089, 0x800e8907), o.u(0x33c1f2a7, 0xf266a733),
3333 // o.u(0x2decc1b6, 0xc15ab62d), o.u(0x3c5a6622, 0x6678223c),
3334 // o.u(0x15b8ad92, 0xad2a9215), o.u(0xc9a96020, 0x608920c9),
3335 // o.u(0x875cdb49, 0xdb154987), o.u(0xaab01aff, 0x1a4fffaa),
3336 // o.u(0x50d88878, 0x88a07850), o.u(0xa52b8e7a, 0x8e517aa5),
3337 // o.u(0x03898a8f, 0x8a068f03), o.u(0x594a13f8, 0x13b2f859),
3338 // o.u(0x09929b80, 0x9b128009), o.u(0x1a233917, 0x3934171a),
3339 // o.u(0x651075da, 0x75cada65), o.u(0xd7845331, 0x53b531d7),
3340 // o.u(0x84d551c6, 0x5113c684), o.u(0xd003d3b8, 0xd3bbb8d0),
3341 // o.u(0x82dc5ec3, 0x5e1fc382), o.u(0x29e2cbb0, 0xcb52b029),
3342 // o.u(0x5ac39977, 0x99b4775a), o.u(0x1e2d3311, 0x333c111e),
3343 // o.u(0x7b3d46cb, 0x46f6cb7b), o.u(0xa8b71ffc, 0x1f4bfca8),
3344 // o.u(0x6d0c61d6, 0x61dad66d), o.u(0x2c624e3a, 0x4e583a2c)
3348 // o.u(0xc6c632f4, 0xa5f497a5), o.u(0xf8f86f97, 0x8497eb84),
3349 // o.u(0xeeee5eb0, 0x99b0c799), o.u(0xf6f67a8c, 0x8d8cf78d),
3350 // o.u(0xffffe817, 0xd17e50d), o.u(0xd6d60adc, 0xbddcb7bd),
3351 // o.u(0xdede16c8, 0xb1c8a7b1), o.u(0x91916dfc, 0x54fc3954),
3352 // o.u(0x606090f0, 0x50f0c050), o.u(0x2020705, 0x3050403),
3353 // o.u(0xcece2ee0, 0xa9e087a9), o.u(0x5656d187, 0x7d87ac7d),
3354 // o.u(0xe7e7cc2b, 0x192bd519), o.u(0xb5b513a6, 0x62a67162),
3355 // o.u(0x4d4d7c31, 0xe6319ae6), o.u(0xecec59b5, 0x9ab5c39a),
3356 // o.u(0x8f8f40cf, 0x45cf0545), o.u(0x1f1fa3bc, 0x9dbc3e9d),
3357 // o.u(0x898949c0, 0x40c00940), o.u(0xfafa6892, 0x8792ef87),
3358 // o.u(0xefefd03f, 0x153fc515), o.u(0xb2b29426, 0xeb267feb),
3359 // o.u(0x8e8ece40, 0xc94007c9), o.u(0xfbfbe61d, 0xb1ded0b),
3360 // o.u(0x41416e2f, 0xec2f82ec), o.u(0xb3b31aa9, 0x67a97d67),
3361 // o.u(0x5f5f431c, 0xfd1cbefd), o.u(0x45456025, 0xea258aea),
3362 // o.u(0x2323f9da, 0xbfda46bf), o.u(0x53535102, 0xf702a6f7),
3363 // o.u(0xe4e445a1, 0x96a1d396), o.u(0x9b9b76ed, 0x5bed2d5b),
3364 // o.u(0x7575285d, 0xc25deac2), o.u(0xe1e1c524, 0x1c24d91c),
3365 // o.u(0x3d3dd4e9, 0xaee97aae), o.u(0x4c4cf2be, 0x6abe986a),
3366 // o.u(0x6c6c82ee, 0x5aeed85a), o.u(0x7e7ebdc3, 0x41c3fc41),
3367 // o.u(0xf5f5f306, 0x206f102), o.u(0x838352d1, 0x4fd11d4f),
3368 // o.u(0x68688ce4, 0x5ce4d05c), o.u(0x51515607, 0xf407a2f4),
3369 // o.u(0xd1d18d5c, 0x345cb934), o.u(0xf9f9e118, 0x818e908),
3370 // o.u(0xe2e24cae, 0x93aedf93), o.u(0xabab3e95, 0x73954d73),
3371 // o.u(0x626297f5, 0x53f5c453), o.u(0x2a2a6b41, 0x3f41543f),
3372 // o.u(0x8081c14, 0xc14100c), o.u(0x959563f6, 0x52f63152),
3373 // o.u(0x4646e9af, 0x65af8c65), o.u(0x9d9d7fe2, 0x5ee2215e),
3374 // o.u(0x30304878, 0x28786028), o.u(0x3737cff8, 0xa1f86ea1),
3375 // o.u(0xa0a1b11, 0xf11140f), o.u(0x2f2febc4, 0xb5c45eb5),
3376 // o.u(0xe0e151b, 0x91b1c09), o.u(0x24247e5a, 0x365a4836),
3377 // o.u(0x1b1badb6, 0x9bb6369b), o.u(0xdfdf9847, 0x3d47a53d),
3378 // o.u(0xcdcda76a, 0x266a8126), o.u(0x4e4ef5bb, 0x69bb9c69),
3379 // o.u(0x7f7f334c, 0xcd4cfecd), o.u(0xeaea50ba, 0x9fbacf9f),
3380 // o.u(0x12123f2d, 0x1b2d241b), o.u(0x1d1da4b9, 0x9eb93a9e),
3381 // o.u(0x5858c49c, 0x749cb074), o.u(0x34344672, 0x2e72682e),
3382 // o.u(0x36364177, 0x2d776c2d), o.u(0xdcdc11cd, 0xb2cda3b2),
3383 // o.u(0xb4b49d29, 0xee2973ee), o.u(0x5b5b4d16, 0xfb16b6fb),
3384 // o.u(0xa4a4a501, 0xf60153f6), o.u(0x7676a1d7, 0x4dd7ec4d),
3385 // o.u(0xb7b714a3, 0x61a37561), o.u(0x7d7d3449, 0xce49face),
3386 // o.u(0x5252df8d, 0x7b8da47b), o.u(0xdddd9f42, 0x3e42a13e),
3387 // o.u(0x5e5ecd93, 0x7193bc71), o.u(0x1313b1a2, 0x97a22697),
3388 // o.u(0xa6a6a204, 0xf50457f5), o.u(0xb9b901b8, 0x68b86968),
3389 // o.u(0x0, 0x0), o.u(0xc1c1b574, 0x2c74992c),
3390 // o.u(0x4040e0a0, 0x60a08060), o.u(0xe3e3c221, 0x1f21dd1f),
3391 // o.u(0x79793a43, 0xc843f2c8), o.u(0xb6b69a2c, 0xed2c77ed),
3392 // o.u(0xd4d40dd9, 0xbed9b3be), o.u(0x8d8d47ca, 0x46ca0146),
3393 // o.u(0x67671770, 0xd970ced9), o.u(0x7272afdd, 0x4bdde44b),
3394 // o.u(0x9494ed79, 0xde7933de), o.u(0x9898ff67, 0xd4672bd4),
3395 // o.u(0xb0b09323, 0xe8237be8), o.u(0x85855bde, 0x4ade114a),
3396 // o.u(0xbbbb06bd, 0x6bbd6d6b), o.u(0xc5c5bb7e, 0x2a7e912a),
3397 // o.u(0x4f4f7b34, 0xe5349ee5), o.u(0xededd73a, 0x163ac116),
3398 // o.u(0x8686d254, 0xc55417c5), o.u(0x9a9af862, 0xd7622fd7),
3399 // o.u(0x666699ff, 0x55ffcc55), o.u(0x1111b6a7, 0x94a72294),
3400 // o.u(0x8a8ac04a, 0xcf4a0fcf), o.u(0xe9e9d930, 0x1030c910),
3401 // o.u(0x4040e0a, 0x60a0806), o.u(0xfefe6698, 0x8198e781),
3402 // o.u(0xa0a0ab0b, 0xf00b5bf0), o.u(0x7878b4cc, 0x44ccf044),
3403 // o.u(0x2525f0d5, 0xbad54aba), o.u(0x4b4b753e, 0xe33e96e3),
3404 // o.u(0xa2a2ac0e, 0xf30e5ff3), o.u(0x5d5d4419, 0xfe19bafe),
3405 // o.u(0x8080db5b, 0xc05b1bc0), o.u(0x5058085, 0x8a850a8a),
3406 // o.u(0x3f3fd3ec, 0xadec7ead), o.u(0x2121fedf, 0xbcdf42bc),
3407 // o.u(0x7070a8d8, 0x48d8e048), o.u(0xf1f1fd0c, 0x40cf904),
3408 // o.u(0x6363197a, 0xdf7ac6df), o.u(0x77772f58, 0xc158eec1),
3409 // o.u(0xafaf309f, 0x759f4575), o.u(0x4242e7a5, 0x63a58463),
3410 // o.u(0x20207050, 0x30504030), o.u(0xe5e5cb2e, 0x1a2ed11a),
3411 // o.u(0xfdfdef12, 0xe12e10e), o.u(0xbfbf08b7, 0x6db7656d),
3412 // o.u(0x818155d4, 0x4cd4194c), o.u(0x1818243c, 0x143c3014),
3413 // o.u(0x2626795f, 0x355f4c35), o.u(0xc3c3b271, 0x2f719d2f),
3414 // o.u(0xbebe8638, 0xe13867e1), o.u(0x3535c8fd, 0xa2fd6aa2),
3415 // o.u(0x8888c74f, 0xcc4f0bcc), o.u(0x2e2e654b, 0x394b5c39),
3416 // o.u(0x93936af9, 0x57f93d57), o.u(0x5555580d, 0xf20daaf2),
3417 // o.u(0xfcfc619d, 0x829de382), o.u(0x7a7ab3c9, 0x47c9f447),
3418 // o.u(0xc8c827ef, 0xacef8bac), o.u(0xbaba8832, 0xe7326fe7),
3419 // o.u(0x32324f7d, 0x2b7d642b), o.u(0xe6e642a4, 0x95a4d795),
3420 // o.u(0xc0c03bfb, 0xa0fb9ba0), o.u(0x1919aab3, 0x98b33298),
3421 // o.u(0x9e9ef668, 0xd16827d1), o.u(0xa3a32281, 0x7f815d7f),
3422 // o.u(0x4444eeaa, 0x66aa8866), o.u(0x5454d682, 0x7e82a87e),
3423 // o.u(0x3b3bdde6, 0xabe676ab), o.u(0xb0b959e, 0x839e1683),
3424 // o.u(0x8c8cc945, 0xca4503ca), o.u(0xc7c7bc7b, 0x297b9529),
3425 // o.u(0x6b6b056e, 0xd36ed6d3), o.u(0x28286c44, 0x3c44503c),
3426 // o.u(0xa7a72c8b, 0x798b5579), o.u(0xbcbc813d, 0xe23d63e2),
3427 // o.u(0x16163127, 0x1d272c1d), o.u(0xadad379a, 0x769a4176),
3428 // o.u(0xdbdb964d, 0x3b4dad3b), o.u(0x64649efa, 0x56fac856),
3429 // o.u(0x7474a6d2, 0x4ed2e84e), o.u(0x14143622, 0x1e22281e),
3430 // o.u(0x9292e476, 0xdb763fdb), o.u(0xc0c121e, 0xa1e180a),
3431 // o.u(0x4848fcb4, 0x6cb4906c), o.u(0xb8b88f37, 0xe4376be4),
3432 // o.u(0x9f9f78e7, 0x5de7255d), o.u(0xbdbd0fb2, 0x6eb2616e),
3433 // o.u(0x4343692a, 0xef2a86ef), o.u(0xc4c435f1, 0xa6f193a6),
3434 // o.u(0x3939dae3, 0xa8e372a8), o.u(0x3131c6f7, 0xa4f762a4),
3435 // o.u(0xd3d38a59, 0x3759bd37), o.u(0xf2f27486, 0x8b86ff8b),
3436 // o.u(0xd5d58356, 0x3256b132), o.u(0x8b8b4ec5, 0x43c50d43),
3437 // o.u(0x6e6e85eb, 0x59ebdc59), o.u(0xdada18c2, 0xb7c2afb7),
3438 // o.u(0x1018e8f, 0x8c8f028c), o.u(0xb1b11dac, 0x64ac7964),
3439 // o.u(0x9c9cf16d, 0xd26d23d2), o.u(0x4949723b, 0xe03b92e0),
3440 // o.u(0xd8d81fc7, 0xb4c7abb4), o.u(0xacacb915, 0xfa1543fa),
3441 // o.u(0xf3f3fa09, 0x709fd07), o.u(0xcfcfa06f, 0x256f8525),
3442 // o.u(0xcaca20ea, 0xafea8faf), o.u(0xf4f47d89, 0x8e89f38e),
3443 // o.u(0x47476720, 0xe9208ee9), o.u(0x10103828, 0x18282018),
3444 // o.u(0x6f6f0b64, 0xd564ded5), o.u(0xf0f07383, 0x8883fb88),
3445 // o.u(0x4a4afbb1, 0x6fb1946f), o.u(0x5c5cca96, 0x7296b872),
3446 // o.u(0x3838546c, 0x246c7024), o.u(0x57575f08, 0xf108aef1),
3447 // o.u(0x73732152, 0xc752e6c7), o.u(0x979764f3, 0x51f33551),
3448 // o.u(0xcbcbae65, 0x23658d23), o.u(0xa1a12584, 0x7c84597c),
3449 // o.u(0xe8e857bf, 0x9cbfcb9c), o.u(0x3e3e5d63, 0x21637c21),
3450 // o.u(0x9696ea7c, 0xdd7c37dd), o.u(0x61611e7f, 0xdc7fc2dc),
3451 // o.u(0xd0d9c91, 0x86911a86), o.u(0xf0f9b94, 0x85941e85),
3452 // o.u(0xe0e04bab, 0x90abdb90), o.u(0x7c7cbac6, 0x42c6f842),
3453 // o.u(0x71712657, 0xc457e2c4), o.u(0xcccc29e5, 0xaae583aa),
3454 // o.u(0x9090e373, 0xd8733bd8), o.u(0x606090f, 0x50f0c05),
3455 // o.u(0xf7f7f403, 0x103f501), o.u(0x1c1c2a36, 0x12363812),
3456 // o.u(0xc2c23cfe, 0xa3fe9fa3), o.u(0x6a6a8be1, 0x5fe1d45f),
3457 // o.u(0xaeaebe10, 0xf91047f9), o.u(0x6969026b, 0xd06bd2d0),
3458 // o.u(0x1717bfa8, 0x91a82e91), o.u(0x999971e8, 0x58e82958),
3459 // o.u(0x3a3a5369, 0x27697427), o.u(0x2727f7d0, 0xb9d04eb9),
3460 // o.u(0xd9d99148, 0x3848a938), o.u(0xebebde35, 0x1335cd13),
3461 // o.u(0x2b2be5ce, 0xb3ce56b3), o.u(0x22227755, 0x33554433),
3462 // o.u(0xd2d204d6, 0xbbd6bfbb), o.u(0xa9a93990, 0x70904970),
3463 // o.u(0x7078780, 0x89800e89), o.u(0x3333c1f2, 0xa7f266a7),
3464 // o.u(0x2d2decc1, 0xb6c15ab6), o.u(0x3c3c5a66, 0x22667822),
3465 // o.u(0x1515b8ad, 0x92ad2a92), o.u(0xc9c9a960, 0x20608920),
3466 // o.u(0x87875cdb, 0x49db1549), o.u(0xaaaab01a, 0xff1a4fff),
3467 // o.u(0x5050d888, 0x7888a078), o.u(0xa5a52b8e, 0x7a8e517a),
3468 // o.u(0x303898a, 0x8f8a068f), o.u(0x59594a13, 0xf813b2f8),
3469 // o.u(0x909929b, 0x809b1280), o.u(0x1a1a2339, 0x17393417),
3470 // o.u(0x65651075, 0xda75cada), o.u(0xd7d78453, 0x3153b531),
3471 // o.u(0x8484d551, 0xc65113c6), o.u(0xd0d003d3, 0xb8d3bbb8),
3472 // o.u(0x8282dc5e, 0xc35e1fc3), o.u(0x2929e2cb, 0xb0cb52b0),
3473 // o.u(0x5a5ac399, 0x7799b477), o.u(0x1e1e2d33, 0x11333c11),
3474 // o.u(0x7b7b3d46, 0xcb46f6cb), o.u(0xa8a8b71f, 0xfc1f4bfc),
3475 // o.u(0x6d6d0c61, 0xd661dad6), o.u(0x2c2c624e, 0x3a4e583a)
3479 // o.u(0xa5c6c632, 0xf4a5f497), o.u(0x84f8f86f, 0x978497eb),
3480 // o.u(0x99eeee5e, 0xb099b0c7), o.u(0x8df6f67a, 0x8c8d8cf7),
3481 // o.u(0xdffffe8, 0x170d17e5), o.u(0xbdd6d60a, 0xdcbddcb7),
3482 // o.u(0xb1dede16, 0xc8b1c8a7), o.u(0x5491916d, 0xfc54fc39),
3483 // o.u(0x50606090, 0xf050f0c0), o.u(0x3020207, 0x5030504),
3484 // o.u(0xa9cece2e, 0xe0a9e087), o.u(0x7d5656d1, 0x877d87ac),
3485 // o.u(0x19e7e7cc, 0x2b192bd5), o.u(0x62b5b513, 0xa662a671),
3486 // o.u(0xe64d4d7c, 0x31e6319a), o.u(0x9aecec59, 0xb59ab5c3),
3487 // o.u(0x458f8f40, 0xcf45cf05), o.u(0x9d1f1fa3, 0xbc9dbc3e),
3488 // o.u(0x40898949, 0xc040c009), o.u(0x87fafa68, 0x928792ef),
3489 // o.u(0x15efefd0, 0x3f153fc5), o.u(0xebb2b294, 0x26eb267f),
3490 // o.u(0xc98e8ece, 0x40c94007), o.u(0xbfbfbe6, 0x1d0b1ded),
3491 // o.u(0xec41416e, 0x2fec2f82), o.u(0x67b3b31a, 0xa967a97d),
3492 // o.u(0xfd5f5f43, 0x1cfd1cbe), o.u(0xea454560, 0x25ea258a),
3493 // o.u(0xbf2323f9, 0xdabfda46), o.u(0xf7535351, 0x2f702a6),
3494 // o.u(0x96e4e445, 0xa196a1d3), o.u(0x5b9b9b76, 0xed5bed2d),
3495 // o.u(0xc2757528, 0x5dc25dea), o.u(0x1ce1e1c5, 0x241c24d9),
3496 // o.u(0xae3d3dd4, 0xe9aee97a), o.u(0x6a4c4cf2, 0xbe6abe98),
3497 // o.u(0x5a6c6c82, 0xee5aeed8), o.u(0x417e7ebd, 0xc341c3fc),
3498 // o.u(0x2f5f5f3, 0x60206f1), o.u(0x4f838352, 0xd14fd11d),
3499 // o.u(0x5c68688c, 0xe45ce4d0), o.u(0xf4515156, 0x7f407a2),
3500 // o.u(0x34d1d18d, 0x5c345cb9), o.u(0x8f9f9e1, 0x180818e9),
3501 // o.u(0x93e2e24c, 0xae93aedf), o.u(0x73abab3e, 0x9573954d),
3502 // o.u(0x53626297, 0xf553f5c4), o.u(0x3f2a2a6b, 0x413f4154),
3503 // o.u(0xc08081c, 0x140c1410), o.u(0x52959563, 0xf652f631),
3504 // o.u(0x654646e9, 0xaf65af8c), o.u(0x5e9d9d7f, 0xe25ee221),
3505 // o.u(0x28303048, 0x78287860), o.u(0xa13737cf, 0xf8a1f86e),
3506 // o.u(0xf0a0a1b, 0x110f1114), o.u(0xb52f2feb, 0xc4b5c45e),
3507 // o.u(0x90e0e15, 0x1b091b1c), o.u(0x3624247e, 0x5a365a48),
3508 // o.u(0x9b1b1bad, 0xb69bb636), o.u(0x3ddfdf98, 0x473d47a5),
3509 // o.u(0x26cdcda7, 0x6a266a81), o.u(0x694e4ef5, 0xbb69bb9c),
3510 // o.u(0xcd7f7f33, 0x4ccd4cfe), o.u(0x9feaea50, 0xba9fbacf),
3511 // o.u(0x1b12123f, 0x2d1b2d24), o.u(0x9e1d1da4, 0xb99eb93a),
3512 // o.u(0x745858c4, 0x9c749cb0), o.u(0x2e343446, 0x722e7268),
3513 // o.u(0x2d363641, 0x772d776c), o.u(0xb2dcdc11, 0xcdb2cda3),
3514 // o.u(0xeeb4b49d, 0x29ee2973), o.u(0xfb5b5b4d, 0x16fb16b6),
3515 // o.u(0xf6a4a4a5, 0x1f60153), o.u(0x4d7676a1, 0xd74dd7ec),
3516 // o.u(0x61b7b714, 0xa361a375), o.u(0xce7d7d34, 0x49ce49fa),
3517 // o.u(0x7b5252df, 0x8d7b8da4), o.u(0x3edddd9f, 0x423e42a1),
3518 // o.u(0x715e5ecd, 0x937193bc), o.u(0x971313b1, 0xa297a226),
3519 // o.u(0xf5a6a6a2, 0x4f50457), o.u(0x68b9b901, 0xb868b869),
3520 // o.u(0x0, 0x0), o.u(0x2cc1c1b5, 0x742c7499),
3521 // o.u(0x604040e0, 0xa060a080), o.u(0x1fe3e3c2, 0x211f21dd),
3522 // o.u(0xc879793a, 0x43c843f2), o.u(0xedb6b69a, 0x2ced2c77),
3523 // o.u(0xbed4d40d, 0xd9bed9b3), o.u(0x468d8d47, 0xca46ca01),
3524 // o.u(0xd9676717, 0x70d970ce), o.u(0x4b7272af, 0xdd4bdde4),
3525 // o.u(0xde9494ed, 0x79de7933), o.u(0xd49898ff, 0x67d4672b),
3526 // o.u(0xe8b0b093, 0x23e8237b), o.u(0x4a85855b, 0xde4ade11),
3527 // o.u(0x6bbbbb06, 0xbd6bbd6d), o.u(0x2ac5c5bb, 0x7e2a7e91),
3528 // o.u(0xe54f4f7b, 0x34e5349e), o.u(0x16ededd7, 0x3a163ac1),
3529 // o.u(0xc58686d2, 0x54c55417), o.u(0xd79a9af8, 0x62d7622f),
3530 // o.u(0x55666699, 0xff55ffcc), o.u(0x941111b6, 0xa794a722),
3531 // o.u(0xcf8a8ac0, 0x4acf4a0f), o.u(0x10e9e9d9, 0x301030c9),
3532 // o.u(0x604040e, 0xa060a08), o.u(0x81fefe66, 0x988198e7),
3533 // o.u(0xf0a0a0ab, 0xbf00b5b), o.u(0x447878b4, 0xcc44ccf0),
3534 // o.u(0xba2525f0, 0xd5bad54a), o.u(0xe34b4b75, 0x3ee33e96),
3535 // o.u(0xf3a2a2ac, 0xef30e5f), o.u(0xfe5d5d44, 0x19fe19ba),
3536 // o.u(0xc08080db, 0x5bc05b1b), o.u(0x8a050580, 0x858a850a),
3537 // o.u(0xad3f3fd3, 0xecadec7e), o.u(0xbc2121fe, 0xdfbcdf42),
3538 // o.u(0x487070a8, 0xd848d8e0), o.u(0x4f1f1fd, 0xc040cf9),
3539 // o.u(0xdf636319, 0x7adf7ac6), o.u(0xc177772f, 0x58c158ee),
3540 // o.u(0x75afaf30, 0x9f759f45), o.u(0x634242e7, 0xa563a584),
3541 // o.u(0x30202070, 0x50305040), o.u(0x1ae5e5cb, 0x2e1a2ed1),
3542 // o.u(0xefdfdef, 0x120e12e1), o.u(0x6dbfbf08, 0xb76db765),
3543 // o.u(0x4c818155, 0xd44cd419), o.u(0x14181824, 0x3c143c30),
3544 // o.u(0x35262679, 0x5f355f4c), o.u(0x2fc3c3b2, 0x712f719d),
3545 // o.u(0xe1bebe86, 0x38e13867), o.u(0xa23535c8, 0xfda2fd6a),
3546 // o.u(0xcc8888c7, 0x4fcc4f0b), o.u(0x392e2e65, 0x4b394b5c),
3547 // o.u(0x5793936a, 0xf957f93d), o.u(0xf2555558, 0xdf20daa),
3548 // o.u(0x82fcfc61, 0x9d829de3), o.u(0x477a7ab3, 0xc947c9f4),
3549 // o.u(0xacc8c827, 0xefacef8b), o.u(0xe7baba88, 0x32e7326f),
3550 // o.u(0x2b32324f, 0x7d2b7d64), o.u(0x95e6e642, 0xa495a4d7),
3551 // o.u(0xa0c0c03b, 0xfba0fb9b), o.u(0x981919aa, 0xb398b332),
3552 // o.u(0xd19e9ef6, 0x68d16827), o.u(0x7fa3a322, 0x817f815d),
3553 // o.u(0x664444ee, 0xaa66aa88), o.u(0x7e5454d6, 0x827e82a8),
3554 // o.u(0xab3b3bdd, 0xe6abe676), o.u(0x830b0b95, 0x9e839e16),
3555 // o.u(0xca8c8cc9, 0x45ca4503), o.u(0x29c7c7bc, 0x7b297b95),
3556 // o.u(0xd36b6b05, 0x6ed36ed6), o.u(0x3c28286c, 0x443c4450),
3557 // o.u(0x79a7a72c, 0x8b798b55), o.u(0xe2bcbc81, 0x3de23d63),
3558 // o.u(0x1d161631, 0x271d272c), o.u(0x76adad37, 0x9a769a41),
3559 // o.u(0x3bdbdb96, 0x4d3b4dad), o.u(0x5664649e, 0xfa56fac8),
3560 // o.u(0x4e7474a6, 0xd24ed2e8), o.u(0x1e141436, 0x221e2228),
3561 // o.u(0xdb9292e4, 0x76db763f), o.u(0xa0c0c12, 0x1e0a1e18),
3562 // o.u(0x6c4848fc, 0xb46cb490), o.u(0xe4b8b88f, 0x37e4376b),
3563 // o.u(0x5d9f9f78, 0xe75de725), o.u(0x6ebdbd0f, 0xb26eb261),
3564 // o.u(0xef434369, 0x2aef2a86), o.u(0xa6c4c435, 0xf1a6f193),
3565 // o.u(0xa83939da, 0xe3a8e372), o.u(0xa43131c6, 0xf7a4f762),
3566 // o.u(0x37d3d38a, 0x593759bd), o.u(0x8bf2f274, 0x868b86ff),
3567 // o.u(0x32d5d583, 0x563256b1), o.u(0x438b8b4e, 0xc543c50d),
3568 // o.u(0x596e6e85, 0xeb59ebdc), o.u(0xb7dada18, 0xc2b7c2af),
3569 // o.u(0x8c01018e, 0x8f8c8f02), o.u(0x64b1b11d, 0xac64ac79),
3570 // o.u(0xd29c9cf1, 0x6dd26d23), o.u(0xe0494972, 0x3be03b92),
3571 // o.u(0xb4d8d81f, 0xc7b4c7ab), o.u(0xfaacacb9, 0x15fa1543),
3572 // o.u(0x7f3f3fa, 0x90709fd), o.u(0x25cfcfa0, 0x6f256f85),
3573 // o.u(0xafcaca20, 0xeaafea8f), o.u(0x8ef4f47d, 0x898e89f3),
3574 // o.u(0xe9474767, 0x20e9208e), o.u(0x18101038, 0x28182820),
3575 // o.u(0xd56f6f0b, 0x64d564de), o.u(0x88f0f073, 0x838883fb),
3576 // o.u(0x6f4a4afb, 0xb16fb194), o.u(0x725c5cca, 0x967296b8),
3577 // o.u(0x24383854, 0x6c246c70), o.u(0xf157575f, 0x8f108ae),
3578 // o.u(0xc7737321, 0x52c752e6), o.u(0x51979764, 0xf351f335),
3579 // o.u(0x23cbcbae, 0x6523658d), o.u(0x7ca1a125, 0x847c8459),
3580 // o.u(0x9ce8e857, 0xbf9cbfcb), o.u(0x213e3e5d, 0x6321637c),
3581 // o.u(0xdd9696ea, 0x7cdd7c37), o.u(0xdc61611e, 0x7fdc7fc2),
3582 // o.u(0x860d0d9c, 0x9186911a), o.u(0x850f0f9b, 0x9485941e),
3583 // o.u(0x90e0e04b, 0xab90abdb), o.u(0x427c7cba, 0xc642c6f8),
3584 // o.u(0xc4717126, 0x57c457e2), o.u(0xaacccc29, 0xe5aae583),
3585 // o.u(0xd89090e3, 0x73d8733b), o.u(0x5060609, 0xf050f0c),
3586 // o.u(0x1f7f7f4, 0x30103f5), o.u(0x121c1c2a, 0x36123638),
3587 // o.u(0xa3c2c23c, 0xfea3fe9f), o.u(0x5f6a6a8b, 0xe15fe1d4),
3588 // o.u(0xf9aeaebe, 0x10f91047), o.u(0xd0696902, 0x6bd06bd2),
3589 // o.u(0x911717bf, 0xa891a82e), o.u(0x58999971, 0xe858e829),
3590 // o.u(0x273a3a53, 0x69276974), o.u(0xb92727f7, 0xd0b9d04e),
3591 // o.u(0x38d9d991, 0x483848a9), o.u(0x13ebebde, 0x351335cd),
3592 // o.u(0xb32b2be5, 0xceb3ce56), o.u(0x33222277, 0x55335544),
3593 // o.u(0xbbd2d204, 0xd6bbd6bf), o.u(0x70a9a939, 0x90709049),
3594 // o.u(0x89070787, 0x8089800e), o.u(0xa73333c1, 0xf2a7f266),
3595 // o.u(0xb62d2dec, 0xc1b6c15a), o.u(0x223c3c5a, 0x66226678),
3596 // o.u(0x921515b8, 0xad92ad2a), o.u(0x20c9c9a9, 0x60206089),
3597 // o.u(0x4987875c, 0xdb49db15), o.u(0xffaaaab0, 0x1aff1a4f),
3598 // o.u(0x785050d8, 0x887888a0), o.u(0x7aa5a52b, 0x8e7a8e51),
3599 // o.u(0x8f030389, 0x8a8f8a06), o.u(0xf859594a, 0x13f813b2),
3600 // o.u(0x80090992, 0x9b809b12), o.u(0x171a1a23, 0x39173934),
3601 // o.u(0xda656510, 0x75da75ca), o.u(0x31d7d784, 0x533153b5),
3602 // o.u(0xc68484d5, 0x51c65113), o.u(0xb8d0d003, 0xd3b8d3bb),
3603 // o.u(0xc38282dc, 0x5ec35e1f), o.u(0xb02929e2, 0xcbb0cb52),
3604 // o.u(0x775a5ac3, 0x997799b4), o.u(0x111e1e2d, 0x3311333c),
3605 // o.u(0xcb7b7b3d, 0x46cb46f6), o.u(0xfca8a8b7, 0x1ffc1f4b),
3606 // o.u(0xd66d6d0c, 0x61d661da), o.u(0x3a2c2c62, 0x4e3a4e58)
3610 // o.u(0x97a5c6c6, 0x32f4a5f4), o.u(0xeb84f8f8, 0x6f978497),
3611 // o.u(0xc799eeee, 0x5eb099b0), o.u(0xf78df6f6, 0x7a8c8d8c),
3612 // o.u(0xe50dffff, 0xe8170d17), o.u(0xb7bdd6d6, 0xadcbddc),
3613 // o.u(0xa7b1dede, 0x16c8b1c8), o.u(0x39549191, 0x6dfc54fc),
3614 // o.u(0xc0506060, 0x90f050f0), o.u(0x4030202, 0x7050305),
3615 // o.u(0x87a9cece, 0x2ee0a9e0), o.u(0xac7d5656, 0xd1877d87),
3616 // o.u(0xd519e7e7, 0xcc2b192b), o.u(0x7162b5b5, 0x13a662a6),
3617 // o.u(0x9ae64d4d, 0x7c31e631), o.u(0xc39aecec, 0x59b59ab5),
3618 // o.u(0x5458f8f, 0x40cf45cf), o.u(0x3e9d1f1f, 0xa3bc9dbc),
3619 // o.u(0x9408989, 0x49c040c0), o.u(0xef87fafa, 0x68928792),
3620 // o.u(0xc515efef, 0xd03f153f), o.u(0x7febb2b2, 0x9426eb26),
3621 // o.u(0x7c98e8e, 0xce40c940), o.u(0xed0bfbfb, 0xe61d0b1d),
3622 // o.u(0x82ec4141, 0x6e2fec2f), o.u(0x7d67b3b3, 0x1aa967a9),
3623 // o.u(0xbefd5f5f, 0x431cfd1c), o.u(0x8aea4545, 0x6025ea25),
3624 // o.u(0x46bf2323, 0xf9dabfda), o.u(0xa6f75353, 0x5102f702),
3625 // o.u(0xd396e4e4, 0x45a196a1), o.u(0x2d5b9b9b, 0x76ed5bed),
3626 // o.u(0xeac27575, 0x285dc25d), o.u(0xd91ce1e1, 0xc5241c24),
3627 // o.u(0x7aae3d3d, 0xd4e9aee9), o.u(0x986a4c4c, 0xf2be6abe),
3628 // o.u(0xd85a6c6c, 0x82ee5aee), o.u(0xfc417e7e, 0xbdc341c3),
3629 // o.u(0xf102f5f5, 0xf3060206), o.u(0x1d4f8383, 0x52d14fd1),
3630 // o.u(0xd05c6868, 0x8ce45ce4), o.u(0xa2f45151, 0x5607f407),
3631 // o.u(0xb934d1d1, 0x8d5c345c), o.u(0xe908f9f9, 0xe1180818),
3632 // o.u(0xdf93e2e2, 0x4cae93ae), o.u(0x4d73abab, 0x3e957395),
3633 // o.u(0xc4536262, 0x97f553f5), o.u(0x543f2a2a, 0x6b413f41),
3634 // o.u(0x100c0808, 0x1c140c14), o.u(0x31529595, 0x63f652f6),
3635 // o.u(0x8c654646, 0xe9af65af), o.u(0x215e9d9d, 0x7fe25ee2),
3636 // o.u(0x60283030, 0x48782878), o.u(0x6ea13737, 0xcff8a1f8),
3637 // o.u(0x140f0a0a, 0x1b110f11), o.u(0x5eb52f2f, 0xebc4b5c4),
3638 // o.u(0x1c090e0e, 0x151b091b), o.u(0x48362424, 0x7e5a365a),
3639 // o.u(0x369b1b1b, 0xadb69bb6), o.u(0xa53ddfdf, 0x98473d47),
3640 // o.u(0x8126cdcd, 0xa76a266a), o.u(0x9c694e4e, 0xf5bb69bb),
3641 // o.u(0xfecd7f7f, 0x334ccd4c), o.u(0xcf9feaea, 0x50ba9fba),
3642 // o.u(0x241b1212, 0x3f2d1b2d), o.u(0x3a9e1d1d, 0xa4b99eb9),
3643 // o.u(0xb0745858, 0xc49c749c), o.u(0x682e3434, 0x46722e72),
3644 // o.u(0x6c2d3636, 0x41772d77), o.u(0xa3b2dcdc, 0x11cdb2cd),
3645 // o.u(0x73eeb4b4, 0x9d29ee29), o.u(0xb6fb5b5b, 0x4d16fb16),
3646 // o.u(0x53f6a4a4, 0xa501f601), o.u(0xec4d7676, 0xa1d74dd7),
3647 // o.u(0x7561b7b7, 0x14a361a3), o.u(0xface7d7d, 0x3449ce49),
3648 // o.u(0xa47b5252, 0xdf8d7b8d), o.u(0xa13edddd, 0x9f423e42),
3649 // o.u(0xbc715e5e, 0xcd937193), o.u(0x26971313, 0xb1a297a2),
3650 // o.u(0x57f5a6a6, 0xa204f504), o.u(0x6968b9b9, 0x1b868b8),
3651 // o.u(0x0, 0x0), o.u(0x992cc1c1, 0xb5742c74),
3652 // o.u(0x80604040, 0xe0a060a0), o.u(0xdd1fe3e3, 0xc2211f21),
3653 // o.u(0xf2c87979, 0x3a43c843), o.u(0x77edb6b6, 0x9a2ced2c),
3654 // o.u(0xb3bed4d4, 0xdd9bed9), o.u(0x1468d8d, 0x47ca46ca),
3655 // o.u(0xced96767, 0x1770d970), o.u(0xe44b7272, 0xafdd4bdd),
3656 // o.u(0x33de9494, 0xed79de79), o.u(0x2bd49898, 0xff67d467),
3657 // o.u(0x7be8b0b0, 0x9323e823), o.u(0x114a8585, 0x5bde4ade),
3658 // o.u(0x6d6bbbbb, 0x6bd6bbd), o.u(0x912ac5c5, 0xbb7e2a7e),
3659 // o.u(0x9ee54f4f, 0x7b34e534), o.u(0xc116eded, 0xd73a163a),
3660 // o.u(0x17c58686, 0xd254c554), o.u(0x2fd79a9a, 0xf862d762),
3661 // o.u(0xcc556666, 0x99ff55ff), o.u(0x22941111, 0xb6a794a7),
3662 // o.u(0xfcf8a8a, 0xc04acf4a), o.u(0xc910e9e9, 0xd9301030),
3663 // o.u(0x8060404, 0xe0a060a), o.u(0xe781fefe, 0x66988198),
3664 // o.u(0x5bf0a0a0, 0xab0bf00b), o.u(0xf0447878, 0xb4cc44cc),
3665 // o.u(0x4aba2525, 0xf0d5bad5), o.u(0x96e34b4b, 0x753ee33e),
3666 // o.u(0x5ff3a2a2, 0xac0ef30e), o.u(0xbafe5d5d, 0x4419fe19),
3667 // o.u(0x1bc08080, 0xdb5bc05b), o.u(0xa8a0505, 0x80858a85),
3668 // o.u(0x7ead3f3f, 0xd3ecadec), o.u(0x42bc2121, 0xfedfbcdf),
3669 // o.u(0xe0487070, 0xa8d848d8), o.u(0xf904f1f1, 0xfd0c040c),
3670 // o.u(0xc6df6363, 0x197adf7a), o.u(0xeec17777, 0x2f58c158),
3671 // o.u(0x4575afaf, 0x309f759f), o.u(0x84634242, 0xe7a563a5),
3672 // o.u(0x40302020, 0x70503050), o.u(0xd11ae5e5, 0xcb2e1a2e),
3673 // o.u(0xe10efdfd, 0xef120e12), o.u(0x656dbfbf, 0x8b76db7),
3674 // o.u(0x194c8181, 0x55d44cd4), o.u(0x30141818, 0x243c143c),
3675 // o.u(0x4c352626, 0x795f355f), o.u(0x9d2fc3c3, 0xb2712f71),
3676 // o.u(0x67e1bebe, 0x8638e138), o.u(0x6aa23535, 0xc8fda2fd),
3677 // o.u(0xbcc8888, 0xc74fcc4f), o.u(0x5c392e2e, 0x654b394b),
3678 // o.u(0x3d579393, 0x6af957f9), o.u(0xaaf25555, 0x580df20d),
3679 // o.u(0xe382fcfc, 0x619d829d), o.u(0xf4477a7a, 0xb3c947c9),
3680 // o.u(0x8bacc8c8, 0x27efacef), o.u(0x6fe7baba, 0x8832e732),
3681 // o.u(0x642b3232, 0x4f7d2b7d), o.u(0xd795e6e6, 0x42a495a4),
3682 // o.u(0x9ba0c0c0, 0x3bfba0fb), o.u(0x32981919, 0xaab398b3),
3683 // o.u(0x27d19e9e, 0xf668d168), o.u(0x5d7fa3a3, 0x22817f81),
3684 // o.u(0x88664444, 0xeeaa66aa), o.u(0xa87e5454, 0xd6827e82),
3685 // o.u(0x76ab3b3b, 0xdde6abe6), o.u(0x16830b0b, 0x959e839e),
3686 // o.u(0x3ca8c8c, 0xc945ca45), o.u(0x9529c7c7, 0xbc7b297b),
3687 // o.u(0xd6d36b6b, 0x56ed36e), o.u(0x503c2828, 0x6c443c44),
3688 // o.u(0x5579a7a7, 0x2c8b798b), o.u(0x63e2bcbc, 0x813de23d),
3689 // o.u(0x2c1d1616, 0x31271d27), o.u(0x4176adad, 0x379a769a),
3690 // o.u(0xad3bdbdb, 0x964d3b4d), o.u(0xc8566464, 0x9efa56fa),
3691 // o.u(0xe84e7474, 0xa6d24ed2), o.u(0x281e1414, 0x36221e22),
3692 // o.u(0x3fdb9292, 0xe476db76), o.u(0x180a0c0c, 0x121e0a1e),
3693 // o.u(0x906c4848, 0xfcb46cb4), o.u(0x6be4b8b8, 0x8f37e437),
3694 // o.u(0x255d9f9f, 0x78e75de7), o.u(0x616ebdbd, 0xfb26eb2),
3695 // o.u(0x86ef4343, 0x692aef2a), o.u(0x93a6c4c4, 0x35f1a6f1),
3696 // o.u(0x72a83939, 0xdae3a8e3), o.u(0x62a43131, 0xc6f7a4f7),
3697 // o.u(0xbd37d3d3, 0x8a593759), o.u(0xff8bf2f2, 0x74868b86),
3698 // o.u(0xb132d5d5, 0x83563256), o.u(0xd438b8b, 0x4ec543c5),
3699 // o.u(0xdc596e6e, 0x85eb59eb), o.u(0xafb7dada, 0x18c2b7c2),
3700 // o.u(0x28c0101, 0x8e8f8c8f), o.u(0x7964b1b1, 0x1dac64ac),
3701 // o.u(0x23d29c9c, 0xf16dd26d), o.u(0x92e04949, 0x723be03b),
3702 // o.u(0xabb4d8d8, 0x1fc7b4c7), o.u(0x43faacac, 0xb915fa15),
3703 // o.u(0xfd07f3f3, 0xfa090709), o.u(0x8525cfcf, 0xa06f256f),
3704 // o.u(0x8fafcaca, 0x20eaafea), o.u(0xf38ef4f4, 0x7d898e89),
3705 // o.u(0x8ee94747, 0x6720e920), o.u(0x20181010, 0x38281828),
3706 // o.u(0xded56f6f, 0xb64d564), o.u(0xfb88f0f0, 0x73838883),
3707 // o.u(0x946f4a4a, 0xfbb16fb1), o.u(0xb8725c5c, 0xca967296),
3708 // o.u(0x70243838, 0x546c246c), o.u(0xaef15757, 0x5f08f108),
3709 // o.u(0xe6c77373, 0x2152c752), o.u(0x35519797, 0x64f351f3),
3710 // o.u(0x8d23cbcb, 0xae652365), o.u(0x597ca1a1, 0x25847c84),
3711 // o.u(0xcb9ce8e8, 0x57bf9cbf), o.u(0x7c213e3e, 0x5d632163),
3712 // o.u(0x37dd9696, 0xea7cdd7c), o.u(0xc2dc6161, 0x1e7fdc7f),
3713 // o.u(0x1a860d0d, 0x9c918691), o.u(0x1e850f0f, 0x9b948594),
3714 // o.u(0xdb90e0e0, 0x4bab90ab), o.u(0xf8427c7c, 0xbac642c6),
3715 // o.u(0xe2c47171, 0x2657c457), o.u(0x83aacccc, 0x29e5aae5),
3716 // o.u(0x3bd89090, 0xe373d873), o.u(0xc050606, 0x90f050f),
3717 // o.u(0xf501f7f7, 0xf4030103), o.u(0x38121c1c, 0x2a361236),
3718 // o.u(0x9fa3c2c2, 0x3cfea3fe), o.u(0xd45f6a6a, 0x8be15fe1),
3719 // o.u(0x47f9aeae, 0xbe10f910), o.u(0xd2d06969, 0x26bd06b),
3720 // o.u(0x2e911717, 0xbfa891a8), o.u(0x29589999, 0x71e858e8),
3721 // o.u(0x74273a3a, 0x53692769), o.u(0x4eb92727, 0xf7d0b9d0),
3722 // o.u(0xa938d9d9, 0x91483848), o.u(0xcd13ebeb, 0xde351335),
3723 // o.u(0x56b32b2b, 0xe5ceb3ce), o.u(0x44332222, 0x77553355),
3724 // o.u(0xbfbbd2d2, 0x4d6bbd6), o.u(0x4970a9a9, 0x39907090),
3725 // o.u(0xe890707, 0x87808980), o.u(0x66a73333, 0xc1f2a7f2),
3726 // o.u(0x5ab62d2d, 0xecc1b6c1), o.u(0x78223c3c, 0x5a662266),
3727 // o.u(0x2a921515, 0xb8ad92ad), o.u(0x8920c9c9, 0xa9602060),
3728 // o.u(0x15498787, 0x5cdb49db), o.u(0x4fffaaaa, 0xb01aff1a),
3729 // o.u(0xa0785050, 0xd8887888), o.u(0x517aa5a5, 0x2b8e7a8e),
3730 // o.u(0x68f0303, 0x898a8f8a), o.u(0xb2f85959, 0x4a13f813),
3731 // o.u(0x12800909, 0x929b809b), o.u(0x34171a1a, 0x23391739),
3732 // o.u(0xcada6565, 0x1075da75), o.u(0xb531d7d7, 0x84533153),
3733 // o.u(0x13c68484, 0xd551c651), o.u(0xbbb8d0d0, 0x3d3b8d3),
3734 // o.u(0x1fc38282, 0xdc5ec35e), o.u(0x52b02929, 0xe2cbb0cb),
3735 // o.u(0xb4775a5a, 0xc3997799), o.u(0x3c111e1e, 0x2d331133),
3736 // o.u(0xf6cb7b7b, 0x3d46cb46), o.u(0x4bfca8a8, 0xb71ffc1f),
3737 // o.u(0xdad66d6d, 0xc61d661), o.u(0x583a2c2c, 0x624e3a4e)
3741 // o.u(0xf497a5c6, 0xc632f4a5), o.u(0x97eb84f8, 0xf86f9784),
3742 // o.u(0xb0c799ee, 0xee5eb099), o.u(0x8cf78df6, 0xf67a8c8d),
3743 // o.u(0x17e50dff, 0xffe8170d), o.u(0xdcb7bdd6, 0xd60adcbd),
3744 // o.u(0xc8a7b1de, 0xde16c8b1), o.u(0xfc395491, 0x916dfc54),
3745 // o.u(0xf0c05060, 0x6090f050), o.u(0x05040302, 0x02070503),
3746 // o.u(0xe087a9ce, 0xce2ee0a9), o.u(0x87ac7d56, 0x56d1877d),
3747 // o.u(0x2bd519e7, 0xe7cc2b19), o.u(0xa67162b5, 0xb513a662),
3748 // o.u(0x319ae64d, 0x4d7c31e6), o.u(0xb5c39aec, 0xec59b59a),
3749 // o.u(0xcf05458f, 0x8f40cf45), o.u(0xbc3e9d1f, 0x1fa3bc9d),
3750 // o.u(0xc0094089, 0x8949c040), o.u(0x92ef87fa, 0xfa689287),
3751 // o.u(0x3fc515ef, 0xefd03f15), o.u(0x267febb2, 0xb29426eb),
3752 // o.u(0x4007c98e, 0x8ece40c9), o.u(0x1ded0bfb, 0xfbe61d0b),
3753 // o.u(0x2f82ec41, 0x416e2fec), o.u(0xa97d67b3, 0xb31aa967),
3754 // o.u(0x1cbefd5f, 0x5f431cfd), o.u(0x258aea45, 0x456025ea),
3755 // o.u(0xda46bf23, 0x23f9dabf), o.u(0x02a6f753, 0x535102f7),
3756 // o.u(0xa1d396e4, 0xe445a196), o.u(0xed2d5b9b, 0x9b76ed5b),
3757 // o.u(0x5deac275, 0x75285dc2), o.u(0x24d91ce1, 0xe1c5241c),
3758 // o.u(0xe97aae3d, 0x3dd4e9ae), o.u(0xbe986a4c, 0x4cf2be6a),
3759 // o.u(0xeed85a6c, 0x6c82ee5a), o.u(0xc3fc417e, 0x7ebdc341),
3760 // o.u(0x06f102f5, 0xf5f30602), o.u(0xd11d4f83, 0x8352d14f),
3761 // o.u(0xe4d05c68, 0x688ce45c), o.u(0x07a2f451, 0x515607f4),
3762 // o.u(0x5cb934d1, 0xd18d5c34), o.u(0x18e908f9, 0xf9e11808),
3763 // o.u(0xaedf93e2, 0xe24cae93), o.u(0x954d73ab, 0xab3e9573),
3764 // o.u(0xf5c45362, 0x6297f553), o.u(0x41543f2a, 0x2a6b413f),
3765 // o.u(0x14100c08, 0x081c140c), o.u(0xf6315295, 0x9563f652),
3766 // o.u(0xaf8c6546, 0x46e9af65), o.u(0xe2215e9d, 0x9d7fe25e),
3767 // o.u(0x78602830, 0x30487828), o.u(0xf86ea137, 0x37cff8a1),
3768 // o.u(0x11140f0a, 0x0a1b110f), o.u(0xc45eb52f, 0x2febc4b5),
3769 // o.u(0x1b1c090e, 0x0e151b09), o.u(0x5a483624, 0x247e5a36),
3770 // o.u(0xb6369b1b, 0x1badb69b), o.u(0x47a53ddf, 0xdf98473d),
3771 // o.u(0x6a8126cd, 0xcda76a26), o.u(0xbb9c694e, 0x4ef5bb69),
3772 // o.u(0x4cfecd7f, 0x7f334ccd), o.u(0xbacf9fea, 0xea50ba9f),
3773 // o.u(0x2d241b12, 0x123f2d1b), o.u(0xb93a9e1d, 0x1da4b99e),
3774 // o.u(0x9cb07458, 0x58c49c74), o.u(0x72682e34, 0x3446722e),
3775 // o.u(0x776c2d36, 0x3641772d), o.u(0xcda3b2dc, 0xdc11cdb2),
3776 // o.u(0x2973eeb4, 0xb49d29ee), o.u(0x16b6fb5b, 0x5b4d16fb),
3777 // o.u(0x0153f6a4, 0xa4a501f6), o.u(0xd7ec4d76, 0x76a1d74d),
3778 // o.u(0xa37561b7, 0xb714a361), o.u(0x49face7d, 0x7d3449ce),
3779 // o.u(0x8da47b52, 0x52df8d7b), o.u(0x42a13edd, 0xdd9f423e),
3780 // o.u(0x93bc715e, 0x5ecd9371), o.u(0xa2269713, 0x13b1a297),
3781 // o.u(0x0457f5a6, 0xa6a204f5), o.u(0xb86968b9, 0xb901b868),
3782 // o.u(0x00000000, 0x00000000), o.u(0x74992cc1, 0xc1b5742c),
3783 // o.u(0xa0806040, 0x40e0a060), o.u(0x21dd1fe3, 0xe3c2211f),
3784 // o.u(0x43f2c879, 0x793a43c8), o.u(0x2c77edb6, 0xb69a2ced),
3785 // o.u(0xd9b3bed4, 0xd40dd9be), o.u(0xca01468d, 0x8d47ca46),
3786 // o.u(0x70ced967, 0x671770d9), o.u(0xdde44b72, 0x72afdd4b),
3787 // o.u(0x7933de94, 0x94ed79de), o.u(0x672bd498, 0x98ff67d4),
3788 // o.u(0x237be8b0, 0xb09323e8), o.u(0xde114a85, 0x855bde4a),
3789 // o.u(0xbd6d6bbb, 0xbb06bd6b), o.u(0x7e912ac5, 0xc5bb7e2a),
3790 // o.u(0x349ee54f, 0x4f7b34e5), o.u(0x3ac116ed, 0xedd73a16),
3791 // o.u(0x5417c586, 0x86d254c5), o.u(0x622fd79a, 0x9af862d7),
3792 // o.u(0xffcc5566, 0x6699ff55), o.u(0xa7229411, 0x11b6a794),
3793 // o.u(0x4a0fcf8a, 0x8ac04acf), o.u(0x30c910e9, 0xe9d93010),
3794 // o.u(0x0a080604, 0x040e0a06), o.u(0x98e781fe, 0xfe669881),
3795 // o.u(0x0b5bf0a0, 0xa0ab0bf0), o.u(0xccf04478, 0x78b4cc44),
3796 // o.u(0xd54aba25, 0x25f0d5ba), o.u(0x3e96e34b, 0x4b753ee3),
3797 // o.u(0x0e5ff3a2, 0xa2ac0ef3), o.u(0x19bafe5d, 0x5d4419fe),
3798 // o.u(0x5b1bc080, 0x80db5bc0), o.u(0x850a8a05, 0x0580858a),
3799 // o.u(0xec7ead3f, 0x3fd3ecad), o.u(0xdf42bc21, 0x21fedfbc),
3800 // o.u(0xd8e04870, 0x70a8d848), o.u(0x0cf904f1, 0xf1fd0c04),
3801 // o.u(0x7ac6df63, 0x63197adf), o.u(0x58eec177, 0x772f58c1),
3802 // o.u(0x9f4575af, 0xaf309f75), o.u(0xa5846342, 0x42e7a563),
3803 // o.u(0x50403020, 0x20705030), o.u(0x2ed11ae5, 0xe5cb2e1a),
3804 // o.u(0x12e10efd, 0xfdef120e), o.u(0xb7656dbf, 0xbf08b76d),
3805 // o.u(0xd4194c81, 0x8155d44c), o.u(0x3c301418, 0x18243c14),
3806 // o.u(0x5f4c3526, 0x26795f35), o.u(0x719d2fc3, 0xc3b2712f),
3807 // o.u(0x3867e1be, 0xbe8638e1), o.u(0xfd6aa235, 0x35c8fda2),
3808 // o.u(0x4f0bcc88, 0x88c74fcc), o.u(0x4b5c392e, 0x2e654b39),
3809 // o.u(0xf93d5793, 0x936af957), o.u(0x0daaf255, 0x55580df2),
3810 // o.u(0x9de382fc, 0xfc619d82), o.u(0xc9f4477a, 0x7ab3c947),
3811 // o.u(0xef8bacc8, 0xc827efac), o.u(0x326fe7ba, 0xba8832e7),
3812 // o.u(0x7d642b32, 0x324f7d2b), o.u(0xa4d795e6, 0xe642a495),
3813 // o.u(0xfb9ba0c0, 0xc03bfba0), o.u(0xb3329819, 0x19aab398),
3814 // o.u(0x6827d19e, 0x9ef668d1), o.u(0x815d7fa3, 0xa322817f),
3815 // o.u(0xaa886644, 0x44eeaa66), o.u(0x82a87e54, 0x54d6827e),
3816 // o.u(0xe676ab3b, 0x3bdde6ab), o.u(0x9e16830b, 0x0b959e83),
3817 // o.u(0x4503ca8c, 0x8cc945ca), o.u(0x7b9529c7, 0xc7bc7b29),
3818 // o.u(0x6ed6d36b, 0x6b056ed3), o.u(0x44503c28, 0x286c443c),
3819 // o.u(0x8b5579a7, 0xa72c8b79), o.u(0x3d63e2bc, 0xbc813de2),
3820 // o.u(0x272c1d16, 0x1631271d), o.u(0x9a4176ad, 0xad379a76),
3821 // o.u(0x4dad3bdb, 0xdb964d3b), o.u(0xfac85664, 0x649efa56),
3822 // o.u(0xd2e84e74, 0x74a6d24e), o.u(0x22281e14, 0x1436221e),
3823 // o.u(0x763fdb92, 0x92e476db), o.u(0x1e180a0c, 0x0c121e0a),
3824 // o.u(0xb4906c48, 0x48fcb46c), o.u(0x376be4b8, 0xb88f37e4),
3825 // o.u(0xe7255d9f, 0x9f78e75d), o.u(0xb2616ebd, 0xbd0fb26e),
3826 // o.u(0x2a86ef43, 0x43692aef), o.u(0xf193a6c4, 0xc435f1a6),
3827 // o.u(0xe372a839, 0x39dae3a8), o.u(0xf762a431, 0x31c6f7a4),
3828 // o.u(0x59bd37d3, 0xd38a5937), o.u(0x86ff8bf2, 0xf274868b),
3829 // o.u(0x56b132d5, 0xd5835632), o.u(0xc50d438b, 0x8b4ec543),
3830 // o.u(0xebdc596e, 0x6e85eb59), o.u(0xc2afb7da, 0xda18c2b7),
3831 // o.u(0x8f028c01, 0x018e8f8c), o.u(0xac7964b1, 0xb11dac64),
3832 // o.u(0x6d23d29c, 0x9cf16dd2), o.u(0x3b92e049, 0x49723be0),
3833 // o.u(0xc7abb4d8, 0xd81fc7b4), o.u(0x1543faac, 0xacb915fa),
3834 // o.u(0x09fd07f3, 0xf3fa0907), o.u(0x6f8525cf, 0xcfa06f25),
3835 // o.u(0xea8fafca, 0xca20eaaf), o.u(0x89f38ef4, 0xf47d898e),
3836 // o.u(0x208ee947, 0x476720e9), o.u(0x28201810, 0x10382818),
3837 // o.u(0x64ded56f, 0x6f0b64d5), o.u(0x83fb88f0, 0xf0738388),
3838 // o.u(0xb1946f4a, 0x4afbb16f), o.u(0x96b8725c, 0x5cca9672),
3839 // o.u(0x6c702438, 0x38546c24), o.u(0x08aef157, 0x575f08f1),
3840 // o.u(0x52e6c773, 0x732152c7), o.u(0xf3355197, 0x9764f351),
3841 // o.u(0x658d23cb, 0xcbae6523), o.u(0x84597ca1, 0xa125847c),
3842 // o.u(0xbfcb9ce8, 0xe857bf9c), o.u(0x637c213e, 0x3e5d6321),
3843 // o.u(0x7c37dd96, 0x96ea7cdd), o.u(0x7fc2dc61, 0x611e7fdc),
3844 // o.u(0x911a860d, 0x0d9c9186), o.u(0x941e850f, 0x0f9b9485),
3845 // o.u(0xabdb90e0, 0xe04bab90), o.u(0xc6f8427c, 0x7cbac642),
3846 // o.u(0x57e2c471, 0x712657c4), o.u(0xe583aacc, 0xcc29e5aa),
3847 // o.u(0x733bd890, 0x90e373d8), o.u(0x0f0c0506, 0x06090f05),
3848 // o.u(0x03f501f7, 0xf7f40301), o.u(0x3638121c, 0x1c2a3612),
3849 // o.u(0xfe9fa3c2, 0xc23cfea3), o.u(0xe1d45f6a, 0x6a8be15f),
3850 // o.u(0x1047f9ae, 0xaebe10f9), o.u(0x6bd2d069, 0x69026bd0),
3851 // o.u(0xa82e9117, 0x17bfa891), o.u(0xe8295899, 0x9971e858),
3852 // o.u(0x6974273a, 0x3a536927), o.u(0xd04eb927, 0x27f7d0b9),
3853 // o.u(0x48a938d9, 0xd9914838), o.u(0x35cd13eb, 0xebde3513),
3854 // o.u(0xce56b32b, 0x2be5ceb3), o.u(0x55443322, 0x22775533),
3855 // o.u(0xd6bfbbd2, 0xd204d6bb), o.u(0x904970a9, 0xa9399070),
3856 // o.u(0x800e8907, 0x07878089), o.u(0xf266a733, 0x33c1f2a7),
3857 // o.u(0xc15ab62d, 0x2decc1b6), o.u(0x6678223c, 0x3c5a6622),
3858 // o.u(0xad2a9215, 0x15b8ad92), o.u(0x608920c9, 0xc9a96020),
3859 // o.u(0xdb154987, 0x875cdb49), o.u(0x1a4fffaa, 0xaab01aff),
3860 // o.u(0x88a07850, 0x50d88878), o.u(0x8e517aa5, 0xa52b8e7a),
3861 // o.u(0x8a068f03, 0x03898a8f), o.u(0x13b2f859, 0x594a13f8),
3862 // o.u(0x9b128009, 0x09929b80), o.u(0x3934171a, 0x1a233917),
3863 // o.u(0x75cada65, 0x651075da), o.u(0x53b531d7, 0xd7845331),
3864 // o.u(0x5113c684, 0x84d551c6), o.u(0xd3bbb8d0, 0xd003d3b8),
3865 // o.u(0x5e1fc382, 0x82dc5ec3), o.u(0xcb52b029, 0x29e2cbb0),
3866 // o.u(0x99b4775a, 0x5ac39977), o.u(0x333c111e, 0x1e2d3311),
3867 // o.u(0x46f6cb7b, 0x7b3d46cb), o.u(0x1f4bfca8, 0xa8b71ffc),
3868 // o.u(0x61dad66d, 0x6d0c61d6), o.u(0x4e583a2c, 0x2c624e3a)
3872 // o.u(0xa5f497a5, 0xc6c632f4), o.u(0x8497eb84, 0xf8f86f97),
3873 // o.u(0x99b0c799, 0xeeee5eb0), o.u(0x8d8cf78d, 0xf6f67a8c),
3874 // o.u(0xd17e50d, 0xffffe817), o.u(0xbddcb7bd, 0xd6d60adc),
3875 // o.u(0xb1c8a7b1, 0xdede16c8), o.u(0x54fc3954, 0x91916dfc),
3876 // o.u(0x50f0c050, 0x606090f0), o.u(0x3050403, 0x2020705),
3877 // o.u(0xa9e087a9, 0xcece2ee0), o.u(0x7d87ac7d, 0x5656d187),
3878 // o.u(0x192bd519, 0xe7e7cc2b), o.u(0x62a67162, 0xb5b513a6),
3879 // o.u(0xe6319ae6, 0x4d4d7c31), o.u(0x9ab5c39a, 0xecec59b5),
3880 // o.u(0x45cf0545, 0x8f8f40cf), o.u(0x9dbc3e9d, 0x1f1fa3bc),
3881 // o.u(0x40c00940, 0x898949c0), o.u(0x8792ef87, 0xfafa6892),
3882 // o.u(0x153fc515, 0xefefd03f), o.u(0xeb267feb, 0xb2b29426),
3883 // o.u(0xc94007c9, 0x8e8ece40), o.u(0xb1ded0b, 0xfbfbe61d),
3884 // o.u(0xec2f82ec, 0x41416e2f), o.u(0x67a97d67, 0xb3b31aa9),
3885 // o.u(0xfd1cbefd, 0x5f5f431c), o.u(0xea258aea, 0x45456025),
3886 // o.u(0xbfda46bf, 0x2323f9da), o.u(0xf702a6f7, 0x53535102),
3887 // o.u(0x96a1d396, 0xe4e445a1), o.u(0x5bed2d5b, 0x9b9b76ed),
3888 // o.u(0xc25deac2, 0x7575285d), o.u(0x1c24d91c, 0xe1e1c524),
3889 // o.u(0xaee97aae, 0x3d3dd4e9), o.u(0x6abe986a, 0x4c4cf2be),
3890 // o.u(0x5aeed85a, 0x6c6c82ee), o.u(0x41c3fc41, 0x7e7ebdc3),
3891 // o.u(0x206f102, 0xf5f5f306), o.u(0x4fd11d4f, 0x838352d1),
3892 // o.u(0x5ce4d05c, 0x68688ce4), o.u(0xf407a2f4, 0x51515607),
3893 // o.u(0x345cb934, 0xd1d18d5c), o.u(0x818e908, 0xf9f9e118),
3894 // o.u(0x93aedf93, 0xe2e24cae), o.u(0x73954d73, 0xabab3e95),
3895 // o.u(0x53f5c453, 0x626297f5), o.u(0x3f41543f, 0x2a2a6b41),
3896 // o.u(0xc14100c, 0x8081c14), o.u(0x52f63152, 0x959563f6),
3897 // o.u(0x65af8c65, 0x4646e9af), o.u(0x5ee2215e, 0x9d9d7fe2),
3898 // o.u(0x28786028, 0x30304878), o.u(0xa1f86ea1, 0x3737cff8),
3899 // o.u(0xf11140f, 0xa0a1b11), o.u(0xb5c45eb5, 0x2f2febc4),
3900 // o.u(0x91b1c09, 0xe0e151b), o.u(0x365a4836, 0x24247e5a),
3901 // o.u(0x9bb6369b, 0x1b1badb6), o.u(0x3d47a53d, 0xdfdf9847),
3902 // o.u(0x266a8126, 0xcdcda76a), o.u(0x69bb9c69, 0x4e4ef5bb),
3903 // o.u(0xcd4cfecd, 0x7f7f334c), o.u(0x9fbacf9f, 0xeaea50ba),
3904 // o.u(0x1b2d241b, 0x12123f2d), o.u(0x9eb93a9e, 0x1d1da4b9),
3905 // o.u(0x749cb074, 0x5858c49c), o.u(0x2e72682e, 0x34344672),
3906 // o.u(0x2d776c2d, 0x36364177), o.u(0xb2cda3b2, 0xdcdc11cd),
3907 // o.u(0xee2973ee, 0xb4b49d29), o.u(0xfb16b6fb, 0x5b5b4d16),
3908 // o.u(0xf60153f6, 0xa4a4a501), o.u(0x4dd7ec4d, 0x7676a1d7),
3909 // o.u(0x61a37561, 0xb7b714a3), o.u(0xce49face, 0x7d7d3449),
3910 // o.u(0x7b8da47b, 0x5252df8d), o.u(0x3e42a13e, 0xdddd9f42),
3911 // o.u(0x7193bc71, 0x5e5ecd93), o.u(0x97a22697, 0x1313b1a2),
3912 // o.u(0xf50457f5, 0xa6a6a204), o.u(0x68b86968, 0xb9b901b8),
3913 // o.u(0x0, 0x0), o.u(0x2c74992c, 0xc1c1b574),
3914 // o.u(0x60a08060, 0x4040e0a0), o.u(0x1f21dd1f, 0xe3e3c221),
3915 // o.u(0xc843f2c8, 0x79793a43), o.u(0xed2c77ed, 0xb6b69a2c),
3916 // o.u(0xbed9b3be, 0xd4d40dd9), o.u(0x46ca0146, 0x8d8d47ca),
3917 // o.u(0xd970ced9, 0x67671770), o.u(0x4bdde44b, 0x7272afdd),
3918 // o.u(0xde7933de, 0x9494ed79), o.u(0xd4672bd4, 0x9898ff67),
3919 // o.u(0xe8237be8, 0xb0b09323), o.u(0x4ade114a, 0x85855bde),
3920 // o.u(0x6bbd6d6b, 0xbbbb06bd), o.u(0x2a7e912a, 0xc5c5bb7e),
3921 // o.u(0xe5349ee5, 0x4f4f7b34), o.u(0x163ac116, 0xededd73a),
3922 // o.u(0xc55417c5, 0x8686d254), o.u(0xd7622fd7, 0x9a9af862),
3923 // o.u(0x55ffcc55, 0x666699ff), o.u(0x94a72294, 0x1111b6a7),
3924 // o.u(0xcf4a0fcf, 0x8a8ac04a), o.u(0x1030c910, 0xe9e9d930),
3925 // o.u(0x60a0806, 0x4040e0a), o.u(0x8198e781, 0xfefe6698),
3926 // o.u(0xf00b5bf0, 0xa0a0ab0b), o.u(0x44ccf044, 0x7878b4cc),
3927 // o.u(0xbad54aba, 0x2525f0d5), o.u(0xe33e96e3, 0x4b4b753e),
3928 // o.u(0xf30e5ff3, 0xa2a2ac0e), o.u(0xfe19bafe, 0x5d5d4419),
3929 // o.u(0xc05b1bc0, 0x8080db5b), o.u(0x8a850a8a, 0x5058085),
3930 // o.u(0xadec7ead, 0x3f3fd3ec), o.u(0xbcdf42bc, 0x2121fedf),
3931 // o.u(0x48d8e048, 0x7070a8d8), o.u(0x40cf904, 0xf1f1fd0c),
3932 // o.u(0xdf7ac6df, 0x6363197a), o.u(0xc158eec1, 0x77772f58),
3933 // o.u(0x759f4575, 0xafaf309f), o.u(0x63a58463, 0x4242e7a5),
3934 // o.u(0x30504030, 0x20207050), o.u(0x1a2ed11a, 0xe5e5cb2e),
3935 // o.u(0xe12e10e, 0xfdfdef12), o.u(0x6db7656d, 0xbfbf08b7),
3936 // o.u(0x4cd4194c, 0x818155d4), o.u(0x143c3014, 0x1818243c),
3937 // o.u(0x355f4c35, 0x2626795f), o.u(0x2f719d2f, 0xc3c3b271),
3938 // o.u(0xe13867e1, 0xbebe8638), o.u(0xa2fd6aa2, 0x3535c8fd),
3939 // o.u(0xcc4f0bcc, 0x8888c74f), o.u(0x394b5c39, 0x2e2e654b),
3940 // o.u(0x57f93d57, 0x93936af9), o.u(0xf20daaf2, 0x5555580d),
3941 // o.u(0x829de382, 0xfcfc619d), o.u(0x47c9f447, 0x7a7ab3c9),
3942 // o.u(0xacef8bac, 0xc8c827ef), o.u(0xe7326fe7, 0xbaba8832),
3943 // o.u(0x2b7d642b, 0x32324f7d), o.u(0x95a4d795, 0xe6e642a4),
3944 // o.u(0xa0fb9ba0, 0xc0c03bfb), o.u(0x98b33298, 0x1919aab3),
3945 // o.u(0xd16827d1, 0x9e9ef668), o.u(0x7f815d7f, 0xa3a32281),
3946 // o.u(0x66aa8866, 0x4444eeaa), o.u(0x7e82a87e, 0x5454d682),
3947 // o.u(0xabe676ab, 0x3b3bdde6), o.u(0x839e1683, 0xb0b959e),
3948 // o.u(0xca4503ca, 0x8c8cc945), o.u(0x297b9529, 0xc7c7bc7b),
3949 // o.u(0xd36ed6d3, 0x6b6b056e), o.u(0x3c44503c, 0x28286c44),
3950 // o.u(0x798b5579, 0xa7a72c8b), o.u(0xe23d63e2, 0xbcbc813d),
3951 // o.u(0x1d272c1d, 0x16163127), o.u(0x769a4176, 0xadad379a),
3952 // o.u(0x3b4dad3b, 0xdbdb964d), o.u(0x56fac856, 0x64649efa),
3953 // o.u(0x4ed2e84e, 0x7474a6d2), o.u(0x1e22281e, 0x14143622),
3954 // o.u(0xdb763fdb, 0x9292e476), o.u(0xa1e180a, 0xc0c121e),
3955 // o.u(0x6cb4906c, 0x4848fcb4), o.u(0xe4376be4, 0xb8b88f37),
3956 // o.u(0x5de7255d, 0x9f9f78e7), o.u(0x6eb2616e, 0xbdbd0fb2),
3957 // o.u(0xef2a86ef, 0x4343692a), o.u(0xa6f193a6, 0xc4c435f1),
3958 // o.u(0xa8e372a8, 0x3939dae3), o.u(0xa4f762a4, 0x3131c6f7),
3959 // o.u(0x3759bd37, 0xd3d38a59), o.u(0x8b86ff8b, 0xf2f27486),
3960 // o.u(0x3256b132, 0xd5d58356), o.u(0x43c50d43, 0x8b8b4ec5),
3961 // o.u(0x59ebdc59, 0x6e6e85eb), o.u(0xb7c2afb7, 0xdada18c2),
3962 // o.u(0x8c8f028c, 0x1018e8f), o.u(0x64ac7964, 0xb1b11dac),
3963 // o.u(0xd26d23d2, 0x9c9cf16d), o.u(0xe03b92e0, 0x4949723b),
3964 // o.u(0xb4c7abb4, 0xd8d81fc7), o.u(0xfa1543fa, 0xacacb915),
3965 // o.u(0x709fd07, 0xf3f3fa09), o.u(0x256f8525, 0xcfcfa06f),
3966 // o.u(0xafea8faf, 0xcaca20ea), o.u(0x8e89f38e, 0xf4f47d89),
3967 // o.u(0xe9208ee9, 0x47476720), o.u(0x18282018, 0x10103828),
3968 // o.u(0xd564ded5, 0x6f6f0b64), o.u(0x8883fb88, 0xf0f07383),
3969 // o.u(0x6fb1946f, 0x4a4afbb1), o.u(0x7296b872, 0x5c5cca96),
3970 // o.u(0x246c7024, 0x3838546c), o.u(0xf108aef1, 0x57575f08),
3971 // o.u(0xc752e6c7, 0x73732152), o.u(0x51f33551, 0x979764f3),
3972 // o.u(0x23658d23, 0xcbcbae65), o.u(0x7c84597c, 0xa1a12584),
3973 // o.u(0x9cbfcb9c, 0xe8e857bf), o.u(0x21637c21, 0x3e3e5d63),
3974 // o.u(0xdd7c37dd, 0x9696ea7c), o.u(0xdc7fc2dc, 0x61611e7f),
3975 // o.u(0x86911a86, 0xd0d9c91), o.u(0x85941e85, 0xf0f9b94),
3976 // o.u(0x90abdb90, 0xe0e04bab), o.u(0x42c6f842, 0x7c7cbac6),
3977 // o.u(0xc457e2c4, 0x71712657), o.u(0xaae583aa, 0xcccc29e5),
3978 // o.u(0xd8733bd8, 0x9090e373), o.u(0x50f0c05, 0x606090f),
3979 // o.u(0x103f501, 0xf7f7f403), o.u(0x12363812, 0x1c1c2a36),
3980 // o.u(0xa3fe9fa3, 0xc2c23cfe), o.u(0x5fe1d45f, 0x6a6a8be1),
3981 // o.u(0xf91047f9, 0xaeaebe10), o.u(0xd06bd2d0, 0x6969026b),
3982 // o.u(0x91a82e91, 0x1717bfa8), o.u(0x58e82958, 0x999971e8),
3983 // o.u(0x27697427, 0x3a3a5369), o.u(0xb9d04eb9, 0x2727f7d0),
3984 // o.u(0x3848a938, 0xd9d99148), o.u(0x1335cd13, 0xebebde35),
3985 // o.u(0xb3ce56b3, 0x2b2be5ce), o.u(0x33554433, 0x22227755),
3986 // o.u(0xbbd6bfbb, 0xd2d204d6), o.u(0x70904970, 0xa9a93990),
3987 // o.u(0x89800e89, 0x7078780), o.u(0xa7f266a7, 0x3333c1f2),
3988 // o.u(0xb6c15ab6, 0x2d2decc1), o.u(0x22667822, 0x3c3c5a66),
3989 // o.u(0x92ad2a92, 0x1515b8ad), o.u(0x20608920, 0xc9c9a960),
3990 // o.u(0x49db1549, 0x87875cdb), o.u(0xff1a4fff, 0xaaaab01a),
3991 // o.u(0x7888a078, 0x5050d888), o.u(0x7a8e517a, 0xa5a52b8e),
3992 // o.u(0x8f8a068f, 0x303898a), o.u(0xf813b2f8, 0x59594a13),
3993 // o.u(0x809b1280, 0x909929b), o.u(0x17393417, 0x1a1a2339),
3994 // o.u(0xda75cada, 0x65651075), o.u(0x3153b531, 0xd7d78453),
3995 // o.u(0xc65113c6, 0x8484d551), o.u(0xb8d3bbb8, 0xd0d003d3),
3996 // o.u(0xc35e1fc3, 0x8282dc5e), o.u(0xb0cb52b0, 0x2929e2cb),
3997 // o.u(0x7799b477, 0x5a5ac399), o.u(0x11333c11, 0x1e1e2d33),
3998 // o.u(0xcb46f6cb, 0x7b7b3d46), o.u(0xfc1f4bfc, 0xa8a8b71f),
3999 // o.u(0xd661dad6, 0x6d6d0c61), o.u(0x3a4e583a, 0x2c2c624e)
4003 // o.u(0xf4a5f497, 0xa5c6c632), o.u(0x978497eb, 0x84f8f86f),
4004 // o.u(0xb099b0c7, 0x99eeee5e), o.u(0x8c8d8cf7, 0x8df6f67a),
4005 // o.u(0x170d17e5, 0xdffffe8), o.u(0xdcbddcb7, 0xbdd6d60a),
4006 // o.u(0xc8b1c8a7, 0xb1dede16), o.u(0xfc54fc39, 0x5491916d),
4007 // o.u(0xf050f0c0, 0x50606090), o.u(0x5030504, 0x3020207),
4008 // o.u(0xe0a9e087, 0xa9cece2e), o.u(0x877d87ac, 0x7d5656d1),
4009 // o.u(0x2b192bd5, 0x19e7e7cc), o.u(0xa662a671, 0x62b5b513),
4010 // o.u(0x31e6319a, 0xe64d4d7c), o.u(0xb59ab5c3, 0x9aecec59),
4011 // o.u(0xcf45cf05, 0x458f8f40), o.u(0xbc9dbc3e, 0x9d1f1fa3),
4012 // o.u(0xc040c009, 0x40898949), o.u(0x928792ef, 0x87fafa68),
4013 // o.u(0x3f153fc5, 0x15efefd0), o.u(0x26eb267f, 0xebb2b294),
4014 // o.u(0x40c94007, 0xc98e8ece), o.u(0x1d0b1ded, 0xbfbfbe6),
4015 // o.u(0x2fec2f82, 0xec41416e), o.u(0xa967a97d, 0x67b3b31a),
4016 // o.u(0x1cfd1cbe, 0xfd5f5f43), o.u(0x25ea258a, 0xea454560),
4017 // o.u(0xdabfda46, 0xbf2323f9), o.u(0x2f702a6, 0xf7535351),
4018 // o.u(0xa196a1d3, 0x96e4e445), o.u(0xed5bed2d, 0x5b9b9b76),
4019 // o.u(0x5dc25dea, 0xc2757528), o.u(0x241c24d9, 0x1ce1e1c5),
4020 // o.u(0xe9aee97a, 0xae3d3dd4), o.u(0xbe6abe98, 0x6a4c4cf2),
4021 // o.u(0xee5aeed8, 0x5a6c6c82), o.u(0xc341c3fc, 0x417e7ebd),
4022 // o.u(0x60206f1, 0x2f5f5f3), o.u(0xd14fd11d, 0x4f838352),
4023 // o.u(0xe45ce4d0, 0x5c68688c), o.u(0x7f407a2, 0xf4515156),
4024 // o.u(0x5c345cb9, 0x34d1d18d), o.u(0x180818e9, 0x8f9f9e1),
4025 // o.u(0xae93aedf, 0x93e2e24c), o.u(0x9573954d, 0x73abab3e),
4026 // o.u(0xf553f5c4, 0x53626297), o.u(0x413f4154, 0x3f2a2a6b),
4027 // o.u(0x140c1410, 0xc08081c), o.u(0xf652f631, 0x52959563),
4028 // o.u(0xaf65af8c, 0x654646e9), o.u(0xe25ee221, 0x5e9d9d7f),
4029 // o.u(0x78287860, 0x28303048), o.u(0xf8a1f86e, 0xa13737cf),
4030 // o.u(0x110f1114, 0xf0a0a1b), o.u(0xc4b5c45e, 0xb52f2feb),
4031 // o.u(0x1b091b1c, 0x90e0e15), o.u(0x5a365a48, 0x3624247e),
4032 // o.u(0xb69bb636, 0x9b1b1bad), o.u(0x473d47a5, 0x3ddfdf98),
4033 // o.u(0x6a266a81, 0x26cdcda7), o.u(0xbb69bb9c, 0x694e4ef5),
4034 // o.u(0x4ccd4cfe, 0xcd7f7f33), o.u(0xba9fbacf, 0x9feaea50),
4035 // o.u(0x2d1b2d24, 0x1b12123f), o.u(0xb99eb93a, 0x9e1d1da4),
4036 // o.u(0x9c749cb0, 0x745858c4), o.u(0x722e7268, 0x2e343446),
4037 // o.u(0x772d776c, 0x2d363641), o.u(0xcdb2cda3, 0xb2dcdc11),
4038 // o.u(0x29ee2973, 0xeeb4b49d), o.u(0x16fb16b6, 0xfb5b5b4d),
4039 // o.u(0x1f60153, 0xf6a4a4a5), o.u(0xd74dd7ec, 0x4d7676a1),
4040 // o.u(0xa361a375, 0x61b7b714), o.u(0x49ce49fa, 0xce7d7d34),
4041 // o.u(0x8d7b8da4, 0x7b5252df), o.u(0x423e42a1, 0x3edddd9f),
4042 // o.u(0x937193bc, 0x715e5ecd), o.u(0xa297a226, 0x971313b1),
4043 // o.u(0x4f50457, 0xf5a6a6a2), o.u(0xb868b869, 0x68b9b901),
4044 // o.u(0x0, 0x0), o.u(0x742c7499, 0x2cc1c1b5),
4045 // o.u(0xa060a080, 0x604040e0), o.u(0x211f21dd, 0x1fe3e3c2),
4046 // o.u(0x43c843f2, 0xc879793a), o.u(0x2ced2c77, 0xedb6b69a),
4047 // o.u(0xd9bed9b3, 0xbed4d40d), o.u(0xca46ca01, 0x468d8d47),
4048 // o.u(0x70d970ce, 0xd9676717), o.u(0xdd4bdde4, 0x4b7272af),
4049 // o.u(0x79de7933, 0xde9494ed), o.u(0x67d4672b, 0xd49898ff),
4050 // o.u(0x23e8237b, 0xe8b0b093), o.u(0xde4ade11, 0x4a85855b),
4051 // o.u(0xbd6bbd6d, 0x6bbbbb06), o.u(0x7e2a7e91, 0x2ac5c5bb),
4052 // o.u(0x34e5349e, 0xe54f4f7b), o.u(0x3a163ac1, 0x16ededd7),
4053 // o.u(0x54c55417, 0xc58686d2), o.u(0x62d7622f, 0xd79a9af8),
4054 // o.u(0xff55ffcc, 0x55666699), o.u(0xa794a722, 0x941111b6),
4055 // o.u(0x4acf4a0f, 0xcf8a8ac0), o.u(0x301030c9, 0x10e9e9d9),
4056 // o.u(0xa060a08, 0x604040e), o.u(0x988198e7, 0x81fefe66),
4057 // o.u(0xbf00b5b, 0xf0a0a0ab), o.u(0xcc44ccf0, 0x447878b4),
4058 // o.u(0xd5bad54a, 0xba2525f0), o.u(0x3ee33e96, 0xe34b4b75),
4059 // o.u(0xef30e5f, 0xf3a2a2ac), o.u(0x19fe19ba, 0xfe5d5d44),
4060 // o.u(0x5bc05b1b, 0xc08080db), o.u(0x858a850a, 0x8a050580),
4061 // o.u(0xecadec7e, 0xad3f3fd3), o.u(0xdfbcdf42, 0xbc2121fe),
4062 // o.u(0xd848d8e0, 0x487070a8), o.u(0xc040cf9, 0x4f1f1fd),
4063 // o.u(0x7adf7ac6, 0xdf636319), o.u(0x58c158ee, 0xc177772f),
4064 // o.u(0x9f759f45, 0x75afaf30), o.u(0xa563a584, 0x634242e7),
4065 // o.u(0x50305040, 0x30202070), o.u(0x2e1a2ed1, 0x1ae5e5cb),
4066 // o.u(0x120e12e1, 0xefdfdef), o.u(0xb76db765, 0x6dbfbf08),
4067 // o.u(0xd44cd419, 0x4c818155), o.u(0x3c143c30, 0x14181824),
4068 // o.u(0x5f355f4c, 0x35262679), o.u(0x712f719d, 0x2fc3c3b2),
4069 // o.u(0x38e13867, 0xe1bebe86), o.u(0xfda2fd6a, 0xa23535c8),
4070 // o.u(0x4fcc4f0b, 0xcc8888c7), o.u(0x4b394b5c, 0x392e2e65),
4071 // o.u(0xf957f93d, 0x5793936a), o.u(0xdf20daa, 0xf2555558),
4072 // o.u(0x9d829de3, 0x82fcfc61), o.u(0xc947c9f4, 0x477a7ab3),
4073 // o.u(0xefacef8b, 0xacc8c827), o.u(0x32e7326f, 0xe7baba88),
4074 // o.u(0x7d2b7d64, 0x2b32324f), o.u(0xa495a4d7, 0x95e6e642),
4075 // o.u(0xfba0fb9b, 0xa0c0c03b), o.u(0xb398b332, 0x981919aa),
4076 // o.u(0x68d16827, 0xd19e9ef6), o.u(0x817f815d, 0x7fa3a322),
4077 // o.u(0xaa66aa88, 0x664444ee), o.u(0x827e82a8, 0x7e5454d6),
4078 // o.u(0xe6abe676, 0xab3b3bdd), o.u(0x9e839e16, 0x830b0b95),
4079 // o.u(0x45ca4503, 0xca8c8cc9), o.u(0x7b297b95, 0x29c7c7bc),
4080 // o.u(0x6ed36ed6, 0xd36b6b05), o.u(0x443c4450, 0x3c28286c),
4081 // o.u(0x8b798b55, 0x79a7a72c), o.u(0x3de23d63, 0xe2bcbc81),
4082 // o.u(0x271d272c, 0x1d161631), o.u(0x9a769a41, 0x76adad37),
4083 // o.u(0x4d3b4dad, 0x3bdbdb96), o.u(0xfa56fac8, 0x5664649e),
4084 // o.u(0xd24ed2e8, 0x4e7474a6), o.u(0x221e2228, 0x1e141436),
4085 // o.u(0x76db763f, 0xdb9292e4), o.u(0x1e0a1e18, 0xa0c0c12),
4086 // o.u(0xb46cb490, 0x6c4848fc), o.u(0x37e4376b, 0xe4b8b88f),
4087 // o.u(0xe75de725, 0x5d9f9f78), o.u(0xb26eb261, 0x6ebdbd0f),
4088 // o.u(0x2aef2a86, 0xef434369), o.u(0xf1a6f193, 0xa6c4c435),
4089 // o.u(0xe3a8e372, 0xa83939da), o.u(0xf7a4f762, 0xa43131c6),
4090 // o.u(0x593759bd, 0x37d3d38a), o.u(0x868b86ff, 0x8bf2f274),
4091 // o.u(0x563256b1, 0x32d5d583), o.u(0xc543c50d, 0x438b8b4e),
4092 // o.u(0xeb59ebdc, 0x596e6e85), o.u(0xc2b7c2af, 0xb7dada18),
4093 // o.u(0x8f8c8f02, 0x8c01018e), o.u(0xac64ac79, 0x64b1b11d),
4094 // o.u(0x6dd26d23, 0xd29c9cf1), o.u(0x3be03b92, 0xe0494972),
4095 // o.u(0xc7b4c7ab, 0xb4d8d81f), o.u(0x15fa1543, 0xfaacacb9),
4096 // o.u(0x90709fd, 0x7f3f3fa), o.u(0x6f256f85, 0x25cfcfa0),
4097 // o.u(0xeaafea8f, 0xafcaca20), o.u(0x898e89f3, 0x8ef4f47d),
4098 // o.u(0x20e9208e, 0xe9474767), o.u(0x28182820, 0x18101038),
4099 // o.u(0x64d564de, 0xd56f6f0b), o.u(0x838883fb, 0x88f0f073),
4100 // o.u(0xb16fb194, 0x6f4a4afb), o.u(0x967296b8, 0x725c5cca),
4101 // o.u(0x6c246c70, 0x24383854), o.u(0x8f108ae, 0xf157575f),
4102 // o.u(0x52c752e6, 0xc7737321), o.u(0xf351f335, 0x51979764),
4103 // o.u(0x6523658d, 0x23cbcbae), o.u(0x847c8459, 0x7ca1a125),
4104 // o.u(0xbf9cbfcb, 0x9ce8e857), o.u(0x6321637c, 0x213e3e5d),
4105 // o.u(0x7cdd7c37, 0xdd9696ea), o.u(0x7fdc7fc2, 0xdc61611e),
4106 // o.u(0x9186911a, 0x860d0d9c), o.u(0x9485941e, 0x850f0f9b),
4107 // o.u(0xab90abdb, 0x90e0e04b), o.u(0xc642c6f8, 0x427c7cba),
4108 // o.u(0x57c457e2, 0xc4717126), o.u(0xe5aae583, 0xaacccc29),
4109 // o.u(0x73d8733b, 0xd89090e3), o.u(0xf050f0c, 0x5060609),
4110 // o.u(0x30103f5, 0x1f7f7f4), o.u(0x36123638, 0x121c1c2a),
4111 // o.u(0xfea3fe9f, 0xa3c2c23c), o.u(0xe15fe1d4, 0x5f6a6a8b),
4112 // o.u(0x10f91047, 0xf9aeaebe), o.u(0x6bd06bd2, 0xd0696902),
4113 // o.u(0xa891a82e, 0x911717bf), o.u(0xe858e829, 0x58999971),
4114 // o.u(0x69276974, 0x273a3a53), o.u(0xd0b9d04e, 0xb92727f7),
4115 // o.u(0x483848a9, 0x38d9d991), o.u(0x351335cd, 0x13ebebde),
4116 // o.u(0xceb3ce56, 0xb32b2be5), o.u(0x55335544, 0x33222277),
4117 // o.u(0xd6bbd6bf, 0xbbd2d204), o.u(0x90709049, 0x70a9a939),
4118 // o.u(0x8089800e, 0x89070787), o.u(0xf2a7f266, 0xa73333c1),
4119 // o.u(0xc1b6c15a, 0xb62d2dec), o.u(0x66226678, 0x223c3c5a),
4120 // o.u(0xad92ad2a, 0x921515b8), o.u(0x60206089, 0x20c9c9a9),
4121 // o.u(0xdb49db15, 0x4987875c), o.u(0x1aff1a4f, 0xffaaaab0),
4122 // o.u(0x887888a0, 0x785050d8), o.u(0x8e7a8e51, 0x7aa5a52b),
4123 // o.u(0x8a8f8a06, 0x8f030389), o.u(0x13f813b2, 0xf859594a),
4124 // o.u(0x9b809b12, 0x80090992), o.u(0x39173934, 0x171a1a23),
4125 // o.u(0x75da75ca, 0xda656510), o.u(0x533153b5, 0x31d7d784),
4126 // o.u(0x51c65113, 0xc68484d5), o.u(0xd3b8d3bb, 0xb8d0d003),
4127 // o.u(0x5ec35e1f, 0xc38282dc), o.u(0xcbb0cb52, 0xb02929e2),
4128 // o.u(0x997799b4, 0x775a5ac3), o.u(0x3311333c, 0x111e1e2d),
4129 // o.u(0x46cb46f6, 0xcb7b7b3d), o.u(0x1ffc1f4b, 0xfca8a8b7),
4130 // o.u(0x61d661da, 0xd66d6d0c), o.u(0x4e3a4e58, 0x3a2c2c62)
4134 // o.u(0x32f4a5f4, 0x97a5c6c6), o.u(0x6f978497, 0xeb84f8f8),
4135 // o.u(0x5eb099b0, 0xc799eeee), o.u(0x7a8c8d8c, 0xf78df6f6),
4136 // o.u(0xe8170d17, 0xe50dffff), o.u(0xadcbddc, 0xb7bdd6d6),
4137 // o.u(0x16c8b1c8, 0xa7b1dede), o.u(0x6dfc54fc, 0x39549191),
4138 // o.u(0x90f050f0, 0xc0506060), o.u(0x7050305, 0x4030202),
4139 // o.u(0x2ee0a9e0, 0x87a9cece), o.u(0xd1877d87, 0xac7d5656),
4140 // o.u(0xcc2b192b, 0xd519e7e7), o.u(0x13a662a6, 0x7162b5b5),
4141 // o.u(0x7c31e631, 0x9ae64d4d), o.u(0x59b59ab5, 0xc39aecec),
4142 // o.u(0x40cf45cf, 0x5458f8f), o.u(0xa3bc9dbc, 0x3e9d1f1f),
4143 // o.u(0x49c040c0, 0x9408989), o.u(0x68928792, 0xef87fafa),
4144 // o.u(0xd03f153f, 0xc515efef), o.u(0x9426eb26, 0x7febb2b2),
4145 // o.u(0xce40c940, 0x7c98e8e), o.u(0xe61d0b1d, 0xed0bfbfb),
4146 // o.u(0x6e2fec2f, 0x82ec4141), o.u(0x1aa967a9, 0x7d67b3b3),
4147 // o.u(0x431cfd1c, 0xbefd5f5f), o.u(0x6025ea25, 0x8aea4545),
4148 // o.u(0xf9dabfda, 0x46bf2323), o.u(0x5102f702, 0xa6f75353),
4149 // o.u(0x45a196a1, 0xd396e4e4), o.u(0x76ed5bed, 0x2d5b9b9b),
4150 // o.u(0x285dc25d, 0xeac27575), o.u(0xc5241c24, 0xd91ce1e1),
4151 // o.u(0xd4e9aee9, 0x7aae3d3d), o.u(0xf2be6abe, 0x986a4c4c),
4152 // o.u(0x82ee5aee, 0xd85a6c6c), o.u(0xbdc341c3, 0xfc417e7e),
4153 // o.u(0xf3060206, 0xf102f5f5), o.u(0x52d14fd1, 0x1d4f8383),
4154 // o.u(0x8ce45ce4, 0xd05c6868), o.u(0x5607f407, 0xa2f45151),
4155 // o.u(0x8d5c345c, 0xb934d1d1), o.u(0xe1180818, 0xe908f9f9),
4156 // o.u(0x4cae93ae, 0xdf93e2e2), o.u(0x3e957395, 0x4d73abab),
4157 // o.u(0x97f553f5, 0xc4536262), o.u(0x6b413f41, 0x543f2a2a),
4158 // o.u(0x1c140c14, 0x100c0808), o.u(0x63f652f6, 0x31529595),
4159 // o.u(0xe9af65af, 0x8c654646), o.u(0x7fe25ee2, 0x215e9d9d),
4160 // o.u(0x48782878, 0x60283030), o.u(0xcff8a1f8, 0x6ea13737),
4161 // o.u(0x1b110f11, 0x140f0a0a), o.u(0xebc4b5c4, 0x5eb52f2f),
4162 // o.u(0x151b091b, 0x1c090e0e), o.u(0x7e5a365a, 0x48362424),
4163 // o.u(0xadb69bb6, 0x369b1b1b), o.u(0x98473d47, 0xa53ddfdf),
4164 // o.u(0xa76a266a, 0x8126cdcd), o.u(0xf5bb69bb, 0x9c694e4e),
4165 // o.u(0x334ccd4c, 0xfecd7f7f), o.u(0x50ba9fba, 0xcf9feaea),
4166 // o.u(0x3f2d1b2d, 0x241b1212), o.u(0xa4b99eb9, 0x3a9e1d1d),
4167 // o.u(0xc49c749c, 0xb0745858), o.u(0x46722e72, 0x682e3434),
4168 // o.u(0x41772d77, 0x6c2d3636), o.u(0x11cdb2cd, 0xa3b2dcdc),
4169 // o.u(0x9d29ee29, 0x73eeb4b4), o.u(0x4d16fb16, 0xb6fb5b5b),
4170 // o.u(0xa501f601, 0x53f6a4a4), o.u(0xa1d74dd7, 0xec4d7676),
4171 // o.u(0x14a361a3, 0x7561b7b7), o.u(0x3449ce49, 0xface7d7d),
4172 // o.u(0xdf8d7b8d, 0xa47b5252), o.u(0x9f423e42, 0xa13edddd),
4173 // o.u(0xcd937193, 0xbc715e5e), o.u(0xb1a297a2, 0x26971313),
4174 // o.u(0xa204f504, 0x57f5a6a6), o.u(0x1b868b8, 0x6968b9b9),
4175 // o.u(0x0, 0x0), o.u(0xb5742c74, 0x992cc1c1),
4176 // o.u(0xe0a060a0, 0x80604040), o.u(0xc2211f21, 0xdd1fe3e3),
4177 // o.u(0x3a43c843, 0xf2c87979), o.u(0x9a2ced2c, 0x77edb6b6),
4178 // o.u(0xdd9bed9, 0xb3bed4d4), o.u(0x47ca46ca, 0x1468d8d),
4179 // o.u(0x1770d970, 0xced96767), o.u(0xafdd4bdd, 0xe44b7272),
4180 // o.u(0xed79de79, 0x33de9494), o.u(0xff67d467, 0x2bd49898),
4181 // o.u(0x9323e823, 0x7be8b0b0), o.u(0x5bde4ade, 0x114a8585),
4182 // o.u(0x6bd6bbd, 0x6d6bbbbb), o.u(0xbb7e2a7e, 0x912ac5c5),
4183 // o.u(0x7b34e534, 0x9ee54f4f), o.u(0xd73a163a, 0xc116eded),
4184 // o.u(0xd254c554, 0x17c58686), o.u(0xf862d762, 0x2fd79a9a),
4185 // o.u(0x99ff55ff, 0xcc556666), o.u(0xb6a794a7, 0x22941111),
4186 // o.u(0xc04acf4a, 0xfcf8a8a), o.u(0xd9301030, 0xc910e9e9),
4187 // o.u(0xe0a060a, 0x8060404), o.u(0x66988198, 0xe781fefe),
4188 // o.u(0xab0bf00b, 0x5bf0a0a0), o.u(0xb4cc44cc, 0xf0447878),
4189 // o.u(0xf0d5bad5, 0x4aba2525), o.u(0x753ee33e, 0x96e34b4b),
4190 // o.u(0xac0ef30e, 0x5ff3a2a2), o.u(0x4419fe19, 0xbafe5d5d),
4191 // o.u(0xdb5bc05b, 0x1bc08080), o.u(0x80858a85, 0xa8a0505),
4192 // o.u(0xd3ecadec, 0x7ead3f3f), o.u(0xfedfbcdf, 0x42bc2121),
4193 // o.u(0xa8d848d8, 0xe0487070), o.u(0xfd0c040c, 0xf904f1f1),
4194 // o.u(0x197adf7a, 0xc6df6363), o.u(0x2f58c158, 0xeec17777),
4195 // o.u(0x309f759f, 0x4575afaf), o.u(0xe7a563a5, 0x84634242),
4196 // o.u(0x70503050, 0x40302020), o.u(0xcb2e1a2e, 0xd11ae5e5),
4197 // o.u(0xef120e12, 0xe10efdfd), o.u(0x8b76db7, 0x656dbfbf),
4198 // o.u(0x55d44cd4, 0x194c8181), o.u(0x243c143c, 0x30141818),
4199 // o.u(0x795f355f, 0x4c352626), o.u(0xb2712f71, 0x9d2fc3c3),
4200 // o.u(0x8638e138, 0x67e1bebe), o.u(0xc8fda2fd, 0x6aa23535),
4201 // o.u(0xc74fcc4f, 0xbcc8888), o.u(0x654b394b, 0x5c392e2e),
4202 // o.u(0x6af957f9, 0x3d579393), o.u(0x580df20d, 0xaaf25555),
4203 // o.u(0x619d829d, 0xe382fcfc), o.u(0xb3c947c9, 0xf4477a7a),
4204 // o.u(0x27efacef, 0x8bacc8c8), o.u(0x8832e732, 0x6fe7baba),
4205 // o.u(0x4f7d2b7d, 0x642b3232), o.u(0x42a495a4, 0xd795e6e6),
4206 // o.u(0x3bfba0fb, 0x9ba0c0c0), o.u(0xaab398b3, 0x32981919),
4207 // o.u(0xf668d168, 0x27d19e9e), o.u(0x22817f81, 0x5d7fa3a3),
4208 // o.u(0xeeaa66aa, 0x88664444), o.u(0xd6827e82, 0xa87e5454),
4209 // o.u(0xdde6abe6, 0x76ab3b3b), o.u(0x959e839e, 0x16830b0b),
4210 // o.u(0xc945ca45, 0x3ca8c8c), o.u(0xbc7b297b, 0x9529c7c7),
4211 // o.u(0x56ed36e, 0xd6d36b6b), o.u(0x6c443c44, 0x503c2828),
4212 // o.u(0x2c8b798b, 0x5579a7a7), o.u(0x813de23d, 0x63e2bcbc),
4213 // o.u(0x31271d27, 0x2c1d1616), o.u(0x379a769a, 0x4176adad),
4214 // o.u(0x964d3b4d, 0xad3bdbdb), o.u(0x9efa56fa, 0xc8566464),
4215 // o.u(0xa6d24ed2, 0xe84e7474), o.u(0x36221e22, 0x281e1414),
4216 // o.u(0xe476db76, 0x3fdb9292), o.u(0x121e0a1e, 0x180a0c0c),
4217 // o.u(0xfcb46cb4, 0x906c4848), o.u(0x8f37e437, 0x6be4b8b8),
4218 // o.u(0x78e75de7, 0x255d9f9f), o.u(0xfb26eb2, 0x616ebdbd),
4219 // o.u(0x692aef2a, 0x86ef4343), o.u(0x35f1a6f1, 0x93a6c4c4),
4220 // o.u(0xdae3a8e3, 0x72a83939), o.u(0xc6f7a4f7, 0x62a43131),
4221 // o.u(0x8a593759, 0xbd37d3d3), o.u(0x74868b86, 0xff8bf2f2),
4222 // o.u(0x83563256, 0xb132d5d5), o.u(0x4ec543c5, 0xd438b8b),
4223 // o.u(0x85eb59eb, 0xdc596e6e), o.u(0x18c2b7c2, 0xafb7dada),
4224 // o.u(0x8e8f8c8f, 0x28c0101), o.u(0x1dac64ac, 0x7964b1b1),
4225 // o.u(0xf16dd26d, 0x23d29c9c), o.u(0x723be03b, 0x92e04949),
4226 // o.u(0x1fc7b4c7, 0xabb4d8d8), o.u(0xb915fa15, 0x43faacac),
4227 // o.u(0xfa090709, 0xfd07f3f3), o.u(0xa06f256f, 0x8525cfcf),
4228 // o.u(0x20eaafea, 0x8fafcaca), o.u(0x7d898e89, 0xf38ef4f4),
4229 // o.u(0x6720e920, 0x8ee94747), o.u(0x38281828, 0x20181010),
4230 // o.u(0xb64d564, 0xded56f6f), o.u(0x73838883, 0xfb88f0f0),
4231 // o.u(0xfbb16fb1, 0x946f4a4a), o.u(0xca967296, 0xb8725c5c),
4232 // o.u(0x546c246c, 0x70243838), o.u(0x5f08f108, 0xaef15757),
4233 // o.u(0x2152c752, 0xe6c77373), o.u(0x64f351f3, 0x35519797),
4234 // o.u(0xae652365, 0x8d23cbcb), o.u(0x25847c84, 0x597ca1a1),
4235 // o.u(0x57bf9cbf, 0xcb9ce8e8), o.u(0x5d632163, 0x7c213e3e),
4236 // o.u(0xea7cdd7c, 0x37dd9696), o.u(0x1e7fdc7f, 0xc2dc6161),
4237 // o.u(0x9c918691, 0x1a860d0d), o.u(0x9b948594, 0x1e850f0f),
4238 // o.u(0x4bab90ab, 0xdb90e0e0), o.u(0xbac642c6, 0xf8427c7c),
4239 // o.u(0x2657c457, 0xe2c47171), o.u(0x29e5aae5, 0x83aacccc),
4240 // o.u(0xe373d873, 0x3bd89090), o.u(0x90f050f, 0xc050606),
4241 // o.u(0xf4030103, 0xf501f7f7), o.u(0x2a361236, 0x38121c1c),
4242 // o.u(0x3cfea3fe, 0x9fa3c2c2), o.u(0x8be15fe1, 0xd45f6a6a),
4243 // o.u(0xbe10f910, 0x47f9aeae), o.u(0x26bd06b, 0xd2d06969),
4244 // o.u(0xbfa891a8, 0x2e911717), o.u(0x71e858e8, 0x29589999),
4245 // o.u(0x53692769, 0x74273a3a), o.u(0xf7d0b9d0, 0x4eb92727),
4246 // o.u(0x91483848, 0xa938d9d9), o.u(0xde351335, 0xcd13ebeb),
4247 // o.u(0xe5ceb3ce, 0x56b32b2b), o.u(0x77553355, 0x44332222),
4248 // o.u(0x4d6bbd6, 0xbfbbd2d2), o.u(0x39907090, 0x4970a9a9),
4249 // o.u(0x87808980, 0xe890707), o.u(0xc1f2a7f2, 0x66a73333),
4250 // o.u(0xecc1b6c1, 0x5ab62d2d), o.u(0x5a662266, 0x78223c3c),
4251 // o.u(0xb8ad92ad, 0x2a921515), o.u(0xa9602060, 0x8920c9c9),
4252 // o.u(0x5cdb49db, 0x15498787), o.u(0xb01aff1a, 0x4fffaaaa),
4253 // o.u(0xd8887888, 0xa0785050), o.u(0x2b8e7a8e, 0x517aa5a5),
4254 // o.u(0x898a8f8a, 0x68f0303), o.u(0x4a13f813, 0xb2f85959),
4255 // o.u(0x929b809b, 0x12800909), o.u(0x23391739, 0x34171a1a),
4256 // o.u(0x1075da75, 0xcada6565), o.u(0x84533153, 0xb531d7d7),
4257 // o.u(0xd551c651, 0x13c68484), o.u(0x3d3b8d3, 0xbbb8d0d0),
4258 // o.u(0xdc5ec35e, 0x1fc38282), o.u(0xe2cbb0cb, 0x52b02929),
4259 // o.u(0xc3997799, 0xb4775a5a), o.u(0x2d331133, 0x3c111e1e),
4260 // o.u(0x3d46cb46, 0xf6cb7b7b), o.u(0xb71ffc1f, 0x4bfca8a8),
4261 // o.u(0xc61d661, 0xdad66d6d), o.u(0x624e3a4e, 0x583a2c2c)
4264 var B64 = function(n
, x
) {
4268 var bits
= (7 - n
) * 8;
4269 if (bits
>= 32) { //faster than >= 32
4270 return (x
.hi
>>> (bits
- 32)) & 0xFF;
4273 var bitsOff32
= 32 - bits
,
4274 toMoveDown
= this.hi
<< bitsOff32
>>> bitsOff32
;
4275 return (x
.lo
>>> bits
| (toMoveDown
<< bitsOff32
)) & 0xFF;
4279 var j64
= [o
.u(0, 0), o
.u(0, 0x10), o
.u(0, 0x20), o
.u(0, 0x30), o
.u(0, 0x40), o
.u(0, 0x50), o
.u(0, 0x60),
4280 o
.u(0, 0x70), o
.u(0, 0x80), o
.u(0, 0x90), o
.u(0, 0xA0), o
.u(0, 0xB0), o
.u(0, 0xC0),
4281 o
.u(0, 0xD0), o
.u(0, 0xE0), o
.u(0, 0xF0)
4284 var nj64
= [o
.u(0xFFFFFFFF, 0xFFFFFFFF), o
.u(0xFFFFFFFF, 0xFFFFFFEF), o
.u(0xFFFFFFFF, 0xFFFFFFDF), o
.u(0xFFFFFFFF, 0xFFFFFFCF), o
.u(0xFFFFFFFF, 0xFFFFFFBF), o
.u(0xFFFFFFFF, 0xFFFFFFAF), o
.u(0xFFFFFFFF, 0xFFFFFF9F),
4285 o
.u(0xFFFFFFFF, 0xFFFFFF8F), o
.u(0xFFFFFFFF, 0xFFFFFF7F), o
.u(0xFFFFFFFF, 0xFFFFFF6F), o
.u(0xFFFFFFFF, 0xFFFFFF5F), o
.u(0xFFFFFFFF, 0xFFFFFF4F), o
.u(0xFFFFFFFF, 0xFFFFFF3F),
4286 o
.u(0xFFFFFFFF, 0xFFFFFF2F), o
.u(0xFFFFFFFF, 0xFFFFFF1F), o
.u(0xFFFFFFFF, 0xFFFFFF0F)
4289 var r64
= [o
.u(0, 0), o
.u(0, 1), o
.u(0, 2), o
.u(0, 3), o
.u(0, 4), o
.u(0, 5), o
.u(0, 6), o
.u(0, 7),
4290 o
.u(0, 8), o
.u(0, 9), o
.u(0, 10), o
.u(0, 11), o
.u(0, 12), o
.u(0, 13)
4293 var compress = function(int64buf
, state
) {
4294 var g
= new Array(16);
4295 var m
= new Array(16);
4296 for (var u
= 0; u
< 16; u
++) {
4298 g
[u
] = m
[u
].xor(state
[u
]);
4300 var t
= new Array(16);
4301 for (var r
= 0; r
< 14; r
++) {
4302 for (var i
= 0; i
< 16; i
++) {
4303 g
[i
].setxor64(j64
[i
].plus(r64
[r
]).setShiftLeft(56));
4306 for (var u
= 0; u
< 16; u
++) {
4307 t
[u
] = o
.xor64(T0
[B64(0, g
[u
])], T1
[B64(1, g
[(u
+ 1) & 0xF])], T2
[B64(2, g
[(u
+ 2) & 0xF])], T3
[B64(3, g
[(u
+ 3) & 0xF])], T4
[B64(4, g
[(u
+ 4) & 0xF])], T5
[B64(5, g
[(u
+ 5) & 0xF])], T6
[B64(6, g
[(u
+ 6) & 0xF])], T7
[B64(7, g
[(u
+ 11) & 0xF])]);
4313 for (var r
= 0; r
< 14; r
++) {
4314 for (var i
= 0; i
< 16; i
++) {
4315 m
[i
].setxor64(r64
[r
], nj64
[i
]);
4317 for (var u
= 0; u
< 16; u
++) {
4318 t
[u
] = o
.xor64(T0
[B64(0, m
[(u
+ 1) & 0xF])], T1
[B64(1, m
[(u
+ 3) & 0xF])], T2
[B64(2, m
[(u
+ 5) & 0xF])], T3
[B64(3, m
[(u
+ 11) & 0xF])], T4
[B64(4, m
[(u
+ 0) & 0xF])], T5
[B64(5, m
[(u
+ 2) & 0xF])], T6
[B64(6, m
[(u
+ 4) & 0xF])], T7
[B64(7, m
[(u
+ 6) & 0xF])]);
4324 for (var u
= 0; u
< 16; u
++) {
4325 state
[u
].setxor64(g
[u
], m
[u
]);
4329 var final = function(state
) {
4330 var g
= new Array(16);
4331 o
.bufferInsert64(g
, 0, state
, 16);
4332 var t
= new Array(16);
4333 for (var r
= 0; r
< 14; r
++) {
4335 for (var i
= 0; i
< 16; i
++) {
4336 g
[i
].setxor64(j64
[i
].plus(r64
[r
]).setShiftLeft(56));
4339 for (var u
= 0; u
< 16; u
++) {
4340 t
[u
] = o
.xor64(T0
[B64(0, g
[u
])], T1
[B64(1, g
[(u
+ 1) & 0xF])], T2
[B64(2, g
[(u
+ 2) & 0xF])], T3
[B64(3, g
[(u
+ 3) & 0xF])], T4
[B64(4, g
[(u
+ 4) & 0xF])], T5
[B64(5, g
[(u
+ 5) & 0xF])], T6
[B64(6, g
[(u
+ 6) & 0xF])], T7
[B64(7, g
[(u
+ 11) & 0xF])]);
4346 for (var u
= 0; u
< 16; u
++)
4347 state
[u
].setxor64(g
[u
]);
4350 var groestl = function(ctx
, data
, len
) {
4352 //create a local copy of states
4353 var V
= new Array(16);
4356 if (len
< ctx
.buffer
.length
- ptr
) {
4357 o
.bufferInsert(buf
, ptr
, data
, data
.length
);
4362 //perform a deep copy of current state
4363 o
.bufferInsert(V
, 0, ctx
.state
, 16);
4365 var clen
= ctx
.buffer
.length
- ptr
;
4366 if (clen
> len
) clen
= len
;
4367 o
.bufferInsert(buf
, ptr
, data
, clen
);
4369 data
= data
.slice(clen
);
4371 if (ptr
=== ctx
.buffer
.length
) {
4372 var int64Buf
= h
.bytes2Int64Buffer(buf
);
4373 compress(int64Buf
, V
);
4382 var groestlClose = function(ctx
) {
4383 var buf
= ctx
.buffer
;
4385 var pad
= new Array(136);
4386 var len
= buf
.length
;
4392 count
= ctx
.count
.plus(o
.u(0, 1));
4396 count
= ctx
.count
.plus(o
.u(0, 2));
4398 o
.bufferSet(pad
, 1, 0, padLen
- 9);
4399 h
.bufferEncode64(pad
, padLen
- 8, count
);
4400 groestl(ctx
, pad
, padLen
);
4402 var out
= new Array(16);
4403 for (var u
= 0, v
= 8; u
< 8; u
++, v
++) {
4404 out
[2 * u
] = ctx
.state
[v
].hi
;
4405 out
[2 * u
+ 1] = ctx
.state
[v
].lo
;
4410 module
.exports = function(input
, format
, output
) {
4415 else if (format
=== 2) {
4416 msg
= h
.int32Buffer2Bytes(input
);
4419 msg
= h
.string2bytes(input
);
4422 ctx
.state
= new Array(16);
4423 for (var i
= 0; i
< 15; i
++) {
4424 ctx
.state
[i
] = new o
.u64(0, 0);
4426 ctx
.state
[15] = new o
.u64(0, 512);
4428 ctx
.count
= new o
.u64(0,0);
4429 ctx
.buffer
= new Array(128);
4430 groestl(ctx
, msg
, msg
.length
);
4431 var r
= groestlClose(ctx
, 0, 0);
4436 else if (output
=== 1) {
4437 out
= h
.int32Buffer2Bytes(r
)
4440 out
= h
.int32ArrayToHexString(r
)
4444 },{"./helper":29,"./op":30}],29:[function(require
,module
,exports
){
4448 var op
= require('./op.js');
4450 module
.exports
.int8ArrayToHexString
= function toString(array
) {
4453 for (var i
= 0; i
< array
.length
; i
++) {
4454 if (array
[i
] < 16) {
4455 string
+= '0' + array
[i
].toString(16);
4458 string
+= array
[i
].toString(16);
4464 module
.exports
.int32ArrayToHexString
= function toString(array
) {
4466 var len
= array
.length
;
4467 for (var i
= 0; i
< len
; i
++) {
4470 s
= 0xFFFFFFFF + array
[i
] + 1;
4472 var l
= s
.toString(16);
4474 while (l
.length
< padding
) {
4482 module
.exports
.hex2string
= function toString(s
) {
4483 for (var c
= [], len
= s
.length
, i
= 0; i
< len
; i
+= 2)
4484 c
.push(String
.fromCharCode(parseInt(s
.substring(i
, i
+ 2), 16)));
4488 module
.exports
.hex2bytes
= function toString(s
) {
4489 for (var c
= [], len
= s
.length
, i
= 0; i
< len
; i
+= 2)
4490 c
.push(parseInt(s
.substring(i
, i
+ 2), 16));
4494 module.exports.string2hex = function toString(s) {
4496 for (var p = [], len = s.length, i = 0; i < len; i++) {
4497 p.push((256 + s.charCodeAt(i)).toString(16).substring(1));
4502 module
.exports
.string2bytes = function(s
) {
4504 var b
= new Array(len
);
4507 b
[i
] = s
.charCodeAt(i
);
4513 module.exports.bytes2Int16Buffer = function(b) {
4515 var bufferLength = len ? (((len - 1) >>> 1) + 1) : 0;
4516 var buffer = new Array(bufferLength);
4520 buffer[j] = (buffer[j] << 8) | b[i];
4528 module
.exports
.bytes2Int32Buffer = function(b
) {
4530 var len
= b
.length
? (((b
.length
- 1) >>> 2) + 1) : 0;
4531 var buffer
= new Array(len
);
4534 buffer
[j
] = (b
[j
* 4] << 24) | (b
[j
* 4 + 1] << 16) | (b
[j
* 4 + 2] << 8) | b
[j
* 4 + 3];
4540 module.exports.bytes2Int32BufferLeAligned = function(b) {
4542 if (!len) return [];
4543 var len2 = len ? (((len - 1) >>> 2) + 1) : 0;
4544 var buffer = new Array(len);
4547 buffer[j] = (b[j * 4 + 3] << 24) | (b[j * 4 + 2] << 16) | (b[j * 4 + 1] << 8) | b[j * 4];
4553 module
.exports
.bytes2Int64Buffer = function(b
) {
4555 var len
= b
.length
? (((b
.length
- 1) >>> 3) + 1) : 0;
4556 var buffer
= new Array(len
);
4559 buffer
[j
] = new op
.u64((b
[j
* 8] << 24) | (b
[j
* 8 + 1] << 16) | (b
[j
* 8 + 2] << 8) | b
[j
* 8 + 3], (b
[j
* 8 + 4] << 24) | (b
[j
* 8 + 5] << 16) | (b
[j
* 8 + 6] << 8) | b
[j
* 8 + 7]);
4565 module
.exports
.bytes2Int64BufferLeAligned = function(b
) {
4567 var len
= b
.length
? ((( b
.length
- 1) >>> 3) + 1) : 0;
4568 var buffer
= new Array(len
);
4571 buffer
[j
] = new op
.u64((b
[j
* 8 + 7] << 24) | (b
[j
* 8 + 6] << 16) | (b
[j
* 8 + 5] << 8) | b
[j
* 8 + 4], (b
[j
* 8 + 3] << 24) | (b
[j
* 8 + 2] << 16) | (b
[j
* 8 + 1] << 8) | b
[j
* 8]);
4577 module
.exports
.bufferEncode64leAligned = function(buffer
, offset
, uint64
) {
4578 buffer
[offset
+ 7] = uint64
.hi
>>> 24;
4579 buffer
[offset
+ 6] = uint64
.hi
>>> 16 & 0xFF;
4580 buffer
[offset
+ 5] = uint64
.hi
>>> 8 & 0xFF;
4581 buffer
[offset
+ 4] = uint64
.hi
& 0xFF;
4582 buffer
[offset
+ 3] = uint64
.lo
>>> 24;
4583 buffer
[offset
+ 2] = uint64
.lo
>>> 16 & 0xFF;
4584 buffer
[offset
+ 1] = uint64
.lo
>>> 8 & 0xFF;
4585 buffer
[offset
+ 0] = uint64
.lo
& 0xFF;
4588 module
.exports
.bufferEncode64 = function(buffer
, offset
, uint64
) {
4589 buffer
[offset
] = uint64
.hi
>>> 24;
4590 buffer
[offset
+ 1] = uint64
.hi
>>> 16 & 0xFF;
4591 buffer
[offset
+ 2] = uint64
.hi
>>> 8 & 0xFF;
4592 buffer
[offset
+ 3] = uint64
.hi
& 0xFF;
4593 buffer
[offset
+ 4] = uint64
.lo
>>> 24;
4594 buffer
[offset
+ 5] = uint64
.lo
>>> 16 & 0xFF;
4595 buffer
[offset
+ 6] = uint64
.lo
>>> 8 & 0xFF;
4596 buffer
[offset
+ 7] = uint64
.lo
& 0xFF;
4599 module
.exports
.int32Buffer2Bytes = function(b
) {
4600 var buffer
= new Array(b
.length
);
4604 buffer
[i
* 4] = (b
[i
] & 0xFF000000) >>> 24;
4605 buffer
[i
* 4 + 1] = (b
[i
] & 0x00FF0000) >>> 16;
4606 buffer
[i
* 4 + 2] = (b
[i
] & 0x0000FF00) >>> 8;
4607 buffer
[i
* 4 + 3] = (b
[i
] & 0x000000FF);
4613 module.exports.int64Buffer2Bytes = function(b) {
4614 var buffer = new Array(b.length);
4616 while (i < b.length) {
4617 buffer[i * 8] = (b[i].hi & 0xFF000000) >>> 24;
4618 buffer[i * 8 + 1] = (b[i].hi & 0x00FF0000) >>> 16;
4619 buffer[i * 8 + 2] = (b[i].hi & 0x0000FF00) >>> 8;
4620 buffer[i * 8 + 3] = (b[i].hi & 0x000000FF);
4621 buffer[i * 8 + 4] = (b[i].lo & 0xFF000000) >>> 24;
4622 buffer[i * 8 + 5] = (b[i].lo & 0x00FF0000) >>> 16;
4623 buffer[i * 8 + 6] = (b[i].lo & 0x0000FF00) >>> 8;
4624 buffer[i * 8 + 7] = (b[i].lo & 0x000000FF);
4631 module
.exports
.string2Int32Buffer = function(s
) {
4632 return this.bytes2Int32Buffer(this.string2bytes(s
));
4635 var keyStr
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
4637 module
.exports
.b64Encode = function(input
) {
4639 var chr1
, chr2
, chr3
, enc1
, enc2
, enc3
, enc4
;
4642 while (i
< input
.length
) {
4649 enc2
= ((chr1
& 3) << 4) | (chr2
>> 4);
4650 enc3
= ((chr2
& 15) << 2) | (chr3
>> 6);
4656 else if (isNaN(chr3
)) {
4661 keyStr
.charAt(enc1
) + keyStr
.charAt(enc2
) +
4662 keyStr
.charAt(enc3
) + keyStr
.charAt(enc4
);
4668 module
.exports
.b64Decode = function(input
) {
4670 var chr1
, chr2
, chr3
;
4671 var enc1
, enc2
, enc3
, enc4
;
4674 input
= input
.replace(/[^A-Za-z0-9\+\/\=]/g, "");
4676 while (i
< input
.length
) {
4678 enc1
= keyStr
.indexOf(input
.charAt(i
++));
4679 enc2
= keyStr
.indexOf(input
.charAt(i
++));
4680 enc3
= keyStr
.indexOf(input
.charAt(i
++));
4681 enc4
= keyStr
.indexOf(input
.charAt(i
++));
4683 chr1
= (enc1
<< 2) | (enc2
>> 4);
4684 chr2
= ((enc2
& 15) << 4) | (enc3
>> 2);
4685 chr3
= ((enc3
& 3) << 6) | enc4
;
4698 },{"./op.js":30}],30:[function(require
,module
,exports
){
4700 //the right shift is important, it has to do with 32 bit operations in javascript, it will make things faster
4701 function u64(h
, l
) {
4706 u64
.prototype.set = function(oWord
) {
4711 u64
.prototype.add = function(oWord
) {
4712 var lowest
, lowMid
, highMid
, highest
; //four parts of the whole 64 bit number..
4714 //need to add the respective parts from each number and the carry if on is present..
4715 lowest
= (this.lo
& 0XFFFF
) + (oWord
.lo
& 0XFFFF
);
4716 lowMid
= (this.lo
>>> 16) + (oWord
.lo
>>> 16) + (lowest
>>> 16);
4717 highMid
= (this.hi
& 0XFFFF
) + (oWord
.hi
& 0XFFFF
) + (lowMid
>>> 16);
4718 highest
= (this.hi
>>> 16) + (oWord
.hi
>>> 16) + (highMid
>>> 16);
4720 //now set the hgih and the low accordingly..
4721 this.lo
= (lowMid
<< 16) | (lowest
& 0XFFFF
);
4722 this.hi
= (highest
<< 16) | (highMid
& 0XFFFF
);
4724 return this; //for chaining..
4727 u64
.prototype.addOne = function() {
4728 if (this.lo
=== -1 || this.lo
=== 0xFFFFFFFF) {
4737 u64
.prototype.plus = function(oWord
) {
4738 var c
= new u64(0, 0);
4739 var lowest
, lowMid
, highMid
, highest
; //four parts of the whole 64 bit number..
4741 //need to add the respective parts from each number and the carry if on is present..
4742 lowest
= (this.lo
& 0XFFFF
) + (oWord
.lo
& 0XFFFF
);
4743 lowMid
= (this.lo
>>> 16) + (oWord
.lo
>>> 16) + (lowest
>>> 16);
4744 highMid
= (this.hi
& 0XFFFF
) + (oWord
.hi
& 0XFFFF
) + (lowMid
>>> 16);
4745 highest
= (this.hi
>>> 16) + (oWord
.hi
>>> 16) + (highMid
>>> 16);
4747 //now set the hgih and the low accordingly..
4748 c
.lo
= (lowMid
<< 16) | (lowest
& 0XFFFF
);
4749 c
.hi
= (highest
<< 16) | (highMid
& 0XFFFF
);
4751 return c
; //for chaining..
4754 u64
.prototype.not = function() {
4755 return new u64(~this.hi
, ~this.lo
);
4758 u64
.prototype.one = function() {
4759 return new u64(0x0, 0x1);
4762 u64
.prototype.zero = function() {
4763 return new u64(0x0, 0x0);
4766 u64
.prototype.neg = function() {
4767 return this.not().plus(this.one());
4770 u64
.prototype.minus = function(oWord
) {
4771 return this.plus(oWord
.neg());
4774 u64
.prototype.isZero = function() {
4775 return (this.lo
=== 0) && (this.hi
=== 0);
4778 function isLong(obj
) {
4779 return (obj
&& obj
["__isLong__"]) === true;
4782 function fromNumber(value
) {
4783 if (isNaN(value
) || !isFinite(value
))
4785 var pow32
= (1 << 32);
4786 return new u64((value
% pow32
) | 0, (value
/ pow32
) | 0);
4789 u64
.prototype.multiply = function(multiplier
) {
4792 if (!isLong(multiplier
))
4793 multiplier
= fromNumber(multiplier
);
4794 if (multiplier
.isZero())
4797 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
4798 // We can skip products that would overflow.
4800 var a48
= this.hi
>>> 16;
4801 var a32
= this.hi
& 0xFFFF;
4802 var a16
= this.lo
>>> 16;
4803 var a00
= this.lo
& 0xFFFF;
4805 var b48
= multiplier
.hi
>>> 16;
4806 var b32
= multiplier
.hi
& 0xFFFF;
4807 var b16
= multiplier
.lo
>>> 16;
4808 var b00
= multiplier
.lo
& 0xFFFF;
4832 c48
+= a48
* b00
+ a32
* b16
+ a16
* b32
+ a00
* b48
;
4834 return new u64((c48
<< 16) | c32
, (c16
<< 16) | c00
);
4837 u64
.prototype.shiftLeft = function(bits
) {
4839 var c
= new u64(0, 0);
4841 return this.clone();
4843 else if (bits
> 31) {
4845 c
.hi
= this.lo
<< (bits
- 32);
4848 var toMoveUp
= this.lo
>>> 32 - bits
;
4849 c
.lo
= this.lo
<< bits
;
4850 c
.hi
= (this.hi
<< bits
) | toMoveUp
;
4852 return c
; //for chaining..
4855 u64
.prototype.setShiftLeft = function(bits
) {
4864 this.hi
= this.lo
<< (bits
- 32);
4868 var toMoveUp
= this.lo
>>> 32 - bits
;
4870 this.hi
= (this.hi
<< bits
) | toMoveUp
;
4872 return this; //for chaining..
4874 //Shifts this word by the given number of bits to the right (max 32)..
4875 u64
.prototype.shiftRight = function(bits
) {
4877 var c
= new u64(0, 0);
4879 return this.clone();
4881 else if (bits
>= 32) {
4883 c
.lo
= this.hi
>>> (bits
- 32);
4886 var bitsOff32
= 32 - bits
,
4887 toMoveDown
= this.hi
<< bitsOff32
>>> bitsOff32
;
4888 c
.hi
= this.hi
>>> bits
;
4889 c
.lo
= this.lo
>>> bits
| (toMoveDown
<< bitsOff32
);
4891 return c
; //for chaining..
4893 //Rotates the bits of this word round to the left (max 32)..
4894 u64
.prototype.rotateLeft = function(bits
) {
4896 return this.rotateRight(64 - bits
);
4898 var c
= new u64(0, 0);
4900 c
.lo
= this.lo
>>> 0;
4901 c
.hi
= this.hi
>>> 0;
4903 else if (bits
=== 32) { //just switch high and low over in this case..
4908 c
.lo
= (this.lo
<< bits
) | (this.hi
>>> (32 - bits
));
4909 c
.hi
= (this.hi
<< bits
) | (this.lo
>>> (32 - bits
));
4911 return c
; //for chaining..
4914 u64
.prototype.setRotateLeft = function(bits
) {
4916 return this.setRotateRight(64 - bits
);
4922 else if (bits
=== 32) { //just switch high and low over in this case..
4928 newHigh
= (this.hi
<< bits
) | (this.lo
>>> (32 - bits
));
4929 this.lo
= (this.lo
<< bits
) | (this.hi
>>> (32 - bits
));
4932 return this; //for chaining..
4934 //Rotates the bits of this word round to the right (max 32)..
4935 u64
.prototype.rotateRight = function(bits
) {
4937 return this.rotateLeft(64 - bits
);
4939 var c
= new u64(0, 0);
4941 c
.lo
= this.lo
>>> 0;
4942 c
.hi
= this.hi
>>> 0;
4944 else if (bits
=== 32) { //just switch high and low over in this case..
4949 c
.lo
= (this.hi
<< (32 - bits
)) | (this.lo
>>> bits
);
4950 c
.hi
= (this.lo
<< (32 - bits
)) | (this.hi
>>> bits
);
4952 return c
; //for chaining..
4954 u64
.prototype.setFlip = function() {
4961 //Rotates the bits of this word round to the right (max 32)..
4962 u64
.prototype.setRotateRight = function(bits
) {
4964 return this.setRotateLeft(64 - bits
);
4970 else if (bits
=== 32) { //just switch high and low over in this case..
4977 newHigh
= (this.lo
<< (32 - bits
)) | (this.hi
>>> bits
);
4978 this.lo
= (this.hi
<< (32 - bits
)) | (this.lo
>>> bits
);
4981 return this; //for chaining..
4983 //Xors this word with the given other..
4984 u64
.prototype.xor = function(oWord
) {
4985 var c
= new u64(0, 0);
4986 c
.hi
= this.hi
^ oWord
.hi
;
4987 c
.lo
= this.lo
^ oWord
.lo
;
4988 return c
; //for chaining..
4990 //Xors this word with the given other..
4991 u64
.prototype.setxorOne = function(oWord
) {
4992 this.hi
^= oWord
.hi
;
4993 this.lo
^= oWord
.lo
;
4994 return this; //for chaining..
4996 //Ands this word with the given other..
4997 u64
.prototype.and = function(oWord
) {
4998 var c
= new u64(0, 0);
4999 c
.hi
= this.hi
& oWord
.hi
;
5000 c
.lo
= this.lo
& oWord
.lo
;
5001 return c
; //for chaining..
5004 //Creates a deep copy of this Word..
5005 u64
.prototype.clone = function() {
5006 return new u64(this.hi
, this.lo
);
5009 u64
.prototype.setxor64 = function() {
5019 module
.exports
.u64
= u64
;
5021 module
.exports
.u = function(h
, l
) {
5022 return new u64(h
, l
);
5025 module.exports.add64 = function(a, b) {
5026 var lowest, lowMid, highMid, highest; //four parts of the whole 64 bit number..
5028 //need to add the respective parts from each number and the carry if on is present..
5029 lowest = (a.lo & 0XFFFF) + (b.lo & 0XFFFF);
5030 lowMid = (a.lo >>> 16) + (b.lo >>> 16) + (lowest >>> 16);
5031 highMid = (a.hi & 0XFFFF) + (b.hi & 0XFFFF) + (lowMid >>> 16);
5032 highest = (a.hi >>> 16) + (b.hi >>> 16) + (highMid >>> 16);
5034 var r = new this.u64((highest << 16) | (highMid & 0XFFFF), (lowMid << 16) | (lowest & 0XFFFF));
5039 module
.exports
.xor64 = function() {
5049 return new this.u64(h
, l
);
5052 module
.exports
.clone64Array = function(array
) {
5054 var len
= array
.length
;
5055 var a
= new Array(len
);
5063 //this shouldn't be a problem, but who knows in the future javascript might support 64bits
5064 module
.exports
.t32 = function(x
) {
5065 return (x
& 0xFFFFFFFF)
5068 module
.exports
.rotl32 = function(x
, c
) {
5069 return (((x
) << (c
)) | ((x
) >>> (32 - (c
)))) & (0xFFFFFFFF);
5072 module
.exports
.rotr32 = function(x
, c
) {
5073 return this.rotl32(x
, (32 - (c
)));
5076 module
.exports
.swap32 = function(val
) {
5077 return ((val
& 0xFF) << 24) |
5078 ((val
& 0xFF00) << 8) |
5079 ((val
>>> 8) & 0xFF00) |
5080 ((val
>>> 24) & 0xFF);
5083 module
.exports
.swap32Array = function(a
) {
5084 //can't do this with map because of support for IE8 (Don't hate me plz).
5085 var i
= 0, len
= a
.length
;
5086 var r
= new Array(i
);
5088 r
[i
] = (this.swap32(a
[i
]));
5094 module
.exports
.xnd64 = function(x
, y
, z
) {
5095 return new this.u64(x
.hi
^ ((~y
.hi
) & z
.hi
), x
.lo
^ ((~y
.lo
) & z
.lo
));
5098 module.exports.load64 = function(x, i) {
5099 var l = x[i] | (x[i + 1] << 8) | (x[i + 2] << 16) | (x[i + 3] << 24);
5100 var h = x[i + 4] | (x[i + 5] << 8) | (x[i + 6] << 16) | (x[i + 7] << 24);
5101 return new this.u64(h, l);
5104 module
.exports
.bufferInsert = function(buffer
, bufferOffset
, data
, len
, dataOffset
) {
5105 dataOffset
= dataOffset
| 0;
5108 buffer
[i
+ bufferOffset
] = data
[i
+ dataOffset
];
5113 module
.exports
.bufferInsert64 = function(buffer
, bufferOffset
, data
, len
) {
5116 buffer
[i
+ bufferOffset
] = data
[i
].clone();
5121 module.exports.buffer2Insert = function(buffer, bufferOffset, bufferOffset2, data, len, len2) {
5125 buffer[len + bufferOffset][j + bufferOffset2] = data[len][j];
5130 module
.exports
.bufferInsertBackwards = function(buffer
, bufferOffset
, data
, len
) {
5133 buffer
[i
+ bufferOffset
] = data
[len
- 1 - i
];
5138 module
.exports
.bufferSet = function(buffer
, bufferOffset
, value
, len
) {
5141 buffer
[i
+ bufferOffset
] = value
;
5146 module
.exports
.bufferXORInsert = function(buffer
, bufferOffset
, data
, dataOffset
, len
) {
5149 buffer
[i
+ bufferOffset
] ^= data
[i
+ dataOffset
];
5154 module
.exports
.xORTable = function(d
, s1
, s2
, len
) {
5157 d
[i
] = s1
[i
] ^ s2
[i
];
5162 },{}],31:[function(require
,module
,exports
){
5164 var Buffer
= require('safe-buffer').Buffer
5165 var Transform
= require('stream').Transform
5166 var inherits
= require('inherits')
5168 function throwIfNotStringOrBuffer (val
, prefix
) {
5169 if (!Buffer
.isBuffer(val
) && typeof val
!== 'string') {
5170 throw new TypeError(prefix
+ ' must be a string or a buffer')
5174 function HashBase (blockSize
) {
5175 Transform
.call(this)
5177 this._block
= Buffer
.allocUnsafe(blockSize
)
5178 this._blockSize
= blockSize
5179 this._blockOffset
= 0
5180 this._length
= [0, 0, 0, 0]
5182 this._finalized
= false
5185 inherits(HashBase
, Transform
)
5187 HashBase
.prototype._transform = function (chunk
, encoding
, callback
) {
5190 this.update(chunk
, encoding
)
5198 HashBase
.prototype._flush = function (callback
) {
5201 this.push(this.digest())
5209 HashBase
.prototype.update = function (data
, encoding
) {
5210 throwIfNotStringOrBuffer(data
, 'Data')
5211 if (this._finalized
) throw new Error('Digest already called')
5212 if (!Buffer
.isBuffer(data
)) data
= Buffer
.from(data
, encoding
)
5215 var block
= this._block
5217 while (this._blockOffset
+ data
.length
- offset
>= this._blockSize
) {
5218 for (var i
= this._blockOffset
; i
< this._blockSize
;) block
[i
++] = data
[offset
++]
5220 this._blockOffset
= 0
5222 while (offset
< data
.length
) block
[this._blockOffset
++] = data
[offset
++]
5225 for (var j
= 0, carry
= data
.length
* 8; carry
> 0; ++j
) {
5226 this._length
[j
] += carry
5227 carry
= (this._length
[j
] / 0x0100000000) | 0
5228 if (carry
> 0) this._length
[j
] -= 0x0100000000 * carry
5234 HashBase
.prototype._update = function () {
5235 throw new Error('_update is not implemented')
5238 HashBase
.prototype.digest = function (encoding
) {
5239 if (this._finalized
) throw new Error('Digest already called')
5240 this._finalized
= true
5242 var digest
= this._digest()
5243 if (encoding
!== undefined) digest
= digest
.toString(encoding
)
5247 this._blockOffset
= 0
5248 for (var i
= 0; i
< 4; ++i
) this._length
[i
] = 0
5253 HashBase
.prototype._digest = function () {
5254 throw new Error('_digest is not implemented')
5257 module
.exports
= HashBase
5259 },{"inherits":32,"safe-buffer":38,"stream":122}],32:[function(require
,module
,exports
){
5260 if (typeof Object
.create
=== 'function') {
5261 // implementation from standard node.js 'util' module
5262 module
.exports
= function inherits(ctor
, superCtor
) {
5264 ctor
.super_
= superCtor
5265 ctor
.prototype = Object
.create(superCtor
.prototype, {
5276 // old school shim for old browsers
5277 module
.exports
= function inherits(ctor
, superCtor
) {
5279 ctor
.super_
= superCtor
5280 var TempCtor = function () {}
5281 TempCtor
.prototype = superCtor
.prototype
5282 ctor
.prototype = new TempCtor()
5283 ctor
.prototype.constructor = ctor
5288 },{}],33:[function(require
,module
,exports
){
5290 var inherits
= require('inherits')
5291 var HashBase
= require('hash-base')
5292 var Buffer
= require('safe-buffer').Buffer
5294 var ARRAY16
= new Array(16)
5297 HashBase
.call(this, 64)
5300 this._a
= 0x67452301
5301 this._b
= 0xefcdab89
5302 this._c
= 0x98badcfe
5303 this._d
= 0x10325476
5306 inherits(MD5
, HashBase
)
5308 MD5
.prototype._update = function () {
5310 for (var i
= 0; i
< 16; ++i
) M
[i
] = this._block
.readInt32LE(i
* 4)
5317 a
= fnF(a
, b
, c
, d
, M
[0], 0xd76aa478, 7)
5318 d
= fnF(d
, a
, b
, c
, M
[1], 0xe8c7b756, 12)
5319 c
= fnF(c
, d
, a
, b
, M
[2], 0x242070db, 17)
5320 b
= fnF(b
, c
, d
, a
, M
[3], 0xc1bdceee, 22)
5321 a
= fnF(a
, b
, c
, d
, M
[4], 0xf57c0faf, 7)
5322 d
= fnF(d
, a
, b
, c
, M
[5], 0x4787c62a, 12)
5323 c
= fnF(c
, d
, a
, b
, M
[6], 0xa8304613, 17)
5324 b
= fnF(b
, c
, d
, a
, M
[7], 0xfd469501, 22)
5325 a
= fnF(a
, b
, c
, d
, M
[8], 0x698098d8, 7)
5326 d
= fnF(d
, a
, b
, c
, M
[9], 0x8b44f7af, 12)
5327 c
= fnF(c
, d
, a
, b
, M
[10], 0xffff5bb1, 17)
5328 b
= fnF(b
, c
, d
, a
, M
[11], 0x895cd7be, 22)
5329 a
= fnF(a
, b
, c
, d
, M
[12], 0x6b901122, 7)
5330 d
= fnF(d
, a
, b
, c
, M
[13], 0xfd987193, 12)
5331 c
= fnF(c
, d
, a
, b
, M
[14], 0xa679438e, 17)
5332 b
= fnF(b
, c
, d
, a
, M
[15], 0x49b40821, 22)
5334 a
= fnG(a
, b
, c
, d
, M
[1], 0xf61e2562, 5)
5335 d
= fnG(d
, a
, b
, c
, M
[6], 0xc040b340, 9)
5336 c
= fnG(c
, d
, a
, b
, M
[11], 0x265e5a51, 14)
5337 b
= fnG(b
, c
, d
, a
, M
[0], 0xe9b6c7aa, 20)
5338 a
= fnG(a
, b
, c
, d
, M
[5], 0xd62f105d, 5)
5339 d
= fnG(d
, a
, b
, c
, M
[10], 0x02441453, 9)
5340 c
= fnG(c
, d
, a
, b
, M
[15], 0xd8a1e681, 14)
5341 b
= fnG(b
, c
, d
, a
, M
[4], 0xe7d3fbc8, 20)
5342 a
= fnG(a
, b
, c
, d
, M
[9], 0x21e1cde6, 5)
5343 d
= fnG(d
, a
, b
, c
, M
[14], 0xc33707d6, 9)
5344 c
= fnG(c
, d
, a
, b
, M
[3], 0xf4d50d87, 14)
5345 b
= fnG(b
, c
, d
, a
, M
[8], 0x455a14ed, 20)
5346 a
= fnG(a
, b
, c
, d
, M
[13], 0xa9e3e905, 5)
5347 d
= fnG(d
, a
, b
, c
, M
[2], 0xfcefa3f8, 9)
5348 c
= fnG(c
, d
, a
, b
, M
[7], 0x676f02d9, 14)
5349 b
= fnG(b
, c
, d
, a
, M
[12], 0x8d2a4c8a, 20)
5351 a
= fnH(a
, b
, c
, d
, M
[5], 0xfffa3942, 4)
5352 d
= fnH(d
, a
, b
, c
, M
[8], 0x8771f681, 11)
5353 c
= fnH(c
, d
, a
, b
, M
[11], 0x6d9d6122, 16)
5354 b
= fnH(b
, c
, d
, a
, M
[14], 0xfde5380c, 23)
5355 a
= fnH(a
, b
, c
, d
, M
[1], 0xa4beea44, 4)
5356 d
= fnH(d
, a
, b
, c
, M
[4], 0x4bdecfa9, 11)
5357 c
= fnH(c
, d
, a
, b
, M
[7], 0xf6bb4b60, 16)
5358 b
= fnH(b
, c
, d
, a
, M
[10], 0xbebfbc70, 23)
5359 a
= fnH(a
, b
, c
, d
, M
[13], 0x289b7ec6, 4)
5360 d
= fnH(d
, a
, b
, c
, M
[0], 0xeaa127fa, 11)
5361 c
= fnH(c
, d
, a
, b
, M
[3], 0xd4ef3085, 16)
5362 b
= fnH(b
, c
, d
, a
, M
[6], 0x04881d05, 23)
5363 a
= fnH(a
, b
, c
, d
, M
[9], 0xd9d4d039, 4)
5364 d
= fnH(d
, a
, b
, c
, M
[12], 0xe6db99e5, 11)
5365 c
= fnH(c
, d
, a
, b
, M
[15], 0x1fa27cf8, 16)
5366 b
= fnH(b
, c
, d
, a
, M
[2], 0xc4ac5665, 23)
5368 a
= fnI(a
, b
, c
, d
, M
[0], 0xf4292244, 6)
5369 d
= fnI(d
, a
, b
, c
, M
[7], 0x432aff97, 10)
5370 c
= fnI(c
, d
, a
, b
, M
[14], 0xab9423a7, 15)
5371 b
= fnI(b
, c
, d
, a
, M
[5], 0xfc93a039, 21)
5372 a
= fnI(a
, b
, c
, d
, M
[12], 0x655b59c3, 6)
5373 d
= fnI(d
, a
, b
, c
, M
[3], 0x8f0ccc92, 10)
5374 c
= fnI(c
, d
, a
, b
, M
[10], 0xffeff47d, 15)
5375 b
= fnI(b
, c
, d
, a
, M
[1], 0x85845dd1, 21)
5376 a
= fnI(a
, b
, c
, d
, M
[8], 0x6fa87e4f, 6)
5377 d
= fnI(d
, a
, b
, c
, M
[15], 0xfe2ce6e0, 10)
5378 c
= fnI(c
, d
, a
, b
, M
[6], 0xa3014314, 15)
5379 b
= fnI(b
, c
, d
, a
, M
[13], 0x4e0811a1, 21)
5380 a
= fnI(a
, b
, c
, d
, M
[4], 0xf7537e82, 6)
5381 d
= fnI(d
, a
, b
, c
, M
[11], 0xbd3af235, 10)
5382 c
= fnI(c
, d
, a
, b
, M
[2], 0x2ad7d2bb, 15)
5383 b
= fnI(b
, c
, d
, a
, M
[9], 0xeb86d391, 21)
5385 this._a
= (this._a
+ a
) | 0
5386 this._b
= (this._b
+ b
) | 0
5387 this._c
= (this._c
+ c
) | 0
5388 this._d
= (this._d
+ d
) | 0
5391 MD5
.prototype._digest = function () {
5392 // create padding and handle blocks
5393 this._block
[this._blockOffset
++] = 0x80
5394 if (this._blockOffset
> 56) {
5395 this._block
.fill(0, this._blockOffset
, 64)
5397 this._blockOffset
= 0
5400 this._block
.fill(0, this._blockOffset
, 56)
5401 this._block
.writeUInt32LE(this._length
[0], 56)
5402 this._block
.writeUInt32LE(this._length
[1], 60)
5406 var buffer
= Buffer
.allocUnsafe(16)
5407 buffer
.writeInt32LE(this._a
, 0)
5408 buffer
.writeInt32LE(this._b
, 4)
5409 buffer
.writeInt32LE(this._c
, 8)
5410 buffer
.writeInt32LE(this._d
, 12)
5414 function rotl (x
, n
) {
5415 return (x
<< n
) | (x
>>> (32 - n
))
5418 function fnF (a
, b
, c
, d
, m
, k
, s
) {
5419 return (rotl((a
+ ((b
& c
) | ((~b
) & d
)) + m
+ k
) | 0, s
) + b
) | 0
5422 function fnG (a
, b
, c
, d
, m
, k
, s
) {
5423 return (rotl((a
+ ((b
& d
) | (c
& (~d
))) + m
+ k
) | 0, s
) + b
) | 0
5426 function fnH (a
, b
, c
, d
, m
, k
, s
) {
5427 return (rotl((a
+ (b
^ c
^ d
) + m
+ k
) | 0, s
) + b
) | 0
5430 function fnI (a
, b
, c
, d
, m
, k
, s
) {
5431 return (rotl((a
+ ((c
^ (b
| (~d
)))) + m
+ k
) | 0, s
) + b
) | 0
5434 module
.exports
= MD5
5436 },{"hash-base":31,"inherits":32,"safe-buffer":38}],34:[function(require
,module
,exports
){
5438 // constant-space merkle root calculation algorithm
5439 module
.exports
= function fastRoot (values
, digestFn
) {
5440 if (!Array
.isArray(values
)) throw TypeError('Expected values Array')
5441 if (typeof digestFn
!== 'function') throw TypeError('Expected digest Function')
5443 var length
= values
.length
5444 var results
= values
.concat()
5446 while (length
> 1) {
5449 for (var i
= 0; i
< length
; i
+= 2, ++j
) {
5450 var left
= results
[i
]
5451 var right
= i
+ 1 === length
? left : results
[i
+ 1]
5452 var data
= Buffer
.concat([left
, right
])
5454 results
[j
] = digestFn(data
)
5463 }).call(this,require("buffer").Buffer
)
5464 },{"buffer":96}],35:[function(require
,module
,exports
){
5465 var OPS
= require('bitcoin-ops')
5467 function encodingLength (i
) {
5468 return i
< OPS
.OP_PUSHDATA1
? 1
5474 function encode (buffer
, number
, offset
) {
5475 var size
= encodingLength(number
)
5479 buffer
.writeUInt8(number
, offset
)
5482 } else if (size
=== 2) {
5483 buffer
.writeUInt8(OPS
.OP_PUSHDATA1
, offset
)
5484 buffer
.writeUInt8(number
, offset
+ 1)
5487 } else if (size
=== 3) {
5488 buffer
.writeUInt8(OPS
.OP_PUSHDATA2
, offset
)
5489 buffer
.writeUInt16LE(number
, offset
+ 1)
5493 buffer
.writeUInt8(OPS
.OP_PUSHDATA4
, offset
)
5494 buffer
.writeUInt32LE(number
, offset
+ 1)
5500 function decode (buffer
, offset
) {
5501 var opcode
= buffer
.readUInt8(offset
)
5505 if (opcode
< OPS
.OP_PUSHDATA1
) {
5510 } else if (opcode
=== OPS
.OP_PUSHDATA1
) {
5511 if (offset
+ 2 > buffer
.length
) return null
5512 number
= buffer
.readUInt8(offset
+ 1)
5516 } else if (opcode
=== OPS
.OP_PUSHDATA2
) {
5517 if (offset
+ 3 > buffer
.length
) return null
5518 number
= buffer
.readUInt16LE(offset
+ 1)
5523 if (offset
+ 5 > buffer
.length
) return null
5524 if (opcode
!== OPS
.OP_PUSHDATA4
) throw new Error('Unexpected opcode')
5526 number
= buffer
.readUInt32LE(offset
+ 1)
5538 encodingLength: encodingLength
,
5543 },{"bitcoin-ops":8}],36:[function(require
,module
,exports
){
5544 (function (process
,global
){
5547 // limit of Crypto.getRandomValues()
5548 // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
5549 var MAX_BYTES
= 65536
5551 // Node supports requesting up to this number of bytes
5552 // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
5553 var MAX_UINT32
= 4294967295
5555 function oldBrowser () {
5556 throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
5559 var Buffer
= require('safe-buffer').Buffer
5560 var crypto
= global
.crypto
|| global
.msCrypto
5562 if (crypto
&& crypto
.getRandomValues
) {
5563 module
.exports
= randomBytes
5565 module
.exports
= oldBrowser
5568 function randomBytes (size
, cb
) {
5569 // phantomjs needs to throw
5570 if (size
> MAX_UINT32
) throw new RangeError('requested too many random bytes')
5572 var bytes
= Buffer
.allocUnsafe(size
)
5574 if (size
> 0) { // getRandomValues fails on IE if size == 0
5575 if (size
> MAX_BYTES
) { // this is the max bytes crypto.getRandomValues
5576 // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
5577 for (var generated
= 0; generated
< size
; generated
+= MAX_BYTES
) {
5578 // buffer.slice automatically checks if the end is past the end of
5579 // the buffer so we don't have to here
5580 crypto
.getRandomValues(bytes
.slice(generated
, generated
+ MAX_BYTES
))
5583 crypto
.getRandomValues(bytes
)
5587 if (typeof cb
=== 'function') {
5588 return process
.nextTick(function () {
5596 }).call(this,require('_process'),typeof global
!== "undefined" ? global : typeof self
!== "undefined" ? self : typeof window
!== "undefined" ? window : {})
5597 },{"_process":105,"safe-buffer":38}],37:[function(require
,module
,exports
){
5599 var Buffer
= require('buffer').Buffer
5600 var inherits
= require('inherits')
5601 var HashBase
= require('hash-base')
5603 var ARRAY16
= new Array(16)
5606 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
5607 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
5608 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
5609 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
5610 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
5614 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
5615 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
5616 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
5617 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
5618 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
5622 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
5623 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
5624 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
5625 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
5626 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
5630 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
5631 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
5632 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
5633 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
5634 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
5637 var hl
= [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
5638 var hr
= [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
5640 function RIPEMD160 () {
5641 HashBase
.call(this, 64)
5644 this._a
= 0x67452301
5645 this._b
= 0xefcdab89
5646 this._c
= 0x98badcfe
5647 this._d
= 0x10325476
5648 this._e
= 0xc3d2e1f0
5651 inherits(RIPEMD160
, HashBase
)
5653 RIPEMD160
.prototype._update = function () {
5655 for (var j
= 0; j
< 16; ++j
) words
[j
] = this._block
.readInt32LE(j
* 4)
5657 var al
= this._a
| 0
5658 var bl
= this._b
| 0
5659 var cl
= this._c
| 0
5660 var dl
= this._d
| 0
5661 var el
= this._e
| 0
5663 var ar
= this._a
| 0
5664 var br
= this._b
| 0
5665 var cr
= this._c
| 0
5666 var dr
= this._d
| 0
5667 var er
= this._e
| 0
5670 for (var i
= 0; i
< 80; i
+= 1) {
5674 tl
= fn1(al
, bl
, cl
, dl
, el
, words
[zl
[i
]], hl
[0], sl
[i
])
5675 tr
= fn5(ar
, br
, cr
, dr
, er
, words
[zr
[i
]], hr
[0], sr
[i
])
5676 } else if (i
< 32) {
5677 tl
= fn2(al
, bl
, cl
, dl
, el
, words
[zl
[i
]], hl
[1], sl
[i
])
5678 tr
= fn4(ar
, br
, cr
, dr
, er
, words
[zr
[i
]], hr
[1], sr
[i
])
5679 } else if (i
< 48) {
5680 tl
= fn3(al
, bl
, cl
, dl
, el
, words
[zl
[i
]], hl
[2], sl
[i
])
5681 tr
= fn3(ar
, br
, cr
, dr
, er
, words
[zr
[i
]], hr
[2], sr
[i
])
5682 } else if (i
< 64) {
5683 tl
= fn4(al
, bl
, cl
, dl
, el
, words
[zl
[i
]], hl
[3], sl
[i
])
5684 tr
= fn2(ar
, br
, cr
, dr
, er
, words
[zr
[i
]], hr
[3], sr
[i
])
5685 } else { // if (i<80) {
5686 tl
= fn5(al
, bl
, cl
, dl
, el
, words
[zl
[i
]], hl
[4], sl
[i
])
5687 tr
= fn1(ar
, br
, cr
, dr
, er
, words
[zr
[i
]], hr
[4], sr
[i
])
5704 var t
= (this._b
+ cl
+ dr
) | 0
5705 this._b
= (this._c
+ dl
+ er
) | 0
5706 this._c
= (this._d
+ el
+ ar
) | 0
5707 this._d
= (this._e
+ al
+ br
) | 0
5708 this._e
= (this._a
+ bl
+ cr
) | 0
5712 RIPEMD160
.prototype._digest = function () {
5713 // create padding and handle blocks
5714 this._block
[this._blockOffset
++] = 0x80
5715 if (this._blockOffset
> 56) {
5716 this._block
.fill(0, this._blockOffset
, 64)
5718 this._blockOffset
= 0
5721 this._block
.fill(0, this._blockOffset
, 56)
5722 this._block
.writeUInt32LE(this._length
[0], 56)
5723 this._block
.writeUInt32LE(this._length
[1], 60)
5727 var buffer
= Buffer
.alloc
? Buffer
.alloc(20) : new Buffer(20)
5728 buffer
.writeInt32LE(this._a
, 0)
5729 buffer
.writeInt32LE(this._b
, 4)
5730 buffer
.writeInt32LE(this._c
, 8)
5731 buffer
.writeInt32LE(this._d
, 12)
5732 buffer
.writeInt32LE(this._e
, 16)
5736 function rotl (x
, n
) {
5737 return (x
<< n
) | (x
>>> (32 - n
))
5740 function fn1 (a
, b
, c
, d
, e
, m
, k
, s
) {
5741 return (rotl((a
+ (b
^ c
^ d
) + m
+ k
) | 0, s
) + e
) | 0
5744 function fn2 (a
, b
, c
, d
, e
, m
, k
, s
) {
5745 return (rotl((a
+ ((b
& c
) | ((~b
) & d
)) + m
+ k
) | 0, s
) + e
) | 0
5748 function fn3 (a
, b
, c
, d
, e
, m
, k
, s
) {
5749 return (rotl((a
+ ((b
| (~c
)) ^ d
) + m
+ k
) | 0, s
) + e
) | 0
5752 function fn4 (a
, b
, c
, d
, e
, m
, k
, s
) {
5753 return (rotl((a
+ ((b
& d
) | (c
& (~d
))) + m
+ k
) | 0, s
) + e
) | 0
5756 function fn5 (a
, b
, c
, d
, e
, m
, k
, s
) {
5757 return (rotl((a
+ (b
^ (c
| (~d
))) + m
+ k
) | 0, s
) + e
) | 0
5760 module
.exports
= RIPEMD160
5762 },{"buffer":96,"hash-base":31,"inherits":32}],38:[function(require
,module
,exports
){
5763 /* eslint-disable node/no-deprecated-api */
5764 var buffer
= require('buffer')
5765 var Buffer
= buffer
.Buffer
5767 // alternative to using Object.keys for old browsers
5768 function copyProps (src
, dst
) {
5769 for (var key
in src
) {
5773 if (Buffer
.from && Buffer
.alloc
&& Buffer
.allocUnsafe
&& Buffer
.allocUnsafeSlow
) {
5774 module
.exports
= buffer
5776 // Copy properties from require('buffer')
5777 copyProps(buffer
, exports
)
5778 exports
.Buffer
= SafeBuffer
5781 function SafeBuffer (arg
, encodingOrOffset
, length
) {
5782 return Buffer(arg
, encodingOrOffset
, length
)
5785 SafeBuffer
.prototype = Object
.create(Buffer
.prototype)
5787 // Copy static methods from Buffer
5788 copyProps(Buffer
, SafeBuffer
)
5790 SafeBuffer
.from = function (arg
, encodingOrOffset
, length
) {
5791 if (typeof arg
=== 'number') {
5792 throw new TypeError('Argument must not be a number')
5794 return Buffer(arg
, encodingOrOffset
, length
)
5797 SafeBuffer
.alloc = function (size
, fill
, encoding
) {
5798 if (typeof size
!== 'number') {
5799 throw new TypeError('Argument must be a number')
5801 var buf
= Buffer(size
)
5802 if (fill
!== undefined) {
5803 if (typeof encoding
=== 'string') {
5804 buf
.fill(fill
, encoding
)
5814 SafeBuffer
.allocUnsafe = function (size
) {
5815 if (typeof size
!== 'number') {
5816 throw new TypeError('Argument must be a number')
5821 SafeBuffer
.allocUnsafeSlow = function (size
) {
5822 if (typeof size
!== 'number') {
5823 throw new TypeError('Argument must be a number')
5825 return buffer
.SlowBuffer(size
)
5828 },{"buffer":96}],39:[function(require
,module
,exports
){
5829 var Buffer
= require('safe-buffer').Buffer
5831 // prototype class for hash functions
5832 function Hash (blockSize
, finalSize
) {
5833 this._block
= Buffer
.alloc(blockSize
)
5834 this._finalSize
= finalSize
5835 this._blockSize
= blockSize
5839 Hash
.prototype.update = function (data
, enc
) {
5840 if (typeof data
=== 'string') {
5842 data
= Buffer
.from(data
, enc
)
5845 var block
= this._block
5846 var blockSize
= this._blockSize
5847 var length
= data
.length
5848 var accum
= this._len
5850 for (var offset
= 0; offset
< length
;) {
5851 var assigned
= accum
% blockSize
5852 var remainder
= Math
.min(length
- offset
, blockSize
- assigned
)
5854 for (var i
= 0; i
< remainder
; i
++) {
5855 block
[assigned
+ i
] = data
[offset
+ i
]
5861 if ((accum
% blockSize
) === 0) {
5870 Hash
.prototype.digest = function (enc
) {
5871 var rem
= this._len
% this._blockSize
5873 this._block
[rem
] = 0x80
5875 // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
5876 // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
5877 this._block
.fill(0, rem
+ 1)
5879 if (rem
>= this._finalSize
) {
5880 this._update(this._block
)
5884 var bits
= this._len
* 8
5887 if (bits
<= 0xffffffff) {
5888 this._block
.writeUInt32BE(bits
, this._blockSize
- 4)
5892 var lowBits
= (bits
& 0xffffffff) >>> 0
5893 var highBits
= (bits
- lowBits
) / 0x100000000
5895 this._block
.writeUInt32BE(highBits
, this._blockSize
- 8)
5896 this._block
.writeUInt32BE(lowBits
, this._blockSize
- 4)
5899 this._update(this._block
)
5900 var hash
= this._hash()
5902 return enc
? hash
.toString(enc
) : hash
5905 Hash
.prototype._update = function () {
5906 throw new Error('_update must be implemented by subclass')
5909 module
.exports
= Hash
5911 },{"safe-buffer":38}],40:[function(require
,module
,exports
){
5912 var exports
= module
.exports
= function SHA (algorithm
) {
5913 algorithm
= algorithm
.toLowerCase()
5915 var Algorithm
= exports
[algorithm
]
5916 if (!Algorithm
) throw new Error(algorithm
+ ' is not supported (we accept pull requests)')
5918 return new Algorithm()
5921 exports
.sha
= require('./sha')
5922 exports
.sha1
= require('./sha1')
5923 exports
.sha224
= require('./sha224')
5924 exports
.sha256
= require('./sha256')
5925 exports
.sha384
= require('./sha384')
5926 exports
.sha512
= require('./sha512')
5928 },{"./sha":41,"./sha1":42,"./sha224":43,"./sha256":44,"./sha384":45,"./sha512":46}],41:[function(require
,module
,exports
){
5930 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
5932 * This source code is derived from sha1.js of the same repository.
5933 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
5934 * operation was added.
5937 var inherits
= require('inherits')
5938 var Hash
= require('./hash')
5939 var Buffer
= require('safe-buffer').Buffer
5942 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
5945 var W
= new Array(80)
5951 Hash
.call(this, 64, 56)
5956 Sha
.prototype.init = function () {
5957 this._a
= 0x67452301
5958 this._b
= 0xefcdab89
5959 this._c
= 0x98badcfe
5960 this._d
= 0x10325476
5961 this._e
= 0xc3d2e1f0
5966 function rotl5 (num
) {
5967 return (num
<< 5) | (num
>>> 27)
5970 function rotl30 (num
) {
5971 return (num
<< 30) | (num
>>> 2)
5974 function ft (s
, b
, c
, d
) {
5975 if (s
=== 0) return (b
& c
) | ((~b
) & d
)
5976 if (s
=== 2) return (b
& c
) | (b
& d
) | (c
& d
)
5980 Sha
.prototype._update = function (M
) {
5989 for (var i
= 0; i
< 16; ++i
) W
[i
] = M
.readInt32BE(i
* 4)
5990 for (; i
< 80; ++i
) W
[i
] = W
[i
- 3] ^ W
[i
- 8] ^ W
[i
- 14] ^ W
[i
- 16]
5992 for (var j
= 0; j
< 80; ++j
) {
5994 var t
= (rotl5(a
) + ft(s
, b
, c
, d
) + e
+ W
[j
] + K
[s
]) | 0
6003 this._a
= (a
+ this._a
) | 0
6004 this._b
= (b
+ this._b
) | 0
6005 this._c
= (c
+ this._c
) | 0
6006 this._d
= (d
+ this._d
) | 0
6007 this._e
= (e
+ this._e
) | 0
6010 Sha
.prototype._hash = function () {
6011 var H
= Buffer
.allocUnsafe(20)
6013 H
.writeInt32BE(this._a
| 0, 0)
6014 H
.writeInt32BE(this._b
| 0, 4)
6015 H
.writeInt32BE(this._c
| 0, 8)
6016 H
.writeInt32BE(this._d
| 0, 12)
6017 H
.writeInt32BE(this._e
| 0, 16)
6022 module
.exports
= Sha
6024 },{"./hash":39,"inherits":32,"safe-buffer":38}],42:[function(require
,module
,exports
){
6026 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
6028 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
6029 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6030 * Distributed under the BSD License
6031 * See http://pajhome.org.uk/crypt/md5 for details.
6034 var inherits
= require('inherits')
6035 var Hash
= require('./hash')
6036 var Buffer
= require('safe-buffer').Buffer
6039 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
6042 var W
= new Array(80)
6048 Hash
.call(this, 64, 56)
6051 inherits(Sha1
, Hash
)
6053 Sha1
.prototype.init = function () {
6054 this._a
= 0x67452301
6055 this._b
= 0xefcdab89
6056 this._c
= 0x98badcfe
6057 this._d
= 0x10325476
6058 this._e
= 0xc3d2e1f0
6063 function rotl1 (num
) {
6064 return (num
<< 1) | (num
>>> 31)
6067 function rotl5 (num
) {
6068 return (num
<< 5) | (num
>>> 27)
6071 function rotl30 (num
) {
6072 return (num
<< 30) | (num
>>> 2)
6075 function ft (s
, b
, c
, d
) {
6076 if (s
=== 0) return (b
& c
) | ((~b
) & d
)
6077 if (s
=== 2) return (b
& c
) | (b
& d
) | (c
& d
)
6081 Sha1
.prototype._update = function (M
) {
6090 for (var i
= 0; i
< 16; ++i
) W
[i
] = M
.readInt32BE(i
* 4)
6091 for (; i
< 80; ++i
) W
[i
] = rotl1(W
[i
- 3] ^ W
[i
- 8] ^ W
[i
- 14] ^ W
[i
- 16])
6093 for (var j
= 0; j
< 80; ++j
) {
6095 var t
= (rotl5(a
) + ft(s
, b
, c
, d
) + e
+ W
[j
] + K
[s
]) | 0
6104 this._a
= (a
+ this._a
) | 0
6105 this._b
= (b
+ this._b
) | 0
6106 this._c
= (c
+ this._c
) | 0
6107 this._d
= (d
+ this._d
) | 0
6108 this._e
= (e
+ this._e
) | 0
6111 Sha1
.prototype._hash = function () {
6112 var H
= Buffer
.allocUnsafe(20)
6114 H
.writeInt32BE(this._a
| 0, 0)
6115 H
.writeInt32BE(this._b
| 0, 4)
6116 H
.writeInt32BE(this._c
| 0, 8)
6117 H
.writeInt32BE(this._d
| 0, 12)
6118 H
.writeInt32BE(this._e
| 0, 16)
6123 module
.exports
= Sha1
6125 },{"./hash":39,"inherits":32,"safe-buffer":38}],43:[function(require
,module
,exports
){
6127 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
6129 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
6130 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6134 var inherits
= require('inherits')
6135 var Sha256
= require('./sha256')
6136 var Hash
= require('./hash')
6137 var Buffer
= require('safe-buffer').Buffer
6139 var W
= new Array(64)
6141 function Sha224 () {
6144 this._w
= W
// new Array(64)
6146 Hash
.call(this, 64, 56)
6149 inherits(Sha224
, Sha256
)
6151 Sha224
.prototype.init = function () {
6152 this._a
= 0xc1059ed8
6153 this._b
= 0x367cd507
6154 this._c
= 0x3070dd17
6155 this._d
= 0xf70e5939
6156 this._e
= 0xffc00b31
6157 this._f
= 0x68581511
6158 this._g
= 0x64f98fa7
6159 this._h
= 0xbefa4fa4
6164 Sha224
.prototype._hash = function () {
6165 var H
= Buffer
.allocUnsafe(28)
6167 H
.writeInt32BE(this._a
, 0)
6168 H
.writeInt32BE(this._b
, 4)
6169 H
.writeInt32BE(this._c
, 8)
6170 H
.writeInt32BE(this._d
, 12)
6171 H
.writeInt32BE(this._e
, 16)
6172 H
.writeInt32BE(this._f
, 20)
6173 H
.writeInt32BE(this._g
, 24)
6178 module
.exports
= Sha224
6180 },{"./hash":39,"./sha256":44,"inherits":32,"safe-buffer":38}],44:[function(require
,module
,exports
){
6182 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
6184 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
6185 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
6189 var inherits
= require('inherits')
6190 var Hash
= require('./hash')
6191 var Buffer
= require('safe-buffer').Buffer
6194 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
6195 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
6196 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
6197 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
6198 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
6199 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
6200 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
6201 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
6202 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
6203 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
6204 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
6205 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
6206 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
6207 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
6208 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
6209 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
6212 var W
= new Array(64)
6214 function Sha256 () {
6217 this._w
= W
// new Array(64)
6219 Hash
.call(this, 64, 56)
6222 inherits(Sha256
, Hash
)
6224 Sha256
.prototype.init = function () {
6225 this._a
= 0x6a09e667
6226 this._b
= 0xbb67ae85
6227 this._c
= 0x3c6ef372
6228 this._d
= 0xa54ff53a
6229 this._e
= 0x510e527f
6230 this._f
= 0x9b05688c
6231 this._g
= 0x1f83d9ab
6232 this._h
= 0x5be0cd19
6237 function ch (x
, y
, z
) {
6238 return z
^ (x
& (y
^ z
))
6241 function maj (x
, y
, z
) {
6242 return (x
& y
) | (z
& (x
| y
))
6245 function sigma0 (x
) {
6246 return (x
>>> 2 | x
<< 30) ^ (x
>>> 13 | x
<< 19) ^ (x
>>> 22 | x
<< 10)
6249 function sigma1 (x
) {
6250 return (x
>>> 6 | x
<< 26) ^ (x
>>> 11 | x
<< 21) ^ (x
>>> 25 | x
<< 7)
6253 function gamma0 (x
) {
6254 return (x
>>> 7 | x
<< 25) ^ (x
>>> 18 | x
<< 14) ^ (x
>>> 3)
6257 function gamma1 (x
) {
6258 return (x
>>> 17 | x
<< 15) ^ (x
>>> 19 | x
<< 13) ^ (x
>>> 10)
6261 Sha256
.prototype._update = function (M
) {
6273 for (var i
= 0; i
< 16; ++i
) W
[i
] = M
.readInt32BE(i
* 4)
6274 for (; i
< 64; ++i
) W
[i
] = (gamma1(W
[i
- 2]) + W
[i
- 7] + gamma0(W
[i
- 15]) + W
[i
- 16]) | 0
6276 for (var j
= 0; j
< 64; ++j
) {
6277 var T1
= (h
+ sigma1(e
) + ch(e
, f
, g
) + K
[j
] + W
[j
]) | 0
6278 var T2
= (sigma0(a
) + maj(a
, b
, c
)) | 0
6290 this._a
= (a
+ this._a
) | 0
6291 this._b
= (b
+ this._b
) | 0
6292 this._c
= (c
+ this._c
) | 0
6293 this._d
= (d
+ this._d
) | 0
6294 this._e
= (e
+ this._e
) | 0
6295 this._f
= (f
+ this._f
) | 0
6296 this._g
= (g
+ this._g
) | 0
6297 this._h
= (h
+ this._h
) | 0
6300 Sha256
.prototype._hash = function () {
6301 var H
= Buffer
.allocUnsafe(32)
6303 H
.writeInt32BE(this._a
, 0)
6304 H
.writeInt32BE(this._b
, 4)
6305 H
.writeInt32BE(this._c
, 8)
6306 H
.writeInt32BE(this._d
, 12)
6307 H
.writeInt32BE(this._e
, 16)
6308 H
.writeInt32BE(this._f
, 20)
6309 H
.writeInt32BE(this._g
, 24)
6310 H
.writeInt32BE(this._h
, 28)
6315 module
.exports
= Sha256
6317 },{"./hash":39,"inherits":32,"safe-buffer":38}],45:[function(require
,module
,exports
){
6318 var inherits
= require('inherits')
6319 var SHA512
= require('./sha512')
6320 var Hash
= require('./hash')
6321 var Buffer
= require('safe-buffer').Buffer
6323 var W
= new Array(160)
6325 function Sha384 () {
6329 Hash
.call(this, 128, 112)
6332 inherits(Sha384
, SHA512
)
6334 Sha384
.prototype.init = function () {
6335 this._ah
= 0xcbbb9d5d
6336 this._bh
= 0x629a292a
6337 this._ch
= 0x9159015a
6338 this._dh
= 0x152fecd8
6339 this._eh
= 0x67332667
6340 this._fh
= 0x8eb44a87
6341 this._gh
= 0xdb0c2e0d
6342 this._hh
= 0x47b5481d
6344 this._al
= 0xc1059ed8
6345 this._bl
= 0x367cd507
6346 this._cl
= 0x3070dd17
6347 this._dl
= 0xf70e5939
6348 this._el
= 0xffc00b31
6349 this._fl
= 0x68581511
6350 this._gl
= 0x64f98fa7
6351 this._hl
= 0xbefa4fa4
6356 Sha384
.prototype._hash = function () {
6357 var H
= Buffer
.allocUnsafe(48)
6359 function writeInt64BE (h
, l
, offset
) {
6360 H
.writeInt32BE(h
, offset
)
6361 H
.writeInt32BE(l
, offset
+ 4)
6364 writeInt64BE(this._ah
, this._al
, 0)
6365 writeInt64BE(this._bh
, this._bl
, 8)
6366 writeInt64BE(this._ch
, this._cl
, 16)
6367 writeInt64BE(this._dh
, this._dl
, 24)
6368 writeInt64BE(this._eh
, this._el
, 32)
6369 writeInt64BE(this._fh
, this._fl
, 40)
6374 module
.exports
= Sha384
6376 },{"./hash":39,"./sha512":46,"inherits":32,"safe-buffer":38}],46:[function(require
,module
,exports
){
6377 var inherits
= require('inherits')
6378 var Hash
= require('./hash')
6379 var Buffer
= require('safe-buffer').Buffer
6382 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
6383 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
6384 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
6385 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
6386 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
6387 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
6388 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
6389 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
6390 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
6391 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
6392 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
6393 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
6394 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
6395 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
6396 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
6397 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
6398 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
6399 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
6400 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
6401 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
6402 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
6403 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
6404 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
6405 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
6406 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
6407 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
6408 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
6409 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
6410 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
6411 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
6412 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
6413 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
6414 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
6415 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
6416 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
6417 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
6418 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
6419 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
6420 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
6421 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
6424 var W
= new Array(160)
6426 function Sha512 () {
6430 Hash
.call(this, 128, 112)
6433 inherits(Sha512
, Hash
)
6435 Sha512
.prototype.init = function () {
6436 this._ah
= 0x6a09e667
6437 this._bh
= 0xbb67ae85
6438 this._ch
= 0x3c6ef372
6439 this._dh
= 0xa54ff53a
6440 this._eh
= 0x510e527f
6441 this._fh
= 0x9b05688c
6442 this._gh
= 0x1f83d9ab
6443 this._hh
= 0x5be0cd19
6445 this._al
= 0xf3bcc908
6446 this._bl
= 0x84caa73b
6447 this._cl
= 0xfe94f82b
6448 this._dl
= 0x5f1d36f1
6449 this._el
= 0xade682d1
6450 this._fl
= 0x2b3e6c1f
6451 this._gl
= 0xfb41bd6b
6452 this._hl
= 0x137e2179
6457 function Ch (x
, y
, z
) {
6458 return z
^ (x
& (y
^ z
))
6461 function maj (x
, y
, z
) {
6462 return (x
& y
) | (z
& (x
| y
))
6465 function sigma0 (x
, xl
) {
6466 return (x
>>> 28 | xl
<< 4) ^ (xl
>>> 2 | x
<< 30) ^ (xl
>>> 7 | x
<< 25)
6469 function sigma1 (x
, xl
) {
6470 return (x
>>> 14 | xl
<< 18) ^ (x
>>> 18 | xl
<< 14) ^ (xl
>>> 9 | x
<< 23)
6473 function Gamma0 (x
, xl
) {
6474 return (x
>>> 1 | xl
<< 31) ^ (x
>>> 8 | xl
<< 24) ^ (x
>>> 7)
6477 function Gamma0l (x
, xl
) {
6478 return (x
>>> 1 | xl
<< 31) ^ (x
>>> 8 | xl
<< 24) ^ (x
>>> 7 | xl
<< 25)
6481 function Gamma1 (x
, xl
) {
6482 return (x
>>> 19 | xl
<< 13) ^ (xl
>>> 29 | x
<< 3) ^ (x
>>> 6)
6485 function Gamma1l (x
, xl
) {
6486 return (x
>>> 19 | xl
<< 13) ^ (xl
>>> 29 | x
<< 3) ^ (x
>>> 6 | xl
<< 26)
6489 function getCarry (a
, b
) {
6490 return (a
>>> 0) < (b
>>> 0) ? 1 : 0
6493 Sha512
.prototype._update = function (M
) {
6496 var ah
= this._ah
| 0
6497 var bh
= this._bh
| 0
6498 var ch
= this._ch
| 0
6499 var dh
= this._dh
| 0
6500 var eh
= this._eh
| 0
6501 var fh
= this._fh
| 0
6502 var gh
= this._gh
| 0
6503 var hh
= this._hh
| 0
6505 var al
= this._al
| 0
6506 var bl
= this._bl
| 0
6507 var cl
= this._cl
| 0
6508 var dl
= this._dl
| 0
6509 var el
= this._el
| 0
6510 var fl
= this._fl
| 0
6511 var gl
= this._gl
| 0
6512 var hl
= this._hl
| 0
6514 for (var i
= 0; i
< 32; i
+= 2) {
6515 W
[i
] = M
.readInt32BE(i
* 4)
6516 W
[i
+ 1] = M
.readInt32BE(i
* 4 + 4)
6518 for (; i
< 160; i
+= 2) {
6519 var xh
= W
[i
- 15 * 2]
6520 var xl
= W
[i
- 15 * 2 + 1]
6521 var gamma0
= Gamma0(xh
, xl
)
6522 var gamma0l
= Gamma0l(xl
, xh
)
6525 xl
= W
[i
- 2 * 2 + 1]
6526 var gamma1
= Gamma1(xh
, xl
)
6527 var gamma1l
= Gamma1l(xl
, xh
)
6529 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
6530 var Wi7h
= W
[i
- 7 * 2]
6531 var Wi7l
= W
[i
- 7 * 2 + 1]
6533 var Wi16h
= W
[i
- 16 * 2]
6534 var Wi16l
= W
[i
- 16 * 2 + 1]
6536 var Wil
= (gamma0l
+ Wi7l
) | 0
6537 var Wih
= (gamma0
+ Wi7h
+ getCarry(Wil
, gamma0l
)) | 0
6538 Wil
= (Wil
+ gamma1l
) | 0
6539 Wih
= (Wih
+ gamma1
+ getCarry(Wil
, gamma1l
)) | 0
6540 Wil
= (Wil
+ Wi16l
) | 0
6541 Wih
= (Wih
+ Wi16h
+ getCarry(Wil
, Wi16l
)) | 0
6547 for (var j
= 0; j
< 160; j
+= 2) {
6551 var majh
= maj(ah
, bh
, ch
)
6552 var majl
= maj(al
, bl
, cl
)
6554 var sigma0h
= sigma0(ah
, al
)
6555 var sigma0l
= sigma0(al
, ah
)
6556 var sigma1h
= sigma1(eh
, el
)
6557 var sigma1l
= sigma1(el
, eh
)
6559 // t1 = h + sigma1 + ch + K[j] + W[j]
6563 var chh
= Ch(eh
, fh
, gh
)
6564 var chl
= Ch(el
, fl
, gl
)
6566 var t1l
= (hl
+ sigma1l
) | 0
6567 var t1h
= (hh
+ sigma1h
+ getCarry(t1l
, hl
)) | 0
6568 t1l
= (t1l
+ chl
) | 0
6569 t1h
= (t1h
+ chh
+ getCarry(t1l
, chl
)) | 0
6570 t1l
= (t1l
+ Kil
) | 0
6571 t1h
= (t1h
+ Kih
+ getCarry(t1l
, Kil
)) | 0
6572 t1l
= (t1l
+ Wil
) | 0
6573 t1h
= (t1h
+ Wih
+ getCarry(t1l
, Wil
)) | 0
6575 // t2 = sigma0 + maj
6576 var t2l
= (sigma0l
+ majl
) | 0
6577 var t2h
= (sigma0h
+ majh
+ getCarry(t2l
, sigma0l
)) | 0
6586 eh
= (dh
+ t1h
+ getCarry(el
, dl
)) | 0
6593 al
= (t1l
+ t2l
) | 0
6594 ah
= (t1h
+ t2h
+ getCarry(al
, t1l
)) | 0
6597 this._al
= (this._al
+ al
) | 0
6598 this._bl
= (this._bl
+ bl
) | 0
6599 this._cl
= (this._cl
+ cl
) | 0
6600 this._dl
= (this._dl
+ dl
) | 0
6601 this._el
= (this._el
+ el
) | 0
6602 this._fl
= (this._fl
+ fl
) | 0
6603 this._gl
= (this._gl
+ gl
) | 0
6604 this._hl
= (this._hl
+ hl
) | 0
6606 this._ah
= (this._ah
+ ah
+ getCarry(this._al
, al
)) | 0
6607 this._bh
= (this._bh
+ bh
+ getCarry(this._bl
, bl
)) | 0
6608 this._ch
= (this._ch
+ ch
+ getCarry(this._cl
, cl
)) | 0
6609 this._dh
= (this._dh
+ dh
+ getCarry(this._dl
, dl
)) | 0
6610 this._eh
= (this._eh
+ eh
+ getCarry(this._el
, el
)) | 0
6611 this._fh
= (this._fh
+ fh
+ getCarry(this._fl
, fl
)) | 0
6612 this._gh
= (this._gh
+ gh
+ getCarry(this._gl
, gl
)) | 0
6613 this._hh
= (this._hh
+ hh
+ getCarry(this._hl
, hl
)) | 0
6616 Sha512
.prototype._hash = function () {
6617 var H
= Buffer
.allocUnsafe(64)
6619 function writeInt64BE (h
, l
, offset
) {
6620 H
.writeInt32BE(h
, offset
)
6621 H
.writeInt32BE(l
, offset
+ 4)
6624 writeInt64BE(this._ah
, this._al
, 0)
6625 writeInt64BE(this._bh
, this._bl
, 8)
6626 writeInt64BE(this._ch
, this._cl
, 16)
6627 writeInt64BE(this._dh
, this._dl
, 24)
6628 writeInt64BE(this._eh
, this._el
, 32)
6629 writeInt64BE(this._fh
, this._fl
, 40)
6630 writeInt64BE(this._gh
, this._gl
, 48)
6631 writeInt64BE(this._hh
, this._hl
, 56)
6636 module
.exports
= Sha512
6638 },{"./hash":39,"inherits":32,"safe-buffer":38}],47:[function(require
,module
,exports
){
6639 var native = require('./native')
6641 function getTypeName (fn
) {
6642 return fn
.name
|| fn
.toString().match(/function (.*?)\s
*\(/)[1]
6645 function getValueTypeName (value
) {
6646 return native.Nil(value
) ? '' : getTypeName(value
.constructor)
6649 function getValue (value
) {
6650 if (native.Function(value
)) return ''
6651 if (native.String(value
)) return JSON
.stringify(value
)
6652 if (value
&& native.Object(value
)) return ''
6656 function captureStackTrace (e
, t
) {
6657 if (Error
.captureStackTrace
) {
6658 Error
.captureStackTrace(e
, t
)
6662 function tfJSON (type
) {
6663 if (native.Function(type
)) return type
.toJSON
? type
.toJSON() : getTypeName(type
)
6664 if (native.Array(type
)) return 'Array'
6665 if (type
&& native.Object(type
)) return 'Object'
6667 return type
!== undefined ? type : ''
6670 function tfErrorString (type
, value
, valueTypeName
) {
6671 var valueJson
= getValue(value
)
6673 return 'Expected ' + tfJSON(type
) + ', got' +
6674 (valueTypeName
!== '' ? ' ' + valueTypeName : '') +
6675 (valueJson
!== '' ? ' ' + valueJson : '')
6678 function TfTypeError (type
, value
, valueTypeName
) {
6679 valueTypeName
= valueTypeName
|| getValueTypeName(value
)
6680 this.message
= tfErrorString(type
, value
, valueTypeName
)
6682 captureStackTrace(this, TfTypeError
)
6684 this.__value
= value
6685 this.__valueTypeName
= valueTypeName
6688 TfTypeError
.prototype = Object
.create(Error
.prototype)
6689 TfTypeError
.prototype.constructor = TfTypeError
6691 function tfPropertyErrorString (type
, label
, name
, value
, valueTypeName
) {
6692 var description
= '" of type '
6693 if (label
=== 'key') description
= '" with key type '
6695 return tfErrorString('property "' + tfJSON(name
) + description
+ tfJSON(type
), value
, valueTypeName
)
6698 function TfPropertyTypeError (type
, property
, label
, value
, valueTypeName
) {
6700 valueTypeName
= valueTypeName
|| getValueTypeName(value
)
6701 this.message
= tfPropertyErrorString(type
, label
, property
, value
, valueTypeName
)
6703 this.message
= 'Unexpected property "' + property
+ '"'
6706 captureStackTrace(this, TfTypeError
)
6707 this.__label
= label
6708 this.__property
= property
6710 this.__value
= value
6711 this.__valueTypeName
= valueTypeName
6714 TfPropertyTypeError
.prototype = Object
.create(Error
.prototype)
6715 TfPropertyTypeError
.prototype.constructor = TfTypeError
6717 function tfCustomError (expected
, actual
) {
6718 return new TfTypeError(expected
, {}, actual
)
6721 function tfSubError (e
, property
, label
) {
6723 if (e
instanceof TfPropertyTypeError
) {
6724 property
= property
+ '.' + e
.__property
6726 e
= new TfPropertyTypeError(
6727 e
.__type
, property
, e
.__label
, e
.__value
, e
.__valueTypeName
6731 } else if (e
instanceof TfTypeError
) {
6732 e
= new TfPropertyTypeError(
6733 e
.__type
, property
, label
, e
.__value
, e
.__valueTypeName
6737 captureStackTrace(e
)
6742 TfTypeError: TfTypeError
,
6743 TfPropertyTypeError: TfPropertyTypeError
,
6744 tfCustomError: tfCustomError
,
6745 tfSubError: tfSubError
,
6747 getValueTypeName: getValueTypeName
6750 },{"./native":50}],48:[function(require
,module
,exports
){
6752 var NATIVE
= require('./native')
6753 var ERRORS
= require('./errors')
6755 function _Buffer (value
) {
6756 return Buffer
.isBuffer(value
)
6759 function Hex (value
) {
6760 return typeof value
=== 'string' && /^([0-9a-f]{2})+$/i.test(value
)
6763 function _LengthN (type
, length
) {
6764 var name
= type
.toJSON()
6766 function Length (value
) {
6767 if (!type(value
)) return false
6768 if (value
.length
=== length
) return true
6770 throw ERRORS
.tfCustomError(name
+ '(Length: ' + length
+ ')', name
+ '(Length: ' + value
.length
+ ')')
6772 Length
.toJSON = function () { return name
}
6777 var _ArrayN
= _LengthN
.bind(null, NATIVE
.Array
)
6778 var _BufferN
= _LengthN
.bind(null, _Buffer
)
6779 var _HexN
= _LengthN
.bind(null, Hex
)
6780 var _StringN
= _LengthN
.bind(null, NATIVE
.String
)
6782 function Range (a
, b
, f
) {
6783 f
= f
|| NATIVE
.Number
6784 function _range (value
, strict
) {
6785 return f(value
, strict
) && (value
> a
) && (value
< b
)
6787 _range
.toJSON = function () {
6788 return `${f.toJSON()} between [${a}, ${b}]`
6793 var INT53_MAX
= Math
.pow(2, 53) - 1
6795 function Finite (value
) {
6796 return typeof value
=== 'number' && isFinite(value
)
6798 function Int8 (value
) { return ((value
<< 24) >> 24) === value
}
6799 function Int16 (value
) { return ((value
<< 16) >> 16) === value
}
6800 function Int32 (value
) { return (value
| 0) === value
}
6801 function Int53 (value
) {
6802 return typeof value
=== 'number' &&
6803 value
>= -INT53_MAX
&&
6804 value
<= INT53_MAX
&&
6805 Math
.floor(value
) === value
6807 function UInt8 (value
) { return (value
& 0xff) === value
}
6808 function UInt16 (value
) { return (value
& 0xffff) === value
}
6809 function UInt32 (value
) { return (value
>>> 0) === value
}
6810 function UInt53 (value
) {
6811 return typeof value
=== 'number' &&
6813 value
<= INT53_MAX
&&
6814 Math
.floor(value
) === value
6836 for (var typeName
in types
) {
6837 types
[typeName
].toJSON = function (t
) {
6839 }.bind(null, typeName
)
6842 module
.exports
= types
6844 }).call(this,{"isBuffer":require("../../../../../../usr/local/lib/node_modules/browserify/node_modules/is-buffer/index.js")})
6845 },{"../../../../../../usr/local/lib/node_modules/browserify/node_modules/is-buffer/index.js":101,"./errors":47,"./native":50}],49:[function(require
,module
,exports
){
6846 var ERRORS
= require('./errors')
6847 var NATIVE
= require('./native')
6850 var tfJSON
= ERRORS
.tfJSON
6851 var TfTypeError
= ERRORS
.TfTypeError
6852 var TfPropertyTypeError
= ERRORS
.TfPropertyTypeError
6853 var tfSubError
= ERRORS
.tfSubError
6854 var getValueTypeName
= ERRORS
.getValueTypeName
6857 arrayOf: function arrayOf (type
, options
) {
6858 type
= compile(type
)
6859 options
= options
|| {}
6861 function _arrayOf (array
, strict
) {
6862 if (!NATIVE
.Array(array
)) return false
6863 if (NATIVE
.Nil(array
)) return false
6864 if (options
.minLength
!== undefined && array
.length
< options
.minLength
) return false
6865 if (options
.maxLength
!== undefined && array
.length
> options
.maxLength
) return false
6866 if (options
.length
!== undefined && array
.length
!== options
.length
) return false
6868 return array
.every(function (value
, i
) {
6870 return typeforce(type
, value
, strict
)
6872 throw tfSubError(e
, i
)
6876 _arrayOf
.toJSON = function () {
6877 var str
= '[' + tfJSON(type
) + ']'
6878 if (options
.length
!== undefined) {
6879 str
+= '{' + options
.length
+ '}'
6880 } else if (options
.minLength
!== undefined || options
.maxLength
!== undefined) {
6882 (options
.minLength
=== undefined ? 0 : options
.minLength
) + ',' +
6883 (options
.maxLength
=== undefined ? Infinity : options
.maxLength
) + '}'
6891 maybe: function maybe (type
) {
6892 type
= compile(type
)
6894 function _maybe (value
, strict
) {
6895 return NATIVE
.Nil(value
) || type(value
, strict
, maybe
)
6897 _maybe
.toJSON = function () { return '?' + tfJSON(type
) }
6902 map: function map (propertyType
, propertyKeyType
) {
6903 propertyType
= compile(propertyType
)
6904 if (propertyKeyType
) propertyKeyType
= compile(propertyKeyType
)
6906 function _map (value
, strict
) {
6907 if (!NATIVE
.Object(value
)) return false
6908 if (NATIVE
.Nil(value
)) return false
6910 for (var propertyName
in value
) {
6912 if (propertyKeyType
) {
6913 typeforce(propertyKeyType
, propertyName
, strict
)
6916 throw tfSubError(e
, propertyName
, 'key')
6920 var propertyValue
= value
[propertyName
]
6921 typeforce(propertyType
, propertyValue
, strict
)
6923 throw tfSubError(e
, propertyName
)
6930 if (propertyKeyType
) {
6931 _map
.toJSON = function () {
6932 return '{' + tfJSON(propertyKeyType
) + ': ' + tfJSON(propertyType
) + '}'
6935 _map
.toJSON = function () { return '{' + tfJSON(propertyType
) + '}' }
6941 object: function object (uncompiled
) {
6944 for (var typePropertyName
in uncompiled
) {
6945 type
[typePropertyName
] = compile(uncompiled
[typePropertyName
])
6948 function _object (value
, strict
) {
6949 if (!NATIVE
.Object(value
)) return false
6950 if (NATIVE
.Nil(value
)) return false
6955 for (propertyName
in type
) {
6956 var propertyType
= type
[propertyName
]
6957 var propertyValue
= value
[propertyName
]
6959 typeforce(propertyType
, propertyValue
, strict
)
6962 throw tfSubError(e
, propertyName
)
6966 for (propertyName
in value
) {
6967 if (type
[propertyName
]) continue
6969 throw new TfPropertyTypeError(undefined, propertyName
)
6975 _object
.toJSON = function () { return tfJSON(type
) }
6980 anyOf: function anyOf () {
6981 var types
= [].slice
.call(arguments
).map(compile
)
6983 function _anyOf (value
, strict
) {
6984 return types
.some(function (type
) {
6986 return typeforce(type
, value
, strict
)
6992 _anyOf
.toJSON = function () { return types
.map(tfJSON
).join('|') }
6997 allOf: function allOf () {
6998 var types
= [].slice
.call(arguments
).map(compile
)
7000 function _allOf (value
, strict
) {
7001 return types
.every(function (type
) {
7003 return typeforce(type
, value
, strict
)
7009 _allOf
.toJSON = function () { return types
.map(tfJSON
).join(' & ') }
7014 quacksLike: function quacksLike (type
) {
7015 function _quacksLike (value
) {
7016 return type
=== getValueTypeName(value
)
7018 _quacksLike
.toJSON = function () { return type
}
7023 tuple: function tuple () {
7024 var types
= [].slice
.call(arguments
).map(compile
)
7026 function _tuple (values
, strict
) {
7027 if (NATIVE
.Nil(values
)) return false
7028 if (NATIVE
.Nil(values
.length
)) return false
7029 if (strict
&& (values
.length
!== types
.length
)) return false
7031 return types
.every(function (type
, i
) {
7033 return typeforce(type
, values
[i
], strict
)
7035 throw tfSubError(e
, i
)
7039 _tuple
.toJSON = function () { return '(' + types
.map(tfJSON
).join(', ') + ')' }
7044 value: function value (expected
) {
7045 function _value (actual
) {
7046 return actual
=== expected
7048 _value
.toJSON = function () { return expected
}
7055 TYPES
.oneOf
= TYPES
.anyOf
7057 function compile (type
) {
7058 if (NATIVE
.String(type
)) {
7059 if (type
[0] === '?') return TYPES
.maybe(type
.slice(1))
7061 return NATIVE
[type
] || TYPES
.quacksLike(type
)
7062 } else if (type
&& NATIVE
.Object(type
)) {
7063 if (NATIVE
.Array(type
)) {
7064 if (type
.length
!== 1) throw new TypeError('Expected compile() parameter of type Array of length 1')
7065 return TYPES
.arrayOf(type
[0])
7068 return TYPES
.object(type
)
7069 } else if (NATIVE
.Function(type
)) {
7073 return TYPES
.value(type
)
7076 function typeforce (type
, value
, strict
, surrogate
) {
7077 if (NATIVE
.Function(type
)) {
7078 if (type(value
, strict
)) return true
7080 throw new TfTypeError(surrogate
|| type
, value
)
7084 return typeforce(compile(type
), value
, strict
)
7087 // assign types to typeforce function
7088 for (var typeName
in NATIVE
) {
7089 typeforce
[typeName
] = NATIVE
[typeName
]
7092 for (typeName
in TYPES
) {
7093 typeforce
[typeName
] = TYPES
[typeName
]
7096 var EXTRA
= require('./extra')
7097 for (typeName
in EXTRA
) {
7098 typeforce
[typeName
] = EXTRA
[typeName
]
7101 typeforce
.compile
= compile
7102 typeforce
.TfTypeError
= TfTypeError
7103 typeforce
.TfPropertyTypeError
= TfPropertyTypeError
7105 module
.exports
= typeforce
7107 },{"./errors":47,"./extra":48,"./native":50}],50:[function(require
,module
,exports
){
7109 Array: function (value
) { return value
!== null && value
!== undefined && value
.constructor === Array
},
7110 Boolean: function (value
) { return typeof value
=== 'boolean' },
7111 Function: function (value
) { return typeof value
=== 'function' },
7112 Nil: function (value
) { return value
=== undefined || value
=== null },
7113 Number: function (value
) { return typeof value
=== 'number' },
7114 Object: function (value
) { return typeof value
=== 'object' },
7115 String: function (value
) { return typeof value
=== 'string' },
7116 '': function () { return true }
7120 types
.Null
= types
.Nil
7122 for (var typeName
in types
) {
7123 types
[typeName
].toJSON = function (t
) {
7125 }.bind(null, typeName
)
7128 module
.exports
= types
7130 },{}],51:[function(require
,module
,exports
){
7132 var Buffer
= require('safe-buffer').Buffer
7134 // Number.MAX_SAFE_INTEGER
7135 var MAX_SAFE_INTEGER
= 9007199254740991
7137 function checkUInt53 (n
) {
7138 if (n
< 0 || n
> MAX_SAFE_INTEGER
|| n
% 1 !== 0) throw new RangeError('value out of range')
7141 function encode (number
, buffer
, offset
) {
7144 if (!buffer
) buffer
= Buffer
.allocUnsafe(encodingLength(number
))
7145 if (!Buffer
.isBuffer(buffer
)) throw new TypeError('buffer must be a Buffer instance')
7146 if (!offset
) offset
= 0
7149 if (number
< 0xfd) {
7150 buffer
.writeUInt8(number
, offset
)
7154 } else if (number
<= 0xffff) {
7155 buffer
.writeUInt8(0xfd, offset
)
7156 buffer
.writeUInt16LE(number
, offset
+ 1)
7160 } else if (number
<= 0xffffffff) {
7161 buffer
.writeUInt8(0xfe, offset
)
7162 buffer
.writeUInt32LE(number
, offset
+ 1)
7167 buffer
.writeUInt8(0xff, offset
)
7168 buffer
.writeUInt32LE(number
>>> 0, offset
+ 1)
7169 buffer
.writeUInt32LE((number
/ 0x100000000) | 0, offset
+ 5)
7176 function decode (buffer
, offset
) {
7177 if (!Buffer
.isBuffer(buffer
)) throw new TypeError('buffer must be a Buffer instance')
7178 if (!offset
) offset
= 0
7180 var first
= buffer
.readUInt8(offset
)
7188 } else if (first
=== 0xfd) {
7190 return buffer
.readUInt16LE(offset
+ 1)
7193 } else if (first
=== 0xfe) {
7195 return buffer
.readUInt32LE(offset
+ 1)
7200 var lo
= buffer
.readUInt32LE(offset
+ 1)
7201 var hi
= buffer
.readUInt32LE(offset
+ 5)
7202 var number
= hi
* 0x0100000000 + lo
7209 function encodingLength (number
) {
7214 : number
<= 0xffff ? 3
7215 : number
<= 0xffffffff ? 5
7220 module
.exports
= { encode: encode
, decode: decode
, encodingLength: encodingLength
}
7222 },{"safe-buffer":38}],52:[function(require
,module
,exports
){
7223 var bs58grscheck
= require('bs58grscheck')
7224 var Buffer
= require('safe-buffer').Buffer
7226 function decodeRaw (buffer
, version
) {
7227 // check version only if defined
7228 if (version
!== undefined && buffer
[0] !== version
) throw new Error('Invalid network version')
7231 if (buffer
.length
=== 33) {
7234 privateKey: buffer
.slice(1, 33),
7240 if (buffer
.length
!== 34) throw new Error('Invalid WIF length')
7242 // invalid compression flag
7243 if (buffer
[33] !== 0x01) throw new Error('Invalid compression flag')
7247 privateKey: buffer
.slice(1, 33),
7252 function encodeRaw (version
, privateKey
, compressed
) {
7253 if (privateKey
.length
!== 32) throw new TypeError('Invalid privateKey length')
7255 var result
= Buffer
.alloc(compressed
? 34 : 33)
7256 result
.writeUInt8(version
, 0)
7257 privateKey
.copy(result
, 1)
7266 function decode (string
, version
) {
7267 return decodeRaw(bs58grscheck
.decode(string
), version
)
7270 function encode (version
, privateKey
, compressed
) {
7271 if (typeof version
=== 'number') return bs58grscheck
.encode(encodeRaw(version
, privateKey
, compressed
))
7273 return bs58grscheck
.encode(
7284 decodeRaw: decodeRaw
,
7286 encodeRaw: encodeRaw
7289 },{"bs58grscheck":12,"safe-buffer":38}],53:[function(require
,module
,exports
){
7290 var Buffer
= require('safe-buffer').Buffer
7291 var bech32
= require('bech32')
7292 var bs58grscheck
= require('bs58grscheck')
7293 var bscript
= require('./script')
7294 var btemplates
= require('./templates')
7295 var networks
= require('./networks')
7296 var typeforce
= require('typeforce')
7297 var types
= require('./types')
7299 function fromBase58GrsCheck (address
) {
7300 var payload
= bs58grscheck
.decode(address
)
7302 // TODO: 4.0.0, move to "toOutputScript"
7303 if (payload
.length
< 21) throw new TypeError(address
+ ' is too short')
7304 if (payload
.length
> 21) throw new TypeError(address
+ ' is too long')
7306 var version
= payload
.readUInt8(0)
7307 var hash
= payload
.slice(1)
7309 return { version: version
, hash: hash
}
7312 function fromBech32 (address
) {
7313 var result
= bech32
.decode(address
)
7314 var data
= bech32
.fromWords(result
.words
.slice(1))
7317 version: result
.words
[0],
7318 prefix: result
.prefix
,
7319 data: Buffer
.from(data
)
7323 function toBase58GrsCheck (hash
, version
) {
7324 typeforce(types
.tuple(types
.Hash160bit
, types
.UInt8
), arguments
)
7326 var payload
= Buffer
.allocUnsafe(21)
7327 payload
.writeUInt8(version
, 0)
7328 hash
.copy(payload
, 1)
7330 return bs58grscheck
.encode(payload
)
7333 function toBech32 (data
, version
, prefix
) {
7334 var words
= bech32
.toWords(data
)
7335 words
.unshift(version
)
7337 return bech32
.encode(prefix
, words
)
7340 function fromOutputScript (outputScript
, network
) {
7341 network
= network
|| networks
.bitcoin
7343 if (btemplates
.pubKeyHash
.output
.check(outputScript
)) return toBase58GrsCheck(bscript
.compile(outputScript
).slice(3, 23), network
.pubKeyHash
)
7344 if (btemplates
.scriptHash
.output
.check(outputScript
)) return toBase58GrsCheck(bscript
.compile(outputScript
).slice(2, 22), network
.scriptHash
)
7345 if (btemplates
.witnessPubKeyHash
.output
.check(outputScript
)) return toBech32(bscript
.compile(outputScript
).slice(2, 22), 0, network
.bech32
)
7346 if (btemplates
.witnessScriptHash
.output
.check(outputScript
)) return toBech32(bscript
.compile(outputScript
).slice(2, 34), 0, network
.bech32
)
7348 throw new Error(bscript
.toASM(outputScript
) + ' has no matching Address')
7351 function toOutputScript (address
, network
) {
7352 network
= network
|| networks
.bitcoin
7356 decode
= fromBase58GrsCheck(address
)
7360 if (decode
.version
=== network
.pubKeyHash
) return btemplates
.pubKeyHash
.output
.encode(decode
.hash
)
7361 if (decode
.version
=== network
.scriptHash
) return btemplates
.scriptHash
.output
.encode(decode
.hash
)
7364 decode
= fromBech32(address
)
7368 if (decode
.prefix
!== network
.bech32
) throw new Error(address
+ ' has an invalid prefix')
7369 if (decode
.version
=== 0) {
7370 if (decode
.data
.length
=== 20) return btemplates
.witnessPubKeyHash
.output
.encode(decode
.data
)
7371 if (decode
.data
.length
=== 32) return btemplates
.witnessScriptHash
.output
.encode(decode
.data
)
7376 throw new Error(address
+ ' has no matching Script')
7380 fromBase58GrsCheck: fromBase58GrsCheck
,
7381 fromBech32: fromBech32
,
7382 fromOutputScript: fromOutputScript
,
7383 toBase58GrsCheck: toBase58GrsCheck
,
7385 toOutputScript: toOutputScript
7388 },{"./networks":62,"./script":63,"./templates":65,"./types":89,"bech32":2,"bs58grscheck":12,"safe-buffer":38,"typeforce":49}],54:[function(require
,module
,exports
){
7389 var Buffer
= require('safe-buffer').Buffer
7390 var bcrypto
= require('./crypto')
7391 var fastMerkleRoot
= require('merkle-lib/fastRoot')
7392 var typeforce
= require('typeforce')
7393 var types
= require('./types')
7394 var varuint
= require('varuint-bitcoin')
7396 var Transaction
= require('./transaction')
7400 this.prevHash
= null
7401 this.merkleRoot
= null
7407 Block
.fromBuffer = function (buffer
) {
7408 if (buffer
.length
< 80) throw new Error('Buffer too small (< 80 bytes)')
7411 function readSlice (n
) {
7413 return buffer
.slice(offset
- n
, offset
)
7416 function readUInt32 () {
7417 var i
= buffer
.readUInt32LE(offset
)
7422 function readInt32 () {
7423 var i
= buffer
.readInt32LE(offset
)
7428 var block
= new Block()
7429 block
.version
= readInt32()
7430 block
.prevHash
= readSlice(32)
7431 block
.merkleRoot
= readSlice(32)
7432 block
.timestamp
= readUInt32()
7433 block
.bits
= readUInt32()
7434 block
.nonce
= readUInt32()
7436 if (buffer
.length
=== 80) return block
7438 function readVarInt () {
7439 var vi
= varuint
.decode(buffer
, offset
)
7440 offset
+= varuint
.decode
.bytes
7444 function readTransaction () {
7445 var tx
= Transaction
.fromBuffer(buffer
.slice(offset
), true)
7446 offset
+= tx
.byteLength()
7450 var nTransactions
= readVarInt()
7451 block
.transactions
= []
7453 for (var i
= 0; i
< nTransactions
; ++i
) {
7454 var tx
= readTransaction()
7455 block
.transactions
.push(tx
)
7461 Block
.prototype.byteLength = function (headersOnly
) {
7462 if (headersOnly
|| !this.transactions
) return 80
7464 return 80 + varuint
.encodingLength(this.transactions
.length
) + this.transactions
.reduce(function (a
, x
) {
7465 return a
+ x
.byteLength()
7469 Block
.fromHex = function (hex
) {
7470 return Block
.fromBuffer(Buffer
.from(hex
, 'hex'))
7473 Block
.prototype.getHash = function () {
7474 return bcrypto
.groestl(this.toBuffer(true))
7477 Block
.prototype.getId = function () {
7478 return this.getHash().reverse().toString('hex')
7481 Block
.prototype.getUTCDate = function () {
7482 var date
= new Date(0) // epoch
7483 date
.setUTCSeconds(this.timestamp
)
7488 // TODO: buffer, offset compatibility
7489 Block
.prototype.toBuffer = function (headersOnly
) {
7490 var buffer
= Buffer
.allocUnsafe(this.byteLength(headersOnly
))
7493 function writeSlice (slice
) {
7494 slice
.copy(buffer
, offset
)
7495 offset
+= slice
.length
7498 function writeInt32 (i
) {
7499 buffer
.writeInt32LE(i
, offset
)
7502 function writeUInt32 (i
) {
7503 buffer
.writeUInt32LE(i
, offset
)
7507 writeInt32(this.version
)
7508 writeSlice(this.prevHash
)
7509 writeSlice(this.merkleRoot
)
7510 writeUInt32(this.timestamp
)
7511 writeUInt32(this.bits
)
7512 writeUInt32(this.nonce
)
7514 if (headersOnly
|| !this.transactions
) return buffer
7516 varuint
.encode(this.transactions
.length
, buffer
, offset
)
7517 offset
+= varuint
.encode
.bytes
7519 this.transactions
.forEach(function (tx
) {
7520 var txSize
= tx
.byteLength() // TODO: extract from toBuffer?
7521 tx
.toBuffer(buffer
, offset
)
7528 Block
.prototype.toHex = function (headersOnly
) {
7529 return this.toBuffer(headersOnly
).toString('hex')
7532 Block
.calculateTarget = function (bits
) {
7533 var exponent
= ((bits
& 0xff000000) >> 24) - 3
7534 var mantissa
= bits
& 0x007fffff
7535 var target
= Buffer
.alloc(32, 0)
7536 target
.writeUInt32BE(mantissa
, 28 - exponent
)
7540 Block
.calculateMerkleRoot = function (transactions
) {
7541 typeforce([{ getHash: types
.Function
}], transactions
)
7542 if (transactions
.length
=== 0) throw TypeError('Cannot compute merkle root for zero transactions')
7544 var hashes
= transactions
.map(function (transaction
) {
7545 return transaction
.getHash()
7548 return fastMerkleRoot(hashes
, bcrypto
.hash256
)
7551 Block
.prototype.checkMerkleRoot = function () {
7552 if (!this.transactions
) return false
7554 var actualMerkleRoot
= Block
.calculateMerkleRoot(this.transactions
)
7555 return this.merkleRoot
.compare(actualMerkleRoot
) === 0
7558 Block
.prototype.checkProofOfWork = function () {
7559 var hash
= this.getHash().reverse()
7560 var target
= Block
.calculateTarget(this.bits
)
7562 return hash
.compare(target
) <= 0
7565 module
.exports
= Block
7567 },{"./crypto":56,"./transaction":87,"./types":89,"merkle-lib/fastRoot":34,"safe-buffer":38,"typeforce":49,"varuint-bitcoin":51}],55:[function(require
,module
,exports
){
7568 var pushdata
= require('pushdata-bitcoin')
7569 var varuint
= require('varuint-bitcoin')
7571 // https://github.com/feross/buffer/blob/master/index.js#L1127
7572 function verifuint (value
, max
) {
7573 if (typeof value
!== 'number') throw new Error('cannot write a non-number as a number')
7574 if (value
< 0) throw new Error('specified a negative value for writing an unsigned value')
7575 if (value
> max
) throw new Error('RangeError: value out of range')
7576 if (Math
.floor(value
) !== value
) throw new Error('value has a fractional component')
7579 function readUInt64LE (buffer
, offset
) {
7580 var a
= buffer
.readUInt32LE(offset
)
7581 var b
= buffer
.readUInt32LE(offset
+ 4)
7584 verifuint(b
+ a
, 0x001fffffffffffff)
7589 function writeUInt64LE (buffer
, value
, offset
) {
7590 verifuint(value
, 0x001fffffffffffff)
7592 buffer
.writeInt32LE(value
& -1, offset
)
7593 buffer
.writeUInt32LE(Math
.floor(value
/ 0x100000000), offset
+ 4)
7597 // TODO: remove in 4.0.0?
7598 function readVarInt (buffer
, offset
) {
7599 var result
= varuint
.decode(buffer
, offset
)
7603 size: varuint
.decode
.bytes
7607 // TODO: remove in 4.0.0?
7608 function writeVarInt (buffer
, number
, offset
) {
7609 varuint
.encode(number
, buffer
, offset
)
7610 return varuint
.encode
.bytes
7614 pushDataSize: pushdata
.encodingLength
,
7615 readPushDataInt: pushdata
.decode
,
7616 readUInt64LE: readUInt64LE
,
7617 readVarInt: readVarInt
,
7618 varIntBuffer: varuint
.encode
,
7619 varIntSize: varuint
.encodingLength
,
7620 writePushDataInt: pushdata
.encode
,
7621 writeUInt64LE: writeUInt64LE
,
7622 writeVarInt: writeVarInt
7625 },{"pushdata-bitcoin":35,"varuint-bitcoin":51}],56:[function(require
,module
,exports
){
7627 var createHash
= require('create-hash')
7628 var groestlhash
= require('groestl-hash-js')
7630 function ripemd160 (buffer
) {
7631 return createHash('rmd160').update(buffer
).digest()
7634 function sha1 (buffer
) {
7635 return createHash('sha1').update(buffer
).digest()
7638 function sha256 (buffer
) {
7639 return createHash('sha256').update(buffer
).digest()
7642 function hash160 (buffer
) {
7643 return ripemd160(sha256(buffer
))
7646 function hash256 (buffer
) {
7647 return sha256(sha256(buffer
))
7650 function groestl (buffer
) {
7651 return Buffer(groestlhash
.groestl_2(buffer
, 1, 1))
7657 ripemd160: ripemd160
,
7663 }).call(this,require("buffer").Buffer
)
7664 },{"buffer":96,"create-hash":14,"groestl-hash-js":27}],57:[function(require
,module
,exports
){
7665 var Buffer
= require('safe-buffer').Buffer
7666 var createHmac
= require('create-hmac')
7667 var typeforce
= require('typeforce')
7668 var types
= require('./types')
7670 var BigInteger
= require('bigi')
7671 var ECSignature
= require('./ecsignature')
7673 var ZERO
= Buffer
.alloc(1, 0)
7674 var ONE
= Buffer
.alloc(1, 1)
7676 var ecurve
= require('ecurve')
7677 var secp256k1
= ecurve
.getCurveByName('secp256k1')
7679 // https://tools.ietf.org/html/rfc6979#section-3.2
7680 function deterministicGenerateK (hash
, x
, checkSig
) {
7681 typeforce(types
.tuple(
7687 // Step A, ignored as hash already provided
7690 var k
= Buffer
.alloc(32, 0)
7691 var v
= Buffer
.alloc(32, 1)
7694 k
= createHmac('sha256', k
)
7702 v
= createHmac('sha256', k
).update(v
).digest()
7705 k
= createHmac('sha256', k
)
7713 v
= createHmac('sha256', k
).update(v
).digest()
7715 // Step H1/H2a, ignored as tlen === qlen (256 bit)
7717 v
= createHmac('sha256', k
).update(v
).digest()
7719 var T
= BigInteger
.fromBuffer(v
)
7721 // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA
7722 while (T
.signum() <= 0 || T
.compareTo(secp256k1
.n
) >= 0 || !checkSig(T
)) {
7723 k
= createHmac('sha256', k
)
7728 v
= createHmac('sha256', k
).update(v
).digest()
7730 // Step H1/H2a, again, ignored as tlen === qlen (256 bit)
7732 v
= createHmac('sha256', k
).update(v
).digest()
7733 T
= BigInteger
.fromBuffer(v
)
7739 var N_OVER_TWO
= secp256k1
.n
.shiftRight(1)
7741 function sign (hash
, d
) {
7742 typeforce(types
.tuple(types
.Hash256bit
, types
.BigInt
), arguments
)
7744 var x
= d
.toBuffer(32)
7745 var e
= BigInteger
.fromBuffer(hash
)
7750 deterministicGenerateK(hash
, x
, function (k
) {
7751 var Q
= G
.multiply(k
)
7753 if (secp256k1
.isInfinity(Q
)) return false
7755 r
= Q
.affineX
.mod(n
)
7756 if (r
.signum() === 0) return false
7758 s
= k
.modInverse(n
).multiply(e
.add(d
.multiply(r
))).mod(n
)
7759 if (s
.signum() === 0) return false
7764 // enforce low S values, see bip62: 'low s values in signatures'
7765 if (s
.compareTo(N_OVER_TWO
) > 0) {
7769 return new ECSignature(r
, s
)
7772 function verify (hash
, signature
, Q
) {
7773 typeforce(types
.tuple(
7785 // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]
7786 if (r
.signum() <= 0 || r
.compareTo(n
) >= 0) return false
7787 if (s
.signum() <= 0 || s
.compareTo(n
) >= 0) return false
7789 // 1.4.2 H = Hash(M), already done by the user
7791 var e
= BigInteger
.fromBuffer(hash
)
7794 var sInv
= s
.modInverse(n
)
7796 // 1.4.4 Compute u1 = es^−1 mod n
7797 // u2 = rs^−1 mod n
7798 var u1
= e
.multiply(sInv
).mod(n
)
7799 var u2
= r
.multiply(sInv
).mod(n
)
7801 // 1.4.5 Compute R = (xR, yR)
7803 var R
= G
.multiplyTwo(u1
, Q
, u2
)
7805 // 1.4.5 (cont.) Enforce R is not at infinity
7806 if (secp256k1
.isInfinity(R
)) return false
7808 // 1.4.6 Convert the field element R.x to an integer
7811 // 1.4.7 Set v = xR mod n
7814 // 1.4.8 If v = r, output "valid", and if v != r, output "invalid"
7819 deterministicGenerateK: deterministicGenerateK
,
7827 },{"./ecsignature":59,"./types":89,"bigi":5,"create-hmac":16,"ecurve":20,"safe-buffer":38,"typeforce":49}],58:[function(require
,module
,exports
){
7828 var baddress
= require('./address')
7829 var bcrypto
= require('./crypto')
7830 var ecdsa
= require('./ecdsa')
7831 var randomBytes
= require('randombytes')
7832 var typeforce
= require('typeforce')
7833 var types
= require('./types')
7834 var wif
= require('wifgrs')
7836 var NETWORKS
= require('./networks')
7837 var BigInteger
= require('bigi')
7839 var ecurve
= require('ecurve')
7840 var secp256k1
= ecdsa
.__curve
7842 function ECPair (d
, Q
, options
) {
7845 compressed: types
.maybe(types
.Boolean
),
7846 network: types
.maybe(types
.Network
)
7850 options
= options
|| {}
7853 if (d
.signum() <= 0) throw new Error('Private key must be greater than 0')
7854 if (d
.compareTo(secp256k1
.n
) >= 0) throw new Error('Private key must be less than the curve order')
7855 if (Q
) throw new TypeError('Unexpected publicKey parameter')
7859 typeforce(types
.ECPoint
, Q
)
7864 this.compressed
= options
.compressed
=== undefined ? true : options
.compressed
7865 this.network
= options
.network
|| NETWORKS
.bitcoin
7868 Object
.defineProperty(ECPair
.prototype, 'Q', {
7870 if (!this.__Q
&& this.d
) {
7871 this.__Q
= secp256k1
.G
.multiply(this.d
)
7878 ECPair
.fromPublicKeyBuffer = function (buffer
, network
) {
7879 var Q
= ecurve
.Point
.decodeFrom(secp256k1
, buffer
)
7881 return new ECPair(null, Q
, {
7882 compressed: Q
.compressed
,
7887 ECPair
.fromWIF = function (string
, network
) {
7888 var decoded
= wif
.decode(string
)
7889 var version
= decoded
.version
7891 // list of networks?
7892 if (types
.Array(network
)) {
7893 network
= network
.filter(function (x
) {
7894 return version
=== x
.wif
7897 if (!network
) throw new Error('Unknown network version')
7899 // otherwise, assume a network object (or default to bitcoin)
7901 network
= network
|| NETWORKS
.bitcoin
7903 if (version
!== network
.wif
) throw new Error('Invalid network version')
7906 var d
= BigInteger
.fromBuffer(decoded
.privateKey
)
7908 return new ECPair(d
, null, {
7909 compressed: decoded
.compressed
,
7914 ECPair
.makeRandom = function (options
) {
7915 options
= options
|| {}
7917 var rng
= options
.rng
|| randomBytes
7921 var buffer
= rng(32)
7922 typeforce(types
.Buffer256bit
, buffer
)
7924 d
= BigInteger
.fromBuffer(buffer
)
7925 } while (d
.signum() <= 0 || d
.compareTo(secp256k1
.n
) >= 0)
7927 return new ECPair(d
, null, options
)
7930 ECPair
.prototype.getAddress = function () {
7931 return baddress
.toBase58GrsCheck(bcrypto
.hash160(this.getPublicKeyBuffer()), this.getNetwork().pubKeyHash
)
7934 ECPair
.prototype.getNetwork = function () {
7938 ECPair
.prototype.getPublicKeyBuffer = function () {
7939 return this.Q
.getEncoded(this.compressed
)
7942 ECPair
.prototype.sign = function (hash
) {
7943 if (!this.d
) throw new Error('Missing private key')
7945 return ecdsa
.sign(hash
, this.d
)
7948 ECPair
.prototype.toWIF = function () {
7949 if (!this.d
) throw new Error('Missing private key')
7951 return wif
.encode(this.network
.wif
, this.d
.toBuffer(32), this.compressed
)
7954 ECPair
.prototype.verify = function (hash
, signature
) {
7955 return ecdsa
.verify(hash
, signature
, this.Q
)
7958 module
.exports
= ECPair
7960 },{"./address":53,"./crypto":56,"./ecdsa":57,"./networks":62,"./types":89,"bigi":5,"ecurve":20,"randombytes":36,"typeforce":49,"wifgrs":52}],59:[function(require
,module
,exports
){
7962 var bip66
= require('bip66')
7963 var typeforce
= require('typeforce')
7964 var types
= require('./types')
7966 var BigInteger
= require('bigi')
7968 function ECSignature (r
, s
) {
7969 typeforce(types
.tuple(types
.BigInt
, types
.BigInt
), arguments
)
7975 ECSignature
.parseCompact = function (buffer
) {
7976 typeforce(types
.BufferN(65), buffer
)
7978 var flagByte
= buffer
.readUInt8(0) - 27
7979 if (flagByte
!== (flagByte
& 7)) throw new Error('Invalid signature parameter')
7981 var compressed
= !!(flagByte
& 4)
7982 var recoveryParam
= flagByte
& 3
7983 var signature
= ECSignature
.fromRSBuffer(buffer
.slice(1))
7986 compressed: compressed
,
7988 signature: signature
7992 ECSignature
.fromRSBuffer = function (buffer
) {
7993 typeforce(types
.BufferN(64), buffer
)
7995 var r
= BigInteger
.fromBuffer(buffer
.slice(0, 32))
7996 var s
= BigInteger
.fromBuffer(buffer
.slice(32, 64))
7997 return new ECSignature(r
, s
)
8000 ECSignature
.fromDER = function (buffer
) {
8001 var decode
= bip66
.decode(buffer
)
8002 var r
= BigInteger
.fromDERInteger(decode
.r
)
8003 var s
= BigInteger
.fromDERInteger(decode
.s
)
8005 return new ECSignature(r
, s
)
8008 // BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)
8009 ECSignature
.parseScriptSignature = function (buffer
) {
8010 var hashType
= buffer
.readUInt8(buffer
.length
- 1)
8011 var hashTypeMod
= hashType
& ~0x80
8013 if (hashTypeMod
<= 0x00 || hashTypeMod
>= 0x04) throw new Error('Invalid hashType ' + hashType
)
8016 signature: ECSignature
.fromDER(buffer
.slice(0, -1)),
8021 ECSignature
.prototype.toCompact = function (i
, compressed
) {
8028 var buffer
= Buffer
.alloc(65)
8029 buffer
.writeUInt8(i
, 0)
8030 this.toRSBuffer(buffer
, 1)
8034 ECSignature
.prototype.toDER = function () {
8035 var r
= Buffer
.from(this.r
.toDERInteger())
8036 var s
= Buffer
.from(this.s
.toDERInteger())
8038 return bip66
.encode(r
, s
)
8041 ECSignature
.prototype.toRSBuffer = function (buffer
, offset
) {
8042 buffer
= buffer
|| Buffer
.alloc(64)
8043 this.r
.toBuffer(32).copy(buffer
, offset
)
8044 this.s
.toBuffer(32).copy(buffer
, offset
+ 32)
8048 ECSignature
.prototype.toScriptSignature = function (hashType
) {
8049 var hashTypeMod
= hashType
& ~0x80
8050 if (hashTypeMod
<= 0 || hashTypeMod
>= 4) throw new Error('Invalid hashType ' + hashType
)
8052 var hashTypeBuffer
= Buffer
.alloc(1)
8053 hashTypeBuffer
.writeUInt8(hashType
, 0)
8055 return Buffer
.concat([this.toDER(), hashTypeBuffer
])
8058 module
.exports
= ECSignature
8060 }).call(this,require("buffer").Buffer
)
8061 },{"./types":89,"bigi":5,"bip66":7,"buffer":96,"typeforce":49}],60:[function(require
,module
,exports
){
8062 var Buffer
= require('safe-buffer').Buffer
8063 var base58grscheck
= require('bs58grscheck')
8064 var bcrypto
= require('./crypto')
8065 var createHmac
= require('create-hmac')
8066 var typeforce
= require('typeforce')
8067 var types
= require('./types')
8068 var NETWORKS
= require('./networks')
8070 var BigInteger
= require('bigi')
8071 var ECPair
= require('./ecpair')
8073 var ecurve
= require('ecurve')
8074 var curve
= ecurve
.getCurveByName('secp256k1')
8076 function HDNode (keyPair
, chainCode
) {
8077 typeforce(types
.tuple('ECPair', types
.Buffer256bit
), arguments
)
8079 if (!keyPair
.compressed
) throw new TypeError('BIP32 only allows compressed keyPairs')
8081 this.keyPair
= keyPair
8082 this.chainCode
= chainCode
8085 this.parentFingerprint
= 0x00000000
8088 HDNode
.HIGHEST_BIT
= 0x80000000
8090 HDNode
.MASTER_SECRET
= Buffer
.from('Bitcoin seed', 'utf8')
8092 HDNode
.fromSeedBuffer = function (seed
, network
) {
8093 typeforce(types
.tuple(types
.Buffer
, types
.maybe(types
.Network
)), arguments
)
8095 if (seed
.length
< 16) throw new TypeError('Seed should be at least 128 bits')
8096 if (seed
.length
> 64) throw new TypeError('Seed should be at most 512 bits')
8098 var I
= createHmac('sha512', HDNode
.MASTER_SECRET
).update(seed
).digest()
8099 var IL
= I
.slice(0, 32)
8100 var IR
= I
.slice(32)
8102 // In case IL is 0 or >= n, the master key is invalid
8103 // This is handled by the ECPair constructor
8104 var pIL
= BigInteger
.fromBuffer(IL
)
8105 var keyPair
= new ECPair(pIL
, null, {
8109 return new HDNode(keyPair
, IR
)
8112 HDNode
.fromSeedHex = function (hex
, network
) {
8113 return HDNode
.fromSeedBuffer(Buffer
.from(hex
, 'hex'), network
)
8116 HDNode
.fromBase58 = function (string
, networks
) {
8117 var buffer
= base58grscheck
.decode(string
)
8118 if (buffer
.length
!== 78) throw new Error('Invalid buffer length')
8120 // 4 bytes: version bytes
8121 var version
= buffer
.readUInt32BE(0)
8124 // list of networks?
8125 if (Array
.isArray(networks
)) {
8126 network
= networks
.filter(function (x
) {
8127 return version
=== x
.bip32
.private ||
8128 version
=== x
.bip32
.public
8131 if (!network
) throw new Error('Unknown network version')
8133 // otherwise, assume a network object (or default to bitcoin)
8135 network
= networks
|| NETWORKS
.bitcoin
8138 if (version
!== network
.bip32
.private &&
8139 version
!== network
.bip32
.public) throw new Error('Invalid network version')
8141 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
8142 var depth
= buffer
[4]
8144 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
8145 var parentFingerprint
= buffer
.readUInt32BE(5)
8147 if (parentFingerprint
!== 0x00000000) throw new Error('Invalid parent fingerprint')
8150 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
8151 // This is encoded in MSB order. (0x00000000 if master key)
8152 var index
= buffer
.readUInt32BE(9)
8153 if (depth
=== 0 && index
!== 0) throw new Error('Invalid index')
8155 // 32 bytes: the chain code
8156 var chainCode
= buffer
.slice(13, 45)
8159 // 33 bytes: private key data (0x00 + k)
8160 if (version
=== network
.bip32
.private) {
8161 if (buffer
.readUInt8(45) !== 0x00) throw new Error('Invalid private key')
8163 var d
= BigInteger
.fromBuffer(buffer
.slice(46, 78))
8164 keyPair
= new ECPair(d
, null, { network: network
})
8166 // 33 bytes: public key data (0x02 + X or 0x03 + X)
8168 var Q
= ecurve
.Point
.decodeFrom(curve
, buffer
.slice(45, 78))
8169 // Q.compressed is assumed, if somehow this assumption is broken, `new HDNode` will throw
8171 // Verify that the X coordinate in the public point corresponds to a point on the curve.
8172 // If not, the extended public key is invalid.
8175 keyPair
= new ECPair(null, Q
, { network: network
})
8178 var hd
= new HDNode(keyPair
, chainCode
)
8181 hd
.parentFingerprint
= parentFingerprint
8186 HDNode
.prototype.getAddress = function () {
8187 return this.keyPair
.getAddress()
8190 HDNode
.prototype.getIdentifier = function () {
8191 return bcrypto
.hash160(this.keyPair
.getPublicKeyBuffer())
8194 HDNode
.prototype.getFingerprint = function () {
8195 return this.getIdentifier().slice(0, 4)
8198 HDNode
.prototype.getNetwork = function () {
8199 return this.keyPair
.getNetwork()
8202 HDNode
.prototype.getPublicKeyBuffer = function () {
8203 return this.keyPair
.getPublicKeyBuffer()
8206 HDNode
.prototype.neutered = function () {
8207 var neuteredKeyPair
= new ECPair(null, this.keyPair
.Q
, {
8208 network: this.keyPair
.network
8211 var neutered
= new HDNode(neuteredKeyPair
, this.chainCode
)
8212 neutered
.depth
= this.depth
8213 neutered
.index
= this.index
8214 neutered
.parentFingerprint
= this.parentFingerprint
8219 HDNode
.prototype.sign = function (hash
) {
8220 return this.keyPair
.sign(hash
)
8223 HDNode
.prototype.verify = function (hash
, signature
) {
8224 return this.keyPair
.verify(hash
, signature
)
8227 HDNode
.prototype.toBase58 = function (__isPrivate
) {
8228 if (__isPrivate
!== undefined) throw new TypeError('Unsupported argument in 2.0.0')
8231 var network
= this.keyPair
.network
8232 var version
= (!this.isNeutered()) ? network
.bip32
.private : network
.bip32
.public
8233 var buffer
= Buffer
.allocUnsafe(78)
8235 // 4 bytes: version bytes
8236 buffer
.writeUInt32BE(version
, 0)
8238 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ....
8239 buffer
.writeUInt8(this.depth
, 4)
8241 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
8242 buffer
.writeUInt32BE(this.parentFingerprint
, 5)
8244 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
8245 // This is encoded in big endian. (0x00000000 if master key)
8246 buffer
.writeUInt32BE(this.index
, 9)
8248 // 32 bytes: the chain code
8249 this.chainCode
.copy(buffer
, 13)
8251 // 33 bytes: the public key or private key data
8252 if (!this.isNeutered()) {
8253 // 0x00 + k for private keys
8254 buffer
.writeUInt8(0, 45)
8255 this.keyPair
.d
.toBuffer(32).copy(buffer
, 46)
8257 // 33 bytes: the public key
8259 // X9.62 encoding for public keys
8260 this.keyPair
.getPublicKeyBuffer().copy(buffer
, 45)
8263 return base58grscheck
.encode(buffer
)
8266 // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions
8267 HDNode
.prototype.derive = function (index
) {
8268 typeforce(types
.UInt32
, index
)
8270 var isHardened
= index
>= HDNode
.HIGHEST_BIT
8271 var data
= Buffer
.allocUnsafe(37)
8275 if (this.isNeutered()) throw new TypeError('Could not derive hardened child key')
8277 // data = 0x00 || ser256(kpar) || ser32(index)
8279 this.keyPair
.d
.toBuffer(32).copy(data
, 1)
8280 data
.writeUInt32BE(index
, 33)
8284 // data = serP(point(kpar)) || ser32(index)
8285 // = serP(Kpar) || ser32(index)
8286 this.keyPair
.getPublicKeyBuffer().copy(data
, 0)
8287 data
.writeUInt32BE(index
, 33)
8290 var I
= createHmac('sha512', this.chainCode
).update(data
).digest()
8291 var IL
= I
.slice(0, 32)
8292 var IR
= I
.slice(32)
8294 var pIL
= BigInteger
.fromBuffer(IL
)
8296 // In case parse256(IL) >= n, proceed with the next value for i
8297 if (pIL
.compareTo(curve
.n
) >= 0) {
8298 return this.derive(index
+ 1)
8301 // Private parent key -> private child key
8303 if (!this.isNeutered()) {
8304 // ki = parse256(IL) + kpar (mod n)
8305 var ki
= pIL
.add(this.keyPair
.d
).mod(curve
.n
)
8307 // In case ki == 0, proceed with the next value for i
8308 if (ki
.signum() === 0) {
8309 return this.derive(index
+ 1)
8312 derivedKeyPair
= new ECPair(ki
, null, {
8313 network: this.keyPair
.network
8316 // Public parent key -> public child key
8318 // Ki = point(parse256(IL)) + Kpar
8320 var Ki
= curve
.G
.multiply(pIL
).add(this.keyPair
.Q
)
8322 // In case Ki is the point at infinity, proceed with the next value for i
8323 if (curve
.isInfinity(Ki
)) {
8324 return this.derive(index
+ 1)
8327 derivedKeyPair
= new ECPair(null, Ki
, {
8328 network: this.keyPair
.network
8332 var hd
= new HDNode(derivedKeyPair
, IR
)
8333 hd
.depth
= this.depth
+ 1
8335 hd
.parentFingerprint
= this.getFingerprint().readUInt32BE(0)
8340 HDNode
.prototype.deriveHardened = function (index
) {
8341 typeforce(types
.UInt31
, index
)
8343 // Only derives hardened private keys by default
8344 return this.derive(index
+ HDNode
.HIGHEST_BIT
)
8347 // Private === not neutered
8348 // Public === neutered
8349 HDNode
.prototype.isNeutered = function () {
8350 return !(this.keyPair
.d
)
8353 HDNode
.prototype.derivePath = function (path
) {
8354 typeforce(types
.BIP32Path
, path
)
8356 var splitPath
= path
.split('/')
8357 if (splitPath
[0] === 'm') {
8358 if (this.parentFingerprint
) {
8359 throw new Error('Not a master node')
8362 splitPath
= splitPath
.slice(1)
8365 return splitPath
.reduce(function (prevHd
, indexStr
) {
8367 if (indexStr
.slice(-1) === "'") {
8368 index
= parseInt(indexStr
.slice(0, -1), 10)
8369 return prevHd
.deriveHardened(index
)
8371 index
= parseInt(indexStr
, 10)
8372 return prevHd
.derive(index
)
8377 module
.exports
= HDNode
8379 },{"./crypto":56,"./ecpair":58,"./networks":62,"./types":89,"bigi":5,"bs58grscheck":12,"create-hmac":16,"ecurve":20,"safe-buffer":38,"typeforce":49}],61:[function(require
,module
,exports
){
8380 var script
= require('./script')
8382 var templates
= require('./templates')
8383 for (var key
in templates
) {
8384 script
[key
] = templates
[key
]
8388 bufferutils: require('./bufferutils'), // TODO: remove in 4.0.0
8390 Block: require('./block'),
8391 ECPair: require('./ecpair'),
8392 ECSignature: require('./ecsignature'),
8393 HDNode: require('./hdnode'),
8394 Transaction: require('./transaction'),
8395 TransactionBuilder: require('./transaction_builder'),
8397 address: require('./address'),
8398 crypto: require('./crypto'),
8399 networks: require('./networks'),
8400 opcodes: require('bitcoin-ops'),
8404 },{"./address":53,"./block":54,"./bufferutils":55,"./crypto":56,"./ecpair":58,"./ecsignature":59,"./hdnode":60,"./networks":62,"./script":63,"./templates":65,"./transaction":87,"./transaction_builder":88,"bitcoin-ops":8}],62:[function(require
,module
,exports
){
8405 // https://en.bitcoin.it/wiki/List_of_address_prefixes
8406 // Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
8410 messagePrefix: '\x1cGroestlCoin Signed Message:\n',
8421 messagePrefix: '\x1cGroestlCoin Signed Message:\n',
8432 messagePrefix: '\x19Litecoin Signed Message:\n',
8443 },{}],63:[function(require
,module
,exports
){
8444 var Buffer
= require('safe-buffer').Buffer
8445 var bip66
= require('bip66')
8446 var pushdata
= require('pushdata-bitcoin')
8447 var typeforce
= require('typeforce')
8448 var types
= require('./types')
8449 var scriptNumber
= require('./script_number')
8451 var OPS
= require('bitcoin-ops')
8452 var REVERSE_OPS
= require('bitcoin-ops/map')
8453 var OP_INT_BASE
= OPS
.OP_RESERVED
// OP_1 - 1
8455 function isOPInt (value
) {
8456 return types
.Number(value
) &&
8457 ((value
=== OPS
.OP_0
) ||
8458 (value
>= OPS
.OP_1
&& value
<= OPS
.OP_16
) ||
8459 (value
=== OPS
.OP_1NEGATE
))
8462 function isPushOnlyChunk (value
) {
8463 return types
.Buffer(value
) || isOPInt(value
)
8466 function isPushOnly (value
) {
8467 return types
.Array(value
) && value
.every(isPushOnlyChunk
)
8470 function asMinimalOP (buffer
) {
8471 if (buffer
.length
=== 0) return OPS
.OP_0
8472 if (buffer
.length
!== 1) return
8473 if (buffer
[0] >= 1 && buffer
[0] <= 16) return OP_INT_BASE
+ buffer
[0]
8474 if (buffer
[0] === 0x81) return OPS
.OP_1NEGATE
8477 function compile (chunks
) {
8479 if (Buffer
.isBuffer(chunks
)) return chunks
8481 typeforce(types
.Array
, chunks
)
8483 var bufferSize
= chunks
.reduce(function (accum
, chunk
) {
8485 if (Buffer
.isBuffer(chunk
)) {
8486 // adhere to BIP62.3, minimal push policy
8487 if (chunk
.length
=== 1 && asMinimalOP(chunk
) !== undefined) {
8491 return accum
+ pushdata
.encodingLength(chunk
.length
) + chunk
.length
8498 var buffer
= Buffer
.allocUnsafe(bufferSize
)
8501 chunks
.forEach(function (chunk
) {
8503 if (Buffer
.isBuffer(chunk
)) {
8504 // adhere to BIP62.3, minimal push policy
8505 var opcode
= asMinimalOP(chunk
)
8506 if (opcode
!== undefined) {
8507 buffer
.writeUInt8(opcode
, offset
)
8512 offset
+= pushdata
.encode(buffer
, chunk
.length
, offset
)
8513 chunk
.copy(buffer
, offset
)
8514 offset
+= chunk
.length
8518 buffer
.writeUInt8(chunk
, offset
)
8523 if (offset
!== buffer
.length
) throw new Error('Could not decode chunks')
8527 function decompile (buffer
) {
8529 if (types
.Array(buffer
)) return buffer
8531 typeforce(types
.Buffer
, buffer
)
8536 while (i
< buffer
.length
) {
8537 var opcode
= buffer
[i
]
8540 if ((opcode
> OPS
.OP_0
) && (opcode
<= OPS
.OP_PUSHDATA4
)) {
8541 var d
= pushdata
.decode(buffer
, i
)
8543 // did reading a pushDataInt fail? empty script
8544 if (d
=== null) return []
8547 // attempt to read too much data? empty script
8548 if (i
+ d
.number
> buffer
.length
) return []
8550 var data
= buffer
.slice(i
, i
+ d
.number
)
8553 // decompile minimally
8554 var op
= asMinimalOP(data
)
8555 if (op
!== undefined) {
8572 function toASM (chunks
) {
8573 if (Buffer
.isBuffer(chunks
)) {
8574 chunks
= decompile(chunks
)
8577 return chunks
.map(function (chunk
) {
8579 if (Buffer
.isBuffer(chunk
)) {
8580 var op
= asMinimalOP(chunk
)
8581 if (op
=== undefined) return chunk
.toString('hex')
8586 return REVERSE_OPS
[chunk
]
8590 function fromASM (asm
) {
8591 typeforce(types
.String
, asm
)
8593 return compile(asm
.split(' ').map(function (chunkStr
) {
8595 if (OPS
[chunkStr
] !== undefined) return OPS
[chunkStr
]
8596 typeforce(types
.Hex
, chunkStr
)
8599 return Buffer
.from(chunkStr
, 'hex')
8603 function toStack (chunks
) {
8604 chunks
= decompile(chunks
)
8605 typeforce(isPushOnly
, chunks
)
8607 return chunks
.map(function (op
) {
8608 if (Buffer
.isBuffer(op
)) return op
8609 if (op
=== OPS
.OP_0
) return Buffer
.allocUnsafe(0)
8611 return scriptNumber
.encode(op
- OP_INT_BASE
)
8615 function isCanonicalPubKey (buffer
) {
8616 if (!Buffer
.isBuffer(buffer
)) return false
8617 if (buffer
.length
< 33) return false
8619 switch (buffer
[0]) {
8622 return buffer
.length
=== 33
8624 return buffer
.length
=== 65
8630 function isDefinedHashType (hashType
) {
8631 var hashTypeMod
= hashType
& ~0x80
8633 // return hashTypeMod > SIGHASH_ALL && hashTypeMod < SIGHASH_SINGLE
8634 return hashTypeMod
> 0x00 && hashTypeMod
< 0x04
8637 function isCanonicalSignature (buffer
) {
8638 if (!Buffer
.isBuffer(buffer
)) return false
8639 if (!isDefinedHashType(buffer
[buffer
.length
- 1])) return false
8641 return bip66
.check(buffer
.slice(0, -1))
8646 decompile: decompile
,
8651 number: require('./script_number'),
8653 isCanonicalPubKey: isCanonicalPubKey
,
8654 isCanonicalSignature: isCanonicalSignature
,
8655 isPushOnly: isPushOnly
,
8656 isDefinedHashType: isDefinedHashType
8659 },{"./script_number":64,"./types":89,"bip66":7,"bitcoin-ops":8,"bitcoin-ops/map":9,"pushdata-bitcoin":35,"safe-buffer":38,"typeforce":49}],64:[function(require
,module
,exports
){
8660 var Buffer
= require('safe-buffer').Buffer
8662 function decode (buffer
, maxLength
, minimal
) {
8663 maxLength
= maxLength
|| 4
8664 minimal
= minimal
=== undefined ? true : minimal
8666 var length
= buffer
.length
8667 if (length
=== 0) return 0
8668 if (length
> maxLength
) throw new TypeError('Script number overflow')
8670 if ((buffer
[length
- 1] & 0x7f) === 0) {
8671 if (length
<= 1 || (buffer
[length
- 2] & 0x80) === 0) throw new Error('Non-minimally encoded script number')
8677 var a
= buffer
.readUInt32LE(0)
8678 var b
= buffer
.readUInt8(4)
8680 if (b
& 0x80) return -(((b
& ~0x80) * 0x100000000) + a
)
8681 return (b
* 0x100000000) + a
8686 // 32-bit / 24-bit / 16-bit / 8-bit
8687 for (var i
= 0; i
< length
; ++i
) {
8688 result
|= buffer
[i
] << (8 * i
)
8691 if (buffer
[length
- 1] & 0x80) return -(result
& ~(0x80 << (8 * (length
- 1))))
8695 function scriptNumSize (i
) {
8696 return i
> 0x7fffffff ? 5
8704 function encode (number
) {
8705 var value
= Math
.abs(number
)
8706 var size
= scriptNumSize(value
)
8707 var buffer
= Buffer
.allocUnsafe(size
)
8708 var negative
= number
< 0
8710 for (var i
= 0; i
< size
; ++i
) {
8711 buffer
.writeUInt8(value
& 0xff, i
)
8715 if (buffer
[size
- 1] & 0x80) {
8716 buffer
.writeUInt8(negative
? 0x80 : 0x00, size
- 1)
8717 } else if (negative
) {
8718 buffer
[size
- 1] |= 0x80
8729 },{"safe-buffer":38}],65:[function(require
,module
,exports
){
8730 var decompile
= require('../script').decompile
8731 var multisig
= require('./multisig')
8732 var nullData
= require('./nulldata')
8733 var pubKey
= require('./pubkey')
8734 var pubKeyHash
= require('./pubkeyhash')
8735 var scriptHash
= require('./scripthash')
8736 var witnessPubKeyHash
= require('./witnesspubkeyhash')
8737 var witnessScriptHash
= require('./witnessscripthash')
8738 var witnessCommitment
= require('./witnesscommitment')
8741 MULTISIG: 'multisig',
8742 NONSTANDARD: 'nonstandard',
8743 NULLDATA: 'nulldata',
8745 P2PKH: 'pubkeyhash',
8747 P2WPKH: 'witnesspubkeyhash',
8748 P2WSH: 'witnessscripthash',
8749 WITNESS_COMMITMENT: 'witnesscommitment'
8752 function classifyOutput (script
) {
8753 if (witnessPubKeyHash
.output
.check(script
)) return types
.P2WPKH
8754 if (witnessScriptHash
.output
.check(script
)) return types
.P2WSH
8755 if (pubKeyHash
.output
.check(script
)) return types
.P2PKH
8756 if (scriptHash
.output
.check(script
)) return types
.P2SH
8758 // XXX: optimization, below functions .decompile before use
8759 var chunks
= decompile(script
)
8760 if (multisig
.output
.check(chunks
)) return types
.MULTISIG
8761 if (pubKey
.output
.check(chunks
)) return types
.P2PK
8762 if (witnessCommitment
.output
.check(chunks
)) return types
.WITNESS_COMMITMENT
8763 if (nullData
.output
.check(chunks
)) return types
.NULLDATA
8765 return types
.NONSTANDARD
8768 function classifyInput (script
, allowIncomplete
) {
8769 // XXX: optimization, below functions .decompile before use
8770 var chunks
= decompile(script
)
8772 if (pubKeyHash
.input
.check(chunks
)) return types
.P2PKH
8773 if (scriptHash
.input
.check(chunks
, allowIncomplete
)) return types
.P2SH
8774 if (multisig
.input
.check(chunks
, allowIncomplete
)) return types
.MULTISIG
8775 if (pubKey
.input
.check(chunks
)) return types
.P2PK
8777 return types
.NONSTANDARD
8780 function classifyWitness (script
, allowIncomplete
) {
8781 // XXX: optimization, below functions .decompile before use
8782 var chunks
= decompile(script
)
8784 if (witnessPubKeyHash
.input
.check(chunks
)) return types
.P2WPKH
8785 if (witnessScriptHash
.input
.check(chunks
, allowIncomplete
)) return types
.P2WSH
8787 return types
.NONSTANDARD
8791 classifyInput: classifyInput
,
8792 classifyOutput: classifyOutput
,
8793 classifyWitness: classifyWitness
,
8797 pubKeyHash: pubKeyHash
,
8798 scriptHash: scriptHash
,
8799 witnessPubKeyHash: witnessPubKeyHash
,
8800 witnessScriptHash: witnessScriptHash
,
8801 witnessCommitment: witnessCommitment
,
8805 },{"../script":63,"./multisig":66,"./nulldata":69,"./pubkey":70,"./pubkeyhash":73,"./scripthash":76,"./witnesscommitment":79,"./witnesspubkeyhash":81,"./witnessscripthash":84}],66:[function(require
,module
,exports
){
8807 input: require('./input'),
8808 output: require('./output')
8811 },{"./input":67,"./output":68}],67:[function(require
,module
,exports
){
8812 // OP_0 [signatures ...]
8814 var Buffer
= require('safe-buffer').Buffer
8815 var bscript
= require('../../script')
8816 var p2mso
= require('./output')
8817 var typeforce
= require('typeforce')
8818 var OPS
= require('bitcoin-ops')
8820 function partialSignature (value
) {
8821 return value
=== OPS
.OP_0
|| bscript
.isCanonicalSignature(value
)
8824 function check (script
, allowIncomplete
) {
8825 var chunks
= bscript
.decompile(script
)
8826 if (chunks
.length
< 2) return false
8827 if (chunks
[0] !== OPS
.OP_0
) return false
8829 if (allowIncomplete
) {
8830 return chunks
.slice(1).every(partialSignature
)
8833 return chunks
.slice(1).every(bscript
.isCanonicalSignature
)
8835 check
.toJSON = function () { return 'multisig input' }
8837 var EMPTY_BUFFER
= Buffer
.allocUnsafe(0)
8839 function encodeStack (signatures
, scriptPubKey
) {
8840 typeforce([partialSignature
], signatures
)
8843 var scriptData
= p2mso
.decode(scriptPubKey
)
8845 if (signatures
.length
< scriptData
.m
) {
8846 throw new TypeError('Not enough signatures provided')
8849 if (signatures
.length
> scriptData
.pubKeys
.length
) {
8850 throw new TypeError('Too many signatures provided')
8854 return [].concat(EMPTY_BUFFER
, signatures
.map(function (sig
) {
8855 if (sig
=== OPS
.OP_0
) {
8862 function encode (signatures
, scriptPubKey
) {
8863 return bscript
.compile(encodeStack(signatures
, scriptPubKey
))
8866 function decodeStack (stack
, allowIncomplete
) {
8867 typeforce(typeforce
.Array
, stack
)
8868 typeforce(check
, stack
, allowIncomplete
)
8869 return stack
.slice(1)
8872 function decode (buffer
, allowIncomplete
) {
8873 var stack
= bscript
.decompile(buffer
)
8874 return decodeStack(stack
, allowIncomplete
)
8880 decodeStack: decodeStack
,
8882 encodeStack: encodeStack
8885 },{"../../script":63,"./output":68,"bitcoin-ops":8,"safe-buffer":38,"typeforce":49}],68:[function(require
,module
,exports
){
8886 // m [pubKeys ...] n OP_CHECKMULTISIG
8888 var bscript
= require('../../script')
8889 var types
= require('../../types')
8890 var typeforce
= require('typeforce')
8891 var OPS
= require('bitcoin-ops')
8892 var OP_INT_BASE
= OPS
.OP_RESERVED
// OP_1 - 1
8894 function check (script
, allowIncomplete
) {
8895 var chunks
= bscript
.decompile(script
)
8897 if (chunks
.length
< 4) return false
8898 if (chunks
[chunks
.length
- 1] !== OPS
.OP_CHECKMULTISIG
) return false
8899 if (!types
.Number(chunks
[0])) return false
8900 if (!types
.Number(chunks
[chunks
.length
- 2])) return false
8901 var m
= chunks
[0] - OP_INT_BASE
8902 var n
= chunks
[chunks
.length
- 2] - OP_INT_BASE
8904 if (m
<= 0) return false
8905 if (n
> 16) return false
8906 if (m
> n
) return false
8907 if (n
!== chunks
.length
- 3) return false
8908 if (allowIncomplete
) return true
8910 var keys
= chunks
.slice(1, -2)
8911 return keys
.every(bscript
.isCanonicalPubKey
)
8913 check
.toJSON = function () { return 'multi-sig output' }
8915 function encode (m
, pubKeys
) {
8918 pubKeys: [bscript
.isCanonicalPubKey
]
8924 var n
= pubKeys
.length
8925 if (n
< m
) throw new TypeError('Not enough pubKeys provided')
8927 return bscript
.compile([].concat(
8931 OPS
.OP_CHECKMULTISIG
8935 function decode (buffer
, allowIncomplete
) {
8936 var chunks
= bscript
.decompile(buffer
)
8937 typeforce(check
, chunks
, allowIncomplete
)
8940 m: chunks
[0] - OP_INT_BASE
,
8941 pubKeys: chunks
.slice(1, -2)
8951 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"typeforce":49}],69:[function(require
,module
,exports
){
8954 var bscript
= require('../script')
8955 var types
= require('../types')
8956 var typeforce
= require('typeforce')
8957 var OPS
= require('bitcoin-ops')
8959 function check (script
) {
8960 var buffer
= bscript
.compile(script
)
8962 return buffer
.length
> 1 &&
8963 buffer
[0] === OPS
.OP_RETURN
8965 check
.toJSON = function () { return 'null data output' }
8967 function encode (data
) {
8968 typeforce(types
.Buffer
, data
)
8970 return bscript
.compile([OPS
.OP_RETURN
, data
])
8973 function decode (buffer
) {
8974 typeforce(check
, buffer
)
8976 return buffer
.slice(2)
8987 },{"../script":63,"../types":89,"bitcoin-ops":8,"typeforce":49}],70:[function(require
,module
,exports
){
8988 arguments
[4][66][0].apply(exports
,arguments
)
8989 },{"./input":71,"./output":72,"dup":66}],71:[function(require
,module
,exports
){
8992 var bscript
= require('../../script')
8993 var typeforce
= require('typeforce')
8995 function check (script
) {
8996 var chunks
= bscript
.decompile(script
)
8998 return chunks
.length
=== 1 &&
8999 bscript
.isCanonicalSignature(chunks
[0])
9001 check
.toJSON = function () { return 'pubKey input' }
9003 function encodeStack (signature
) {
9004 typeforce(bscript
.isCanonicalSignature
, signature
)
9008 function encode (signature
) {
9009 return bscript
.compile(encodeStack(signature
))
9012 function decodeStack (stack
) {
9013 typeforce(typeforce
.Array
, stack
)
9014 typeforce(check
, stack
)
9018 function decode (buffer
) {
9019 var stack
= bscript
.decompile(buffer
)
9020 return decodeStack(stack
)
9026 decodeStack: decodeStack
,
9028 encodeStack: encodeStack
9031 },{"../../script":63,"typeforce":49}],72:[function(require
,module
,exports
){
9032 // {pubKey} OP_CHECKSIG
9034 var bscript
= require('../../script')
9035 var typeforce
= require('typeforce')
9036 var OPS
= require('bitcoin-ops')
9038 function check (script
) {
9039 var chunks
= bscript
.decompile(script
)
9041 return chunks
.length
=== 2 &&
9042 bscript
.isCanonicalPubKey(chunks
[0]) &&
9043 chunks
[1] === OPS
.OP_CHECKSIG
9045 check
.toJSON = function () { return 'pubKey output' }
9047 function encode (pubKey
) {
9048 typeforce(bscript
.isCanonicalPubKey
, pubKey
)
9050 return bscript
.compile([pubKey
, OPS
.OP_CHECKSIG
])
9053 function decode (buffer
) {
9054 var chunks
= bscript
.decompile(buffer
)
9055 typeforce(check
, chunks
)
9066 },{"../../script":63,"bitcoin-ops":8,"typeforce":49}],73:[function(require
,module
,exports
){
9067 arguments
[4][66][0].apply(exports
,arguments
)
9068 },{"./input":74,"./output":75,"dup":66}],74:[function(require
,module
,exports
){
9069 // {signature} {pubKey}
9071 var bscript
= require('../../script')
9072 var typeforce
= require('typeforce')
9074 function check (script
) {
9075 var chunks
= bscript
.decompile(script
)
9077 return chunks
.length
=== 2 &&
9078 bscript
.isCanonicalSignature(chunks
[0]) &&
9079 bscript
.isCanonicalPubKey(chunks
[1])
9081 check
.toJSON = function () { return 'pubKeyHash input' }
9083 function encodeStack (signature
, pubKey
) {
9085 signature: bscript
.isCanonicalSignature
,
9086 pubKey: bscript
.isCanonicalPubKey
9088 signature: signature
,
9092 return [signature
, pubKey
]
9095 function encode (signature
, pubKey
) {
9096 return bscript
.compile(encodeStack(signature
, pubKey
))
9099 function decodeStack (stack
) {
9100 typeforce(typeforce
.Array
, stack
)
9101 typeforce(check
, stack
)
9104 signature: stack
[0],
9109 function decode (buffer
) {
9110 var stack
= bscript
.decompile(buffer
)
9111 return decodeStack(stack
)
9117 decodeStack: decodeStack
,
9119 encodeStack: encodeStack
9122 },{"../../script":63,"typeforce":49}],75:[function(require
,module
,exports
){
9123 // OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
9125 var bscript
= require('../../script')
9126 var types
= require('../../types')
9127 var typeforce
= require('typeforce')
9128 var OPS
= require('bitcoin-ops')
9130 function check (script
) {
9131 var buffer
= bscript
.compile(script
)
9133 return buffer
.length
=== 25 &&
9134 buffer
[0] === OPS
.OP_DUP
&&
9135 buffer
[1] === OPS
.OP_HASH160
&&
9136 buffer
[2] === 0x14 &&
9137 buffer
[23] === OPS
.OP_EQUALVERIFY
&&
9138 buffer
[24] === OPS
.OP_CHECKSIG
9140 check
.toJSON = function () { return 'pubKeyHash output' }
9142 function encode (pubKeyHash
) {
9143 typeforce(types
.Hash160bit
, pubKeyHash
)
9145 return bscript
.compile([
9154 function decode (buffer
) {
9155 typeforce(check
, buffer
)
9157 return buffer
.slice(3, 23)
9166 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"typeforce":49}],76:[function(require
,module
,exports
){
9167 arguments
[4][66][0].apply(exports
,arguments
)
9168 },{"./input":77,"./output":78,"dup":66}],77:[function(require
,module
,exports
){
9169 // <scriptSig> {serialized scriptPubKey script}
9171 var Buffer
= require('safe-buffer').Buffer
9172 var bscript
= require('../../script')
9173 var typeforce
= require('typeforce')
9175 var p2ms
= require('../multisig/')
9176 var p2pk
= require('../pubkey/')
9177 var p2pkh
= require('../pubkeyhash/')
9178 var p2wpkho
= require('../witnesspubkeyhash/output')
9179 var p2wsho
= require('../witnessscripthash/output')
9181 function check (script
, allowIncomplete
) {
9182 var chunks
= bscript
.decompile(script
)
9183 if (chunks
.length
< 1) return false
9185 var lastChunk
= chunks
[chunks
.length
- 1]
9186 if (!Buffer
.isBuffer(lastChunk
)) return false
9188 var scriptSigChunks
= bscript
.decompile(bscript
.compile(chunks
.slice(0, -1)))
9189 var redeemScriptChunks
= bscript
.decompile(lastChunk
)
9191 // is redeemScript a valid script?
9192 if (redeemScriptChunks
.length
=== 0) return false
9194 // is redeemScriptSig push only?
9195 if (!bscript
.isPushOnly(scriptSigChunks
)) return false
9198 if (chunks
.length
=== 1) {
9199 return p2wsho
.check(redeemScriptChunks
) ||
9200 p2wpkho
.check(redeemScriptChunks
)
9204 if (p2pkh
.input
.check(scriptSigChunks
) &&
9205 p2pkh
.output
.check(redeemScriptChunks
)) return true
9207 if (p2ms
.input
.check(scriptSigChunks
, allowIncomplete
) &&
9208 p2ms
.output
.check(redeemScriptChunks
)) return true
9210 if (p2pk
.input
.check(scriptSigChunks
) &&
9211 p2pk
.output
.check(redeemScriptChunks
)) return true
9215 check
.toJSON = function () { return 'scriptHash input' }
9217 function encodeStack (redeemScriptStack
, redeemScript
) {
9218 var serializedScriptPubKey
= bscript
.compile(redeemScript
)
9220 return [].concat(redeemScriptStack
, serializedScriptPubKey
)
9223 function encode (redeemScriptSig
, redeemScript
) {
9224 var redeemScriptStack
= bscript
.decompile(redeemScriptSig
)
9226 return bscript
.compile(encodeStack(redeemScriptStack
, redeemScript
))
9229 function decodeStack (stack
) {
9230 typeforce(typeforce
.Array
, stack
)
9231 typeforce(check
, stack
)
9234 redeemScriptStack: stack
.slice(0, -1),
9235 redeemScript: stack
[stack
.length
- 1]
9239 function decode (buffer
) {
9240 var stack
= bscript
.decompile(buffer
)
9241 var result
= decodeStack(stack
)
9242 result
.redeemScriptSig
= bscript
.compile(result
.redeemScriptStack
)
9243 delete result
.redeemScriptStack
9250 decodeStack: decodeStack
,
9252 encodeStack: encodeStack
9255 },{"../../script":63,"../multisig/":66,"../pubkey/":70,"../pubkeyhash/":73,"../witnesspubkeyhash/output":83,"../witnessscripthash/output":86,"safe-buffer":38,"typeforce":49}],78:[function(require
,module
,exports
){
9256 // OP_HASH160 {scriptHash} OP_EQUAL
9258 var bscript
= require('../../script')
9259 var types
= require('../../types')
9260 var typeforce
= require('typeforce')
9261 var OPS
= require('bitcoin-ops')
9263 function check (script
) {
9264 var buffer
= bscript
.compile(script
)
9266 return buffer
.length
=== 23 &&
9267 buffer
[0] === OPS
.OP_HASH160
&&
9268 buffer
[1] === 0x14 &&
9269 buffer
[22] === OPS
.OP_EQUAL
9271 check
.toJSON = function () { return 'scriptHash output' }
9273 function encode (scriptHash
) {
9274 typeforce(types
.Hash160bit
, scriptHash
)
9276 return bscript
.compile([OPS
.OP_HASH160
, scriptHash
, OPS
.OP_EQUAL
])
9279 function decode (buffer
) {
9280 typeforce(check
, buffer
)
9282 return buffer
.slice(2, 22)
9291 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"typeforce":49}],79:[function(require
,module
,exports
){
9293 output: require('./output')
9296 },{"./output":80}],80:[function(require
,module
,exports
){
9297 // OP_RETURN {aa21a9ed} {commitment}
9299 var Buffer
= require('safe-buffer').Buffer
9300 var bscript
= require('../../script')
9301 var types
= require('../../types')
9302 var typeforce
= require('typeforce')
9303 var OPS
= require('bitcoin-ops')
9305 var HEADER
= Buffer
.from('aa21a9ed', 'hex')
9307 function check (script
) {
9308 var buffer
= bscript
.compile(script
)
9310 return buffer
.length
> 37 &&
9311 buffer
[0] === OPS
.OP_RETURN
&&
9312 buffer
[1] === 0x24 &&
9313 buffer
.slice(2, 6).equals(HEADER
)
9316 check
.toJSON = function () { return 'Witness commitment output' }
9318 function encode (commitment
) {
9319 typeforce(types
.Hash256bit
, commitment
)
9321 var buffer
= Buffer
.allocUnsafe(36)
9322 HEADER
.copy(buffer
, 0)
9323 commitment
.copy(buffer
, 4)
9325 return bscript
.compile([OPS
.OP_RETURN
, buffer
])
9328 function decode (buffer
) {
9329 typeforce(check
, buffer
)
9331 return bscript
.decompile(buffer
)[1].slice(4, 36)
9340 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"safe-buffer":38,"typeforce":49}],81:[function(require
,module
,exports
){
9341 arguments
[4][66][0].apply(exports
,arguments
)
9342 },{"./input":82,"./output":83,"dup":66}],82:[function(require
,module
,exports
){
9343 // {signature} {pubKey}
9345 var bscript
= require('../../script')
9346 var typeforce
= require('typeforce')
9348 function isCompressedCanonicalPubKey (pubKey
) {
9349 return bscript
.isCanonicalPubKey(pubKey
) && pubKey
.length
=== 33
9352 function check (script
) {
9353 var chunks
= bscript
.decompile(script
)
9355 return chunks
.length
=== 2 &&
9356 bscript
.isCanonicalSignature(chunks
[0]) &&
9357 isCompressedCanonicalPubKey(chunks
[1])
9359 check
.toJSON = function () { return 'witnessPubKeyHash input' }
9361 function encodeStack (signature
, pubKey
) {
9363 signature: bscript
.isCanonicalSignature
,
9364 pubKey: isCompressedCanonicalPubKey
9366 signature: signature
,
9370 return [signature
, pubKey
]
9373 function decodeStack (stack
) {
9374 typeforce(typeforce
.Array
, stack
)
9375 typeforce(check
, stack
)
9378 signature: stack
[0],
9385 decodeStack: decodeStack
,
9386 encodeStack: encodeStack
9389 },{"../../script":63,"typeforce":49}],83:[function(require
,module
,exports
){
9390 // OP_0 {pubKeyHash}
9392 var bscript
= require('../../script')
9393 var types
= require('../../types')
9394 var typeforce
= require('typeforce')
9395 var OPS
= require('bitcoin-ops')
9397 function check (script
) {
9398 var buffer
= bscript
.compile(script
)
9400 return buffer
.length
=== 22 &&
9401 buffer
[0] === OPS
.OP_0
&&
9404 check
.toJSON = function () { return 'Witness pubKeyHash output' }
9406 function encode (pubKeyHash
) {
9407 typeforce(types
.Hash160bit
, pubKeyHash
)
9409 return bscript
.compile([OPS
.OP_0
, pubKeyHash
])
9412 function decode (buffer
) {
9413 typeforce(check
, buffer
)
9415 return buffer
.slice(2)
9424 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"typeforce":49}],84:[function(require
,module
,exports
){
9425 arguments
[4][66][0].apply(exports
,arguments
)
9426 },{"./input":85,"./output":86,"dup":66}],85:[function(require
,module
,exports
){
9428 // <scriptSig> {serialized scriptPubKey script}
9430 var bscript
= require('../../script')
9431 var types
= require('../../types')
9432 var typeforce
= require('typeforce')
9434 var p2ms
= require('../multisig/')
9435 var p2pk
= require('../pubkey/')
9436 var p2pkh
= require('../pubkeyhash/')
9438 function check (chunks
, allowIncomplete
) {
9439 typeforce(types
.Array
, chunks
)
9440 if (chunks
.length
< 1) return false
9442 var witnessScript
= chunks
[chunks
.length
- 1]
9443 if (!Buffer
.isBuffer(witnessScript
)) return false
9445 var witnessScriptChunks
= bscript
.decompile(witnessScript
)
9447 // is witnessScript a valid script?
9448 if (witnessScriptChunks
.length
=== 0) return false
9450 var witnessRawScriptSig
= bscript
.compile(chunks
.slice(0, -1))
9453 if (p2pkh
.input
.check(witnessRawScriptSig
) &&
9454 p2pkh
.output
.check(witnessScriptChunks
)) return true
9456 if (p2ms
.input
.check(witnessRawScriptSig
, allowIncomplete
) &&
9457 p2ms
.output
.check(witnessScriptChunks
)) return true
9459 if (p2pk
.input
.check(witnessRawScriptSig
) &&
9460 p2pk
.output
.check(witnessScriptChunks
)) return true
9464 check
.toJSON = function () { return 'witnessScriptHash input' }
9466 function encodeStack (witnessData
, witnessScript
) {
9468 witnessData: [types
.Buffer
],
9469 witnessScript: types
.Buffer
9471 witnessData: witnessData
,
9472 witnessScript: witnessScript
9475 return [].concat(witnessData
, witnessScript
)
9478 function decodeStack (stack
) {
9479 typeforce(typeforce
.Array
, stack
)
9480 typeforce(check
, stack
)
9482 witnessData: stack
.slice(0, -1),
9483 witnessScript: stack
[stack
.length
- 1]
9489 decodeStack: decodeStack
,
9490 encodeStack: encodeStack
9493 }).call(this,{"isBuffer":require("../../../../../../../usr/local/lib/node_modules/browserify/node_modules/is-buffer/index.js")})
9494 },{"../../../../../../../usr/local/lib/node_modules/browserify/node_modules/is-buffer/index.js":101,"../../script":63,"../../types":89,"../multisig/":66,"../pubkey/":70,"../pubkeyhash/":73,"typeforce":49}],86:[function(require
,module
,exports
){
9495 // OP_0 {scriptHash}
9497 var bscript
= require('../../script')
9498 var types
= require('../../types')
9499 var typeforce
= require('typeforce')
9500 var OPS
= require('bitcoin-ops')
9502 function check (script
) {
9503 var buffer
= bscript
.compile(script
)
9505 return buffer
.length
=== 34 &&
9506 buffer
[0] === OPS
.OP_0
&&
9509 check
.toJSON = function () { return 'Witness scriptHash output' }
9511 function encode (scriptHash
) {
9512 typeforce(types
.Hash256bit
, scriptHash
)
9514 return bscript
.compile([OPS
.OP_0
, scriptHash
])
9517 function decode (buffer
) {
9518 typeforce(check
, buffer
)
9520 return buffer
.slice(2)
9529 },{"../../script":63,"../../types":89,"bitcoin-ops":8,"typeforce":49}],87:[function(require
,module
,exports
){
9530 var Buffer
= require('safe-buffer').Buffer
9531 var bcrypto
= require('./crypto')
9532 var bscript
= require('./script')
9533 var bufferutils
= require('./bufferutils')
9534 var opcodes
= require('bitcoin-ops')
9535 var typeforce
= require('typeforce')
9536 var types
= require('./types')
9537 var varuint
= require('varuint-bitcoin')
9539 function varSliceSize (someScript
) {
9540 var length
= someScript
.length
9542 return varuint
.encodingLength(length
) + length
9545 function vectorSize (someVector
) {
9546 var length
= someVector
.length
9548 return varuint
.encodingLength(length
) + someVector
.reduce(function (sum
, witness
) {
9549 return sum
+ varSliceSize(witness
)
9553 function Transaction () {
9560 Transaction
.DEFAULT_SEQUENCE
= 0xffffffff
9561 Transaction
.SIGHASH_ALL
= 0x01
9562 Transaction
.SIGHASH_NONE
= 0x02
9563 Transaction
.SIGHASH_SINGLE
= 0x03
9564 Transaction
.SIGHASH_ANYONECANPAY
= 0x80
9565 Transaction
.ADVANCED_TRANSACTION_MARKER
= 0x00
9566 Transaction
.ADVANCED_TRANSACTION_FLAG
= 0x01
9568 var EMPTY_SCRIPT
= Buffer
.allocUnsafe(0)
9569 var EMPTY_WITNESS
= []
9570 var ZERO
= Buffer
.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex')
9571 var ONE
= Buffer
.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
9572 var VALUE_UINT64_MAX
= Buffer
.from('ffffffffffffffff', 'hex')
9573 var BLANK_OUTPUT
= {
9574 script: EMPTY_SCRIPT
,
9575 valueBuffer: VALUE_UINT64_MAX
9578 Transaction
.fromBuffer = function (buffer
, __noStrict
) {
9580 function readSlice (n
) {
9582 return buffer
.slice(offset
- n
, offset
)
9585 function readUInt32 () {
9586 var i
= buffer
.readUInt32LE(offset
)
9591 function readInt32 () {
9592 var i
= buffer
.readInt32LE(offset
)
9597 function readUInt64 () {
9598 var i
= bufferutils
.readUInt64LE(buffer
, offset
)
9603 function readVarInt () {
9604 var vi
= varuint
.decode(buffer
, offset
)
9605 offset
+= varuint
.decode
.bytes
9609 function readVarSlice () {
9610 return readSlice(readVarInt())
9613 function readVector () {
9614 var count
= readVarInt()
9616 for (var i
= 0; i
< count
; i
++) vector
.push(readVarSlice())
9620 var tx
= new Transaction()
9621 tx
.version
= readInt32()
9623 var marker
= buffer
.readUInt8(offset
)
9624 var flag
= buffer
.readUInt8(offset
+ 1)
9626 var hasWitnesses
= false
9627 if (marker
=== Transaction
.ADVANCED_TRANSACTION_MARKER
&&
9628 flag
=== Transaction
.ADVANCED_TRANSACTION_FLAG
) {
9633 var vinLen
= readVarInt()
9634 for (var i
= 0; i
< vinLen
; ++i
) {
9636 hash: readSlice(32),
9637 index: readUInt32(),
9638 script: readVarSlice(),
9639 sequence: readUInt32(),
9640 witness: EMPTY_WITNESS
9644 var voutLen
= readVarInt()
9645 for (i
= 0; i
< voutLen
; ++i
) {
9647 value: readUInt64(),
9648 script: readVarSlice()
9653 for (i
= 0; i
< vinLen
; ++i
) {
9654 tx
.ins
[i
].witness
= readVector()
9657 // was this pointless?
9658 if (!tx
.hasWitnesses()) throw new Error('Transaction has superfluous witness data')
9661 tx
.locktime
= readUInt32()
9663 if (__noStrict
) return tx
9664 if (offset
!== buffer
.length
) throw new Error('Transaction has unexpected data')
9669 Transaction
.fromHex = function (hex
) {
9670 return Transaction
.fromBuffer(Buffer
.from(hex
, 'hex'))
9673 Transaction
.isCoinbaseHash = function (buffer
) {
9674 typeforce(types
.Hash256bit
, buffer
)
9675 for (var i
= 0; i
< 32; ++i
) {
9676 if (buffer
[i
] !== 0) return false
9681 Transaction
.prototype.isCoinbase = function () {
9682 return this.ins
.length
=== 1 && Transaction
.isCoinbaseHash(this.ins
[0].hash
)
9685 Transaction
.prototype.addInput = function (hash
, index
, sequence
, scriptSig
) {
9686 typeforce(types
.tuple(
9689 types
.maybe(types
.UInt32
),
9690 types
.maybe(types
.Buffer
)
9693 if (types
.Null(sequence
)) {
9694 sequence
= Transaction
.DEFAULT_SEQUENCE
9697 // Add the input and return the input's index
9698 return (this.ins
.push({
9701 script: scriptSig
|| EMPTY_SCRIPT
,
9703 witness: EMPTY_WITNESS
9707 Transaction
.prototype.addOutput = function (scriptPubKey
, value
) {
9708 typeforce(types
.tuple(types
.Buffer
, types
.Satoshi
), arguments
)
9710 // Add the output and return the output's index
9711 return (this.outs
.push({
9712 script: scriptPubKey
,
9717 Transaction
.prototype.hasWitnesses = function () {
9718 return this.ins
.some(function (x
) {
9719 return x
.witness
.length
!== 0
9723 Transaction
.prototype.weight = function () {
9724 var base
= this.__byteLength(false)
9725 var total
= this.__byteLength(true)
9726 return base
* 3 + total
9729 Transaction
.prototype.virtualSize = function () {
9730 return Math
.ceil(this.weight() / 4)
9733 Transaction
.prototype.byteLength = function () {
9734 return this.__byteLength(true)
9737 Transaction
.prototype.__byteLength = function (__allowWitness
) {
9738 var hasWitnesses
= __allowWitness
&& this.hasWitnesses()
9741 (hasWitnesses
? 10 : 8) +
9742 varuint
.encodingLength(this.ins
.length
) +
9743 varuint
.encodingLength(this.outs
.length
) +
9744 this.ins
.reduce(function (sum
, input
) { return sum
+ 40 + varSliceSize(input
.script
) }, 0) +
9745 this.outs
.reduce(function (sum
, output
) { return sum
+ 8 + varSliceSize(output
.script
) }, 0) +
9746 (hasWitnesses
? this.ins
.reduce(function (sum
, input
) { return sum
+ vectorSize(input
.witness
) }, 0) : 0)
9750 Transaction
.prototype.clone = function () {
9751 var newTx
= new Transaction()
9752 newTx
.version
= this.version
9753 newTx
.locktime
= this.locktime
9755 newTx
.ins
= this.ins
.map(function (txIn
) {
9759 script: txIn
.script
,
9760 sequence: txIn
.sequence
,
9761 witness: txIn
.witness
9765 newTx
.outs
= this.outs
.map(function (txOut
) {
9767 script: txOut
.script
,
9776 * Hash transaction for signing a specific input.
9778 * Bitcoin uses a different hash for each signed transaction input.
9779 * This method copies the transaction, makes the necessary changes based on the
9780 * hashType, and then hashes the result.
9781 * This hash can then be used to sign the provided transaction input.
9783 Transaction
.prototype.hashForSignature = function (inIndex
, prevOutScript
, hashType
) {
9784 typeforce(types
.tuple(types
.UInt32
, types
.Buffer
, /* types.UInt8 */ types
.Number
), arguments
)
9786 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L29
9787 if (inIndex
>= this.ins
.length
) return ONE
9789 // ignore OP_CODESEPARATOR
9790 var ourScript
= bscript
.compile(bscript
.decompile(prevOutScript
).filter(function (x
) {
9791 return x
!== opcodes
.OP_CODESEPARATOR
9794 var txTmp
= this.clone()
9796 // SIGHASH_NONE: ignore all outputs? (wildcard payee)
9797 if ((hashType
& 0x1f) === Transaction
.SIGHASH_NONE
) {
9800 // ignore sequence numbers (except at inIndex)
9801 txTmp
.ins
.forEach(function (input
, i
) {
9802 if (i
=== inIndex
) return
9807 // SIGHASH_SINGLE: ignore all outputs, except at the same index?
9808 } else if ((hashType
& 0x1f) === Transaction
.SIGHASH_SINGLE
) {
9809 // https://github.com/bitcoin/bitcoin/blob/master/src/test/sighash_tests.cpp#L60
9810 if (inIndex
>= this.outs
.length
) return ONE
9812 // truncate outputs after
9813 txTmp
.outs
.length
= inIndex
+ 1
9815 // "blank" outputs before
9816 for (var i
= 0; i
< inIndex
; i
++) {
9817 txTmp
.outs
[i
] = BLANK_OUTPUT
9820 // ignore sequence numbers (except at inIndex)
9821 txTmp
.ins
.forEach(function (input
, y
) {
9822 if (y
=== inIndex
) return
9828 // SIGHASH_ANYONECANPAY: ignore inputs entirely?
9829 if (hashType
& Transaction
.SIGHASH_ANYONECANPAY
) {
9830 txTmp
.ins
= [txTmp
.ins
[inIndex
]]
9831 txTmp
.ins
[0].script
= ourScript
9833 // SIGHASH_ALL: only ignore input scripts
9835 // "blank" others input scripts
9836 txTmp
.ins
.forEach(function (input
) { input
.script
= EMPTY_SCRIPT
})
9837 txTmp
.ins
[inIndex
].script
= ourScript
9840 // serialize and hash
9841 var buffer
= Buffer
.allocUnsafe(txTmp
.__byteLength(false) + 4)
9842 buffer
.writeInt32LE(hashType
, buffer
.length
- 4)
9843 txTmp
.__toBuffer(buffer
, 0, false)
9845 return bcrypto
.sha256(buffer
)
9848 Transaction
.prototype.hashForWitnessV0 = function (inIndex
, prevOutScript
, value
, hashType
) {
9849 typeforce(types
.tuple(types
.UInt32
, types
.Buffer
, types
.Satoshi
, types
.UInt32
), arguments
)
9851 var tbuffer
, toffset
9852 function writeSlice (slice
) { toffset
+= slice
.copy(tbuffer
, toffset
) }
9853 function writeUInt32 (i
) { toffset
= tbuffer
.writeUInt32LE(i
, toffset
) }
9854 function writeUInt64 (i
) { toffset
= bufferutils
.writeUInt64LE(tbuffer
, i
, toffset
) }
9855 function writeVarInt (i
) {
9856 varuint
.encode(i
, tbuffer
, toffset
)
9857 toffset
+= varuint
.encode
.bytes
9859 function writeVarSlice (slice
) { writeVarInt(slice
.length
); writeSlice(slice
) }
9861 var hashOutputs
= ZERO
9862 var hashPrevouts
= ZERO
9863 var hashSequence
= ZERO
9865 if (!(hashType
& Transaction
.SIGHASH_ANYONECANPAY
)) {
9866 tbuffer
= Buffer
.allocUnsafe(36 * this.ins
.length
)
9869 this.ins
.forEach(function (txIn
) {
9870 writeSlice(txIn
.hash
)
9871 writeUInt32(txIn
.index
)
9874 hashPrevouts
= bcrypto
.sha256(tbuffer
)
9877 if (!(hashType
& Transaction
.SIGHASH_ANYONECANPAY
) &&
9878 (hashType
& 0x1f) !== Transaction
.SIGHASH_SINGLE
&&
9879 (hashType
& 0x1f) !== Transaction
.SIGHASH_NONE
) {
9880 tbuffer
= Buffer
.allocUnsafe(4 * this.ins
.length
)
9883 this.ins
.forEach(function (txIn
) {
9884 writeUInt32(txIn
.sequence
)
9887 hashSequence
= bcrypto
.sha256(tbuffer
)
9890 if ((hashType
& 0x1f) !== Transaction
.SIGHASH_SINGLE
&&
9891 (hashType
& 0x1f) !== Transaction
.SIGHASH_NONE
) {
9892 var txOutsSize
= this.outs
.reduce(function (sum
, output
) {
9893 return sum
+ 8 + varSliceSize(output
.script
)
9896 tbuffer
= Buffer
.allocUnsafe(txOutsSize
)
9899 this.outs
.forEach(function (out
) {
9900 writeUInt64(out
.value
)
9901 writeVarSlice(out
.script
)
9904 hashOutputs
= bcrypto
.sha256(tbuffer
)
9905 } else if ((hashType
& 0x1f) === Transaction
.SIGHASH_SINGLE
&& inIndex
< this.outs
.length
) {
9906 var output
= this.outs
[inIndex
]
9908 tbuffer
= Buffer
.allocUnsafe(8 + varSliceSize(output
.script
))
9910 writeUInt64(output
.value
)
9911 writeVarSlice(output
.script
)
9913 hashOutputs
= bcrypto
.sha256(tbuffer
)
9916 tbuffer
= Buffer
.allocUnsafe(156 + varSliceSize(prevOutScript
))
9919 var input
= this.ins
[inIndex
]
9920 writeUInt32(this.version
)
9921 writeSlice(hashPrevouts
)
9922 writeSlice(hashSequence
)
9923 writeSlice(input
.hash
)
9924 writeUInt32(input
.index
)
9925 writeVarSlice(prevOutScript
)
9927 writeUInt32(input
.sequence
)
9928 writeSlice(hashOutputs
)
9929 writeUInt32(this.locktime
)
9930 writeUInt32(hashType
)
9931 return bcrypto
.sha256(tbuffer
)
9934 Transaction
.prototype.getHash = function () {
9935 return bcrypto
.sha256(this.__toBuffer(undefined, undefined, false))
9938 Transaction
.prototype.getId = function () {
9939 // transaction hash's are displayed in reverse order
9940 return this.getHash().reverse().toString('hex')
9943 Transaction
.prototype.toBuffer = function (buffer
, initialOffset
) {
9944 return this.__toBuffer(buffer
, initialOffset
, true)
9947 Transaction
.prototype.__toBuffer = function (buffer
, initialOffset
, __allowWitness
) {
9948 if (!buffer
) buffer
= Buffer
.allocUnsafe(this.__byteLength(__allowWitness
))
9950 var offset
= initialOffset
|| 0
9951 function writeSlice (slice
) { offset
+= slice
.copy(buffer
, offset
) }
9952 function writeUInt8 (i
) { offset
= buffer
.writeUInt8(i
, offset
) }
9953 function writeUInt32 (i
) { offset
= buffer
.writeUInt32LE(i
, offset
) }
9954 function writeInt32 (i
) { offset
= buffer
.writeInt32LE(i
, offset
) }
9955 function writeUInt64 (i
) { offset
= bufferutils
.writeUInt64LE(buffer
, i
, offset
) }
9956 function writeVarInt (i
) {
9957 varuint
.encode(i
, buffer
, offset
)
9958 offset
+= varuint
.encode
.bytes
9960 function writeVarSlice (slice
) { writeVarInt(slice
.length
); writeSlice(slice
) }
9961 function writeVector (vector
) { writeVarInt(vector
.length
); vector
.forEach(writeVarSlice
) }
9963 writeInt32(this.version
)
9965 var hasWitnesses
= __allowWitness
&& this.hasWitnesses()
9968 writeUInt8(Transaction
.ADVANCED_TRANSACTION_MARKER
)
9969 writeUInt8(Transaction
.ADVANCED_TRANSACTION_FLAG
)
9972 writeVarInt(this.ins
.length
)
9974 this.ins
.forEach(function (txIn
) {
9975 writeSlice(txIn
.hash
)
9976 writeUInt32(txIn
.index
)
9977 writeVarSlice(txIn
.script
)
9978 writeUInt32(txIn
.sequence
)
9981 writeVarInt(this.outs
.length
)
9982 this.outs
.forEach(function (txOut
) {
9983 if (!txOut
.valueBuffer
) {
9984 writeUInt64(txOut
.value
)
9986 writeSlice(txOut
.valueBuffer
)
9989 writeVarSlice(txOut
.script
)
9993 this.ins
.forEach(function (input
) {
9994 writeVector(input
.witness
)
9998 writeUInt32(this.locktime
)
10000 // avoid slicing unless necessary
10001 if (initialOffset
!== undefined) return buffer
.slice(initialOffset
, offset
)
10005 Transaction
.prototype.toHex = function () {
10006 return this.toBuffer().toString('hex')
10009 Transaction
.prototype.setInputScript = function (index
, scriptSig
) {
10010 typeforce(types
.tuple(types
.Number
, types
.Buffer
), arguments
)
10012 this.ins
[index
].script
= scriptSig
10015 Transaction
.prototype.setWitness = function (index
, witness
) {
10016 typeforce(types
.tuple(types
.Number
, [types
.Buffer
]), arguments
)
10018 this.ins
[index
].witness
= witness
10021 module
.exports
= Transaction
10023 },{"./bufferutils":55,"./crypto":56,"./script":63,"./types":89,"bitcoin-ops":8,"safe-buffer":38,"typeforce":49,"varuint-bitcoin":51}],88:[function(require
,module
,exports
){
10024 var Buffer
= require('safe-buffer').Buffer
10025 var baddress
= require('./address')
10026 var bcrypto
= require('./crypto')
10027 var bscript
= require('./script')
10028 var btemplates
= require('./templates')
10029 var networks
= require('./networks')
10030 var ops
= require('bitcoin-ops')
10031 var typeforce
= require('typeforce')
10032 var types
= require('./types')
10033 var scriptTypes
= btemplates
.types
10034 var SIGNABLE
= [btemplates
.types
.P2PKH
, btemplates
.types
.P2PK
, btemplates
.types
.MULTISIG
]
10035 var P2SH
= SIGNABLE
.concat([btemplates
.types
.P2WPKH
, btemplates
.types
.P2WSH
])
10037 var ECPair
= require('./ecpair')
10038 var ECSignature
= require('./ecsignature')
10039 var Transaction
= require('./transaction')
10041 function supportedType (type
) {
10042 return SIGNABLE
.indexOf(type
) !== -1
10045 function supportedP2SHType (type
) {
10046 return P2SH
.indexOf(type
) !== -1
10049 function extractChunks (type
, chunks
, script
) {
10051 var signatures
= []
10053 case scriptTypes
.P2PKH:
10054 // if (redeemScript) throw new Error('Nonstandard... P2SH(P2PKH)')
10055 pubKeys
= chunks
.slice(1)
10056 signatures
= chunks
.slice(0, 1)
10059 case scriptTypes
.P2PK:
10060 pubKeys
[0] = script
? btemplates
.pubKey
.output
.decode(script
) : undefined
10061 signatures
= chunks
.slice(0, 1)
10064 case scriptTypes
.MULTISIG:
10066 var multisig
= btemplates
.multisig
.output
.decode(script
)
10067 pubKeys
= multisig
.pubKeys
10070 signatures
= chunks
.slice(1).map(function (chunk
) {
10071 return chunk
.length
=== 0 ? undefined : chunk
10078 signatures: signatures
10081 function expandInput (scriptSig
, witnessStack
) {
10082 if (scriptSig
.length
=== 0 && witnessStack
.length
=== 0) return {}
10090 var witnessScriptType
10091 var redeemScriptType
10092 var witness
= false
10098 var scriptSigChunks
= bscript
.decompile(scriptSig
)
10099 var sigType
= btemplates
.classifyInput(scriptSigChunks
, true)
10100 if (sigType
=== scriptTypes
.P2SH
) {
10102 redeemScript
= scriptSigChunks
[scriptSigChunks
.length
- 1]
10103 redeemScriptType
= btemplates
.classifyOutput(redeemScript
)
10104 prevOutScript
= btemplates
.scriptHash
.output
.encode(bcrypto
.hash160(redeemScript
))
10105 prevOutType
= scriptTypes
.P2SH
10106 script
= redeemScript
10109 var classifyWitness
= btemplates
.classifyWitness(witnessStack
, true)
10110 if (classifyWitness
=== scriptTypes
.P2WSH
) {
10111 witnessScript
= witnessStack
[witnessStack
.length
- 1]
10112 witnessScriptType
= btemplates
.classifyOutput(witnessScript
)
10115 if (scriptSig
.length
=== 0) {
10116 prevOutScript
= btemplates
.witnessScriptHash
.output
.encode(bcrypto
.sha256(witnessScript
))
10117 prevOutType
= scriptTypes
.P2WSH
10118 if (redeemScript
!== undefined) {
10119 throw new Error('Redeem script given when unnecessary')
10123 if (!redeemScript
) {
10124 throw new Error('No redeemScript provided for P2WSH, but scriptSig non-empty')
10126 witnessProgram
= btemplates
.witnessScriptHash
.output
.encode(bcrypto
.sha256(witnessScript
))
10127 if (!redeemScript
.equals(witnessProgram
)) {
10128 throw new Error('Redeem script didn\'t match witnessScript')
10132 if (!supportedType(btemplates
.classifyOutput(witnessScript
))) {
10133 throw new Error('unsupported witness script')
10136 script
= witnessScript
10137 scriptType
= witnessScriptType
10138 chunks
= witnessStack
.slice(0, -1)
10139 } else if (classifyWitness
=== scriptTypes
.P2WPKH
) {
10141 var key
= witnessStack
[witnessStack
.length
- 1]
10142 var keyHash
= bcrypto
.hash160(key
)
10143 if (scriptSig
.length
=== 0) {
10144 prevOutScript
= btemplates
.witnessPubKeyHash
.output
.encode(keyHash
)
10145 prevOutType
= scriptTypes
.P2WPKH
10146 if (typeof redeemScript
!== 'undefined') {
10147 throw new Error('Redeem script given when unnecessary')
10150 if (!redeemScript
) {
10151 throw new Error('No redeemScript provided for P2WPKH, but scriptSig wasn\'t empty')
10153 witnessProgram
= btemplates
.witnessPubKeyHash
.output
.encode(keyHash
)
10154 if (!redeemScript
.equals(witnessProgram
)) {
10155 throw new Error('Redeem script did not have the right witness program')
10159 scriptType
= scriptTypes
.P2PKH
10160 chunks
= witnessStack
10161 } else if (redeemScript
) {
10162 if (!supportedP2SHType(redeemScriptType
)) {
10163 throw new Error('Bad redeemscript!')
10166 script
= redeemScript
10167 scriptType
= redeemScriptType
10168 chunks
= scriptSigChunks
.slice(0, -1)
10170 prevOutType
= scriptType
= btemplates
.classifyInput(scriptSig
)
10171 chunks
= scriptSigChunks
10174 var expanded
= extractChunks(scriptType
, chunks
, script
)
10177 pubKeys: expanded
.pubKeys
,
10178 signatures: expanded
.signatures
,
10179 prevOutScript: prevOutScript
,
10180 prevOutType: prevOutType
,
10181 signType: scriptType
,
10182 signScript: script
,
10183 witness: Boolean(witness
)
10187 result
.redeemScript
= redeemScript
10188 result
.redeemScriptType
= redeemScriptType
10192 result
.witnessScript
= witnessScript
10193 result
.witnessScriptType
= witnessScriptType
10199 // could be done in expandInput, but requires the original Transaction for hashForSignature
10200 function fixMultisigOrder (input
, transaction
, vin
) {
10201 if (input
.redeemScriptType
!== scriptTypes
.MULTISIG
|| !input
.redeemScript
) return
10202 if (input
.pubKeys
.length
=== input
.signatures
.length
) return
10204 var unmatched
= input
.signatures
.concat()
10206 input
.signatures
= input
.pubKeys
.map(function (pubKey
) {
10207 var keyPair
= ECPair
.fromPublicKeyBuffer(pubKey
)
10210 // check for a signature
10211 unmatched
.some(function (signature
, i
) {
10212 // skip if undefined || OP_0
10213 if (!signature
) return false
10215 // TODO: avoid O(n) hashForSignature
10216 var parsed
= ECSignature
.parseScriptSignature(signature
)
10217 var hash
= transaction
.hashForSignature(vin
, input
.redeemScript
, parsed
.hashType
)
10219 // skip if signature does not match pubKey
10220 if (!keyPair
.verify(hash
, parsed
.signature
)) return false
10222 // remove matched signature from unmatched
10223 unmatched
[i
] = undefined
10233 function expandOutput (script
, scriptType
, ourPubKey
) {
10234 typeforce(types
.Buffer
, script
)
10236 var scriptChunks
= bscript
.decompile(script
)
10238 scriptType
= btemplates
.classifyOutput(script
)
10243 switch (scriptType
) {
10244 // does our hash160(pubKey) match the output scripts?
10245 case scriptTypes
.P2PKH:
10246 if (!ourPubKey
) break
10248 var pkh1
= scriptChunks
[2]
10249 var pkh2
= bcrypto
.hash160(ourPubKey
)
10250 if (pkh1
.equals(pkh2
)) pubKeys
= [ourPubKey
]
10253 // does our hash160(pubKey) match the output scripts?
10254 case scriptTypes
.P2WPKH:
10255 if (!ourPubKey
) break
10257 var wpkh1
= scriptChunks
[1]
10258 var wpkh2
= bcrypto
.hash160(ourPubKey
)
10259 if (wpkh1
.equals(wpkh2
)) pubKeys
= [ourPubKey
]
10262 case scriptTypes
.P2PK:
10263 pubKeys
= scriptChunks
.slice(0, 1)
10266 case scriptTypes
.MULTISIG:
10267 pubKeys
= scriptChunks
.slice(1, -2)
10270 default: return { scriptType: scriptType
}
10275 scriptType: scriptType
,
10276 signatures: pubKeys
.map(function () { return undefined })
10280 function checkP2SHInput (input
, redeemScriptHash
) {
10281 if (input
.prevOutType
) {
10282 if (input
.prevOutType
!== scriptTypes
.P2SH
) throw new Error('PrevOutScript must be P2SH')
10284 var prevOutScriptScriptHash
= bscript
.decompile(input
.prevOutScript
)[1]
10285 if (!prevOutScriptScriptHash
.equals(redeemScriptHash
)) throw new Error('Inconsistent hash160(RedeemScript)')
10289 function checkP2WSHInput (input
, witnessScriptHash
) {
10290 if (input
.prevOutType
) {
10291 if (input
.prevOutType
!== scriptTypes
.P2WSH
) throw new Error('PrevOutScript must be P2WSH')
10293 var scriptHash
= bscript
.decompile(input
.prevOutScript
)[1]
10294 if (!scriptHash
.equals(witnessScriptHash
)) throw new Error('Inconsistent sha25(WitnessScript)')
10298 function prepareInput (input
, kpPubKey
, redeemScript
, witnessValue
, witnessScript
) {
10305 var redeemScriptHash
10307 var witness
= false
10310 var witnessScriptHash
10315 if (redeemScript
&& witnessScript
) {
10316 redeemScriptHash
= bcrypto
.hash160(redeemScript
)
10317 witnessScriptHash
= bcrypto
.sha256(witnessScript
)
10318 checkP2SHInput(input
, redeemScriptHash
)
10320 if (!redeemScript
.equals(btemplates
.witnessScriptHash
.output
.encode(witnessScriptHash
))) throw new Error('Witness script inconsistent with redeem script')
10322 expanded
= expandOutput(witnessScript
, undefined, kpPubKey
)
10323 if (!expanded
.pubKeys
) throw new Error('WitnessScript not supported "' + bscript
.toASM(redeemScript
) + '"')
10325 prevOutType
= btemplates
.types
.P2SH
10326 prevOutScript
= btemplates
.scriptHash
.output
.encode(redeemScriptHash
)
10327 p2sh
= witness
= p2wsh
= true
10328 p2shType
= btemplates
.types
.P2WSH
10329 signType
= witnessType
= expanded
.scriptType
10330 signScript
= witnessScript
10331 } else if (redeemScript
) {
10332 redeemScriptHash
= bcrypto
.hash160(redeemScript
)
10333 checkP2SHInput(input
, redeemScriptHash
)
10335 expanded
= expandOutput(redeemScript
, undefined, kpPubKey
)
10336 if (!expanded
.pubKeys
) throw new Error('RedeemScript not supported "' + bscript
.toASM(redeemScript
) + '"')
10338 prevOutType
= btemplates
.types
.P2SH
10339 prevOutScript
= btemplates
.scriptHash
.output
.encode(redeemScriptHash
)
10341 signType
= p2shType
= expanded
.scriptType
10342 signScript
= redeemScript
10343 witness
= signType
=== btemplates
.types
.P2WPKH
10344 } else if (witnessScript
) {
10345 witnessScriptHash
= bcrypto
.sha256(witnessScript
)
10346 checkP2WSHInput(input
, witnessScriptHash
)
10348 expanded
= expandOutput(witnessScript
, undefined, kpPubKey
)
10349 if (!expanded
.pubKeys
) throw new Error('WitnessScript not supported "' + bscript
.toASM(redeemScript
) + '"')
10351 prevOutType
= btemplates
.types
.P2WSH
10352 prevOutScript
= btemplates
.witnessScriptHash
.output
.encode(witnessScriptHash
)
10353 witness
= p2wsh
= true
10354 signType
= witnessType
= expanded
.scriptType
10355 signScript
= witnessScript
10356 } else if (input
.prevOutType
) {
10357 // embedded scripts are not possible without a redeemScript
10358 if (input
.prevOutType
=== scriptTypes
.P2SH
||
10359 input
.prevOutType
=== scriptTypes
.P2WSH
) {
10360 throw new Error('PrevOutScript is ' + input
.prevOutType
+ ', requires redeemScript')
10363 prevOutType
= input
.prevOutType
10364 prevOutScript
= input
.prevOutScript
10365 expanded
= expandOutput(input
.prevOutScript
, input
.prevOutType
, kpPubKey
)
10366 if (!expanded
.pubKeys
) return
10368 witness
= (input
.prevOutType
=== scriptTypes
.P2WPKH
)
10369 signType
= prevOutType
10370 signScript
= prevOutScript
10372 prevOutScript
= btemplates
.pubKeyHash
.output
.encode(bcrypto
.hash160(kpPubKey
))
10373 expanded
= expandOutput(prevOutScript
, scriptTypes
.P2PKH
, kpPubKey
)
10375 prevOutType
= scriptTypes
.P2PKH
10377 signType
= prevOutType
10378 signScript
= prevOutScript
10381 if (signType
=== scriptTypes
.P2WPKH
) {
10382 signScript
= btemplates
.pubKeyHash
.output
.encode(btemplates
.witnessPubKeyHash
.output
.decode(signScript
))
10386 input
.redeemScript
= redeemScript
10387 input
.redeemScriptType
= p2shType
10391 input
.witnessScript
= witnessScript
10392 input
.witnessScriptType
= witnessType
10395 input
.pubKeys
= expanded
.pubKeys
10396 input
.signatures
= expanded
.signatures
10397 input
.signScript
= signScript
10398 input
.signType
= signType
10399 input
.prevOutScript
= prevOutScript
10400 input
.prevOutType
= prevOutType
10401 input
.witness
= witness
10404 function buildStack (type
, signatures
, pubKeys
, allowIncomplete
) {
10405 if (type
=== scriptTypes
.P2PKH
) {
10406 if (signatures
.length
=== 1 && Buffer
.isBuffer(signatures
[0]) && pubKeys
.length
=== 1) return btemplates
.pubKeyHash
.input
.encodeStack(signatures
[0], pubKeys
[0])
10407 } else if (type
=== scriptTypes
.P2PK
) {
10408 if (signatures
.length
=== 1 && Buffer
.isBuffer(signatures
[0])) return btemplates
.pubKey
.input
.encodeStack(signatures
[0])
10409 } else if (type
=== scriptTypes
.MULTISIG
) {
10410 if (signatures
.length
> 0) {
10411 signatures
= signatures
.map(function (signature
) {
10412 return signature
|| ops
.OP_0
10414 if (!allowIncomplete
) {
10415 // remove blank signatures
10416 signatures
= signatures
.filter(function (x
) { return x
!== ops
.OP_0
})
10419 return btemplates
.multisig
.input
.encodeStack(signatures
)
10422 throw new Error('Not yet supported')
10425 if (!allowIncomplete
) throw new Error('Not enough signatures provided')
10429 function buildInput (input
, allowIncomplete
) {
10430 var scriptType
= input
.prevOutType
10434 if (supportedType(scriptType
)) {
10435 sig
= buildStack(scriptType
, input
.signatures
, input
.pubKeys
, allowIncomplete
)
10439 if (scriptType
=== btemplates
.types
.P2SH
) {
10440 // We can remove this error later when we have a guarantee prepareInput
10441 // rejects unsignable scripts - it MUST be signable at this point.
10442 if (!allowIncomplete
&& !supportedP2SHType(input
.redeemScriptType
)) {
10443 throw new Error('Impossible to sign this type')
10446 if (supportedType(input
.redeemScriptType
)) {
10447 sig
= buildStack(input
.redeemScriptType
, input
.signatures
, input
.pubKeys
, allowIncomplete
)
10450 // If it wasn't SIGNABLE, it's witness, defer to that
10451 if (input
.redeemScriptType
) {
10453 scriptType
= input
.redeemScriptType
10457 switch (scriptType
) {
10458 // P2WPKH is a special case of P2PKH
10459 case btemplates
.types
.P2WPKH:
10460 witness
= buildStack(btemplates
.types
.P2PKH
, input
.signatures
, input
.pubKeys
, allowIncomplete
)
10463 case btemplates
.types
.P2WSH:
10464 // We can remove this check later
10465 if (!allowIncomplete
&& !supportedType(input
.witnessScriptType
)) {
10466 throw new Error('Impossible to sign this type')
10469 if (supportedType(input
.witnessScriptType
)) {
10470 witness
= buildStack(input
.witnessScriptType
, input
.signatures
, input
.pubKeys
, allowIncomplete
)
10471 witness
.push(input
.witnessScript
)
10472 scriptType
= input
.witnessScriptType
10478 // append redeemScript if necessary
10480 sig
.push(input
.redeemScript
)
10485 script: bscript
.compile(sig
),
10490 function TransactionBuilder (network
, maximumFeeRate
) {
10491 this.prevTxMap
= {}
10492 this.network
= network
|| networks
.bitcoin
10494 // WARNING: This is __NOT__ to be relied on, its just another potential safety mechanism (safety in-depth)
10495 this.maximumFeeRate
= maximumFeeRate
|| 2500
10498 this.tx
= new Transaction()
10501 TransactionBuilder
.prototype.setLockTime = function (locktime
) {
10502 typeforce(types
.UInt32
, locktime
)
10504 // if any signatures exist, throw
10505 if (this.inputs
.some(function (input
) {
10506 if (!input
.signatures
) return false
10508 return input
.signatures
.some(function (s
) { return s
})
10510 throw new Error('No, this would invalidate signatures')
10513 this.tx
.locktime
= locktime
10516 TransactionBuilder
.prototype.setVersion = function (version
) {
10517 typeforce(types
.UInt32
, version
)
10519 // XXX: this might eventually become more complex depending on what the versions represent
10520 this.tx
.version
= version
10523 TransactionBuilder
.fromTransaction = function (transaction
, network
) {
10524 var txb
= new TransactionBuilder(network
)
10526 // Copy transaction fields
10527 txb
.setVersion(transaction
.version
)
10528 txb
.setLockTime(transaction
.locktime
)
10530 // Copy outputs (done first to avoid signature invalidation)
10531 transaction
.outs
.forEach(function (txOut
) {
10532 txb
.addOutput(txOut
.script
, txOut
.value
)
10536 transaction
.ins
.forEach(function (txIn
) {
10537 txb
.__addInputUnsafe(txIn
.hash
, txIn
.index
, {
10538 sequence: txIn
.sequence
,
10539 script: txIn
.script
,
10540 witness: txIn
.witness
10544 // fix some things not possible through the public API
10545 txb
.inputs
.forEach(function (input
, i
) {
10546 fixMultisigOrder(input
, transaction
, i
)
10552 TransactionBuilder
.prototype.addInput = function (txHash
, vout
, sequence
, prevOutScript
) {
10553 if (!this.__canModifyInputs()) {
10554 throw new Error('No, this would invalidate signatures')
10559 // is it a hex string?
10560 if (typeof txHash
=== 'string') {
10561 // transaction hashs's are displayed in reverse order, un-reverse it
10562 txHash
= Buffer
.from(txHash
, 'hex').reverse()
10564 // is it a Transaction object?
10565 } else if (txHash
instanceof Transaction
) {
10566 var txOut
= txHash
.outs
[vout
]
10567 prevOutScript
= txOut
.script
10568 value
= txOut
.value
10570 txHash
= txHash
.getHash()
10573 return this.__addInputUnsafe(txHash
, vout
, {
10574 sequence: sequence
,
10575 prevOutScript: prevOutScript
,
10580 TransactionBuilder
.prototype.__addInputUnsafe = function (txHash
, vout
, options
) {
10581 if (Transaction
.isCoinbaseHash(txHash
)) {
10582 throw new Error('coinbase inputs not supported')
10585 var prevTxOut
= txHash
.toString('hex') + ':' + vout
10586 if (this.prevTxMap
[prevTxOut
] !== undefined) throw new Error('Duplicate TxOut: ' + prevTxOut
)
10590 // derive what we can from the scriptSig
10591 if (options
.script
!== undefined) {
10592 input
= expandInput(options
.script
, options
.witness
|| [])
10595 // if an input value was given, retain it
10596 if (options
.value
!== undefined) {
10597 input
.value
= options
.value
10600 // derive what we can from the previous transactions output script
10601 if (!input
.prevOutScript
&& options
.prevOutScript
) {
10604 if (!input
.pubKeys
&& !input
.signatures
) {
10605 var expanded
= expandOutput(options
.prevOutScript
)
10607 if (expanded
.pubKeys
) {
10608 input
.pubKeys
= expanded
.pubKeys
10609 input
.signatures
= expanded
.signatures
10612 prevOutType
= expanded
.scriptType
10615 input
.prevOutScript
= options
.prevOutScript
10616 input
.prevOutType
= prevOutType
|| btemplates
.classifyOutput(options
.prevOutScript
)
10619 var vin
= this.tx
.addInput(txHash
, vout
, options
.sequence
, options
.scriptSig
)
10620 this.inputs
[vin
] = input
10621 this.prevTxMap
[prevTxOut
] = vin
10625 TransactionBuilder
.prototype.addOutput = function (scriptPubKey
, value
) {
10626 if (!this.__canModifyOutputs()) {
10627 throw new Error('No, this would invalidate signatures')
10630 // Attempt to get a script if it's a base58 address string
10631 if (typeof scriptPubKey
=== 'string') {
10632 scriptPubKey
= baddress
.toOutputScript(scriptPubKey
, this.network
)
10635 return this.tx
.addOutput(scriptPubKey
, value
)
10638 TransactionBuilder
.prototype.build = function () {
10639 return this.__build(false)
10641 TransactionBuilder
.prototype.buildIncomplete = function () {
10642 return this.__build(true)
10645 TransactionBuilder
.prototype.__build = function (allowIncomplete
) {
10646 if (!allowIncomplete
) {
10647 if (!this.tx
.ins
.length
) throw new Error('Transaction has no inputs')
10648 if (!this.tx
.outs
.length
) throw new Error('Transaction has no outputs')
10651 var tx
= this.tx
.clone()
10652 // Create script signatures from inputs
10653 this.inputs
.forEach(function (input
, i
) {
10654 var scriptType
= input
.witnessScriptType
|| input
.redeemScriptType
|| input
.prevOutType
10655 if (!scriptType
&& !allowIncomplete
) throw new Error('Transaction is not complete')
10656 var result
= buildInput(input
, allowIncomplete
)
10658 // skip if no result
10659 if (!allowIncomplete
) {
10660 if (!supportedType(result
.type
) && result
.type
!== btemplates
.types
.P2WPKH
) {
10661 throw new Error(result
.type
+ ' not supported')
10665 tx
.setInputScript(i
, result
.script
)
10666 tx
.setWitness(i
, result
.witness
)
10669 if (!allowIncomplete
) {
10670 // do not rely on this, its merely a last resort
10671 if (this.__overMaximumFees(tx
.virtualSize())) {
10672 throw new Error('Transaction has absurd fees')
10679 function canSign (input
) {
10680 return input
.prevOutScript
!== undefined &&
10681 input
.signScript
!== undefined &&
10682 input
.pubKeys
!== undefined &&
10683 input
.signatures
!== undefined &&
10684 input
.signatures
.length
=== input
.pubKeys
.length
&&
10685 input
.pubKeys
.length
> 0 &&
10687 input
.witness
=== false ||
10688 (input
.witness
=== true && input
.value
!== undefined)
10692 TransactionBuilder
.prototype.sign = function (vin
, keyPair
, redeemScript
, hashType
, witnessValue
, witnessScript
) {
10693 // TODO: remove keyPair.network matching in 4.0.0
10694 if (keyPair
.network
&& keyPair
.network
!== this.network
) throw new TypeError('Inconsistent network')
10695 if (!this.inputs
[vin
]) throw new Error('No input at index: ' + vin
)
10696 hashType
= hashType
|| Transaction
.SIGHASH_ALL
10698 var input
= this.inputs
[vin
]
10700 // if redeemScript was previously provided, enforce consistency
10701 if (input
.redeemScript
!== undefined &&
10703 !input
.redeemScript
.equals(redeemScript
)) {
10704 throw new Error('Inconsistent redeemScript')
10707 var kpPubKey
= keyPair
.publicKey
|| keyPair
.getPublicKeyBuffer()
10708 if (!canSign(input
)) {
10709 if (witnessValue
!== undefined) {
10710 if (input
.value
!== undefined && input
.value
!== witnessValue
) throw new Error('Input didn\'t match witnessValue')
10711 typeforce(types
.Satoshi
, witnessValue
)
10712 input
.value
= witnessValue
10715 if (!canSign(input
)) prepareInput(input
, kpPubKey
, redeemScript
, witnessValue
, witnessScript
)
10716 if (!canSign(input
)) throw Error(input
.prevOutType
+ ' not supported')
10721 if (input
.witness
) {
10722 signatureHash
= this.tx
.hashForWitnessV0(vin
, input
.signScript
, input
.value
, hashType
)
10724 signatureHash
= this.tx
.hashForSignature(vin
, input
.signScript
, hashType
)
10727 // enforce in order signing of public keys
10728 var signed
= input
.pubKeys
.some(function (pubKey
, i
) {
10729 if (!kpPubKey
.equals(pubKey
)) return false
10730 if (input
.signatures
[i
]) throw new Error('Signature already exists')
10731 if (kpPubKey
.length
!== 33 &&
10732 input
.signType
=== scriptTypes
.P2WPKH
) throw new Error('BIP143 rejects uncompressed public keys in P2WPKH or P2WSH')
10734 var signature
= keyPair
.sign(signatureHash
)
10735 if (Buffer
.isBuffer(signature
)) signature
= ECSignature
.fromRSBuffer(signature
)
10737 input
.signatures
[i
] = signature
.toScriptSignature(hashType
)
10741 if (!signed
) throw new Error('Key pair cannot sign for this input')
10744 function signatureHashType (buffer
) {
10745 return buffer
.readUInt8(buffer
.length
- 1)
10748 TransactionBuilder
.prototype.__canModifyInputs = function () {
10749 return this.inputs
.every(function (input
) {
10751 if (input
.signatures
=== undefined) return true
10753 return input
.signatures
.every(function (signature
) {
10754 if (!signature
) return true
10755 var hashType
= signatureHashType(signature
)
10757 // if SIGHASH_ANYONECANPAY is set, signatures would not
10758 // be invalidated by more inputs
10759 return hashType
& Transaction
.SIGHASH_ANYONECANPAY
10764 TransactionBuilder
.prototype.__canModifyOutputs = function () {
10765 var nInputs
= this.tx
.ins
.length
10766 var nOutputs
= this.tx
.outs
.length
10768 return this.inputs
.every(function (input
) {
10769 if (input
.signatures
=== undefined) return true
10771 return input
.signatures
.every(function (signature
) {
10772 if (!signature
) return true
10773 var hashType
= signatureHashType(signature
)
10775 var hashTypeMod
= hashType
& 0x1f
10776 if (hashTypeMod
=== Transaction
.SIGHASH_NONE
) return true
10777 if (hashTypeMod
=== Transaction
.SIGHASH_SINGLE
) {
10778 // if SIGHASH_SINGLE is set, and nInputs > nOutputs
10779 // some signatures would be invalidated by the addition
10781 return nInputs
<= nOutputs
10787 TransactionBuilder
.prototype.__overMaximumFees = function (bytes
) {
10788 // not all inputs will have .value defined
10789 var incoming
= this.inputs
.reduce(function (a
, x
) { return a
+ (x
.value
>>> 0) }, 0)
10791 // but all outputs do, and if we have any input value
10792 // we can immediately determine if the outputs are too small
10793 var outgoing
= this.tx
.outs
.reduce(function (a
, x
) { return a
+ x
.value
}, 0)
10794 var fee
= incoming
- outgoing
10795 var feeRate
= fee
/ bytes
10797 return feeRate
> this.maximumFeeRate
10800 module
.exports
= TransactionBuilder
10802 },{"./address":53,"./crypto":56,"./ecpair":58,"./ecsignature":59,"./networks":62,"./script":63,"./templates":65,"./transaction":87,"./types":89,"bitcoin-ops":8,"safe-buffer":38,"typeforce":49}],89:[function(require
,module
,exports
){
10803 var typeforce
= require('typeforce')
10805 var UINT31_MAX
= Math
.pow(2, 31) - 1
10806 function UInt31 (value
) {
10807 return typeforce
.UInt32(value
) && value
<= UINT31_MAX
10810 function BIP32Path (value
) {
10811 return typeforce
.String(value
) && value
.match(/^(m\/)?(\d+'?\/)*\d+'?$/)
10813 BIP32Path
.toJSON = function () { return 'BIP32 derivation path' }
10815 var SATOSHI_MAX
= 105 * 1e14
10816 function Satoshi (value
) {
10817 return typeforce
.UInt53(value
) && value
<= SATOSHI_MAX
10820 // external dependent types
10821 var BigInt
= typeforce
.quacksLike('BigInteger')
10822 var ECPoint
= typeforce
.quacksLike('Point')
10824 // exposed, external API
10825 var ECSignature
= typeforce
.compile({ r: BigInt
, s: BigInt
})
10826 var Network
= typeforce
.compile({
10827 messagePrefix: typeforce
.oneOf(typeforce
.Buffer
, typeforce
.String
),
10829 public: typeforce
.UInt32
,
10830 private: typeforce
.UInt32
10832 pubKeyHash: typeforce
.UInt8
,
10833 scriptHash: typeforce
.UInt8
,
10834 wif: typeforce
.UInt8
10837 // extend typeforce types with ours
10840 BIP32Path: BIP32Path
,
10841 Buffer256bit: typeforce
.BufferN(32),
10843 ECSignature: ECSignature
,
10844 Hash160bit: typeforce
.BufferN(20),
10845 Hash256bit: typeforce
.BufferN(32),
10851 for (var typeName
in typeforce
) {
10852 types
[typeName
] = typeforce
[typeName
]
10855 module
.exports
= types
10857 },{"typeforce":49}],90:[function(require
,module
,exports
){
10858 (function (global
){
10861 var objectAssign
= require('object-assign');
10863 // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
10864 // original notice:
10867 * The buffer module from node.js, for the browser.
10869 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
10872 function compare(a
, b
) {
10880 for (var i
= 0, len
= Math
.min(x
, y
); i
< len
; ++i
) {
10881 if (a
[i
] !== b
[i
]) {
10896 function isBuffer(b
) {
10897 if (global
.Buffer
&& typeof global
.Buffer
.isBuffer
=== 'function') {
10898 return global
.Buffer
.isBuffer(b
);
10900 return !!(b
!= null && b
._isBuffer
);
10903 // based on node assert, original notice:
10904 // NB: The URL to the CommonJS spec is kept just for tradition.
10905 // node-assert has evolved a lot since then, both in API and behavior.
10907 // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
10909 // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
10911 // Originally from narwhal.js (http://narwhaljs.org)
10912 // Copyright (c) 2009 Thomas Robinson <280north.com>
10914 // Permission is hereby granted, free of charge, to any person obtaining a copy
10915 // of this software and associated documentation files (the 'Software'), to
10916 // deal in the Software without restriction, including without limitation the
10917 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10918 // sell copies of the Software, and to permit persons to whom the Software is
10919 // furnished to do so, subject to the following conditions:
10921 // The above copyright notice and this permission notice shall be included in
10922 // all copies or substantial portions of the Software.
10924 // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10925 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10926 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10927 // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
10928 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
10929 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10931 var util
= require('util/');
10932 var hasOwn
= Object
.prototype.hasOwnProperty
;
10933 var pSlice
= Array
.prototype.slice
;
10934 var functionsHaveNames
= (function () {
10935 return function foo() {}.name
=== 'foo';
10937 function pToString (obj
) {
10938 return Object
.prototype.toString
.call(obj
);
10940 function isView(arrbuf
) {
10941 if (isBuffer(arrbuf
)) {
10944 if (typeof global
.ArrayBuffer
!== 'function') {
10947 if (typeof ArrayBuffer
.isView
=== 'function') {
10948 return ArrayBuffer
.isView(arrbuf
);
10953 if (arrbuf
instanceof DataView
) {
10956 if (arrbuf
.buffer
&& arrbuf
.buffer
instanceof ArrayBuffer
) {
10961 // 1. The assert module provides functions that throw
10962 // AssertionError's when particular conditions are not met. The
10963 // assert module must conform to the following interface.
10965 var assert
= module
.exports
= ok
;
10967 // 2. The AssertionError is defined in assert.
10968 // new assert.AssertionError({ message: message,
10970 // expected: expected })
10972 var regex
= /\s*function\s+([^\(\s]*)\s*/;
10973 // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
10974 function getName(func
) {
10975 if (!util
.isFunction(func
)) {
10978 if (functionsHaveNames
) {
10981 var str
= func
.toString();
10982 var match
= str
.match(regex
);
10983 return match
&& match
[1];
10985 assert
.AssertionError
= function AssertionError(options
) {
10986 this.name
= 'AssertionError';
10987 this.actual
= options
.actual
;
10988 this.expected
= options
.expected
;
10989 this.operator
= options
.operator
;
10990 if (options
.message
) {
10991 this.message
= options
.message
;
10992 this.generatedMessage
= false;
10994 this.message
= getMessage(this);
10995 this.generatedMessage
= true;
10997 var stackStartFunction
= options
.stackStartFunction
|| fail
;
10998 if (Error
.captureStackTrace
) {
10999 Error
.captureStackTrace(this, stackStartFunction
);
11001 // non v8 browsers so we can have a stacktrace
11002 var err
= new Error();
11004 var out
= err
.stack
;
11006 // try to strip useless frames
11007 var fn_name
= getName(stackStartFunction
);
11008 var idx
= out
.indexOf('\n' + fn_name
);
11010 // once we have located the function frame
11011 // we need to strip out everything before it (and its line)
11012 var next_line
= out
.indexOf('\n', idx
+ 1);
11013 out
= out
.substring(next_line
+ 1);
11021 // assert.AssertionError instanceof Error
11022 util
.inherits(assert
.AssertionError
, Error
);
11024 function truncate(s
, n
) {
11025 if (typeof s
=== 'string') {
11026 return s
.length
< n
? s : s
.slice(0, n
);
11031 function inspect(something
) {
11032 if (functionsHaveNames
|| !util
.isFunction(something
)) {
11033 return util
.inspect(something
);
11035 var rawname
= getName(something
);
11036 var name
= rawname
? ': ' + rawname : '';
11037 return '[Function' + name
+ ']';
11039 function getMessage(self
) {
11040 return truncate(inspect(self
.actual
), 128) + ' ' +
11041 self
.operator
+ ' ' +
11042 truncate(inspect(self
.expected
), 128);
11045 // At present only the three keys mentioned above are used and
11046 // understood by the spec. Implementations or sub modules can pass
11047 // other keys to the AssertionError's constructor - they will be
11050 // 3. All of the following functions must throw an AssertionError
11051 // when a corresponding condition is not met, with a message that
11052 // may be undefined if not provided. All assertion methods provide
11053 // both the actual and expected values to the assertion error for
11054 // display purposes.
11056 function fail(actual
, expected
, message
, operator
, stackStartFunction
) {
11057 throw new assert
.AssertionError({
11060 expected: expected
,
11061 operator: operator
,
11062 stackStartFunction: stackStartFunction
11066 // EXTENSION! allows for well behaved errors defined elsewhere.
11067 assert
.fail
= fail
;
11069 // 4. Pure assertion tests whether a value is truthy, as determined
11071 // assert.ok(guard, message_opt);
11072 // This statement is equivalent to assert.equal(true, !!guard,
11073 // message_opt);. To test strictly for the value true, use
11074 // assert.strictEqual(true, guard, message_opt);.
11076 function ok(value
, message
) {
11077 if (!value
) fail(value
, true, message
, '==', assert
.ok
);
11081 // 5. The equality assertion tests shallow, coercive equality with
11083 // assert.equal(actual, expected, message_opt);
11085 assert
.equal
= function equal(actual
, expected
, message
) {
11086 if (actual
!= expected
) fail(actual
, expected
, message
, '==', assert
.equal
);
11089 // 6. The non-equality assertion tests for whether two objects are not equal
11090 // with != assert.notEqual(actual, expected, message_opt);
11092 assert
.notEqual
= function notEqual(actual
, expected
, message
) {
11093 if (actual
== expected
) {
11094 fail(actual
, expected
, message
, '!=', assert
.notEqual
);
11098 // 7. The equivalence assertion tests a deep equality relation.
11099 // assert.deepEqual(actual, expected, message_opt);
11101 assert
.deepEqual
= function deepEqual(actual
, expected
, message
) {
11102 if (!_deepEqual(actual
, expected
, false)) {
11103 fail(actual
, expected
, message
, 'deepEqual', assert
.deepEqual
);
11107 assert
.deepStrictEqual
= function deepStrictEqual(actual
, expected
, message
) {
11108 if (!_deepEqual(actual
, expected
, true)) {
11109 fail(actual
, expected
, message
, 'deepStrictEqual', assert
.deepStrictEqual
);
11113 function _deepEqual(actual
, expected
, strict
, memos
) {
11114 // 7.1. All identical values are equivalent, as determined by ===.
11115 if (actual
=== expected
) {
11117 } else if (isBuffer(actual
) && isBuffer(expected
)) {
11118 return compare(actual
, expected
) === 0;
11120 // 7.2. If the expected value is a Date object, the actual value is
11121 // equivalent if it is also a Date object that refers to the same time.
11122 } else if (util
.isDate(actual
) && util
.isDate(expected
)) {
11123 return actual
.getTime() === expected
.getTime();
11125 // 7.3 If the expected value is a RegExp object, the actual value is
11126 // equivalent if it is also a RegExp object with the same source and
11127 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
11128 } else if (util
.isRegExp(actual
) && util
.isRegExp(expected
)) {
11129 return actual
.source
=== expected
.source
&&
11130 actual
.global
=== expected
.global
&&
11131 actual
.multiline
=== expected
.multiline
&&
11132 actual
.lastIndex
=== expected
.lastIndex
&&
11133 actual
.ignoreCase
=== expected
.ignoreCase
;
11135 // 7.4. Other pairs that do not both pass typeof value == 'object',
11136 // equivalence is determined by ==.
11137 } else if ((actual
=== null || typeof actual
!== 'object') &&
11138 (expected
=== null || typeof expected
!== 'object')) {
11139 return strict
? actual
=== expected : actual
== expected
;
11141 // If both values are instances of typed arrays, wrap their underlying
11142 // ArrayBuffers in a Buffer each to increase performance
11143 // This optimization requires the arrays to have the same type as checked by
11144 // Object.prototype.toString (aka pToString). Never perform binary
11145 // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
11146 // bit patterns are not identical.
11147 } else if (isView(actual
) && isView(expected
) &&
11148 pToString(actual
) === pToString(expected
) &&
11149 !(actual
instanceof Float32Array
||
11150 actual
instanceof Float64Array
)) {
11151 return compare(new Uint8Array(actual
.buffer
),
11152 new Uint8Array(expected
.buffer
)) === 0;
11154 // 7.5 For all other Object pairs, including Array objects, equivalence is
11155 // determined by having the same number of owned properties (as verified
11156 // with Object.prototype.hasOwnProperty.call), the same set of keys
11157 // (although not necessarily the same order), equivalent values for every
11158 // corresponding key, and an identical 'prototype' property. Note: this
11159 // accounts for both named and indexed properties on Arrays.
11160 } else if (isBuffer(actual
) !== isBuffer(expected
)) {
11163 memos
= memos
|| {actual: [], expected: []};
11165 var actualIndex
= memos
.actual
.indexOf(actual
);
11166 if (actualIndex
!== -1) {
11167 if (actualIndex
=== memos
.expected
.indexOf(expected
)) {
11172 memos
.actual
.push(actual
);
11173 memos
.expected
.push(expected
);
11175 return objEquiv(actual
, expected
, strict
, memos
);
11179 function isArguments(object
) {
11180 return Object
.prototype.toString
.call(object
) == '[object Arguments]';
11183 function objEquiv(a
, b
, strict
, actualVisitedObjects
) {
11184 if (a
=== null || a
=== undefined || b
=== null || b
=== undefined)
11186 // if one is a primitive, the other must be same
11187 if (util
.isPrimitive(a
) || util
.isPrimitive(b
))
11189 if (strict
&& Object
.getPrototypeOf(a
) !== Object
.getPrototypeOf(b
))
11191 var aIsArgs
= isArguments(a
);
11192 var bIsArgs
= isArguments(b
);
11193 if ((aIsArgs
&& !bIsArgs
) || (!aIsArgs
&& bIsArgs
))
11196 a
= pSlice
.call(a
);
11197 b
= pSlice
.call(b
);
11198 return _deepEqual(a
, b
, strict
);
11200 var ka
= objectKeys(a
);
11201 var kb
= objectKeys(b
);
11203 // having the same number of owned properties (keys incorporates
11205 if (ka
.length
!== kb
.length
)
11207 //the same set of keys (although not necessarily the same order),
11210 //~~~cheap key test
11211 for (i
= ka
.length
- 1; i
>= 0; i
--) {
11212 if (ka
[i
] !== kb
[i
])
11215 //equivalent values for every corresponding key, and
11216 //~~~possibly expensive deep test
11217 for (i
= ka
.length
- 1; i
>= 0; i
--) {
11219 if (!_deepEqual(a
[key
], b
[key
], strict
, actualVisitedObjects
))
11225 // 8. The non-equivalence assertion tests for any deep inequality.
11226 // assert.notDeepEqual(actual, expected, message_opt);
11228 assert
.notDeepEqual
= function notDeepEqual(actual
, expected
, message
) {
11229 if (_deepEqual(actual
, expected
, false)) {
11230 fail(actual
, expected
, message
, 'notDeepEqual', assert
.notDeepEqual
);
11234 assert
.notDeepStrictEqual
= notDeepStrictEqual
;
11235 function notDeepStrictEqual(actual
, expected
, message
) {
11236 if (_deepEqual(actual
, expected
, true)) {
11237 fail(actual
, expected
, message
, 'notDeepStrictEqual', notDeepStrictEqual
);
11242 // 9. The strict equality assertion tests strict equality, as determined by ===.
11243 // assert.strictEqual(actual, expected, message_opt);
11245 assert
.strictEqual
= function strictEqual(actual
, expected
, message
) {
11246 if (actual
!== expected
) {
11247 fail(actual
, expected
, message
, '===', assert
.strictEqual
);
11251 // 10. The strict non-equality assertion tests for strict inequality, as
11252 // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
11254 assert
.notStrictEqual
= function notStrictEqual(actual
, expected
, message
) {
11255 if (actual
=== expected
) {
11256 fail(actual
, expected
, message
, '!==', assert
.notStrictEqual
);
11260 function expectedException(actual
, expected
) {
11261 if (!actual
|| !expected
) {
11265 if (Object
.prototype.toString
.call(expected
) == '[object RegExp]') {
11266 return expected
.test(actual
);
11270 if (actual
instanceof expected
) {
11274 // Ignore. The instanceof check doesn't work for arrow functions.
11277 if (Error
.isPrototypeOf(expected
)) {
11281 return expected
.call({}, actual
) === true;
11284 function _tryBlock(block
) {
11294 function _throws(shouldThrow
, block
, expected
, message
) {
11297 if (typeof block
!== 'function') {
11298 throw new TypeError('"block" argument must be a function');
11301 if (typeof expected
=== 'string') {
11302 message
= expected
;
11306 actual
= _tryBlock(block
);
11308 message
= (expected
&& expected
.name
? ' (' + expected
.name
+ ').' : '.') +
11309 (message
? ' ' + message : '.');
11311 if (shouldThrow
&& !actual
) {
11312 fail(actual
, expected
, 'Missing expected exception' + message
);
11315 var userProvidedMessage
= typeof message
=== 'string';
11316 var isUnwantedException
= !shouldThrow
&& util
.isError(actual
);
11317 var isUnexpectedException
= !shouldThrow
&& actual
&& !expected
;
11319 if ((isUnwantedException
&&
11320 userProvidedMessage
&&
11321 expectedException(actual
, expected
)) ||
11322 isUnexpectedException
) {
11323 fail(actual
, expected
, 'Got unwanted exception' + message
);
11326 if ((shouldThrow
&& actual
&& expected
&&
11327 !expectedException(actual
, expected
)) || (!shouldThrow
&& actual
)) {
11332 // 11. Expected to throw an error:
11333 // assert.throws(block, Error_opt, message_opt);
11335 assert
.throws = function(block
, /*optional*/error
, /*optional*/message
) {
11336 _throws(true, block
, error
, message
);
11339 // EXTENSION! This is annoying to write outside this module.
11340 assert
.doesNotThrow = function(block
, /*optional*/error
, /*optional*/message
) {
11341 _throws(false, block
, error
, message
);
11344 assert
.ifError = function(err
) { if (err
) throw err
; };
11346 // Expose a strict only variant of assert
11347 function strict(value
, message
) {
11348 if (!value
) fail(value
, true, message
, '==', strict
);
11350 assert
.strict
= objectAssign(strict
, assert
, {
11351 equal: assert
.strictEqual
,
11352 deepEqual: assert
.deepStrictEqual
,
11353 notEqual: assert
.notStrictEqual
,
11354 notDeepEqual: assert
.notDeepStrictEqual
11356 assert
.strict
.strict
= assert
.strict
;
11358 var objectKeys
= Object
.keys
|| function (obj
) {
11360 for (var key
in obj
) {
11361 if (hasOwn
.call(obj
, key
)) keys
.push(key
);
11366 }).call(this,typeof global
!== "undefined" ? global : typeof self
!== "undefined" ? self : typeof window
!== "undefined" ? window : {})
11367 },{"object-assign":103,"util/":93}],91:[function(require
,module
,exports
){
11368 if (typeof Object
.create
=== 'function') {
11369 // implementation from standard node.js 'util' module
11370 module
.exports
= function inherits(ctor
, superCtor
) {
11371 ctor
.super_
= superCtor
11372 ctor
.prototype = Object
.create(superCtor
.prototype, {
11382 // old school shim for old browsers
11383 module
.exports
= function inherits(ctor
, superCtor
) {
11384 ctor
.super_
= superCtor
11385 var TempCtor = function () {}
11386 TempCtor
.prototype = superCtor
.prototype
11387 ctor
.prototype = new TempCtor()
11388 ctor
.prototype.constructor = ctor
11392 },{}],92:[function(require
,module
,exports
){
11393 module
.exports
= function isBuffer(arg
) {
11394 return arg
&& typeof arg
=== 'object'
11395 && typeof arg
.copy
=== 'function'
11396 && typeof arg
.fill
=== 'function'
11397 && typeof arg
.readUInt8
=== 'function';
11399 },{}],93:[function(require
,module
,exports
){
11400 (function (process
,global
){
11401 // Copyright Joyent, Inc. and other Node contributors.
11403 // Permission is hereby granted, free of charge, to any person obtaining a
11404 // copy of this software and associated documentation files (the
11405 // "Software"), to deal in the Software without restriction, including
11406 // without limitation the rights to use, copy, modify, merge, publish,
11407 // distribute, sublicense, and/or sell copies of the Software, and to permit
11408 // persons to whom the Software is furnished to do so, subject to the
11409 // following conditions:
11411 // The above copyright notice and this permission notice shall be included
11412 // in all copies or substantial portions of the Software.
11414 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11415 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11416 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
11417 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
11418 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
11419 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
11420 // USE OR OTHER DEALINGS IN THE SOFTWARE.
11422 var formatRegExp
= /%[sdj%]/g;
11423 exports
.format = function(f
) {
11424 if (!isString(f
)) {
11426 for (var i
= 0; i
< arguments
.length
; i
++) {
11427 objects
.push(inspect(arguments
[i
]));
11429 return objects
.join(' ');
11433 var args
= arguments
;
11434 var len
= args
.length
;
11435 var str
= String(f
).replace(formatRegExp
, function(x
) {
11436 if (x
=== '%%') return '%';
11437 if (i
>= len
) return x
;
11439 case '%s': return String(args
[i
++]);
11440 case '%d': return Number(args
[i
++]);
11443 return JSON
.stringify(args
[i
++]);
11445 return '[Circular]';
11451 for (var x
= args
[i
]; i
< len
; x
= args
[++i
]) {
11452 if (isNull(x
) || !isObject(x
)) {
11455 str
+= ' ' + inspect(x
);
11462 // Mark that a method should not be used.
11463 // Returns a modified function which warns once by default.
11464 // If --no-deprecation is set, then it is a no-op.
11465 exports
.deprecate = function(fn
, msg
) {
11466 // Allow for deprecating things in the process of starting up.
11467 if (isUndefined(global
.process
)) {
11468 return function() {
11469 return exports
.deprecate(fn
, msg
).apply(this, arguments
);
11473 if (process
.noDeprecation
=== true) {
11477 var warned
= false;
11478 function deprecated() {
11480 if (process
.throwDeprecation
) {
11481 throw new Error(msg
);
11482 } else if (process
.traceDeprecation
) {
11483 console
.trace(msg
);
11485 console
.error(msg
);
11489 return fn
.apply(this, arguments
);
11498 exports
.debuglog = function(set) {
11499 if (isUndefined(debugEnviron
))
11500 debugEnviron
= process
.env
.NODE_DEBUG
|| '';
11501 set = set.toUpperCase();
11502 if (!debugs
[set]) {
11503 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron
)) {
11504 var pid
= process
.pid
;
11505 debugs
[set] = function() {
11506 var msg
= exports
.format
.apply(exports
, arguments
);
11507 console
.error('%s %d: %s', set, pid
, msg
);
11510 debugs
[set] = function() {};
11513 return debugs
[set];
11518 * Echos the value of a value. Trys to print the value out
11519 * in the best way possible given the different types.
11521 * @param {Object} obj The object to print out.
11522 * @param {Object} opts Optional options object that alters the output.
11524 /* legacy: obj, showHidden, depth, colors*/
11525 function inspect(obj
, opts
) {
11529 stylize: stylizeNoColor
11532 if (arguments
.length
>= 3) ctx
.depth
= arguments
[2];
11533 if (arguments
.length
>= 4) ctx
.colors
= arguments
[3];
11534 if (isBoolean(opts
)) {
11536 ctx
.showHidden
= opts
;
11538 // got an "options" object
11539 exports
._extend(ctx
, opts
);
11541 // set default options
11542 if (isUndefined(ctx
.showHidden
)) ctx
.showHidden
= false;
11543 if (isUndefined(ctx
.depth
)) ctx
.depth
= 2;
11544 if (isUndefined(ctx
.colors
)) ctx
.colors
= false;
11545 if (isUndefined(ctx
.customInspect
)) ctx
.customInspect
= true;
11546 if (ctx
.colors
) ctx
.stylize
= stylizeWithColor
;
11547 return formatValue(ctx
, obj
, ctx
.depth
);
11549 exports
.inspect
= inspect
;
11552 // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
11555 'italic' : [3, 23],
11556 'underline' : [4, 24],
11557 'inverse' : [7, 27],
11558 'white' : [37, 39],
11560 'black' : [30, 39],
11563 'green' : [32, 39],
11564 'magenta' : [35, 39],
11566 'yellow' : [33, 39]
11569 // Don't use 'blue' not visible on cmd.exe
11572 'number': 'yellow',
11573 'boolean': 'yellow',
11574 'undefined': 'grey',
11578 // "name": intentionally not styling
11583 function stylizeWithColor(str
, styleType
) {
11584 var style
= inspect
.styles
[styleType
];
11587 return '\u001b[' + inspect
.colors
[style
][0] + 'm' + str
+
11588 '\u001b[' + inspect
.colors
[style
][1] + 'm';
11595 function stylizeNoColor(str
, styleType
) {
11600 function arrayToHash(array
) {
11603 array
.forEach(function(val
, idx
) {
11611 function formatValue(ctx
, value
, recurseTimes
) {
11612 // Provide a hook for user-specified inspect functions.
11613 // Check that value is an object with an inspect function on it
11614 if (ctx
.customInspect
&&
11616 isFunction(value
.inspect
) &&
11617 // Filter out the util module, it's inspect function is special
11618 value
.inspect
!== exports
.inspect
&&
11619 // Also filter out any prototype objects using the circular check.
11620 !(value
.constructor && value
.constructor.prototype === value
)) {
11621 var ret
= value
.inspect(recurseTimes
, ctx
);
11622 if (!isString(ret
)) {
11623 ret
= formatValue(ctx
, ret
, recurseTimes
);
11628 // Primitive types cannot have properties
11629 var primitive
= formatPrimitive(ctx
, value
);
11634 // Look up the keys of the object.
11635 var keys
= Object
.keys(value
);
11636 var visibleKeys
= arrayToHash(keys
);
11638 if (ctx
.showHidden
) {
11639 keys
= Object
.getOwnPropertyNames(value
);
11642 // IE doesn't make error fields non-enumerable
11643 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
11645 && (keys
.indexOf('message') >= 0 || keys
.indexOf('description') >= 0)) {
11646 return formatError(value
);
11649 // Some type of object without properties can be shortcutted.
11650 if (keys
.length
=== 0) {
11651 if (isFunction(value
)) {
11652 var name
= value
.name
? ': ' + value
.name : '';
11653 return ctx
.stylize('[Function' + name
+ ']', 'special');
11655 if (isRegExp(value
)) {
11656 return ctx
.stylize(RegExp
.prototype.toString
.call(value
), 'regexp');
11658 if (isDate(value
)) {
11659 return ctx
.stylize(Date
.prototype.toString
.call(value
), 'date');
11661 if (isError(value
)) {
11662 return formatError(value
);
11666 var base
= '', array
= false, braces
= ['{', '}'];
11668 // Make Array say that they are Array
11669 if (isArray(value
)) {
11671 braces
= ['[', ']'];
11674 // Make functions say that they are functions
11675 if (isFunction(value
)) {
11676 var n
= value
.name
? ': ' + value
.name : '';
11677 base
= ' [Function' + n
+ ']';
11680 // Make RegExps say that they are RegExps
11681 if (isRegExp(value
)) {
11682 base
= ' ' + RegExp
.prototype.toString
.call(value
);
11685 // Make dates with properties first say the date
11686 if (isDate(value
)) {
11687 base
= ' ' + Date
.prototype.toUTCString
.call(value
);
11690 // Make error with message first say the error
11691 if (isError(value
)) {
11692 base
= ' ' + formatError(value
);
11695 if (keys
.length
=== 0 && (!array
|| value
.length
== 0)) {
11696 return braces
[0] + base
+ braces
[1];
11699 if (recurseTimes
< 0) {
11700 if (isRegExp(value
)) {
11701 return ctx
.stylize(RegExp
.prototype.toString
.call(value
), 'regexp');
11703 return ctx
.stylize('[Object]', 'special');
11707 ctx
.seen
.push(value
);
11711 output
= formatArray(ctx
, value
, recurseTimes
, visibleKeys
, keys
);
11713 output
= keys
.map(function(key
) {
11714 return formatProperty(ctx
, value
, recurseTimes
, visibleKeys
, key
, array
);
11720 return reduceToSingleString(output
, base
, braces
);
11724 function formatPrimitive(ctx
, value
) {
11725 if (isUndefined(value
))
11726 return ctx
.stylize('undefined', 'undefined');
11727 if (isString(value
)) {
11728 var simple
= '\'' + JSON
.stringify(value
).replace(/^"|"$/g, '')
11729 .replace(/'/g, "\\'")
11730 .replace(/\\"/g
, '"') + '\'';
11731 return ctx
.stylize(simple
, 'string');
11733 if (isNumber(value
))
11734 return ctx
.stylize('' + value
, 'number');
11735 if (isBoolean(value
))
11736 return ctx
.stylize('' + value
, 'boolean');
11737 // For some reason typeof null is "object", so special case here.
11739 return ctx
.stylize('null', 'null');
11743 function formatError(value
) {
11744 return '[' + Error
.prototype.toString
.call(value
) + ']';
11748 function formatArray(ctx
, value
, recurseTimes
, visibleKeys
, keys
) {
11750 for (var i
= 0, l
= value
.length
; i
< l
; ++i
) {
11751 if (hasOwnProperty(value
, String(i
))) {
11752 output
.push(formatProperty(ctx
, value
, recurseTimes
, visibleKeys
,
11758 keys
.forEach(function(key
) {
11759 if (!key
.match(/^\d+$/)) {
11760 output
.push(formatProperty(ctx
, value
, recurseTimes
, visibleKeys
,
11768 function formatProperty(ctx
, value
, recurseTimes
, visibleKeys
, key
, array
) {
11769 var name
, str
, desc
;
11770 desc
= Object
.getOwnPropertyDescriptor(value
, key
) || { value: value
[key
] };
11773 str
= ctx
.stylize('[Getter/Setter]', 'special');
11775 str
= ctx
.stylize('[Getter]', 'special');
11779 str
= ctx
.stylize('[Setter]', 'special');
11782 if (!hasOwnProperty(visibleKeys
, key
)) {
11783 name
= '[' + key
+ ']';
11786 if (ctx
.seen
.indexOf(desc
.value
) < 0) {
11787 if (isNull(recurseTimes
)) {
11788 str
= formatValue(ctx
, desc
.value
, null);
11790 str
= formatValue(ctx
, desc
.value
, recurseTimes
- 1);
11792 if (str
.indexOf('\n') > -1) {
11794 str
= str
.split('\n').map(function(line
) {
11796 }).join('\n').substr(2);
11798 str
= '\n' + str
.split('\n').map(function(line
) {
11804 str
= ctx
.stylize('[Circular]', 'special');
11807 if (isUndefined(name
)) {
11808 if (array
&& key
.match(/^\d+$/)) {
11811 name
= JSON
.stringify('' + key
);
11812 if (name
.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
11813 name
= name
.substr(1, name
.length
- 2);
11814 name
= ctx
.stylize(name
, 'name');
11816 name
= name
.replace(/'/g, "\\'")
11817 .replace(/\\"/g
, '"')
11818 .replace(/(^"|"$)/g, "'");
11819 name
= ctx
.stylize(name
, 'string');
11823 return name
+ ': ' + str
;
11827 function reduceToSingleString(output
, base
, braces
) {
11828 var numLinesEst
= 0;
11829 var length
= output
.reduce(function(prev
, cur
) {
11831 if (cur
.indexOf('\n') >= 0) numLinesEst
++;
11832 return prev
+ cur
.replace(/\u001b\[\d\d?m/g, '').length
+ 1;
11837 (base
=== '' ? '' : base
+ '\n ') +
11839 output
.join(',\n ') +
11844 return braces
[0] + base
+ ' ' + output
.join(', ') + ' ' + braces
[1];
11848 // NOTE: These type checking functions intentionally don't use `instanceof`
11849 // because it is fragile and can be easily faked with `Object.create()`.
11850 function isArray(ar
) {
11851 return Array
.isArray(ar
);
11853 exports
.isArray
= isArray
;
11855 function isBoolean(arg
) {
11856 return typeof arg
=== 'boolean';
11858 exports
.isBoolean
= isBoolean
;
11860 function isNull(arg
) {
11861 return arg
=== null;
11863 exports
.isNull
= isNull
;
11865 function isNullOrUndefined(arg
) {
11866 return arg
== null;
11868 exports
.isNullOrUndefined
= isNullOrUndefined
;
11870 function isNumber(arg
) {
11871 return typeof arg
=== 'number';
11873 exports
.isNumber
= isNumber
;
11875 function isString(arg
) {
11876 return typeof arg
=== 'string';
11878 exports
.isString
= isString
;
11880 function isSymbol(arg
) {
11881 return typeof arg
=== 'symbol';
11883 exports
.isSymbol
= isSymbol
;
11885 function isUndefined(arg
) {
11886 return arg
=== void 0;
11888 exports
.isUndefined
= isUndefined
;
11890 function isRegExp(re
) {
11891 return isObject(re
) && objectToString(re
) === '[object RegExp]';
11893 exports
.isRegExp
= isRegExp
;
11895 function isObject(arg
) {
11896 return typeof arg
=== 'object' && arg
!== null;
11898 exports
.isObject
= isObject
;
11900 function isDate(d
) {
11901 return isObject(d
) && objectToString(d
) === '[object Date]';
11903 exports
.isDate
= isDate
;
11905 function isError(e
) {
11906 return isObject(e
) &&
11907 (objectToString(e
) === '[object Error]' || e
instanceof Error
);
11909 exports
.isError
= isError
;
11911 function isFunction(arg
) {
11912 return typeof arg
=== 'function';
11914 exports
.isFunction
= isFunction
;
11916 function isPrimitive(arg
) {
11917 return arg
=== null ||
11918 typeof arg
=== 'boolean' ||
11919 typeof arg
=== 'number' ||
11920 typeof arg
=== 'string' ||
11921 typeof arg
=== 'symbol' || // ES6 symbol
11922 typeof arg
=== 'undefined';
11924 exports
.isPrimitive
= isPrimitive
;
11926 exports
.isBuffer
= require('./support/isBuffer');
11928 function objectToString(o
) {
11929 return Object
.prototype.toString
.call(o
);
11934 return n
< 10 ? '0' + n
.toString(10) : n
.toString(10);
11938 var months
= ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
11939 'Oct', 'Nov', 'Dec'];
11942 function timestamp() {
11943 var d
= new Date();
11944 var time
= [pad(d
.getHours()),
11945 pad(d
.getMinutes()),
11946 pad(d
.getSeconds())].join(':');
11947 return [d
.getDate(), months
[d
.getMonth()], time
].join(' ');
11951 // log is just a thin wrapper to console.log that prepends a timestamp
11952 exports
.log = function() {
11953 console
.log('%s - %s', timestamp(), exports
.format
.apply(exports
, arguments
));
11958 * Inherit the prototype methods from one constructor into another.
11960 * The Function.prototype.inherits from lang.js rewritten as a standalone
11961 * function (not on Function.prototype). NOTE: If this file is to be loaded
11962 * during bootstrapping this function needs to be rewritten using some native
11963 * functions as prototype setup using normal JavaScript does not work as
11964 * expected during bootstrapping (see mirror.js in r114903).
11966 * @param {function} ctor Constructor function which needs to inherit the
11968 * @param {function} superCtor Constructor function to inherit prototype from.
11970 exports
.inherits
= require('inherits');
11972 exports
._extend = function(origin
, add
) {
11973 // Don't do anything if add isn't an object
11974 if (!add
|| !isObject(add
)) return origin
;
11976 var keys
= Object
.keys(add
);
11977 var i
= keys
.length
;
11979 origin
[keys
[i
]] = add
[keys
[i
]];
11984 function hasOwnProperty(obj
, prop
) {
11985 return Object
.prototype.hasOwnProperty
.call(obj
, prop
);
11988 }).call(this,require('_process'),typeof global
!== "undefined" ? global : typeof self
!== "undefined" ? self : typeof window
!== "undefined" ? window : {})
11989 },{"./support/isBuffer":92,"_process":105,"inherits":91}],94:[function(require
,module
,exports
){
11992 exports
.byteLength
= byteLength
11993 exports
.toByteArray
= toByteArray
11994 exports
.fromByteArray
= fromByteArray
11998 var Arr
= typeof Uint8Array
!== 'undefined' ? Uint8Array : Array
12000 var code
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
12001 for (var i
= 0, len
= code
.length
; i
< len
; ++i
) {
12002 lookup
[i
] = code
[i
]
12003 revLookup
[code
.charCodeAt(i
)] = i
12006 // Support decoding URL-safe base64 strings, as Node.js does.
12007 // See: https://en.wikipedia.org/wiki/Base64#URL_applications
12008 revLookup
['-'.charCodeAt(0)] = 62
12009 revLookup
['_'.charCodeAt(0)] = 63
12011 function getLens (b64
) {
12012 var len
= b64
.length
12015 throw new Error('Invalid string. Length must be a multiple of 4')
12018 // Trim off extra bytes after placeholder bytes are found
12019 // See: https://github.com/beatgammit/base64-js/issues/42
12020 var validLen
= b64
.indexOf('=')
12021 if (validLen
=== -1) validLen
= len
12023 var placeHoldersLen
= validLen
=== len
12025 : 4 - (validLen
% 4)
12027 return [validLen
, placeHoldersLen
]
12030 // base64 is 4/3 + up to two characters of the original data
12031 function byteLength (b64
) {
12032 var lens
= getLens(b64
)
12033 var validLen
= lens
[0]
12034 var placeHoldersLen
= lens
[1]
12035 return ((validLen
+ placeHoldersLen
) * 3 / 4) - placeHoldersLen
12038 function _byteLength (b64
, validLen
, placeHoldersLen
) {
12039 return ((validLen
+ placeHoldersLen
) * 3 / 4) - placeHoldersLen
12042 function toByteArray (b64
) {
12044 var lens
= getLens(b64
)
12045 var validLen
= lens
[0]
12046 var placeHoldersLen
= lens
[1]
12048 var arr
= new Arr(_byteLength(b64
, validLen
, placeHoldersLen
))
12052 // if there are placeholders, only get up to the last complete 4 chars
12053 var len
= placeHoldersLen
> 0
12058 for (i
= 0; i
< len
; i
+= 4) {
12060 (revLookup
[b64
.charCodeAt(i
)] << 18) |
12061 (revLookup
[b64
.charCodeAt(i
+ 1)] << 12) |
12062 (revLookup
[b64
.charCodeAt(i
+ 2)] << 6) |
12063 revLookup
[b64
.charCodeAt(i
+ 3)]
12064 arr
[curByte
++] = (tmp
>> 16) & 0xFF
12065 arr
[curByte
++] = (tmp
>> 8) & 0xFF
12066 arr
[curByte
++] = tmp
& 0xFF
12069 if (placeHoldersLen
=== 2) {
12071 (revLookup
[b64
.charCodeAt(i
)] << 2) |
12072 (revLookup
[b64
.charCodeAt(i
+ 1)] >> 4)
12073 arr
[curByte
++] = tmp
& 0xFF
12076 if (placeHoldersLen
=== 1) {
12078 (revLookup
[b64
.charCodeAt(i
)] << 10) |
12079 (revLookup
[b64
.charCodeAt(i
+ 1)] << 4) |
12080 (revLookup
[b64
.charCodeAt(i
+ 2)] >> 2)
12081 arr
[curByte
++] = (tmp
>> 8) & 0xFF
12082 arr
[curByte
++] = tmp
& 0xFF
12088 function tripletToBase64 (num
) {
12089 return lookup
[num
>> 18 & 0x3F] +
12090 lookup
[num
>> 12 & 0x3F] +
12091 lookup
[num
>> 6 & 0x3F] +
12095 function encodeChunk (uint8
, start
, end
) {
12098 for (var i
= start
; i
< end
; i
+= 3) {
12100 ((uint8
[i
] << 16) & 0xFF0000) +
12101 ((uint8
[i
+ 1] << 8) & 0xFF00) +
12102 (uint8
[i
+ 2] & 0xFF)
12103 output
.push(tripletToBase64(tmp
))
12105 return output
.join('')
12108 function fromByteArray (uint8
) {
12110 var len
= uint8
.length
12111 var extraBytes
= len
% 3 // if we have 1 byte left, pad 2 bytes
12113 var maxChunkLength
= 16383 // must be multiple of 3
12115 // go through the array every three bytes, we'll deal with trailing stuff later
12116 for (var i
= 0, len2
= len
- extraBytes
; i
< len2
; i
+= maxChunkLength
) {
12117 parts
.push(encodeChunk(
12118 uint8
, i
, (i
+ maxChunkLength
) > len2
? len2 : (i
+ maxChunkLength
)
12122 // pad the end with zeros, but make sure to not forget the extra bytes
12123 if (extraBytes
=== 1) {
12124 tmp
= uint8
[len
- 1]
12127 lookup
[(tmp
<< 4) & 0x3F] +
12130 } else if (extraBytes
=== 2) {
12131 tmp
= (uint8
[len
- 2] << 8) + uint8
[len
- 1]
12133 lookup
[tmp
>> 10] +
12134 lookup
[(tmp
>> 4) & 0x3F] +
12135 lookup
[(tmp
<< 2) & 0x3F] +
12140 return parts
.join('')
12143 },{}],95:[function(require
,module
,exports
){
12145 },{}],96:[function(require
,module
,exports
){
12146 (function (Buffer
){
12148 * The buffer module from node.js, for the browser.
12150 * @author Feross Aboukhadijeh <https://feross.org>
12153 /* eslint-disable no-proto */
12157 var base64
= require('base64-js')
12158 var ieee754
= require('ieee754')
12159 var customInspectSymbol
=
12160 (typeof Symbol
=== 'function' && typeof Symbol
.for === 'function')
12161 ? Symbol
.for('nodejs.util.inspect.custom')
12164 exports
.Buffer
= Buffer
12165 exports
.SlowBuffer
= SlowBuffer
12166 exports
.INSPECT_MAX_BYTES
= 50
12168 var K_MAX_LENGTH
= 0x7fffffff
12169 exports
.kMaxLength
= K_MAX_LENGTH
12172 * If `Buffer.TYPED_ARRAY_SUPPORT`:
12173 * === true Use Uint8Array implementation (fastest)
12174 * === false Print warning and recommend using `buffer` v4.x which has an Object
12175 * implementation (most compatible, even IE6)
12177 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
12178 * Opera 11.6+, iOS 4.2+.
12180 * We report that the browser does not support typed arrays if the are not subclassable
12181 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
12182 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
12183 * for __proto__ and has a buggy typed array implementation.
12185 Buffer
.TYPED_ARRAY_SUPPORT
= typedArraySupport()
12187 if (!Buffer
.TYPED_ARRAY_SUPPORT
&& typeof console
!== 'undefined' &&
12188 typeof console
.error
=== 'function') {
12190 'This browser lacks typed array (Uint8Array) support which is required by ' +
12191 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
12195 function typedArraySupport () {
12196 // Can typed array instances can be augmented?
12198 var arr
= new Uint8Array(1)
12199 var proto
= { foo: function () { return 42 } }
12200 Object
.setPrototypeOf(proto
, Uint8Array
.prototype)
12201 Object
.setPrototypeOf(arr
, proto
)
12202 return arr
.foo() === 42
12208 Object
.defineProperty(Buffer
.prototype, 'parent', {
12211 if (!Buffer
.isBuffer(this)) return undefined
12216 Object
.defineProperty(Buffer
.prototype, 'offset', {
12219 if (!Buffer
.isBuffer(this)) return undefined
12220 return this.byteOffset
12224 function createBuffer (length
) {
12225 if (length
> K_MAX_LENGTH
) {
12226 throw new RangeError('The value "' + length
+ '" is invalid for option "size"')
12228 // Return an augmented `Uint8Array` instance
12229 var buf
= new Uint8Array(length
)
12230 Object
.setPrototypeOf(buf
, Buffer
.prototype)
12235 * The Buffer constructor returns instances of `Uint8Array` that have their
12236 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
12237 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
12238 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
12239 * returns a single octet.
12241 * The `Uint8Array` prototype remains unmodified.
12244 function Buffer (arg
, encodingOrOffset
, length
) {
12246 if (typeof arg
=== 'number') {
12247 if (typeof encodingOrOffset
=== 'string') {
12248 throw new TypeError(
12249 'The "string" argument must be of type string. Received type number'
12252 return allocUnsafe(arg
)
12254 return from(arg
, encodingOrOffset
, length
)
12257 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
12258 if (typeof Symbol
!== 'undefined' && Symbol
.species
!= null &&
12259 Buffer
[Symbol
.species
] === Buffer
) {
12260 Object
.defineProperty(Buffer
, Symbol
.species
, {
12262 configurable: true,
12268 Buffer
.poolSize
= 8192 // not used by this implementation
12270 function from (value
, encodingOrOffset
, length
) {
12271 if (typeof value
=== 'string') {
12272 return fromString(value
, encodingOrOffset
)
12275 if (ArrayBuffer
.isView(value
)) {
12276 return fromArrayLike(value
)
12279 if (value
== null) {
12280 throw new TypeError(
12281 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
12282 'or Array-like Object. Received type ' + (typeof value
)
12286 if (isInstance(value
, ArrayBuffer
) ||
12287 (value
&& isInstance(value
.buffer
, ArrayBuffer
))) {
12288 return fromArrayBuffer(value
, encodingOrOffset
, length
)
12291 if (typeof value
=== 'number') {
12292 throw new TypeError(
12293 'The "value" argument must not be of type number. Received type number'
12297 var valueOf
= value
.valueOf
&& value
.valueOf()
12298 if (valueOf
!= null && valueOf
!== value
) {
12299 return Buffer
.from(valueOf
, encodingOrOffset
, length
)
12302 var b
= fromObject(value
)
12305 if (typeof Symbol
!== 'undefined' && Symbol
.toPrimitive
!= null &&
12306 typeof value
[Symbol
.toPrimitive
] === 'function') {
12307 return Buffer
.from(
12308 value
[Symbol
.toPrimitive
]('string'), encodingOrOffset
, length
12312 throw new TypeError(
12313 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
12314 'or Array-like Object. Received type ' + (typeof value
)
12319 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
12320 * if value is a number.
12321 * Buffer.from(str[, encoding])
12322 * Buffer.from(array)
12323 * Buffer.from(buffer)
12324 * Buffer.from(arrayBuffer[, byteOffset[, length]])
12326 Buffer
.from = function (value
, encodingOrOffset
, length
) {
12327 return from(value
, encodingOrOffset
, length
)
12330 // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
12331 // https://github.com/feross/buffer/pull/148
12332 Object
.setPrototypeOf(Buffer
.prototype, Uint8Array
.prototype)
12333 Object
.setPrototypeOf(Buffer
, Uint8Array
)
12335 function assertSize (size
) {
12336 if (typeof size
!== 'number') {
12337 throw new TypeError('"size" argument must be of type number')
12338 } else if (size
< 0) {
12339 throw new RangeError('The value "' + size
+ '" is invalid for option "size"')
12343 function alloc (size
, fill
, encoding
) {
12346 return createBuffer(size
)
12348 if (fill
!== undefined) {
12349 // Only pay attention to encoding if it's a string. This
12350 // prevents accidentally sending in a number that would
12351 // be interpretted as a start offset.
12352 return typeof encoding
=== 'string'
12353 ? createBuffer(size
).fill(fill
, encoding
)
12354 : createBuffer(size
).fill(fill
)
12356 return createBuffer(size
)
12360 * Creates a new filled Buffer instance.
12361 * alloc(size[, fill[, encoding]])
12363 Buffer
.alloc = function (size
, fill
, encoding
) {
12364 return alloc(size
, fill
, encoding
)
12367 function allocUnsafe (size
) {
12369 return createBuffer(size
< 0 ? 0 : checked(size
) | 0)
12373 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
12375 Buffer
.allocUnsafe = function (size
) {
12376 return allocUnsafe(size
)
12379 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
12381 Buffer
.allocUnsafeSlow = function (size
) {
12382 return allocUnsafe(size
)
12385 function fromString (string
, encoding
) {
12386 if (typeof encoding
!== 'string' || encoding
=== '') {
12390 if (!Buffer
.isEncoding(encoding
)) {
12391 throw new TypeError('Unknown encoding: ' + encoding
)
12394 var length
= byteLength(string
, encoding
) | 0
12395 var buf
= createBuffer(length
)
12397 var actual
= buf
.write(string
, encoding
)
12399 if (actual
!== length
) {
12400 // Writing a hex string, for example, that contains invalid characters will
12401 // cause everything after the first invalid character to be ignored. (e.g.
12402 // 'abxxcd' will be treated as 'ab')
12403 buf
= buf
.slice(0, actual
)
12409 function fromArrayLike (array
) {
12410 var length
= array
.length
< 0 ? 0 : checked(array
.length
) | 0
12411 var buf
= createBuffer(length
)
12412 for (var i
= 0; i
< length
; i
+= 1) {
12413 buf
[i
] = array
[i
] & 255
12418 function fromArrayBuffer (array
, byteOffset
, length
) {
12419 if (byteOffset
< 0 || array
.byteLength
< byteOffset
) {
12420 throw new RangeError('"offset" is outside of buffer bounds')
12423 if (array
.byteLength
< byteOffset
+ (length
|| 0)) {
12424 throw new RangeError('"length" is outside of buffer bounds')
12428 if (byteOffset
=== undefined && length
=== undefined) {
12429 buf
= new Uint8Array(array
)
12430 } else if (length
=== undefined) {
12431 buf
= new Uint8Array(array
, byteOffset
)
12433 buf
= new Uint8Array(array
, byteOffset
, length
)
12436 // Return an augmented `Uint8Array` instance
12437 Object
.setPrototypeOf(buf
, Buffer
.prototype)
12442 function fromObject (obj
) {
12443 if (Buffer
.isBuffer(obj
)) {
12444 var len
= checked(obj
.length
) | 0
12445 var buf
= createBuffer(len
)
12447 if (buf
.length
=== 0) {
12451 obj
.copy(buf
, 0, 0, len
)
12455 if (obj
.length
!== undefined) {
12456 if (typeof obj
.length
!== 'number' || numberIsNaN(obj
.length
)) {
12457 return createBuffer(0)
12459 return fromArrayLike(obj
)
12462 if (obj
.type
=== 'Buffer' && Array
.isArray(obj
.data
)) {
12463 return fromArrayLike(obj
.data
)
12467 function checked (length
) {
12468 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
12469 // length is NaN (which is otherwise coerced to zero.)
12470 if (length
>= K_MAX_LENGTH
) {
12471 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
12472 'size: 0x' + K_MAX_LENGTH
.toString(16) + ' bytes')
12477 function SlowBuffer (length
) {
12478 if (+length
!= length
) { // eslint-disable-line eqeqeq
12481 return Buffer
.alloc(+length
)
12484 Buffer
.isBuffer
= function isBuffer (b
) {
12485 return b
!= null && b
._isBuffer
=== true &&
12486 b
!== Buffer
.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
12489 Buffer
.compare
= function compare (a
, b
) {
12490 if (isInstance(a
, Uint8Array
)) a
= Buffer
.from(a
, a
.offset
, a
.byteLength
)
12491 if (isInstance(b
, Uint8Array
)) b
= Buffer
.from(b
, b
.offset
, b
.byteLength
)
12492 if (!Buffer
.isBuffer(a
) || !Buffer
.isBuffer(b
)) {
12493 throw new TypeError(
12494 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
12498 if (a
=== b
) return 0
12503 for (var i
= 0, len
= Math
.min(x
, y
); i
< len
; ++i
) {
12504 if (a
[i
] !== b
[i
]) {
12511 if (x
< y
) return -1
12512 if (y
< x
) return 1
12516 Buffer
.isEncoding
= function isEncoding (encoding
) {
12517 switch (String(encoding
).toLowerCase()) {
12535 Buffer
.concat
= function concat (list
, length
) {
12536 if (!Array
.isArray(list
)) {
12537 throw new TypeError('"list" argument must be an Array of Buffers')
12540 if (list
.length
=== 0) {
12541 return Buffer
.alloc(0)
12545 if (length
=== undefined) {
12547 for (i
= 0; i
< list
.length
; ++i
) {
12548 length
+= list
[i
].length
12552 var buffer
= Buffer
.allocUnsafe(length
)
12554 for (i
= 0; i
< list
.length
; ++i
) {
12556 if (isInstance(buf
, Uint8Array
)) {
12557 buf
= Buffer
.from(buf
)
12559 if (!Buffer
.isBuffer(buf
)) {
12560 throw new TypeError('"list" argument must be an Array of Buffers')
12562 buf
.copy(buffer
, pos
)
12568 function byteLength (string
, encoding
) {
12569 if (Buffer
.isBuffer(string
)) {
12570 return string
.length
12572 if (ArrayBuffer
.isView(string
) || isInstance(string
, ArrayBuffer
)) {
12573 return string
.byteLength
12575 if (typeof string
!== 'string') {
12576 throw new TypeError(
12577 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
12578 'Received type ' + typeof string
12582 var len
= string
.length
12583 var mustMatch
= (arguments
.length
> 2 && arguments
[2] === true)
12584 if (!mustMatch
&& len
=== 0) return 0
12586 // Use a for loop to avoid recursion
12587 var loweredCase
= false
12589 switch (encoding
) {
12596 return utf8ToBytes(string
).length
12605 return base64ToBytes(string
).length
12608 return mustMatch
? -1 : utf8ToBytes(string
).length
// assume utf8
12610 encoding
= ('' + encoding
).toLowerCase()
12615 Buffer
.byteLength
= byteLength
12617 function slowToString (encoding
, start
, end
) {
12618 var loweredCase
= false
12620 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
12621 // property of a typed array.
12623 // This behaves neither like String nor Uint8Array in that we set start/end
12624 // to their upper/lower bounds if the value passed is out of range.
12625 // undefined is handled specially as per ECMA-262 6th Edition,
12626 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
12627 if (start
=== undefined || start
< 0) {
12630 // Return early if start > this.length. Done here to prevent potential uint32
12631 // coercion fail below.
12632 if (start
> this.length
) {
12636 if (end
=== undefined || end
> this.length
) {
12644 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
12648 if (end
<= start
) {
12652 if (!encoding
) encoding
= 'utf8'
12655 switch (encoding
) {
12657 return hexSlice(this, start
, end
)
12661 return utf8Slice(this, start
, end
)
12664 return asciiSlice(this, start
, end
)
12668 return latin1Slice(this, start
, end
)
12671 return base64Slice(this, start
, end
)
12677 return utf16leSlice(this, start
, end
)
12680 if (loweredCase
) throw new TypeError('Unknown encoding: ' + encoding
)
12681 encoding
= (encoding
+ '').toLowerCase()
12687 // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
12688 // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
12689 // reliably in a browserify context because there could be multiple different
12690 // copies of the 'buffer' package in use. This method works even for Buffer
12691 // instances that were created from another copy of the `buffer` package.
12692 // See: https://github.com/feross/buffer/issues/154
12693 Buffer
.prototype._isBuffer
= true
12695 function swap (b
, n
, m
) {
12701 Buffer
.prototype.swap16
= function swap16 () {
12702 var len
= this.length
12703 if (len
% 2 !== 0) {
12704 throw new RangeError('Buffer size must be a multiple of 16-bits')
12706 for (var i
= 0; i
< len
; i
+= 2) {
12707 swap(this, i
, i
+ 1)
12712 Buffer
.prototype.swap32
= function swap32 () {
12713 var len
= this.length
12714 if (len
% 4 !== 0) {
12715 throw new RangeError('Buffer size must be a multiple of 32-bits')
12717 for (var i
= 0; i
< len
; i
+= 4) {
12718 swap(this, i
, i
+ 3)
12719 swap(this, i
+ 1, i
+ 2)
12724 Buffer
.prototype.swap64
= function swap64 () {
12725 var len
= this.length
12726 if (len
% 8 !== 0) {
12727 throw new RangeError('Buffer size must be a multiple of 64-bits')
12729 for (var i
= 0; i
< len
; i
+= 8) {
12730 swap(this, i
, i
+ 7)
12731 swap(this, i
+ 1, i
+ 6)
12732 swap(this, i
+ 2, i
+ 5)
12733 swap(this, i
+ 3, i
+ 4)
12738 Buffer
.prototype.toString
= function toString () {
12739 var length
= this.length
12740 if (length
=== 0) return ''
12741 if (arguments
.length
=== 0) return utf8Slice(this, 0, length
)
12742 return slowToString
.apply(this, arguments
)
12745 Buffer
.prototype.toLocaleString
= Buffer
.prototype.toString
12747 Buffer
.prototype.equals
= function equals (b
) {
12748 if (!Buffer
.isBuffer(b
)) throw new TypeError('Argument must be a Buffer')
12749 if (this === b
) return true
12750 return Buffer
.compare(this, b
) === 0
12753 Buffer
.prototype.inspect
= function inspect () {
12755 var max
= exports
.INSPECT_MAX_BYTES
12756 str
= this.toString('hex', 0, max
).replace(/(.{2})/g, '$1 ').trim()
12757 if (this.length
> max
) str
+= ' ... '
12758 return '<Buffer ' + str
+ '>'
12760 if (customInspectSymbol
) {
12761 Buffer
.prototype[customInspectSymbol
] = Buffer
.prototype.inspect
12764 Buffer
.prototype.compare
= function compare (target
, start
, end
, thisStart
, thisEnd
) {
12765 if (isInstance(target
, Uint8Array
)) {
12766 target
= Buffer
.from(target
, target
.offset
, target
.byteLength
)
12768 if (!Buffer
.isBuffer(target
)) {
12769 throw new TypeError(
12770 'The "target" argument must be one of type Buffer or Uint8Array. ' +
12771 'Received type ' + (typeof target
)
12775 if (start
=== undefined) {
12778 if (end
=== undefined) {
12779 end
= target
? target
.length : 0
12781 if (thisStart
=== undefined) {
12784 if (thisEnd
=== undefined) {
12785 thisEnd
= this.length
12788 if (start
< 0 || end
> target
.length
|| thisStart
< 0 || thisEnd
> this.length
) {
12789 throw new RangeError('out of range index')
12792 if (thisStart
>= thisEnd
&& start
>= end
) {
12795 if (thisStart
>= thisEnd
) {
12798 if (start
>= end
) {
12807 if (this === target
) return 0
12809 var x
= thisEnd
- thisStart
12810 var y
= end
- start
12811 var len
= Math
.min(x
, y
)
12813 var thisCopy
= this.slice(thisStart
, thisEnd
)
12814 var targetCopy
= target
.slice(start
, end
)
12816 for (var i
= 0; i
< len
; ++i
) {
12817 if (thisCopy
[i
] !== targetCopy
[i
]) {
12824 if (x
< y
) return -1
12825 if (y
< x
) return 1
12829 // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
12830 // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
12833 // - buffer - a Buffer to search
12834 // - val - a string, Buffer, or number
12835 // - byteOffset - an index into `buffer`; will be clamped to an int32
12836 // - encoding - an optional encoding, relevant is val is a string
12837 // - dir - true for indexOf, false for lastIndexOf
12838 function bidirectionalIndexOf (buffer
, val
, byteOffset
, encoding
, dir
) {
12839 // Empty buffer means no match
12840 if (buffer
.length
=== 0) return -1
12842 // Normalize byteOffset
12843 if (typeof byteOffset
=== 'string') {
12844 encoding
= byteOffset
12846 } else if (byteOffset
> 0x7fffffff) {
12847 byteOffset
= 0x7fffffff
12848 } else if (byteOffset
< -0x80000000) {
12849 byteOffset
= -0x80000000
12851 byteOffset
= +byteOffset
// Coerce to Number.
12852 if (numberIsNaN(byteOffset
)) {
12853 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
12854 byteOffset
= dir
? 0 : (buffer
.length
- 1)
12857 // Normalize byteOffset: negative offsets start from the end of the buffer
12858 if (byteOffset
< 0) byteOffset
= buffer
.length
+ byteOffset
12859 if (byteOffset
>= buffer
.length
) {
12861 else byteOffset
= buffer
.length
- 1
12862 } else if (byteOffset
< 0) {
12863 if (dir
) byteOffset
= 0
12868 if (typeof val
=== 'string') {
12869 val
= Buffer
.from(val
, encoding
)
12872 // Finally, search either indexOf (if dir is true) or lastIndexOf
12873 if (Buffer
.isBuffer(val
)) {
12874 // Special case: looking for empty string/buffer always fails
12875 if (val
.length
=== 0) {
12878 return arrayIndexOf(buffer
, val
, byteOffset
, encoding
, dir
)
12879 } else if (typeof val
=== 'number') {
12880 val
= val
& 0xFF // Search for a byte value [0-255]
12881 if (typeof Uint8Array
.prototype.indexOf
=== 'function') {
12883 return Uint8Array
.prototype.indexOf
.call(buffer
, val
, byteOffset
)
12885 return Uint8Array
.prototype.lastIndexOf
.call(buffer
, val
, byteOffset
)
12888 return arrayIndexOf(buffer
, [val
], byteOffset
, encoding
, dir
)
12891 throw new TypeError('val must be string, number or Buffer')
12894 function arrayIndexOf (arr
, val
, byteOffset
, encoding
, dir
) {
12896 var arrLength
= arr
.length
12897 var valLength
= val
.length
12899 if (encoding
!== undefined) {
12900 encoding
= String(encoding
).toLowerCase()
12901 if (encoding
=== 'ucs2' || encoding
=== 'ucs-2' ||
12902 encoding
=== 'utf16le' || encoding
=== 'utf-16le') {
12903 if (arr
.length
< 2 || val
.length
< 2) {
12913 function read (buf
, i
) {
12914 if (indexSize
=== 1) {
12917 return buf
.readUInt16BE(i
* indexSize
)
12923 var foundIndex
= -1
12924 for (i
= byteOffset
; i
< arrLength
; i
++) {
12925 if (read(arr
, i
) === read(val
, foundIndex
=== -1 ? 0 : i
- foundIndex
)) {
12926 if (foundIndex
=== -1) foundIndex
= i
12927 if (i
- foundIndex
+ 1 === valLength
) return foundIndex
* indexSize
12929 if (foundIndex
!== -1) i
-= i
- foundIndex
12934 if (byteOffset
+ valLength
> arrLength
) byteOffset
= arrLength
- valLength
12935 for (i
= byteOffset
; i
>= 0; i
--) {
12937 for (var j
= 0; j
< valLength
; j
++) {
12938 if (read(arr
, i
+ j
) !== read(val
, j
)) {
12943 if (found
) return i
12950 Buffer
.prototype.includes
= function includes (val
, byteOffset
, encoding
) {
12951 return this.indexOf(val
, byteOffset
, encoding
) !== -1
12954 Buffer
.prototype.indexOf
= function indexOf (val
, byteOffset
, encoding
) {
12955 return bidirectionalIndexOf(this, val
, byteOffset
, encoding
, true)
12958 Buffer
.prototype.lastIndexOf
= function lastIndexOf (val
, byteOffset
, encoding
) {
12959 return bidirectionalIndexOf(this, val
, byteOffset
, encoding
, false)
12962 function hexWrite (buf
, string
, offset
, length
) {
12963 offset
= Number(offset
) || 0
12964 var remaining
= buf
.length
- offset
12968 length
= Number(length
)
12969 if (length
> remaining
) {
12974 var strLen
= string
.length
12976 if (length
> strLen
/ 2) {
12977 length
= strLen
/ 2
12979 for (var i
= 0; i
< length
; ++i
) {
12980 var parsed
= parseInt(string
.substr(i
* 2, 2), 16)
12981 if (numberIsNaN(parsed
)) return i
12982 buf
[offset
+ i
] = parsed
12987 function utf8Write (buf
, string
, offset
, length
) {
12988 return blitBuffer(utf8ToBytes(string
, buf
.length
- offset
), buf
, offset
, length
)
12991 function asciiWrite (buf
, string
, offset
, length
) {
12992 return blitBuffer(asciiToBytes(string
), buf
, offset
, length
)
12995 function latin1Write (buf
, string
, offset
, length
) {
12996 return asciiWrite(buf
, string
, offset
, length
)
12999 function base64Write (buf
, string
, offset
, length
) {
13000 return blitBuffer(base64ToBytes(string
), buf
, offset
, length
)
13003 function ucs2Write (buf
, string
, offset
, length
) {
13004 return blitBuffer(utf16leToBytes(string
, buf
.length
- offset
), buf
, offset
, length
)
13007 Buffer
.prototype.write
= function write (string
, offset
, length
, encoding
) {
13008 // Buffer#write(string)
13009 if (offset
=== undefined) {
13011 length
= this.length
13013 // Buffer#write(string, encoding)
13014 } else if (length
=== undefined && typeof offset
=== 'string') {
13016 length
= this.length
13018 // Buffer#write(string, offset[, length][, encoding])
13019 } else if (isFinite(offset
)) {
13020 offset
= offset
>>> 0
13021 if (isFinite(length
)) {
13022 length
= length
>>> 0
13023 if (encoding
=== undefined) encoding
= 'utf8'
13030 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
13034 var remaining
= this.length
- offset
13035 if (length
=== undefined || length
> remaining
) length
= remaining
13037 if ((string
.length
> 0 && (length
< 0 || offset
< 0)) || offset
> this.length
) {
13038 throw new RangeError('Attempt to write outside buffer bounds')
13041 if (!encoding
) encoding
= 'utf8'
13043 var loweredCase
= false
13045 switch (encoding
) {
13047 return hexWrite(this, string
, offset
, length
)
13051 return utf8Write(this, string
, offset
, length
)
13054 return asciiWrite(this, string
, offset
, length
)
13058 return latin1Write(this, string
, offset
, length
)
13061 // Warning: maxLength not taken into account in base64Write
13062 return base64Write(this, string
, offset
, length
)
13068 return ucs2Write(this, string
, offset
, length
)
13071 if (loweredCase
) throw new TypeError('Unknown encoding: ' + encoding
)
13072 encoding
= ('' + encoding
).toLowerCase()
13078 Buffer
.prototype.toJSON
= function toJSON () {
13081 data: Array
.prototype.slice
.call(this._arr
|| this, 0)
13085 function base64Slice (buf
, start
, end
) {
13086 if (start
=== 0 && end
=== buf
.length
) {
13087 return base64
.fromByteArray(buf
)
13089 return base64
.fromByteArray(buf
.slice(start
, end
))
13093 function utf8Slice (buf
, start
, end
) {
13094 end
= Math
.min(buf
.length
, end
)
13099 var firstByte
= buf
[i
]
13100 var codePoint
= null
13101 var bytesPerSequence
= (firstByte
> 0xEF) ? 4
13102 : (firstByte
> 0xDF) ? 3
13103 : (firstByte
> 0xBF) ? 2
13106 if (i
+ bytesPerSequence
<= end
) {
13107 var secondByte
, thirdByte
, fourthByte
, tempCodePoint
13109 switch (bytesPerSequence
) {
13111 if (firstByte
< 0x80) {
13112 codePoint
= firstByte
13116 secondByte
= buf
[i
+ 1]
13117 if ((secondByte
& 0xC0) === 0x80) {
13118 tempCodePoint
= (firstByte
& 0x1F) << 0x6 | (secondByte
& 0x3F)
13119 if (tempCodePoint
> 0x7F) {
13120 codePoint
= tempCodePoint
13125 secondByte
= buf
[i
+ 1]
13126 thirdByte
= buf
[i
+ 2]
13127 if ((secondByte
& 0xC0) === 0x80 && (thirdByte
& 0xC0) === 0x80) {
13128 tempCodePoint
= (firstByte
& 0xF) << 0xC | (secondByte
& 0x3F) << 0x6 | (thirdByte
& 0x3F)
13129 if (tempCodePoint
> 0x7FF && (tempCodePoint
< 0xD800 || tempCodePoint
> 0xDFFF)) {
13130 codePoint
= tempCodePoint
13135 secondByte
= buf
[i
+ 1]
13136 thirdByte
= buf
[i
+ 2]
13137 fourthByte
= buf
[i
+ 3]
13138 if ((secondByte
& 0xC0) === 0x80 && (thirdByte
& 0xC0) === 0x80 && (fourthByte
& 0xC0) === 0x80) {
13139 tempCodePoint
= (firstByte
& 0xF) << 0x12 | (secondByte
& 0x3F) << 0xC | (thirdByte
& 0x3F) << 0x6 | (fourthByte
& 0x3F)
13140 if (tempCodePoint
> 0xFFFF && tempCodePoint
< 0x110000) {
13141 codePoint
= tempCodePoint
13147 if (codePoint
=== null) {
13148 // we did not generate a valid codePoint so insert a
13149 // replacement char (U+FFFD) and advance only 1 byte
13151 bytesPerSequence
= 1
13152 } else if (codePoint
> 0xFFFF) {
13153 // encode to utf16 (surrogate pair dance)
13154 codePoint
-= 0x10000
13155 res
.push(codePoint
>>> 10 & 0x3FF | 0xD800)
13156 codePoint
= 0xDC00 | codePoint
& 0x3FF
13159 res
.push(codePoint
)
13160 i
+= bytesPerSequence
13163 return decodeCodePointsArray(res
)
13166 // Based on http://stackoverflow.com/a/22747272/680742, the browser with
13167 // the lowest limit is Chrome, with 0x10000 args.
13168 // We go 1 magnitude less, for safety
13169 var MAX_ARGUMENTS_LENGTH
= 0x1000
13171 function decodeCodePointsArray (codePoints
) {
13172 var len
= codePoints
.length
13173 if (len
<= MAX_ARGUMENTS_LENGTH
) {
13174 return String
.fromCharCode
.apply(String
, codePoints
) // avoid extra slice()
13177 // Decode in chunks to avoid "call stack size exceeded".
13181 res
+= String
.fromCharCode
.apply(
13183 codePoints
.slice(i
, i
+= MAX_ARGUMENTS_LENGTH
)
13189 function asciiSlice (buf
, start
, end
) {
13191 end
= Math
.min(buf
.length
, end
)
13193 for (var i
= start
; i
< end
; ++i
) {
13194 ret
+= String
.fromCharCode(buf
[i
] & 0x7F)
13199 function latin1Slice (buf
, start
, end
) {
13201 end
= Math
.min(buf
.length
, end
)
13203 for (var i
= start
; i
< end
; ++i
) {
13204 ret
+= String
.fromCharCode(buf
[i
])
13209 function hexSlice (buf
, start
, end
) {
13210 var len
= buf
.length
13212 if (!start
|| start
< 0) start
= 0
13213 if (!end
|| end
< 0 || end
> len
) end
= len
13216 for (var i
= start
; i
< end
; ++i
) {
13217 out
+= toHex(buf
[i
])
13222 function utf16leSlice (buf
, start
, end
) {
13223 var bytes
= buf
.slice(start
, end
)
13225 for (var i
= 0; i
< bytes
.length
; i
+= 2) {
13226 res
+= String
.fromCharCode(bytes
[i
] + (bytes
[i
+ 1] * 256))
13231 Buffer
.prototype.slice
= function slice (start
, end
) {
13232 var len
= this.length
13234 end
= end
=== undefined ? len : ~~end
13238 if (start
< 0) start
= 0
13239 } else if (start
> len
) {
13245 if (end
< 0) end
= 0
13246 } else if (end
> len
) {
13250 if (end
< start
) end
= start
13252 var newBuf
= this.subarray(start
, end
)
13253 // Return an augmented `Uint8Array` instance
13254 Object
.setPrototypeOf(newBuf
, Buffer
.prototype)
13260 * Need to make sure that buffer isn't trying to write out of bounds.
13262 function checkOffset (offset
, ext
, length
) {
13263 if ((offset
% 1) !== 0 || offset
< 0) throw new RangeError('offset is not uint')
13264 if (offset
+ ext
> length
) throw new RangeError('Trying to access beyond buffer length')
13267 Buffer
.prototype.readUIntLE
= function readUIntLE (offset
, byteLength
, noAssert
) {
13268 offset
= offset
>>> 0
13269 byteLength
= byteLength
>>> 0
13270 if (!noAssert
) checkOffset(offset
, byteLength
, this.length
)
13272 var val
= this[offset
]
13275 while (++i
< byteLength
&& (mul
*= 0x100)) {
13276 val
+= this[offset
+ i
] * mul
13282 Buffer
.prototype.readUIntBE
= function readUIntBE (offset
, byteLength
, noAssert
) {
13283 offset
= offset
>>> 0
13284 byteLength
= byteLength
>>> 0
13286 checkOffset(offset
, byteLength
, this.length
)
13289 var val
= this[offset
+ --byteLength
]
13291 while (byteLength
> 0 && (mul
*= 0x100)) {
13292 val
+= this[offset
+ --byteLength
] * mul
13298 Buffer
.prototype.readUInt8
= function readUInt8 (offset
, noAssert
) {
13299 offset
= offset
>>> 0
13300 if (!noAssert
) checkOffset(offset
, 1, this.length
)
13301 return this[offset
]
13304 Buffer
.prototype.readUInt16LE
= function readUInt16LE (offset
, noAssert
) {
13305 offset
= offset
>>> 0
13306 if (!noAssert
) checkOffset(offset
, 2, this.length
)
13307 return this[offset
] | (this[offset
+ 1] << 8)
13310 Buffer
.prototype.readUInt16BE
= function readUInt16BE (offset
, noAssert
) {
13311 offset
= offset
>>> 0
13312 if (!noAssert
) checkOffset(offset
, 2, this.length
)
13313 return (this[offset
] << 8) | this[offset
+ 1]
13316 Buffer
.prototype.readUInt32LE
= function readUInt32LE (offset
, noAssert
) {
13317 offset
= offset
>>> 0
13318 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13320 return ((this[offset
]) |
13321 (this[offset
+ 1] << 8) |
13322 (this[offset
+ 2] << 16)) +
13323 (this[offset
+ 3] * 0x1000000)
13326 Buffer
.prototype.readUInt32BE
= function readUInt32BE (offset
, noAssert
) {
13327 offset
= offset
>>> 0
13328 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13330 return (this[offset
] * 0x1000000) +
13331 ((this[offset
+ 1] << 16) |
13332 (this[offset
+ 2] << 8) |
13336 Buffer
.prototype.readIntLE
= function readIntLE (offset
, byteLength
, noAssert
) {
13337 offset
= offset
>>> 0
13338 byteLength
= byteLength
>>> 0
13339 if (!noAssert
) checkOffset(offset
, byteLength
, this.length
)
13341 var val
= this[offset
]
13344 while (++i
< byteLength
&& (mul
*= 0x100)) {
13345 val
+= this[offset
+ i
] * mul
13349 if (val
>= mul
) val
-= Math
.pow(2, 8 * byteLength
)
13354 Buffer
.prototype.readIntBE
= function readIntBE (offset
, byteLength
, noAssert
) {
13355 offset
= offset
>>> 0
13356 byteLength
= byteLength
>>> 0
13357 if (!noAssert
) checkOffset(offset
, byteLength
, this.length
)
13361 var val
= this[offset
+ --i
]
13362 while (i
> 0 && (mul
*= 0x100)) {
13363 val
+= this[offset
+ --i
] * mul
13367 if (val
>= mul
) val
-= Math
.pow(2, 8 * byteLength
)
13372 Buffer
.prototype.readInt8
= function readInt8 (offset
, noAssert
) {
13373 offset
= offset
>>> 0
13374 if (!noAssert
) checkOffset(offset
, 1, this.length
)
13375 if (!(this[offset
] & 0x80)) return (this[offset
])
13376 return ((0xff - this[offset
] + 1) * -1)
13379 Buffer
.prototype.readInt16LE
= function readInt16LE (offset
, noAssert
) {
13380 offset
= offset
>>> 0
13381 if (!noAssert
) checkOffset(offset
, 2, this.length
)
13382 var val
= this[offset
] | (this[offset
+ 1] << 8)
13383 return (val
& 0x8000) ? val
| 0xFFFF0000 : val
13386 Buffer
.prototype.readInt16BE
= function readInt16BE (offset
, noAssert
) {
13387 offset
= offset
>>> 0
13388 if (!noAssert
) checkOffset(offset
, 2, this.length
)
13389 var val
= this[offset
+ 1] | (this[offset
] << 8)
13390 return (val
& 0x8000) ? val
| 0xFFFF0000 : val
13393 Buffer
.prototype.readInt32LE
= function readInt32LE (offset
, noAssert
) {
13394 offset
= offset
>>> 0
13395 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13397 return (this[offset
]) |
13398 (this[offset
+ 1] << 8) |
13399 (this[offset
+ 2] << 16) |
13400 (this[offset
+ 3] << 24)
13403 Buffer
.prototype.readInt32BE
= function readInt32BE (offset
, noAssert
) {
13404 offset
= offset
>>> 0
13405 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13407 return (this[offset
] << 24) |
13408 (this[offset
+ 1] << 16) |
13409 (this[offset
+ 2] << 8) |
13413 Buffer
.prototype.readFloatLE
= function readFloatLE (offset
, noAssert
) {
13414 offset
= offset
>>> 0
13415 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13416 return ieee754
.read(this, offset
, true, 23, 4)
13419 Buffer
.prototype.readFloatBE
= function readFloatBE (offset
, noAssert
) {
13420 offset
= offset
>>> 0
13421 if (!noAssert
) checkOffset(offset
, 4, this.length
)
13422 return ieee754
.read(this, offset
, false, 23, 4)
13425 Buffer
.prototype.readDoubleLE
= function readDoubleLE (offset
, noAssert
) {
13426 offset
= offset
>>> 0
13427 if (!noAssert
) checkOffset(offset
, 8, this.length
)
13428 return ieee754
.read(this, offset
, true, 52, 8)
13431 Buffer
.prototype.readDoubleBE
= function readDoubleBE (offset
, noAssert
) {
13432 offset
= offset
>>> 0
13433 if (!noAssert
) checkOffset(offset
, 8, this.length
)
13434 return ieee754
.read(this, offset
, false, 52, 8)
13437 function checkInt (buf
, value
, offset
, ext
, max
, min
) {
13438 if (!Buffer
.isBuffer(buf
)) throw new TypeError('"buffer" argument must be a Buffer instance')
13439 if (value
> max
|| value
< min
) throw new RangeError('"value" argument is out of bounds')
13440 if (offset
+ ext
> buf
.length
) throw new RangeError('Index out of range')
13443 Buffer
.prototype.writeUIntLE
= function writeUIntLE (value
, offset
, byteLength
, noAssert
) {
13445 offset
= offset
>>> 0
13446 byteLength
= byteLength
>>> 0
13448 var maxBytes
= Math
.pow(2, 8 * byteLength
) - 1
13449 checkInt(this, value
, offset
, byteLength
, maxBytes
, 0)
13454 this[offset
] = value
& 0xFF
13455 while (++i
< byteLength
&& (mul
*= 0x100)) {
13456 this[offset
+ i
] = (value
/ mul
) & 0xFF
13459 return offset
+ byteLength
13462 Buffer
.prototype.writeUIntBE
= function writeUIntBE (value
, offset
, byteLength
, noAssert
) {
13464 offset
= offset
>>> 0
13465 byteLength
= byteLength
>>> 0
13467 var maxBytes
= Math
.pow(2, 8 * byteLength
) - 1
13468 checkInt(this, value
, offset
, byteLength
, maxBytes
, 0)
13471 var i
= byteLength
- 1
13473 this[offset
+ i
] = value
& 0xFF
13474 while (--i
>= 0 && (mul
*= 0x100)) {
13475 this[offset
+ i
] = (value
/ mul
) & 0xFF
13478 return offset
+ byteLength
13481 Buffer
.prototype.writeUInt8
= function writeUInt8 (value
, offset
, noAssert
) {
13483 offset
= offset
>>> 0
13484 if (!noAssert
) checkInt(this, value
, offset
, 1, 0xff, 0)
13485 this[offset
] = (value
& 0xff)
13489 Buffer
.prototype.writeUInt16LE
= function writeUInt16LE (value
, offset
, noAssert
) {
13491 offset
= offset
>>> 0
13492 if (!noAssert
) checkInt(this, value
, offset
, 2, 0xffff, 0)
13493 this[offset
] = (value
& 0xff)
13494 this[offset
+ 1] = (value
>>> 8)
13498 Buffer
.prototype.writeUInt16BE
= function writeUInt16BE (value
, offset
, noAssert
) {
13500 offset
= offset
>>> 0
13501 if (!noAssert
) checkInt(this, value
, offset
, 2, 0xffff, 0)
13502 this[offset
] = (value
>>> 8)
13503 this[offset
+ 1] = (value
& 0xff)
13507 Buffer
.prototype.writeUInt32LE
= function writeUInt32LE (value
, offset
, noAssert
) {
13509 offset
= offset
>>> 0
13510 if (!noAssert
) checkInt(this, value
, offset
, 4, 0xffffffff, 0)
13511 this[offset
+ 3] = (value
>>> 24)
13512 this[offset
+ 2] = (value
>>> 16)
13513 this[offset
+ 1] = (value
>>> 8)
13514 this[offset
] = (value
& 0xff)
13518 Buffer
.prototype.writeUInt32BE
= function writeUInt32BE (value
, offset
, noAssert
) {
13520 offset
= offset
>>> 0
13521 if (!noAssert
) checkInt(this, value
, offset
, 4, 0xffffffff, 0)
13522 this[offset
] = (value
>>> 24)
13523 this[offset
+ 1] = (value
>>> 16)
13524 this[offset
+ 2] = (value
>>> 8)
13525 this[offset
+ 3] = (value
& 0xff)
13529 Buffer
.prototype.writeIntLE
= function writeIntLE (value
, offset
, byteLength
, noAssert
) {
13531 offset
= offset
>>> 0
13533 var limit
= Math
.pow(2, (8 * byteLength
) - 1)
13535 checkInt(this, value
, offset
, byteLength
, limit
- 1, -limit
)
13541 this[offset
] = value
& 0xFF
13542 while (++i
< byteLength
&& (mul
*= 0x100)) {
13543 if (value
< 0 && sub
=== 0 && this[offset
+ i
- 1] !== 0) {
13546 this[offset
+ i
] = ((value
/ mul
) >> 0) - sub
& 0xFF
13549 return offset
+ byteLength
13552 Buffer
.prototype.writeIntBE
= function writeIntBE (value
, offset
, byteLength
, noAssert
) {
13554 offset
= offset
>>> 0
13556 var limit
= Math
.pow(2, (8 * byteLength
) - 1)
13558 checkInt(this, value
, offset
, byteLength
, limit
- 1, -limit
)
13561 var i
= byteLength
- 1
13564 this[offset
+ i
] = value
& 0xFF
13565 while (--i
>= 0 && (mul
*= 0x100)) {
13566 if (value
< 0 && sub
=== 0 && this[offset
+ i
+ 1] !== 0) {
13569 this[offset
+ i
] = ((value
/ mul
) >> 0) - sub
& 0xFF
13572 return offset
+ byteLength
13575 Buffer
.prototype.writeInt8
= function writeInt8 (value
, offset
, noAssert
) {
13577 offset
= offset
>>> 0
13578 if (!noAssert
) checkInt(this, value
, offset
, 1, 0x7f, -0x80)
13579 if (value
< 0) value
= 0xff + value
+ 1
13580 this[offset
] = (value
& 0xff)
13584 Buffer
.prototype.writeInt16LE
= function writeInt16LE (value
, offset
, noAssert
) {
13586 offset
= offset
>>> 0
13587 if (!noAssert
) checkInt(this, value
, offset
, 2, 0x7fff, -0x8000)
13588 this[offset
] = (value
& 0xff)
13589 this[offset
+ 1] = (value
>>> 8)
13593 Buffer
.prototype.writeInt16BE
= function writeInt16BE (value
, offset
, noAssert
) {
13595 offset
= offset
>>> 0
13596 if (!noAssert
) checkInt(this, value
, offset
, 2, 0x7fff, -0x8000)
13597 this[offset
] = (value
>>> 8)
13598 this[offset
+ 1] = (value
& 0xff)
13602 Buffer
.prototype.writeInt32LE
= function writeInt32LE (value
, offset
, noAssert
) {
13604 offset
= offset
>>> 0
13605 if (!noAssert
) checkInt(this, value
, offset
, 4, 0x7fffffff, -0x80000000)
13606 this[offset
] = (value
& 0xff)
13607 this[offset
+ 1] = (value
>>> 8)
13608 this[offset
+ 2] = (value
>>> 16)
13609 this[offset
+ 3] = (value
>>> 24)
13613 Buffer
.prototype.writeInt32BE
= function writeInt32BE (value
, offset
, noAssert
) {
13615 offset
= offset
>>> 0
13616 if (!noAssert
) checkInt(this, value
, offset
, 4, 0x7fffffff, -0x80000000)
13617 if (value
< 0) value
= 0xffffffff + value
+ 1
13618 this[offset
] = (value
>>> 24)
13619 this[offset
+ 1] = (value
>>> 16)
13620 this[offset
+ 2] = (value
>>> 8)
13621 this[offset
+ 3] = (value
& 0xff)
13625 function checkIEEE754 (buf
, value
, offset
, ext
, max
, min
) {
13626 if (offset
+ ext
> buf
.length
) throw new RangeError('Index out of range')
13627 if (offset
< 0) throw new RangeError('Index out of range')
13630 function writeFloat (buf
, value
, offset
, littleEndian
, noAssert
) {
13632 offset
= offset
>>> 0
13634 checkIEEE754(buf
, value
, offset
, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
13636 ieee754
.write(buf
, value
, offset
, littleEndian
, 23, 4)
13640 Buffer
.prototype.writeFloatLE
= function writeFloatLE (value
, offset
, noAssert
) {
13641 return writeFloat(this, value
, offset
, true, noAssert
)
13644 Buffer
.prototype.writeFloatBE
= function writeFloatBE (value
, offset
, noAssert
) {
13645 return writeFloat(this, value
, offset
, false, noAssert
)
13648 function writeDouble (buf
, value
, offset
, littleEndian
, noAssert
) {
13650 offset
= offset
>>> 0
13652 checkIEEE754(buf
, value
, offset
, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
13654 ieee754
.write(buf
, value
, offset
, littleEndian
, 52, 8)
13658 Buffer
.prototype.writeDoubleLE
= function writeDoubleLE (value
, offset
, noAssert
) {
13659 return writeDouble(this, value
, offset
, true, noAssert
)
13662 Buffer
.prototype.writeDoubleBE
= function writeDoubleBE (value
, offset
, noAssert
) {
13663 return writeDouble(this, value
, offset
, false, noAssert
)
13666 // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
13667 Buffer
.prototype.copy
= function copy (target
, targetStart
, start
, end
) {
13668 if (!Buffer
.isBuffer(target
)) throw new TypeError('argument should be a Buffer')
13669 if (!start
) start
= 0
13670 if (!end
&& end
!== 0) end
= this.length
13671 if (targetStart
>= target
.length
) targetStart
= target
.length
13672 if (!targetStart
) targetStart
= 0
13673 if (end
> 0 && end
< start
) end
= start
13675 // Copy 0 bytes; we're done
13676 if (end
=== start
) return 0
13677 if (target
.length
=== 0 || this.length
=== 0) return 0
13679 // Fatal error conditions
13680 if (targetStart
< 0) {
13681 throw new RangeError('targetStart out of bounds')
13683 if (start
< 0 || start
>= this.length
) throw new RangeError('Index out of range')
13684 if (end
< 0) throw new RangeError('sourceEnd out of bounds')
13687 if (end
> this.length
) end
= this.length
13688 if (target
.length
- targetStart
< end
- start
) {
13689 end
= target
.length
- targetStart
+ start
13692 var len
= end
- start
13694 if (this === target
&& typeof Uint8Array
.prototype.copyWithin
=== 'function') {
13695 // Use built-in when available, missing from IE11
13696 this.copyWithin(targetStart
, start
, end
)
13697 } else if (this === target
&& start
< targetStart
&& targetStart
< end
) {
13698 // descending copy from end
13699 for (var i
= len
- 1; i
>= 0; --i
) {
13700 target
[i
+ targetStart
] = this[i
+ start
]
13703 Uint8Array
.prototype.set.call(
13705 this.subarray(start
, end
),
13714 // buffer.fill(number[, offset[, end]])
13715 // buffer.fill(buffer[, offset[, end]])
13716 // buffer.fill(string[, offset[, end]][, encoding])
13717 Buffer
.prototype.fill
= function fill (val
, start
, end
, encoding
) {
13718 // Handle string cases:
13719 if (typeof val
=== 'string') {
13720 if (typeof start
=== 'string') {
13724 } else if (typeof end
=== 'string') {
13728 if (encoding
!== undefined && typeof encoding
!== 'string') {
13729 throw new TypeError('encoding must be a string')
13731 if (typeof encoding
=== 'string' && !Buffer
.isEncoding(encoding
)) {
13732 throw new TypeError('Unknown encoding: ' + encoding
)
13734 if (val
.length
=== 1) {
13735 var code
= val
.charCodeAt(0)
13736 if ((encoding
=== 'utf8' && code
< 128) ||
13737 encoding
=== 'latin1') {
13738 // Fast path: If `val` fits into a single byte, use that numeric value.
13742 } else if (typeof val
=== 'number') {
13744 } else if (typeof val
=== 'boolean') {
13748 // Invalid ranges are not set to a default, so can range check early.
13749 if (start
< 0 || this.length
< start
|| this.length
< end
) {
13750 throw new RangeError('Out of range index')
13753 if (end
<= start
) {
13757 start
= start
>>> 0
13758 end
= end
=== undefined ? this.length : end
>>> 0
13763 if (typeof val
=== 'number') {
13764 for (i
= start
; i
< end
; ++i
) {
13768 var bytes
= Buffer
.isBuffer(val
)
13770 : Buffer
.from(val
, encoding
)
13771 var len
= bytes
.length
13773 throw new TypeError('The value "' + val
+
13774 '" is invalid for argument "value"')
13776 for (i
= 0; i
< end
- start
; ++i
) {
13777 this[i
+ start
] = bytes
[i
% len
]
13784 // HELPER FUNCTIONS
13785 // ================
13787 var INVALID_BASE64_RE
= /[^+/0-9A
-Za
-z
-_
]/g
13789 function base64clean (str
) {
13790 // Node takes equal signs as end of the Base64 encoding
13791 str
= str
.split('=')[0]
13792 // Node strips out invalid characters like \n and \t from the string, base64-js does not
13793 str
= str
.trim().replace(INVALID_BASE64_RE
, '')
13794 // Node converts strings with length < 2 to ''
13795 if (str
.length
< 2) return ''
13796 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
13797 while (str
.length
% 4 !== 0) {
13803 function toHex (n
) {
13804 if (n
< 16) return '0' + n
.toString(16)
13805 return n
.toString(16)
13808 function utf8ToBytes (string
, units
) {
13809 units
= units
|| Infinity
13811 var length
= string
.length
13812 var leadSurrogate
= null
13815 for (var i
= 0; i
< length
; ++i
) {
13816 codePoint
= string
.charCodeAt(i
)
13818 // is surrogate component
13819 if (codePoint
> 0xD7FF && codePoint
< 0xE000) {
13820 // last char was a lead
13821 if (!leadSurrogate
) {
13823 if (codePoint
> 0xDBFF) {
13824 // unexpected trail
13825 if ((units
-= 3) > -1) bytes
.push(0xEF, 0xBF, 0xBD)
13827 } else if (i
+ 1 === length
) {
13829 if ((units
-= 3) > -1) bytes
.push(0xEF, 0xBF, 0xBD)
13834 leadSurrogate
= codePoint
13839 // 2 leads in a row
13840 if (codePoint
< 0xDC00) {
13841 if ((units
-= 3) > -1) bytes
.push(0xEF, 0xBF, 0xBD)
13842 leadSurrogate
= codePoint
13846 // valid surrogate pair
13847 codePoint
= (leadSurrogate
- 0xD800 << 10 | codePoint
- 0xDC00) + 0x10000
13848 } else if (leadSurrogate
) {
13849 // valid bmp char, but last char was a lead
13850 if ((units
-= 3) > -1) bytes
.push(0xEF, 0xBF, 0xBD)
13853 leadSurrogate
= null
13856 if (codePoint
< 0x80) {
13857 if ((units
-= 1) < 0) break
13858 bytes
.push(codePoint
)
13859 } else if (codePoint
< 0x800) {
13860 if ((units
-= 2) < 0) break
13862 codePoint
>> 0x6 | 0xC0,
13863 codePoint
& 0x3F | 0x80
13865 } else if (codePoint
< 0x10000) {
13866 if ((units
-= 3) < 0) break
13868 codePoint
>> 0xC | 0xE0,
13869 codePoint
>> 0x6 & 0x3F | 0x80,
13870 codePoint
& 0x3F | 0x80
13872 } else if (codePoint
< 0x110000) {
13873 if ((units
-= 4) < 0) break
13875 codePoint
>> 0x12 | 0xF0,
13876 codePoint
>> 0xC & 0x3F | 0x80,
13877 codePoint
>> 0x6 & 0x3F | 0x80,
13878 codePoint
& 0x3F | 0x80
13881 throw new Error('Invalid code point')
13888 function asciiToBytes (str
) {
13890 for (var i
= 0; i
< str
.length
; ++i
) {
13891 // Node's code seems to be doing this and not & 0x7F..
13892 byteArray
.push(str
.charCodeAt(i
) & 0xFF)
13897 function utf16leToBytes (str
, units
) {
13900 for (var i
= 0; i
< str
.length
; ++i
) {
13901 if ((units
-= 2) < 0) break
13903 c
= str
.charCodeAt(i
)
13913 function base64ToBytes (str
) {
13914 return base64
.toByteArray(base64clean(str
))
13917 function blitBuffer (src
, dst
, offset
, length
) {
13918 for (var i
= 0; i
< length
; ++i
) {
13919 if ((i
+ offset
>= dst
.length
) || (i
>= src
.length
)) break
13920 dst
[i
+ offset
] = src
[i
]
13925 // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
13926 // the `instanceof` check but they should be treated as of that type.
13927 // See: https://github.com/feross/buffer/issues/166
13928 function isInstance (obj
, type
) {
13929 return obj
instanceof type
||
13930 (obj
!= null && obj
.constructor != null && obj
.constructor.name
!= null &&
13931 obj
.constructor.name
=== type
.name
)
13933 function numberIsNaN (obj
) {
13934 // For IE11 support
13935 return obj
!== obj
// eslint-disable-line no-self-compare
13938 }).call(this,require("buffer").Buffer
)
13939 },{"base64-js":94,"buffer":96,"ieee754":99}],97:[function(require
,module
,exports
){
13940 (function (Buffer
){
13941 // Copyright Joyent, Inc. and other Node contributors.
13943 // Permission is hereby granted, free of charge, to any person obtaining a
13944 // copy of this software and associated documentation files (the
13945 // "Software"), to deal in the Software without restriction, including
13946 // without limitation the rights to use, copy, modify, merge, publish,
13947 // distribute, sublicense, and/or sell copies of the Software, and to permit
13948 // persons to whom the Software is furnished to do so, subject to the
13949 // following conditions:
13951 // The above copyright notice and this permission notice shall be included
13952 // in all copies or substantial portions of the Software.
13954 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13955 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13956 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
13957 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
13958 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
13959 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
13960 // USE OR OTHER DEALINGS IN THE SOFTWARE.
13962 // NOTE: These type checking functions intentionally don't use `instanceof`
13963 // because it is fragile and can be easily faked with `Object.create()`.
13965 function isArray(arg
) {
13966 if (Array
.isArray
) {
13967 return Array
.isArray(arg
);
13969 return objectToString(arg
) === '[object Array]';
13971 exports
.isArray
= isArray
;
13973 function isBoolean(arg
) {
13974 return typeof arg
=== 'boolean';
13976 exports
.isBoolean
= isBoolean
;
13978 function isNull(arg
) {
13979 return arg
=== null;
13981 exports
.isNull
= isNull
;
13983 function isNullOrUndefined(arg
) {
13984 return arg
== null;
13986 exports
.isNullOrUndefined
= isNullOrUndefined
;
13988 function isNumber(arg
) {
13989 return typeof arg
=== 'number';
13991 exports
.isNumber
= isNumber
;
13993 function isString(arg
) {
13994 return typeof arg
=== 'string';
13996 exports
.isString
= isString
;
13998 function isSymbol(arg
) {
13999 return typeof arg
=== 'symbol';
14001 exports
.isSymbol
= isSymbol
;
14003 function isUndefined(arg
) {
14004 return arg
=== void 0;
14006 exports
.isUndefined
= isUndefined
;
14008 function isRegExp(re
) {
14009 return objectToString(re
) === '[object RegExp]';
14011 exports
.isRegExp
= isRegExp
;
14013 function isObject(arg
) {
14014 return typeof arg
=== 'object' && arg
!== null;
14016 exports
.isObject
= isObject
;
14018 function isDate(d
) {
14019 return objectToString(d
) === '[object Date]';
14021 exports
.isDate
= isDate
;
14023 function isError(e
) {
14024 return (objectToString(e
) === '[object Error]' || e
instanceof Error
);
14026 exports
.isError
= isError
;
14028 function isFunction(arg
) {
14029 return typeof arg
=== 'function';
14031 exports
.isFunction
= isFunction
;
14033 function isPrimitive(arg
) {
14034 return arg
=== null ||
14035 typeof arg
=== 'boolean' ||
14036 typeof arg
=== 'number' ||
14037 typeof arg
=== 'string' ||
14038 typeof arg
=== 'symbol' || // ES6 symbol
14039 typeof arg
=== 'undefined';
14041 exports
.isPrimitive
= isPrimitive
;
14043 exports
.isBuffer
= Buffer
.isBuffer
;
14045 function objectToString(o
) {
14046 return Object
.prototype.toString
.call(o
);
14049 }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
14050 },{"../../is-buffer/index.js":101}],98:[function(require
,module
,exports
){
14051 // Copyright Joyent, Inc. and other Node contributors.
14053 // Permission is hereby granted, free of charge, to any person obtaining a
14054 // copy of this software and associated documentation files (the
14055 // "Software"), to deal in the Software without restriction, including
14056 // without limitation the rights to use, copy, modify, merge, publish,
14057 // distribute, sublicense, and/or sell copies of the Software, and to permit
14058 // persons to whom the Software is furnished to do so, subject to the
14059 // following conditions:
14061 // The above copyright notice and this permission notice shall be included
14062 // in all copies or substantial portions of the Software.
14064 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14065 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14066 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14067 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14068 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14069 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
14070 // USE OR OTHER DEALINGS IN THE SOFTWARE.
14072 var objectCreate
= Object
.create
|| objectCreatePolyfill
14073 var objectKeys
= Object
.keys
|| objectKeysPolyfill
14074 var bind
= Function
.prototype.bind
|| functionBindPolyfill
14076 function EventEmitter() {
14077 if (!this._events
|| !Object
.prototype.hasOwnProperty
.call(this, '_events')) {
14078 this._events
= objectCreate(null);
14079 this._eventsCount
= 0;
14082 this._maxListeners
= this._maxListeners
|| undefined;
14084 module
.exports
= EventEmitter
;
14086 // Backwards-compat with node 0.10.x
14087 EventEmitter
.EventEmitter
= EventEmitter
;
14089 EventEmitter
.prototype._events
= undefined;
14090 EventEmitter
.prototype._maxListeners
= undefined;
14092 // By default EventEmitters will print a warning if more than 10 listeners are
14093 // added to it. This is a useful default which helps finding memory leaks.
14094 var defaultMaxListeners
= 10;
14096 var hasDefineProperty
;
14099 if (Object
.defineProperty
) Object
.defineProperty(o
, 'x', { value: 0 });
14100 hasDefineProperty
= o
.x
=== 0;
14101 } catch (err
) { hasDefineProperty
= false }
14102 if (hasDefineProperty
) {
14103 Object
.defineProperty(EventEmitter
, 'defaultMaxListeners', {
14106 return defaultMaxListeners
;
14108 set: function(arg
) {
14109 // check whether the input is a positive number (whose value is zero or
14110 // greater and not a NaN).
14111 if (typeof arg
!== 'number' || arg
< 0 || arg
!== arg
)
14112 throw new TypeError('"defaultMaxListeners" must be a positive number');
14113 defaultMaxListeners
= arg
;
14117 EventEmitter
.defaultMaxListeners
= defaultMaxListeners
;
14120 // Obviously not all Emitters should be limited to 10. This function allows
14121 // that to be increased. Set to zero for unlimited.
14122 EventEmitter
.prototype.setMaxListeners
= function setMaxListeners(n
) {
14123 if (typeof n
!== 'number' || n
< 0 || isNaN(n
))
14124 throw new TypeError('"n" argument must be a positive number');
14125 this._maxListeners
= n
;
14129 function $getMaxListeners(that
) {
14130 if (that
._maxListeners
=== undefined)
14131 return EventEmitter
.defaultMaxListeners
;
14132 return that
._maxListeners
;
14135 EventEmitter
.prototype.getMaxListeners
= function getMaxListeners() {
14136 return $getMaxListeners(this);
14139 // These standalone emit* functions are used to optimize calling of event
14140 // handlers for fast cases because emit() itself often has a variable number of
14141 // arguments and can be deoptimized because of that. These functions always have
14142 // the same number of arguments and thus do not get deoptimized, so the code
14143 // inside them can execute faster.
14144 function emitNone(handler
, isFn
, self
) {
14146 handler
.call(self
);
14148 var len
= handler
.length
;
14149 var listeners
= arrayClone(handler
, len
);
14150 for (var i
= 0; i
< len
; ++i
)
14151 listeners
[i
].call(self
);
14154 function emitOne(handler
, isFn
, self
, arg1
) {
14156 handler
.call(self
, arg1
);
14158 var len
= handler
.length
;
14159 var listeners
= arrayClone(handler
, len
);
14160 for (var i
= 0; i
< len
; ++i
)
14161 listeners
[i
].call(self
, arg1
);
14164 function emitTwo(handler
, isFn
, self
, arg1
, arg2
) {
14166 handler
.call(self
, arg1
, arg2
);
14168 var len
= handler
.length
;
14169 var listeners
= arrayClone(handler
, len
);
14170 for (var i
= 0; i
< len
; ++i
)
14171 listeners
[i
].call(self
, arg1
, arg2
);
14174 function emitThree(handler
, isFn
, self
, arg1
, arg2
, arg3
) {
14176 handler
.call(self
, arg1
, arg2
, arg3
);
14178 var len
= handler
.length
;
14179 var listeners
= arrayClone(handler
, len
);
14180 for (var i
= 0; i
< len
; ++i
)
14181 listeners
[i
].call(self
, arg1
, arg2
, arg3
);
14185 function emitMany(handler
, isFn
, self
, args
) {
14187 handler
.apply(self
, args
);
14189 var len
= handler
.length
;
14190 var listeners
= arrayClone(handler
, len
);
14191 for (var i
= 0; i
< len
; ++i
)
14192 listeners
[i
].apply(self
, args
);
14196 EventEmitter
.prototype.emit
= function emit(type
) {
14197 var er
, handler
, len
, args
, i
, events
;
14198 var doError
= (type
=== 'error');
14200 events
= this._events
;
14202 doError
= (doError
&& events
.error
== null);
14206 // If there is no 'error' event listener then throw.
14208 if (arguments
.length
> 1)
14210 if (er
instanceof Error
) {
14211 throw er
; // Unhandled 'error' event
14213 // At least give some kind of context to the user
14214 var err
= new Error('Unhandled "error" event. (' + er
+ ')');
14221 handler
= events
[type
];
14226 var isFn
= typeof handler
=== 'function';
14227 len
= arguments
.length
;
14231 emitNone(handler
, isFn
, this);
14234 emitOne(handler
, isFn
, this, arguments
[1]);
14237 emitTwo(handler
, isFn
, this, arguments
[1], arguments
[2]);
14240 emitThree(handler
, isFn
, this, arguments
[1], arguments
[2], arguments
[3]);
14244 args
= new Array(len
- 1);
14245 for (i
= 1; i
< len
; i
++)
14246 args
[i
- 1] = arguments
[i
];
14247 emitMany(handler
, isFn
, this, args
);
14253 function _addListener(target
, type
, listener
, prepend
) {
14258 if (typeof listener
!== 'function')
14259 throw new TypeError('"listener" argument must be a function');
14261 events
= target
._events
;
14263 events
= target
._events
= objectCreate(null);
14264 target
._eventsCount
= 0;
14266 // To avoid recursion in the case that type === "newListener"! Before
14267 // adding it to the listeners, first emit "newListener".
14268 if (events
.newListener
) {
14269 target
.emit('newListener', type
,
14270 listener
.listener
? listener
.listener : listener
);
14272 // Re-assign `events` because a newListener handler could have caused the
14273 // this._events to be assigned to a new object
14274 events
= target
._events
;
14276 existing
= events
[type
];
14280 // Optimize the case of one listener. Don't need the extra array object.
14281 existing
= events
[type
] = listener
;
14282 ++target
._eventsCount
;
14284 if (typeof existing
=== 'function') {
14285 // Adding the second element, need to change to array.
14286 existing
= events
[type
] =
14287 prepend
? [listener
, existing
] : [existing
, listener
];
14289 // If we've already got an array, just append.
14291 existing
.unshift(listener
);
14293 existing
.push(listener
);
14297 // Check for listener leak
14298 if (!existing
.warned
) {
14299 m
= $getMaxListeners(target
);
14300 if (m
&& m
> 0 && existing
.length
> m
) {
14301 existing
.warned
= true;
14302 var w
= new Error('Possible EventEmitter memory leak detected. ' +
14303 existing
.length
+ ' "' + String(type
) + '" listeners ' +
14304 'added. Use emitter.setMaxListeners() to ' +
14305 'increase limit.');
14306 w
.name
= 'MaxListenersExceededWarning';
14307 w
.emitter
= target
;
14309 w
.count
= existing
.length
;
14310 if (typeof console
=== 'object' && console
.warn
) {
14311 console
.warn('%s: %s', w
.name
, w
.message
);
14320 EventEmitter
.prototype.addListener
= function addListener(type
, listener
) {
14321 return _addListener(this, type
, listener
, false);
14324 EventEmitter
.prototype.on
= EventEmitter
.prototype.addListener
;
14326 EventEmitter
.prototype.prependListener
=
14327 function prependListener(type
, listener
) {
14328 return _addListener(this, type
, listener
, true);
14331 function onceWrapper() {
14333 this.target
.removeListener(this.type
, this.wrapFn
);
14335 switch (arguments
.length
) {
14337 return this.listener
.call(this.target
);
14339 return this.listener
.call(this.target
, arguments
[0]);
14341 return this.listener
.call(this.target
, arguments
[0], arguments
[1]);
14343 return this.listener
.call(this.target
, arguments
[0], arguments
[1],
14346 var args
= new Array(arguments
.length
);
14347 for (var i
= 0; i
< args
.length
; ++i
)
14348 args
[i
] = arguments
[i
];
14349 this.listener
.apply(this.target
, args
);
14354 function _onceWrap(target
, type
, listener
) {
14355 var state
= { fired: false, wrapFn: undefined, target: target
, type: type
, listener: listener
};
14356 var wrapped
= bind
.call(onceWrapper
, state
);
14357 wrapped
.listener
= listener
;
14358 state
.wrapFn
= wrapped
;
14362 EventEmitter
.prototype.once
= function once(type
, listener
) {
14363 if (typeof listener
!== 'function')
14364 throw new TypeError('"listener" argument must be a function');
14365 this.on(type
, _onceWrap(this, type
, listener
));
14369 EventEmitter
.prototype.prependOnceListener
=
14370 function prependOnceListener(type
, listener
) {
14371 if (typeof listener
!== 'function')
14372 throw new TypeError('"listener" argument must be a function');
14373 this.prependListener(type
, _onceWrap(this, type
, listener
));
14377 // Emits a 'removeListener' event if and only if the listener was removed.
14378 EventEmitter
.prototype.removeListener
=
14379 function removeListener(type
, listener
) {
14380 var list
, events
, position
, i
, originalListener
;
14382 if (typeof listener
!== 'function')
14383 throw new TypeError('"listener" argument must be a function');
14385 events
= this._events
;
14389 list
= events
[type
];
14393 if (list
=== listener
|| list
.listener
=== listener
) {
14394 if (--this._eventsCount
=== 0)
14395 this._events
= objectCreate(null);
14397 delete events
[type
];
14398 if (events
.removeListener
)
14399 this.emit('removeListener', type
, list
.listener
|| listener
);
14401 } else if (typeof list
!== 'function') {
14404 for (i
= list
.length
- 1; i
>= 0; i
--) {
14405 if (list
[i
] === listener
|| list
[i
].listener
=== listener
) {
14406 originalListener
= list
[i
].listener
;
14415 if (position
=== 0)
14418 spliceOne(list
, position
);
14420 if (list
.length
=== 1)
14421 events
[type
] = list
[0];
14423 if (events
.removeListener
)
14424 this.emit('removeListener', type
, originalListener
|| listener
);
14430 EventEmitter
.prototype.removeAllListeners
=
14431 function removeAllListeners(type
) {
14432 var listeners
, events
, i
;
14434 events
= this._events
;
14438 // not listening for removeListener, no need to emit
14439 if (!events
.removeListener
) {
14440 if (arguments
.length
=== 0) {
14441 this._events
= objectCreate(null);
14442 this._eventsCount
= 0;
14443 } else if (events
[type
]) {
14444 if (--this._eventsCount
=== 0)
14445 this._events
= objectCreate(null);
14447 delete events
[type
];
14452 // emit removeListener for all listeners on all events
14453 if (arguments
.length
=== 0) {
14454 var keys
= objectKeys(events
);
14456 for (i
= 0; i
< keys
.length
; ++i
) {
14458 if (key
=== 'removeListener') continue;
14459 this.removeAllListeners(key
);
14461 this.removeAllListeners('removeListener');
14462 this._events
= objectCreate(null);
14463 this._eventsCount
= 0;
14467 listeners
= events
[type
];
14469 if (typeof listeners
=== 'function') {
14470 this.removeListener(type
, listeners
);
14471 } else if (listeners
) {
14473 for (i
= listeners
.length
- 1; i
>= 0; i
--) {
14474 this.removeListener(type
, listeners
[i
]);
14481 function _listeners(target
, type
, unwrap
) {
14482 var events
= target
._events
;
14487 var evlistener
= events
[type
];
14491 if (typeof evlistener
=== 'function')
14492 return unwrap
? [evlistener
.listener
|| evlistener
] : [evlistener
];
14494 return unwrap
? unwrapListeners(evlistener
) : arrayClone(evlistener
, evlistener
.length
);
14497 EventEmitter
.prototype.listeners
= function listeners(type
) {
14498 return _listeners(this, type
, true);
14501 EventEmitter
.prototype.rawListeners
= function rawListeners(type
) {
14502 return _listeners(this, type
, false);
14505 EventEmitter
.listenerCount = function(emitter
, type
) {
14506 if (typeof emitter
.listenerCount
=== 'function') {
14507 return emitter
.listenerCount(type
);
14509 return listenerCount
.call(emitter
, type
);
14513 EventEmitter
.prototype.listenerCount
= listenerCount
;
14514 function listenerCount(type
) {
14515 var events
= this._events
;
14518 var evlistener
= events
[type
];
14520 if (typeof evlistener
=== 'function') {
14522 } else if (evlistener
) {
14523 return evlistener
.length
;
14530 EventEmitter
.prototype.eventNames
= function eventNames() {
14531 return this._eventsCount
> 0 ? Reflect
.ownKeys(this._events
) : [];
14534 // About 1.5x faster than the two-arg version of Array#splice().
14535 function spliceOne(list
, index
) {
14536 for (var i
= index
, k
= i
+ 1, n
= list
.length
; k
< n
; i
+= 1, k
+= 1)
14541 function arrayClone(arr
, n
) {
14542 var copy
= new Array(n
);
14543 for (var i
= 0; i
< n
; ++i
)
14548 function unwrapListeners(arr
) {
14549 var ret
= new Array(arr
.length
);
14550 for (var i
= 0; i
< ret
.length
; ++i
) {
14551 ret
[i
] = arr
[i
].listener
|| arr
[i
];
14556 function objectCreatePolyfill(proto
) {
14557 var F = function() {};
14558 F
.prototype = proto
;
14561 function objectKeysPolyfill(obj
) {
14563 for (var k
in obj
) if (Object
.prototype.hasOwnProperty
.call(obj
, k
)) {
14568 function functionBindPolyfill(context
) {
14570 return function () {
14571 return fn
.apply(context
, arguments
);
14575 },{}],99:[function(require
,module
,exports
){
14576 exports
.read = function (buffer
, offset
, isLE
, mLen
, nBytes
) {
14578 var eLen
= (nBytes
* 8) - mLen
- 1
14579 var eMax
= (1 << eLen
) - 1
14580 var eBias
= eMax
>> 1
14582 var i
= isLE
? (nBytes
- 1) : 0
14583 var d
= isLE
? -1 : 1
14584 var s
= buffer
[offset
+ i
]
14588 e
= s
& ((1 << (-nBits
)) - 1)
14591 for (; nBits
> 0; e
= (e
* 256) + buffer
[offset
+ i
], i
+= d
, nBits
-= 8) {}
14593 m
= e
& ((1 << (-nBits
)) - 1)
14596 for (; nBits
> 0; m
= (m
* 256) + buffer
[offset
+ i
], i
+= d
, nBits
-= 8) {}
14600 } else if (e
=== eMax
) {
14601 return m
? NaN : ((s
? -1 : 1) * Infinity
)
14603 m
= m
+ Math
.pow(2, mLen
)
14606 return (s
? -1 : 1) * m
* Math
.pow(2, e
- mLen
)
14609 exports
.write = function (buffer
, value
, offset
, isLE
, mLen
, nBytes
) {
14611 var eLen
= (nBytes
* 8) - mLen
- 1
14612 var eMax
= (1 << eLen
) - 1
14613 var eBias
= eMax
>> 1
14614 var rt
= (mLen
=== 23 ? Math
.pow(2, -24) - Math
.pow(2, -77) : 0)
14615 var i
= isLE
? 0 : (nBytes
- 1)
14616 var d
= isLE
? 1 : -1
14617 var s
= value
< 0 || (value
=== 0 && 1 / value
< 0) ? 1 : 0
14619 value
= Math
.abs(value
)
14621 if (isNaN(value
) || value
=== Infinity
) {
14622 m
= isNaN(value
) ? 1 : 0
14625 e
= Math
.floor(Math
.log(value
) / Math
.LN2
)
14626 if (value
* (c
= Math
.pow(2, -e
)) < 1) {
14630 if (e
+ eBias
>= 1) {
14633 value
+= rt
* Math
.pow(2, 1 - eBias
)
14635 if (value
* c
>= 2) {
14640 if (e
+ eBias
>= eMax
) {
14643 } else if (e
+ eBias
>= 1) {
14644 m
= ((value
* c
) - 1) * Math
.pow(2, mLen
)
14647 m
= value
* Math
.pow(2, eBias
- 1) * Math
.pow(2, mLen
)
14652 for (; mLen
>= 8; buffer
[offset
+ i
] = m
& 0xff, i
+= d
, m
/= 256, mLen
-= 8) {}
14654 e
= (e
<< mLen
) | m
14656 for (; eLen
> 0; buffer
[offset
+ i
] = e
& 0xff, i
+= d
, e
/= 256, eLen
-= 8) {}
14658 buffer
[offset
+ i
- d
] |= s
* 128
14661 },{}],100:[function(require
,module
,exports
){
14662 arguments
[4][32][0].apply(exports
,arguments
)
14663 },{"dup":32}],101:[function(require
,module
,exports
){
14665 * Determine if an object is a Buffer
14667 * @author Feross Aboukhadijeh <https://feross.org>
14671 // The _isBuffer check is for Safari 5-7 support, because it's missing
14672 // Object.prototype.constructor. Remove this eventually
14673 module
.exports = function (obj
) {
14674 return obj
!= null && (isBuffer(obj
) || isSlowBuffer(obj
) || !!obj
._isBuffer
)
14677 function isBuffer (obj
) {
14678 return !!obj
.constructor && typeof obj
.constructor.isBuffer
=== 'function' && obj
.constructor.isBuffer(obj
)
14681 // For Node v0.10 support. Remove this eventually.
14682 function isSlowBuffer (obj
) {
14683 return typeof obj
.readFloatLE
=== 'function' && typeof obj
.slice
=== 'function' && isBuffer(obj
.slice(0, 0))
14686 },{}],102:[function(require
,module
,exports
){
14687 var toString
= {}.toString
;
14689 module
.exports
= Array
.isArray
|| function (arr
) {
14690 return toString
.call(arr
) == '[object Array]';
14693 },{}],103:[function(require
,module
,exports
){
14701 /* eslint-disable no-unused-vars */
14702 var getOwnPropertySymbols
= Object
.getOwnPropertySymbols
;
14703 var hasOwnProperty
= Object
.prototype.hasOwnProperty
;
14704 var propIsEnumerable
= Object
.prototype.propertyIsEnumerable
;
14706 function toObject(val
) {
14707 if (val
=== null || val
=== undefined) {
14708 throw new TypeError('Object.assign cannot be called with null or undefined');
14711 return Object(val
);
14714 function shouldUseNative() {
14716 if (!Object
.assign
) {
14720 // Detect buggy property enumeration order in older V8 versions.
14722 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
14723 var test1
= new String('abc'); // eslint-disable-line no-new-wrappers
14725 if (Object
.getOwnPropertyNames(test1
)[0] === '5') {
14729 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
14731 for (var i
= 0; i
< 10; i
++) {
14732 test2
['_' + String
.fromCharCode(i
)] = i
;
14734 var order2
= Object
.getOwnPropertyNames(test2
).map(function (n
) {
14737 if (order2
.join('') !== '0123456789') {
14741 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
14743 'abcdefghijklmnopqrst'.split('').forEach(function (letter
) {
14744 test3
[letter
] = letter
;
14746 if (Object
.keys(Object
.assign({}, test3
)).join('') !==
14747 'abcdefghijklmnopqrst') {
14753 // We don't expect any of the above to throw, but better to be safe.
14758 module
.exports
= shouldUseNative() ? Object
.assign : function (target
, source
) {
14760 var to
= toObject(target
);
14763 for (var s
= 1; s
< arguments
.length
; s
++) {
14764 from = Object(arguments
[s
]);
14766 for (var key
in from) {
14767 if (hasOwnProperty
.call(from, key
)) {
14768 to
[key
] = from[key
];
14772 if (getOwnPropertySymbols
) {
14773 symbols
= getOwnPropertySymbols(from);
14774 for (var i
= 0; i
< symbols
.length
; i
++) {
14775 if (propIsEnumerable
.call(from, symbols
[i
])) {
14776 to
[symbols
[i
]] = from[symbols
[i
]];
14785 },{}],104:[function(require
,module
,exports
){
14786 (function (process
){
14789 if (typeof process
=== 'undefined' ||
14790 !process
.version
||
14791 process
.version
.indexOf('v0.') === 0 ||
14792 process
.version
.indexOf('v1.') === 0 && process
.version
.indexOf('v1.8.') !== 0) {
14793 module
.exports
= { nextTick: nextTick
};
14795 module
.exports
= process
14798 function nextTick(fn
, arg1
, arg2
, arg3
) {
14799 if (typeof fn
!== 'function') {
14800 throw new TypeError('"callback" argument must be a function');
14802 var len
= arguments
.length
;
14807 return process
.nextTick(fn
);
14809 return process
.nextTick(function afterTickOne() {
14810 fn
.call(null, arg1
);
14813 return process
.nextTick(function afterTickTwo() {
14814 fn
.call(null, arg1
, arg2
);
14817 return process
.nextTick(function afterTickThree() {
14818 fn
.call(null, arg1
, arg2
, arg3
);
14821 args
= new Array(len
- 1);
14823 while (i
< args
.length
) {
14824 args
[i
++] = arguments
[i
];
14826 return process
.nextTick(function afterTick() {
14827 fn
.apply(null, args
);
14833 }).call(this,require('_process'))
14834 },{"_process":105}],105:[function(require
,module
,exports
){
14835 // shim for using process in browser
14836 var process
= module
.exports
= {};
14838 // cached from whatever global is present so that test runners that stub it
14839 // don't break things. But we need to wrap it in a try catch in case it is
14840 // wrapped in strict mode code which doesn't define any globals. It's inside a
14841 // function because try/catches deoptimize in certain engines.
14843 var cachedSetTimeout
;
14844 var cachedClearTimeout
;
14846 function defaultSetTimout() {
14847 throw new Error('setTimeout has not been defined');
14849 function defaultClearTimeout () {
14850 throw new Error('clearTimeout has not been defined');
14854 if (typeof setTimeout
=== 'function') {
14855 cachedSetTimeout
= setTimeout
;
14857 cachedSetTimeout
= defaultSetTimout
;
14860 cachedSetTimeout
= defaultSetTimout
;
14863 if (typeof clearTimeout
=== 'function') {
14864 cachedClearTimeout
= clearTimeout
;
14866 cachedClearTimeout
= defaultClearTimeout
;
14869 cachedClearTimeout
= defaultClearTimeout
;
14872 function runTimeout(fun
) {
14873 if (cachedSetTimeout
=== setTimeout
) {
14874 //normal enviroments in sane situations
14875 return setTimeout(fun
, 0);
14877 // if setTimeout wasn't available but was latter defined
14878 if ((cachedSetTimeout
=== defaultSetTimout
|| !cachedSetTimeout
) && setTimeout
) {
14879 cachedSetTimeout
= setTimeout
;
14880 return setTimeout(fun
, 0);
14883 // when when somebody has screwed with setTimeout but no I.E. maddness
14884 return cachedSetTimeout(fun
, 0);
14887 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14888 return cachedSetTimeout
.call(null, fun
, 0);
14890 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
14891 return cachedSetTimeout
.call(this, fun
, 0);
14897 function runClearTimeout(marker
) {
14898 if (cachedClearTimeout
=== clearTimeout
) {
14899 //normal enviroments in sane situations
14900 return clearTimeout(marker
);
14902 // if clearTimeout wasn't available but was latter defined
14903 if ((cachedClearTimeout
=== defaultClearTimeout
|| !cachedClearTimeout
) && clearTimeout
) {
14904 cachedClearTimeout
= clearTimeout
;
14905 return clearTimeout(marker
);
14908 // when when somebody has screwed with setTimeout but no I.E. maddness
14909 return cachedClearTimeout(marker
);
14912 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
14913 return cachedClearTimeout
.call(null, marker
);
14915 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
14916 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
14917 return cachedClearTimeout
.call(this, marker
);
14925 var draining
= false;
14927 var queueIndex
= -1;
14929 function cleanUpNextTick() {
14930 if (!draining
|| !currentQueue
) {
14934 if (currentQueue
.length
) {
14935 queue
= currentQueue
.concat(queue
);
14939 if (queue
.length
) {
14944 function drainQueue() {
14948 var timeout
= runTimeout(cleanUpNextTick
);
14951 var len
= queue
.length
;
14953 currentQueue
= queue
;
14955 while (++queueIndex
< len
) {
14956 if (currentQueue
) {
14957 currentQueue
[queueIndex
].run();
14961 len
= queue
.length
;
14963 currentQueue
= null;
14965 runClearTimeout(timeout
);
14968 process
.nextTick = function (fun
) {
14969 var args
= new Array(arguments
.length
- 1);
14970 if (arguments
.length
> 1) {
14971 for (var i
= 1; i
< arguments
.length
; i
++) {
14972 args
[i
- 1] = arguments
[i
];
14975 queue
.push(new Item(fun
, args
));
14976 if (queue
.length
=== 1 && !draining
) {
14977 runTimeout(drainQueue
);
14981 // v8 likes predictible objects
14982 function Item(fun
, array
) {
14984 this.array
= array
;
14986 Item
.prototype.run = function () {
14987 this.fun
.apply(null, this.array
);
14989 process
.title
= 'browser';
14990 process
.browser
= true;
14993 process
.version
= ''; // empty string to avoid regexp issues
14994 process
.versions
= {};
14999 process
.addListener
= noop
;
15000 process
.once
= noop
;
15001 process
.off
= noop
;
15002 process
.removeListener
= noop
;
15003 process
.removeAllListeners
= noop
;
15004 process
.emit
= noop
;
15005 process
.prependListener
= noop
;
15006 process
.prependOnceListener
= noop
;
15008 process
.listeners = function (name
) { return [] }
15010 process
.binding = function (name
) {
15011 throw new Error('process.binding is not supported');
15014 process
.cwd = function () { return '/' };
15015 process
.chdir = function (dir
) {
15016 throw new Error('process.chdir is not supported');
15018 process
.umask = function() { return 0; };
15020 },{}],106:[function(require
,module
,exports
){
15021 module
.exports
= require('./lib/_stream_duplex.js');
15023 },{"./lib/_stream_duplex.js":107}],107:[function(require
,module
,exports
){
15024 // Copyright Joyent, Inc. and other Node contributors.
15026 // Permission is hereby granted, free of charge, to any person obtaining a
15027 // copy of this software and associated documentation files (the
15028 // "Software"), to deal in the Software without restriction, including
15029 // without limitation the rights to use, copy, modify, merge, publish,
15030 // distribute, sublicense, and/or sell copies of the Software, and to permit
15031 // persons to whom the Software is furnished to do so, subject to the
15032 // following conditions:
15034 // The above copyright notice and this permission notice shall be included
15035 // in all copies or substantial portions of the Software.
15037 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15038 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15039 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15040 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15041 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15042 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15043 // USE OR OTHER DEALINGS IN THE SOFTWARE.
15045 // a duplex stream is just a stream that is both readable and writable.
15046 // Since JS doesn't have multiple prototypal inheritance, this class
15047 // prototypally inherits from Readable, and then parasitically from
15054 var pna
= require('process-nextick-args');
15058 var objectKeys
= Object
.keys
|| function (obj
) {
15060 for (var key
in obj
) {
15066 module.exports = Duplex;
15069 var util
= require('core-util-is');
15070 util
.inherits
= require('inherits');
15073 var Readable = require('./_stream_readable');
15074 var Writable = require('./_stream_writable');
15076 util.inherits(Duplex, Readable);
15079 // avoid scope creep, the keys array can then be collected
15080 var keys = objectKeys(Writable.prototype);
15081 for (var v = 0; v < keys.length; v++) {
15082 var method = keys[v];
15083 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
15087 function Duplex(options) {
15088 if (!(this instanceof Duplex)) return new Duplex(options);
15090 Readable.call(this, options);
15091 Writable.call(this, options);
15093 if (options && options.readable === false) this.readable = false;
15095 if (options && options.writable === false) this.writable = false;
15097 this.allowHalfOpen = true;
15098 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
15100 this.once('end', onend);
15103 Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
15104 // making it explicit this property is not enumerable
15105 // because otherwise some prototype manipulation in
15106 // userland will fail
15109 return this._writableState.highWaterMark;
15113 // the no-half-open enforcer
15115 // if we allow half-open state, or if the writable side ended,
15117 if (this.allowHalfOpen || this._writableState.ended) return;
15119 // no more data can be written.
15120 // But allow more writes to happen in this tick.
15121 pna.nextTick(onEndNT, this);
15124 function onEndNT(self) {
15128 Object.defineProperty(Duplex.prototype, 'destroyed', {
15130 if (this._readableState === undefined || this._writableState === undefined) {
15133 return this._readableState.destroyed && this._writableState.destroyed;
15135 set: function (value) {
15136 // we ignore the value if the stream
15137 // has not been initialized yet
15138 if (this._readableState === undefined || this._writableState === undefined) {
15142 // backward compatibility, the user is explicitly
15143 // managing destroyed
15144 this._readableState.destroyed = value;
15145 this._writableState.destroyed = value;
15149 Duplex.prototype._destroy = function (err, cb) {
15153 pna.nextTick(cb, err);
15155 },{"./_stream_readable":109,"./_stream_writable":111,"core-util-is":97,"inherits":100,"process-nextick-args":104}],108:[function(require,module,exports){
15156 // Copyright Joyent, Inc. and other Node contributors.
15158 // Permission is hereby granted, free of charge, to any person obtaining a
15159 // copy of this software and associated documentation files (the
15160 // "Software"), to deal in the Software without restriction, including
15161 // without limitation the rights to use, copy, modify, merge, publish,
15162 // distribute, sublicense, and/or sell copies of the Software, and to permit
15163 // persons to whom the Software is furnished to do so, subject to the
15164 // following conditions:
15166 // The above copyright notice and this permission notice shall be included
15167 // in all copies or substantial portions of the Software.
15169 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15170 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15171 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15172 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15173 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15174 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15175 // USE OR OTHER DEALINGS IN THE SOFTWARE.
15177 // a passthrough stream.
15178 // basically just the most minimal sort of Transform stream.
15179 // Every written chunk gets output as-is.
15183 module.exports = PassThrough;
15185 var Transform = require('./_stream_transform');
15188 var util
= require('core-util-is');
15189 util
.inherits
= require('inherits');
15192 util.inherits(PassThrough, Transform);
15194 function PassThrough(options) {
15195 if (!(this instanceof PassThrough)) return new PassThrough(options);
15197 Transform.call(this, options);
15200 PassThrough.prototype._transform = function (chunk, encoding, cb) {
15203 },{"./_stream_transform":110,"core-util-is":97,"inherits":100}],109:[function(require,module,exports){
15204 (function (process,global){
15205 // Copyright Joyent, Inc. and other Node contributors.
15207 // Permission is hereby granted, free of charge, to any person obtaining a
15208 // copy of this software and associated documentation files (the
15209 // "Software"), to deal in the Software without restriction, including
15210 // without limitation the rights to use, copy, modify, merge, publish,
15211 // distribute, sublicense, and/or sell copies of the Software, and to permit
15212 // persons to whom the Software is furnished to do so, subject to the
15213 // following conditions:
15215 // The above copyright notice and this permission notice shall be included
15216 // in all copies or substantial portions of the Software.
15218 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15219 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15220 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15221 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15222 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15223 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
15224 // USE OR OTHER DEALINGS IN THE SOFTWARE.
15230 var pna
= require('process-nextick-args');
15233 module.exports = Readable;
15236 var isArray
= require('isarray');
15243 Readable.ReadableState = ReadableState;
15246 var EE
= require('events').EventEmitter
;
15248 var EElistenerCount = function (emitter
, type
) {
15249 return emitter
.listeners(type
).length
;
15254 var Stream
= require('./internal/streams/stream');
15259 var Buffer
= require('safe-buffer').Buffer
;
15260 var OurUint8Array
= global
.Uint8Array
|| function () {};
15261 function _uint8ArrayToBuffer(chunk
) {
15262 return Buffer
.from(chunk
);
15264 function _isUint8Array(obj
) {
15265 return Buffer
.isBuffer(obj
) || obj
instanceof OurUint8Array
;
15271 var util
= require('core-util-is');
15272 util
.inherits
= require('inherits');
15276 var debugUtil
= require('util');
15277 var debug
= void 0;
15278 if (debugUtil
&& debugUtil
.debuglog
) {
15279 debug
= debugUtil
.debuglog('stream');
15281 debug = function () {};
15285 var BufferList = require('./internal/streams/BufferList');
15286 var destroyImpl = require('./internal/streams/destroy');
15289 util.inherits(Readable, Stream);
15291 var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
15293 function prependListener(emitter, event, fn) {
15294 // Sadly this is not cacheable as some libraries bundle their own
15295 // event emitter implementation with them.
15296 if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
15298 // This is a hack to make sure that our error handler is attached before any
15299 // userland ones. NEVER DO THIS. This is here only because this code needs
15300 // to continue to work with older versions of Node.js that do not include
15301 // the prependListener() method. The goal is to eventually remove this hack.
15302 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
15305 function ReadableState(options, stream) {
15306 Duplex = Duplex || require('./_stream_duplex');
15308 options = options || {};
15310 // Duplex streams are both readable and writable, but share
15311 // the same options object.
15312 // However, some cases require setting options to different
15313 // values for the readable and the writable sides of the duplex stream.
15314 // These options can be provided separately as readableXXX and writableXXX.
15315 var isDuplex = stream instanceof Duplex;
15317 // object stream flag. Used to make read(n) ignore n and to
15318 // make all the buffer merging and length checks go away
15319 this.objectMode = !!options.objectMode;
15321 if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
15323 // the point at which it stops calling _read() to fill the buffer
15324 // Note: 0 is a valid value, means "don't call _read preemptively ever"
15325 var hwm = options.highWaterMark;
15326 var readableHwm = options.readableHighWaterMark;
15327 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
15329 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
15332 this.highWaterMark = Math.floor(this.highWaterMark);
15334 // A linked list is used to store data chunks instead of an array because the
15335 // linked list can remove elements from the beginning faster than
15337 this.buffer = new BufferList();
15340 this.pipesCount = 0;
15341 this.flowing = null;
15342 this.ended = false;
15343 this.endEmitted = false;
15344 this.reading = false;
15346 // a flag to be able to tell if the event 'readable'/'data' is emitted
15347 // immediately, or on a later tick. We set this to true at first, because
15348 // any actions that shouldn't happen until "later" should generally also
15349 // not happen before the first read call.
15352 // whenever we return null, then we set a flag to say
15353 // that we're awaiting a 'readable' event emission.
15354 this.needReadable = false;
15355 this.emittedReadable = false;
15356 this.readableListening = false;
15357 this.resumeScheduled = false;
15359 // has it been destroyed
15360 this.destroyed = false;
15362 // Crypto is kind of old and crusty. Historically, its default string
15363 // encoding is 'binary' so we have to make this configurable.
15364 // Everything else in the universe uses 'utf8', though.
15365 this.defaultEncoding = options.defaultEncoding || 'utf8';
15367 // the number of writers that are awaiting a drain event in .pipe()s
15368 this.awaitDrain = 0;
15370 // if true, a maybeReadMore has been scheduled
15371 this.readingMore = false;
15373 this.decoder = null;
15374 this.encoding = null;
15375 if (options.encoding) {
15376 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15377 this.decoder = new StringDecoder(options.encoding);
15378 this.encoding = options.encoding;
15382 function Readable(options) {
15383 Duplex = Duplex || require('./_stream_duplex');
15385 if (!(this instanceof Readable)) return new Readable(options);
15387 this._readableState = new ReadableState(options, this);
15390 this.readable = true;
15393 if (typeof options.read === 'function') this._read = options.read;
15395 if (typeof options.destroy === 'function') this._destroy = options.destroy;
15401 Object.defineProperty(Readable.prototype, 'destroyed', {
15403 if (this._readableState === undefined) {
15406 return this._readableState.destroyed;
15408 set: function (value) {
15409 // we ignore the value if the stream
15410 // has not been initialized yet
15411 if (!this._readableState) {
15415 // backward compatibility, the user is explicitly
15416 // managing destroyed
15417 this._readableState.destroyed = value;
15421 Readable.prototype.destroy = destroyImpl.destroy;
15422 Readable.prototype._undestroy = destroyImpl.undestroy;
15423 Readable.prototype._destroy = function (err, cb) {
15428 // Manually shove something into the read() buffer.
15429 // This returns true if the highWaterMark has not been hit yet,
15430 // similar to how Writable.write() returns true if you should
15431 // write() some more.
15432 Readable.prototype.push = function (chunk, encoding) {
15433 var state = this._readableState;
15434 var skipChunkCheck;
15436 if (!state.objectMode) {
15437 if (typeof chunk === 'string') {
15438 encoding = encoding || state.defaultEncoding;
15439 if (encoding !== state.encoding) {
15440 chunk = Buffer.from(chunk, encoding);
15443 skipChunkCheck = true;
15446 skipChunkCheck = true;
15449 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
15452 // Unshift should *always* be something directly out of read()
15453 Readable.prototype.unshift = function (chunk) {
15454 return readableAddChunk(this, chunk, null, true, false);
15457 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
15458 var state = stream._readableState;
15459 if (chunk === null) {
15460 state.reading = false;
15461 onEofChunk(stream, state);
15464 if (!skipChunkCheck) er = chunkInvalid(state, chunk);
15466 stream.emit('error', er);
15467 } else if (state.objectMode || chunk && chunk.length > 0) {
15468 if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
15469 chunk = _uint8ArrayToBuffer(chunk);
15473 if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
15474 } else if (state.ended) {
15475 stream.emit('error', new Error('stream.push() after EOF'));
15477 state.reading = false;
15478 if (state.decoder && !encoding) {
15479 chunk = state.decoder.write(chunk);
15480 if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
15482 addChunk(stream, state, chunk, false);
15485 } else if (!addToFront) {
15486 state.reading = false;
15490 return needMoreData(state);
15493 function addChunk(stream, state, chunk, addToFront) {
15494 if (state.flowing && state.length === 0 && !state.sync) {
15495 stream.emit('data', chunk);
15498 // update the buffer info.
15499 state.length += state.objectMode ? 1 : chunk.length;
15500 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
15502 if (state.needReadable) emitReadable(stream);
15504 maybeReadMore(stream, state);
15507 function chunkInvalid(state, chunk) {
15509 if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
15510 er = new TypeError('Invalid non-string/buffer chunk');
15515 // if it's past the high water mark, we can push in some more.
15516 // Also, if we have no data yet, we can stand some
15517 // more bytes. This is to work around cases where hwm=0,
15518 // such as the repl. Also, if the push() triggered a
15519 // readable event, and the user called read(largeNumber) such that
15520 // needReadable was set, then we ought to push more, so that another
15521 // 'readable' event will be triggered.
15522 function needMoreData(state) {
15523 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
15526 Readable.prototype.isPaused = function () {
15527 return this._readableState.flowing === false;
15530 // backwards compatibility.
15531 Readable.prototype.setEncoding = function (enc) {
15532 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
15533 this._readableState.decoder = new StringDecoder(enc);
15534 this._readableState.encoding = enc;
15538 // Don't raise the hwm > 8MB
15539 var MAX_HWM = 0x800000;
15540 function computeNewHighWaterMark(n) {
15541 if (n >= MAX_HWM) {
15544 // Get the next highest power of 2 to prevent increasing hwm excessively in
15557 // This function is designed to be inlinable, so please take care when making
15558 // changes to the function body.
15559 function howMuchToRead(n, state) {
15560 if (n <= 0 || state.length === 0 && state.ended) return 0;
15561 if (state.objectMode) return 1;
15563 // Only flow one buffer at a time
15564 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
15566 // If we're asking for more than the current hwm, then raise the hwm.
15567 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
15568 if (n <= state.length) return n;
15569 // Don't have enough
15570 if (!state.ended) {
15571 state.needReadable = true;
15574 return state.length;
15577 // you can override either this method, or the async _read(n) below.
15578 Readable.prototype.read = function (n) {
15580 n = parseInt(n, 10);
15581 var state = this._readableState;
15584 if (n !== 0) state.emittedReadable = false;
15586 // if we're doing read(0) to trigger a readable event, but we
15587 // already have a bunch of data in the buffer, then just trigger
15588 // the 'readable' event and move on.
15589 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
15590 debug('read: emitReadable', state.length, state.ended);
15591 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
15595 n = howMuchToRead(n, state);
15597 // if we've ended, and we're now clear, then finish it up.
15598 if (n === 0 && state.ended) {
15599 if (state.length === 0) endReadable(this);
15603 // All the actual chunk generation logic needs to be
15604 // *below* the call to _read. The reason is that in certain
15605 // synthetic stream cases, such as passthrough streams, _read
15606 // may be a completely synchronous operation which may change
15607 // the state of the read buffer, providing enough data when
15608 // before there was *not* enough.
15610 // So, the steps are:
15611 // 1. Figure out what the state of things will be after we do
15612 // a read from the buffer.
15614 // 2. If that resulting state will trigger a _read, then call _read.
15615 // Note that this may be asynchronous, or synchronous. Yes, it is
15616 // deeply ugly to write APIs this way, but that still doesn't mean
15617 // that the Readable class should behave improperly, as streams are
15618 // designed to be sync/async agnostic.
15619 // Take note if the _read call is sync or async (ie, if the read call
15620 // has returned yet), so that we know whether or not it's safe to emit
15623 // 3. Actually pull the requested chunks out of the buffer and return.
15625 // if we need a readable event, then we need to do some reading.
15626 var doRead = state.needReadable;
15627 debug('need readable', doRead);
15629 // if we currently have less than the highWaterMark, then also read some
15630 if (state.length === 0 || state.length - n < state.highWaterMark) {
15632 debug('length less than watermark', doRead);
15635 // however, if we've ended, then there's no point, and if we're already
15636 // reading, then it's unnecessary.
15637 if (state.ended || state.reading) {
15639 debug('reading or ended', doRead);
15640 } else if (doRead) {
15642 state.reading = true;
15644 // if the length is currently zero, then we *need* a readable event.
15645 if (state.length === 0) state.needReadable = true;
15646 // call internal read method
15647 this._read(state.highWaterMark);
15648 state.sync = false;
15649 // If _read pushed data synchronously, then `reading` will be false,
15650 // and we need to re-evaluate how much data we can return to the user.
15651 if (!state.reading) n = howMuchToRead(nOrig, state);
15655 if (n > 0) ret = fromList(n, state);else ret = null;
15657 if (ret === null) {
15658 state.needReadable = true;
15664 if (state.length === 0) {
15665 // If we have nothing in the buffer, then we want to know
15666 // as soon as we *do* get something into the buffer.
15667 if (!state.ended) state.needReadable = true;
15669 // If we tried to read() past the EOF, then emit end on the next tick.
15670 if (nOrig !== n && state.ended) endReadable(this);
15673 if (ret !== null) this.emit('data', ret);
15678 function onEofChunk(stream, state) {
15679 if (state.ended) return;
15680 if (state.decoder) {
15681 var chunk = state.decoder.end();
15682 if (chunk && chunk.length) {
15683 state.buffer.push(chunk);
15684 state.length += state.objectMode ? 1 : chunk.length;
15687 state.ended = true;
15689 // emit 'readable' now to make sure it gets picked up.
15690 emitReadable(stream);
15693 // Don't emit readable right away in sync mode, because this can trigger
15694 // another read() call => stack overflow. This way, it might trigger
15695 // a nextTick recursion warning, but that's not so bad.
15696 function emitReadable(stream) {
15697 var state = stream._readableState;
15698 state.needReadable = false;
15699 if (!state.emittedReadable) {
15700 debug('emitReadable', state.flowing);
15701 state.emittedReadable = true;
15702 if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
15706 function emitReadable_(stream) {
15707 debug('emit readable');
15708 stream.emit('readable');
15712 // at this point, the user has presumably seen the 'readable' event,
15713 // and called read() to consume some data. that may have triggered
15714 // in turn another _read(n) call, in which case reading = true if
15715 // it's in progress.
15716 // However, if we're not ended, or reading, and the length < hwm,
15717 // then go ahead and try to read some more preemptively.
15718 function maybeReadMore(stream, state) {
15719 if (!state.readingMore) {
15720 state.readingMore = true;
15721 pna.nextTick(maybeReadMore_, stream, state);
15725 function maybeReadMore_(stream, state) {
15726 var len = state.length;
15727 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
15728 debug('maybeReadMore read 0');
15730 if (len === state.length)
15731 // didn't get any data, stop spinning.
15732 break;else len = state.length;
15734 state.readingMore = false;
15737 // abstract method. to be overridden in specific implementation classes.
15738 // call cb(er, data) where data is <= n in length.
15739 // for virtual (non-string, non-buffer) streams, "length" is somewhat
15740 // arbitrary, and perhaps not very meaningful.
15741 Readable.prototype._read = function (n) {
15742 this.emit('error', new Error('_read() is not implemented'));
15745 Readable.prototype.pipe = function (dest, pipeOpts) {
15747 var state = this._readableState;
15749 switch (state.pipesCount) {
15751 state.pipes = dest;
15754 state.pipes = [state.pipes, dest];
15757 state.pipes.push(dest);
15760 state.pipesCount += 1;
15761 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
15763 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
15765 var endFn = doEnd ? onend : unpipe;
15766 if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
15768 dest.on('unpipe', onunpipe);
15769 function onunpipe(readable, unpipeInfo) {
15771 if (readable === src) {
15772 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
15773 unpipeInfo.hasUnpiped = true;
15784 // when the dest drains, it reduces the awaitDrain counter
15785 // on the source. This would be more elegant with a .once()
15786 // handler in flow(), but adding and removing repeatedly is
15788 var ondrain = pipeOnDrain(src);
15789 dest.on('drain', ondrain);
15791 var cleanedUp = false;
15792 function cleanup() {
15794 // cleanup event handlers once the pipe is broken
15795 dest.removeListener('close', onclose);
15796 dest.removeListener('finish', onfinish);
15797 dest.removeListener('drain', ondrain);
15798 dest.removeListener('error', onerror);
15799 dest.removeListener('unpipe', onunpipe);
15800 src.removeListener('end', onend);
15801 src.removeListener('end', unpipe);
15802 src.removeListener('data', ondata);
15806 // if the reader is waiting for a drain event from this
15807 // specific writer, then it would cause it to never start
15809 // So, if this is awaiting a drain, then we just call it now.
15810 // If we don't know, then assume that we are waiting for one.
15811 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
15814 // If the user pushes more data while we're writing to dest then we'll end up
15815 // in ondata again. However, we only want to increase awaitDrain once because
15816 // dest will only emit one 'drain' event for the multiple writes.
15817 // => Introduce a guard on increasing awaitDrain.
15818 var increasedAwaitDrain = false;
15819 src.on('data', ondata);
15820 function ondata(chunk) {
15822 increasedAwaitDrain = false;
15823 var ret = dest.write(chunk);
15824 if (false === ret && !increasedAwaitDrain) {
15825 // If the user unpiped during `dest.write()`, it is possible
15826 // to get stuck in a permanently paused state if that write
15827 // also returned false.
15828 // => Check whether `dest` is still a piping destination.
15829 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
15830 debug('false write response, pause', src._readableState.awaitDrain);
15831 src._readableState.awaitDrain++;
15832 increasedAwaitDrain = true;
15838 // if the dest has an error, then stop piping into it.
15839 // however, don't suppress the throwing behavior for this.
15840 function onerror(er) {
15841 debug('onerror', er);
15843 dest.removeListener('error', onerror);
15844 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
15847 // Make sure our error handler is attached before userland ones.
15848 prependListener(dest, 'error', onerror);
15850 // Both close and finish should trigger unpipe, but only once.
15851 function onclose() {
15852 dest.removeListener('finish', onfinish);
15855 dest.once('close', onclose);
15856 function onfinish() {
15858 dest.removeListener('close', onclose);
15861 dest.once('finish', onfinish);
15863 function unpipe() {
15868 // tell the dest that it's being piped to
15869 dest.emit('pipe', src);
15871 // start the flow if it hasn't been started already.
15872 if (!state.flowing) {
15873 debug('pipe resume');
15880 function pipeOnDrain(src) {
15881 return function () {
15882 var state = src._readableState;
15883 debug('pipeOnDrain', state.awaitDrain);
15884 if (state.awaitDrain) state.awaitDrain--;
15885 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
15886 state.flowing = true;
15892 Readable.prototype.unpipe = function (dest) {
15893 var state = this._readableState;
15894 var unpipeInfo = { hasUnpiped: false };
15896 // if we're not piping anywhere, then do nothing.
15897 if (state.pipesCount === 0) return this;
15899 // just one destination. most common case.
15900 if (state.pipesCount === 1) {
15901 // passed in one, but it's not the right one.
15902 if (dest && dest !== state.pipes) return this;
15904 if (!dest) dest = state.pipes;
15907 state.pipes = null;
15908 state.pipesCount = 0;
15909 state.flowing = false;
15910 if (dest) dest.emit('unpipe', this, unpipeInfo);
15914 // slow case. multiple pipe destinations.
15918 var dests = state.pipes;
15919 var len = state.pipesCount;
15920 state.pipes = null;
15921 state.pipesCount = 0;
15922 state.flowing = false;
15924 for (var i = 0; i < len; i++) {
15925 dests[i].emit('unpipe', this, unpipeInfo);
15929 // try to find the right one.
15930 var index = indexOf(state.pipes, dest);
15931 if (index === -1) return this;
15933 state.pipes.splice(index, 1);
15934 state.pipesCount -= 1;
15935 if (state.pipesCount === 1) state.pipes = state.pipes[0];
15937 dest.emit('unpipe', this, unpipeInfo);
15942 // set up data events if they are asked for
15943 // Ensure readable listeners eventually get something
15944 Readable.prototype.on = function (ev, fn) {
15945 var res = Stream.prototype.on.call(this, ev, fn);
15947 if (ev === 'data') {
15948 // Start flowing on next tick if stream isn't explicitly paused
15949 if (this._readableState.flowing !== false) this.resume();
15950 } else if (ev === 'readable') {
15951 var state = this._readableState;
15952 if (!state.endEmitted && !state.readableListening) {
15953 state.readableListening = state.needReadable = true;
15954 state.emittedReadable = false;
15955 if (!state.reading) {
15956 pna.nextTick(nReadingNextTick, this);
15957 } else if (state.length) {
15958 emitReadable(this);
15965 Readable.prototype.addListener = Readable.prototype.on;
15967 function nReadingNextTick(self) {
15968 debug('readable nexttick read 0');
15972 // pause() and resume() are remnants of the legacy readable stream API
15973 // If the user uses them, then switch into old mode.
15974 Readable.prototype.resume = function () {
15975 var state = this._readableState;
15976 if (!state.flowing) {
15978 state.flowing = true;
15979 resume(this, state);
15984 function resume(stream, state) {
15985 if (!state.resumeScheduled) {
15986 state.resumeScheduled = true;
15987 pna.nextTick(resume_, stream, state);
15991 function resume_(stream, state) {
15992 if (!state.reading) {
15993 debug('resume read 0');
15997 state.resumeScheduled = false;
15998 state.awaitDrain = 0;
15999 stream.emit('resume');
16001 if (state.flowing && !state.reading) stream.read(0);
16004 Readable.prototype.pause = function () {
16005 debug('call pause flowing=%j', this._readableState.flowing);
16006 if (false !== this._readableState.flowing) {
16008 this._readableState.flowing = false;
16009 this.emit('pause');
16014 function flow(stream) {
16015 var state = stream._readableState;
16016 debug('flow', state.flowing);
16017 while (state.flowing && stream.read() !== null) {}
16020 // wrap an old-style stream as the async data source.
16021 // This is *not* part of the readable stream interface.
16022 // It is an ugly unfortunate mess of history.
16023 Readable.prototype.wrap = function (stream) {
16026 var state = this._readableState;
16027 var paused = false;
16029 stream.on('end', function () {
16030 debug('wrapped end');
16031 if (state.decoder && !state.ended) {
16032 var chunk = state.decoder.end();
16033 if (chunk && chunk.length) _this.push(chunk);
16039 stream.on('data', function (chunk) {
16040 debug('wrapped data');
16041 if (state.decoder) chunk = state.decoder.write(chunk);
16043 // don't skip over falsy values in objectMode
16044 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
16046 var ret = _this.push(chunk);
16053 // proxy all the other methods.
16054 // important when wrapping filters and duplexes.
16055 for (var i in stream) {
16056 if (this[i] === undefined && typeof stream[i] === 'function') {
16057 this[i] = function (method) {
16058 return function () {
16059 return stream[method].apply(stream, arguments);
16065 // proxy certain important events.
16066 for (var n = 0; n < kProxyEvents.length; n++) {
16067 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
16070 // when we try to consume some more bytes, simply unpause the
16071 // underlying stream.
16072 this._read = function (n) {
16073 debug('wrapped _read', n);
16083 Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
16084 // making it explicit this property is not enumerable
16085 // because otherwise some prototype manipulation in
16086 // userland will fail
16089 return this._readableState.highWaterMark;
16093 // exposed for testing purposes only.
16094 Readable._fromList = fromList;
16096 // Pluck off n bytes from an array of buffers.
16097 // Length is the combined lengths of all the buffers in the list.
16098 // This function is designed to be inlinable, so please take care when making
16099 // changes to the function body.
16100 function fromList(n, state) {
16101 // nothing buffered
16102 if (state.length === 0) return null;
16105 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
16106 // read it all, truncate the list
16107 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
16108 state.buffer.clear();
16110 // read part of list
16111 ret = fromListPartial(n, state.buffer, state.decoder);
16117 // Extracts only enough buffered data to satisfy the amount requested.
16118 // This function is designed to be inlinable, so please take care when making
16119 // changes to the function body.
16120 function fromListPartial(n, list, hasStrings) {
16122 if (n < list.head.data.length) {
16123 // slice is the same for buffers and strings
16124 ret = list.head.data.slice(0, n);
16125 list.head.data = list.head.data.slice(n);
16126 } else if (n === list.head.data.length) {
16127 // first chunk is a perfect match
16128 ret = list.shift();
16130 // result spans more than one buffer
16131 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
16136 // Copies a specified amount of characters from the list of buffered data
16138 // This function is designed to be inlinable, so please take care when making
16139 // changes to the function body.
16140 function copyFromBufferString(n, list) {
16145 while (p = p.next) {
16147 var nb = n > str.length ? str.length : n;
16148 if (nb === str.length) ret += str;else ret += str.slice(0, n);
16151 if (nb === str.length) {
16153 if (p.next) list.head = p.next;else list.head = list.tail = null;
16156 p.data = str.slice(nb);
16166 // Copies a specified amount of bytes from the list of buffered data chunks.
16167 // This function is designed to be inlinable, so please take care when making
16168 // changes to the function body.
16169 function copyFromBuffer(n, list) {
16170 var ret = Buffer.allocUnsafe(n);
16174 n -= p.data.length;
16175 while (p = p.next) {
16177 var nb = n > buf.length ? buf.length : n;
16178 buf.copy(ret, ret.length - n, 0, nb);
16181 if (nb === buf.length) {
16183 if (p.next) list.head = p.next;else list.head = list.tail = null;
16186 p.data = buf.slice(nb);
16196 function endReadable(stream) {
16197 var state = stream._readableState;
16199 // If we get here before consuming all the bytes, then that is a
16200 // bug in node. Should never happen.
16201 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
16203 if (!state.endEmitted) {
16204 state.ended = true;
16205 pna.nextTick(endReadableNT, state, stream);
16209 function endReadableNT(state, stream) {
16210 // Check that we didn't get one last unshift.
16211 if (!state.endEmitted && state.length === 0) {
16212 state.endEmitted = true;
16213 stream.readable = false;
16214 stream.emit('end');
16218 function indexOf(xs, x) {
16219 for (var i = 0, l = xs.length; i < l; i++) {
16220 if (xs[i] === x) return i;
16224 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
16225 },{"./_stream_duplex":107,"./internal/streams/BufferList":112,"./internal/streams/destroy":113,"./internal/streams/stream":114,"_process":105,"core-util-is":97,"events":98,"inherits":100,"isarray":102,"process-nextick-args":104,"safe-buffer":115,"string_decoder/":116,"util":95}],110:[function(require,module,exports){
16226 // Copyright Joyent, Inc. and other Node contributors.
16228 // Permission is hereby granted, free of charge, to any person obtaining a
16229 // copy of this software and associated documentation files (the
16230 // "Software"), to deal in the Software without restriction, including
16231 // without limitation the rights to use, copy, modify, merge, publish,
16232 // distribute, sublicense, and/or sell copies of the Software, and to permit
16233 // persons to whom the Software is furnished to do so, subject to the
16234 // following conditions:
16236 // The above copyright notice and this permission notice shall be included
16237 // in all copies or substantial portions of the Software.
16239 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16240 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16241 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16242 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16243 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16244 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16245 // USE OR OTHER DEALINGS IN THE SOFTWARE.
16247 // a transform stream is a readable/writable stream where you do
16248 // something with the data. Sometimes it's called a "filter",
16249 // but that's not a great name for it, since that implies a thing where
16250 // some bits pass through, and others are simply ignored. (That would
16251 // be a valid example of a transform, of course.)
16253 // While the output is causally related to the input, it's not a
16254 // necessarily symmetric or synchronous transformation. For example,
16255 // a zlib stream might take multiple plain-text writes(), and then
16256 // emit a single compressed chunk some time in the future.
16258 // Here's how this works:
16260 // The Transform stream has all the aspects of the readable and writable
16261 // stream classes. When you write(chunk), that calls _write(chunk,cb)
16262 // internally, and returns false if there's a lot of pending writes
16263 // buffered up. When you call read(), that calls _read(n) until
16264 // there's enough pending readable data buffered up.
16266 // In a transform stream, the written data is placed in a buffer. When
16267 // _read(n) is called, it transforms the queued up data, calling the
16268 // buffered _write cb's as it consumes chunks. If consuming a single
16269 // written chunk would result in multiple output chunks, then the first
16270 // outputted bit calls the readcb, and subsequent chunks just go into
16271 // the read buffer, and will cause it to emit 'readable' if necessary.
16273 // This way, back-pressure is actually determined by the reading side,
16274 // since _read has to be called to start processing a new chunk. However,
16275 // a pathological inflate type of transform can cause excessive buffering
16276 // here. For example, imagine a stream where every byte of input is
16277 // interpreted as an integer from 0-255, and then results in that many
16278 // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
16279 // 1kb of data being output. In this case, you could write a very small
16280 // amount of input, and end up with a very large amount of output. In
16281 // such a pathological inflating mechanism, there'd be no way to tell
16282 // the system to stop doing the transform. A single 4MB write could
16283 // cause the system to run out of memory.
16285 // However, even in such a pathological case, only a single written chunk
16286 // would be consumed, and then the rest would wait (un-transformed) until
16287 // the results of the previous transformed chunk were consumed.
16291 module.exports = Transform;
16293 var Duplex = require('./_stream_duplex');
16296 var util
= require('core-util-is');
16297 util
.inherits
= require('inherits');
16300 util.inherits(Transform, Duplex);
16302 function afterTransform(er, data) {
16303 var ts = this._transformState;
16304 ts.transforming = false;
16306 var cb = ts.writecb;
16309 return this.emit('error', new Error('write callback called multiple times'));
16312 ts.writechunk = null;
16315 if (data != null) // single equals check for both `null` and `undefined`
16320 var rs = this._readableState;
16321 rs.reading = false;
16322 if (rs.needReadable || rs.length < rs.highWaterMark) {
16323 this._read(rs.highWaterMark);
16327 function Transform(options) {
16328 if (!(this instanceof Transform)) return new Transform(options);
16330 Duplex.call(this, options);
16332 this._transformState = {
16333 afterTransform: afterTransform.bind(this),
16334 needTransform: false,
16335 transforming: false,
16338 writeencoding: null
16341 // start out asking for a readable event once data is transformed.
16342 this._readableState.needReadable = true;
16344 // we have implemented the _read method, and done the other things
16345 // that Readable wants before the first _read call, so unset the
16346 // sync guard flag.
16347 this._readableState.sync = false;
16350 if (typeof options.transform === 'function') this._transform = options.transform;
16352 if (typeof options.flush === 'function') this._flush = options.flush;
16355 // When the writable side finishes, then flush out anything remaining.
16356 this.on('prefinish', prefinish);
16359 function prefinish() {
16362 if (typeof this._flush === 'function') {
16363 this._flush(function (er, data) {
16364 done(_this, er, data);
16367 done(this, null, null);
16371 Transform.prototype.push = function (chunk, encoding) {
16372 this._transformState.needTransform = false;
16373 return Duplex.prototype.push.call(this, chunk, encoding);
16376 // This is the part where you do stuff!
16377 // override this function in implementation classes.
16378 // 'chunk' is an input chunk.
16380 // Call `push(newChunk)` to pass along transformed output
16381 // to the readable side. You may call 'push' zero or more times.
16383 // Call `cb(err)` when you are done with this chunk. If you pass
16384 // an error, then that'll put the hurt on the whole operation. If you
16385 // never call cb(), then you'll never get another chunk.
16386 Transform.prototype._transform = function (chunk, encoding, cb) {
16387 throw new Error('_transform() is not implemented');
16390 Transform.prototype._write = function (chunk, encoding, cb) {
16391 var ts = this._transformState;
16393 ts.writechunk = chunk;
16394 ts.writeencoding = encoding;
16395 if (!ts.transforming) {
16396 var rs = this._readableState;
16397 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
16401 // Doesn't matter what the args are here.
16402 // _transform does all the work.
16403 // That we got here means that the readable side wants more data.
16404 Transform.prototype._read = function (n) {
16405 var ts = this._transformState;
16407 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
16408 ts.transforming = true;
16409 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
16411 // mark that we need a transform, so that any data that comes in
16412 // will get processed, now that we've asked for it.
16413 ts.needTransform = true;
16417 Transform.prototype._destroy = function (err, cb) {
16420 Duplex.prototype._destroy.call(this, err, function (err2) {
16422 _this2.emit('close');
16426 function done(stream, er, data) {
16427 if (er) return stream.emit('error', er);
16429 if (data != null) // single equals check for both `null` and `undefined`
16432 // if there's nothing in the write buffer, then that means
16433 // that nothing more will ever be provided
16434 if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
16436 if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
16438 return stream.push(null);
16440 },{"./_stream_duplex":107,"core-util-is":97,"inherits":100}],111:[function(require,module,exports){
16441 (function (process,global,setImmediate){
16442 // Copyright Joyent, Inc. and other Node contributors.
16444 // Permission is hereby granted, free of charge, to any person obtaining a
16445 // copy of this software and associated documentation files (the
16446 // "Software"), to deal in the Software without restriction, including
16447 // without limitation the rights to use, copy, modify, merge, publish,
16448 // distribute, sublicense, and/or sell copies of the Software, and to permit
16449 // persons to whom the Software is furnished to do so, subject to the
16450 // following conditions:
16452 // The above copyright notice and this permission notice shall be included
16453 // in all copies or substantial portions of the Software.
16455 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16456 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16457 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16458 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16459 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16460 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16461 // USE OR OTHER DEALINGS IN THE SOFTWARE.
16463 // A bit simpler than readable streams.
16464 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
16465 // the drain event emission and buffering.
16471 var pna
= require('process-nextick-args');
16474 module.exports = Writable;
16476 /* <replacement> */
16477 function WriteReq(chunk
, encoding
, cb
) {
16478 this.chunk
= chunk
;
16479 this.encoding
= encoding
;
16480 this.callback
= cb
;
16484 // It seems a linked list but it is not
16485 // there will be only 2 of these for each stream
16486 function CorkedRequest(state
) {
16491 this.finish = function () {
16492 onCorkedFinish(_this
, state
);
16495 /* </replacement> */
16498 var asyncWrite
= !process
.browser
&& ['v0.10', 'v0.9.'].indexOf(process
.version
.slice(0, 5)) > -1 ? setImmediate : pna
.nextTick
;
16505 Writable.WritableState = WritableState;
16508 var util
= require('core-util-is');
16509 util
.inherits
= require('inherits');
16513 var internalUtil
= {
16514 deprecate: require('util-deprecate')
16519 var Stream
= require('./internal/streams/stream');
16524 var Buffer
= require('safe-buffer').Buffer
;
16525 var OurUint8Array
= global
.Uint8Array
|| function () {};
16526 function _uint8ArrayToBuffer(chunk
) {
16527 return Buffer
.from(chunk
);
16529 function _isUint8Array(obj
) {
16530 return Buffer
.isBuffer(obj
) || obj
instanceof OurUint8Array
;
16535 var destroyImpl = require('./internal/streams/destroy');
16537 util.inherits(Writable, Stream);
16541 function WritableState(options, stream) {
16542 Duplex = Duplex || require('./_stream_duplex');
16544 options = options || {};
16546 // Duplex streams are both readable and writable, but share
16547 // the same options object.
16548 // However, some cases require setting options to different
16549 // values for the readable and the writable sides of the duplex stream.
16550 // These options can be provided separately as readableXXX and writableXXX.
16551 var isDuplex = stream instanceof Duplex;
16553 // object stream flag to indicate whether or not this stream
16554 // contains buffers or objects.
16555 this.objectMode = !!options.objectMode;
16557 if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
16559 // the point at which write() starts returning false
16560 // Note: 0 is a valid value, means that we always return false if
16561 // the entire buffer is not flushed immediately on write()
16562 var hwm = options.highWaterMark;
16563 var writableHwm = options.writableHighWaterMark;
16564 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
16566 if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
16569 this.highWaterMark = Math.floor(this.highWaterMark);
16571 // if _final has been called
16572 this.finalCalled = false;
16574 // drain event flag.
16575 this.needDrain = false;
16576 // at the start of calling end()
16577 this.ending = false;
16578 // when end() has been called, and returned
16579 this.ended = false;
16580 // when 'finish' is emitted
16581 this.finished = false;
16583 // has it been destroyed
16584 this.destroyed = false;
16586 // should we decode strings into buffers before passing to _write?
16587 // this is here so that some node-core streams can optimize string
16588 // handling at a lower level.
16589 var noDecode = options.decodeStrings === false;
16590 this.decodeStrings = !noDecode;
16592 // Crypto is kind of old and crusty. Historically, its default string
16593 // encoding is 'binary' so we have to make this configurable.
16594 // Everything else in the universe uses 'utf8', though.
16595 this.defaultEncoding = options.defaultEncoding || 'utf8';
16597 // not an actual buffer we keep track of, but a measurement
16598 // of how much we're waiting to get pushed to some underlying
16602 // a flag to see when we're in the middle of a write.
16603 this.writing = false;
16605 // when true all writes will be buffered until .uncork() call
16608 // a flag to be able to tell if the onwrite cb is called immediately,
16609 // or on a later tick. We set this to true at first, because any
16610 // actions that shouldn't happen until "later" should generally also
16611 // not happen before the first write call.
16614 // a flag to know if we're processing previously buffered items, which
16615 // may call the _write() callback in the same tick, so that we don't
16616 // end up in an overlapped onwrite situation.
16617 this.bufferProcessing = false;
16619 // the callback that's passed to _write(chunk,cb)
16620 this.onwrite = function (er) {
16621 onwrite(stream, er);
16624 // the callback that the user supplies to write(chunk,encoding,cb)
16625 this.writecb = null;
16627 // the amount that is being written when _write is called.
16630 this.bufferedRequest = null;
16631 this.lastBufferedRequest = null;
16633 // number of pending user-supplied write callbacks
16634 // this must be 0 before 'finish' can be emitted
16635 this.pendingcb = 0;
16637 // emit prefinish if the only thing we're waiting for is _write cbs
16638 // This is relevant for synchronous Transform streams
16639 this.prefinished = false;
16641 // True if the error was already emitted and should not be thrown again
16642 this.errorEmitted = false;
16644 // count buffered requests
16645 this.bufferedRequestCount = 0;
16647 // allocate the first CorkedRequest, there is always
16648 // one allocated and free to use, and we maintain at most two
16649 this.corkedRequestsFree = new CorkedRequest(this);
16652 WritableState.prototype.getBuffer = function getBuffer() {
16653 var current = this.bufferedRequest;
16657 current = current.next;
16664 Object.defineProperty(WritableState.prototype, 'buffer', {
16665 get: internalUtil.deprecate(function () {
16666 return this.getBuffer();
16667 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
16672 // Test _writableState for inheritance to account for Duplex streams,
16673 // whose prototype chain only points to Readable.
16674 var realHasInstance;
16675 if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
16676 realHasInstance = Function.prototype[Symbol.hasInstance];
16677 Object.defineProperty(Writable, Symbol.hasInstance, {
16678 value: function (object) {
16679 if (realHasInstance.call(this, object)) return true;
16680 if (this !== Writable) return false;
16682 return object && object._writableState instanceof WritableState;
16686 realHasInstance = function (object) {
16687 return object instanceof this;
16691 function Writable(options) {
16692 Duplex = Duplex || require('./_stream_duplex');
16694 // Writable ctor is applied to Duplexes, too.
16695 // `realHasInstance` is necessary because using plain `instanceof`
16696 // would return false, as no `_writableState` property is attached.
16698 // Trying to use the custom `instanceof` for Writable here will also break the
16699 // Node.js LazyTransform implementation, which has a non-trivial getter for
16700 // `_writableState` that would lead to infinite recursion.
16701 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
16702 return new Writable(options);
16705 this._writableState = new WritableState(options, this);
16708 this.writable = true;
16711 if (typeof options.write === 'function') this._write = options.write;
16713 if (typeof options.writev === 'function') this._writev = options.writev;
16715 if (typeof options.destroy === 'function') this._destroy = options.destroy;
16717 if (typeof options.final === 'function') this._final = options.final;
16723 // Otherwise people can pipe Writable streams, which is just wrong.
16724 Writable.prototype.pipe = function () {
16725 this.emit('error', new Error('Cannot pipe, not readable'));
16728 function writeAfterEnd(stream, cb) {
16729 var er = new Error('write after end');
16730 // TODO: defer error events consistently everywhere, not just the cb
16731 stream.emit('error', er);
16732 pna.nextTick(cb, er);
16735 // Checks that a user-supplied chunk is valid, especially for the particular
16736 // mode the stream is in. Currently this means that `null` is never accepted
16737 // and undefined/non-string values are only allowed in object mode.
16738 function validChunk(stream, state, chunk, cb) {
16742 if (chunk === null) {
16743 er = new TypeError('May not write null values to stream');
16744 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
16745 er = new TypeError('Invalid non-string/buffer chunk');
16748 stream.emit('error', er);
16749 pna.nextTick(cb, er);
16755 Writable.prototype.write = function (chunk, encoding, cb) {
16756 var state = this._writableState;
16758 var isBuf = !state.objectMode && _isUint8Array(chunk);
16760 if (isBuf && !Buffer.isBuffer(chunk)) {
16761 chunk = _uint8ArrayToBuffer(chunk);
16764 if (typeof encoding === 'function') {
16769 if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
16771 if (typeof cb !== 'function') cb = nop;
16773 if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
16775 ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
16781 Writable.prototype.cork = function () {
16782 var state = this._writableState;
16787 Writable.prototype.uncork = function () {
16788 var state = this._writableState;
16790 if (state.corked) {
16793 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
16797 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
16798 // node::ParseEncoding() requires lower case.
16799 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
16800 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
16801 this._writableState.defaultEncoding = encoding;
16805 function decodeChunk(state, chunk, encoding) {
16806 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
16807 chunk = Buffer.from(chunk, encoding);
16812 Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
16813 // making it explicit this property is not enumerable
16814 // because otherwise some prototype manipulation in
16815 // userland will fail
16818 return this._writableState.highWaterMark;
16822 // if we're already writing something, then just put this
16823 // in the queue, and wait our turn. Otherwise, call _write
16824 // If we return false, then we need a drain event, so set that flag.
16825 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
16827 var newChunk = decodeChunk(state, chunk, encoding);
16828 if (chunk !== newChunk) {
16830 encoding = 'buffer';
16834 var len = state.objectMode ? 1 : chunk.length;
16836 state.length += len;
16838 var ret = state.length < state.highWaterMark;
16839 // we must ensure that previous needDrain will not be reset to false.
16840 if (!ret) state.needDrain = true;
16842 if (state.writing || state.corked) {
16843 var last = state.lastBufferedRequest;
16844 state.lastBufferedRequest = {
16846 encoding: encoding,
16852 last.next = state.lastBufferedRequest;
16854 state.bufferedRequest = state.lastBufferedRequest;
16856 state.bufferedRequestCount += 1;
16858 doWrite(stream, state, false, len, chunk, encoding, cb);
16864 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
16865 state.writelen = len;
16866 state.writecb = cb;
16867 state.writing = true;
16869 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
16870 state.sync = false;
16873 function onwriteError(stream, state, sync, er, cb) {
16877 // defer the callback if we are being called synchronously
16878 // to avoid piling up things on the stack
16879 pna.nextTick(cb, er);
16880 // this can emit finish, and it will always happen
16882 pna.nextTick(finishMaybe, stream, state);
16883 stream._writableState.errorEmitted = true;
16884 stream.emit('error', er);
16886 // the caller expect this to happen before if
16889 stream._writableState.errorEmitted = true;
16890 stream.emit('error', er);
16891 // this can emit finish, but finish must
16892 // always follow error
16893 finishMaybe(stream, state);
16897 function onwriteStateUpdate(state) {
16898 state.writing = false;
16899 state.writecb = null;
16900 state.length -= state.writelen;
16901 state.writelen = 0;
16904 function onwrite(stream, er) {
16905 var state = stream._writableState;
16906 var sync = state.sync;
16907 var cb = state.writecb;
16909 onwriteStateUpdate(state);
16911 if (er) onwriteError(stream, state, sync, er, cb);else {
16912 // Check if we're actually ready to finish, but don't emit yet
16913 var finished = needFinish(state);
16915 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
16916 clearBuffer(stream, state);
16921 asyncWrite(afterWrite
, stream
, state
, finished
, cb
);
16924 afterWrite(stream, state, finished, cb);
16929 function afterWrite(stream, state, finished, cb) {
16930 if (!finished) onwriteDrain(stream, state);
16933 finishMaybe(stream, state);
16936 // Must force callback to be called on nextTick, so that we don't
16937 // emit 'drain' before the write() consumer gets the 'false' return
16938 // value, and has a chance to attach a 'drain' listener.
16939 function onwriteDrain(stream, state) {
16940 if (state.length === 0 && state.needDrain) {
16941 state.needDrain = false;
16942 stream.emit('drain');
16946 // if there's something in the buffer waiting, then process it
16947 function clearBuffer(stream, state) {
16948 state.bufferProcessing = true;
16949 var entry = state.bufferedRequest;
16951 if (stream._writev && entry && entry.next) {
16952 // Fast case, write everything using _writev()
16953 var l = state.bufferedRequestCount;
16954 var buffer = new Array(l);
16955 var holder = state.corkedRequestsFree;
16956 holder.entry = entry;
16959 var allBuffers = true;
16961 buffer[count] = entry;
16962 if (!entry.isBuf) allBuffers = false;
16963 entry = entry.next;
16966 buffer.allBuffers = allBuffers;
16968 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
16970 // doWrite is almost always async, defer these to save a bit of time
16971 // as the hot path ends with doWrite
16973 state.lastBufferedRequest = null;
16975 state.corkedRequestsFree = holder.next;
16976 holder.next = null;
16978 state.corkedRequestsFree = new CorkedRequest(state);
16980 state.bufferedRequestCount = 0;
16982 // Slow case, write chunks one-by-one
16984 var chunk = entry.chunk;
16985 var encoding = entry.encoding;
16986 var cb = entry.callback;
16987 var len = state.objectMode ? 1 : chunk.length;
16989 doWrite(stream, state, false, len, chunk, encoding, cb);
16990 entry = entry.next;
16991 state.bufferedRequestCount--;
16992 // if we didn't call the onwrite immediately, then
16993 // it means that we need to wait until it does.
16994 // also, that means that the chunk and cb are currently
16995 // being processed, so move the buffer counter past them.
16996 if (state.writing) {
17001 if (entry === null) state.lastBufferedRequest = null;
17004 state.bufferedRequest = entry;
17005 state.bufferProcessing = false;
17008 Writable.prototype._write = function (chunk, encoding, cb) {
17009 cb(new Error('_write() is not implemented'));
17012 Writable.prototype._writev = null;
17014 Writable.prototype.end = function (chunk, encoding, cb) {
17015 var state = this._writableState;
17017 if (typeof chunk === 'function') {
17021 } else if (typeof encoding === 'function') {
17026 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
17028 // .end() fully uncorks
17029 if (state.corked) {
17034 // ignore unnecessary end() calls.
17035 if (!state.ending && !state.finished) endWritable(this, state, cb);
17038 function needFinish(state) {
17039 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
17041 function callFinal(stream, state) {
17042 stream._final(function (err) {
17045 stream.emit('error', err);
17047 state.prefinished = true;
17048 stream.emit('prefinish');
17049 finishMaybe(stream, state);
17052 function prefinish(stream, state) {
17053 if (!state.prefinished && !state.finalCalled) {
17054 if (typeof stream._final === 'function') {
17056 state.finalCalled = true;
17057 pna.nextTick(callFinal, stream, state);
17059 state.prefinished = true;
17060 stream.emit('prefinish');
17065 function finishMaybe(stream, state) {
17066 var need = needFinish(state);
17068 prefinish(stream, state);
17069 if (state.pendingcb === 0) {
17070 state.finished = true;
17071 stream.emit('finish');
17077 function endWritable(stream, state, cb) {
17078 state.ending = true;
17079 finishMaybe(stream, state);
17081 if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
17083 state.ended = true;
17084 stream.writable = false;
17087 function onCorkedFinish(corkReq, state, err) {
17088 var entry = corkReq.entry;
17089 corkReq.entry = null;
17091 var cb = entry.callback;
17094 entry = entry.next;
17096 if (state.corkedRequestsFree) {
17097 state.corkedRequestsFree.next = corkReq;
17099 state.corkedRequestsFree = corkReq;
17103 Object.defineProperty(Writable.prototype, 'destroyed', {
17105 if (this._writableState === undefined) {
17108 return this._writableState.destroyed;
17110 set: function (value) {
17111 // we ignore the value if the stream
17112 // has not been initialized yet
17113 if (!this._writableState) {
17117 // backward compatibility, the user is explicitly
17118 // managing destroyed
17119 this._writableState.destroyed = value;
17123 Writable.prototype.destroy = destroyImpl.destroy;
17124 Writable.prototype._undestroy = destroyImpl.undestroy;
17125 Writable.prototype._destroy = function (err, cb) {
17129 }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
17130 },{"./_stream_duplex":107,"./internal/streams/destroy":113,"./internal/streams/stream":114,"_process":105,"core-util-is":97,"inherits":100,"process-nextick-args":104,"safe-buffer":115,"timers":124,"util-deprecate":125}],112:[function(require,module,exports){
17133 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17135 var Buffer = require('safe-buffer').Buffer;
17136 var util = require('util');
17138 function copyBuffer(src, target, offset) {
17139 src.copy(target, offset);
17142 module.exports = function () {
17143 function BufferList() {
17144 _classCallCheck(this, BufferList);
17151 BufferList.prototype.push = function push(v) {
17152 var entry = { data: v, next: null };
17153 if (this.length > 0) this.tail.next = entry;else this.head = entry;
17158 BufferList.prototype.unshift = function unshift(v) {
17159 var entry = { data: v, next: this.head };
17160 if (this.length === 0) this.tail = entry;
17165 BufferList.prototype.shift = function shift() {
17166 if (this.length === 0) return;
17167 var ret = this.head.data;
17168 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
17173 BufferList.prototype.clear = function clear() {
17174 this.head = this.tail = null;
17178 BufferList.prototype.join = function join(s) {
17179 if (this.length === 0) return '';
17181 var ret = '' + p.data;
17182 while (p = p.next) {
17187 BufferList.prototype.concat = function concat(n) {
17188 if (this.length === 0) return Buffer.alloc(0);
17189 if (this.length === 1) return this.head.data;
17190 var ret = Buffer.allocUnsafe(n >>> 0);
17194 copyBuffer(p.data, ret, i);
17195 i += p.data.length;
17204 if (util && util.inspect && util.inspect.custom) {
17205 module.exports.prototype[util.inspect.custom] = function () {
17206 var obj = util.inspect({ length: this.length });
17207 return this.constructor.name + ' ' + obj;
17210 },{"safe-buffer":115,"util":95}],113:[function(require,module,exports){
17215 var pna
= require('process-nextick-args');
17218 // undocumented cb() API, needed for core, not for public API
17219 function destroy(err, cb) {
17222 var readableDestroyed = this._readableState && this._readableState.destroyed;
17223 var writableDestroyed = this._writableState && this._writableState.destroyed;
17225 if (readableDestroyed || writableDestroyed) {
17228 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
17229 pna.nextTick(emitErrorNT, this, err);
17234 // we set destroyed to true before firing error callbacks in order
17235 // to make it re-entrance safe in case destroy() is called within callbacks
17237 if (this._readableState) {
17238 this._readableState.destroyed = true;
17241 // if this is a duplex stream mark the writable part as destroyed as well
17242 if (this._writableState) {
17243 this._writableState.destroyed = true;
17246 this._destroy(err || null, function (err) {
17248 pna.nextTick(emitErrorNT, _this, err);
17249 if (_this._writableState) {
17250 _this._writableState.errorEmitted = true;
17260 function undestroy() {
17261 if (this._readableState) {
17262 this._readableState.destroyed = false;
17263 this._readableState.reading = false;
17264 this._readableState.ended = false;
17265 this._readableState.endEmitted = false;
17268 if (this._writableState) {
17269 this._writableState.destroyed = false;
17270 this._writableState.ended = false;
17271 this._writableState.ending = false;
17272 this._writableState.finished = false;
17273 this._writableState.errorEmitted = false;
17277 function emitErrorNT(self, err) {
17278 self.emit('error', err);
17283 undestroy: undestroy
17285 },{"process-nextick-args":104}],114:[function(require,module,exports){
17286 module.exports = require('events').EventEmitter;
17288 },{"events":98}],115:[function(require,module,exports){
17289 /* eslint-disable node/no-deprecated-api */
17290 var buffer
= require('buffer')
17291 var Buffer
= buffer
.Buffer
17293 // alternative to using Object.keys for old browsers
17294 function copyProps (src
, dst
) {
17295 for (var key
in src
) {
17296 dst
[key
] = src
[key
]
17299 if (Buffer
.from && Buffer
.alloc
&& Buffer
.allocUnsafe
&& Buffer
.allocUnsafeSlow
) {
17300 module
.exports
= buffer
17302 // Copy properties from require('buffer')
17303 copyProps(buffer
, exports
)
17304 exports
.Buffer
= SafeBuffer
17307 function SafeBuffer (arg
, encodingOrOffset
, length
) {
17308 return Buffer(arg
, encodingOrOffset
, length
)
17311 // Copy static methods from Buffer
17312 copyProps(Buffer
, SafeBuffer
)
17314 SafeBuffer
.from = function (arg
, encodingOrOffset
, length
) {
17315 if (typeof arg
=== 'number') {
17316 throw new TypeError('Argument must not be a number')
17318 return Buffer(arg
, encodingOrOffset
, length
)
17321 SafeBuffer
.alloc = function (size
, fill
, encoding
) {
17322 if (typeof size
!== 'number') {
17323 throw new TypeError('Argument must be a number')
17325 var buf
= Buffer(size
)
17326 if (fill
!== undefined) {
17327 if (typeof encoding
=== 'string') {
17328 buf
.fill(fill
, encoding
)
17338 SafeBuffer
.allocUnsafe = function (size
) {
17339 if (typeof size
!== 'number') {
17340 throw new TypeError('Argument must be a number')
17342 return Buffer(size
)
17345 SafeBuffer
.allocUnsafeSlow = function (size
) {
17346 if (typeof size
!== 'number') {
17347 throw new TypeError('Argument must be a number')
17349 return buffer
.SlowBuffer(size
)
17352 },{"buffer":96}],116:[function(require
,module
,exports
){
17353 // Copyright Joyent, Inc. and other Node contributors.
17355 // Permission is hereby granted, free of charge, to any person obtaining a
17356 // copy of this software and associated documentation files (the
17357 // "Software"), to deal in the Software without restriction, including
17358 // without limitation the rights to use, copy, modify, merge, publish,
17359 // distribute, sublicense, and/or sell copies of the Software, and to permit
17360 // persons to whom the Software is furnished to do so, subject to the
17361 // following conditions:
17363 // The above copyright notice and this permission notice shall be included
17364 // in all copies or substantial portions of the Software.
17366 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17367 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17368 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17369 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17370 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17371 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17372 // USE OR OTHER DEALINGS IN THE SOFTWARE.
17378 var Buffer
= require('safe-buffer').Buffer
;
17381 var isEncoding = Buffer.isEncoding || function (encoding) {
17382 encoding = '' + encoding;
17383 switch (encoding && encoding.toLowerCase()) {
17384 case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
17391 function _normalizeEncoding(enc) {
17392 if (!enc) return 'utf8';
17412 if (retried) return; // undefined
17413 enc = ('' + enc).toLowerCase();
17419 // Do not cache `Buffer.isEncoding` when checking encoding names as some
17420 // modules monkey-patch it to support additional encodings
17421 function normalizeEncoding(enc) {
17422 var nenc = _normalizeEncoding(enc);
17423 if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
17424 return nenc || enc;
17427 // StringDecoder provides an interface for efficiently splitting a series of
17428 // buffers into a series of JS strings without breaking apart multi-byte
17430 exports.StringDecoder = StringDecoder;
17431 function StringDecoder(encoding) {
17432 this.encoding = normalizeEncoding(encoding);
17434 switch (this.encoding) {
17436 this.text = utf16Text;
17437 this.end = utf16End;
17441 this.fillLast = utf8FillLast;
17445 this.text = base64Text;
17446 this.end = base64End;
17450 this.write = simpleWrite;
17451 this.end = simpleEnd;
17455 this.lastTotal = 0;
17456 this.lastChar = Buffer.allocUnsafe(nb);
17459 StringDecoder.prototype.write = function (buf) {
17460 if (buf.length === 0) return '';
17463 if (this.lastNeed) {
17464 r = this.fillLast(buf);
17465 if (r === undefined) return '';
17471 if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
17475 StringDecoder.prototype.end = utf8End;
17477 // Returns only complete characters in a Buffer
17478 StringDecoder.prototype.text = utf8Text;
17480 // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
17481 StringDecoder.prototype.fillLast = function (buf) {
17482 if (this.lastNeed <= buf.length) {
17483 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
17484 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17486 buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
17487 this.lastNeed -= buf.length;
17490 // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
17491 // continuation byte. If an invalid byte is detected, -2 is returned.
17492 function utf8CheckByte(byte) {
17493 if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
17494 return byte >> 6 === 0x02 ? -1 : -2;
17497 // Checks at most 3 bytes at the end of a Buffer in order to detect an
17498 // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
17499 // needed to complete the UTF-8 character (if applicable) are returned.
17500 function utf8CheckIncomplete(self, buf, i) {
17501 var j = buf.length - 1;
17502 if (j < i) return 0;
17503 var nb = utf8CheckByte(buf[j]);
17505 if (nb > 0) self.lastNeed = nb - 1;
17508 if (--j < i || nb === -2) return 0;
17509 nb = utf8CheckByte(buf[j]);
17511 if (nb > 0) self.lastNeed = nb - 2;
17514 if (--j < i || nb === -2) return 0;
17515 nb = utf8CheckByte(buf[j]);
17518 if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
17525 // Validates as many continuation bytes for a multi-byte UTF-8 character as
17526 // needed or are available. If we see a non-continuation byte where we expect
17527 // one, we "replace" the validated continuation bytes we've seen so far with
17528 // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
17529 // behavior. The continuation byte check is included three times in the case
17530 // where all of the continuation bytes for a character exist in the same buffer.
17531 // It is also done this way as a slight performance increase instead of using a
17533 function utf8CheckExtraBytes(self, buf, p) {
17534 if ((buf[0] & 0xC0) !== 0x80) {
17538 if (self.lastNeed > 1 && buf.length > 1) {
17539 if ((buf[1] & 0xC0) !== 0x80) {
17543 if (self.lastNeed > 2 && buf.length > 2) {
17544 if ((buf[2] & 0xC0) !== 0x80) {
17552 // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
17553 function utf8FillLast(buf) {
17554 var p = this.lastTotal - this.lastNeed;
17555 var r = utf8CheckExtraBytes(this, buf, p);
17556 if (r !== undefined) return r;
17557 if (this.lastNeed <= buf.length) {
17558 buf.copy(this.lastChar, p, 0, this.lastNeed);
17559 return this.lastChar.toString(this.encoding, 0, this.lastTotal);
17561 buf.copy(this.lastChar, p, 0, buf.length);
17562 this.lastNeed -= buf.length;
17565 // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
17566 // partial character, the character's bytes are buffered until the required
17567 // number of bytes are available.
17568 function utf8Text(buf, i) {
17569 var total = utf8CheckIncomplete(this, buf, i);
17570 if (!this.lastNeed) return buf.toString('utf8', i);
17571 this.lastTotal = total;
17572 var end = buf.length - (total - this.lastNeed);
17573 buf.copy(this.lastChar, 0, end);
17574 return buf.toString('utf8', i, end);
17577 // For UTF-8, a replacement character is added when ending on a partial
17579 function utf8End(buf) {
17580 var r = buf && buf.length ? this.write(buf) : '';
17581 if (this.lastNeed) return r + '\ufffd';
17585 // UTF-16LE typically needs two bytes per character, but even if we have an even
17586 // number of bytes available, we need to check if we end on a leading/high
17587 // surrogate. In that case, we need to wait for the next two bytes in order to
17588 // decode the last character properly.
17589 function utf16Text(buf, i) {
17590 if ((buf.length - i) % 2 === 0) {
17591 var r = buf.toString('utf16le', i);
17593 var c = r.charCodeAt(r.length - 1);
17594 if (c >= 0xD800 && c <= 0xDBFF) {
17596 this.lastTotal = 4;
17597 this.lastChar[0] = buf[buf.length - 2];
17598 this.lastChar[1] = buf[buf.length - 1];
17599 return r.slice(0, -1);
17605 this.lastTotal = 2;
17606 this.lastChar[0] = buf[buf.length - 1];
17607 return buf.toString('utf16le', i, buf.length - 1);
17610 // For UTF-16LE we do not explicitly append special replacement characters if we
17611 // end on a partial character, we simply let v8 handle that.
17612 function utf16End(buf) {
17613 var r = buf && buf.length ? this.write(buf) : '';
17614 if (this.lastNeed) {
17615 var end = this.lastTotal - this.lastNeed;
17616 return r + this.lastChar.toString('utf16le', 0, end);
17621 function base64Text(buf, i) {
17622 var n = (buf.length - i) % 3;
17623 if (n === 0) return buf.toString('base64', i);
17624 this.lastNeed = 3 - n;
17625 this.lastTotal = 3;
17627 this.lastChar[0] = buf[buf.length - 1];
17629 this.lastChar[0] = buf[buf.length - 2];
17630 this.lastChar[1] = buf[buf.length - 1];
17632 return buf.toString('base64', i, buf.length - n);
17635 function base64End(buf) {
17636 var r = buf && buf.length ? this.write(buf) : '';
17637 if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
17641 // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
17642 function simpleWrite(buf) {
17643 return buf.toString(this.encoding);
17646 function simpleEnd(buf) {
17647 return buf && buf.length ? this.write(buf) : '';
17649 },{"safe-buffer":115}],117:[function(require,module,exports){
17650 module.exports = require('./readable').PassThrough
17652 },{"./readable":118}],118:[function(require,module,exports){
17653 exports = module.exports = require('./lib/_stream_readable.js');
17654 exports.Stream = exports;
17655 exports.Readable = exports;
17656 exports.Writable = require('./lib/_stream_writable.js');
17657 exports.Duplex = require('./lib/_stream_duplex.js');
17658 exports.Transform = require('./lib/_stream_transform.js');
17659 exports.PassThrough = require('./lib/_stream_passthrough.js');
17661 },{"./lib/_stream_duplex.js":107,"./lib/_stream_passthrough.js":108,"./lib/_stream_readable.js":109,"./lib/_stream_transform.js":110,"./lib/_stream_writable.js":111}],119:[function(require,module,exports){
17662 module.exports = require('./readable').Transform
17664 },{"./readable":118}],120:[function(require,module,exports){
17665 module.exports = require('./lib/_stream_writable.js');
17667 },{"./lib/_stream_writable.js":111}],121:[function(require,module,exports){
17668 arguments[4][38][0].apply(exports,arguments)
17669 },{"buffer":96,"dup":38}],122:[function(require,module,exports){
17670 // Copyright Joyent, Inc. and other Node contributors.
17672 // Permission is hereby granted, free of charge, to any person obtaining a
17673 // copy of this software and associated documentation files (the
17674 // "Software"), to deal in the Software without restriction, including
17675 // without limitation the rights to use, copy, modify, merge, publish,
17676 // distribute, sublicense, and/or sell copies of the Software, and to permit
17677 // persons to whom the Software is furnished to do so, subject to the
17678 // following conditions:
17680 // The above copyright notice and this permission notice shall be included
17681 // in all copies or substantial portions of the Software.
17683 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17684 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17685 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17686 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17687 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17688 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
17689 // USE OR OTHER DEALINGS IN THE SOFTWARE.
17691 module.exports = Stream;
17693 var EE = require('events').EventEmitter;
17694 var inherits = require('inherits');
17696 inherits(Stream, EE);
17697 Stream.Readable = require('readable-stream/readable.js');
17698 Stream.Writable = require('readable-stream/writable.js');
17699 Stream.Duplex = require('readable-stream/duplex.js');
17700 Stream.Transform = require('readable-stream/transform.js');
17701 Stream.PassThrough = require('readable-stream/passthrough.js');
17703 // Backwards-compat with node 0.4.x
17704 Stream.Stream = Stream;
17708 // old-style streams. Note that the pipe method (the only relevant
17709 // part of this class) is overridden in the Readable class.
17711 function Stream() {
17715 Stream.prototype.pipe = function(dest, options) {
17718 function ondata(chunk) {
17719 if (dest.writable) {
17720 if (false === dest.write(chunk) && source.pause) {
17726 source.on('data', ondata);
17728 function ondrain() {
17729 if (source.readable && source.resume) {
17734 dest.on('drain', ondrain);
17736 // If the 'end' option is not supplied, dest.end() will be called when
17737 // source gets the 'end' or 'close' events. Only dest.end() once.
17738 if (!dest._isStdio && (!options || options.end !== false)) {
17739 source.on('end', onend);
17740 source.on('close', onclose);
17743 var didOnEnd = false;
17745 if (didOnEnd) return;
17752 function onclose() {
17753 if (didOnEnd) return;
17756 if (typeof dest.destroy === 'function') dest.destroy();
17759 // don't leave dangling pipes when there are errors.
17760 function onerror(er) {
17762 if (EE.listenerCount(this, 'error') === 0) {
17763 throw er; // Unhandled stream error in pipe.
17767 source.on('error', onerror);
17768 dest.on('error', onerror);
17770 // remove all the event listeners that were added.
17771 function cleanup() {
17772 source.removeListener('data', ondata);
17773 dest.removeListener('drain', ondrain);
17775 source.removeListener('end', onend);
17776 source.removeListener('close', onclose);
17778 source.removeListener('error', onerror);
17779 dest.removeListener('error', onerror);
17781 source.removeListener('end', cleanup);
17782 source.removeListener('close', cleanup);
17784 dest.removeListener('close', cleanup);
17787 source.on('end', cleanup);
17788 source.on('close', cleanup);
17790 dest.on('close', cleanup);
17792 dest.emit('pipe', source);
17794 // Allow for unix-like usage: A.pipe(B).pipe(C)
17798 },{"events":98,"inherits":100,"readable-stream/duplex.js":106,"readable-stream/passthrough.js":117,"readable-stream/readable.js":118,"readable-stream/transform.js":119,"readable-stream/writable.js":120}],123:[function(require,module,exports){
17799 arguments[4][116][0].apply(exports,arguments)
17800 },{"dup":116,"safe-buffer":121}],124:[function(require,module,exports){
17801 (function (setImmediate,clearImmediate){
17802 var nextTick = require('process/browser.js').nextTick;
17803 var apply = Function.prototype.apply;
17804 var slice = Array.prototype.slice;
17805 var immediateIds = {};
17806 var nextImmediateId = 0;
17808 // DOM APIs, for completeness
17810 exports.setTimeout = function() {
17811 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
17813 exports.setInterval = function() {
17814 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
17816 exports.clearTimeout =
17817 exports.clearInterval = function(timeout) { timeout.close(); };
17819 function Timeout(id, clearFn) {
17821 this._clearFn = clearFn;
17823 Timeout.prototype.unref = Timeout.prototype.ref = function() {};
17824 Timeout.prototype.close = function() {
17825 this._clearFn.call(window, this._id);
17828 // Does not start the time, just sets up the members needed.
17829 exports.enroll = function(item, msecs) {
17830 clearTimeout(item._idleTimeoutId);
17831 item._idleTimeout = msecs;
17834 exports.unenroll = function(item) {
17835 clearTimeout(item._idleTimeoutId);
17836 item._idleTimeout = -1;
17839 exports._unrefActive = exports.active = function(item) {
17840 clearTimeout(item._idleTimeoutId);
17842 var msecs = item._idleTimeout;
17844 item._idleTimeoutId = setTimeout(function onTimeout() {
17845 if (item._onTimeout)
17851 // That's not how node.js implements it but the exposed api is the same.
17852 exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
17853 var id = nextImmediateId++;
17854 var args = arguments.length < 2 ? false : slice.call(arguments, 1);
17856 immediateIds[id] = true;
17858 nextTick(function onNextTick() {
17859 if (immediateIds[id]) {
17860 // fn.call() is faster so we optimize for the common use-case
17861 // @see http://jsperf.com/call-apply-segu
17863 fn.apply(null, args);
17867 // Prevent ids from leaking
17868 exports.clearImmediate(id);
17875 exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
17876 delete immediateIds[id];
17878 }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17879 },{"process/browser.js":105,"timers":124}],125:[function(require,module,exports){
17880 (function (global){
17886 module
.exports
= deprecate
;
17889 * Mark that a method should not be used.
17890 * Returns a modified function which warns once by default.
17892 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
17894 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
17895 * will throw an Error when invoked.
17897 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
17898 * will invoke `console.trace()` instead of `console.error()`.
17900 * @param {Function} fn - the function to deprecate
17901 * @param {String} msg - the string to print to the console when `fn` is invoked
17902 * @returns {Function} a new "deprecated" version of `fn`
17906 function deprecate (fn
, msg
) {
17907 if (config('noDeprecation')) {
17911 var warned
= false;
17912 function deprecated() {
17914 if (config('throwDeprecation')) {
17915 throw new Error(msg
);
17916 } else if (config('traceDeprecation')) {
17917 console
.trace(msg
);
17923 return fn
.apply(this, arguments
);
17930 * Checks `localStorage` for boolean values for the given `name`.
17932 * @param {String} name
17933 * @returns {Boolean}
17937 function config (name
) {
17938 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
17940 if (!global
.localStorage
) return false;
17944 var val
= global
.localStorage
[name
];
17945 if (null == val
) return false;
17946 return String(val
).toLowerCase() === 'true';
17949 }).call(this,typeof global
!== "undefined" ? global : typeof self
!== "undefined" ? self : typeof window
!== "undefined" ? window : {})
17950 },{}]},{},[61])(61)