Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

37727 righe
984 KiB

  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/ // The require function
  5. /******/ function __webpack_require__(moduleId) {
  6. /******/ // Check if module is in cache
  7. /******/ if(installedModules[moduleId])
  8. /******/ return installedModules[moduleId].exports;
  9. /******/ // Create a new module (and put it into the cache)
  10. /******/ var module = installedModules[moduleId] = {
  11. /******/ i: moduleId,
  12. /******/ l: false,
  13. /******/ exports: {}
  14. /******/ };
  15. /******/ // Execute the module function
  16. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  17. /******/ // Flag the module as loaded
  18. /******/ module.l = true;
  19. /******/ // Return the exports of the module
  20. /******/ return module.exports;
  21. /******/ }
  22. /******/ // expose the modules object (__webpack_modules__)
  23. /******/ __webpack_require__.m = modules;
  24. /******/ // expose the module cache
  25. /******/ __webpack_require__.c = installedModules;
  26. /******/ // identity function for calling harmory imports with the correct context
  27. /******/ __webpack_require__.i = function(value) { return value; };
  28. /******/ // define getter function for harmory exports
  29. /******/ __webpack_require__.d = function(exports, name, getter) {
  30. /******/ Object.defineProperty(exports, name, {
  31. /******/ configurable: false,
  32. /******/ enumerable: true,
  33. /******/ get: getter
  34. /******/ });
  35. /******/ };
  36. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37. /******/ __webpack_require__.n = function(module) {
  38. /******/ var getter = module && module.__esModule ?
  39. /******/ function getDefault() { return module['default']; } :
  40. /******/ function getModuleExports() { return module; };
  41. /******/ __webpack_require__.d(getter, 'a', getter);
  42. /******/ return getter;
  43. /******/ };
  44. /******/ // Object.prototype.hasOwnProperty.call
  45. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  46. /******/ // __webpack_public_path__
  47. /******/ __webpack_require__.p = "/dist/";
  48. /******/ // Load entry module and return exports
  49. /******/ return __webpack_require__(__webpack_require__.s = 313);
  50. /******/ })
  51. /************************************************************************/
  52. /******/ ((function(modules) {
  53. // Check all modules for deduplicated modules
  54. for(var i in modules) {
  55. if(Object.prototype.hasOwnProperty.call(modules, i)) {
  56. switch(typeof modules[i]) {
  57. case "function": break;
  58. case "object":
  59. // Module can be created from a template
  60. modules[i] = (function(_m) {
  61. var args = _m.slice(1), fn = modules[_m[0]];
  62. return function (a,b,c) {
  63. fn.apply(this, [a,b,c].concat(args));
  64. };
  65. }(modules[i]));
  66. break;
  67. default:
  68. // Module is a copy of another module
  69. modules[i] = modules[modules[i]];
  70. break;
  71. }
  72. }
  73. }
  74. return modules;
  75. }([
  76. /* 0 */
  77. /***/ function(module, exports, __webpack_require__) {
  78. "use strict";
  79. /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!
  80. * The buffer module from node.js, for the browser.
  81. *
  82. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  83. * @license MIT
  84. */
  85. /* eslint-disable no-proto */
  86. 'use strict'
  87. var base64 = __webpack_require__(164)
  88. var ieee754 = __webpack_require__(253)
  89. var isArray = __webpack_require__(106)
  90. exports.Buffer = Buffer
  91. exports.SlowBuffer = SlowBuffer
  92. exports.INSPECT_MAX_BYTES = 50
  93. /**
  94. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  95. * === true Use Uint8Array implementation (fastest)
  96. * === false Use Object implementation (most compatible, even IE6)
  97. *
  98. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  99. * Opera 11.6+, iOS 4.2+.
  100. *
  101. * Due to various browser bugs, sometimes the Object implementation will be used even
  102. * when the browser supports typed arrays.
  103. *
  104. * Note:
  105. *
  106. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  107. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  108. *
  109. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  110. *
  111. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  112. * incorrect length in some situations.
  113. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  114. * get the Object implementation, which is slower but behaves correctly.
  115. */
  116. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  117. ? global.TYPED_ARRAY_SUPPORT
  118. : typedArraySupport()
  119. /*
  120. * Export kMaxLength after typed array support is determined.
  121. */
  122. exports.kMaxLength = kMaxLength()
  123. function typedArraySupport () {
  124. try {
  125. var arr = new Uint8Array(1)
  126. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  127. return arr.foo() === 42 && // typed array instances can be augmented
  128. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  129. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  130. } catch (e) {
  131. return false
  132. }
  133. }
  134. function kMaxLength () {
  135. return Buffer.TYPED_ARRAY_SUPPORT
  136. ? 0x7fffffff
  137. : 0x3fffffff
  138. }
  139. function createBuffer (that, length) {
  140. if (kMaxLength() < length) {
  141. throw new RangeError('Invalid typed array length')
  142. }
  143. if (Buffer.TYPED_ARRAY_SUPPORT) {
  144. // Return an augmented `Uint8Array` instance, for best performance
  145. that = new Uint8Array(length)
  146. that.__proto__ = Buffer.prototype
  147. } else {
  148. // Fallback: Return an object instance of the Buffer class
  149. if (that === null) {
  150. that = new Buffer(length)
  151. }
  152. that.length = length
  153. }
  154. return that
  155. }
  156. /**
  157. * The Buffer constructor returns instances of `Uint8Array` that have their
  158. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  159. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  160. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  161. * returns a single octet.
  162. *
  163. * The `Uint8Array` prototype remains unmodified.
  164. */
  165. function Buffer (arg, encodingOrOffset, length) {
  166. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  167. return new Buffer(arg, encodingOrOffset, length)
  168. }
  169. // Common case.
  170. if (typeof arg === 'number') {
  171. if (typeof encodingOrOffset === 'string') {
  172. throw new Error(
  173. 'If encoding is specified then the first argument must be a string'
  174. )
  175. }
  176. return allocUnsafe(this, arg)
  177. }
  178. return from(this, arg, encodingOrOffset, length)
  179. }
  180. Buffer.poolSize = 8192 // not used by this implementation
  181. // TODO: Legacy, not needed anymore. Remove in next major version.
  182. Buffer._augment = function (arr) {
  183. arr.__proto__ = Buffer.prototype
  184. return arr
  185. }
  186. function from (that, value, encodingOrOffset, length) {
  187. if (typeof value === 'number') {
  188. throw new TypeError('"value" argument must not be a number')
  189. }
  190. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  191. return fromArrayBuffer(that, value, encodingOrOffset, length)
  192. }
  193. if (typeof value === 'string') {
  194. return fromString(that, value, encodingOrOffset)
  195. }
  196. return fromObject(that, value)
  197. }
  198. /**
  199. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  200. * if value is a number.
  201. * Buffer.from(str[, encoding])
  202. * Buffer.from(array)
  203. * Buffer.from(buffer)
  204. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  205. **/
  206. Buffer.from = function (value, encodingOrOffset, length) {
  207. return from(null, value, encodingOrOffset, length)
  208. }
  209. if (Buffer.TYPED_ARRAY_SUPPORT) {
  210. Buffer.prototype.__proto__ = Uint8Array.prototype
  211. Buffer.__proto__ = Uint8Array
  212. if (typeof Symbol !== 'undefined' && Symbol.species &&
  213. Buffer[Symbol.species] === Buffer) {
  214. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  215. Object.defineProperty(Buffer, Symbol.species, {
  216. value: null,
  217. configurable: true
  218. })
  219. }
  220. }
  221. function assertSize (size) {
  222. if (typeof size !== 'number') {
  223. throw new TypeError('"size" argument must be a number')
  224. } else if (size < 0) {
  225. throw new RangeError('"size" argument must not be negative')
  226. }
  227. }
  228. function alloc (that, size, fill, encoding) {
  229. assertSize(size)
  230. if (size <= 0) {
  231. return createBuffer(that, size)
  232. }
  233. if (fill !== undefined) {
  234. // Only pay attention to encoding if it's a string. This
  235. // prevents accidentally sending in a number that would
  236. // be interpretted as a start offset.
  237. return typeof encoding === 'string'
  238. ? createBuffer(that, size).fill(fill, encoding)
  239. : createBuffer(that, size).fill(fill)
  240. }
  241. return createBuffer(that, size)
  242. }
  243. /**
  244. * Creates a new filled Buffer instance.
  245. * alloc(size[, fill[, encoding]])
  246. **/
  247. Buffer.alloc = function (size, fill, encoding) {
  248. return alloc(null, size, fill, encoding)
  249. }
  250. function allocUnsafe (that, size) {
  251. assertSize(size)
  252. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  253. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  254. for (var i = 0; i < size; ++i) {
  255. that[i] = 0
  256. }
  257. }
  258. return that
  259. }
  260. /**
  261. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  262. * */
  263. Buffer.allocUnsafe = function (size) {
  264. return allocUnsafe(null, size)
  265. }
  266. /**
  267. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  268. */
  269. Buffer.allocUnsafeSlow = function (size) {
  270. return allocUnsafe(null, size)
  271. }
  272. function fromString (that, string, encoding) {
  273. if (typeof encoding !== 'string' || encoding === '') {
  274. encoding = 'utf8'
  275. }
  276. if (!Buffer.isEncoding(encoding)) {
  277. throw new TypeError('"encoding" must be a valid string encoding')
  278. }
  279. var length = byteLength(string, encoding) | 0
  280. that = createBuffer(that, length)
  281. var actual = that.write(string, encoding)
  282. if (actual !== length) {
  283. // Writing a hex string, for example, that contains invalid characters will
  284. // cause everything after the first invalid character to be ignored. (e.g.
  285. // 'abxxcd' will be treated as 'ab')
  286. that = that.slice(0, actual)
  287. }
  288. return that
  289. }
  290. function fromArrayLike (that, array) {
  291. var length = array.length < 0 ? 0 : checked(array.length) | 0
  292. that = createBuffer(that, length)
  293. for (var i = 0; i < length; i += 1) {
  294. that[i] = array[i] & 255
  295. }
  296. return that
  297. }
  298. function fromArrayBuffer (that, array, byteOffset, length) {
  299. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  300. if (byteOffset < 0 || array.byteLength < byteOffset) {
  301. throw new RangeError('\'offset\' is out of bounds')
  302. }
  303. if (array.byteLength < byteOffset + (length || 0)) {
  304. throw new RangeError('\'length\' is out of bounds')
  305. }
  306. if (byteOffset === undefined && length === undefined) {
  307. array = new Uint8Array(array)
  308. } else if (length === undefined) {
  309. array = new Uint8Array(array, byteOffset)
  310. } else {
  311. array = new Uint8Array(array, byteOffset, length)
  312. }
  313. if (Buffer.TYPED_ARRAY_SUPPORT) {
  314. // Return an augmented `Uint8Array` instance, for best performance
  315. that = array
  316. that.__proto__ = Buffer.prototype
  317. } else {
  318. // Fallback: Return an object instance of the Buffer class
  319. that = fromArrayLike(that, array)
  320. }
  321. return that
  322. }
  323. function fromObject (that, obj) {
  324. if (Buffer.isBuffer(obj)) {
  325. var len = checked(obj.length) | 0
  326. that = createBuffer(that, len)
  327. if (that.length === 0) {
  328. return that
  329. }
  330. obj.copy(that, 0, 0, len)
  331. return that
  332. }
  333. if (obj) {
  334. if ((typeof ArrayBuffer !== 'undefined' &&
  335. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  336. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  337. return createBuffer(that, 0)
  338. }
  339. return fromArrayLike(that, obj)
  340. }
  341. if (obj.type === 'Buffer' && isArray(obj.data)) {
  342. return fromArrayLike(that, obj.data)
  343. }
  344. }
  345. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  346. }
  347. function checked (length) {
  348. // Note: cannot use `length < kMaxLength()` here because that fails when
  349. // length is NaN (which is otherwise coerced to zero.)
  350. if (length >= kMaxLength()) {
  351. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  352. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  353. }
  354. return length | 0
  355. }
  356. function SlowBuffer (length) {
  357. if (+length != length) { // eslint-disable-line eqeqeq
  358. length = 0
  359. }
  360. return Buffer.alloc(+length)
  361. }
  362. Buffer.isBuffer = function isBuffer (b) {
  363. return !!(b != null && b._isBuffer)
  364. }
  365. Buffer.compare = function compare (a, b) {
  366. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  367. throw new TypeError('Arguments must be Buffers')
  368. }
  369. if (a === b) return 0
  370. var x = a.length
  371. var y = b.length
  372. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  373. if (a[i] !== b[i]) {
  374. x = a[i]
  375. y = b[i]
  376. break
  377. }
  378. }
  379. if (x < y) return -1
  380. if (y < x) return 1
  381. return 0
  382. }
  383. Buffer.isEncoding = function isEncoding (encoding) {
  384. switch (String(encoding).toLowerCase()) {
  385. case 'hex':
  386. case 'utf8':
  387. case 'utf-8':
  388. case 'ascii':
  389. case 'latin1':
  390. case 'binary':
  391. case 'base64':
  392. case 'ucs2':
  393. case 'ucs-2':
  394. case 'utf16le':
  395. case 'utf-16le':
  396. return true
  397. default:
  398. return false
  399. }
  400. }
  401. Buffer.concat = function concat (list, length) {
  402. if (!isArray(list)) {
  403. throw new TypeError('"list" argument must be an Array of Buffers')
  404. }
  405. if (list.length === 0) {
  406. return Buffer.alloc(0)
  407. }
  408. var i
  409. if (length === undefined) {
  410. length = 0
  411. for (i = 0; i < list.length; ++i) {
  412. length += list[i].length
  413. }
  414. }
  415. var buffer = Buffer.allocUnsafe(length)
  416. var pos = 0
  417. for (i = 0; i < list.length; ++i) {
  418. var buf = list[i]
  419. if (!Buffer.isBuffer(buf)) {
  420. throw new TypeError('"list" argument must be an Array of Buffers')
  421. }
  422. buf.copy(buffer, pos)
  423. pos += buf.length
  424. }
  425. return buffer
  426. }
  427. function byteLength (string, encoding) {
  428. if (Buffer.isBuffer(string)) {
  429. return string.length
  430. }
  431. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  432. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  433. return string.byteLength
  434. }
  435. if (typeof string !== 'string') {
  436. string = '' + string
  437. }
  438. var len = string.length
  439. if (len === 0) return 0
  440. // Use a for loop to avoid recursion
  441. var loweredCase = false
  442. for (;;) {
  443. switch (encoding) {
  444. case 'ascii':
  445. case 'latin1':
  446. case 'binary':
  447. return len
  448. case 'utf8':
  449. case 'utf-8':
  450. case undefined:
  451. return utf8ToBytes(string).length
  452. case 'ucs2':
  453. case 'ucs-2':
  454. case 'utf16le':
  455. case 'utf-16le':
  456. return len * 2
  457. case 'hex':
  458. return len >>> 1
  459. case 'base64':
  460. return base64ToBytes(string).length
  461. default:
  462. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  463. encoding = ('' + encoding).toLowerCase()
  464. loweredCase = true
  465. }
  466. }
  467. }
  468. Buffer.byteLength = byteLength
  469. function slowToString (encoding, start, end) {
  470. var loweredCase = false
  471. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  472. // property of a typed array.
  473. // This behaves neither like String nor Uint8Array in that we set start/end
  474. // to their upper/lower bounds if the value passed is out of range.
  475. // undefined is handled specially as per ECMA-262 6th Edition,
  476. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  477. if (start === undefined || start < 0) {
  478. start = 0
  479. }
  480. // Return early if start > this.length. Done here to prevent potential uint32
  481. // coercion fail below.
  482. if (start > this.length) {
  483. return ''
  484. }
  485. if (end === undefined || end > this.length) {
  486. end = this.length
  487. }
  488. if (end <= 0) {
  489. return ''
  490. }
  491. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  492. end >>>= 0
  493. start >>>= 0
  494. if (end <= start) {
  495. return ''
  496. }
  497. if (!encoding) encoding = 'utf8'
  498. while (true) {
  499. switch (encoding) {
  500. case 'hex':
  501. return hexSlice(this, start, end)
  502. case 'utf8':
  503. case 'utf-8':
  504. return utf8Slice(this, start, end)
  505. case 'ascii':
  506. return asciiSlice(this, start, end)
  507. case 'latin1':
  508. case 'binary':
  509. return latin1Slice(this, start, end)
  510. case 'base64':
  511. return base64Slice(this, start, end)
  512. case 'ucs2':
  513. case 'ucs-2':
  514. case 'utf16le':
  515. case 'utf-16le':
  516. return utf16leSlice(this, start, end)
  517. default:
  518. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  519. encoding = (encoding + '').toLowerCase()
  520. loweredCase = true
  521. }
  522. }
  523. }
  524. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  525. // Buffer instances.
  526. Buffer.prototype._isBuffer = true
  527. function swap (b, n, m) {
  528. var i = b[n]
  529. b[n] = b[m]
  530. b[m] = i
  531. }
  532. Buffer.prototype.swap16 = function swap16 () {
  533. var len = this.length
  534. if (len % 2 !== 0) {
  535. throw new RangeError('Buffer size must be a multiple of 16-bits')
  536. }
  537. for (var i = 0; i < len; i += 2) {
  538. swap(this, i, i + 1)
  539. }
  540. return this
  541. }
  542. Buffer.prototype.swap32 = function swap32 () {
  543. var len = this.length
  544. if (len % 4 !== 0) {
  545. throw new RangeError('Buffer size must be a multiple of 32-bits')
  546. }
  547. for (var i = 0; i < len; i += 4) {
  548. swap(this, i, i + 3)
  549. swap(this, i + 1, i + 2)
  550. }
  551. return this
  552. }
  553. Buffer.prototype.swap64 = function swap64 () {
  554. var len = this.length
  555. if (len % 8 !== 0) {
  556. throw new RangeError('Buffer size must be a multiple of 64-bits')
  557. }
  558. for (var i = 0; i < len; i += 8) {
  559. swap(this, i, i + 7)
  560. swap(this, i + 1, i + 6)
  561. swap(this, i + 2, i + 5)
  562. swap(this, i + 3, i + 4)
  563. }
  564. return this
  565. }
  566. Buffer.prototype.toString = function toString () {
  567. var length = this.length | 0
  568. if (length === 0) return ''
  569. if (arguments.length === 0) return utf8Slice(this, 0, length)
  570. return slowToString.apply(this, arguments)
  571. }
  572. Buffer.prototype.equals = function equals (b) {
  573. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  574. if (this === b) return true
  575. return Buffer.compare(this, b) === 0
  576. }
  577. Buffer.prototype.inspect = function inspect () {
  578. var str = ''
  579. var max = exports.INSPECT_MAX_BYTES
  580. if (this.length > 0) {
  581. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  582. if (this.length > max) str += ' ... '
  583. }
  584. return '<Buffer ' + str + '>'
  585. }
  586. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  587. if (!Buffer.isBuffer(target)) {
  588. throw new TypeError('Argument must be a Buffer')
  589. }
  590. if (start === undefined) {
  591. start = 0
  592. }
  593. if (end === undefined) {
  594. end = target ? target.length : 0
  595. }
  596. if (thisStart === undefined) {
  597. thisStart = 0
  598. }
  599. if (thisEnd === undefined) {
  600. thisEnd = this.length
  601. }
  602. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  603. throw new RangeError('out of range index')
  604. }
  605. if (thisStart >= thisEnd && start >= end) {
  606. return 0
  607. }
  608. if (thisStart >= thisEnd) {
  609. return -1
  610. }
  611. if (start >= end) {
  612. return 1
  613. }
  614. start >>>= 0
  615. end >>>= 0
  616. thisStart >>>= 0
  617. thisEnd >>>= 0
  618. if (this === target) return 0
  619. var x = thisEnd - thisStart
  620. var y = end - start
  621. var len = Math.min(x, y)
  622. var thisCopy = this.slice(thisStart, thisEnd)
  623. var targetCopy = target.slice(start, end)
  624. for (var i = 0; i < len; ++i) {
  625. if (thisCopy[i] !== targetCopy[i]) {
  626. x = thisCopy[i]
  627. y = targetCopy[i]
  628. break
  629. }
  630. }
  631. if (x < y) return -1
  632. if (y < x) return 1
  633. return 0
  634. }
  635. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  636. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  637. //
  638. // Arguments:
  639. // - buffer - a Buffer to search
  640. // - val - a string, Buffer, or number
  641. // - byteOffset - an index into `buffer`; will be clamped to an int32
  642. // - encoding - an optional encoding, relevant is val is a string
  643. // - dir - true for indexOf, false for lastIndexOf
  644. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  645. // Empty buffer means no match
  646. if (buffer.length === 0) return -1
  647. // Normalize byteOffset
  648. if (typeof byteOffset === 'string') {
  649. encoding = byteOffset
  650. byteOffset = 0
  651. } else if (byteOffset > 0x7fffffff) {
  652. byteOffset = 0x7fffffff
  653. } else if (byteOffset < -0x80000000) {
  654. byteOffset = -0x80000000
  655. }
  656. byteOffset = +byteOffset // Coerce to Number.
  657. if (isNaN(byteOffset)) {
  658. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  659. byteOffset = dir ? 0 : (buffer.length - 1)
  660. }
  661. // Normalize byteOffset: negative offsets start from the end of the buffer
  662. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  663. if (byteOffset >= buffer.length) {
  664. if (dir) return -1
  665. else byteOffset = buffer.length - 1
  666. } else if (byteOffset < 0) {
  667. if (dir) byteOffset = 0
  668. else return -1
  669. }
  670. // Normalize val
  671. if (typeof val === 'string') {
  672. val = Buffer.from(val, encoding)
  673. }
  674. // Finally, search either indexOf (if dir is true) or lastIndexOf
  675. if (Buffer.isBuffer(val)) {
  676. // Special case: looking for empty string/buffer always fails
  677. if (val.length === 0) {
  678. return -1
  679. }
  680. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  681. } else if (typeof val === 'number') {
  682. val = val & 0xFF // Search for a byte value [0-255]
  683. if (Buffer.TYPED_ARRAY_SUPPORT &&
  684. typeof Uint8Array.prototype.indexOf === 'function') {
  685. if (dir) {
  686. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  687. } else {
  688. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  689. }
  690. }
  691. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  692. }
  693. throw new TypeError('val must be string, number or Buffer')
  694. }
  695. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  696. var indexSize = 1
  697. var arrLength = arr.length
  698. var valLength = val.length
  699. if (encoding !== undefined) {
  700. encoding = String(encoding).toLowerCase()
  701. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  702. encoding === 'utf16le' || encoding === 'utf-16le') {
  703. if (arr.length < 2 || val.length < 2) {
  704. return -1
  705. }
  706. indexSize = 2
  707. arrLength /= 2
  708. valLength /= 2
  709. byteOffset /= 2
  710. }
  711. }
  712. function read (buf, i) {
  713. if (indexSize === 1) {
  714. return buf[i]
  715. } else {
  716. return buf.readUInt16BE(i * indexSize)
  717. }
  718. }
  719. var i
  720. if (dir) {
  721. var foundIndex = -1
  722. for (i = byteOffset; i < arrLength; i++) {
  723. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  724. if (foundIndex === -1) foundIndex = i
  725. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  726. } else {
  727. if (foundIndex !== -1) i -= i - foundIndex
  728. foundIndex = -1
  729. }
  730. }
  731. } else {
  732. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  733. for (i = byteOffset; i >= 0; i--) {
  734. var found = true
  735. for (var j = 0; j < valLength; j++) {
  736. if (read(arr, i + j) !== read(val, j)) {
  737. found = false
  738. break
  739. }
  740. }
  741. if (found) return i
  742. }
  743. }
  744. return -1
  745. }
  746. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  747. return this.indexOf(val, byteOffset, encoding) !== -1
  748. }
  749. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  750. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  751. }
  752. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  753. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  754. }
  755. function hexWrite (buf, string, offset, length) {
  756. offset = Number(offset) || 0
  757. var remaining = buf.length - offset
  758. if (!length) {
  759. length = remaining
  760. } else {
  761. length = Number(length)
  762. if (length > remaining) {
  763. length = remaining
  764. }
  765. }
  766. // must be an even number of digits
  767. var strLen = string.length
  768. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  769. if (length > strLen / 2) {
  770. length = strLen / 2
  771. }
  772. for (var i = 0; i < length; ++i) {
  773. var parsed = parseInt(string.substr(i * 2, 2), 16)
  774. if (isNaN(parsed)) return i
  775. buf[offset + i] = parsed
  776. }
  777. return i
  778. }
  779. function utf8Write (buf, string, offset, length) {
  780. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  781. }
  782. function asciiWrite (buf, string, offset, length) {
  783. return blitBuffer(asciiToBytes(string), buf, offset, length)
  784. }
  785. function latin1Write (buf, string, offset, length) {
  786. return asciiWrite(buf, string, offset, length)
  787. }
  788. function base64Write (buf, string, offset, length) {
  789. return blitBuffer(base64ToBytes(string), buf, offset, length)
  790. }
  791. function ucs2Write (buf, string, offset, length) {
  792. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  793. }
  794. Buffer.prototype.write = function write (string, offset, length, encoding) {
  795. // Buffer#write(string)
  796. if (offset === undefined) {
  797. encoding = 'utf8'
  798. length = this.length
  799. offset = 0
  800. // Buffer#write(string, encoding)
  801. } else if (length === undefined && typeof offset === 'string') {
  802. encoding = offset
  803. length = this.length
  804. offset = 0
  805. // Buffer#write(string, offset[, length][, encoding])
  806. } else if (isFinite(offset)) {
  807. offset = offset | 0
  808. if (isFinite(length)) {
  809. length = length | 0
  810. if (encoding === undefined) encoding = 'utf8'
  811. } else {
  812. encoding = length
  813. length = undefined
  814. }
  815. // legacy write(string, encoding, offset, length) - remove in v0.13
  816. } else {
  817. throw new Error(
  818. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  819. )
  820. }
  821. var remaining = this.length - offset
  822. if (length === undefined || length > remaining) length = remaining
  823. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  824. throw new RangeError('Attempt to write outside buffer bounds')
  825. }
  826. if (!encoding) encoding = 'utf8'
  827. var loweredCase = false
  828. for (;;) {
  829. switch (encoding) {
  830. case 'hex':
  831. return hexWrite(this, string, offset, length)
  832. case 'utf8':
  833. case 'utf-8':
  834. return utf8Write(this, string, offset, length)
  835. case 'ascii':
  836. return asciiWrite(this, string, offset, length)
  837. case 'latin1':
  838. case 'binary':
  839. return latin1Write(this, string, offset, length)
  840. case 'base64':
  841. // Warning: maxLength not taken into account in base64Write
  842. return base64Write(this, string, offset, length)
  843. case 'ucs2':
  844. case 'ucs-2':
  845. case 'utf16le':
  846. case 'utf-16le':
  847. return ucs2Write(this, string, offset, length)
  848. default:
  849. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  850. encoding = ('' + encoding).toLowerCase()
  851. loweredCase = true
  852. }
  853. }
  854. }
  855. Buffer.prototype.toJSON = function toJSON () {
  856. return {
  857. type: 'Buffer',
  858. data: Array.prototype.slice.call(this._arr || this, 0)
  859. }
  860. }
  861. function base64Slice (buf, start, end) {
  862. if (start === 0 && end === buf.length) {
  863. return base64.fromByteArray(buf)
  864. } else {
  865. return base64.fromByteArray(buf.slice(start, end))
  866. }
  867. }
  868. function utf8Slice (buf, start, end) {
  869. end = Math.min(buf.length, end)
  870. var res = []
  871. var i = start
  872. while (i < end) {
  873. var firstByte = buf[i]
  874. var codePoint = null
  875. var bytesPerSequence = (firstByte > 0xEF) ? 4
  876. : (firstByte > 0xDF) ? 3
  877. : (firstByte > 0xBF) ? 2
  878. : 1
  879. if (i + bytesPerSequence <= end) {
  880. var secondByte, thirdByte, fourthByte, tempCodePoint
  881. switch (bytesPerSequence) {
  882. case 1:
  883. if (firstByte < 0x80) {
  884. codePoint = firstByte
  885. }
  886. break
  887. case 2:
  888. secondByte = buf[i + 1]
  889. if ((secondByte & 0xC0) === 0x80) {
  890. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  891. if (tempCodePoint > 0x7F) {
  892. codePoint = tempCodePoint
  893. }
  894. }
  895. break
  896. case 3:
  897. secondByte = buf[i + 1]
  898. thirdByte = buf[i + 2]
  899. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  900. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  901. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  902. codePoint = tempCodePoint
  903. }
  904. }
  905. break
  906. case 4:
  907. secondByte = buf[i + 1]
  908. thirdByte = buf[i + 2]
  909. fourthByte = buf[i + 3]
  910. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  911. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  912. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  913. codePoint = tempCodePoint
  914. }
  915. }
  916. }
  917. }
  918. if (codePoint === null) {
  919. // we did not generate a valid codePoint so insert a
  920. // replacement char (U+FFFD) and advance only 1 byte
  921. codePoint = 0xFFFD
  922. bytesPerSequence = 1
  923. } else if (codePoint > 0xFFFF) {
  924. // encode to utf16 (surrogate pair dance)
  925. codePoint -= 0x10000
  926. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  927. codePoint = 0xDC00 | codePoint & 0x3FF
  928. }
  929. res.push(codePoint)
  930. i += bytesPerSequence
  931. }
  932. return decodeCodePointsArray(res)
  933. }
  934. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  935. // the lowest limit is Chrome, with 0x10000 args.
  936. // We go 1 magnitude less, for safety
  937. var MAX_ARGUMENTS_LENGTH = 0x1000
  938. function decodeCodePointsArray (codePoints) {
  939. var len = codePoints.length
  940. if (len <= MAX_ARGUMENTS_LENGTH) {
  941. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  942. }
  943. // Decode in chunks to avoid "call stack size exceeded".
  944. var res = ''
  945. var i = 0
  946. while (i < len) {
  947. res += String.fromCharCode.apply(
  948. String,
  949. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  950. )
  951. }
  952. return res
  953. }
  954. function asciiSlice (buf, start, end) {
  955. var ret = ''
  956. end = Math.min(buf.length, end)
  957. for (var i = start; i < end; ++i) {
  958. ret += String.fromCharCode(buf[i] & 0x7F)
  959. }
  960. return ret
  961. }
  962. function latin1Slice (buf, start, end) {
  963. var ret = ''
  964. end = Math.min(buf.length, end)
  965. for (var i = start; i < end; ++i) {
  966. ret += String.fromCharCode(buf[i])
  967. }
  968. return ret
  969. }
  970. function hexSlice (buf, start, end) {
  971. var len = buf.length
  972. if (!start || start < 0) start = 0
  973. if (!end || end < 0 || end > len) end = len
  974. var out = ''
  975. for (var i = start; i < end; ++i) {
  976. out += toHex(buf[i])
  977. }
  978. return out
  979. }
  980. function utf16leSlice (buf, start, end) {
  981. var bytes = buf.slice(start, end)
  982. var res = ''
  983. for (var i = 0; i < bytes.length; i += 2) {
  984. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  985. }
  986. return res
  987. }
  988. Buffer.prototype.slice = function slice (start, end) {
  989. var len = this.length
  990. start = ~~start
  991. end = end === undefined ? len : ~~end
  992. if (start < 0) {
  993. start += len
  994. if (start < 0) start = 0
  995. } else if (start > len) {
  996. start = len
  997. }
  998. if (end < 0) {
  999. end += len
  1000. if (end < 0) end = 0
  1001. } else if (end > len) {
  1002. end = len
  1003. }
  1004. if (end < start) end = start
  1005. var newBuf
  1006. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1007. newBuf = this.subarray(start, end)
  1008. newBuf.__proto__ = Buffer.prototype
  1009. } else {
  1010. var sliceLen = end - start
  1011. newBuf = new Buffer(sliceLen, undefined)
  1012. for (var i = 0; i < sliceLen; ++i) {
  1013. newBuf[i] = this[i + start]
  1014. }
  1015. }
  1016. return newBuf
  1017. }
  1018. /*
  1019. * Need to make sure that buffer isn't trying to write out of bounds.
  1020. */
  1021. function checkOffset (offset, ext, length) {
  1022. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  1023. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  1024. }
  1025. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  1026. offset = offset | 0
  1027. byteLength = byteLength | 0
  1028. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1029. var val = this[offset]
  1030. var mul = 1
  1031. var i = 0
  1032. while (++i < byteLength && (mul *= 0x100)) {
  1033. val += this[offset + i] * mul
  1034. }
  1035. return val
  1036. }
  1037. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  1038. offset = offset | 0
  1039. byteLength = byteLength | 0
  1040. if (!noAssert) {
  1041. checkOffset(offset, byteLength, this.length)
  1042. }
  1043. var val = this[offset + --byteLength]
  1044. var mul = 1
  1045. while (byteLength > 0 && (mul *= 0x100)) {
  1046. val += this[offset + --byteLength] * mul
  1047. }
  1048. return val
  1049. }
  1050. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  1051. if (!noAssert) checkOffset(offset, 1, this.length)
  1052. return this[offset]
  1053. }
  1054. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  1055. if (!noAssert) checkOffset(offset, 2, this.length)
  1056. return this[offset] | (this[offset + 1] << 8)
  1057. }
  1058. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  1059. if (!noAssert) checkOffset(offset, 2, this.length)
  1060. return (this[offset] << 8) | this[offset + 1]
  1061. }
  1062. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  1063. if (!noAssert) checkOffset(offset, 4, this.length)
  1064. return ((this[offset]) |
  1065. (this[offset + 1] << 8) |
  1066. (this[offset + 2] << 16)) +
  1067. (this[offset + 3] * 0x1000000)
  1068. }
  1069. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  1070. if (!noAssert) checkOffset(offset, 4, this.length)
  1071. return (this[offset] * 0x1000000) +
  1072. ((this[offset + 1] << 16) |
  1073. (this[offset + 2] << 8) |
  1074. this[offset + 3])
  1075. }
  1076. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  1077. offset = offset | 0
  1078. byteLength = byteLength | 0
  1079. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1080. var val = this[offset]
  1081. var mul = 1
  1082. var i = 0
  1083. while (++i < byteLength && (mul *= 0x100)) {
  1084. val += this[offset + i] * mul
  1085. }
  1086. mul *= 0x80
  1087. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1088. return val
  1089. }
  1090. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  1091. offset = offset | 0
  1092. byteLength = byteLength | 0
  1093. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1094. var i = byteLength
  1095. var mul = 1
  1096. var val = this[offset + --i]
  1097. while (i > 0 && (mul *= 0x100)) {
  1098. val += this[offset + --i] * mul
  1099. }
  1100. mul *= 0x80
  1101. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1102. return val
  1103. }
  1104. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  1105. if (!noAssert) checkOffset(offset, 1, this.length)
  1106. if (!(this[offset] & 0x80)) return (this[offset])
  1107. return ((0xff - this[offset] + 1) * -1)
  1108. }
  1109. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  1110. if (!noAssert) checkOffset(offset, 2, this.length)
  1111. var val = this[offset] | (this[offset + 1] << 8)
  1112. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1113. }
  1114. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  1115. if (!noAssert) checkOffset(offset, 2, this.length)
  1116. var val = this[offset + 1] | (this[offset] << 8)
  1117. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1118. }
  1119. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  1120. if (!noAssert) checkOffset(offset, 4, this.length)
  1121. return (this[offset]) |
  1122. (this[offset + 1] << 8) |
  1123. (this[offset + 2] << 16) |
  1124. (this[offset + 3] << 24)
  1125. }
  1126. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  1127. if (!noAssert) checkOffset(offset, 4, this.length)
  1128. return (this[offset] << 24) |
  1129. (this[offset + 1] << 16) |
  1130. (this[offset + 2] << 8) |
  1131. (this[offset + 3])
  1132. }
  1133. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  1134. if (!noAssert) checkOffset(offset, 4, this.length)
  1135. return ieee754.read(this, offset, true, 23, 4)
  1136. }
  1137. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  1138. if (!noAssert) checkOffset(offset, 4, this.length)
  1139. return ieee754.read(this, offset, false, 23, 4)
  1140. }
  1141. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  1142. if (!noAssert) checkOffset(offset, 8, this.length)
  1143. return ieee754.read(this, offset, true, 52, 8)
  1144. }
  1145. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  1146. if (!noAssert) checkOffset(offset, 8, this.length)
  1147. return ieee754.read(this, offset, false, 52, 8)
  1148. }
  1149. function checkInt (buf, value, offset, ext, max, min) {
  1150. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  1151. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  1152. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1153. }
  1154. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  1155. value = +value
  1156. offset = offset | 0
  1157. byteLength = byteLength | 0
  1158. if (!noAssert) {
  1159. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1160. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1161. }
  1162. var mul = 1
  1163. var i = 0
  1164. this[offset] = value & 0xFF
  1165. while (++i < byteLength && (mul *= 0x100)) {
  1166. this[offset + i] = (value / mul) & 0xFF
  1167. }
  1168. return offset + byteLength
  1169. }
  1170. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  1171. value = +value
  1172. offset = offset | 0
  1173. byteLength = byteLength | 0
  1174. if (!noAssert) {
  1175. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1176. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1177. }
  1178. var i = byteLength - 1
  1179. var mul = 1
  1180. this[offset + i] = value & 0xFF
  1181. while (--i >= 0 && (mul *= 0x100)) {
  1182. this[offset + i] = (value / mul) & 0xFF
  1183. }
  1184. return offset + byteLength
  1185. }
  1186. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  1187. value = +value
  1188. offset = offset | 0
  1189. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  1190. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1191. this[offset] = (value & 0xff)
  1192. return offset + 1
  1193. }
  1194. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  1195. if (value < 0) value = 0xffff + value + 1
  1196. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  1197. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  1198. (littleEndian ? i : 1 - i) * 8
  1199. }
  1200. }
  1201. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  1202. value = +value
  1203. offset = offset | 0
  1204. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1205. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1206. this[offset] = (value & 0xff)
  1207. this[offset + 1] = (value >>> 8)
  1208. } else {
  1209. objectWriteUInt16(this, value, offset, true)
  1210. }
  1211. return offset + 2
  1212. }
  1213. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  1214. value = +value
  1215. offset = offset | 0
  1216. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1217. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1218. this[offset] = (value >>> 8)
  1219. this[offset + 1] = (value & 0xff)
  1220. } else {
  1221. objectWriteUInt16(this, value, offset, false)
  1222. }
  1223. return offset + 2
  1224. }
  1225. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  1226. if (value < 0) value = 0xffffffff + value + 1
  1227. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  1228. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  1229. }
  1230. }
  1231. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  1232. value = +value
  1233. offset = offset | 0
  1234. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1235. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1236. this[offset + 3] = (value >>> 24)
  1237. this[offset + 2] = (value >>> 16)
  1238. this[offset + 1] = (value >>> 8)
  1239. this[offset] = (value & 0xff)
  1240. } else {
  1241. objectWriteUInt32(this, value, offset, true)
  1242. }
  1243. return offset + 4
  1244. }
  1245. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  1246. value = +value
  1247. offset = offset | 0
  1248. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1249. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1250. this[offset] = (value >>> 24)
  1251. this[offset + 1] = (value >>> 16)
  1252. this[offset + 2] = (value >>> 8)
  1253. this[offset + 3] = (value & 0xff)
  1254. } else {
  1255. objectWriteUInt32(this, value, offset, false)
  1256. }
  1257. return offset + 4
  1258. }
  1259. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  1260. value = +value
  1261. offset = offset | 0
  1262. if (!noAssert) {
  1263. var limit = Math.pow(2, 8 * byteLength - 1)
  1264. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1265. }
  1266. var i = 0
  1267. var mul = 1
  1268. var sub = 0
  1269. this[offset] = value & 0xFF
  1270. while (++i < byteLength && (mul *= 0x100)) {
  1271. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  1272. sub = 1
  1273. }
  1274. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1275. }
  1276. return offset + byteLength
  1277. }
  1278. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  1279. value = +value
  1280. offset = offset | 0
  1281. if (!noAssert) {
  1282. var limit = Math.pow(2, 8 * byteLength - 1)
  1283. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1284. }
  1285. var i = byteLength - 1
  1286. var mul = 1
  1287. var sub = 0
  1288. this[offset + i] = value & 0xFF
  1289. while (--i >= 0 && (mul *= 0x100)) {
  1290. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  1291. sub = 1
  1292. }
  1293. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1294. }
  1295. return offset + byteLength
  1296. }
  1297. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  1298. value = +value
  1299. offset = offset | 0
  1300. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  1301. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1302. if (value < 0) value = 0xff + value + 1
  1303. this[offset] = (value & 0xff)
  1304. return offset + 1
  1305. }
  1306. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  1307. value = +value
  1308. offset = offset | 0
  1309. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1310. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1311. this[offset] = (value & 0xff)
  1312. this[offset + 1] = (value >>> 8)
  1313. } else {
  1314. objectWriteUInt16(this, value, offset, true)
  1315. }
  1316. return offset + 2
  1317. }
  1318. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  1319. value = +value
  1320. offset = offset | 0
  1321. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1322. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1323. this[offset] = (value >>> 8)
  1324. this[offset + 1] = (value & 0xff)
  1325. } else {
  1326. objectWriteUInt16(this, value, offset, false)
  1327. }
  1328. return offset + 2
  1329. }
  1330. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  1331. value = +value
  1332. offset = offset | 0
  1333. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1334. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1335. this[offset] = (value & 0xff)
  1336. this[offset + 1] = (value >>> 8)
  1337. this[offset + 2] = (value >>> 16)
  1338. this[offset + 3] = (value >>> 24)
  1339. } else {
  1340. objectWriteUInt32(this, value, offset, true)
  1341. }
  1342. return offset + 4
  1343. }
  1344. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  1345. value = +value
  1346. offset = offset | 0
  1347. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1348. if (value < 0) value = 0xffffffff + value + 1
  1349. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1350. this[offset] = (value >>> 24)
  1351. this[offset + 1] = (value >>> 16)
  1352. this[offset + 2] = (value >>> 8)
  1353. this[offset + 3] = (value & 0xff)
  1354. } else {
  1355. objectWriteUInt32(this, value, offset, false)
  1356. }
  1357. return offset + 4
  1358. }
  1359. function checkIEEE754 (buf, value, offset, ext, max, min) {
  1360. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1361. if (offset < 0) throw new RangeError('Index out of range')
  1362. }
  1363. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  1364. if (!noAssert) {
  1365. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  1366. }
  1367. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  1368. return offset + 4
  1369. }
  1370. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  1371. return writeFloat(this, value, offset, true, noAssert)
  1372. }
  1373. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  1374. return writeFloat(this, value, offset, false, noAssert)
  1375. }
  1376. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  1377. if (!noAssert) {
  1378. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  1379. }
  1380. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  1381. return offset + 8
  1382. }
  1383. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  1384. return writeDouble(this, value, offset, true, noAssert)
  1385. }
  1386. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  1387. return writeDouble(this, value, offset, false, noAssert)
  1388. }
  1389. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  1390. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  1391. if (!start) start = 0
  1392. if (!end && end !== 0) end = this.length
  1393. if (targetStart >= target.length) targetStart = target.length
  1394. if (!targetStart) targetStart = 0
  1395. if (end > 0 && end < start) end = start
  1396. // Copy 0 bytes; we're done
  1397. if (end === start) return 0
  1398. if (target.length === 0 || this.length === 0) return 0
  1399. // Fatal error conditions
  1400. if (targetStart < 0) {
  1401. throw new RangeError('targetStart out of bounds')
  1402. }
  1403. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  1404. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  1405. // Are we oob?
  1406. if (end > this.length) end = this.length
  1407. if (target.length - targetStart < end - start) {
  1408. end = target.length - targetStart + start
  1409. }
  1410. var len = end - start
  1411. var i
  1412. if (this === target && start < targetStart && targetStart < end) {
  1413. // descending copy from end
  1414. for (i = len - 1; i >= 0; --i) {
  1415. target[i + targetStart] = this[i + start]
  1416. }
  1417. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  1418. // ascending copy from start
  1419. for (i = 0; i < len; ++i) {
  1420. target[i + targetStart] = this[i + start]
  1421. }
  1422. } else {
  1423. Uint8Array.prototype.set.call(
  1424. target,
  1425. this.subarray(start, start + len),
  1426. targetStart
  1427. )
  1428. }
  1429. return len
  1430. }
  1431. // Usage:
  1432. // buffer.fill(number[, offset[, end]])
  1433. // buffer.fill(buffer[, offset[, end]])
  1434. // buffer.fill(string[, offset[, end]][, encoding])
  1435. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  1436. // Handle string cases:
  1437. if (typeof val === 'string') {
  1438. if (typeof start === 'string') {
  1439. encoding = start
  1440. start = 0
  1441. end = this.length
  1442. } else if (typeof end === 'string') {
  1443. encoding = end
  1444. end = this.length
  1445. }
  1446. if (val.length === 1) {
  1447. var code = val.charCodeAt(0)
  1448. if (code < 256) {
  1449. val = code
  1450. }
  1451. }
  1452. if (encoding !== undefined && typeof encoding !== 'string') {
  1453. throw new TypeError('encoding must be a string')
  1454. }
  1455. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  1456. throw new TypeError('Unknown encoding: ' + encoding)
  1457. }
  1458. } else if (typeof val === 'number') {
  1459. val = val & 255
  1460. }
  1461. // Invalid ranges are not set to a default, so can range check early.
  1462. if (start < 0 || this.length < start || this.length < end) {
  1463. throw new RangeError('Out of range index')
  1464. }
  1465. if (end <= start) {
  1466. return this
  1467. }
  1468. start = start >>> 0
  1469. end = end === undefined ? this.length : end >>> 0
  1470. if (!val) val = 0
  1471. var i
  1472. if (typeof val === 'number') {
  1473. for (i = start; i < end; ++i) {
  1474. this[i] = val
  1475. }
  1476. } else {
  1477. var bytes = Buffer.isBuffer(val)
  1478. ? val
  1479. : utf8ToBytes(new Buffer(val, encoding).toString())
  1480. var len = bytes.length
  1481. for (i = 0; i < end - start; ++i) {
  1482. this[i + start] = bytes[i % len]
  1483. }
  1484. }
  1485. return this
  1486. }
  1487. // HELPER FUNCTIONS
  1488. // ================
  1489. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  1490. function base64clean (str) {
  1491. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  1492. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  1493. // Node converts strings with length < 2 to ''
  1494. if (str.length < 2) return ''
  1495. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  1496. while (str.length % 4 !== 0) {
  1497. str = str + '='
  1498. }
  1499. return str
  1500. }
  1501. function stringtrim (str) {
  1502. if (str.trim) return str.trim()
  1503. return str.replace(/^\s+|\s+$/g, '')
  1504. }
  1505. function toHex (n) {
  1506. if (n < 16) return '0' + n.toString(16)
  1507. return n.toString(16)
  1508. }
  1509. function utf8ToBytes (string, units) {
  1510. units = units || Infinity
  1511. var codePoint
  1512. var length = string.length
  1513. var leadSurrogate = null
  1514. var bytes = []
  1515. for (var i = 0; i < length; ++i) {
  1516. codePoint = string.charCodeAt(i)
  1517. // is surrogate component
  1518. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  1519. // last char was a lead
  1520. if (!leadSurrogate) {
  1521. // no lead yet
  1522. if (codePoint > 0xDBFF) {
  1523. // unexpected trail
  1524. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1525. continue
  1526. } else if (i + 1 === length) {
  1527. // unpaired lead
  1528. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1529. continue
  1530. }
  1531. // valid lead
  1532. leadSurrogate = codePoint
  1533. continue
  1534. }
  1535. // 2 leads in a row
  1536. if (codePoint < 0xDC00) {
  1537. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1538. leadSurrogate = codePoint
  1539. continue
  1540. }
  1541. // valid surrogate pair
  1542. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  1543. } else if (leadSurrogate) {
  1544. // valid bmp char, but last char was a lead
  1545. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1546. }
  1547. leadSurrogate = null
  1548. // encode utf8
  1549. if (codePoint < 0x80) {
  1550. if ((units -= 1) < 0) break
  1551. bytes.push(codePoint)
  1552. } else if (codePoint < 0x800) {
  1553. if ((units -= 2) < 0) break
  1554. bytes.push(
  1555. codePoint >> 0x6 | 0xC0,
  1556. codePoint & 0x3F | 0x80
  1557. )
  1558. } else if (codePoint < 0x10000) {
  1559. if ((units -= 3) < 0) break
  1560. bytes.push(
  1561. codePoint >> 0xC | 0xE0,
  1562. codePoint >> 0x6 & 0x3F | 0x80,
  1563. codePoint & 0x3F | 0x80
  1564. )
  1565. } else if (codePoint < 0x110000) {
  1566. if ((units -= 4) < 0) break
  1567. bytes.push(
  1568. codePoint >> 0x12 | 0xF0,
  1569. codePoint >> 0xC & 0x3F | 0x80,
  1570. codePoint >> 0x6 & 0x3F | 0x80,
  1571. codePoint & 0x3F | 0x80
  1572. )
  1573. } else {
  1574. throw new Error('Invalid code point')
  1575. }
  1576. }
  1577. return bytes
  1578. }
  1579. function asciiToBytes (str) {
  1580. var byteArray = []
  1581. for (var i = 0; i < str.length; ++i) {
  1582. // Node's code seems to be doing this and not & 0x7F..
  1583. byteArray.push(str.charCodeAt(i) & 0xFF)
  1584. }
  1585. return byteArray
  1586. }
  1587. function utf16leToBytes (str, units) {
  1588. var c, hi, lo
  1589. var byteArray = []
  1590. for (var i = 0; i < str.length; ++i) {
  1591. if ((units -= 2) < 0) break
  1592. c = str.charCodeAt(i)
  1593. hi = c >> 8
  1594. lo = c % 256
  1595. byteArray.push(lo)
  1596. byteArray.push(hi)
  1597. }
  1598. return byteArray
  1599. }
  1600. function base64ToBytes (str) {
  1601. return base64.toByteArray(base64clean(str))
  1602. }
  1603. function blitBuffer (src, dst, offset, length) {
  1604. for (var i = 0; i < length; ++i) {
  1605. if ((i + offset >= dst.length) || (i >= src.length)) break
  1606. dst[i + offset] = src[i]
  1607. }
  1608. return i
  1609. }
  1610. function isnan (val) {
  1611. return val !== val // eslint-disable-line no-self-compare
  1612. }
  1613. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(32)))
  1614. /***/ },
  1615. /* 1 */
  1616. /***/ function(module, exports) {
  1617. if (typeof Object.create === 'function') {
  1618. // implementation from standard node.js 'util' module
  1619. module.exports = function inherits(ctor, superCtor) {
  1620. ctor.super_ = superCtor
  1621. ctor.prototype = Object.create(superCtor.prototype, {
  1622. constructor: {
  1623. value: ctor,
  1624. enumerable: false,
  1625. writable: true,
  1626. configurable: true
  1627. }
  1628. });
  1629. };
  1630. } else {
  1631. // old school shim for old browsers
  1632. module.exports = function inherits(ctor, superCtor) {
  1633. ctor.super_ = superCtor
  1634. var TempCtor = function () {}
  1635. TempCtor.prototype = superCtor.prototype
  1636. ctor.prototype = new TempCtor()
  1637. ctor.prototype.constructor = ctor
  1638. }
  1639. }
  1640. /***/ },
  1641. /* 2 */
  1642. /***/ function(module, exports, __webpack_require__) {
  1643. /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
  1644. 'use strict';
  1645. // Utils
  1646. function assert (val, msg) {
  1647. if (!val) throw new Error(msg || 'Assertion failed');
  1648. }
  1649. // Could use `inherits` module, but don't want to move from single file
  1650. // architecture yet.
  1651. function inherits (ctor, superCtor) {
  1652. ctor.super_ = superCtor;
  1653. var TempCtor = function () {};
  1654. TempCtor.prototype = superCtor.prototype;
  1655. ctor.prototype = new TempCtor();
  1656. ctor.prototype.constructor = ctor;
  1657. }
  1658. // BN
  1659. function BN (number, base, endian) {
  1660. if (BN.isBN(number)) {
  1661. return number;
  1662. }
  1663. this.negative = 0;
  1664. this.words = null;
  1665. this.length = 0;
  1666. // Reduction context
  1667. this.red = null;
  1668. if (number !== null) {
  1669. if (base === 'le' || base === 'be') {
  1670. endian = base;
  1671. base = 10;
  1672. }
  1673. this._init(number || 0, base || 10, endian || 'be');
  1674. }
  1675. }
  1676. if (typeof module === 'object') {
  1677. module.exports = BN;
  1678. } else {
  1679. exports.BN = BN;
  1680. }
  1681. BN.BN = BN;
  1682. BN.wordSize = 26;
  1683. var Buffer;
  1684. try {
  1685. Buffer = __webpack_require__(0).Buffer;
  1686. } catch (e) {
  1687. }
  1688. BN.isBN = function isBN (num) {
  1689. if (num instanceof BN) {
  1690. return true;
  1691. }
  1692. return num !== null && typeof num === 'object' &&
  1693. num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
  1694. };
  1695. BN.max = function max (left, right) {
  1696. if (left.cmp(right) > 0) return left;
  1697. return right;
  1698. };
  1699. BN.min = function min (left, right) {
  1700. if (left.cmp(right) < 0) return left;
  1701. return right;
  1702. };
  1703. BN.prototype._init = function init (number, base, endian) {
  1704. if (typeof number === 'number') {
  1705. return this._initNumber(number, base, endian);
  1706. }
  1707. if (typeof number === 'object') {
  1708. return this._initArray(number, base, endian);
  1709. }
  1710. if (base === 'hex') {
  1711. base = 16;
  1712. }
  1713. assert(base === (base | 0) && base >= 2 && base <= 36);
  1714. number = number.toString().replace(/\s+/g, '');
  1715. var start = 0;
  1716. if (number[0] === '-') {
  1717. start++;
  1718. }
  1719. if (base === 16) {
  1720. this._parseHex(number, start);
  1721. } else {
  1722. this._parseBase(number, base, start);
  1723. }
  1724. if (number[0] === '-') {
  1725. this.negative = 1;
  1726. }
  1727. this.strip();
  1728. if (endian !== 'le') return;
  1729. this._initArray(this.toArray(), base, endian);
  1730. };
  1731. BN.prototype._initNumber = function _initNumber (number, base, endian) {
  1732. if (number < 0) {
  1733. this.negative = 1;
  1734. number = -number;
  1735. }
  1736. if (number < 0x4000000) {
  1737. this.words = [ number & 0x3ffffff ];
  1738. this.length = 1;
  1739. } else if (number < 0x10000000000000) {
  1740. this.words = [
  1741. number & 0x3ffffff,
  1742. (number / 0x4000000) & 0x3ffffff
  1743. ];
  1744. this.length = 2;
  1745. } else {
  1746. assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
  1747. this.words = [
  1748. number & 0x3ffffff,
  1749. (number / 0x4000000) & 0x3ffffff,
  1750. 1
  1751. ];
  1752. this.length = 3;
  1753. }
  1754. if (endian !== 'le') return;
  1755. // Reverse the bytes
  1756. this._initArray(this.toArray(), base, endian);
  1757. };
  1758. BN.prototype._initArray = function _initArray (number, base, endian) {
  1759. // Perhaps a Uint8Array
  1760. assert(typeof number.length === 'number');
  1761. if (number.length <= 0) {
  1762. this.words = [ 0 ];
  1763. this.length = 1;
  1764. return this;
  1765. }
  1766. this.length = Math.ceil(number.length / 3);
  1767. this.words = new Array(this.length);
  1768. for (var i = 0; i < this.length; i++) {
  1769. this.words[i] = 0;
  1770. }
  1771. var j, w;
  1772. var off = 0;
  1773. if (endian === 'be') {
  1774. for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
  1775. w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
  1776. this.words[j] |= (w << off) & 0x3ffffff;
  1777. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  1778. off += 24;
  1779. if (off >= 26) {
  1780. off -= 26;
  1781. j++;
  1782. }
  1783. }
  1784. } else if (endian === 'le') {
  1785. for (i = 0, j = 0; i < number.length; i += 3) {
  1786. w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
  1787. this.words[j] |= (w << off) & 0x3ffffff;
  1788. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  1789. off += 24;
  1790. if (off >= 26) {
  1791. off -= 26;
  1792. j++;
  1793. }
  1794. }
  1795. }
  1796. return this.strip();
  1797. };
  1798. function parseHex (str, start, end) {
  1799. var r = 0;
  1800. var len = Math.min(str.length, end);
  1801. for (var i = start; i < len; i++) {
  1802. var c = str.charCodeAt(i) - 48;
  1803. r <<= 4;
  1804. // 'a' - 'f'
  1805. if (c >= 49 && c <= 54) {
  1806. r |= c - 49 + 0xa;
  1807. // 'A' - 'F'
  1808. } else if (c >= 17 && c <= 22) {
  1809. r |= c - 17 + 0xa;
  1810. // '0' - '9'
  1811. } else {
  1812. r |= c & 0xf;
  1813. }
  1814. }
  1815. return r;
  1816. }
  1817. BN.prototype._parseHex = function _parseHex (number, start) {
  1818. // Create possibly bigger array to ensure that it fits the number
  1819. this.length = Math.ceil((number.length - start) / 6);
  1820. this.words = new Array(this.length);
  1821. for (var i = 0; i < this.length; i++) {
  1822. this.words[i] = 0;
  1823. }
  1824. var j, w;
  1825. // Scan 24-bit chunks and add them to the number
  1826. var off = 0;
  1827. for (i = number.length - 6, j = 0; i >= start; i -= 6) {
  1828. w = parseHex(number, i, i + 6);
  1829. this.words[j] |= (w << off) & 0x3ffffff;
  1830. // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
  1831. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  1832. off += 24;
  1833. if (off >= 26) {
  1834. off -= 26;
  1835. j++;
  1836. }
  1837. }
  1838. if (i + 6 !== start) {
  1839. w = parseHex(number, start, i + 6);
  1840. this.words[j] |= (w << off) & 0x3ffffff;
  1841. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  1842. }
  1843. this.strip();
  1844. };
  1845. function parseBase (str, start, end, mul) {
  1846. var r = 0;
  1847. var len = Math.min(str.length, end);
  1848. for (var i = start; i < len; i++) {
  1849. var c = str.charCodeAt(i) - 48;
  1850. r *= mul;
  1851. // 'a'
  1852. if (c >= 49) {
  1853. r += c - 49 + 0xa;
  1854. // 'A'
  1855. } else if (c >= 17) {
  1856. r += c - 17 + 0xa;
  1857. // '0' - '9'
  1858. } else {
  1859. r += c;
  1860. }
  1861. }
  1862. return r;
  1863. }
  1864. BN.prototype._parseBase = function _parseBase (number, base, start) {
  1865. // Initialize as zero
  1866. this.words = [ 0 ];
  1867. this.length = 1;
  1868. // Find length of limb in base
  1869. for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
  1870. limbLen++;
  1871. }
  1872. limbLen--;
  1873. limbPow = (limbPow / base) | 0;
  1874. var total = number.length - start;
  1875. var mod = total % limbLen;
  1876. var end = Math.min(total, total - mod) + start;
  1877. var word = 0;
  1878. for (var i = start; i < end; i += limbLen) {
  1879. word = parseBase(number, i, i + limbLen, base);
  1880. this.imuln(limbPow);
  1881. if (this.words[0] + word < 0x4000000) {
  1882. this.words[0] += word;
  1883. } else {
  1884. this._iaddn(word);
  1885. }
  1886. }
  1887. if (mod !== 0) {
  1888. var pow = 1;
  1889. word = parseBase(number, i, number.length, base);
  1890. for (i = 0; i < mod; i++) {
  1891. pow *= base;
  1892. }
  1893. this.imuln(pow);
  1894. if (this.words[0] + word < 0x4000000) {
  1895. this.words[0] += word;
  1896. } else {
  1897. this._iaddn(word);
  1898. }
  1899. }
  1900. };
  1901. BN.prototype.copy = function copy (dest) {
  1902. dest.words = new Array(this.length);
  1903. for (var i = 0; i < this.length; i++) {
  1904. dest.words[i] = this.words[i];
  1905. }
  1906. dest.length = this.length;
  1907. dest.negative = this.negative;
  1908. dest.red = this.red;
  1909. };
  1910. BN.prototype.clone = function clone () {
  1911. var r = new BN(null);
  1912. this.copy(r);
  1913. return r;
  1914. };
  1915. BN.prototype._expand = function _expand (size) {
  1916. while (this.length < size) {
  1917. this.words[this.length++] = 0;
  1918. }
  1919. return this;
  1920. };
  1921. // Remove leading `0` from `this`
  1922. BN.prototype.strip = function strip () {
  1923. while (this.length > 1 && this.words[this.length - 1] === 0) {
  1924. this.length--;
  1925. }
  1926. return this._normSign();
  1927. };
  1928. BN.prototype._normSign = function _normSign () {
  1929. // -0 = 0
  1930. if (this.length === 1 && this.words[0] === 0) {
  1931. this.negative = 0;
  1932. }
  1933. return this;
  1934. };
  1935. BN.prototype.inspect = function inspect () {
  1936. return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
  1937. };
  1938. /*
  1939. var zeros = [];
  1940. var groupSizes = [];
  1941. var groupBases = [];
  1942. var s = '';
  1943. var i = -1;
  1944. while (++i < BN.wordSize) {
  1945. zeros[i] = s;
  1946. s += '0';
  1947. }
  1948. groupSizes[0] = 0;
  1949. groupSizes[1] = 0;
  1950. groupBases[0] = 0;
  1951. groupBases[1] = 0;
  1952. var base = 2 - 1;
  1953. while (++base < 36 + 1) {
  1954. var groupSize = 0;
  1955. var groupBase = 1;
  1956. while (groupBase < (1 << BN.wordSize) / base) {
  1957. groupBase *= base;
  1958. groupSize += 1;
  1959. }
  1960. groupSizes[base] = groupSize;
  1961. groupBases[base] = groupBase;
  1962. }
  1963. */
  1964. var zeros = [
  1965. '',
  1966. '0',
  1967. '00',
  1968. '000',
  1969. '0000',
  1970. '00000',
  1971. '000000',
  1972. '0000000',
  1973. '00000000',
  1974. '000000000',
  1975. '0000000000',
  1976. '00000000000',
  1977. '000000000000',
  1978. '0000000000000',
  1979. '00000000000000',
  1980. '000000000000000',
  1981. '0000000000000000',
  1982. '00000000000000000',
  1983. '000000000000000000',
  1984. '0000000000000000000',
  1985. '00000000000000000000',
  1986. '000000000000000000000',
  1987. '0000000000000000000000',
  1988. '00000000000000000000000',
  1989. '000000000000000000000000',
  1990. '0000000000000000000000000'
  1991. ];
  1992. var groupSizes = [
  1993. 0, 0,
  1994. 25, 16, 12, 11, 10, 9, 8,
  1995. 8, 7, 7, 7, 7, 6, 6,
  1996. 6, 6, 6, 6, 6, 5, 5,
  1997. 5, 5, 5, 5, 5, 5, 5,
  1998. 5, 5, 5, 5, 5, 5, 5
  1999. ];
  2000. var groupBases = [
  2001. 0, 0,
  2002. 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
  2003. 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
  2004. 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
  2005. 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
  2006. 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  2007. ];
  2008. BN.prototype.toString = function toString (base, padding) {
  2009. base = base || 10;
  2010. padding = padding | 0 || 1;
  2011. var out;
  2012. if (base === 16 || base === 'hex') {
  2013. out = '';
  2014. var off = 0;
  2015. var carry = 0;
  2016. for (var i = 0; i < this.length; i++) {
  2017. var w = this.words[i];
  2018. var word = (((w << off) | carry) & 0xffffff).toString(16);
  2019. carry = (w >>> (24 - off)) & 0xffffff;
  2020. if (carry !== 0 || i !== this.length - 1) {
  2021. out = zeros[6 - word.length] + word + out;
  2022. } else {
  2023. out = word + out;
  2024. }
  2025. off += 2;
  2026. if (off >= 26) {
  2027. off -= 26;
  2028. i--;
  2029. }
  2030. }
  2031. if (carry !== 0) {
  2032. out = carry.toString(16) + out;
  2033. }
  2034. while (out.length % padding !== 0) {
  2035. out = '0' + out;
  2036. }
  2037. if (this.negative !== 0) {
  2038. out = '-' + out;
  2039. }
  2040. return out;
  2041. }
  2042. if (base === (base | 0) && base >= 2 && base <= 36) {
  2043. // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
  2044. var groupSize = groupSizes[base];
  2045. // var groupBase = Math.pow(base, groupSize);
  2046. var groupBase = groupBases[base];
  2047. out = '';
  2048. var c = this.clone();
  2049. c.negative = 0;
  2050. while (!c.isZero()) {
  2051. var r = c.modn(groupBase).toString(base);
  2052. c = c.idivn(groupBase);
  2053. if (!c.isZero()) {
  2054. out = zeros[groupSize - r.length] + r + out;
  2055. } else {
  2056. out = r + out;
  2057. }
  2058. }
  2059. if (this.isZero()) {
  2060. out = '0' + out;
  2061. }
  2062. while (out.length % padding !== 0) {
  2063. out = '0' + out;
  2064. }
  2065. if (this.negative !== 0) {
  2066. out = '-' + out;
  2067. }
  2068. return out;
  2069. }
  2070. assert(false, 'Base should be between 2 and 36');
  2071. };
  2072. BN.prototype.toNumber = function toNumber () {
  2073. var ret = this.words[0];
  2074. if (this.length === 2) {
  2075. ret += this.words[1] * 0x4000000;
  2076. } else if (this.length === 3 && this.words[2] === 0x01) {
  2077. // NOTE: at this stage it is known that the top bit is set
  2078. ret += 0x10000000000000 + (this.words[1] * 0x4000000);
  2079. } else if (this.length > 2) {
  2080. assert(false, 'Number can only safely store up to 53 bits');
  2081. }
  2082. return (this.negative !== 0) ? -ret : ret;
  2083. };
  2084. BN.prototype.toJSON = function toJSON () {
  2085. return this.toString(16);
  2086. };
  2087. BN.prototype.toBuffer = function toBuffer (endian, length) {
  2088. assert(typeof Buffer !== 'undefined');
  2089. return this.toArrayLike(Buffer, endian, length);
  2090. };
  2091. BN.prototype.toArray = function toArray (endian, length) {
  2092. return this.toArrayLike(Array, endian, length);
  2093. };
  2094. BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
  2095. var byteLength = this.byteLength();
  2096. var reqLength = length || Math.max(1, byteLength);
  2097. assert(byteLength <= reqLength, 'byte array longer than desired length');
  2098. assert(reqLength > 0, 'Requested array length <= 0');
  2099. this.strip();
  2100. var littleEndian = endian === 'le';
  2101. var res = new ArrayType(reqLength);
  2102. var b, i;
  2103. var q = this.clone();
  2104. if (!littleEndian) {
  2105. // Assume big-endian
  2106. for (i = 0; i < reqLength - byteLength; i++) {
  2107. res[i] = 0;
  2108. }
  2109. for (i = 0; !q.isZero(); i++) {
  2110. b = q.andln(0xff);
  2111. q.iushrn(8);
  2112. res[reqLength - i - 1] = b;
  2113. }
  2114. } else {
  2115. for (i = 0; !q.isZero(); i++) {
  2116. b = q.andln(0xff);
  2117. q.iushrn(8);
  2118. res[i] = b;
  2119. }
  2120. for (; i < reqLength; i++) {
  2121. res[i] = 0;
  2122. }
  2123. }
  2124. return res;
  2125. };
  2126. if (Math.clz32) {
  2127. BN.prototype._countBits = function _countBits (w) {
  2128. return 32 - Math.clz32(w);
  2129. };
  2130. } else {
  2131. BN.prototype._countBits = function _countBits (w) {
  2132. var t = w;
  2133. var r = 0;
  2134. if (t >= 0x1000) {
  2135. r += 13;
  2136. t >>>= 13;
  2137. }
  2138. if (t >= 0x40) {
  2139. r += 7;
  2140. t >>>= 7;
  2141. }
  2142. if (t >= 0x8) {
  2143. r += 4;
  2144. t >>>= 4;
  2145. }
  2146. if (t >= 0x02) {
  2147. r += 2;
  2148. t >>>= 2;
  2149. }
  2150. return r + t;
  2151. };
  2152. }
  2153. BN.prototype._zeroBits = function _zeroBits (w) {
  2154. // Short-cut
  2155. if (w === 0) return 26;
  2156. var t = w;
  2157. var r = 0;
  2158. if ((t & 0x1fff) === 0) {
  2159. r += 13;
  2160. t >>>= 13;
  2161. }
  2162. if ((t & 0x7f) === 0) {
  2163. r += 7;
  2164. t >>>= 7;
  2165. }
  2166. if ((t & 0xf) === 0) {
  2167. r += 4;
  2168. t >>>= 4;
  2169. }
  2170. if ((t & 0x3) === 0) {
  2171. r += 2;
  2172. t >>>= 2;
  2173. }
  2174. if ((t & 0x1) === 0) {
  2175. r++;
  2176. }
  2177. return r;
  2178. };
  2179. // Return number of used bits in a BN
  2180. BN.prototype.bitLength = function bitLength () {
  2181. var w = this.words[this.length - 1];
  2182. var hi = this._countBits(w);
  2183. return (this.length - 1) * 26 + hi;
  2184. };
  2185. function toBitArray (num) {
  2186. var w = new Array(num.bitLength());
  2187. for (var bit = 0; bit < w.length; bit++) {
  2188. var off = (bit / 26) | 0;
  2189. var wbit = bit % 26;
  2190. w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
  2191. }
  2192. return w;
  2193. }
  2194. // Number of trailing zero bits
  2195. BN.prototype.zeroBits = function zeroBits () {
  2196. if (this.isZero()) return 0;
  2197. var r = 0;
  2198. for (var i = 0; i < this.length; i++) {
  2199. var b = this._zeroBits(this.words[i]);
  2200. r += b;
  2201. if (b !== 26) break;
  2202. }
  2203. return r;
  2204. };
  2205. BN.prototype.byteLength = function byteLength () {
  2206. return Math.ceil(this.bitLength() / 8);
  2207. };
  2208. BN.prototype.toTwos = function toTwos (width) {
  2209. if (this.negative !== 0) {
  2210. return this.abs().inotn(width).iaddn(1);
  2211. }
  2212. return this.clone();
  2213. };
  2214. BN.prototype.fromTwos = function fromTwos (width) {
  2215. if (this.testn(width - 1)) {
  2216. return this.notn(width).iaddn(1).ineg();
  2217. }
  2218. return this.clone();
  2219. };
  2220. BN.prototype.isNeg = function isNeg () {
  2221. return this.negative !== 0;
  2222. };
  2223. // Return negative clone of `this`
  2224. BN.prototype.neg = function neg () {
  2225. return this.clone().ineg();
  2226. };
  2227. BN.prototype.ineg = function ineg () {
  2228. if (!this.isZero()) {
  2229. this.negative ^= 1;
  2230. }
  2231. return this;
  2232. };
  2233. // Or `num` with `this` in-place
  2234. BN.prototype.iuor = function iuor (num) {
  2235. while (this.length < num.length) {
  2236. this.words[this.length++] = 0;
  2237. }
  2238. for (var i = 0; i < num.length; i++) {
  2239. this.words[i] = this.words[i] | num.words[i];
  2240. }
  2241. return this.strip();
  2242. };
  2243. BN.prototype.ior = function ior (num) {
  2244. assert((this.negative | num.negative) === 0);
  2245. return this.iuor(num);
  2246. };
  2247. // Or `num` with `this`
  2248. BN.prototype.or = function or (num) {
  2249. if (this.length > num.length) return this.clone().ior(num);
  2250. return num.clone().ior(this);
  2251. };
  2252. BN.prototype.uor = function uor (num) {
  2253. if (this.length > num.length) return this.clone().iuor(num);
  2254. return num.clone().iuor(this);
  2255. };
  2256. // And `num` with `this` in-place
  2257. BN.prototype.iuand = function iuand (num) {
  2258. // b = min-length(num, this)
  2259. var b;
  2260. if (this.length > num.length) {
  2261. b = num;
  2262. } else {
  2263. b = this;
  2264. }
  2265. for (var i = 0; i < b.length; i++) {
  2266. this.words[i] = this.words[i] & num.words[i];
  2267. }
  2268. this.length = b.length;
  2269. return this.strip();
  2270. };
  2271. BN.prototype.iand = function iand (num) {
  2272. assert((this.negative | num.negative) === 0);
  2273. return this.iuand(num);
  2274. };
  2275. // And `num` with `this`
  2276. BN.prototype.and = function and (num) {
  2277. if (this.length > num.length) return this.clone().iand(num);
  2278. return num.clone().iand(this);
  2279. };
  2280. BN.prototype.uand = function uand (num) {
  2281. if (this.length > num.length) return this.clone().iuand(num);
  2282. return num.clone().iuand(this);
  2283. };
  2284. // Xor `num` with `this` in-place
  2285. BN.prototype.iuxor = function iuxor (num) {
  2286. // a.length > b.length
  2287. var a;
  2288. var b;
  2289. if (this.length > num.length) {
  2290. a = this;
  2291. b = num;
  2292. } else {
  2293. a = num;
  2294. b = this;
  2295. }
  2296. for (var i = 0; i < b.length; i++) {
  2297. this.words[i] = a.words[i] ^ b.words[i];
  2298. }
  2299. if (this !== a) {
  2300. for (; i < a.length; i++) {
  2301. this.words[i] = a.words[i];
  2302. }
  2303. }
  2304. this.length = a.length;
  2305. return this.strip();
  2306. };
  2307. BN.prototype.ixor = function ixor (num) {
  2308. assert((this.negative | num.negative) === 0);
  2309. return this.iuxor(num);
  2310. };
  2311. // Xor `num` with `this`
  2312. BN.prototype.xor = function xor (num) {
  2313. if (this.length > num.length) return this.clone().ixor(num);
  2314. return num.clone().ixor(this);
  2315. };
  2316. BN.prototype.uxor = function uxor (num) {
  2317. if (this.length > num.length) return this.clone().iuxor(num);
  2318. return num.clone().iuxor(this);
  2319. };
  2320. // Not ``this`` with ``width`` bitwidth
  2321. BN.prototype.inotn = function inotn (width) {
  2322. assert(typeof width === 'number' && width >= 0);
  2323. var bytesNeeded = Math.ceil(width / 26) | 0;
  2324. var bitsLeft = width % 26;
  2325. // Extend the buffer with leading zeroes
  2326. this._expand(bytesNeeded);
  2327. if (bitsLeft > 0) {
  2328. bytesNeeded--;
  2329. }
  2330. // Handle complete words
  2331. for (var i = 0; i < bytesNeeded; i++) {
  2332. this.words[i] = ~this.words[i] & 0x3ffffff;
  2333. }
  2334. // Handle the residue
  2335. if (bitsLeft > 0) {
  2336. this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
  2337. }
  2338. // And remove leading zeroes
  2339. return this.strip();
  2340. };
  2341. BN.prototype.notn = function notn (width) {
  2342. return this.clone().inotn(width);
  2343. };
  2344. // Set `bit` of `this`
  2345. BN.prototype.setn = function setn (bit, val) {
  2346. assert(typeof bit === 'number' && bit >= 0);
  2347. var off = (bit / 26) | 0;
  2348. var wbit = bit % 26;
  2349. this._expand(off + 1);
  2350. if (val) {
  2351. this.words[off] = this.words[off] | (1 << wbit);
  2352. } else {
  2353. this.words[off] = this.words[off] & ~(1 << wbit);
  2354. }
  2355. return this.strip();
  2356. };
  2357. // Add `num` to `this` in-place
  2358. BN.prototype.iadd = function iadd (num) {
  2359. var r;
  2360. // negative + positive
  2361. if (this.negative !== 0 && num.negative === 0) {
  2362. this.negative = 0;
  2363. r = this.isub(num);
  2364. this.negative ^= 1;
  2365. return this._normSign();
  2366. // positive + negative
  2367. } else if (this.negative === 0 && num.negative !== 0) {
  2368. num.negative = 0;
  2369. r = this.isub(num);
  2370. num.negative = 1;
  2371. return r._normSign();
  2372. }
  2373. // a.length > b.length
  2374. var a, b;
  2375. if (this.length > num.length) {
  2376. a = this;
  2377. b = num;
  2378. } else {
  2379. a = num;
  2380. b = this;
  2381. }
  2382. var carry = 0;
  2383. for (var i = 0; i < b.length; i++) {
  2384. r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
  2385. this.words[i] = r & 0x3ffffff;
  2386. carry = r >>> 26;
  2387. }
  2388. for (; carry !== 0 && i < a.length; i++) {
  2389. r = (a.words[i] | 0) + carry;
  2390. this.words[i] = r & 0x3ffffff;
  2391. carry = r >>> 26;
  2392. }
  2393. this.length = a.length;
  2394. if (carry !== 0) {
  2395. this.words[this.length] = carry;
  2396. this.length++;
  2397. // Copy the rest of the words
  2398. } else if (a !== this) {
  2399. for (; i < a.length; i++) {
  2400. this.words[i] = a.words[i];
  2401. }
  2402. }
  2403. return this;
  2404. };
  2405. // Add `num` to `this`
  2406. BN.prototype.add = function add (num) {
  2407. var res;
  2408. if (num.negative !== 0 && this.negative === 0) {
  2409. num.negative = 0;
  2410. res = this.sub(num);
  2411. num.negative ^= 1;
  2412. return res;
  2413. } else if (num.negative === 0 && this.negative !== 0) {
  2414. this.negative = 0;
  2415. res = num.sub(this);
  2416. this.negative = 1;
  2417. return res;
  2418. }
  2419. if (this.length > num.length) return this.clone().iadd(num);
  2420. return num.clone().iadd(this);
  2421. };
  2422. // Subtract `num` from `this` in-place
  2423. BN.prototype.isub = function isub (num) {
  2424. // this - (-num) = this + num
  2425. if (num.negative !== 0) {
  2426. num.negative = 0;
  2427. var r = this.iadd(num);
  2428. num.negative = 1;
  2429. return r._normSign();
  2430. // -this - num = -(this + num)
  2431. } else if (this.negative !== 0) {
  2432. this.negative = 0;
  2433. this.iadd(num);
  2434. this.negative = 1;
  2435. return this._normSign();
  2436. }
  2437. // At this point both numbers are positive
  2438. var cmp = this.cmp(num);
  2439. // Optimization - zeroify
  2440. if (cmp === 0) {
  2441. this.negative = 0;
  2442. this.length = 1;
  2443. this.words[0] = 0;
  2444. return this;
  2445. }
  2446. // a > b
  2447. var a, b;
  2448. if (cmp > 0) {
  2449. a = this;
  2450. b = num;
  2451. } else {
  2452. a = num;
  2453. b = this;
  2454. }
  2455. var carry = 0;
  2456. for (var i = 0; i < b.length; i++) {
  2457. r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
  2458. carry = r >> 26;
  2459. this.words[i] = r & 0x3ffffff;
  2460. }
  2461. for (; carry !== 0 && i < a.length; i++) {
  2462. r = (a.words[i] | 0) + carry;
  2463. carry = r >> 26;
  2464. this.words[i] = r & 0x3ffffff;
  2465. }
  2466. // Copy rest of the words
  2467. if (carry === 0 && i < a.length && a !== this) {
  2468. for (; i < a.length; i++) {
  2469. this.words[i] = a.words[i];
  2470. }
  2471. }
  2472. this.length = Math.max(this.length, i);
  2473. if (a !== this) {
  2474. this.negative = 1;
  2475. }
  2476. return this.strip();
  2477. };
  2478. // Subtract `num` from `this`
  2479. BN.prototype.sub = function sub (num) {
  2480. return this.clone().isub(num);
  2481. };
  2482. function smallMulTo (self, num, out) {
  2483. out.negative = num.negative ^ self.negative;
  2484. var len = (self.length + num.length) | 0;
  2485. out.length = len;
  2486. len = (len - 1) | 0;
  2487. // Peel one iteration (compiler can't do it, because of code complexity)
  2488. var a = self.words[0] | 0;
  2489. var b = num.words[0] | 0;
  2490. var r = a * b;
  2491. var lo = r & 0x3ffffff;
  2492. var carry = (r / 0x4000000) | 0;
  2493. out.words[0] = lo;
  2494. for (var k = 1; k < len; k++) {
  2495. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  2496. // note that ncarry could be >= 0x3ffffff
  2497. var ncarry = carry >>> 26;
  2498. var rword = carry & 0x3ffffff;
  2499. var maxJ = Math.min(k, num.length - 1);
  2500. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  2501. var i = (k - j) | 0;
  2502. a = self.words[i] | 0;
  2503. b = num.words[j] | 0;
  2504. r = a * b + rword;
  2505. ncarry += (r / 0x4000000) | 0;
  2506. rword = r & 0x3ffffff;
  2507. }
  2508. out.words[k] = rword | 0;
  2509. carry = ncarry | 0;
  2510. }
  2511. if (carry !== 0) {
  2512. out.words[k] = carry | 0;
  2513. } else {
  2514. out.length--;
  2515. }
  2516. return out.strip();
  2517. }
  2518. // TODO(indutny): it may be reasonable to omit it for users who don't need
  2519. // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
  2520. // multiplication (like elliptic secp256k1).
  2521. var comb10MulTo = function comb10MulTo (self, num, out) {
  2522. var a = self.words;
  2523. var b = num.words;
  2524. var o = out.words;
  2525. var c = 0;
  2526. var lo;
  2527. var mid;
  2528. var hi;
  2529. var a0 = a[0] | 0;
  2530. var al0 = a0 & 0x1fff;
  2531. var ah0 = a0 >>> 13;
  2532. var a1 = a[1] | 0;
  2533. var al1 = a1 & 0x1fff;
  2534. var ah1 = a1 >>> 13;
  2535. var a2 = a[2] | 0;
  2536. var al2 = a2 & 0x1fff;
  2537. var ah2 = a2 >>> 13;
  2538. var a3 = a[3] | 0;
  2539. var al3 = a3 & 0x1fff;
  2540. var ah3 = a3 >>> 13;
  2541. var a4 = a[4] | 0;
  2542. var al4 = a4 & 0x1fff;
  2543. var ah4 = a4 >>> 13;
  2544. var a5 = a[5] | 0;
  2545. var al5 = a5 & 0x1fff;
  2546. var ah5 = a5 >>> 13;
  2547. var a6 = a[6] | 0;
  2548. var al6 = a6 & 0x1fff;
  2549. var ah6 = a6 >>> 13;
  2550. var a7 = a[7] | 0;
  2551. var al7 = a7 & 0x1fff;
  2552. var ah7 = a7 >>> 13;
  2553. var a8 = a[8] | 0;
  2554. var al8 = a8 & 0x1fff;
  2555. var ah8 = a8 >>> 13;
  2556. var a9 = a[9] | 0;
  2557. var al9 = a9 & 0x1fff;
  2558. var ah9 = a9 >>> 13;
  2559. var b0 = b[0] | 0;
  2560. var bl0 = b0 & 0x1fff;
  2561. var bh0 = b0 >>> 13;
  2562. var b1 = b[1] | 0;
  2563. var bl1 = b1 & 0x1fff;
  2564. var bh1 = b1 >>> 13;
  2565. var b2 = b[2] | 0;
  2566. var bl2 = b2 & 0x1fff;
  2567. var bh2 = b2 >>> 13;
  2568. var b3 = b[3] | 0;
  2569. var bl3 = b3 & 0x1fff;
  2570. var bh3 = b3 >>> 13;
  2571. var b4 = b[4] | 0;
  2572. var bl4 = b4 & 0x1fff;
  2573. var bh4 = b4 >>> 13;
  2574. var b5 = b[5] | 0;
  2575. var bl5 = b5 & 0x1fff;
  2576. var bh5 = b5 >>> 13;
  2577. var b6 = b[6] | 0;
  2578. var bl6 = b6 & 0x1fff;
  2579. var bh6 = b6 >>> 13;
  2580. var b7 = b[7] | 0;
  2581. var bl7 = b7 & 0x1fff;
  2582. var bh7 = b7 >>> 13;
  2583. var b8 = b[8] | 0;
  2584. var bl8 = b8 & 0x1fff;
  2585. var bh8 = b8 >>> 13;
  2586. var b9 = b[9] | 0;
  2587. var bl9 = b9 & 0x1fff;
  2588. var bh9 = b9 >>> 13;
  2589. out.negative = self.negative ^ num.negative;
  2590. out.length = 19;
  2591. /* k = 0 */
  2592. lo = Math.imul(al0, bl0);
  2593. mid = Math.imul(al0, bh0);
  2594. mid = (mid + Math.imul(ah0, bl0)) | 0;
  2595. hi = Math.imul(ah0, bh0);
  2596. var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2597. c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
  2598. w0 &= 0x3ffffff;
  2599. /* k = 1 */
  2600. lo = Math.imul(al1, bl0);
  2601. mid = Math.imul(al1, bh0);
  2602. mid = (mid + Math.imul(ah1, bl0)) | 0;
  2603. hi = Math.imul(ah1, bh0);
  2604. lo = (lo + Math.imul(al0, bl1)) | 0;
  2605. mid = (mid + Math.imul(al0, bh1)) | 0;
  2606. mid = (mid + Math.imul(ah0, bl1)) | 0;
  2607. hi = (hi + Math.imul(ah0, bh1)) | 0;
  2608. var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2609. c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
  2610. w1 &= 0x3ffffff;
  2611. /* k = 2 */
  2612. lo = Math.imul(al2, bl0);
  2613. mid = Math.imul(al2, bh0);
  2614. mid = (mid + Math.imul(ah2, bl0)) | 0;
  2615. hi = Math.imul(ah2, bh0);
  2616. lo = (lo + Math.imul(al1, bl1)) | 0;
  2617. mid = (mid + Math.imul(al1, bh1)) | 0;
  2618. mid = (mid + Math.imul(ah1, bl1)) | 0;
  2619. hi = (hi + Math.imul(ah1, bh1)) | 0;
  2620. lo = (lo + Math.imul(al0, bl2)) | 0;
  2621. mid = (mid + Math.imul(al0, bh2)) | 0;
  2622. mid = (mid + Math.imul(ah0, bl2)) | 0;
  2623. hi = (hi + Math.imul(ah0, bh2)) | 0;
  2624. var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2625. c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
  2626. w2 &= 0x3ffffff;
  2627. /* k = 3 */
  2628. lo = Math.imul(al3, bl0);
  2629. mid = Math.imul(al3, bh0);
  2630. mid = (mid + Math.imul(ah3, bl0)) | 0;
  2631. hi = Math.imul(ah3, bh0);
  2632. lo = (lo + Math.imul(al2, bl1)) | 0;
  2633. mid = (mid + Math.imul(al2, bh1)) | 0;
  2634. mid = (mid + Math.imul(ah2, bl1)) | 0;
  2635. hi = (hi + Math.imul(ah2, bh1)) | 0;
  2636. lo = (lo + Math.imul(al1, bl2)) | 0;
  2637. mid = (mid + Math.imul(al1, bh2)) | 0;
  2638. mid = (mid + Math.imul(ah1, bl2)) | 0;
  2639. hi = (hi + Math.imul(ah1, bh2)) | 0;
  2640. lo = (lo + Math.imul(al0, bl3)) | 0;
  2641. mid = (mid + Math.imul(al0, bh3)) | 0;
  2642. mid = (mid + Math.imul(ah0, bl3)) | 0;
  2643. hi = (hi + Math.imul(ah0, bh3)) | 0;
  2644. var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2645. c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
  2646. w3 &= 0x3ffffff;
  2647. /* k = 4 */
  2648. lo = Math.imul(al4, bl0);
  2649. mid = Math.imul(al4, bh0);
  2650. mid = (mid + Math.imul(ah4, bl0)) | 0;
  2651. hi = Math.imul(ah4, bh0);
  2652. lo = (lo + Math.imul(al3, bl1)) | 0;
  2653. mid = (mid + Math.imul(al3, bh1)) | 0;
  2654. mid = (mid + Math.imul(ah3, bl1)) | 0;
  2655. hi = (hi + Math.imul(ah3, bh1)) | 0;
  2656. lo = (lo + Math.imul(al2, bl2)) | 0;
  2657. mid = (mid + Math.imul(al2, bh2)) | 0;
  2658. mid = (mid + Math.imul(ah2, bl2)) | 0;
  2659. hi = (hi + Math.imul(ah2, bh2)) | 0;
  2660. lo = (lo + Math.imul(al1, bl3)) | 0;
  2661. mid = (mid + Math.imul(al1, bh3)) | 0;
  2662. mid = (mid + Math.imul(ah1, bl3)) | 0;
  2663. hi = (hi + Math.imul(ah1, bh3)) | 0;
  2664. lo = (lo + Math.imul(al0, bl4)) | 0;
  2665. mid = (mid + Math.imul(al0, bh4)) | 0;
  2666. mid = (mid + Math.imul(ah0, bl4)) | 0;
  2667. hi = (hi + Math.imul(ah0, bh4)) | 0;
  2668. var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2669. c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
  2670. w4 &= 0x3ffffff;
  2671. /* k = 5 */
  2672. lo = Math.imul(al5, bl0);
  2673. mid = Math.imul(al5, bh0);
  2674. mid = (mid + Math.imul(ah5, bl0)) | 0;
  2675. hi = Math.imul(ah5, bh0);
  2676. lo = (lo + Math.imul(al4, bl1)) | 0;
  2677. mid = (mid + Math.imul(al4, bh1)) | 0;
  2678. mid = (mid + Math.imul(ah4, bl1)) | 0;
  2679. hi = (hi + Math.imul(ah4, bh1)) | 0;
  2680. lo = (lo + Math.imul(al3, bl2)) | 0;
  2681. mid = (mid + Math.imul(al3, bh2)) | 0;
  2682. mid = (mid + Math.imul(ah3, bl2)) | 0;
  2683. hi = (hi + Math.imul(ah3, bh2)) | 0;
  2684. lo = (lo + Math.imul(al2, bl3)) | 0;
  2685. mid = (mid + Math.imul(al2, bh3)) | 0;
  2686. mid = (mid + Math.imul(ah2, bl3)) | 0;
  2687. hi = (hi + Math.imul(ah2, bh3)) | 0;
  2688. lo = (lo + Math.imul(al1, bl4)) | 0;
  2689. mid = (mid + Math.imul(al1, bh4)) | 0;
  2690. mid = (mid + Math.imul(ah1, bl4)) | 0;
  2691. hi = (hi + Math.imul(ah1, bh4)) | 0;
  2692. lo = (lo + Math.imul(al0, bl5)) | 0;
  2693. mid = (mid + Math.imul(al0, bh5)) | 0;
  2694. mid = (mid + Math.imul(ah0, bl5)) | 0;
  2695. hi = (hi + Math.imul(ah0, bh5)) | 0;
  2696. var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2697. c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
  2698. w5 &= 0x3ffffff;
  2699. /* k = 6 */
  2700. lo = Math.imul(al6, bl0);
  2701. mid = Math.imul(al6, bh0);
  2702. mid = (mid + Math.imul(ah6, bl0)) | 0;
  2703. hi = Math.imul(ah6, bh0);
  2704. lo = (lo + Math.imul(al5, bl1)) | 0;
  2705. mid = (mid + Math.imul(al5, bh1)) | 0;
  2706. mid = (mid + Math.imul(ah5, bl1)) | 0;
  2707. hi = (hi + Math.imul(ah5, bh1)) | 0;
  2708. lo = (lo + Math.imul(al4, bl2)) | 0;
  2709. mid = (mid + Math.imul(al4, bh2)) | 0;
  2710. mid = (mid + Math.imul(ah4, bl2)) | 0;
  2711. hi = (hi + Math.imul(ah4, bh2)) | 0;
  2712. lo = (lo + Math.imul(al3, bl3)) | 0;
  2713. mid = (mid + Math.imul(al3, bh3)) | 0;
  2714. mid = (mid + Math.imul(ah3, bl3)) | 0;
  2715. hi = (hi + Math.imul(ah3, bh3)) | 0;
  2716. lo = (lo + Math.imul(al2, bl4)) | 0;
  2717. mid = (mid + Math.imul(al2, bh4)) | 0;
  2718. mid = (mid + Math.imul(ah2, bl4)) | 0;
  2719. hi = (hi + Math.imul(ah2, bh4)) | 0;
  2720. lo = (lo + Math.imul(al1, bl5)) | 0;
  2721. mid = (mid + Math.imul(al1, bh5)) | 0;
  2722. mid = (mid + Math.imul(ah1, bl5)) | 0;
  2723. hi = (hi + Math.imul(ah1, bh5)) | 0;
  2724. lo = (lo + Math.imul(al0, bl6)) | 0;
  2725. mid = (mid + Math.imul(al0, bh6)) | 0;
  2726. mid = (mid + Math.imul(ah0, bl6)) | 0;
  2727. hi = (hi + Math.imul(ah0, bh6)) | 0;
  2728. var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2729. c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
  2730. w6 &= 0x3ffffff;
  2731. /* k = 7 */
  2732. lo = Math.imul(al7, bl0);
  2733. mid = Math.imul(al7, bh0);
  2734. mid = (mid + Math.imul(ah7, bl0)) | 0;
  2735. hi = Math.imul(ah7, bh0);
  2736. lo = (lo + Math.imul(al6, bl1)) | 0;
  2737. mid = (mid + Math.imul(al6, bh1)) | 0;
  2738. mid = (mid + Math.imul(ah6, bl1)) | 0;
  2739. hi = (hi + Math.imul(ah6, bh1)) | 0;
  2740. lo = (lo + Math.imul(al5, bl2)) | 0;
  2741. mid = (mid + Math.imul(al5, bh2)) | 0;
  2742. mid = (mid + Math.imul(ah5, bl2)) | 0;
  2743. hi = (hi + Math.imul(ah5, bh2)) | 0;
  2744. lo = (lo + Math.imul(al4, bl3)) | 0;
  2745. mid = (mid + Math.imul(al4, bh3)) | 0;
  2746. mid = (mid + Math.imul(ah4, bl3)) | 0;
  2747. hi = (hi + Math.imul(ah4, bh3)) | 0;
  2748. lo = (lo + Math.imul(al3, bl4)) | 0;
  2749. mid = (mid + Math.imul(al3, bh4)) | 0;
  2750. mid = (mid + Math.imul(ah3, bl4)) | 0;
  2751. hi = (hi + Math.imul(ah3, bh4)) | 0;
  2752. lo = (lo + Math.imul(al2, bl5)) | 0;
  2753. mid = (mid + Math.imul(al2, bh5)) | 0;
  2754. mid = (mid + Math.imul(ah2, bl5)) | 0;
  2755. hi = (hi + Math.imul(ah2, bh5)) | 0;
  2756. lo = (lo + Math.imul(al1, bl6)) | 0;
  2757. mid = (mid + Math.imul(al1, bh6)) | 0;
  2758. mid = (mid + Math.imul(ah1, bl6)) | 0;
  2759. hi = (hi + Math.imul(ah1, bh6)) | 0;
  2760. lo = (lo + Math.imul(al0, bl7)) | 0;
  2761. mid = (mid + Math.imul(al0, bh7)) | 0;
  2762. mid = (mid + Math.imul(ah0, bl7)) | 0;
  2763. hi = (hi + Math.imul(ah0, bh7)) | 0;
  2764. var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2765. c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
  2766. w7 &= 0x3ffffff;
  2767. /* k = 8 */
  2768. lo = Math.imul(al8, bl0);
  2769. mid = Math.imul(al8, bh0);
  2770. mid = (mid + Math.imul(ah8, bl0)) | 0;
  2771. hi = Math.imul(ah8, bh0);
  2772. lo = (lo + Math.imul(al7, bl1)) | 0;
  2773. mid = (mid + Math.imul(al7, bh1)) | 0;
  2774. mid = (mid + Math.imul(ah7, bl1)) | 0;
  2775. hi = (hi + Math.imul(ah7, bh1)) | 0;
  2776. lo = (lo + Math.imul(al6, bl2)) | 0;
  2777. mid = (mid + Math.imul(al6, bh2)) | 0;
  2778. mid = (mid + Math.imul(ah6, bl2)) | 0;
  2779. hi = (hi + Math.imul(ah6, bh2)) | 0;
  2780. lo = (lo + Math.imul(al5, bl3)) | 0;
  2781. mid = (mid + Math.imul(al5, bh3)) | 0;
  2782. mid = (mid + Math.imul(ah5, bl3)) | 0;
  2783. hi = (hi + Math.imul(ah5, bh3)) | 0;
  2784. lo = (lo + Math.imul(al4, bl4)) | 0;
  2785. mid = (mid + Math.imul(al4, bh4)) | 0;
  2786. mid = (mid + Math.imul(ah4, bl4)) | 0;
  2787. hi = (hi + Math.imul(ah4, bh4)) | 0;
  2788. lo = (lo + Math.imul(al3, bl5)) | 0;
  2789. mid = (mid + Math.imul(al3, bh5)) | 0;
  2790. mid = (mid + Math.imul(ah3, bl5)) | 0;
  2791. hi = (hi + Math.imul(ah3, bh5)) | 0;
  2792. lo = (lo + Math.imul(al2, bl6)) | 0;
  2793. mid = (mid + Math.imul(al2, bh6)) | 0;
  2794. mid = (mid + Math.imul(ah2, bl6)) | 0;
  2795. hi = (hi + Math.imul(ah2, bh6)) | 0;
  2796. lo = (lo + Math.imul(al1, bl7)) | 0;
  2797. mid = (mid + Math.imul(al1, bh7)) | 0;
  2798. mid = (mid + Math.imul(ah1, bl7)) | 0;
  2799. hi = (hi + Math.imul(ah1, bh7)) | 0;
  2800. lo = (lo + Math.imul(al0, bl8)) | 0;
  2801. mid = (mid + Math.imul(al0, bh8)) | 0;
  2802. mid = (mid + Math.imul(ah0, bl8)) | 0;
  2803. hi = (hi + Math.imul(ah0, bh8)) | 0;
  2804. var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2805. c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
  2806. w8 &= 0x3ffffff;
  2807. /* k = 9 */
  2808. lo = Math.imul(al9, bl0);
  2809. mid = Math.imul(al9, bh0);
  2810. mid = (mid + Math.imul(ah9, bl0)) | 0;
  2811. hi = Math.imul(ah9, bh0);
  2812. lo = (lo + Math.imul(al8, bl1)) | 0;
  2813. mid = (mid + Math.imul(al8, bh1)) | 0;
  2814. mid = (mid + Math.imul(ah8, bl1)) | 0;
  2815. hi = (hi + Math.imul(ah8, bh1)) | 0;
  2816. lo = (lo + Math.imul(al7, bl2)) | 0;
  2817. mid = (mid + Math.imul(al7, bh2)) | 0;
  2818. mid = (mid + Math.imul(ah7, bl2)) | 0;
  2819. hi = (hi + Math.imul(ah7, bh2)) | 0;
  2820. lo = (lo + Math.imul(al6, bl3)) | 0;
  2821. mid = (mid + Math.imul(al6, bh3)) | 0;
  2822. mid = (mid + Math.imul(ah6, bl3)) | 0;
  2823. hi = (hi + Math.imul(ah6, bh3)) | 0;
  2824. lo = (lo + Math.imul(al5, bl4)) | 0;
  2825. mid = (mid + Math.imul(al5, bh4)) | 0;
  2826. mid = (mid + Math.imul(ah5, bl4)) | 0;
  2827. hi = (hi + Math.imul(ah5, bh4)) | 0;
  2828. lo = (lo + Math.imul(al4, bl5)) | 0;
  2829. mid = (mid + Math.imul(al4, bh5)) | 0;
  2830. mid = (mid + Math.imul(ah4, bl5)) | 0;
  2831. hi = (hi + Math.imul(ah4, bh5)) | 0;
  2832. lo = (lo + Math.imul(al3, bl6)) | 0;
  2833. mid = (mid + Math.imul(al3, bh6)) | 0;
  2834. mid = (mid + Math.imul(ah3, bl6)) | 0;
  2835. hi = (hi + Math.imul(ah3, bh6)) | 0;
  2836. lo = (lo + Math.imul(al2, bl7)) | 0;
  2837. mid = (mid + Math.imul(al2, bh7)) | 0;
  2838. mid = (mid + Math.imul(ah2, bl7)) | 0;
  2839. hi = (hi + Math.imul(ah2, bh7)) | 0;
  2840. lo = (lo + Math.imul(al1, bl8)) | 0;
  2841. mid = (mid + Math.imul(al1, bh8)) | 0;
  2842. mid = (mid + Math.imul(ah1, bl8)) | 0;
  2843. hi = (hi + Math.imul(ah1, bh8)) | 0;
  2844. lo = (lo + Math.imul(al0, bl9)) | 0;
  2845. mid = (mid + Math.imul(al0, bh9)) | 0;
  2846. mid = (mid + Math.imul(ah0, bl9)) | 0;
  2847. hi = (hi + Math.imul(ah0, bh9)) | 0;
  2848. var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2849. c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
  2850. w9 &= 0x3ffffff;
  2851. /* k = 10 */
  2852. lo = Math.imul(al9, bl1);
  2853. mid = Math.imul(al9, bh1);
  2854. mid = (mid + Math.imul(ah9, bl1)) | 0;
  2855. hi = Math.imul(ah9, bh1);
  2856. lo = (lo + Math.imul(al8, bl2)) | 0;
  2857. mid = (mid + Math.imul(al8, bh2)) | 0;
  2858. mid = (mid + Math.imul(ah8, bl2)) | 0;
  2859. hi = (hi + Math.imul(ah8, bh2)) | 0;
  2860. lo = (lo + Math.imul(al7, bl3)) | 0;
  2861. mid = (mid + Math.imul(al7, bh3)) | 0;
  2862. mid = (mid + Math.imul(ah7, bl3)) | 0;
  2863. hi = (hi + Math.imul(ah7, bh3)) | 0;
  2864. lo = (lo + Math.imul(al6, bl4)) | 0;
  2865. mid = (mid + Math.imul(al6, bh4)) | 0;
  2866. mid = (mid + Math.imul(ah6, bl4)) | 0;
  2867. hi = (hi + Math.imul(ah6, bh4)) | 0;
  2868. lo = (lo + Math.imul(al5, bl5)) | 0;
  2869. mid = (mid + Math.imul(al5, bh5)) | 0;
  2870. mid = (mid + Math.imul(ah5, bl5)) | 0;
  2871. hi = (hi + Math.imul(ah5, bh5)) | 0;
  2872. lo = (lo + Math.imul(al4, bl6)) | 0;
  2873. mid = (mid + Math.imul(al4, bh6)) | 0;
  2874. mid = (mid + Math.imul(ah4, bl6)) | 0;
  2875. hi = (hi + Math.imul(ah4, bh6)) | 0;
  2876. lo = (lo + Math.imul(al3, bl7)) | 0;
  2877. mid = (mid + Math.imul(al3, bh7)) | 0;
  2878. mid = (mid + Math.imul(ah3, bl7)) | 0;
  2879. hi = (hi + Math.imul(ah3, bh7)) | 0;
  2880. lo = (lo + Math.imul(al2, bl8)) | 0;
  2881. mid = (mid + Math.imul(al2, bh8)) | 0;
  2882. mid = (mid + Math.imul(ah2, bl8)) | 0;
  2883. hi = (hi + Math.imul(ah2, bh8)) | 0;
  2884. lo = (lo + Math.imul(al1, bl9)) | 0;
  2885. mid = (mid + Math.imul(al1, bh9)) | 0;
  2886. mid = (mid + Math.imul(ah1, bl9)) | 0;
  2887. hi = (hi + Math.imul(ah1, bh9)) | 0;
  2888. var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2889. c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
  2890. w10 &= 0x3ffffff;
  2891. /* k = 11 */
  2892. lo = Math.imul(al9, bl2);
  2893. mid = Math.imul(al9, bh2);
  2894. mid = (mid + Math.imul(ah9, bl2)) | 0;
  2895. hi = Math.imul(ah9, bh2);
  2896. lo = (lo + Math.imul(al8, bl3)) | 0;
  2897. mid = (mid + Math.imul(al8, bh3)) | 0;
  2898. mid = (mid + Math.imul(ah8, bl3)) | 0;
  2899. hi = (hi + Math.imul(ah8, bh3)) | 0;
  2900. lo = (lo + Math.imul(al7, bl4)) | 0;
  2901. mid = (mid + Math.imul(al7, bh4)) | 0;
  2902. mid = (mid + Math.imul(ah7, bl4)) | 0;
  2903. hi = (hi + Math.imul(ah7, bh4)) | 0;
  2904. lo = (lo + Math.imul(al6, bl5)) | 0;
  2905. mid = (mid + Math.imul(al6, bh5)) | 0;
  2906. mid = (mid + Math.imul(ah6, bl5)) | 0;
  2907. hi = (hi + Math.imul(ah6, bh5)) | 0;
  2908. lo = (lo + Math.imul(al5, bl6)) | 0;
  2909. mid = (mid + Math.imul(al5, bh6)) | 0;
  2910. mid = (mid + Math.imul(ah5, bl6)) | 0;
  2911. hi = (hi + Math.imul(ah5, bh6)) | 0;
  2912. lo = (lo + Math.imul(al4, bl7)) | 0;
  2913. mid = (mid + Math.imul(al4, bh7)) | 0;
  2914. mid = (mid + Math.imul(ah4, bl7)) | 0;
  2915. hi = (hi + Math.imul(ah4, bh7)) | 0;
  2916. lo = (lo + Math.imul(al3, bl8)) | 0;
  2917. mid = (mid + Math.imul(al3, bh8)) | 0;
  2918. mid = (mid + Math.imul(ah3, bl8)) | 0;
  2919. hi = (hi + Math.imul(ah3, bh8)) | 0;
  2920. lo = (lo + Math.imul(al2, bl9)) | 0;
  2921. mid = (mid + Math.imul(al2, bh9)) | 0;
  2922. mid = (mid + Math.imul(ah2, bl9)) | 0;
  2923. hi = (hi + Math.imul(ah2, bh9)) | 0;
  2924. var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2925. c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
  2926. w11 &= 0x3ffffff;
  2927. /* k = 12 */
  2928. lo = Math.imul(al9, bl3);
  2929. mid = Math.imul(al9, bh3);
  2930. mid = (mid + Math.imul(ah9, bl3)) | 0;
  2931. hi = Math.imul(ah9, bh3);
  2932. lo = (lo + Math.imul(al8, bl4)) | 0;
  2933. mid = (mid + Math.imul(al8, bh4)) | 0;
  2934. mid = (mid + Math.imul(ah8, bl4)) | 0;
  2935. hi = (hi + Math.imul(ah8, bh4)) | 0;
  2936. lo = (lo + Math.imul(al7, bl5)) | 0;
  2937. mid = (mid + Math.imul(al7, bh5)) | 0;
  2938. mid = (mid + Math.imul(ah7, bl5)) | 0;
  2939. hi = (hi + Math.imul(ah7, bh5)) | 0;
  2940. lo = (lo + Math.imul(al6, bl6)) | 0;
  2941. mid = (mid + Math.imul(al6, bh6)) | 0;
  2942. mid = (mid + Math.imul(ah6, bl6)) | 0;
  2943. hi = (hi + Math.imul(ah6, bh6)) | 0;
  2944. lo = (lo + Math.imul(al5, bl7)) | 0;
  2945. mid = (mid + Math.imul(al5, bh7)) | 0;
  2946. mid = (mid + Math.imul(ah5, bl7)) | 0;
  2947. hi = (hi + Math.imul(ah5, bh7)) | 0;
  2948. lo = (lo + Math.imul(al4, bl8)) | 0;
  2949. mid = (mid + Math.imul(al4, bh8)) | 0;
  2950. mid = (mid + Math.imul(ah4, bl8)) | 0;
  2951. hi = (hi + Math.imul(ah4, bh8)) | 0;
  2952. lo = (lo + Math.imul(al3, bl9)) | 0;
  2953. mid = (mid + Math.imul(al3, bh9)) | 0;
  2954. mid = (mid + Math.imul(ah3, bl9)) | 0;
  2955. hi = (hi + Math.imul(ah3, bh9)) | 0;
  2956. var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2957. c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
  2958. w12 &= 0x3ffffff;
  2959. /* k = 13 */
  2960. lo = Math.imul(al9, bl4);
  2961. mid = Math.imul(al9, bh4);
  2962. mid = (mid + Math.imul(ah9, bl4)) | 0;
  2963. hi = Math.imul(ah9, bh4);
  2964. lo = (lo + Math.imul(al8, bl5)) | 0;
  2965. mid = (mid + Math.imul(al8, bh5)) | 0;
  2966. mid = (mid + Math.imul(ah8, bl5)) | 0;
  2967. hi = (hi + Math.imul(ah8, bh5)) | 0;
  2968. lo = (lo + Math.imul(al7, bl6)) | 0;
  2969. mid = (mid + Math.imul(al7, bh6)) | 0;
  2970. mid = (mid + Math.imul(ah7, bl6)) | 0;
  2971. hi = (hi + Math.imul(ah7, bh6)) | 0;
  2972. lo = (lo + Math.imul(al6, bl7)) | 0;
  2973. mid = (mid + Math.imul(al6, bh7)) | 0;
  2974. mid = (mid + Math.imul(ah6, bl7)) | 0;
  2975. hi = (hi + Math.imul(ah6, bh7)) | 0;
  2976. lo = (lo + Math.imul(al5, bl8)) | 0;
  2977. mid = (mid + Math.imul(al5, bh8)) | 0;
  2978. mid = (mid + Math.imul(ah5, bl8)) | 0;
  2979. hi = (hi + Math.imul(ah5, bh8)) | 0;
  2980. lo = (lo + Math.imul(al4, bl9)) | 0;
  2981. mid = (mid + Math.imul(al4, bh9)) | 0;
  2982. mid = (mid + Math.imul(ah4, bl9)) | 0;
  2983. hi = (hi + Math.imul(ah4, bh9)) | 0;
  2984. var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2985. c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
  2986. w13 &= 0x3ffffff;
  2987. /* k = 14 */
  2988. lo = Math.imul(al9, bl5);
  2989. mid = Math.imul(al9, bh5);
  2990. mid = (mid + Math.imul(ah9, bl5)) | 0;
  2991. hi = Math.imul(ah9, bh5);
  2992. lo = (lo + Math.imul(al8, bl6)) | 0;
  2993. mid = (mid + Math.imul(al8, bh6)) | 0;
  2994. mid = (mid + Math.imul(ah8, bl6)) | 0;
  2995. hi = (hi + Math.imul(ah8, bh6)) | 0;
  2996. lo = (lo + Math.imul(al7, bl7)) | 0;
  2997. mid = (mid + Math.imul(al7, bh7)) | 0;
  2998. mid = (mid + Math.imul(ah7, bl7)) | 0;
  2999. hi = (hi + Math.imul(ah7, bh7)) | 0;
  3000. lo = (lo + Math.imul(al6, bl8)) | 0;
  3001. mid = (mid + Math.imul(al6, bh8)) | 0;
  3002. mid = (mid + Math.imul(ah6, bl8)) | 0;
  3003. hi = (hi + Math.imul(ah6, bh8)) | 0;
  3004. lo = (lo + Math.imul(al5, bl9)) | 0;
  3005. mid = (mid + Math.imul(al5, bh9)) | 0;
  3006. mid = (mid + Math.imul(ah5, bl9)) | 0;
  3007. hi = (hi + Math.imul(ah5, bh9)) | 0;
  3008. var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3009. c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
  3010. w14 &= 0x3ffffff;
  3011. /* k = 15 */
  3012. lo = Math.imul(al9, bl6);
  3013. mid = Math.imul(al9, bh6);
  3014. mid = (mid + Math.imul(ah9, bl6)) | 0;
  3015. hi = Math.imul(ah9, bh6);
  3016. lo = (lo + Math.imul(al8, bl7)) | 0;
  3017. mid = (mid + Math.imul(al8, bh7)) | 0;
  3018. mid = (mid + Math.imul(ah8, bl7)) | 0;
  3019. hi = (hi + Math.imul(ah8, bh7)) | 0;
  3020. lo = (lo + Math.imul(al7, bl8)) | 0;
  3021. mid = (mid + Math.imul(al7, bh8)) | 0;
  3022. mid = (mid + Math.imul(ah7, bl8)) | 0;
  3023. hi = (hi + Math.imul(ah7, bh8)) | 0;
  3024. lo = (lo + Math.imul(al6, bl9)) | 0;
  3025. mid = (mid + Math.imul(al6, bh9)) | 0;
  3026. mid = (mid + Math.imul(ah6, bl9)) | 0;
  3027. hi = (hi + Math.imul(ah6, bh9)) | 0;
  3028. var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3029. c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
  3030. w15 &= 0x3ffffff;
  3031. /* k = 16 */
  3032. lo = Math.imul(al9, bl7);
  3033. mid = Math.imul(al9, bh7);
  3034. mid = (mid + Math.imul(ah9, bl7)) | 0;
  3035. hi = Math.imul(ah9, bh7);
  3036. lo = (lo + Math.imul(al8, bl8)) | 0;
  3037. mid = (mid + Math.imul(al8, bh8)) | 0;
  3038. mid = (mid + Math.imul(ah8, bl8)) | 0;
  3039. hi = (hi + Math.imul(ah8, bh8)) | 0;
  3040. lo = (lo + Math.imul(al7, bl9)) | 0;
  3041. mid = (mid + Math.imul(al7, bh9)) | 0;
  3042. mid = (mid + Math.imul(ah7, bl9)) | 0;
  3043. hi = (hi + Math.imul(ah7, bh9)) | 0;
  3044. var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3045. c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
  3046. w16 &= 0x3ffffff;
  3047. /* k = 17 */
  3048. lo = Math.imul(al9, bl8);
  3049. mid = Math.imul(al9, bh8);
  3050. mid = (mid + Math.imul(ah9, bl8)) | 0;
  3051. hi = Math.imul(ah9, bh8);
  3052. lo = (lo + Math.imul(al8, bl9)) | 0;
  3053. mid = (mid + Math.imul(al8, bh9)) | 0;
  3054. mid = (mid + Math.imul(ah8, bl9)) | 0;
  3055. hi = (hi + Math.imul(ah8, bh9)) | 0;
  3056. var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3057. c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
  3058. w17 &= 0x3ffffff;
  3059. /* k = 18 */
  3060. lo = Math.imul(al9, bl9);
  3061. mid = Math.imul(al9, bh9);
  3062. mid = (mid + Math.imul(ah9, bl9)) | 0;
  3063. hi = Math.imul(ah9, bh9);
  3064. var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3065. c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
  3066. w18 &= 0x3ffffff;
  3067. o[0] = w0;
  3068. o[1] = w1;
  3069. o[2] = w2;
  3070. o[3] = w3;
  3071. o[4] = w4;
  3072. o[5] = w5;
  3073. o[6] = w6;
  3074. o[7] = w7;
  3075. o[8] = w8;
  3076. o[9] = w9;
  3077. o[10] = w10;
  3078. o[11] = w11;
  3079. o[12] = w12;
  3080. o[13] = w13;
  3081. o[14] = w14;
  3082. o[15] = w15;
  3083. o[16] = w16;
  3084. o[17] = w17;
  3085. o[18] = w18;
  3086. if (c !== 0) {
  3087. o[19] = c;
  3088. out.length++;
  3089. }
  3090. return out;
  3091. };
  3092. // Polyfill comb
  3093. if (!Math.imul) {
  3094. comb10MulTo = smallMulTo;
  3095. }
  3096. function bigMulTo (self, num, out) {
  3097. out.negative = num.negative ^ self.negative;
  3098. out.length = self.length + num.length;
  3099. var carry = 0;
  3100. var hncarry = 0;
  3101. for (var k = 0; k < out.length - 1; k++) {
  3102. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  3103. // note that ncarry could be >= 0x3ffffff
  3104. var ncarry = hncarry;
  3105. hncarry = 0;
  3106. var rword = carry & 0x3ffffff;
  3107. var maxJ = Math.min(k, num.length - 1);
  3108. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  3109. var i = k - j;
  3110. var a = self.words[i] | 0;
  3111. var b = num.words[j] | 0;
  3112. var r = a * b;
  3113. var lo = r & 0x3ffffff;
  3114. ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
  3115. lo = (lo + rword) | 0;
  3116. rword = lo & 0x3ffffff;
  3117. ncarry = (ncarry + (lo >>> 26)) | 0;
  3118. hncarry += ncarry >>> 26;
  3119. ncarry &= 0x3ffffff;
  3120. }
  3121. out.words[k] = rword;
  3122. carry = ncarry;
  3123. ncarry = hncarry;
  3124. }
  3125. if (carry !== 0) {
  3126. out.words[k] = carry;
  3127. } else {
  3128. out.length--;
  3129. }
  3130. return out.strip();
  3131. }
  3132. function jumboMulTo (self, num, out) {
  3133. var fftm = new FFTM();
  3134. return fftm.mulp(self, num, out);
  3135. }
  3136. BN.prototype.mulTo = function mulTo (num, out) {
  3137. var res;
  3138. var len = this.length + num.length;
  3139. if (this.length === 10 && num.length === 10) {
  3140. res = comb10MulTo(this, num, out);
  3141. } else if (len < 63) {
  3142. res = smallMulTo(this, num, out);
  3143. } else if (len < 1024) {
  3144. res = bigMulTo(this, num, out);
  3145. } else {
  3146. res = jumboMulTo(this, num, out);
  3147. }
  3148. return res;
  3149. };
  3150. // Cooley-Tukey algorithm for FFT
  3151. // slightly revisited to rely on looping instead of recursion
  3152. function FFTM (x, y) {
  3153. this.x = x;
  3154. this.y = y;
  3155. }
  3156. FFTM.prototype.makeRBT = function makeRBT (N) {
  3157. var t = new Array(N);
  3158. var l = BN.prototype._countBits(N) - 1;
  3159. for (var i = 0; i < N; i++) {
  3160. t[i] = this.revBin(i, l, N);
  3161. }
  3162. return t;
  3163. };
  3164. // Returns binary-reversed representation of `x`
  3165. FFTM.prototype.revBin = function revBin (x, l, N) {
  3166. if (x === 0 || x === N - 1) return x;
  3167. var rb = 0;
  3168. for (var i = 0; i < l; i++) {
  3169. rb |= (x & 1) << (l - i - 1);
  3170. x >>= 1;
  3171. }
  3172. return rb;
  3173. };
  3174. // Performs "tweedling" phase, therefore 'emulating'
  3175. // behaviour of the recursive algorithm
  3176. FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
  3177. for (var i = 0; i < N; i++) {
  3178. rtws[i] = rws[rbt[i]];
  3179. itws[i] = iws[rbt[i]];
  3180. }
  3181. };
  3182. FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
  3183. this.permute(rbt, rws, iws, rtws, itws, N);
  3184. for (var s = 1; s < N; s <<= 1) {
  3185. var l = s << 1;
  3186. var rtwdf = Math.cos(2 * Math.PI / l);
  3187. var itwdf = Math.sin(2 * Math.PI / l);
  3188. for (var p = 0; p < N; p += l) {
  3189. var rtwdf_ = rtwdf;
  3190. var itwdf_ = itwdf;
  3191. for (var j = 0; j < s; j++) {
  3192. var re = rtws[p + j];
  3193. var ie = itws[p + j];
  3194. var ro = rtws[p + j + s];
  3195. var io = itws[p + j + s];
  3196. var rx = rtwdf_ * ro - itwdf_ * io;
  3197. io = rtwdf_ * io + itwdf_ * ro;
  3198. ro = rx;
  3199. rtws[p + j] = re + ro;
  3200. itws[p + j] = ie + io;
  3201. rtws[p + j + s] = re - ro;
  3202. itws[p + j + s] = ie - io;
  3203. /* jshint maxdepth : false */
  3204. if (j !== l) {
  3205. rx = rtwdf * rtwdf_ - itwdf * itwdf_;
  3206. itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
  3207. rtwdf_ = rx;
  3208. }
  3209. }
  3210. }
  3211. }
  3212. };
  3213. FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
  3214. var N = Math.max(m, n) | 1;
  3215. var odd = N & 1;
  3216. var i = 0;
  3217. for (N = N / 2 | 0; N; N = N >>> 1) {
  3218. i++;
  3219. }
  3220. return 1 << i + 1 + odd;
  3221. };
  3222. FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
  3223. if (N <= 1) return;
  3224. for (var i = 0; i < N / 2; i++) {
  3225. var t = rws[i];
  3226. rws[i] = rws[N - i - 1];
  3227. rws[N - i - 1] = t;
  3228. t = iws[i];
  3229. iws[i] = -iws[N - i - 1];
  3230. iws[N - i - 1] = -t;
  3231. }
  3232. };
  3233. FFTM.prototype.normalize13b = function normalize13b (ws, N) {
  3234. var carry = 0;
  3235. for (var i = 0; i < N / 2; i++) {
  3236. var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
  3237. Math.round(ws[2 * i] / N) +
  3238. carry;
  3239. ws[i] = w & 0x3ffffff;
  3240. if (w < 0x4000000) {
  3241. carry = 0;
  3242. } else {
  3243. carry = w / 0x4000000 | 0;
  3244. }
  3245. }
  3246. return ws;
  3247. };
  3248. FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
  3249. var carry = 0;
  3250. for (var i = 0; i < len; i++) {
  3251. carry = carry + (ws[i] | 0);
  3252. rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
  3253. rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
  3254. }
  3255. // Pad with zeroes
  3256. for (i = 2 * len; i < N; ++i) {
  3257. rws[i] = 0;
  3258. }
  3259. assert(carry === 0);
  3260. assert((carry & ~0x1fff) === 0);
  3261. };
  3262. FFTM.prototype.stub = function stub (N) {
  3263. var ph = new Array(N);
  3264. for (var i = 0; i < N; i++) {
  3265. ph[i] = 0;
  3266. }
  3267. return ph;
  3268. };
  3269. FFTM.prototype.mulp = function mulp (x, y, out) {
  3270. var N = 2 * this.guessLen13b(x.length, y.length);
  3271. var rbt = this.makeRBT(N);
  3272. var _ = this.stub(N);
  3273. var rws = new Array(N);
  3274. var rwst = new Array(N);
  3275. var iwst = new Array(N);
  3276. var nrws = new Array(N);
  3277. var nrwst = new Array(N);
  3278. var niwst = new Array(N);
  3279. var rmws = out.words;
  3280. rmws.length = N;
  3281. this.convert13b(x.words, x.length, rws, N);
  3282. this.convert13b(y.words, y.length, nrws, N);
  3283. this.transform(rws, _, rwst, iwst, N, rbt);
  3284. this.transform(nrws, _, nrwst, niwst, N, rbt);
  3285. for (var i = 0; i < N; i++) {
  3286. var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
  3287. iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
  3288. rwst[i] = rx;
  3289. }
  3290. this.conjugate(rwst, iwst, N);
  3291. this.transform(rwst, iwst, rmws, _, N, rbt);
  3292. this.conjugate(rmws, _, N);
  3293. this.normalize13b(rmws, N);
  3294. out.negative = x.negative ^ y.negative;
  3295. out.length = x.length + y.length;
  3296. return out.strip();
  3297. };
  3298. // Multiply `this` by `num`
  3299. BN.prototype.mul = function mul (num) {
  3300. var out = new BN(null);
  3301. out.words = new Array(this.length + num.length);
  3302. return this.mulTo(num, out);
  3303. };
  3304. // Multiply employing FFT
  3305. BN.prototype.mulf = function mulf (num) {
  3306. var out = new BN(null);
  3307. out.words = new Array(this.length + num.length);
  3308. return jumboMulTo(this, num, out);
  3309. };
  3310. // In-place Multiplication
  3311. BN.prototype.imul = function imul (num) {
  3312. return this.clone().mulTo(num, this);
  3313. };
  3314. BN.prototype.imuln = function imuln (num) {
  3315. assert(typeof num === 'number');
  3316. assert(num < 0x4000000);
  3317. // Carry
  3318. var carry = 0;
  3319. for (var i = 0; i < this.length; i++) {
  3320. var w = (this.words[i] | 0) * num;
  3321. var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
  3322. carry >>= 26;
  3323. carry += (w / 0x4000000) | 0;
  3324. // NOTE: lo is 27bit maximum
  3325. carry += lo >>> 26;
  3326. this.words[i] = lo & 0x3ffffff;
  3327. }
  3328. if (carry !== 0) {
  3329. this.words[i] = carry;
  3330. this.length++;
  3331. }
  3332. return this;
  3333. };
  3334. BN.prototype.muln = function muln (num) {
  3335. return this.clone().imuln(num);
  3336. };
  3337. // `this` * `this`
  3338. BN.prototype.sqr = function sqr () {
  3339. return this.mul(this);
  3340. };
  3341. // `this` * `this` in-place
  3342. BN.prototype.isqr = function isqr () {
  3343. return this.imul(this.clone());
  3344. };
  3345. // Math.pow(`this`, `num`)
  3346. BN.prototype.pow = function pow (num) {
  3347. var w = toBitArray(num);
  3348. if (w.length === 0) return new BN(1);
  3349. // Skip leading zeroes
  3350. var res = this;
  3351. for (var i = 0; i < w.length; i++, res = res.sqr()) {
  3352. if (w[i] !== 0) break;
  3353. }
  3354. if (++i < w.length) {
  3355. for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
  3356. if (w[i] === 0) continue;
  3357. res = res.mul(q);
  3358. }
  3359. }
  3360. return res;
  3361. };
  3362. // Shift-left in-place
  3363. BN.prototype.iushln = function iushln (bits) {
  3364. assert(typeof bits === 'number' && bits >= 0);
  3365. var r = bits % 26;
  3366. var s = (bits - r) / 26;
  3367. var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
  3368. var i;
  3369. if (r !== 0) {
  3370. var carry = 0;
  3371. for (i = 0; i < this.length; i++) {
  3372. var newCarry = this.words[i] & carryMask;
  3373. var c = ((this.words[i] | 0) - newCarry) << r;
  3374. this.words[i] = c | carry;
  3375. carry = newCarry >>> (26 - r);
  3376. }
  3377. if (carry) {
  3378. this.words[i] = carry;
  3379. this.length++;
  3380. }
  3381. }
  3382. if (s !== 0) {
  3383. for (i = this.length - 1; i >= 0; i--) {
  3384. this.words[i + s] = this.words[i];
  3385. }
  3386. for (i = 0; i < s; i++) {
  3387. this.words[i] = 0;
  3388. }
  3389. this.length += s;
  3390. }
  3391. return this.strip();
  3392. };
  3393. BN.prototype.ishln = function ishln (bits) {
  3394. // TODO(indutny): implement me
  3395. assert(this.negative === 0);
  3396. return this.iushln(bits);
  3397. };
  3398. // Shift-right in-place
  3399. // NOTE: `hint` is a lowest bit before trailing zeroes
  3400. // NOTE: if `extended` is present - it will be filled with destroyed bits
  3401. BN.prototype.iushrn = function iushrn (bits, hint, extended) {
  3402. assert(typeof bits === 'number' && bits >= 0);
  3403. var h;
  3404. if (hint) {
  3405. h = (hint - (hint % 26)) / 26;
  3406. } else {
  3407. h = 0;
  3408. }
  3409. var r = bits % 26;
  3410. var s = Math.min((bits - r) / 26, this.length);
  3411. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  3412. var maskedWords = extended;
  3413. h -= s;
  3414. h = Math.max(0, h);
  3415. // Extended mode, copy masked part
  3416. if (maskedWords) {
  3417. for (var i = 0; i < s; i++) {
  3418. maskedWords.words[i] = this.words[i];
  3419. }
  3420. maskedWords.length = s;
  3421. }
  3422. if (s === 0) {
  3423. // No-op, we should not move anything at all
  3424. } else if (this.length > s) {
  3425. this.length -= s;
  3426. for (i = 0; i < this.length; i++) {
  3427. this.words[i] = this.words[i + s];
  3428. }
  3429. } else {
  3430. this.words[0] = 0;
  3431. this.length = 1;
  3432. }
  3433. var carry = 0;
  3434. for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
  3435. var word = this.words[i] | 0;
  3436. this.words[i] = (carry << (26 - r)) | (word >>> r);
  3437. carry = word & mask;
  3438. }
  3439. // Push carried bits as a mask
  3440. if (maskedWords && carry !== 0) {
  3441. maskedWords.words[maskedWords.length++] = carry;
  3442. }
  3443. if (this.length === 0) {
  3444. this.words[0] = 0;
  3445. this.length = 1;
  3446. }
  3447. return this.strip();
  3448. };
  3449. BN.prototype.ishrn = function ishrn (bits, hint, extended) {
  3450. // TODO(indutny): implement me
  3451. assert(this.negative === 0);
  3452. return this.iushrn(bits, hint, extended);
  3453. };
  3454. // Shift-left
  3455. BN.prototype.shln = function shln (bits) {
  3456. return this.clone().ishln(bits);
  3457. };
  3458. BN.prototype.ushln = function ushln (bits) {
  3459. return this.clone().iushln(bits);
  3460. };
  3461. // Shift-right
  3462. BN.prototype.shrn = function shrn (bits) {
  3463. return this.clone().ishrn(bits);
  3464. };
  3465. BN.prototype.ushrn = function ushrn (bits) {
  3466. return this.clone().iushrn(bits);
  3467. };
  3468. // Test if n bit is set
  3469. BN.prototype.testn = function testn (bit) {
  3470. assert(typeof bit === 'number' && bit >= 0);
  3471. var r = bit % 26;
  3472. var s = (bit - r) / 26;
  3473. var q = 1 << r;
  3474. // Fast case: bit is much higher than all existing words
  3475. if (this.length <= s) return false;
  3476. // Check bit and return
  3477. var w = this.words[s];
  3478. return !!(w & q);
  3479. };
  3480. // Return only lowers bits of number (in-place)
  3481. BN.prototype.imaskn = function imaskn (bits) {
  3482. assert(typeof bits === 'number' && bits >= 0);
  3483. var r = bits % 26;
  3484. var s = (bits - r) / 26;
  3485. assert(this.negative === 0, 'imaskn works only with positive numbers');
  3486. if (this.length <= s) {
  3487. return this;
  3488. }
  3489. if (r !== 0) {
  3490. s++;
  3491. }
  3492. this.length = Math.min(s, this.length);
  3493. if (r !== 0) {
  3494. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  3495. this.words[this.length - 1] &= mask;
  3496. }
  3497. return this.strip();
  3498. };
  3499. // Return only lowers bits of number
  3500. BN.prototype.maskn = function maskn (bits) {
  3501. return this.clone().imaskn(bits);
  3502. };
  3503. // Add plain number `num` to `this`
  3504. BN.prototype.iaddn = function iaddn (num) {
  3505. assert(typeof num === 'number');
  3506. assert(num < 0x4000000);
  3507. if (num < 0) return this.isubn(-num);
  3508. // Possible sign change
  3509. if (this.negative !== 0) {
  3510. if (this.length === 1 && (this.words[0] | 0) < num) {
  3511. this.words[0] = num - (this.words[0] | 0);
  3512. this.negative = 0;
  3513. return this;
  3514. }
  3515. this.negative = 0;
  3516. this.isubn(num);
  3517. this.negative = 1;
  3518. return this;
  3519. }
  3520. // Add without checks
  3521. return this._iaddn(num);
  3522. };
  3523. BN.prototype._iaddn = function _iaddn (num) {
  3524. this.words[0] += num;
  3525. // Carry
  3526. for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
  3527. this.words[i] -= 0x4000000;
  3528. if (i === this.length - 1) {
  3529. this.words[i + 1] = 1;
  3530. } else {
  3531. this.words[i + 1]++;
  3532. }
  3533. }
  3534. this.length = Math.max(this.length, i + 1);
  3535. return this;
  3536. };
  3537. // Subtract plain number `num` from `this`
  3538. BN.prototype.isubn = function isubn (num) {
  3539. assert(typeof num === 'number');
  3540. assert(num < 0x4000000);
  3541. if (num < 0) return this.iaddn(-num);
  3542. if (this.negative !== 0) {
  3543. this.negative = 0;
  3544. this.iaddn(num);
  3545. this.negative = 1;
  3546. return this;
  3547. }
  3548. this.words[0] -= num;
  3549. if (this.length === 1 && this.words[0] < 0) {
  3550. this.words[0] = -this.words[0];
  3551. this.negative = 1;
  3552. } else {
  3553. // Carry
  3554. for (var i = 0; i < this.length && this.words[i] < 0; i++) {
  3555. this.words[i] += 0x4000000;
  3556. this.words[i + 1] -= 1;
  3557. }
  3558. }
  3559. return this.strip();
  3560. };
  3561. BN.prototype.addn = function addn (num) {
  3562. return this.clone().iaddn(num);
  3563. };
  3564. BN.prototype.subn = function subn (num) {
  3565. return this.clone().isubn(num);
  3566. };
  3567. BN.prototype.iabs = function iabs () {
  3568. this.negative = 0;
  3569. return this;
  3570. };
  3571. BN.prototype.abs = function abs () {
  3572. return this.clone().iabs();
  3573. };
  3574. BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
  3575. var len = num.length + shift;
  3576. var i;
  3577. this._expand(len);
  3578. var w;
  3579. var carry = 0;
  3580. for (i = 0; i < num.length; i++) {
  3581. w = (this.words[i + shift] | 0) + carry;
  3582. var right = (num.words[i] | 0) * mul;
  3583. w -= right & 0x3ffffff;
  3584. carry = (w >> 26) - ((right / 0x4000000) | 0);
  3585. this.words[i + shift] = w & 0x3ffffff;
  3586. }
  3587. for (; i < this.length - shift; i++) {
  3588. w = (this.words[i + shift] | 0) + carry;
  3589. carry = w >> 26;
  3590. this.words[i + shift] = w & 0x3ffffff;
  3591. }
  3592. if (carry === 0) return this.strip();
  3593. // Subtraction overflow
  3594. assert(carry === -1);
  3595. carry = 0;
  3596. for (i = 0; i < this.length; i++) {
  3597. w = -(this.words[i] | 0) + carry;
  3598. carry = w >> 26;
  3599. this.words[i] = w & 0x3ffffff;
  3600. }
  3601. this.negative = 1;
  3602. return this.strip();
  3603. };
  3604. BN.prototype._wordDiv = function _wordDiv (num, mode) {
  3605. var shift = this.length - num.length;
  3606. var a = this.clone();
  3607. var b = num;
  3608. // Normalize
  3609. var bhi = b.words[b.length - 1] | 0;
  3610. var bhiBits = this._countBits(bhi);
  3611. shift = 26 - bhiBits;
  3612. if (shift !== 0) {
  3613. b = b.ushln(shift);
  3614. a.iushln(shift);
  3615. bhi = b.words[b.length - 1] | 0;
  3616. }
  3617. // Initialize quotient
  3618. var m = a.length - b.length;
  3619. var q;
  3620. if (mode !== 'mod') {
  3621. q = new BN(null);
  3622. q.length = m + 1;
  3623. q.words = new Array(q.length);
  3624. for (var i = 0; i < q.length; i++) {
  3625. q.words[i] = 0;
  3626. }
  3627. }
  3628. var diff = a.clone()._ishlnsubmul(b, 1, m);
  3629. if (diff.negative === 0) {
  3630. a = diff;
  3631. if (q) {
  3632. q.words[m] = 1;
  3633. }
  3634. }
  3635. for (var j = m - 1; j >= 0; j--) {
  3636. var qj = (a.words[b.length + j] | 0) * 0x4000000 +
  3637. (a.words[b.length + j - 1] | 0);
  3638. // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
  3639. // (0x7ffffff)
  3640. qj = Math.min((qj / bhi) | 0, 0x3ffffff);
  3641. a._ishlnsubmul(b, qj, j);
  3642. while (a.negative !== 0) {
  3643. qj--;
  3644. a.negative = 0;
  3645. a._ishlnsubmul(b, 1, j);
  3646. if (!a.isZero()) {
  3647. a.negative ^= 1;
  3648. }
  3649. }
  3650. if (q) {
  3651. q.words[j] = qj;
  3652. }
  3653. }
  3654. if (q) {
  3655. q.strip();
  3656. }
  3657. a.strip();
  3658. // Denormalize
  3659. if (mode !== 'div' && shift !== 0) {
  3660. a.iushrn(shift);
  3661. }
  3662. return {
  3663. div: q || null,
  3664. mod: a
  3665. };
  3666. };
  3667. // NOTE: 1) `mode` can be set to `mod` to request mod only,
  3668. // to `div` to request div only, or be absent to
  3669. // request both div & mod
  3670. // 2) `positive` is true if unsigned mod is requested
  3671. BN.prototype.divmod = function divmod (num, mode, positive) {
  3672. assert(!num.isZero());
  3673. if (this.isZero()) {
  3674. return {
  3675. div: new BN(0),
  3676. mod: new BN(0)
  3677. };
  3678. }
  3679. var div, mod, res;
  3680. if (this.negative !== 0 && num.negative === 0) {
  3681. res = this.neg().divmod(num, mode);
  3682. if (mode !== 'mod') {
  3683. div = res.div.neg();
  3684. }
  3685. if (mode !== 'div') {
  3686. mod = res.mod.neg();
  3687. if (positive && mod.negative !== 0) {
  3688. mod.iadd(num);
  3689. }
  3690. }
  3691. return {
  3692. div: div,
  3693. mod: mod
  3694. };
  3695. }
  3696. if (this.negative === 0 && num.negative !== 0) {
  3697. res = this.divmod(num.neg(), mode);
  3698. if (mode !== 'mod') {
  3699. div = res.div.neg();
  3700. }
  3701. return {
  3702. div: div,
  3703. mod: res.mod
  3704. };
  3705. }
  3706. if ((this.negative & num.negative) !== 0) {
  3707. res = this.neg().divmod(num.neg(), mode);
  3708. if (mode !== 'div') {
  3709. mod = res.mod.neg();
  3710. if (positive && mod.negative !== 0) {
  3711. mod.isub(num);
  3712. }
  3713. }
  3714. return {
  3715. div: res.div,
  3716. mod: mod
  3717. };
  3718. }
  3719. // Both numbers are positive at this point
  3720. // Strip both numbers to approximate shift value
  3721. if (num.length > this.length || this.cmp(num) < 0) {
  3722. return {
  3723. div: new BN(0),
  3724. mod: this
  3725. };
  3726. }
  3727. // Very short reduction
  3728. if (num.length === 1) {
  3729. if (mode === 'div') {
  3730. return {
  3731. div: this.divn(num.words[0]),
  3732. mod: null
  3733. };
  3734. }
  3735. if (mode === 'mod') {
  3736. return {
  3737. div: null,
  3738. mod: new BN(this.modn(num.words[0]))
  3739. };
  3740. }
  3741. return {
  3742. div: this.divn(num.words[0]),
  3743. mod: new BN(this.modn(num.words[0]))
  3744. };
  3745. }
  3746. return this._wordDiv(num, mode);
  3747. };
  3748. // Find `this` / `num`
  3749. BN.prototype.div = function div (num) {
  3750. return this.divmod(num, 'div', false).div;
  3751. };
  3752. // Find `this` % `num`
  3753. BN.prototype.mod = function mod (num) {
  3754. return this.divmod(num, 'mod', false).mod;
  3755. };
  3756. BN.prototype.umod = function umod (num) {
  3757. return this.divmod(num, 'mod', true).mod;
  3758. };
  3759. // Find Round(`this` / `num`)
  3760. BN.prototype.divRound = function divRound (num) {
  3761. var dm = this.divmod(num);
  3762. // Fast case - exact division
  3763. if (dm.mod.isZero()) return dm.div;
  3764. var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
  3765. var half = num.ushrn(1);
  3766. var r2 = num.andln(1);
  3767. var cmp = mod.cmp(half);
  3768. // Round down
  3769. if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
  3770. // Round up
  3771. return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
  3772. };
  3773. BN.prototype.modn = function modn (num) {
  3774. assert(num <= 0x3ffffff);
  3775. var p = (1 << 26) % num;
  3776. var acc = 0;
  3777. for (var i = this.length - 1; i >= 0; i--) {
  3778. acc = (p * acc + (this.words[i] | 0)) % num;
  3779. }
  3780. return acc;
  3781. };
  3782. // In-place division by number
  3783. BN.prototype.idivn = function idivn (num) {
  3784. assert(num <= 0x3ffffff);
  3785. var carry = 0;
  3786. for (var i = this.length - 1; i >= 0; i--) {
  3787. var w = (this.words[i] | 0) + carry * 0x4000000;
  3788. this.words[i] = (w / num) | 0;
  3789. carry = w % num;
  3790. }
  3791. return this.strip();
  3792. };
  3793. BN.prototype.divn = function divn (num) {
  3794. return this.clone().idivn(num);
  3795. };
  3796. BN.prototype.egcd = function egcd (p) {
  3797. assert(p.negative === 0);
  3798. assert(!p.isZero());
  3799. var x = this;
  3800. var y = p.clone();
  3801. if (x.negative !== 0) {
  3802. x = x.umod(p);
  3803. } else {
  3804. x = x.clone();
  3805. }
  3806. // A * x + B * y = x
  3807. var A = new BN(1);
  3808. var B = new BN(0);
  3809. // C * x + D * y = y
  3810. var C = new BN(0);
  3811. var D = new BN(1);
  3812. var g = 0;
  3813. while (x.isEven() && y.isEven()) {
  3814. x.iushrn(1);
  3815. y.iushrn(1);
  3816. ++g;
  3817. }
  3818. var yp = y.clone();
  3819. var xp = x.clone();
  3820. while (!x.isZero()) {
  3821. for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  3822. if (i > 0) {
  3823. x.iushrn(i);
  3824. while (i-- > 0) {
  3825. if (A.isOdd() || B.isOdd()) {
  3826. A.iadd(yp);
  3827. B.isub(xp);
  3828. }
  3829. A.iushrn(1);
  3830. B.iushrn(1);
  3831. }
  3832. }
  3833. for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  3834. if (j > 0) {
  3835. y.iushrn(j);
  3836. while (j-- > 0) {
  3837. if (C.isOdd() || D.isOdd()) {
  3838. C.iadd(yp);
  3839. D.isub(xp);
  3840. }
  3841. C.iushrn(1);
  3842. D.iushrn(1);
  3843. }
  3844. }
  3845. if (x.cmp(y) >= 0) {
  3846. x.isub(y);
  3847. A.isub(C);
  3848. B.isub(D);
  3849. } else {
  3850. y.isub(x);
  3851. C.isub(A);
  3852. D.isub(B);
  3853. }
  3854. }
  3855. return {
  3856. a: C,
  3857. b: D,
  3858. gcd: y.iushln(g)
  3859. };
  3860. };
  3861. // This is reduced incarnation of the binary EEA
  3862. // above, designated to invert members of the
  3863. // _prime_ fields F(p) at a maximal speed
  3864. BN.prototype._invmp = function _invmp (p) {
  3865. assert(p.negative === 0);
  3866. assert(!p.isZero());
  3867. var a = this;
  3868. var b = p.clone();
  3869. if (a.negative !== 0) {
  3870. a = a.umod(p);
  3871. } else {
  3872. a = a.clone();
  3873. }
  3874. var x1 = new BN(1);
  3875. var x2 = new BN(0);
  3876. var delta = b.clone();
  3877. while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
  3878. for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  3879. if (i > 0) {
  3880. a.iushrn(i);
  3881. while (i-- > 0) {
  3882. if (x1.isOdd()) {
  3883. x1.iadd(delta);
  3884. }
  3885. x1.iushrn(1);
  3886. }
  3887. }
  3888. for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  3889. if (j > 0) {
  3890. b.iushrn(j);
  3891. while (j-- > 0) {
  3892. if (x2.isOdd()) {
  3893. x2.iadd(delta);
  3894. }
  3895. x2.iushrn(1);
  3896. }
  3897. }
  3898. if (a.cmp(b) >= 0) {
  3899. a.isub(b);
  3900. x1.isub(x2);
  3901. } else {
  3902. b.isub(a);
  3903. x2.isub(x1);
  3904. }
  3905. }
  3906. var res;
  3907. if (a.cmpn(1) === 0) {
  3908. res = x1;
  3909. } else {
  3910. res = x2;
  3911. }
  3912. if (res.cmpn(0) < 0) {
  3913. res.iadd(p);
  3914. }
  3915. return res;
  3916. };
  3917. BN.prototype.gcd = function gcd (num) {
  3918. if (this.isZero()) return num.abs();
  3919. if (num.isZero()) return this.abs();
  3920. var a = this.clone();
  3921. var b = num.clone();
  3922. a.negative = 0;
  3923. b.negative = 0;
  3924. // Remove common factor of two
  3925. for (var shift = 0; a.isEven() && b.isEven(); shift++) {
  3926. a.iushrn(1);
  3927. b.iushrn(1);
  3928. }
  3929. do {
  3930. while (a.isEven()) {
  3931. a.iushrn(1);
  3932. }
  3933. while (b.isEven()) {
  3934. b.iushrn(1);
  3935. }
  3936. var r = a.cmp(b);
  3937. if (r < 0) {
  3938. // Swap `a` and `b` to make `a` always bigger than `b`
  3939. var t = a;
  3940. a = b;
  3941. b = t;
  3942. } else if (r === 0 || b.cmpn(1) === 0) {
  3943. break;
  3944. }
  3945. a.isub(b);
  3946. } while (true);
  3947. return b.iushln(shift);
  3948. };
  3949. // Invert number in the field F(num)
  3950. BN.prototype.invm = function invm (num) {
  3951. return this.egcd(num).a.umod(num);
  3952. };
  3953. BN.prototype.isEven = function isEven () {
  3954. return (this.words[0] & 1) === 0;
  3955. };
  3956. BN.prototype.isOdd = function isOdd () {
  3957. return (this.words[0] & 1) === 1;
  3958. };
  3959. // And first word and num
  3960. BN.prototype.andln = function andln (num) {
  3961. return this.words[0] & num;
  3962. };
  3963. // Increment at the bit position in-line
  3964. BN.prototype.bincn = function bincn (bit) {
  3965. assert(typeof bit === 'number');
  3966. var r = bit % 26;
  3967. var s = (bit - r) / 26;
  3968. var q = 1 << r;
  3969. // Fast case: bit is much higher than all existing words
  3970. if (this.length <= s) {
  3971. this._expand(s + 1);
  3972. this.words[s] |= q;
  3973. return this;
  3974. }
  3975. // Add bit and propagate, if needed
  3976. var carry = q;
  3977. for (var i = s; carry !== 0 && i < this.length; i++) {
  3978. var w = this.words[i] | 0;
  3979. w += carry;
  3980. carry = w >>> 26;
  3981. w &= 0x3ffffff;
  3982. this.words[i] = w;
  3983. }
  3984. if (carry !== 0) {
  3985. this.words[i] = carry;
  3986. this.length++;
  3987. }
  3988. return this;
  3989. };
  3990. BN.prototype.isZero = function isZero () {
  3991. return this.length === 1 && this.words[0] === 0;
  3992. };
  3993. BN.prototype.cmpn = function cmpn (num) {
  3994. var negative = num < 0;
  3995. if (this.negative !== 0 && !negative) return -1;
  3996. if (this.negative === 0 && negative) return 1;
  3997. this.strip();
  3998. var res;
  3999. if (this.length > 1) {
  4000. res = 1;
  4001. } else {
  4002. if (negative) {
  4003. num = -num;
  4004. }
  4005. assert(num <= 0x3ffffff, 'Number is too big');
  4006. var w = this.words[0] | 0;
  4007. res = w === num ? 0 : w < num ? -1 : 1;
  4008. }
  4009. if (this.negative !== 0) return -res | 0;
  4010. return res;
  4011. };
  4012. // Compare two numbers and return:
  4013. // 1 - if `this` > `num`
  4014. // 0 - if `this` == `num`
  4015. // -1 - if `this` < `num`
  4016. BN.prototype.cmp = function cmp (num) {
  4017. if (this.negative !== 0 && num.negative === 0) return -1;
  4018. if (this.negative === 0 && num.negative !== 0) return 1;
  4019. var res = this.ucmp(num);
  4020. if (this.negative !== 0) return -res | 0;
  4021. return res;
  4022. };
  4023. // Unsigned comparison
  4024. BN.prototype.ucmp = function ucmp (num) {
  4025. // At this point both numbers have the same sign
  4026. if (this.length > num.length) return 1;
  4027. if (this.length < num.length) return -1;
  4028. var res = 0;
  4029. for (var i = this.length - 1; i >= 0; i--) {
  4030. var a = this.words[i] | 0;
  4031. var b = num.words[i] | 0;
  4032. if (a === b) continue;
  4033. if (a < b) {
  4034. res = -1;
  4035. } else if (a > b) {
  4036. res = 1;
  4037. }
  4038. break;
  4039. }
  4040. return res;
  4041. };
  4042. BN.prototype.gtn = function gtn (num) {
  4043. return this.cmpn(num) === 1;
  4044. };
  4045. BN.prototype.gt = function gt (num) {
  4046. return this.cmp(num) === 1;
  4047. };
  4048. BN.prototype.gten = function gten (num) {
  4049. return this.cmpn(num) >= 0;
  4050. };
  4051. BN.prototype.gte = function gte (num) {
  4052. return this.cmp(num) >= 0;
  4053. };
  4054. BN.prototype.ltn = function ltn (num) {
  4055. return this.cmpn(num) === -1;
  4056. };
  4057. BN.prototype.lt = function lt (num) {
  4058. return this.cmp(num) === -1;
  4059. };
  4060. BN.prototype.lten = function lten (num) {
  4061. return this.cmpn(num) <= 0;
  4062. };
  4063. BN.prototype.lte = function lte (num) {
  4064. return this.cmp(num) <= 0;
  4065. };
  4066. BN.prototype.eqn = function eqn (num) {
  4067. return this.cmpn(num) === 0;
  4068. };
  4069. BN.prototype.eq = function eq (num) {
  4070. return this.cmp(num) === 0;
  4071. };
  4072. //
  4073. // A reduce context, could be using montgomery or something better, depending
  4074. // on the `m` itself.
  4075. //
  4076. BN.red = function red (num) {
  4077. return new Red(num);
  4078. };
  4079. BN.prototype.toRed = function toRed (ctx) {
  4080. assert(!this.red, 'Already a number in reduction context');
  4081. assert(this.negative === 0, 'red works only with positives');
  4082. return ctx.convertTo(this)._forceRed(ctx);
  4083. };
  4084. BN.prototype.fromRed = function fromRed () {
  4085. assert(this.red, 'fromRed works only with numbers in reduction context');
  4086. return this.red.convertFrom(this);
  4087. };
  4088. BN.prototype._forceRed = function _forceRed (ctx) {
  4089. this.red = ctx;
  4090. return this;
  4091. };
  4092. BN.prototype.forceRed = function forceRed (ctx) {
  4093. assert(!this.red, 'Already a number in reduction context');
  4094. return this._forceRed(ctx);
  4095. };
  4096. BN.prototype.redAdd = function redAdd (num) {
  4097. assert(this.red, 'redAdd works only with red numbers');
  4098. return this.red.add(this, num);
  4099. };
  4100. BN.prototype.redIAdd = function redIAdd (num) {
  4101. assert(this.red, 'redIAdd works only with red numbers');
  4102. return this.red.iadd(this, num);
  4103. };
  4104. BN.prototype.redSub = function redSub (num) {
  4105. assert(this.red, 'redSub works only with red numbers');
  4106. return this.red.sub(this, num);
  4107. };
  4108. BN.prototype.redISub = function redISub (num) {
  4109. assert(this.red, 'redISub works only with red numbers');
  4110. return this.red.isub(this, num);
  4111. };
  4112. BN.prototype.redShl = function redShl (num) {
  4113. assert(this.red, 'redShl works only with red numbers');
  4114. return this.red.shl(this, num);
  4115. };
  4116. BN.prototype.redMul = function redMul (num) {
  4117. assert(this.red, 'redMul works only with red numbers');
  4118. this.red._verify2(this, num);
  4119. return this.red.mul(this, num);
  4120. };
  4121. BN.prototype.redIMul = function redIMul (num) {
  4122. assert(this.red, 'redMul works only with red numbers');
  4123. this.red._verify2(this, num);
  4124. return this.red.imul(this, num);
  4125. };
  4126. BN.prototype.redSqr = function redSqr () {
  4127. assert(this.red, 'redSqr works only with red numbers');
  4128. this.red._verify1(this);
  4129. return this.red.sqr(this);
  4130. };
  4131. BN.prototype.redISqr = function redISqr () {
  4132. assert(this.red, 'redISqr works only with red numbers');
  4133. this.red._verify1(this);
  4134. return this.red.isqr(this);
  4135. };
  4136. // Square root over p
  4137. BN.prototype.redSqrt = function redSqrt () {
  4138. assert(this.red, 'redSqrt works only with red numbers');
  4139. this.red._verify1(this);
  4140. return this.red.sqrt(this);
  4141. };
  4142. BN.prototype.redInvm = function redInvm () {
  4143. assert(this.red, 'redInvm works only with red numbers');
  4144. this.red._verify1(this);
  4145. return this.red.invm(this);
  4146. };
  4147. // Return negative clone of `this` % `red modulo`
  4148. BN.prototype.redNeg = function redNeg () {
  4149. assert(this.red, 'redNeg works only with red numbers');
  4150. this.red._verify1(this);
  4151. return this.red.neg(this);
  4152. };
  4153. BN.prototype.redPow = function redPow (num) {
  4154. assert(this.red && !num.red, 'redPow(normalNum)');
  4155. this.red._verify1(this);
  4156. return this.red.pow(this, num);
  4157. };
  4158. // Prime numbers with efficient reduction
  4159. var primes = {
  4160. k256: null,
  4161. p224: null,
  4162. p192: null,
  4163. p25519: null
  4164. };
  4165. // Pseudo-Mersenne prime
  4166. function MPrime (name, p) {
  4167. // P = 2 ^ N - K
  4168. this.name = name;
  4169. this.p = new BN(p, 16);
  4170. this.n = this.p.bitLength();
  4171. this.k = new BN(1).iushln(this.n).isub(this.p);
  4172. this.tmp = this._tmp();
  4173. }
  4174. MPrime.prototype._tmp = function _tmp () {
  4175. var tmp = new BN(null);
  4176. tmp.words = new Array(Math.ceil(this.n / 13));
  4177. return tmp;
  4178. };
  4179. MPrime.prototype.ireduce = function ireduce (num) {
  4180. // Assumes that `num` is less than `P^2`
  4181. // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
  4182. var r = num;
  4183. var rlen;
  4184. do {
  4185. this.split(r, this.tmp);
  4186. r = this.imulK(r);
  4187. r = r.iadd(this.tmp);
  4188. rlen = r.bitLength();
  4189. } while (rlen > this.n);
  4190. var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
  4191. if (cmp === 0) {
  4192. r.words[0] = 0;
  4193. r.length = 1;
  4194. } else if (cmp > 0) {
  4195. r.isub(this.p);
  4196. } else {
  4197. r.strip();
  4198. }
  4199. return r;
  4200. };
  4201. MPrime.prototype.split = function split (input, out) {
  4202. input.iushrn(this.n, 0, out);
  4203. };
  4204. MPrime.prototype.imulK = function imulK (num) {
  4205. return num.imul(this.k);
  4206. };
  4207. function K256 () {
  4208. MPrime.call(
  4209. this,
  4210. 'k256',
  4211. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
  4212. }
  4213. inherits(K256, MPrime);
  4214. K256.prototype.split = function split (input, output) {
  4215. // 256 = 9 * 26 + 22
  4216. var mask = 0x3fffff;
  4217. var outLen = Math.min(input.length, 9);
  4218. for (var i = 0; i < outLen; i++) {
  4219. output.words[i] = input.words[i];
  4220. }
  4221. output.length = outLen;
  4222. if (input.length <= 9) {
  4223. input.words[0] = 0;
  4224. input.length = 1;
  4225. return;
  4226. }
  4227. // Shift by 9 limbs
  4228. var prev = input.words[9];
  4229. output.words[output.length++] = prev & mask;
  4230. for (i = 10; i < input.length; i++) {
  4231. var next = input.words[i] | 0;
  4232. input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
  4233. prev = next;
  4234. }
  4235. prev >>>= 22;
  4236. input.words[i - 10] = prev;
  4237. if (prev === 0 && input.length > 10) {
  4238. input.length -= 10;
  4239. } else {
  4240. input.length -= 9;
  4241. }
  4242. };
  4243. K256.prototype.imulK = function imulK (num) {
  4244. // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
  4245. num.words[num.length] = 0;
  4246. num.words[num.length + 1] = 0;
  4247. num.length += 2;
  4248. // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
  4249. var lo = 0;
  4250. for (var i = 0; i < num.length; i++) {
  4251. var w = num.words[i] | 0;
  4252. lo += w * 0x3d1;
  4253. num.words[i] = lo & 0x3ffffff;
  4254. lo = w * 0x40 + ((lo / 0x4000000) | 0);
  4255. }
  4256. // Fast length reduction
  4257. if (num.words[num.length - 1] === 0) {
  4258. num.length--;
  4259. if (num.words[num.length - 1] === 0) {
  4260. num.length--;
  4261. }
  4262. }
  4263. return num;
  4264. };
  4265. function P224 () {
  4266. MPrime.call(
  4267. this,
  4268. 'p224',
  4269. 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
  4270. }
  4271. inherits(P224, MPrime);
  4272. function P192 () {
  4273. MPrime.call(
  4274. this,
  4275. 'p192',
  4276. 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
  4277. }
  4278. inherits(P192, MPrime);
  4279. function P25519 () {
  4280. // 2 ^ 255 - 19
  4281. MPrime.call(
  4282. this,
  4283. '25519',
  4284. '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
  4285. }
  4286. inherits(P25519, MPrime);
  4287. P25519.prototype.imulK = function imulK (num) {
  4288. // K = 0x13
  4289. var carry = 0;
  4290. for (var i = 0; i < num.length; i++) {
  4291. var hi = (num.words[i] | 0) * 0x13 + carry;
  4292. var lo = hi & 0x3ffffff;
  4293. hi >>>= 26;
  4294. num.words[i] = lo;
  4295. carry = hi;
  4296. }
  4297. if (carry !== 0) {
  4298. num.words[num.length++] = carry;
  4299. }
  4300. return num;
  4301. };
  4302. // Exported mostly for testing purposes, use plain name instead
  4303. BN._prime = function prime (name) {
  4304. // Cached version of prime
  4305. if (primes[name]) return primes[name];
  4306. var prime;
  4307. if (name === 'k256') {
  4308. prime = new K256();
  4309. } else if (name === 'p224') {
  4310. prime = new P224();
  4311. } else if (name === 'p192') {
  4312. prime = new P192();
  4313. } else if (name === 'p25519') {
  4314. prime = new P25519();
  4315. } else {
  4316. throw new Error('Unknown prime ' + name);
  4317. }
  4318. primes[name] = prime;
  4319. return prime;
  4320. };
  4321. //
  4322. // Base reduction engine
  4323. //
  4324. function Red (m) {
  4325. if (typeof m === 'string') {
  4326. var prime = BN._prime(m);
  4327. this.m = prime.p;
  4328. this.prime = prime;
  4329. } else {
  4330. assert(m.gtn(1), 'modulus must be greater than 1');
  4331. this.m = m;
  4332. this.prime = null;
  4333. }
  4334. }
  4335. Red.prototype._verify1 = function _verify1 (a) {
  4336. assert(a.negative === 0, 'red works only with positives');
  4337. assert(a.red, 'red works only with red numbers');
  4338. };
  4339. Red.prototype._verify2 = function _verify2 (a, b) {
  4340. assert((a.negative | b.negative) === 0, 'red works only with positives');
  4341. assert(a.red && a.red === b.red,
  4342. 'red works only with red numbers');
  4343. };
  4344. Red.prototype.imod = function imod (a) {
  4345. if (this.prime) return this.prime.ireduce(a)._forceRed(this);
  4346. return a.umod(this.m)._forceRed(this);
  4347. };
  4348. Red.prototype.neg = function neg (a) {
  4349. if (a.isZero()) {
  4350. return a.clone();
  4351. }
  4352. return this.m.sub(a)._forceRed(this);
  4353. };
  4354. Red.prototype.add = function add (a, b) {
  4355. this._verify2(a, b);
  4356. var res = a.add(b);
  4357. if (res.cmp(this.m) >= 0) {
  4358. res.isub(this.m);
  4359. }
  4360. return res._forceRed(this);
  4361. };
  4362. Red.prototype.iadd = function iadd (a, b) {
  4363. this._verify2(a, b);
  4364. var res = a.iadd(b);
  4365. if (res.cmp(this.m) >= 0) {
  4366. res.isub(this.m);
  4367. }
  4368. return res;
  4369. };
  4370. Red.prototype.sub = function sub (a, b) {
  4371. this._verify2(a, b);
  4372. var res = a.sub(b);
  4373. if (res.cmpn(0) < 0) {
  4374. res.iadd(this.m);
  4375. }
  4376. return res._forceRed(this);
  4377. };
  4378. Red.prototype.isub = function isub (a, b) {
  4379. this._verify2(a, b);
  4380. var res = a.isub(b);
  4381. if (res.cmpn(0) < 0) {
  4382. res.iadd(this.m);
  4383. }
  4384. return res;
  4385. };
  4386. Red.prototype.shl = function shl (a, num) {
  4387. this._verify1(a);
  4388. return this.imod(a.ushln(num));
  4389. };
  4390. Red.prototype.imul = function imul (a, b) {
  4391. this._verify2(a, b);
  4392. return this.imod(a.imul(b));
  4393. };
  4394. Red.prototype.mul = function mul (a, b) {
  4395. this._verify2(a, b);
  4396. return this.imod(a.mul(b));
  4397. };
  4398. Red.prototype.isqr = function isqr (a) {
  4399. return this.imul(a, a.clone());
  4400. };
  4401. Red.prototype.sqr = function sqr (a) {
  4402. return this.mul(a, a);
  4403. };
  4404. Red.prototype.sqrt = function sqrt (a) {
  4405. if (a.isZero()) return a.clone();
  4406. var mod3 = this.m.andln(3);
  4407. assert(mod3 % 2 === 1);
  4408. // Fast case
  4409. if (mod3 === 3) {
  4410. var pow = this.m.add(new BN(1)).iushrn(2);
  4411. return this.pow(a, pow);
  4412. }
  4413. // Tonelli-Shanks algorithm (Totally unoptimized and slow)
  4414. //
  4415. // Find Q and S, that Q * 2 ^ S = (P - 1)
  4416. var q = this.m.subn(1);
  4417. var s = 0;
  4418. while (!q.isZero() && q.andln(1) === 0) {
  4419. s++;
  4420. q.iushrn(1);
  4421. }
  4422. assert(!q.isZero());
  4423. var one = new BN(1).toRed(this);
  4424. var nOne = one.redNeg();
  4425. // Find quadratic non-residue
  4426. // NOTE: Max is such because of generalized Riemann hypothesis.
  4427. var lpow = this.m.subn(1).iushrn(1);
  4428. var z = this.m.bitLength();
  4429. z = new BN(2 * z * z).toRed(this);
  4430. while (this.pow(z, lpow).cmp(nOne) !== 0) {
  4431. z.redIAdd(nOne);
  4432. }
  4433. var c = this.pow(z, q);
  4434. var r = this.pow(a, q.addn(1).iushrn(1));
  4435. var t = this.pow(a, q);
  4436. var m = s;
  4437. while (t.cmp(one) !== 0) {
  4438. var tmp = t;
  4439. for (var i = 0; tmp.cmp(one) !== 0; i++) {
  4440. tmp = tmp.redSqr();
  4441. }
  4442. assert(i < m);
  4443. var b = this.pow(c, new BN(1).iushln(m - i - 1));
  4444. r = r.redMul(b);
  4445. c = b.redSqr();
  4446. t = t.redMul(c);
  4447. m = i;
  4448. }
  4449. return r;
  4450. };
  4451. Red.prototype.invm = function invm (a) {
  4452. var inv = a._invmp(this.m);
  4453. if (inv.negative !== 0) {
  4454. inv.negative = 0;
  4455. return this.imod(inv).redNeg();
  4456. } else {
  4457. return this.imod(inv);
  4458. }
  4459. };
  4460. Red.prototype.pow = function pow (a, num) {
  4461. if (num.isZero()) return new BN(1);
  4462. if (num.cmpn(1) === 0) return a.clone();
  4463. var windowSize = 4;
  4464. var wnd = new Array(1 << windowSize);
  4465. wnd[0] = new BN(1).toRed(this);
  4466. wnd[1] = a;
  4467. for (var i = 2; i < wnd.length; i++) {
  4468. wnd[i] = this.mul(wnd[i - 1], a);
  4469. }
  4470. var res = wnd[0];
  4471. var current = 0;
  4472. var currentLen = 0;
  4473. var start = num.bitLength() % 26;
  4474. if (start === 0) {
  4475. start = 26;
  4476. }
  4477. for (i = num.length - 1; i >= 0; i--) {
  4478. var word = num.words[i];
  4479. for (var j = start - 1; j >= 0; j--) {
  4480. var bit = (word >> j) & 1;
  4481. if (res !== wnd[0]) {
  4482. res = this.sqr(res);
  4483. }
  4484. if (bit === 0 && current === 0) {
  4485. currentLen = 0;
  4486. continue;
  4487. }
  4488. current <<= 1;
  4489. current |= bit;
  4490. currentLen++;
  4491. if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
  4492. res = this.mul(res, wnd[current]);
  4493. currentLen = 0;
  4494. current = 0;
  4495. }
  4496. start = 26;
  4497. }
  4498. return res;
  4499. };
  4500. Red.prototype.convertTo = function convertTo (num) {
  4501. var r = num.umod(this.m);
  4502. return r === num ? r.clone() : r;
  4503. };
  4504. Red.prototype.convertFrom = function convertFrom (num) {
  4505. var res = num.clone();
  4506. res.red = null;
  4507. return res;
  4508. };
  4509. //
  4510. // Montgomery method engine
  4511. //
  4512. BN.mont = function mont (num) {
  4513. return new Mont(num);
  4514. };
  4515. function Mont (m) {
  4516. Red.call(this, m);
  4517. this.shift = this.m.bitLength();
  4518. if (this.shift % 26 !== 0) {
  4519. this.shift += 26 - (this.shift % 26);
  4520. }
  4521. this.r = new BN(1).iushln(this.shift);
  4522. this.r2 = this.imod(this.r.sqr());
  4523. this.rinv = this.r._invmp(this.m);
  4524. this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
  4525. this.minv = this.minv.umod(this.r);
  4526. this.minv = this.r.sub(this.minv);
  4527. }
  4528. inherits(Mont, Red);
  4529. Mont.prototype.convertTo = function convertTo (num) {
  4530. return this.imod(num.ushln(this.shift));
  4531. };
  4532. Mont.prototype.convertFrom = function convertFrom (num) {
  4533. var r = this.imod(num.mul(this.rinv));
  4534. r.red = null;
  4535. return r;
  4536. };
  4537. Mont.prototype.imul = function imul (a, b) {
  4538. if (a.isZero() || b.isZero()) {
  4539. a.words[0] = 0;
  4540. a.length = 1;
  4541. return a;
  4542. }
  4543. var t = a.imul(b);
  4544. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  4545. var u = t.isub(c).iushrn(this.shift);
  4546. var res = u;
  4547. if (u.cmp(this.m) >= 0) {
  4548. res = u.isub(this.m);
  4549. } else if (u.cmpn(0) < 0) {
  4550. res = u.iadd(this.m);
  4551. }
  4552. return res._forceRed(this);
  4553. };
  4554. Mont.prototype.mul = function mul (a, b) {
  4555. if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
  4556. var t = a.mul(b);
  4557. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  4558. var u = t.isub(c).iushrn(this.shift);
  4559. var res = u;
  4560. if (u.cmp(this.m) >= 0) {
  4561. res = u.isub(this.m);
  4562. } else if (u.cmpn(0) < 0) {
  4563. res = u.iadd(this.m);
  4564. }
  4565. return res._forceRed(this);
  4566. };
  4567. Mont.prototype.invm = function invm (a) {
  4568. // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
  4569. var res = this.imod(a._invmp(this.m).mul(this.r2));
  4570. return res._forceRed(this);
  4571. };
  4572. })(typeof module === 'undefined' || module, this);
  4573. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(310)(module)))
  4574. /***/ },
  4575. /* 3 */
  4576. /***/ function(module, exports, __webpack_require__) {
  4577. "use strict";
  4578. 'use strict';
  4579. var elliptic = exports;
  4580. elliptic.version = __webpack_require__(256).version;
  4581. elliptic.utils = __webpack_require__(245);
  4582. elliptic.rand = __webpack_require__(81);
  4583. elliptic.hmacDRBG = __webpack_require__(243);
  4584. elliptic.curve = __webpack_require__(43);
  4585. elliptic.curves = __webpack_require__(236);
  4586. // Protocols
  4587. elliptic.ec = __webpack_require__(237);
  4588. elliptic.eddsa = __webpack_require__(240);
  4589. /***/ },
  4590. /* 4 */
  4591. /***/ function(module, exports, __webpack_require__) {
  4592. "use strict";
  4593. 'use strict';
  4594. var bind = __webpack_require__(77);
  4595. /*global toString:true*/
  4596. // utils is a library of generic helper functions non-specific to axios
  4597. var toString = Object.prototype.toString;
  4598. /**
  4599. * Determine if a value is an Array
  4600. *
  4601. * @param {Object} val The value to test
  4602. * @returns {boolean} True if value is an Array, otherwise false
  4603. */
  4604. function isArray(val) {
  4605. return toString.call(val) === '[object Array]';
  4606. }
  4607. /**
  4608. * Determine if a value is an ArrayBuffer
  4609. *
  4610. * @param {Object} val The value to test
  4611. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  4612. */
  4613. function isArrayBuffer(val) {
  4614. return toString.call(val) === '[object ArrayBuffer]';
  4615. }
  4616. /**
  4617. * Determine if a value is a FormData
  4618. *
  4619. * @param {Object} val The value to test
  4620. * @returns {boolean} True if value is an FormData, otherwise false
  4621. */
  4622. function isFormData(val) {
  4623. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  4624. }
  4625. /**
  4626. * Determine if a value is a view on an ArrayBuffer
  4627. *
  4628. * @param {Object} val The value to test
  4629. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  4630. */
  4631. function isArrayBufferView(val) {
  4632. var result;
  4633. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  4634. result = ArrayBuffer.isView(val);
  4635. } else {
  4636. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  4637. }
  4638. return result;
  4639. }
  4640. /**
  4641. * Determine if a value is a String
  4642. *
  4643. * @param {Object} val The value to test
  4644. * @returns {boolean} True if value is a String, otherwise false
  4645. */
  4646. function isString(val) {
  4647. return typeof val === 'string';
  4648. }
  4649. /**
  4650. * Determine if a value is a Number
  4651. *
  4652. * @param {Object} val The value to test
  4653. * @returns {boolean} True if value is a Number, otherwise false
  4654. */
  4655. function isNumber(val) {
  4656. return typeof val === 'number';
  4657. }
  4658. /**
  4659. * Determine if a value is undefined
  4660. *
  4661. * @param {Object} val The value to test
  4662. * @returns {boolean} True if the value is undefined, otherwise false
  4663. */
  4664. function isUndefined(val) {
  4665. return typeof val === 'undefined';
  4666. }
  4667. /**
  4668. * Determine if a value is an Object
  4669. *
  4670. * @param {Object} val The value to test
  4671. * @returns {boolean} True if value is an Object, otherwise false
  4672. */
  4673. function isObject(val) {
  4674. return val !== null && typeof val === 'object';
  4675. }
  4676. /**
  4677. * Determine if a value is a Date
  4678. *
  4679. * @param {Object} val The value to test
  4680. * @returns {boolean} True if value is a Date, otherwise false
  4681. */
  4682. function isDate(val) {
  4683. return toString.call(val) === '[object Date]';
  4684. }
  4685. /**
  4686. * Determine if a value is a File
  4687. *
  4688. * @param {Object} val The value to test
  4689. * @returns {boolean} True if value is a File, otherwise false
  4690. */
  4691. function isFile(val) {
  4692. return toString.call(val) === '[object File]';
  4693. }
  4694. /**
  4695. * Determine if a value is a Blob
  4696. *
  4697. * @param {Object} val The value to test
  4698. * @returns {boolean} True if value is a Blob, otherwise false
  4699. */
  4700. function isBlob(val) {
  4701. return toString.call(val) === '[object Blob]';
  4702. }
  4703. /**
  4704. * Determine if a value is a Function
  4705. *
  4706. * @param {Object} val The value to test
  4707. * @returns {boolean} True if value is a Function, otherwise false
  4708. */
  4709. function isFunction(val) {
  4710. return toString.call(val) === '[object Function]';
  4711. }
  4712. /**
  4713. * Determine if a value is a Stream
  4714. *
  4715. * @param {Object} val The value to test
  4716. * @returns {boolean} True if value is a Stream, otherwise false
  4717. */
  4718. function isStream(val) {
  4719. return isObject(val) && isFunction(val.pipe);
  4720. }
  4721. /**
  4722. * Determine if a value is a URLSearchParams object
  4723. *
  4724. * @param {Object} val The value to test
  4725. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  4726. */
  4727. function isURLSearchParams(val) {
  4728. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  4729. }
  4730. /**
  4731. * Trim excess whitespace off the beginning and end of a string
  4732. *
  4733. * @param {String} str The String to trim
  4734. * @returns {String} The String freed of excess whitespace
  4735. */
  4736. function trim(str) {
  4737. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  4738. }
  4739. /**
  4740. * Determine if we're running in a standard browser environment
  4741. *
  4742. * This allows axios to run in a web worker, and react-native.
  4743. * Both environments support XMLHttpRequest, but not fully standard globals.
  4744. *
  4745. * web workers:
  4746. * typeof window -> undefined
  4747. * typeof document -> undefined
  4748. *
  4749. * react-native:
  4750. * typeof document.createElement -> undefined
  4751. */
  4752. function isStandardBrowserEnv() {
  4753. return (
  4754. typeof window !== 'undefined' &&
  4755. typeof document !== 'undefined' &&
  4756. typeof document.createElement === 'function'
  4757. );
  4758. }
  4759. /**
  4760. * Iterate over an Array or an Object invoking a function for each item.
  4761. *
  4762. * If `obj` is an Array callback will be called passing
  4763. * the value, index, and complete array for each item.
  4764. *
  4765. * If 'obj' is an Object callback will be called passing
  4766. * the value, key, and complete object for each property.
  4767. *
  4768. * @param {Object|Array} obj The object to iterate
  4769. * @param {Function} fn The callback to invoke for each item
  4770. */
  4771. function forEach(obj, fn) {
  4772. // Don't bother if no value provided
  4773. if (obj === null || typeof obj === 'undefined') {
  4774. return;
  4775. }
  4776. // Force an array if not already something iterable
  4777. if (typeof obj !== 'object' && !isArray(obj)) {
  4778. /*eslint no-param-reassign:0*/
  4779. obj = [obj];
  4780. }
  4781. if (isArray(obj)) {
  4782. // Iterate over array values
  4783. for (var i = 0, l = obj.length; i < l; i++) {
  4784. fn.call(null, obj[i], i, obj);
  4785. }
  4786. } else {
  4787. // Iterate over object keys
  4788. for (var key in obj) {
  4789. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  4790. fn.call(null, obj[key], key, obj);
  4791. }
  4792. }
  4793. }
  4794. }
  4795. /**
  4796. * Accepts varargs expecting each argument to be an object, then
  4797. * immutably merges the properties of each object and returns result.
  4798. *
  4799. * When multiple objects contain the same key the later object in
  4800. * the arguments list will take precedence.
  4801. *
  4802. * Example:
  4803. *
  4804. * ```js
  4805. * var result = merge({foo: 123}, {foo: 456});
  4806. * console.log(result.foo); // outputs 456
  4807. * ```
  4808. *
  4809. * @param {Object} obj1 Object to merge
  4810. * @returns {Object} Result of all merge properties
  4811. */
  4812. function merge(/* obj1, obj2, obj3, ... */) {
  4813. var result = {};
  4814. function assignValue(val, key) {
  4815. if (typeof result[key] === 'object' && typeof val === 'object') {
  4816. result[key] = merge(result[key], val);
  4817. } else {
  4818. result[key] = val;
  4819. }
  4820. }
  4821. for (var i = 0, l = arguments.length; i < l; i++) {
  4822. forEach(arguments[i], assignValue);
  4823. }
  4824. return result;
  4825. }
  4826. /**
  4827. * Extends object a by mutably adding to it the properties of object b.
  4828. *
  4829. * @param {Object} a The object to be extended
  4830. * @param {Object} b The object to copy properties from
  4831. * @param {Object} thisArg The object to bind function to
  4832. * @return {Object} The resulting value of object a
  4833. */
  4834. function extend(a, b, thisArg) {
  4835. forEach(b, function assignValue(val, key) {
  4836. if (thisArg && typeof val === 'function') {
  4837. a[key] = bind(val, thisArg);
  4838. } else {
  4839. a[key] = val;
  4840. }
  4841. });
  4842. return a;
  4843. }
  4844. module.exports = {
  4845. isArray: isArray,
  4846. isArrayBuffer: isArrayBuffer,
  4847. isFormData: isFormData,
  4848. isArrayBufferView: isArrayBufferView,
  4849. isString: isString,
  4850. isNumber: isNumber,
  4851. isObject: isObject,
  4852. isUndefined: isUndefined,
  4853. isDate: isDate,
  4854. isFile: isFile,
  4855. isBlob: isBlob,
  4856. isFunction: isFunction,
  4857. isStream: isStream,
  4858. isURLSearchParams: isURLSearchParams,
  4859. isStandardBrowserEnv: isStandardBrowserEnv,
  4860. forEach: forEach,
  4861. merge: merge,
  4862. extend: extend,
  4863. trim: trim
  4864. };
  4865. /***/ },
  4866. /* 5 */
  4867. /***/ function(module, exports, __webpack_require__) {
  4868. var store = __webpack_require__(99)('wks')
  4869. , uid = __webpack_require__(103)
  4870. , Symbol = __webpack_require__(6).Symbol
  4871. , USE_SYMBOL = typeof Symbol == 'function';
  4872. var $exports = module.exports = function(name){
  4873. return store[name] || (store[name] =
  4874. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  4875. };
  4876. $exports.store = store;
  4877. /***/ },
  4878. /* 6 */
  4879. /***/ function(module, exports) {
  4880. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  4881. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  4882. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  4883. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  4884. /***/ },
  4885. /* 7 */
  4886. /***/ function(module, exports) {
  4887. // shim for using process in browser
  4888. var process = module.exports = {};
  4889. // cached from whatever global is present so that test runners that stub it
  4890. // don't break things. But we need to wrap it in a try catch in case it is
  4891. // wrapped in strict mode code which doesn't define any globals. It's inside a
  4892. // function because try/catches deoptimize in certain engines.
  4893. var cachedSetTimeout;
  4894. var cachedClearTimeout;
  4895. function defaultSetTimout() {
  4896. throw new Error('setTimeout has not been defined');
  4897. }
  4898. function defaultClearTimeout () {
  4899. throw new Error('clearTimeout has not been defined');
  4900. }
  4901. (function () {
  4902. try {
  4903. if (typeof setTimeout === 'function') {
  4904. cachedSetTimeout = setTimeout;
  4905. } else {
  4906. cachedSetTimeout = defaultSetTimout;
  4907. }
  4908. } catch (e) {
  4909. cachedSetTimeout = defaultSetTimout;
  4910. }
  4911. try {
  4912. if (typeof clearTimeout === 'function') {
  4913. cachedClearTimeout = clearTimeout;
  4914. } else {
  4915. cachedClearTimeout = defaultClearTimeout;
  4916. }
  4917. } catch (e) {
  4918. cachedClearTimeout = defaultClearTimeout;
  4919. }
  4920. } ())
  4921. function runTimeout(fun) {
  4922. if (cachedSetTimeout === setTimeout) {
  4923. //normal enviroments in sane situations
  4924. return setTimeout(fun, 0);
  4925. }
  4926. // if setTimeout wasn't available but was latter defined
  4927. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  4928. cachedSetTimeout = setTimeout;
  4929. return setTimeout(fun, 0);
  4930. }
  4931. try {
  4932. // when when somebody has screwed with setTimeout but no I.E. maddness
  4933. return cachedSetTimeout(fun, 0);
  4934. } catch(e){
  4935. try {
  4936. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4937. return cachedSetTimeout.call(null, fun, 0);
  4938. } catch(e){
  4939. // 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
  4940. return cachedSetTimeout.call(this, fun, 0);
  4941. }
  4942. }
  4943. }
  4944. function runClearTimeout(marker) {
  4945. if (cachedClearTimeout === clearTimeout) {
  4946. //normal enviroments in sane situations
  4947. return clearTimeout(marker);
  4948. }
  4949. // if clearTimeout wasn't available but was latter defined
  4950. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  4951. cachedClearTimeout = clearTimeout;
  4952. return clearTimeout(marker);
  4953. }
  4954. try {
  4955. // when when somebody has screwed with setTimeout but no I.E. maddness
  4956. return cachedClearTimeout(marker);
  4957. } catch (e){
  4958. try {
  4959. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4960. return cachedClearTimeout.call(null, marker);
  4961. } catch (e){
  4962. // 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.
  4963. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  4964. return cachedClearTimeout.call(this, marker);
  4965. }
  4966. }
  4967. }
  4968. var queue = [];
  4969. var draining = false;
  4970. var currentQueue;
  4971. var queueIndex = -1;
  4972. function cleanUpNextTick() {
  4973. if (!draining || !currentQueue) {
  4974. return;
  4975. }
  4976. draining = false;
  4977. if (currentQueue.length) {
  4978. queue = currentQueue.concat(queue);
  4979. } else {
  4980. queueIndex = -1;
  4981. }
  4982. if (queue.length) {
  4983. drainQueue();
  4984. }
  4985. }
  4986. function drainQueue() {
  4987. if (draining) {
  4988. return;
  4989. }
  4990. var timeout = runTimeout(cleanUpNextTick);
  4991. draining = true;
  4992. var len = queue.length;
  4993. while(len) {
  4994. currentQueue = queue;
  4995. queue = [];
  4996. while (++queueIndex < len) {
  4997. if (currentQueue) {
  4998. currentQueue[queueIndex].run();
  4999. }
  5000. }
  5001. queueIndex = -1;
  5002. len = queue.length;
  5003. }
  5004. currentQueue = null;
  5005. draining = false;
  5006. runClearTimeout(timeout);
  5007. }
  5008. process.nextTick = function (fun) {
  5009. var args = new Array(arguments.length - 1);
  5010. if (arguments.length > 1) {
  5011. for (var i = 1; i < arguments.length; i++) {
  5012. args[i - 1] = arguments[i];
  5013. }
  5014. }
  5015. queue.push(new Item(fun, args));
  5016. if (queue.length === 1 && !draining) {
  5017. runTimeout(drainQueue);
  5018. }
  5019. };
  5020. // v8 likes predictible objects
  5021. function Item(fun, array) {
  5022. this.fun = fun;
  5023. this.array = array;
  5024. }
  5025. Item.prototype.run = function () {
  5026. this.fun.apply(null, this.array);
  5027. };
  5028. process.title = 'browser';
  5029. process.browser = true;
  5030. process.env = {};
  5031. process.argv = [];
  5032. process.version = ''; // empty string to avoid regexp issues
  5033. process.versions = {};
  5034. function noop() {}
  5035. process.on = noop;
  5036. process.addListener = noop;
  5037. process.once = noop;
  5038. process.off = noop;
  5039. process.removeListener = noop;
  5040. process.removeAllListeners = noop;
  5041. process.emit = noop;
  5042. process.binding = function (name) {
  5043. throw new Error('process.binding is not supported');
  5044. };
  5045. process.cwd = function () { return '/' };
  5046. process.chdir = function (dir) {
  5047. throw new Error('process.chdir is not supported');
  5048. };
  5049. process.umask = function() { return 0; };
  5050. /***/ },
  5051. /* 8 */
  5052. /***/ function(module, exports) {
  5053. var core = module.exports = {version: '2.4.0'};
  5054. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  5055. /***/ },
  5056. /* 9 */
  5057. /***/ function(module, exports, __webpack_require__) {
  5058. var hash = exports;
  5059. hash.utils = __webpack_require__(252);
  5060. hash.common = __webpack_require__(248);
  5061. hash.sha = __webpack_require__(251);
  5062. hash.ripemd = __webpack_require__(250);
  5063. hash.hmac = __webpack_require__(249);
  5064. // Proxy hash functions to the main object
  5065. hash.sha1 = hash.sha.sha1;
  5066. hash.sha256 = hash.sha.sha256;
  5067. hash.sha224 = hash.sha.sha224;
  5068. hash.sha384 = hash.sha.sha384;
  5069. hash.sha512 = hash.sha.sha512;
  5070. hash.ripemd160 = hash.ripemd.ripemd160;
  5071. /***/ },
  5072. /* 10 */
  5073. /***/ function(module, exports, __webpack_require__) {
  5074. "use strict";
  5075. // a duplex stream is just a stream that is both readable and writable.
  5076. // Since JS doesn't have multiple prototypal inheritance, this class
  5077. // prototypally inherits from Readable, and then parasitically from
  5078. // Writable.
  5079. 'use strict';
  5080. /*<replacement>*/
  5081. var objectKeys = Object.keys || function (obj) {
  5082. var keys = [];
  5083. for (var key in obj) {
  5084. keys.push(key);
  5085. }return keys;
  5086. };
  5087. /*</replacement>*/
  5088. module.exports = Duplex;
  5089. /*<replacement>*/
  5090. var processNextTick = __webpack_require__(62);
  5091. /*</replacement>*/
  5092. /*<replacement>*/
  5093. var util = __webpack_require__(29);
  5094. util.inherits = __webpack_require__(1);
  5095. /*</replacement>*/
  5096. var Readable = __webpack_require__(115);
  5097. var Writable = __webpack_require__(64);
  5098. util.inherits(Duplex, Readable);
  5099. var keys = objectKeys(Writable.prototype);
  5100. for (var v = 0; v < keys.length; v++) {
  5101. var method = keys[v];
  5102. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  5103. }
  5104. function Duplex(options) {
  5105. if (!(this instanceof Duplex)) return new Duplex(options);
  5106. Readable.call(this, options);
  5107. Writable.call(this, options);
  5108. if (options && options.readable === false) this.readable = false;
  5109. if (options && options.writable === false) this.writable = false;
  5110. this.allowHalfOpen = true;
  5111. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  5112. this.once('end', onend);
  5113. }
  5114. // the no-half-open enforcer
  5115. function onend() {
  5116. // if we allow half-open state, or if the writable side ended,
  5117. // then we're ok.
  5118. if (this.allowHalfOpen || this._writableState.ended) return;
  5119. // no more data can be written.
  5120. // But allow more writes to happen in this tick.
  5121. processNextTick(onEndNT, this);
  5122. }
  5123. function onEndNT(self) {
  5124. self.end();
  5125. }
  5126. function forEach(xs, f) {
  5127. for (var i = 0, l = xs.length; i < l; i++) {
  5128. f(xs[i], i);
  5129. }
  5130. }
  5131. /***/ },
  5132. /* 11 */
  5133. /***/ function(module, exports, __webpack_require__) {
  5134. /**
  5135. * vuex v2.0.0
  5136. * (c) 2016 Evan You
  5137. * @license MIT
  5138. */
  5139. (function (global, factory) {
  5140. true ? module.exports = factory() :
  5141. typeof define === 'function' && define.amd ? define(factory) :
  5142. (global.Vuex = factory());
  5143. }(this, (function () { 'use strict';
  5144. var devtoolHook =
  5145. typeof window !== 'undefined' &&
  5146. window.__VUE_DEVTOOLS_GLOBAL_HOOK__
  5147. function devtoolPlugin (store) {
  5148. if (!devtoolHook) { return }
  5149. store._devtoolHook = devtoolHook
  5150. devtoolHook.emit('vuex:init', store)
  5151. devtoolHook.on('vuex:travel-to-state', function (targetState) {
  5152. store.replaceState(targetState)
  5153. })
  5154. store.subscribe(function (mutation, state) {
  5155. devtoolHook.emit('vuex:mutation', mutation, state)
  5156. })
  5157. }
  5158. function applyMixin (Vue) {
  5159. var version = Number(Vue.version.split('.')[0])
  5160. if (version >= 2) {
  5161. var usesInit = Vue.config._lifecycleHooks.indexOf('init') > -1
  5162. Vue.mixin(usesInit ? { init: vuexInit } : { beforeCreate: vuexInit })
  5163. } else {
  5164. // override init and inject vuex init procedure
  5165. // for 1.x backwards compatibility.
  5166. var _init = Vue.prototype._init
  5167. Vue.prototype._init = function (options) {
  5168. if ( options === void 0 ) options = {};
  5169. options.init = options.init
  5170. ? [vuexInit].concat(options.init)
  5171. : vuexInit
  5172. _init.call(this, options)
  5173. }
  5174. }
  5175. /**
  5176. * Vuex init hook, injected into each instances init hooks list.
  5177. */
  5178. function vuexInit () {
  5179. var options = this.$options
  5180. // store injection
  5181. if (options.store) {
  5182. this.$store = options.store
  5183. } else if (options.parent && options.parent.$store) {
  5184. this.$store = options.parent.$store
  5185. }
  5186. }
  5187. }
  5188. function mapState (states) {
  5189. var res = {}
  5190. normalizeMap(states).forEach(function (ref) {
  5191. var key = ref.key;
  5192. var val = ref.val;
  5193. res[key] = function mappedState () {
  5194. return typeof val === 'function'
  5195. ? val.call(this, this.$store.state, this.$store.getters)
  5196. : this.$store.state[val]
  5197. }
  5198. })
  5199. return res
  5200. }
  5201. function mapMutations (mutations) {
  5202. var res = {}
  5203. normalizeMap(mutations).forEach(function (ref) {
  5204. var key = ref.key;
  5205. var val = ref.val;
  5206. res[key] = function mappedMutation () {
  5207. var args = [], len = arguments.length;
  5208. while ( len-- ) args[ len ] = arguments[ len ];
  5209. return this.$store.commit.apply(this.$store, [val].concat(args))
  5210. }
  5211. })
  5212. return res
  5213. }
  5214. function mapGetters (getters) {
  5215. var res = {}
  5216. normalizeMap(getters).forEach(function (ref) {
  5217. var key = ref.key;
  5218. var val = ref.val;
  5219. res[key] = function mappedGetter () {
  5220. if (!(val in this.$store.getters)) {
  5221. console.error(("[vuex] unknown getter: " + val))
  5222. }
  5223. return this.$store.getters[val]
  5224. }
  5225. })
  5226. return res
  5227. }
  5228. function mapActions (actions) {
  5229. var res = {}
  5230. normalizeMap(actions).forEach(function (ref) {
  5231. var key = ref.key;
  5232. var val = ref.val;
  5233. res[key] = function mappedAction () {
  5234. var args = [], len = arguments.length;
  5235. while ( len-- ) args[ len ] = arguments[ len ];
  5236. return this.$store.dispatch.apply(this.$store, [val].concat(args))
  5237. }
  5238. })
  5239. return res
  5240. }
  5241. function normalizeMap (map) {
  5242. return Array.isArray(map)
  5243. ? map.map(function (key) { return ({ key: key, val: key }); })
  5244. : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
  5245. }
  5246. function isObject (obj) {
  5247. return obj !== null && typeof obj === 'object'
  5248. }
  5249. function isPromise (val) {
  5250. return val && typeof val.then === 'function'
  5251. }
  5252. function assert (condition, msg) {
  5253. if (!condition) { throw new Error(("[vuex] " + msg)) }
  5254. }
  5255. var Vue // bind on install
  5256. var Store = function Store (options) {
  5257. var this$1 = this;
  5258. if ( options === void 0 ) options = {};
  5259. assert(Vue, "must call Vue.use(Vuex) before creating a store instance.")
  5260. assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.")
  5261. var state = options.state; if ( state === void 0 ) state = {};
  5262. var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
  5263. var strict = options.strict; if ( strict === void 0 ) strict = false;
  5264. // store internal state
  5265. this._options = options
  5266. this._committing = false
  5267. this._actions = Object.create(null)
  5268. this._mutations = Object.create(null)
  5269. this._wrappedGetters = Object.create(null)
  5270. this._runtimeModules = Object.create(null)
  5271. this._subscribers = []
  5272. this._watcherVM = new Vue()
  5273. // bind commit and dispatch to self
  5274. var store = this
  5275. var ref = this;
  5276. var dispatch = ref.dispatch;
  5277. var commit = ref.commit;
  5278. this.dispatch = function boundDispatch (type, payload) {
  5279. return dispatch.call(store, type, payload)
  5280. }
  5281. this.commit = function boundCommit (type, payload, options) {
  5282. return commit.call(store, type, payload, options)
  5283. }
  5284. // strict mode
  5285. this.strict = strict
  5286. // init root module.
  5287. // this also recursively registers all sub-modules
  5288. // and collects all module getters inside this._wrappedGetters
  5289. installModule(this, state, [], options)
  5290. // initialize the store vm, which is responsible for the reactivity
  5291. // (also registers _wrappedGetters as computed properties)
  5292. resetStoreVM(this, state)
  5293. // apply plugins
  5294. plugins.concat(devtoolPlugin).forEach(function (plugin) { return plugin(this$1); })
  5295. };
  5296. var prototypeAccessors = { state: {} };
  5297. prototypeAccessors.state.get = function () {
  5298. return this._vm.state
  5299. };
  5300. prototypeAccessors.state.set = function (v) {
  5301. assert(false, "Use store.replaceState() to explicit replace store state.")
  5302. };
  5303. Store.prototype.commit = function commit (type, payload, options) {
  5304. var this$1 = this;
  5305. // check object-style commit
  5306. if (isObject(type) && type.type) {
  5307. options = payload
  5308. payload = type
  5309. type = type.type
  5310. }
  5311. var mutation = { type: type, payload: payload }
  5312. var entry = this._mutations[type]
  5313. if (!entry) {
  5314. console.error(("[vuex] unknown mutation type: " + type))
  5315. return
  5316. }
  5317. this._withCommit(function () {
  5318. entry.forEach(function commitIterator (handler) {
  5319. handler(payload)
  5320. })
  5321. })
  5322. if (!options || !options.silent) {
  5323. this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); })
  5324. }
  5325. };
  5326. Store.prototype.dispatch = function dispatch (type, payload) {
  5327. // check object-style dispatch
  5328. if (isObject(type) && type.type) {
  5329. payload = type
  5330. type = type.type
  5331. }
  5332. var entry = this._actions[type]
  5333. if (!entry) {
  5334. console.error(("[vuex] unknown action type: " + type))
  5335. return
  5336. }
  5337. return entry.length > 1
  5338. ? Promise.all(entry.map(function (handler) { return handler(payload); }))
  5339. : entry[0](payload)
  5340. };
  5341. Store.prototype.subscribe = function subscribe (fn) {
  5342. var subs = this._subscribers
  5343. if (subs.indexOf(fn) < 0) {
  5344. subs.push(fn)
  5345. }
  5346. return function () {
  5347. var i = subs.indexOf(fn)
  5348. if (i > -1) {
  5349. subs.splice(i, 1)
  5350. }
  5351. }
  5352. };
  5353. Store.prototype.watch = function watch (getter, cb, options) {
  5354. var this$1 = this;
  5355. assert(typeof getter === 'function', "store.watch only accepts a function.")
  5356. return this._watcherVM.$watch(function () { return getter(this$1.state); }, cb, options)
  5357. };
  5358. Store.prototype.replaceState = function replaceState (state) {
  5359. var this$1 = this;
  5360. this._withCommit(function () {
  5361. this$1._vm.state = state
  5362. })
  5363. };
  5364. Store.prototype.registerModule = function registerModule (path, module) {
  5365. if (typeof path === 'string') { path = [path] }
  5366. assert(Array.isArray(path), "module path must be a string or an Array.")
  5367. this._runtimeModules[path.join('.')] = module
  5368. installModule(this, this.state, path, module)
  5369. // reset store to update getters...
  5370. resetStoreVM(this, this.state)
  5371. };
  5372. Store.prototype.unregisterModule = function unregisterModule (path) {
  5373. var this$1 = this;
  5374. if (typeof path === 'string') { path = [path] }
  5375. assert(Array.isArray(path), "module path must be a string or an Array.")
  5376. delete this._runtimeModules[path.join('.')]
  5377. this._withCommit(function () {
  5378. var parentState = getNestedState(this$1.state, path.slice(0, -1))
  5379. Vue.delete(parentState, path[path.length - 1])
  5380. })
  5381. resetStore(this)
  5382. };
  5383. Store.prototype.hotUpdate = function hotUpdate (newOptions) {
  5384. updateModule(this._options, newOptions)
  5385. resetStore(this)
  5386. };
  5387. Store.prototype._withCommit = function _withCommit (fn) {
  5388. var committing = this._committing
  5389. this._committing = true
  5390. fn()
  5391. this._committing = committing
  5392. };
  5393. Object.defineProperties( Store.prototype, prototypeAccessors );
  5394. function updateModule (targetModule, newModule) {
  5395. if (newModule.actions) {
  5396. targetModule.actions = newModule.actions
  5397. }
  5398. if (newModule.mutations) {
  5399. targetModule.mutations = newModule.mutations
  5400. }
  5401. if (newModule.getters) {
  5402. targetModule.getters = newModule.getters
  5403. }
  5404. if (newModule.modules) {
  5405. for (var key in newModule.modules) {
  5406. if (!(targetModule.modules && targetModule.modules[key])) {
  5407. console.warn(
  5408. "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
  5409. 'manual reload is needed'
  5410. )
  5411. return
  5412. }
  5413. updateModule(targetModule.modules[key], newModule.modules[key])
  5414. }
  5415. }
  5416. }
  5417. function resetStore (store) {
  5418. store._actions = Object.create(null)
  5419. store._mutations = Object.create(null)
  5420. store._wrappedGetters = Object.create(null)
  5421. var state = store.state
  5422. // init root module
  5423. installModule(store, state, [], store._options, true)
  5424. // init all runtime modules
  5425. Object.keys(store._runtimeModules).forEach(function (key) {
  5426. installModule(store, state, key.split('.'), store._runtimeModules[key], true)
  5427. })
  5428. // reset vm
  5429. resetStoreVM(store, state)
  5430. }
  5431. function resetStoreVM (store, state) {
  5432. var oldVm = store._vm
  5433. // bind store public getters
  5434. store.getters = {}
  5435. var wrappedGetters = store._wrappedGetters
  5436. var computed = {}
  5437. Object.keys(wrappedGetters).forEach(function (key) {
  5438. var fn = wrappedGetters[key]
  5439. // use computed to leverage its lazy-caching mechanism
  5440. computed[key] = function () { return fn(store); }
  5441. Object.defineProperty(store.getters, key, {
  5442. get: function () { return store._vm[key]; }
  5443. })
  5444. })
  5445. // use a Vue instance to store the state tree
  5446. // suppress warnings just in case the user has added
  5447. // some funky global mixins
  5448. var silent = Vue.config.silent
  5449. Vue.config.silent = true
  5450. store._vm = new Vue({
  5451. data: { state: state },
  5452. computed: computed
  5453. })
  5454. Vue.config.silent = silent
  5455. // enable strict mode for new vm
  5456. if (store.strict) {
  5457. enableStrictMode(store)
  5458. }
  5459. if (oldVm) {
  5460. // dispatch changes in all subscribed watchers
  5461. // to force getter re-evaluation.
  5462. store._withCommit(function () {
  5463. oldVm.state = null
  5464. })
  5465. Vue.nextTick(function () { return oldVm.$destroy(); })
  5466. }
  5467. }
  5468. function installModule (store, rootState, path, module, hot) {
  5469. var isRoot = !path.length
  5470. var state = module.state;
  5471. var actions = module.actions;
  5472. var mutations = module.mutations;
  5473. var getters = module.getters;
  5474. var modules = module.modules;
  5475. // set state
  5476. if (!isRoot && !hot) {
  5477. var parentState = getNestedState(rootState, path.slice(0, -1))
  5478. var moduleName = path[path.length - 1]
  5479. store._withCommit(function () {
  5480. Vue.set(parentState, moduleName, state || {})
  5481. })
  5482. }
  5483. if (mutations) {
  5484. Object.keys(mutations).forEach(function (key) {
  5485. registerMutation(store, key, mutations[key], path)
  5486. })
  5487. }
  5488. if (actions) {
  5489. Object.keys(actions).forEach(function (key) {
  5490. registerAction(store, key, actions[key], path)
  5491. })
  5492. }
  5493. if (getters) {
  5494. wrapGetters(store, getters, path)
  5495. }
  5496. if (modules) {
  5497. Object.keys(modules).forEach(function (key) {
  5498. installModule(store, rootState, path.concat(key), modules[key], hot)
  5499. })
  5500. }
  5501. }
  5502. function registerMutation (store, type, handler, path) {
  5503. if ( path === void 0 ) path = [];
  5504. var entry = store._mutations[type] || (store._mutations[type] = [])
  5505. entry.push(function wrappedMutationHandler (payload) {
  5506. handler(getNestedState(store.state, path), payload)
  5507. })
  5508. }
  5509. function registerAction (store, type, handler, path) {
  5510. if ( path === void 0 ) path = [];
  5511. var entry = store._actions[type] || (store._actions[type] = [])
  5512. var dispatch = store.dispatch;
  5513. var commit = store.commit;
  5514. entry.push(function wrappedActionHandler (payload, cb) {
  5515. var res = handler({
  5516. dispatch: dispatch,
  5517. commit: commit,
  5518. getters: store.getters,
  5519. state: getNestedState(store.state, path),
  5520. rootState: store.state
  5521. }, payload, cb)
  5522. if (!isPromise(res)) {
  5523. res = Promise.resolve(res)
  5524. }
  5525. if (store._devtoolHook) {
  5526. return res.catch(function (err) {
  5527. store._devtoolHook.emit('vuex:error', err)
  5528. throw err
  5529. })
  5530. } else {
  5531. return res
  5532. }
  5533. })
  5534. }
  5535. function wrapGetters (store, moduleGetters, modulePath) {
  5536. Object.keys(moduleGetters).forEach(function (getterKey) {
  5537. var rawGetter = moduleGetters[getterKey]
  5538. if (store._wrappedGetters[getterKey]) {
  5539. console.error(("[vuex] duplicate getter key: " + getterKey))
  5540. return
  5541. }
  5542. store._wrappedGetters[getterKey] = function wrappedGetter (store) {
  5543. return rawGetter(
  5544. getNestedState(store.state, modulePath), // local state
  5545. store.getters, // getters
  5546. store.state // root state
  5547. )
  5548. }
  5549. })
  5550. }
  5551. function enableStrictMode (store) {
  5552. store._vm.$watch('state', function () {
  5553. assert(store._committing, "Do not mutate vuex store state outside mutation handlers.")
  5554. }, { deep: true, sync: true })
  5555. }
  5556. function getNestedState (state, path) {
  5557. return path.length
  5558. ? path.reduce(function (state, key) { return state[key]; }, state)
  5559. : state
  5560. }
  5561. function install (_Vue) {
  5562. if (Vue) {
  5563. console.error(
  5564. '[vuex] already installed. Vue.use(Vuex) should be called only once.'
  5565. )
  5566. return
  5567. }
  5568. Vue = _Vue
  5569. applyMixin(Vue)
  5570. }
  5571. // auto install in dist mode
  5572. if (typeof window !== 'undefined' && window.Vue) {
  5573. install(window.Vue)
  5574. }
  5575. var index = {
  5576. Store: Store,
  5577. install: install,
  5578. mapState: mapState,
  5579. mapMutations: mapMutations,
  5580. mapGetters: mapGetters,
  5581. mapActions: mapActions
  5582. }
  5583. return index;
  5584. })));
  5585. /***/ },
  5586. /* 12 */
  5587. /***/ function(module, exports, __webpack_require__) {
  5588. /* WEBPACK VAR INJECTION */(function(Buffer) {var Transform = __webpack_require__(19).Transform
  5589. var inherits = __webpack_require__(1)
  5590. var StringDecoder = __webpack_require__(65).StringDecoder
  5591. module.exports = CipherBase
  5592. inherits(CipherBase, Transform)
  5593. function CipherBase (hashMode) {
  5594. Transform.call(this)
  5595. this.hashMode = typeof hashMode === 'string'
  5596. if (this.hashMode) {
  5597. this[hashMode] = this._finalOrDigest
  5598. } else {
  5599. this.final = this._finalOrDigest
  5600. }
  5601. this._decoder = null
  5602. this._encoding = null
  5603. }
  5604. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  5605. if (typeof data === 'string') {
  5606. data = new Buffer(data, inputEnc)
  5607. }
  5608. var outData = this._update(data)
  5609. if (this.hashMode) {
  5610. return this
  5611. }
  5612. if (outputEnc) {
  5613. outData = this._toString(outData, outputEnc)
  5614. }
  5615. return outData
  5616. }
  5617. CipherBase.prototype.setAutoPadding = function () {}
  5618. CipherBase.prototype.getAuthTag = function () {
  5619. throw new Error('trying to get auth tag in unsupported state')
  5620. }
  5621. CipherBase.prototype.setAuthTag = function () {
  5622. throw new Error('trying to set auth tag in unsupported state')
  5623. }
  5624. CipherBase.prototype.setAAD = function () {
  5625. throw new Error('trying to set aad in unsupported state')
  5626. }
  5627. CipherBase.prototype._transform = function (data, _, next) {
  5628. var err
  5629. try {
  5630. if (this.hashMode) {
  5631. this._update(data)
  5632. } else {
  5633. this.push(this._update(data))
  5634. }
  5635. } catch (e) {
  5636. err = e
  5637. } finally {
  5638. next(err)
  5639. }
  5640. }
  5641. CipherBase.prototype._flush = function (done) {
  5642. var err
  5643. try {
  5644. this.push(this._final())
  5645. } catch (e) {
  5646. err = e
  5647. } finally {
  5648. done(err)
  5649. }
  5650. }
  5651. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  5652. var outData = this._final() || new Buffer('')
  5653. if (outputEnc) {
  5654. outData = this._toString(outData, outputEnc, true)
  5655. }
  5656. return outData
  5657. }
  5658. CipherBase.prototype._toString = function (value, enc, fin) {
  5659. if (!this._decoder) {
  5660. this._decoder = new StringDecoder(enc)
  5661. this._encoding = enc
  5662. }
  5663. if (this._encoding !== enc) {
  5664. throw new Error('can\'t switch encodings')
  5665. }
  5666. var out = this._decoder.write(value)
  5667. if (fin) {
  5668. out += this._decoder.end()
  5669. }
  5670. return out
  5671. }
  5672. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5673. /***/ },
  5674. /* 13 */
  5675. /***/ function(module, exports, __webpack_require__) {
  5676. var isObject = __webpack_require__(42);
  5677. module.exports = function(it){
  5678. if(!isObject(it))throw TypeError(it + ' is not an object!');
  5679. return it;
  5680. };
  5681. /***/ },
  5682. /* 14 */
  5683. /***/ function(module, exports, __webpack_require__) {
  5684. // Thank's IE8 for his funny defineProperty
  5685. module.exports = !__webpack_require__(55)(function(){
  5686. return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  5687. });
  5688. /***/ },
  5689. /* 15 */
  5690. /***/ function(module, exports, __webpack_require__) {
  5691. var dP = __webpack_require__(28)
  5692. , createDesc = __webpack_require__(98);
  5693. module.exports = __webpack_require__(14) ? function(object, key, value){
  5694. return dP.f(object, key, createDesc(1, value));
  5695. } : function(object, key, value){
  5696. object[key] = value;
  5697. return object;
  5698. };
  5699. /***/ },
  5700. /* 16 */
  5701. /***/ function(module, exports, __webpack_require__) {
  5702. "use strict";
  5703. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  5704. var inherits = __webpack_require__(1)
  5705. var md5 = __webpack_require__(104)
  5706. var rmd160 = __webpack_require__(274)
  5707. var sha = __webpack_require__(276)
  5708. var Base = __webpack_require__(12)
  5709. function HashNoConstructor(hash) {
  5710. Base.call(this, 'digest')
  5711. this._hash = hash
  5712. this.buffers = []
  5713. }
  5714. inherits(HashNoConstructor, Base)
  5715. HashNoConstructor.prototype._update = function (data) {
  5716. this.buffers.push(data)
  5717. }
  5718. HashNoConstructor.prototype._final = function () {
  5719. var buf = Buffer.concat(this.buffers)
  5720. var r = this._hash(buf)
  5721. this.buffers = null
  5722. return r
  5723. }
  5724. function Hash(hash) {
  5725. Base.call(this, 'digest')
  5726. this._hash = hash
  5727. }
  5728. inherits(Hash, Base)
  5729. Hash.prototype._update = function (data) {
  5730. this._hash.update(data)
  5731. }
  5732. Hash.prototype._final = function () {
  5733. return this._hash.digest()
  5734. }
  5735. module.exports = function createHash (alg) {
  5736. alg = alg.toLowerCase()
  5737. if ('md5' === alg) return new HashNoConstructor(md5)
  5738. if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160)
  5739. return new Hash(sha(alg))
  5740. }
  5741. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5742. /***/ },
  5743. /* 17 */
  5744. /***/ function(module, exports) {
  5745. /*
  5746. MIT License http://www.opensource.org/licenses/mit-license.php
  5747. Author Tobias Koppers @sokra
  5748. */
  5749. // css base code, injected by the css-loader
  5750. module.exports = function() {
  5751. var list = [];
  5752. // return the list of modules as css string
  5753. list.toString = function toString() {
  5754. var result = [];
  5755. for(var i = 0; i < this.length; i++) {
  5756. var item = this[i];
  5757. if(item[2]) {
  5758. result.push("@media " + item[2] + "{" + item[1] + "}");
  5759. } else {
  5760. result.push(item[1]);
  5761. }
  5762. }
  5763. return result.join("");
  5764. };
  5765. // import a list of modules into the list
  5766. list.i = function(modules, mediaQuery) {
  5767. if(typeof modules === "string")
  5768. modules = [[null, modules, ""]];
  5769. var alreadyImportedModules = {};
  5770. for(var i = 0; i < this.length; i++) {
  5771. var id = this[i][0];
  5772. if(typeof id === "number")
  5773. alreadyImportedModules[id] = true;
  5774. }
  5775. for(i = 0; i < modules.length; i++) {
  5776. var item = modules[i];
  5777. // skip already imported module
  5778. // this implementation is not 100% perfect for weird media query combinations
  5779. // when a module is imported multiple times with different media queries.
  5780. // I hope this will never occur (Hey this way we have smaller bundles)
  5781. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  5782. if(mediaQuery && !item[2]) {
  5783. item[2] = mediaQuery;
  5784. } else if(mediaQuery) {
  5785. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  5786. }
  5787. list.push(item);
  5788. }
  5789. }
  5790. };
  5791. return list;
  5792. };
  5793. /***/ },
  5794. /* 18 */
  5795. /***/ function(module, exports, __webpack_require__) {
  5796. /* WEBPACK VAR INJECTION */(function(Buffer) {// prototype class for hash functions
  5797. function Hash (blockSize, finalSize) {
  5798. this._block = new Buffer(blockSize)
  5799. this._finalSize = finalSize
  5800. this._blockSize = blockSize
  5801. this._len = 0
  5802. this._s = 0
  5803. }
  5804. Hash.prototype.update = function (data, enc) {
  5805. if (typeof data === 'string') {
  5806. enc = enc || 'utf8'
  5807. data = new Buffer(data, enc)
  5808. }
  5809. var l = this._len += data.length
  5810. var s = this._s || 0
  5811. var f = 0
  5812. var buffer = this._block
  5813. while (s < l) {
  5814. var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
  5815. var ch = (t - f)
  5816. for (var i = 0; i < ch; i++) {
  5817. buffer[(s % this._blockSize) + i] = data[i + f]
  5818. }
  5819. s += ch
  5820. f += ch
  5821. if ((s % this._blockSize) === 0) {
  5822. this._update(buffer)
  5823. }
  5824. }
  5825. this._s = s
  5826. return this
  5827. }
  5828. Hash.prototype.digest = function (enc) {
  5829. // Suppose the length of the message M, in bits, is l
  5830. var l = this._len * 8
  5831. // Append the bit 1 to the end of the message
  5832. this._block[this._len % this._blockSize] = 0x80
  5833. // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
  5834. this._block.fill(0, this._len % this._blockSize + 1)
  5835. if (l % (this._blockSize * 8) >= this._finalSize * 8) {
  5836. this._update(this._block)
  5837. this._block.fill(0)
  5838. }
  5839. // to this append the block which is equal to the number l written in binary
  5840. // TODO: handle case where l is > Math.pow(2, 29)
  5841. this._block.writeInt32BE(l, this._blockSize - 4)
  5842. var hash = this._update(this._block) || this._hash()
  5843. return enc ? hash.toString(enc) : hash
  5844. }
  5845. Hash.prototype._update = function () {
  5846. throw new Error('_update must be implemented by subclass')
  5847. }
  5848. module.exports = Hash
  5849. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5850. /***/ },
  5851. /* 19 */
  5852. /***/ function(module, exports, __webpack_require__) {
  5853. // Copyright Joyent, Inc. and other Node contributors.
  5854. //
  5855. // Permission is hereby granted, free of charge, to any person obtaining a
  5856. // copy of this software and associated documentation files (the
  5857. // "Software"), to deal in the Software without restriction, including
  5858. // without limitation the rights to use, copy, modify, merge, publish,
  5859. // distribute, sublicense, and/or sell copies of the Software, and to permit
  5860. // persons to whom the Software is furnished to do so, subject to the
  5861. // following conditions:
  5862. //
  5863. // The above copyright notice and this permission notice shall be included
  5864. // in all copies or substantial portions of the Software.
  5865. //
  5866. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  5867. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  5868. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  5869. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  5870. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  5871. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  5872. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  5873. module.exports = Stream;
  5874. var EE = __webpack_require__(44).EventEmitter;
  5875. var inherits = __webpack_require__(1);
  5876. inherits(Stream, EE);
  5877. Stream.Readable = __webpack_require__(271);
  5878. Stream.Writable = __webpack_require__(273);
  5879. Stream.Duplex = __webpack_require__(268);
  5880. Stream.Transform = __webpack_require__(272);
  5881. Stream.PassThrough = __webpack_require__(270);
  5882. // Backwards-compat with node 0.4.x
  5883. Stream.Stream = Stream;
  5884. // old-style streams. Note that the pipe method (the only relevant
  5885. // part of this class) is overridden in the Readable class.
  5886. function Stream() {
  5887. EE.call(this);
  5888. }
  5889. Stream.prototype.pipe = function(dest, options) {
  5890. var source = this;
  5891. function ondata(chunk) {
  5892. if (dest.writable) {
  5893. if (false === dest.write(chunk) && source.pause) {
  5894. source.pause();
  5895. }
  5896. }
  5897. }
  5898. source.on('data', ondata);
  5899. function ondrain() {
  5900. if (source.readable && source.resume) {
  5901. source.resume();
  5902. }
  5903. }
  5904. dest.on('drain', ondrain);
  5905. // If the 'end' option is not supplied, dest.end() will be called when
  5906. // source gets the 'end' or 'close' events. Only dest.end() once.
  5907. if (!dest._isStdio && (!options || options.end !== false)) {
  5908. source.on('end', onend);
  5909. source.on('close', onclose);
  5910. }
  5911. var didOnEnd = false;
  5912. function onend() {
  5913. if (didOnEnd) return;
  5914. didOnEnd = true;
  5915. dest.end();
  5916. }
  5917. function onclose() {
  5918. if (didOnEnd) return;
  5919. didOnEnd = true;
  5920. if (typeof dest.destroy === 'function') dest.destroy();
  5921. }
  5922. // don't leave dangling pipes when there are errors.
  5923. function onerror(er) {
  5924. cleanup();
  5925. if (EE.listenerCount(this, 'error') === 0) {
  5926. throw er; // Unhandled stream error in pipe.
  5927. }
  5928. }
  5929. source.on('error', onerror);
  5930. dest.on('error', onerror);
  5931. // remove all the event listeners that were added.
  5932. function cleanup() {
  5933. source.removeListener('data', ondata);
  5934. dest.removeListener('drain', ondrain);
  5935. source.removeListener('end', onend);
  5936. source.removeListener('close', onclose);
  5937. source.removeListener('error', onerror);
  5938. dest.removeListener('error', onerror);
  5939. source.removeListener('end', cleanup);
  5940. source.removeListener('close', cleanup);
  5941. dest.removeListener('close', cleanup);
  5942. }
  5943. source.on('end', cleanup);
  5944. source.on('close', cleanup);
  5945. dest.on('close', cleanup);
  5946. dest.emit('pipe', source);
  5947. // Allow for unix-like usage: A.pipe(B).pipe(C)
  5948. return dest;
  5949. };
  5950. /***/ },
  5951. /* 20 */
  5952. /***/ function(module, exports) {
  5953. /*
  5954. MIT License http://www.opensource.org/licenses/mit-license.php
  5955. Author Tobias Koppers @sokra
  5956. */
  5957. var stylesInDom = {},
  5958. memoize = function(fn) {
  5959. var memo;
  5960. return function () {
  5961. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  5962. return memo;
  5963. };
  5964. },
  5965. isOldIE = memoize(function() {
  5966. return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
  5967. }),
  5968. getHeadElement = memoize(function () {
  5969. return document.head || document.getElementsByTagName("head")[0];
  5970. }),
  5971. singletonElement = null,
  5972. singletonCounter = 0,
  5973. styleElementsInsertedAtTop = [];
  5974. module.exports = function(list, options) {
  5975. if(typeof DEBUG !== "undefined" && DEBUG) {
  5976. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  5977. }
  5978. options = options || {};
  5979. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  5980. // tags it will allow on a page
  5981. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  5982. // By default, add <style> tags to the bottom of <head>.
  5983. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  5984. var styles = listToStyles(list);
  5985. addStylesToDom(styles, options);
  5986. return function update(newList) {
  5987. var mayRemove = [];
  5988. for(var i = 0; i < styles.length; i++) {
  5989. var item = styles[i];
  5990. var domStyle = stylesInDom[item.id];
  5991. domStyle.refs--;
  5992. mayRemove.push(domStyle);
  5993. }
  5994. if(newList) {
  5995. var newStyles = listToStyles(newList);
  5996. addStylesToDom(newStyles, options);
  5997. }
  5998. for(var i = 0; i < mayRemove.length; i++) {
  5999. var domStyle = mayRemove[i];
  6000. if(domStyle.refs === 0) {
  6001. for(var j = 0; j < domStyle.parts.length; j++)
  6002. domStyle.parts[j]();
  6003. delete stylesInDom[domStyle.id];
  6004. }
  6005. }
  6006. };
  6007. }
  6008. function addStylesToDom(styles, options) {
  6009. for(var i = 0; i < styles.length; i++) {
  6010. var item = styles[i];
  6011. var domStyle = stylesInDom[item.id];
  6012. if(domStyle) {
  6013. domStyle.refs++;
  6014. for(var j = 0; j < domStyle.parts.length; j++) {
  6015. domStyle.parts[j](item.parts[j]);
  6016. }
  6017. for(; j < item.parts.length; j++) {
  6018. domStyle.parts.push(addStyle(item.parts[j], options));
  6019. }
  6020. } else {
  6021. var parts = [];
  6022. for(var j = 0; j < item.parts.length; j++) {
  6023. parts.push(addStyle(item.parts[j], options));
  6024. }
  6025. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  6026. }
  6027. }
  6028. }
  6029. function listToStyles(list) {
  6030. var styles = [];
  6031. var newStyles = {};
  6032. for(var i = 0; i < list.length; i++) {
  6033. var item = list[i];
  6034. var id = item[0];
  6035. var css = item[1];
  6036. var media = item[2];
  6037. var sourceMap = item[3];
  6038. var part = {css: css, media: media, sourceMap: sourceMap};
  6039. if(!newStyles[id])
  6040. styles.push(newStyles[id] = {id: id, parts: [part]});
  6041. else
  6042. newStyles[id].parts.push(part);
  6043. }
  6044. return styles;
  6045. }
  6046. function insertStyleElement(options, styleElement) {
  6047. var head = getHeadElement();
  6048. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  6049. if (options.insertAt === "top") {
  6050. if(!lastStyleElementInsertedAtTop) {
  6051. head.insertBefore(styleElement, head.firstChild);
  6052. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  6053. head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  6054. } else {
  6055. head.appendChild(styleElement);
  6056. }
  6057. styleElementsInsertedAtTop.push(styleElement);
  6058. } else if (options.insertAt === "bottom") {
  6059. head.appendChild(styleElement);
  6060. } else {
  6061. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  6062. }
  6063. }
  6064. function removeStyleElement(styleElement) {
  6065. styleElement.parentNode.removeChild(styleElement);
  6066. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  6067. if(idx >= 0) {
  6068. styleElementsInsertedAtTop.splice(idx, 1);
  6069. }
  6070. }
  6071. function createStyleElement(options) {
  6072. var styleElement = document.createElement("style");
  6073. styleElement.type = "text/css";
  6074. insertStyleElement(options, styleElement);
  6075. return styleElement;
  6076. }
  6077. function addStyle(obj, options) {
  6078. var styleElement, update, remove;
  6079. if (options.singleton) {
  6080. var styleIndex = singletonCounter++;
  6081. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  6082. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  6083. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  6084. } else {
  6085. styleElement = createStyleElement(options);
  6086. update = applyToTag.bind(null, styleElement);
  6087. remove = function() {
  6088. removeStyleElement(styleElement);
  6089. };
  6090. }
  6091. update(obj);
  6092. return function updateStyle(newObj) {
  6093. if(newObj) {
  6094. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  6095. return;
  6096. update(obj = newObj);
  6097. } else {
  6098. remove();
  6099. }
  6100. };
  6101. }
  6102. var replaceText = (function () {
  6103. var textStore = [];
  6104. return function (index, replacement) {
  6105. textStore[index] = replacement;
  6106. return textStore.filter(Boolean).join('\n');
  6107. };
  6108. })();
  6109. function applyToSingletonTag(styleElement, index, remove, obj) {
  6110. var css = remove ? "" : obj.css;
  6111. if (styleElement.styleSheet) {
  6112. styleElement.styleSheet.cssText = replaceText(index, css);
  6113. } else {
  6114. var cssNode = document.createTextNode(css);
  6115. var childNodes = styleElement.childNodes;
  6116. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  6117. if (childNodes.length) {
  6118. styleElement.insertBefore(cssNode, childNodes[index]);
  6119. } else {
  6120. styleElement.appendChild(cssNode);
  6121. }
  6122. }
  6123. }
  6124. function applyToTag(styleElement, obj) {
  6125. var css = obj.css;
  6126. var media = obj.media;
  6127. var sourceMap = obj.sourceMap;
  6128. if (media) {
  6129. styleElement.setAttribute("media", media);
  6130. }
  6131. if (sourceMap) {
  6132. // https://developer.chrome.com/devtools/docs/javascript-debugging
  6133. // this makes source maps inside style tags work properly in Chrome
  6134. css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */';
  6135. // http://stackoverflow.com/a/26603875
  6136. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  6137. }
  6138. if (styleElement.styleSheet) {
  6139. styleElement.styleSheet.cssText = css;
  6140. } else {
  6141. while(styleElement.firstChild) {
  6142. styleElement.removeChild(styleElement.firstChild);
  6143. }
  6144. styleElement.appendChild(document.createTextNode(css));
  6145. }
  6146. }
  6147. /***/ },
  6148. /* 21 */
  6149. /***/ function(module, exports, __webpack_require__) {
  6150. var base = exports;
  6151. base.Reporter = __webpack_require__(126).Reporter;
  6152. base.DecoderBuffer = __webpack_require__(67).DecoderBuffer;
  6153. base.EncoderBuffer = __webpack_require__(67).EncoderBuffer;
  6154. base.Node = __webpack_require__(125);
  6155. /***/ },
  6156. /* 22 */
  6157. /***/ function(module, exports, __webpack_require__) {
  6158. "use strict";
  6159. 'use strict';
  6160. Object.defineProperty(exports, "__esModule", {
  6161. value: true
  6162. });
  6163. exports.TOKEN_KEY = exports.LOCAL_STORAGE_KEY = undefined;
  6164. var _defineProperty2 = __webpack_require__(163);
  6165. var _defineProperty3 = _interopRequireDefault(_defineProperty2);
  6166. var _stringify = __webpack_require__(162);
  6167. var _stringify2 = _interopRequireDefault(_stringify);
  6168. var _assign = __webpack_require__(48);
  6169. var _assign2 = _interopRequireDefault(_assign);
  6170. var _classCallCheck2 = __webpack_require__(23);
  6171. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6172. var _createClass2 = __webpack_require__(24);
  6173. var _createClass3 = _interopRequireDefault(_createClass2);
  6174. var _token = __webpack_require__(159);
  6175. var _token2 = _interopRequireDefault(_token);
  6176. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6177. var LOCAL_STORAGE_KEY = exports.LOCAL_STORAGE_KEY = 'lesspass';
  6178. var TOKEN_KEY = exports.TOKEN_KEY = 'jwt';
  6179. var Storage = function () {
  6180. function Storage() {
  6181. var storage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.localStorage;
  6182. (0, _classCallCheck3.default)(this, Storage);
  6183. this.storage = storage;
  6184. }
  6185. (0, _createClass3.default)(Storage, [{
  6186. key: '_getLocalStorage',
  6187. value: function _getLocalStorage() {
  6188. return JSON.parse(this.storage.getItem(LOCAL_STORAGE_KEY) || '{}');
  6189. }
  6190. }, {
  6191. key: 'json',
  6192. value: function json() {
  6193. var defaultStorage = {
  6194. baseURL: 'https://lesspass.com',
  6195. timeout: 5000
  6196. };
  6197. var localStorage = this._getLocalStorage();
  6198. return (0, _assign2.default)(defaultStorage, localStorage);
  6199. }
  6200. }, {
  6201. key: 'save',
  6202. value: function save(data) {
  6203. var newData = (0, _assign2.default)(this._getLocalStorage(), data);
  6204. this.storage.setItem(LOCAL_STORAGE_KEY, (0, _stringify2.default)(newData));
  6205. }
  6206. }, {
  6207. key: 'clear',
  6208. value: function clear() {
  6209. this.storage.clear();
  6210. }
  6211. }, {
  6212. key: 'getToken',
  6213. value: function getToken() {
  6214. var storage = this.json();
  6215. if (TOKEN_KEY in storage) {
  6216. return new _token2.default(storage[TOKEN_KEY]);
  6217. }
  6218. return new _token2.default();
  6219. }
  6220. }, {
  6221. key: 'saveToken',
  6222. value: function saveToken(token) {
  6223. this.save((0, _defineProperty3.default)({}, TOKEN_KEY, token));
  6224. }
  6225. }]);
  6226. return Storage;
  6227. }();
  6228. exports.default = Storage;
  6229. /***/ },
  6230. /* 23 */
  6231. /***/ function(module, exports) {
  6232. "use strict";
  6233. "use strict";
  6234. exports.__esModule = true;
  6235. exports.default = function (instance, Constructor) {
  6236. if (!(instance instanceof Constructor)) {
  6237. throw new TypeError("Cannot call a class as a function");
  6238. }
  6239. };
  6240. /***/ },
  6241. /* 24 */
  6242. /***/ function(module, exports, __webpack_require__) {
  6243. "use strict";
  6244. "use strict";
  6245. exports.__esModule = true;
  6246. var _defineProperty = __webpack_require__(79);
  6247. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  6248. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6249. exports.default = function () {
  6250. function defineProperties(target, props) {
  6251. for (var i = 0; i < props.length; i++) {
  6252. var descriptor = props[i];
  6253. descriptor.enumerable = descriptor.enumerable || false;
  6254. descriptor.configurable = true;
  6255. if ("value" in descriptor) descriptor.writable = true;
  6256. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  6257. }
  6258. }
  6259. return function (Constructor, protoProps, staticProps) {
  6260. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  6261. if (staticProps) defineProperties(Constructor, staticProps);
  6262. return Constructor;
  6263. };
  6264. }();
  6265. /***/ },
  6266. /* 25 */
  6267. /***/ function(module, exports, __webpack_require__) {
  6268. "use strict";
  6269. "use strict";
  6270. exports.__esModule = true;
  6271. var _assign = __webpack_require__(48);
  6272. var _assign2 = _interopRequireDefault(_assign);
  6273. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6274. exports.default = _assign2.default || function (target) {
  6275. for (var i = 1; i < arguments.length; i++) {
  6276. var source = arguments[i];
  6277. for (var key in source) {
  6278. if (Object.prototype.hasOwnProperty.call(source, key)) {
  6279. target[key] = source[key];
  6280. }
  6281. }
  6282. }
  6283. return target;
  6284. };
  6285. /***/ },
  6286. /* 26 */
  6287. /***/ function(module, exports, __webpack_require__) {
  6288. /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
  6289. var length = Math.min(a.length, b.length)
  6290. var buffer = new Buffer(length)
  6291. for (var i = 0; i < length; ++i) {
  6292. buffer[i] = a[i] ^ b[i]
  6293. }
  6294. return buffer
  6295. }
  6296. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6297. /***/ },
  6298. /* 27 */
  6299. /***/ function(module, exports) {
  6300. module.exports = {};
  6301. /***/ },
  6302. /* 28 */
  6303. /***/ function(module, exports, __webpack_require__) {
  6304. var anObject = __webpack_require__(13)
  6305. , IE8_DOM_DEFINE = __webpack_require__(184)
  6306. , toPrimitive = __webpack_require__(205)
  6307. , dP = Object.defineProperty;
  6308. exports.f = __webpack_require__(14) ? Object.defineProperty : function defineProperty(O, P, Attributes){
  6309. anObject(O);
  6310. P = toPrimitive(P, true);
  6311. anObject(Attributes);
  6312. if(IE8_DOM_DEFINE)try {
  6313. return dP(O, P, Attributes);
  6314. } catch(e){ /* empty */ }
  6315. if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
  6316. if('value' in Attributes)O[P] = Attributes.value;
  6317. return O;
  6318. };
  6319. /***/ },
  6320. /* 29 */
  6321. /***/ function(module, exports, __webpack_require__) {
  6322. /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
  6323. //
  6324. // Permission is hereby granted, free of charge, to any person obtaining a
  6325. // copy of this software and associated documentation files (the
  6326. // "Software"), to deal in the Software without restriction, including
  6327. // without limitation the rights to use, copy, modify, merge, publish,
  6328. // distribute, sublicense, and/or sell copies of the Software, and to permit
  6329. // persons to whom the Software is furnished to do so, subject to the
  6330. // following conditions:
  6331. //
  6332. // The above copyright notice and this permission notice shall be included
  6333. // in all copies or substantial portions of the Software.
  6334. //
  6335. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  6336. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  6337. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  6338. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  6339. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  6340. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  6341. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  6342. // NOTE: These type checking functions intentionally don't use `instanceof`
  6343. // because it is fragile and can be easily faked with `Object.create()`.
  6344. function isArray(arg) {
  6345. if (Array.isArray) {
  6346. return Array.isArray(arg);
  6347. }
  6348. return objectToString(arg) === '[object Array]';
  6349. }
  6350. exports.isArray = isArray;
  6351. function isBoolean(arg) {
  6352. return typeof arg === 'boolean';
  6353. }
  6354. exports.isBoolean = isBoolean;
  6355. function isNull(arg) {
  6356. return arg === null;
  6357. }
  6358. exports.isNull = isNull;
  6359. function isNullOrUndefined(arg) {
  6360. return arg == null;
  6361. }
  6362. exports.isNullOrUndefined = isNullOrUndefined;
  6363. function isNumber(arg) {
  6364. return typeof arg === 'number';
  6365. }
  6366. exports.isNumber = isNumber;
  6367. function isString(arg) {
  6368. return typeof arg === 'string';
  6369. }
  6370. exports.isString = isString;
  6371. function isSymbol(arg) {
  6372. return typeof arg === 'symbol';
  6373. }
  6374. exports.isSymbol = isSymbol;
  6375. function isUndefined(arg) {
  6376. return arg === void 0;
  6377. }
  6378. exports.isUndefined = isUndefined;
  6379. function isRegExp(re) {
  6380. return objectToString(re) === '[object RegExp]';
  6381. }
  6382. exports.isRegExp = isRegExp;
  6383. function isObject(arg) {
  6384. return typeof arg === 'object' && arg !== null;
  6385. }
  6386. exports.isObject = isObject;
  6387. function isDate(d) {
  6388. return objectToString(d) === '[object Date]';
  6389. }
  6390. exports.isDate = isDate;
  6391. function isError(e) {
  6392. return (objectToString(e) === '[object Error]' || e instanceof Error);
  6393. }
  6394. exports.isError = isError;
  6395. function isFunction(arg) {
  6396. return typeof arg === 'function';
  6397. }
  6398. exports.isFunction = isFunction;
  6399. function isPrimitive(arg) {
  6400. return arg === null ||
  6401. typeof arg === 'boolean' ||
  6402. typeof arg === 'number' ||
  6403. typeof arg === 'string' ||
  6404. typeof arg === 'symbol' || // ES6 symbol
  6405. typeof arg === 'undefined';
  6406. }
  6407. exports.isPrimitive = isPrimitive;
  6408. exports.isBuffer = Buffer.isBuffer;
  6409. function objectToString(o) {
  6410. return Object.prototype.toString.call(o);
  6411. }
  6412. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6413. /***/ },
  6414. /* 30 */
  6415. /***/ function(module, exports) {
  6416. module.exports = assert;
  6417. function assert(val, msg) {
  6418. if (!val)
  6419. throw new Error(msg || 'Assertion failed');
  6420. }
  6421. assert.equal = function assertEqual(l, r, msg) {
  6422. if (l != r)
  6423. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  6424. };
  6425. /***/ },
  6426. /* 31 */
  6427. /***/ function(module, exports, __webpack_require__) {
  6428. "use strict";
  6429. /* WEBPACK VAR INJECTION */(function(global, Buffer, process) {'use strict'
  6430. function oldBrowser () {
  6431. throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
  6432. }
  6433. var crypto = global.crypto || global.msCrypto
  6434. if (crypto && crypto.getRandomValues) {
  6435. module.exports = randomBytes
  6436. } else {
  6437. module.exports = oldBrowser
  6438. }
  6439. function randomBytes (size, cb) {
  6440. // phantomjs needs to throw
  6441. if (size > 65536) throw new Error('requested too many random bytes')
  6442. // in case browserify isn't using the Uint8Array version
  6443. var rawBytes = new global.Uint8Array(size)
  6444. // This will not work in older browsers.
  6445. // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
  6446. if (size > 0) { // getRandomValues fails on IE if size == 0
  6447. crypto.getRandomValues(rawBytes)
  6448. }
  6449. // phantomjs doesn't like a buffer being passed here
  6450. var bytes = new Buffer(rawBytes.buffer)
  6451. if (typeof cb === 'function') {
  6452. return process.nextTick(function () {
  6453. cb(null, bytes)
  6454. })
  6455. }
  6456. return bytes
  6457. }
  6458. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32), __webpack_require__(0).Buffer, __webpack_require__(7)))
  6459. /***/ },
  6460. /* 32 */
  6461. /***/ function(module, exports) {
  6462. var g;
  6463. // This works in non-strict mode
  6464. g = (function() { return this; })();
  6465. try {
  6466. // This works if eval is allowed (see CSP)
  6467. g = g || Function("return this")() || (1,eval)("this");
  6468. } catch(e) {
  6469. // This works if the window reference is available
  6470. if(typeof window === "object")
  6471. g = window;
  6472. }
  6473. // g can still be undefined, but nothing to do about it...
  6474. // We return undefined, instead of nothing here, so it's
  6475. // easier to handle this case. if(!global) { ...}
  6476. module.exports = g;
  6477. /***/ },
  6478. /* 33 */
  6479. /***/ function(module, exports, __webpack_require__) {
  6480. var asn1 = exports;
  6481. asn1.bignum = __webpack_require__(2);
  6482. asn1.define = __webpack_require__(124).define;
  6483. asn1.base = __webpack_require__(21);
  6484. asn1.constants = __webpack_require__(68);
  6485. asn1.decoders = __webpack_require__(128);
  6486. asn1.encoders = __webpack_require__(130);
  6487. /***/ },
  6488. /* 34 */
  6489. /***/ function(module, exports, __webpack_require__) {
  6490. "use strict";
  6491. 'use strict';
  6492. Object.defineProperty(exports, "__esModule", {
  6493. value: true
  6494. });
  6495. var _promise = __webpack_require__(80);
  6496. var _promise2 = _interopRequireDefault(_promise);
  6497. var _classCallCheck2 = __webpack_require__(23);
  6498. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6499. var _createClass2 = __webpack_require__(24);
  6500. var _createClass3 = _interopRequireDefault(_createClass2);
  6501. var _axios = __webpack_require__(71);
  6502. var _axios2 = _interopRequireDefault(_axios);
  6503. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6504. var Auth = function () {
  6505. function Auth(storage) {
  6506. (0, _classCallCheck3.default)(this, Auth);
  6507. this.user = {
  6508. authenticated: false
  6509. };
  6510. this.storage = storage;
  6511. }
  6512. (0, _createClass3.default)(Auth, [{
  6513. key: 'isAuthenticated',
  6514. value: function isAuthenticated() {
  6515. var token = this.storage.getToken();
  6516. if (token.stillValid()) {
  6517. this.user.authenticated = true;
  6518. return true;
  6519. }
  6520. this.user.authenticated = false;
  6521. return false;
  6522. }
  6523. }, {
  6524. key: 'isGuest',
  6525. value: function isGuest() {
  6526. return !this.isAuthenticated();
  6527. }
  6528. }, {
  6529. key: 'logout',
  6530. value: function logout() {
  6531. var _this = this;
  6532. return new _promise2.default(function (resolve) {
  6533. _this.storage.clear();
  6534. _this.user.authenticated = false;
  6535. resolve();
  6536. });
  6537. }
  6538. }, {
  6539. key: 'login',
  6540. value: function login(user, baseURL) {
  6541. var _this2 = this;
  6542. var config = this.storage.json();
  6543. if (baseURL) {
  6544. config.baseURL = baseURL;
  6545. }
  6546. return Auth._requestToken(user, config).then(function (token) {
  6547. _this2.storage.saveToken(token);
  6548. });
  6549. }
  6550. }, {
  6551. key: 'refreshToken',
  6552. value: function refreshToken() {
  6553. var _this3 = this;
  6554. var config = this.storage.json();
  6555. var token = this.storage.getToken();
  6556. return Auth._requestNewToken({ token: token.name }, config).then(function (token) {
  6557. _this3.storage.saveToken(token);
  6558. });
  6559. }
  6560. }, {
  6561. key: 'register',
  6562. value: function register(user, baseURL) {
  6563. var config = this.storage.json();
  6564. if (baseURL) {
  6565. config.baseURL = baseURL;
  6566. }
  6567. return _axios2.default.post('/api/auth/register/', user, config).then(function (response) {
  6568. return response.data;
  6569. });
  6570. }
  6571. }, {
  6572. key: 'resetPassword',
  6573. value: function resetPassword(email, baseURL) {
  6574. var config = this.storage.json();
  6575. if (baseURL) {
  6576. config.baseURL = baseURL;
  6577. }
  6578. return _axios2.default.post('/api/auth/password/reset/', email, config);
  6579. }
  6580. }, {
  6581. key: 'confirmResetPassword',
  6582. value: function confirmResetPassword(password, baseURL) {
  6583. var config = this.storage.json();
  6584. if (baseURL) {
  6585. config.baseURL = baseURL;
  6586. }
  6587. return _axios2.default.post('/api/auth/password/reset/confirm/', password, config);
  6588. }
  6589. }], [{
  6590. key: '_requestToken',
  6591. value: function _requestToken(user) {
  6592. var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6593. return _axios2.default.post('/api/tokens/auth/', user, config).then(function (response) {
  6594. return response.data.token;
  6595. });
  6596. }
  6597. }, {
  6598. key: '_requestNewToken',
  6599. value: function _requestNewToken(token) {
  6600. var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6601. return _axios2.default.post('/api/tokens/refresh/', token, config).then(function (response) {
  6602. return response.data.token;
  6603. });
  6604. }
  6605. }]);
  6606. return Auth;
  6607. }();
  6608. exports.default = Auth;
  6609. /***/ },
  6610. /* 35 */
  6611. /***/ function(module, exports, __webpack_require__) {
  6612. /* WEBPACK VAR INJECTION */(function(Buffer) {// based on the aes implimentation in triple sec
  6613. // https://github.com/keybase/triplesec
  6614. // which is in turn based on the one from crypto-js
  6615. // https://code.google.com/p/crypto-js/
  6616. var uint_max = Math.pow(2, 32)
  6617. function fixup_uint32 (x) {
  6618. var ret, x_pos
  6619. ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x
  6620. return ret
  6621. }
  6622. function scrub_vec (v) {
  6623. for (var i = 0; i < v.length; v++) {
  6624. v[i] = 0
  6625. }
  6626. return false
  6627. }
  6628. function Global () {
  6629. this.SBOX = []
  6630. this.INV_SBOX = []
  6631. this.SUB_MIX = [[], [], [], []]
  6632. this.INV_SUB_MIX = [[], [], [], []]
  6633. this.init()
  6634. this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
  6635. }
  6636. Global.prototype.init = function () {
  6637. var d, i, sx, t, x, x2, x4, x8, xi, _i
  6638. d = (function () {
  6639. var _i, _results
  6640. _results = []
  6641. for (i = _i = 0; _i < 256; i = ++_i) {
  6642. if (i < 128) {
  6643. _results.push(i << 1)
  6644. } else {
  6645. _results.push((i << 1) ^ 0x11b)
  6646. }
  6647. }
  6648. return _results
  6649. })()
  6650. x = 0
  6651. xi = 0
  6652. for (i = _i = 0; _i < 256; i = ++_i) {
  6653. sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
  6654. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
  6655. this.SBOX[x] = sx
  6656. this.INV_SBOX[sx] = x
  6657. x2 = d[x]
  6658. x4 = d[x2]
  6659. x8 = d[x4]
  6660. t = (d[sx] * 0x101) ^ (sx * 0x1010100)
  6661. this.SUB_MIX[0][x] = (t << 24) | (t >>> 8)
  6662. this.SUB_MIX[1][x] = (t << 16) | (t >>> 16)
  6663. this.SUB_MIX[2][x] = (t << 8) | (t >>> 24)
  6664. this.SUB_MIX[3][x] = t
  6665. t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
  6666. this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
  6667. this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
  6668. this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
  6669. this.INV_SUB_MIX[3][sx] = t
  6670. if (x === 0) {
  6671. x = xi = 1
  6672. } else {
  6673. x = x2 ^ d[d[d[x8 ^ x2]]]
  6674. xi ^= d[d[xi]]
  6675. }
  6676. }
  6677. return true
  6678. }
  6679. var G = new Global()
  6680. AES.blockSize = 4 * 4
  6681. AES.prototype.blockSize = AES.blockSize
  6682. AES.keySize = 256 / 8
  6683. AES.prototype.keySize = AES.keySize
  6684. function bufferToArray (buf) {
  6685. var len = buf.length / 4
  6686. var out = new Array(len)
  6687. var i = -1
  6688. while (++i < len) {
  6689. out[i] = buf.readUInt32BE(i * 4)
  6690. }
  6691. return out
  6692. }
  6693. function AES (key) {
  6694. this._key = bufferToArray(key)
  6695. this._doReset()
  6696. }
  6697. AES.prototype._doReset = function () {
  6698. var invKsRow, keySize, keyWords, ksRow, ksRows, t
  6699. keyWords = this._key
  6700. keySize = keyWords.length
  6701. this._nRounds = keySize + 6
  6702. ksRows = (this._nRounds + 1) * 4
  6703. this._keySchedule = []
  6704. for (ksRow = 0; ksRow < ksRows; ksRow++) {
  6705. this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t)
  6706. }
  6707. this._invKeySchedule = []
  6708. for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  6709. ksRow = ksRows - invKsRow
  6710. t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)]
  6711. this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]]
  6712. }
  6713. return true
  6714. }
  6715. AES.prototype.encryptBlock = function (M) {
  6716. M = bufferToArray(new Buffer(M))
  6717. var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX)
  6718. var buf = new Buffer(16)
  6719. buf.writeUInt32BE(out[0], 0)
  6720. buf.writeUInt32BE(out[1], 4)
  6721. buf.writeUInt32BE(out[2], 8)
  6722. buf.writeUInt32BE(out[3], 12)
  6723. return buf
  6724. }
  6725. AES.prototype.decryptBlock = function (M) {
  6726. M = bufferToArray(new Buffer(M))
  6727. var temp = [M[3], M[1]]
  6728. M[1] = temp[0]
  6729. M[3] = temp[1]
  6730. var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX)
  6731. var buf = new Buffer(16)
  6732. buf.writeUInt32BE(out[0], 0)
  6733. buf.writeUInt32BE(out[3], 4)
  6734. buf.writeUInt32BE(out[2], 8)
  6735. buf.writeUInt32BE(out[1], 12)
  6736. return buf
  6737. }
  6738. AES.prototype.scrub = function () {
  6739. scrub_vec(this._keySchedule)
  6740. scrub_vec(this._invKeySchedule)
  6741. scrub_vec(this._key)
  6742. }
  6743. AES.prototype._doCryptBlock = function (M, keySchedule, SUB_MIX, SBOX) {
  6744. var ksRow, s0, s1, s2, s3, t0, t1, t2, t3
  6745. s0 = M[0] ^ keySchedule[0]
  6746. s1 = M[1] ^ keySchedule[1]
  6747. s2 = M[2] ^ keySchedule[2]
  6748. s3 = M[3] ^ keySchedule[3]
  6749. ksRow = 4
  6750. for (var round = 1; round < this._nRounds; round++) {
  6751. t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++]
  6752. t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++]
  6753. t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++]
  6754. t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++]
  6755. s0 = t0
  6756. s1 = t1
  6757. s2 = t2
  6758. s3 = t3
  6759. }
  6760. t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
  6761. t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
  6762. t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
  6763. t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
  6764. return [
  6765. fixup_uint32(t0),
  6766. fixup_uint32(t1),
  6767. fixup_uint32(t2),
  6768. fixup_uint32(t3)
  6769. ]
  6770. }
  6771. exports.AES = AES
  6772. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6773. /***/ },
  6774. /* 36 */
  6775. /***/ function(module, exports) {
  6776. exports['aes-128-ecb'] = {
  6777. cipher: 'AES',
  6778. key: 128,
  6779. iv: 0,
  6780. mode: 'ECB',
  6781. type: 'block'
  6782. }
  6783. exports['aes-192-ecb'] = {
  6784. cipher: 'AES',
  6785. key: 192,
  6786. iv: 0,
  6787. mode: 'ECB',
  6788. type: 'block'
  6789. }
  6790. exports['aes-256-ecb'] = {
  6791. cipher: 'AES',
  6792. key: 256,
  6793. iv: 0,
  6794. mode: 'ECB',
  6795. type: 'block'
  6796. }
  6797. exports['aes-128-cbc'] = {
  6798. cipher: 'AES',
  6799. key: 128,
  6800. iv: 16,
  6801. mode: 'CBC',
  6802. type: 'block'
  6803. }
  6804. exports['aes-192-cbc'] = {
  6805. cipher: 'AES',
  6806. key: 192,
  6807. iv: 16,
  6808. mode: 'CBC',
  6809. type: 'block'
  6810. }
  6811. exports['aes-256-cbc'] = {
  6812. cipher: 'AES',
  6813. key: 256,
  6814. iv: 16,
  6815. mode: 'CBC',
  6816. type: 'block'
  6817. }
  6818. exports['aes128'] = exports['aes-128-cbc']
  6819. exports['aes192'] = exports['aes-192-cbc']
  6820. exports['aes256'] = exports['aes-256-cbc']
  6821. exports['aes-128-cfb'] = {
  6822. cipher: 'AES',
  6823. key: 128,
  6824. iv: 16,
  6825. mode: 'CFB',
  6826. type: 'stream'
  6827. }
  6828. exports['aes-192-cfb'] = {
  6829. cipher: 'AES',
  6830. key: 192,
  6831. iv: 16,
  6832. mode: 'CFB',
  6833. type: 'stream'
  6834. }
  6835. exports['aes-256-cfb'] = {
  6836. cipher: 'AES',
  6837. key: 256,
  6838. iv: 16,
  6839. mode: 'CFB',
  6840. type: 'stream'
  6841. }
  6842. exports['aes-128-cfb8'] = {
  6843. cipher: 'AES',
  6844. key: 128,
  6845. iv: 16,
  6846. mode: 'CFB8',
  6847. type: 'stream'
  6848. }
  6849. exports['aes-192-cfb8'] = {
  6850. cipher: 'AES',
  6851. key: 192,
  6852. iv: 16,
  6853. mode: 'CFB8',
  6854. type: 'stream'
  6855. }
  6856. exports['aes-256-cfb8'] = {
  6857. cipher: 'AES',
  6858. key: 256,
  6859. iv: 16,
  6860. mode: 'CFB8',
  6861. type: 'stream'
  6862. }
  6863. exports['aes-128-cfb1'] = {
  6864. cipher: 'AES',
  6865. key: 128,
  6866. iv: 16,
  6867. mode: 'CFB1',
  6868. type: 'stream'
  6869. }
  6870. exports['aes-192-cfb1'] = {
  6871. cipher: 'AES',
  6872. key: 192,
  6873. iv: 16,
  6874. mode: 'CFB1',
  6875. type: 'stream'
  6876. }
  6877. exports['aes-256-cfb1'] = {
  6878. cipher: 'AES',
  6879. key: 256,
  6880. iv: 16,
  6881. mode: 'CFB1',
  6882. type: 'stream'
  6883. }
  6884. exports['aes-128-ofb'] = {
  6885. cipher: 'AES',
  6886. key: 128,
  6887. iv: 16,
  6888. mode: 'OFB',
  6889. type: 'stream'
  6890. }
  6891. exports['aes-192-ofb'] = {
  6892. cipher: 'AES',
  6893. key: 192,
  6894. iv: 16,
  6895. mode: 'OFB',
  6896. type: 'stream'
  6897. }
  6898. exports['aes-256-ofb'] = {
  6899. cipher: 'AES',
  6900. key: 256,
  6901. iv: 16,
  6902. mode: 'OFB',
  6903. type: 'stream'
  6904. }
  6905. exports['aes-128-ctr'] = {
  6906. cipher: 'AES',
  6907. key: 128,
  6908. iv: 16,
  6909. mode: 'CTR',
  6910. type: 'stream'
  6911. }
  6912. exports['aes-192-ctr'] = {
  6913. cipher: 'AES',
  6914. key: 192,
  6915. iv: 16,
  6916. mode: 'CTR',
  6917. type: 'stream'
  6918. }
  6919. exports['aes-256-ctr'] = {
  6920. cipher: 'AES',
  6921. key: 256,
  6922. iv: 16,
  6923. mode: 'CTR',
  6924. type: 'stream'
  6925. }
  6926. exports['aes-128-gcm'] = {
  6927. cipher: 'AES',
  6928. key: 128,
  6929. iv: 12,
  6930. mode: 'GCM',
  6931. type: 'auth'
  6932. }
  6933. exports['aes-192-gcm'] = {
  6934. cipher: 'AES',
  6935. key: 192,
  6936. iv: 12,
  6937. mode: 'GCM',
  6938. type: 'auth'
  6939. }
  6940. exports['aes-256-gcm'] = {
  6941. cipher: 'AES',
  6942. key: 256,
  6943. iv: 12,
  6944. mode: 'GCM',
  6945. type: 'auth'
  6946. }
  6947. /***/ },
  6948. /* 37 */
  6949. /***/ function(module, exports, __webpack_require__) {
  6950. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  6951. function incr32 (iv) {
  6952. var len = iv.length
  6953. var item
  6954. while (len--) {
  6955. item = iv.readUInt8(len)
  6956. if (item === 255) {
  6957. iv.writeUInt8(0, len)
  6958. } else {
  6959. item++
  6960. iv.writeUInt8(item, len)
  6961. break
  6962. }
  6963. }
  6964. }
  6965. function getBlock (self) {
  6966. var out = self._cipher.encryptBlock(self._prev)
  6967. incr32(self._prev)
  6968. return out
  6969. }
  6970. exports.encrypt = function (self, chunk) {
  6971. while (self._cache.length < chunk.length) {
  6972. self._cache = Buffer.concat([self._cache, getBlock(self)])
  6973. }
  6974. var pad = self._cache.slice(0, chunk.length)
  6975. self._cache = self._cache.slice(chunk.length)
  6976. return xor(chunk, pad)
  6977. }
  6978. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6979. /***/ },
  6980. /* 38 */
  6981. /***/ function(module, exports) {
  6982. var toString = {}.toString;
  6983. module.exports = function(it){
  6984. return toString.call(it).slice(8, -1);
  6985. };
  6986. /***/ },
  6987. /* 39 */
  6988. /***/ function(module, exports, __webpack_require__) {
  6989. // optional / simple context binding
  6990. var aFunction = __webpack_require__(52);
  6991. module.exports = function(fn, that, length){
  6992. aFunction(fn);
  6993. if(that === undefined)return fn;
  6994. switch(length){
  6995. case 1: return function(a){
  6996. return fn.call(that, a);
  6997. };
  6998. case 2: return function(a, b){
  6999. return fn.call(that, a, b);
  7000. };
  7001. case 3: return function(a, b, c){
  7002. return fn.call(that, a, b, c);
  7003. };
  7004. }
  7005. return function(/* ...args */){
  7006. return fn.apply(that, arguments);
  7007. };
  7008. };
  7009. /***/ },
  7010. /* 40 */
  7011. /***/ function(module, exports, __webpack_require__) {
  7012. var global = __webpack_require__(6)
  7013. , core = __webpack_require__(8)
  7014. , ctx = __webpack_require__(39)
  7015. , hide = __webpack_require__(15)
  7016. , PROTOTYPE = 'prototype';
  7017. var $export = function(type, name, source){
  7018. var IS_FORCED = type & $export.F
  7019. , IS_GLOBAL = type & $export.G
  7020. , IS_STATIC = type & $export.S
  7021. , IS_PROTO = type & $export.P
  7022. , IS_BIND = type & $export.B
  7023. , IS_WRAP = type & $export.W
  7024. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  7025. , expProto = exports[PROTOTYPE]
  7026. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  7027. , key, own, out;
  7028. if(IS_GLOBAL)source = name;
  7029. for(key in source){
  7030. // contains in native
  7031. own = !IS_FORCED && target && target[key] !== undefined;
  7032. if(own && key in exports)continue;
  7033. // export native or passed
  7034. out = own ? target[key] : source[key];
  7035. // prevent global pollution for namespaces
  7036. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  7037. // bind timers to global for call from export context
  7038. : IS_BIND && own ? ctx(out, global)
  7039. // wrap global constructors for prevent change them in library
  7040. : IS_WRAP && target[key] == out ? (function(C){
  7041. var F = function(a, b, c){
  7042. if(this instanceof C){
  7043. switch(arguments.length){
  7044. case 0: return new C;
  7045. case 1: return new C(a);
  7046. case 2: return new C(a, b);
  7047. } return new C(a, b, c);
  7048. } return C.apply(this, arguments);
  7049. };
  7050. F[PROTOTYPE] = C[PROTOTYPE];
  7051. return F;
  7052. // make static versions for prototype methods
  7053. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  7054. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  7055. if(IS_PROTO){
  7056. (exports.virtual || (exports.virtual = {}))[key] = out;
  7057. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  7058. if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
  7059. }
  7060. }
  7061. };
  7062. // type bitmap
  7063. $export.F = 1; // forced
  7064. $export.G = 2; // global
  7065. $export.S = 4; // static
  7066. $export.P = 8; // proto
  7067. $export.B = 16; // bind
  7068. $export.W = 32; // wrap
  7069. $export.U = 64; // safe
  7070. $export.R = 128; // real proto method for `library`
  7071. module.exports = $export;
  7072. /***/ },
  7073. /* 41 */
  7074. /***/ function(module, exports) {
  7075. var hasOwnProperty = {}.hasOwnProperty;
  7076. module.exports = function(it, key){
  7077. return hasOwnProperty.call(it, key);
  7078. };
  7079. /***/ },
  7080. /* 42 */
  7081. /***/ function(module, exports) {
  7082. module.exports = function(it){
  7083. return typeof it === 'object' ? it !== null : typeof it === 'function';
  7084. };
  7085. /***/ },
  7086. /* 43 */
  7087. /***/ function(module, exports, __webpack_require__) {
  7088. "use strict";
  7089. 'use strict';
  7090. var curve = exports;
  7091. curve.base = __webpack_require__(232);
  7092. curve.short = __webpack_require__(235);
  7093. curve.mont = __webpack_require__(234);
  7094. curve.edwards = __webpack_require__(233);
  7095. /***/ },
  7096. /* 44 */
  7097. /***/ function(module, exports) {
  7098. // Copyright Joyent, Inc. and other Node contributors.
  7099. //
  7100. // Permission is hereby granted, free of charge, to any person obtaining a
  7101. // copy of this software and associated documentation files (the
  7102. // "Software"), to deal in the Software without restriction, including
  7103. // without limitation the rights to use, copy, modify, merge, publish,
  7104. // distribute, sublicense, and/or sell copies of the Software, and to permit
  7105. // persons to whom the Software is furnished to do so, subject to the
  7106. // following conditions:
  7107. //
  7108. // The above copyright notice and this permission notice shall be included
  7109. // in all copies or substantial portions of the Software.
  7110. //
  7111. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  7112. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7113. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  7114. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  7115. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  7116. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7117. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  7118. function EventEmitter() {
  7119. this._events = this._events || {};
  7120. this._maxListeners = this._maxListeners || undefined;
  7121. }
  7122. module.exports = EventEmitter;
  7123. // Backwards-compat with node 0.10.x
  7124. EventEmitter.EventEmitter = EventEmitter;
  7125. EventEmitter.prototype._events = undefined;
  7126. EventEmitter.prototype._maxListeners = undefined;
  7127. // By default EventEmitters will print a warning if more than 10 listeners are
  7128. // added to it. This is a useful default which helps finding memory leaks.
  7129. EventEmitter.defaultMaxListeners = 10;
  7130. // Obviously not all Emitters should be limited to 10. This function allows
  7131. // that to be increased. Set to zero for unlimited.
  7132. EventEmitter.prototype.setMaxListeners = function(n) {
  7133. if (!isNumber(n) || n < 0 || isNaN(n))
  7134. throw TypeError('n must be a positive number');
  7135. this._maxListeners = n;
  7136. return this;
  7137. };
  7138. EventEmitter.prototype.emit = function(type) {
  7139. var er, handler, len, args, i, listeners;
  7140. if (!this._events)
  7141. this._events = {};
  7142. // If there is no 'error' event listener then throw.
  7143. if (type === 'error') {
  7144. if (!this._events.error ||
  7145. (isObject(this._events.error) && !this._events.error.length)) {
  7146. er = arguments[1];
  7147. if (er instanceof Error) {
  7148. throw er; // Unhandled 'error' event
  7149. } else {
  7150. // At least give some kind of context to the user
  7151. var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
  7152. err.context = er;
  7153. throw err;
  7154. }
  7155. }
  7156. }
  7157. handler = this._events[type];
  7158. if (isUndefined(handler))
  7159. return false;
  7160. if (isFunction(handler)) {
  7161. switch (arguments.length) {
  7162. // fast cases
  7163. case 1:
  7164. handler.call(this);
  7165. break;
  7166. case 2:
  7167. handler.call(this, arguments[1]);
  7168. break;
  7169. case 3:
  7170. handler.call(this, arguments[1], arguments[2]);
  7171. break;
  7172. // slower
  7173. default:
  7174. args = Array.prototype.slice.call(arguments, 1);
  7175. handler.apply(this, args);
  7176. }
  7177. } else if (isObject(handler)) {
  7178. args = Array.prototype.slice.call(arguments, 1);
  7179. listeners = handler.slice();
  7180. len = listeners.length;
  7181. for (i = 0; i < len; i++)
  7182. listeners[i].apply(this, args);
  7183. }
  7184. return true;
  7185. };
  7186. EventEmitter.prototype.addListener = function(type, listener) {
  7187. var m;
  7188. if (!isFunction(listener))
  7189. throw TypeError('listener must be a function');
  7190. if (!this._events)
  7191. this._events = {};
  7192. // To avoid recursion in the case that type === "newListener"! Before
  7193. // adding it to the listeners, first emit "newListener".
  7194. if (this._events.newListener)
  7195. this.emit('newListener', type,
  7196. isFunction(listener.listener) ?
  7197. listener.listener : listener);
  7198. if (!this._events[type])
  7199. // Optimize the case of one listener. Don't need the extra array object.
  7200. this._events[type] = listener;
  7201. else if (isObject(this._events[type]))
  7202. // If we've already got an array, just append.
  7203. this._events[type].push(listener);
  7204. else
  7205. // Adding the second element, need to change to array.
  7206. this._events[type] = [this._events[type], listener];
  7207. // Check for listener leak
  7208. if (isObject(this._events[type]) && !this._events[type].warned) {
  7209. if (!isUndefined(this._maxListeners)) {
  7210. m = this._maxListeners;
  7211. } else {
  7212. m = EventEmitter.defaultMaxListeners;
  7213. }
  7214. if (m && m > 0 && this._events[type].length > m) {
  7215. this._events[type].warned = true;
  7216. console.error('(node) warning: possible EventEmitter memory ' +
  7217. 'leak detected. %d listeners added. ' +
  7218. 'Use emitter.setMaxListeners() to increase limit.',
  7219. this._events[type].length);
  7220. if (typeof console.trace === 'function') {
  7221. // not supported in IE 10
  7222. console.trace();
  7223. }
  7224. }
  7225. }
  7226. return this;
  7227. };
  7228. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  7229. EventEmitter.prototype.once = function(type, listener) {
  7230. if (!isFunction(listener))
  7231. throw TypeError('listener must be a function');
  7232. var fired = false;
  7233. function g() {
  7234. this.removeListener(type, g);
  7235. if (!fired) {
  7236. fired = true;
  7237. listener.apply(this, arguments);
  7238. }
  7239. }
  7240. g.listener = listener;
  7241. this.on(type, g);
  7242. return this;
  7243. };
  7244. // emits a 'removeListener' event iff the listener was removed
  7245. EventEmitter.prototype.removeListener = function(type, listener) {
  7246. var list, position, length, i;
  7247. if (!isFunction(listener))
  7248. throw TypeError('listener must be a function');
  7249. if (!this._events || !this._events[type])
  7250. return this;
  7251. list = this._events[type];
  7252. length = list.length;
  7253. position = -1;
  7254. if (list === listener ||
  7255. (isFunction(list.listener) && list.listener === listener)) {
  7256. delete this._events[type];
  7257. if (this._events.removeListener)
  7258. this.emit('removeListener', type, listener);
  7259. } else if (isObject(list)) {
  7260. for (i = length; i-- > 0;) {
  7261. if (list[i] === listener ||
  7262. (list[i].listener && list[i].listener === listener)) {
  7263. position = i;
  7264. break;
  7265. }
  7266. }
  7267. if (position < 0)
  7268. return this;
  7269. if (list.length === 1) {
  7270. list.length = 0;
  7271. delete this._events[type];
  7272. } else {
  7273. list.splice(position, 1);
  7274. }
  7275. if (this._events.removeListener)
  7276. this.emit('removeListener', type, listener);
  7277. }
  7278. return this;
  7279. };
  7280. EventEmitter.prototype.removeAllListeners = function(type) {
  7281. var key, listeners;
  7282. if (!this._events)
  7283. return this;
  7284. // not listening for removeListener, no need to emit
  7285. if (!this._events.removeListener) {
  7286. if (arguments.length === 0)
  7287. this._events = {};
  7288. else if (this._events[type])
  7289. delete this._events[type];
  7290. return this;
  7291. }
  7292. // emit removeListener for all listeners on all events
  7293. if (arguments.length === 0) {
  7294. for (key in this._events) {
  7295. if (key === 'removeListener') continue;
  7296. this.removeAllListeners(key);
  7297. }
  7298. this.removeAllListeners('removeListener');
  7299. this._events = {};
  7300. return this;
  7301. }
  7302. listeners = this._events[type];
  7303. if (isFunction(listeners)) {
  7304. this.removeListener(type, listeners);
  7305. } else if (listeners) {
  7306. // LIFO order
  7307. while (listeners.length)
  7308. this.removeListener(type, listeners[listeners.length - 1]);
  7309. }
  7310. delete this._events[type];
  7311. return this;
  7312. };
  7313. EventEmitter.prototype.listeners = function(type) {
  7314. var ret;
  7315. if (!this._events || !this._events[type])
  7316. ret = [];
  7317. else if (isFunction(this._events[type]))
  7318. ret = [this._events[type]];
  7319. else
  7320. ret = this._events[type].slice();
  7321. return ret;
  7322. };
  7323. EventEmitter.prototype.listenerCount = function(type) {
  7324. if (this._events) {
  7325. var evlistener = this._events[type];
  7326. if (isFunction(evlistener))
  7327. return 1;
  7328. else if (evlistener)
  7329. return evlistener.length;
  7330. }
  7331. return 0;
  7332. };
  7333. EventEmitter.listenerCount = function(emitter, type) {
  7334. return emitter.listenerCount(type);
  7335. };
  7336. function isFunction(arg) {
  7337. return typeof arg === 'function';
  7338. }
  7339. function isNumber(arg) {
  7340. return typeof arg === 'number';
  7341. }
  7342. function isObject(arg) {
  7343. return typeof arg === 'object' && arg !== null;
  7344. }
  7345. function isUndefined(arg) {
  7346. return arg === void 0;
  7347. }
  7348. /***/ },
  7349. /* 45 */
  7350. /***/ function(module, exports, __webpack_require__) {
  7351. /* WEBPACK VAR INJECTION */(function(Buffer) {var md5 = __webpack_require__(104)
  7352. module.exports = EVP_BytesToKey
  7353. function EVP_BytesToKey (password, salt, keyLen, ivLen) {
  7354. if (!Buffer.isBuffer(password)) {
  7355. password = new Buffer(password, 'binary')
  7356. }
  7357. if (salt && !Buffer.isBuffer(salt)) {
  7358. salt = new Buffer(salt, 'binary')
  7359. }
  7360. keyLen = keyLen / 8
  7361. ivLen = ivLen || 0
  7362. var ki = 0
  7363. var ii = 0
  7364. var key = new Buffer(keyLen)
  7365. var iv = new Buffer(ivLen)
  7366. var addmd = 0
  7367. var md_buf
  7368. var i
  7369. var bufs = []
  7370. while (true) {
  7371. if (addmd++ > 0) {
  7372. bufs.push(md_buf)
  7373. }
  7374. bufs.push(password)
  7375. if (salt) {
  7376. bufs.push(salt)
  7377. }
  7378. md_buf = md5(Buffer.concat(bufs))
  7379. bufs = []
  7380. i = 0
  7381. if (keyLen > 0) {
  7382. while (true) {
  7383. if (keyLen === 0) {
  7384. break
  7385. }
  7386. if (i === md_buf.length) {
  7387. break
  7388. }
  7389. key[ki++] = md_buf[i]
  7390. keyLen--
  7391. i++
  7392. }
  7393. }
  7394. if (ivLen > 0 && i !== md_buf.length) {
  7395. while (true) {
  7396. if (ivLen === 0) {
  7397. break
  7398. }
  7399. if (i === md_buf.length) {
  7400. break
  7401. }
  7402. iv[ii++] = md_buf[i]
  7403. ivLen--
  7404. i++
  7405. }
  7406. }
  7407. if (keyLen === 0 && ivLen === 0) {
  7408. break
  7409. }
  7410. }
  7411. for (i = 0; i < md_buf.length; i++) {
  7412. md_buf[i] = 0
  7413. }
  7414. return {
  7415. key: key,
  7416. iv: iv
  7417. }
  7418. }
  7419. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7420. /***/ },
  7421. /* 46 */
  7422. /***/ function(module, exports, __webpack_require__) {
  7423. /* WEBPACK VAR INJECTION */(function(Buffer) {var asn1 = __webpack_require__(262)
  7424. var aesid = __webpack_require__(257)
  7425. var fixProc = __webpack_require__(263)
  7426. var ciphers = __webpack_require__(49)
  7427. var compat = __webpack_require__(110)
  7428. module.exports = parseKeys
  7429. function parseKeys (buffer) {
  7430. var password
  7431. if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
  7432. password = buffer.passphrase
  7433. buffer = buffer.key
  7434. }
  7435. if (typeof buffer === 'string') {
  7436. buffer = new Buffer(buffer)
  7437. }
  7438. var stripped = fixProc(buffer, password)
  7439. var type = stripped.tag
  7440. var data = stripped.data
  7441. var subtype, ndata
  7442. switch (type) {
  7443. case 'PUBLIC KEY':
  7444. ndata = asn1.PublicKey.decode(data, 'der')
  7445. subtype = ndata.algorithm.algorithm.join('.')
  7446. switch (subtype) {
  7447. case '1.2.840.113549.1.1.1':
  7448. return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
  7449. case '1.2.840.10045.2.1':
  7450. ndata.subjectPrivateKey = ndata.subjectPublicKey
  7451. return {
  7452. type: 'ec',
  7453. data: ndata
  7454. }
  7455. case '1.2.840.10040.4.1':
  7456. ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
  7457. return {
  7458. type: 'dsa',
  7459. data: ndata.algorithm.params
  7460. }
  7461. default: throw new Error('unknown key id ' + subtype)
  7462. }
  7463. throw new Error('unknown key type ' + type)
  7464. case 'ENCRYPTED PRIVATE KEY':
  7465. data = asn1.EncryptedPrivateKey.decode(data, 'der')
  7466. data = decrypt(data, password)
  7467. // falls through
  7468. case 'PRIVATE KEY':
  7469. ndata = asn1.PrivateKey.decode(data, 'der')
  7470. subtype = ndata.algorithm.algorithm.join('.')
  7471. switch (subtype) {
  7472. case '1.2.840.113549.1.1.1':
  7473. return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
  7474. case '1.2.840.10045.2.1':
  7475. return {
  7476. curve: ndata.algorithm.curve,
  7477. privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
  7478. }
  7479. case '1.2.840.10040.4.1':
  7480. ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
  7481. return {
  7482. type: 'dsa',
  7483. params: ndata.algorithm.params
  7484. }
  7485. default: throw new Error('unknown key id ' + subtype)
  7486. }
  7487. throw new Error('unknown key type ' + type)
  7488. case 'RSA PUBLIC KEY':
  7489. return asn1.RSAPublicKey.decode(data, 'der')
  7490. case 'RSA PRIVATE KEY':
  7491. return asn1.RSAPrivateKey.decode(data, 'der')
  7492. case 'DSA PRIVATE KEY':
  7493. return {
  7494. type: 'dsa',
  7495. params: asn1.DSAPrivateKey.decode(data, 'der')
  7496. }
  7497. case 'EC PRIVATE KEY':
  7498. data = asn1.ECPrivateKey.decode(data, 'der')
  7499. return {
  7500. curve: data.parameters.value,
  7501. privateKey: data.privateKey
  7502. }
  7503. default: throw new Error('unknown key type ' + type)
  7504. }
  7505. }
  7506. parseKeys.signature = asn1.signature
  7507. function decrypt (data, password) {
  7508. var salt = data.algorithm.decrypt.kde.kdeparams.salt
  7509. var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
  7510. var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
  7511. var iv = data.algorithm.decrypt.cipher.iv
  7512. var cipherText = data.subjectPrivateKey
  7513. var keylen = parseInt(algo.split('-')[1], 10) / 8
  7514. var key = compat.pbkdf2Sync(password, salt, iters, keylen)
  7515. var cipher = ciphers.createDecipheriv(algo, key, iv)
  7516. var out = []
  7517. out.push(cipher.update(cipherText))
  7518. out.push(cipher.final())
  7519. return Buffer.concat(out)
  7520. }
  7521. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7522. /***/ },
  7523. /* 47 */
  7524. /***/ function(module, exports, __webpack_require__) {
  7525. "use strict";
  7526. /* WEBPACK VAR INJECTION */(function(process) {/*!
  7527. * Vue.js v2.0.3
  7528. * (c) 2014-2016 Evan You
  7529. * Released under the MIT License.
  7530. */
  7531. 'use strict';
  7532. /* */
  7533. /**
  7534. * Convert a value to a string that is actually rendered.
  7535. */
  7536. function _toString (val) {
  7537. return val == null
  7538. ? ''
  7539. : typeof val === 'object'
  7540. ? JSON.stringify(val, null, 2)
  7541. : String(val)
  7542. }
  7543. /**
  7544. * Convert a input value to a number for persistence.
  7545. * If the conversion fails, return original string.
  7546. */
  7547. function toNumber (val) {
  7548. var n = parseFloat(val, 10);
  7549. return (n || n === 0) ? n : val
  7550. }
  7551. /**
  7552. * Make a map and return a function for checking if a key
  7553. * is in that map.
  7554. */
  7555. function makeMap (
  7556. str,
  7557. expectsLowerCase
  7558. ) {
  7559. var map = Object.create(null);
  7560. var list = str.split(',');
  7561. for (var i = 0; i < list.length; i++) {
  7562. map[list[i]] = true;
  7563. }
  7564. return expectsLowerCase
  7565. ? function (val) { return map[val.toLowerCase()]; }
  7566. : function (val) { return map[val]; }
  7567. }
  7568. /**
  7569. * Check if a tag is a built-in tag.
  7570. */
  7571. var isBuiltInTag = makeMap('slot,component', true);
  7572. /**
  7573. * Remove an item from an array
  7574. */
  7575. function remove$1 (arr, item) {
  7576. if (arr.length) {
  7577. var index = arr.indexOf(item);
  7578. if (index > -1) {
  7579. return arr.splice(index, 1)
  7580. }
  7581. }
  7582. }
  7583. /**
  7584. * Check whether the object has the property.
  7585. */
  7586. var hasOwnProperty = Object.prototype.hasOwnProperty;
  7587. function hasOwn (obj, key) {
  7588. return hasOwnProperty.call(obj, key)
  7589. }
  7590. /**
  7591. * Check if value is primitive
  7592. */
  7593. function isPrimitive (value) {
  7594. return typeof value === 'string' || typeof value === 'number'
  7595. }
  7596. /**
  7597. * Create a cached version of a pure function.
  7598. */
  7599. function cached (fn) {
  7600. var cache = Object.create(null);
  7601. return function cachedFn (str) {
  7602. var hit = cache[str];
  7603. return hit || (cache[str] = fn(str))
  7604. }
  7605. }
  7606. /**
  7607. * Camelize a hyphen-delmited string.
  7608. */
  7609. var camelizeRE = /-(\w)/g;
  7610. var camelize = cached(function (str) {
  7611. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  7612. });
  7613. /**
  7614. * Capitalize a string.
  7615. */
  7616. var capitalize = cached(function (str) {
  7617. return str.charAt(0).toUpperCase() + str.slice(1)
  7618. });
  7619. /**
  7620. * Hyphenate a camelCase string.
  7621. */
  7622. var hyphenateRE = /([^-])([A-Z])/g;
  7623. var hyphenate = cached(function (str) {
  7624. return str
  7625. .replace(hyphenateRE, '$1-$2')
  7626. .replace(hyphenateRE, '$1-$2')
  7627. .toLowerCase()
  7628. });
  7629. /**
  7630. * Simple bind, faster than native
  7631. */
  7632. function bind$1 (fn, ctx) {
  7633. function boundFn (a) {
  7634. var l = arguments.length;
  7635. return l
  7636. ? l > 1
  7637. ? fn.apply(ctx, arguments)
  7638. : fn.call(ctx, a)
  7639. : fn.call(ctx)
  7640. }
  7641. // record original fn length
  7642. boundFn._length = fn.length;
  7643. return boundFn
  7644. }
  7645. /**
  7646. * Convert an Array-like object to a real Array.
  7647. */
  7648. function toArray (list, start) {
  7649. start = start || 0;
  7650. var i = list.length - start;
  7651. var ret = new Array(i);
  7652. while (i--) {
  7653. ret[i] = list[i + start];
  7654. }
  7655. return ret
  7656. }
  7657. /**
  7658. * Mix properties into target object.
  7659. */
  7660. function extend (to, _from) {
  7661. for (var key in _from) {
  7662. to[key] = _from[key];
  7663. }
  7664. return to
  7665. }
  7666. /**
  7667. * Quick object check - this is primarily used to tell
  7668. * Objects from primitive values when we know the value
  7669. * is a JSON-compliant type.
  7670. */
  7671. function isObject (obj) {
  7672. return obj !== null && typeof obj === 'object'
  7673. }
  7674. /**
  7675. * Strict object type check. Only returns true
  7676. * for plain JavaScript objects.
  7677. */
  7678. var toString = Object.prototype.toString;
  7679. var OBJECT_STRING = '[object Object]';
  7680. function isPlainObject (obj) {
  7681. return toString.call(obj) === OBJECT_STRING
  7682. }
  7683. /**
  7684. * Merge an Array of Objects into a single Object.
  7685. */
  7686. function toObject (arr) {
  7687. var res = {};
  7688. for (var i = 0; i < arr.length; i++) {
  7689. if (arr[i]) {
  7690. extend(res, arr[i]);
  7691. }
  7692. }
  7693. return res
  7694. }
  7695. /**
  7696. * Perform no operation.
  7697. */
  7698. function noop () {}
  7699. /**
  7700. * Always return false.
  7701. */
  7702. var no = function () { return false; };
  7703. /**
  7704. * Generate a static keys string from compiler modules.
  7705. */
  7706. function genStaticKeys (modules) {
  7707. return modules.reduce(function (keys, m) {
  7708. return keys.concat(m.staticKeys || [])
  7709. }, []).join(',')
  7710. }
  7711. /**
  7712. * Check if two values are loosely equal - that is,
  7713. * if they are plain objects, do they have the same shape?
  7714. */
  7715. function looseEqual (a, b) {
  7716. /* eslint-disable eqeqeq */
  7717. return a == b || (
  7718. isObject(a) && isObject(b)
  7719. ? JSON.stringify(a) === JSON.stringify(b)
  7720. : false
  7721. )
  7722. /* eslint-enable eqeqeq */
  7723. }
  7724. function looseIndexOf (arr, val) {
  7725. for (var i = 0; i < arr.length; i++) {
  7726. if (looseEqual(arr[i], val)) { return i }
  7727. }
  7728. return -1
  7729. }
  7730. /* */
  7731. var config = {
  7732. /**
  7733. * Option merge strategies (used in core/util/options)
  7734. */
  7735. optionMergeStrategies: Object.create(null),
  7736. /**
  7737. * Whether to suppress warnings.
  7738. */
  7739. silent: false,
  7740. /**
  7741. * Whether to enable devtools
  7742. */
  7743. devtools: process.env.NODE_ENV !== 'production',
  7744. /**
  7745. * Error handler for watcher errors
  7746. */
  7747. errorHandler: null,
  7748. /**
  7749. * Ignore certain custom elements
  7750. */
  7751. ignoredElements: null,
  7752. /**
  7753. * Custom user key aliases for v-on
  7754. */
  7755. keyCodes: Object.create(null),
  7756. /**
  7757. * Check if a tag is reserved so that it cannot be registered as a
  7758. * component. This is platform-dependent and may be overwritten.
  7759. */
  7760. isReservedTag: no,
  7761. /**
  7762. * Check if a tag is an unknown element.
  7763. * Platform-dependent.
  7764. */
  7765. isUnknownElement: no,
  7766. /**
  7767. * Get the namespace of an element
  7768. */
  7769. getTagNamespace: noop,
  7770. /**
  7771. * Check if an attribute must be bound using property, e.g. value
  7772. * Platform-dependent.
  7773. */
  7774. mustUseProp: no,
  7775. /**
  7776. * List of asset types that a component can own.
  7777. */
  7778. _assetTypes: [
  7779. 'component',
  7780. 'directive',
  7781. 'filter'
  7782. ],
  7783. /**
  7784. * List of lifecycle hooks.
  7785. */
  7786. _lifecycleHooks: [
  7787. 'beforeCreate',
  7788. 'created',
  7789. 'beforeMount',
  7790. 'mounted',
  7791. 'beforeUpdate',
  7792. 'updated',
  7793. 'beforeDestroy',
  7794. 'destroyed',
  7795. 'activated',
  7796. 'deactivated'
  7797. ],
  7798. /**
  7799. * Max circular updates allowed in a scheduler flush cycle.
  7800. */
  7801. _maxUpdateCount: 100,
  7802. /**
  7803. * Server rendering?
  7804. */
  7805. _isServer: process.env.VUE_ENV === 'server'
  7806. };
  7807. /* */
  7808. /**
  7809. * Check if a string starts with $ or _
  7810. */
  7811. function isReserved (str) {
  7812. var c = (str + '').charCodeAt(0);
  7813. return c === 0x24 || c === 0x5F
  7814. }
  7815. /**
  7816. * Define a property.
  7817. */
  7818. function def (obj, key, val, enumerable) {
  7819. Object.defineProperty(obj, key, {
  7820. value: val,
  7821. enumerable: !!enumerable,
  7822. writable: true,
  7823. configurable: true
  7824. });
  7825. }
  7826. /**
  7827. * Parse simple path.
  7828. */
  7829. var bailRE = /[^\w\.\$]/;
  7830. function parsePath (path) {
  7831. if (bailRE.test(path)) {
  7832. return
  7833. } else {
  7834. var segments = path.split('.');
  7835. return function (obj) {
  7836. for (var i = 0; i < segments.length; i++) {
  7837. if (!obj) { return }
  7838. obj = obj[segments[i]];
  7839. }
  7840. return obj
  7841. }
  7842. }
  7843. }
  7844. /* */
  7845. /* globals MutationObserver */
  7846. // can we use __proto__?
  7847. var hasProto = '__proto__' in {};
  7848. // Browser environment sniffing
  7849. var inBrowser =
  7850. typeof window !== 'undefined' &&
  7851. Object.prototype.toString.call(window) !== '[object Object]';
  7852. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  7853. var isIE = UA && /msie|trident/.test(UA);
  7854. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  7855. var isEdge = UA && UA.indexOf('edge/') > 0;
  7856. var isAndroid = UA && UA.indexOf('android') > 0;
  7857. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  7858. // detect devtools
  7859. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  7860. /* istanbul ignore next */
  7861. function isNative (Ctor) {
  7862. return /native code/.test(Ctor.toString())
  7863. }
  7864. /**
  7865. * Defer a task to execute it asynchronously.
  7866. */
  7867. var nextTick = (function () {
  7868. var callbacks = [];
  7869. var pending = false;
  7870. var timerFunc;
  7871. function nextTickHandler () {
  7872. pending = false;
  7873. var copies = callbacks.slice(0);
  7874. callbacks.length = 0;
  7875. for (var i = 0; i < copies.length; i++) {
  7876. copies[i]();
  7877. }
  7878. }
  7879. // the nextTick behavior leverages the microtask queue, which can be accessed
  7880. // via either native Promise.then or MutationObserver.
  7881. // MutationObserver has wider support, however it is seriously bugged in
  7882. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  7883. // completely stops working after triggering a few times... so, if native
  7884. // Promise is available, we will use it:
  7885. /* istanbul ignore if */
  7886. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  7887. var p = Promise.resolve();
  7888. timerFunc = function () {
  7889. p.then(nextTickHandler);
  7890. // in problematic UIWebViews, Promise.then doesn't completely break, but
  7891. // it can get stuck in a weird state where callbacks are pushed into the
  7892. // microtask queue but the queue isn't being flushed, until the browser
  7893. // needs to do some other work, e.g. handle a timer. Therefore we can
  7894. // "force" the microtask queue to be flushed by adding an empty timer.
  7895. if (isIOS) { setTimeout(noop); }
  7896. };
  7897. } else if (typeof MutationObserver !== 'undefined' && (
  7898. isNative(MutationObserver) ||
  7899. // PhantomJS and iOS 7.x
  7900. MutationObserver.toString() === '[object MutationObserverConstructor]'
  7901. )) {
  7902. // use MutationObserver where native Promise is not available,
  7903. // e.g. PhantomJS IE11, iOS7, Android 4.4
  7904. var counter = 1;
  7905. var observer = new MutationObserver(nextTickHandler);
  7906. var textNode = document.createTextNode(String(counter));
  7907. observer.observe(textNode, {
  7908. characterData: true
  7909. });
  7910. timerFunc = function () {
  7911. counter = (counter + 1) % 2;
  7912. textNode.data = String(counter);
  7913. };
  7914. } else {
  7915. // fallback to setTimeout
  7916. /* istanbul ignore next */
  7917. timerFunc = function () {
  7918. setTimeout(nextTickHandler, 0);
  7919. };
  7920. }
  7921. return function queueNextTick (cb, ctx) {
  7922. var func = ctx
  7923. ? function () { cb.call(ctx); }
  7924. : cb;
  7925. callbacks.push(func);
  7926. if (!pending) {
  7927. pending = true;
  7928. timerFunc();
  7929. }
  7930. }
  7931. })();
  7932. var _Set;
  7933. /* istanbul ignore if */
  7934. if (typeof Set !== 'undefined' && isNative(Set)) {
  7935. // use native Set when available.
  7936. _Set = Set;
  7937. } else {
  7938. // a non-standard Set polyfill that only works with primitive keys.
  7939. _Set = (function () {
  7940. function Set () {
  7941. this.set = Object.create(null);
  7942. }
  7943. Set.prototype.has = function has (key) {
  7944. return this.set[key] !== undefined
  7945. };
  7946. Set.prototype.add = function add (key) {
  7947. this.set[key] = 1;
  7948. };
  7949. Set.prototype.clear = function clear () {
  7950. this.set = Object.create(null);
  7951. };
  7952. return Set;
  7953. }());
  7954. }
  7955. /* not type checking this file because flow doesn't play well with Proxy */
  7956. var hasProxy;
  7957. var proxyHandlers;
  7958. var initProxy;
  7959. if (process.env.NODE_ENV !== 'production') {
  7960. var allowedGlobals = makeMap(
  7961. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  7962. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  7963. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  7964. 'require' // for Webpack/Browserify
  7965. );
  7966. hasProxy =
  7967. typeof Proxy !== 'undefined' &&
  7968. Proxy.toString().match(/native code/);
  7969. proxyHandlers = {
  7970. has: function has (target, key) {
  7971. var has = key in target;
  7972. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  7973. if (!has && !isAllowed) {
  7974. warn(
  7975. "Property or method \"" + key + "\" is not defined on the instance but " +
  7976. "referenced during render. Make sure to declare reactive data " +
  7977. "properties in the data option.",
  7978. target
  7979. );
  7980. }
  7981. return has || !isAllowed
  7982. }
  7983. };
  7984. initProxy = function initProxy (vm) {
  7985. if (hasProxy) {
  7986. vm._renderProxy = new Proxy(vm, proxyHandlers);
  7987. } else {
  7988. vm._renderProxy = vm;
  7989. }
  7990. };
  7991. }
  7992. /* */
  7993. var uid$2 = 0;
  7994. /**
  7995. * A dep is an observable that can have multiple
  7996. * directives subscribing to it.
  7997. */
  7998. var Dep = function Dep () {
  7999. this.id = uid$2++;
  8000. this.subs = [];
  8001. };
  8002. Dep.prototype.addSub = function addSub (sub) {
  8003. this.subs.push(sub);
  8004. };
  8005. Dep.prototype.removeSub = function removeSub (sub) {
  8006. remove$1(this.subs, sub);
  8007. };
  8008. Dep.prototype.depend = function depend () {
  8009. if (Dep.target) {
  8010. Dep.target.addDep(this);
  8011. }
  8012. };
  8013. Dep.prototype.notify = function notify () {
  8014. // stablize the subscriber list first
  8015. var subs = this.subs.slice();
  8016. for (var i = 0, l = subs.length; i < l; i++) {
  8017. subs[i].update();
  8018. }
  8019. };
  8020. // the current target watcher being evaluated.
  8021. // this is globally unique because there could be only one
  8022. // watcher being evaluated at any time.
  8023. Dep.target = null;
  8024. var targetStack = [];
  8025. function pushTarget (_target) {
  8026. if (Dep.target) { targetStack.push(Dep.target); }
  8027. Dep.target = _target;
  8028. }
  8029. function popTarget () {
  8030. Dep.target = targetStack.pop();
  8031. }
  8032. /* */
  8033. var queue = [];
  8034. var has$1 = {};
  8035. var circular = {};
  8036. var waiting = false;
  8037. var flushing = false;
  8038. var index = 0;
  8039. /**
  8040. * Reset the scheduler's state.
  8041. */
  8042. function resetSchedulerState () {
  8043. queue.length = 0;
  8044. has$1 = {};
  8045. if (process.env.NODE_ENV !== 'production') {
  8046. circular = {};
  8047. }
  8048. waiting = flushing = false;
  8049. }
  8050. /**
  8051. * Flush both queues and run the watchers.
  8052. */
  8053. function flushSchedulerQueue () {
  8054. flushing = true;
  8055. // Sort queue before flush.
  8056. // This ensures that:
  8057. // 1. Components are updated from parent to child. (because parent is always
  8058. // created before the child)
  8059. // 2. A component's user watchers are run before its render watcher (because
  8060. // user watchers are created before the render watcher)
  8061. // 3. If a component is destroyed during a parent component's watcher run,
  8062. // its watchers can be skipped.
  8063. queue.sort(function (a, b) { return a.id - b.id; });
  8064. // do not cache length because more watchers might be pushed
  8065. // as we run existing watchers
  8066. for (index = 0; index < queue.length; index++) {
  8067. var watcher = queue[index];
  8068. var id = watcher.id;
  8069. has$1[id] = null;
  8070. watcher.run();
  8071. // in dev build, check and stop circular updates.
  8072. if (process.env.NODE_ENV !== 'production' && has$1[id] != null) {
  8073. circular[id] = (circular[id] || 0) + 1;
  8074. if (circular[id] > config._maxUpdateCount) {
  8075. warn(
  8076. 'You may have an infinite update loop ' + (
  8077. watcher.user
  8078. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  8079. : "in a component render function."
  8080. ),
  8081. watcher.vm
  8082. );
  8083. break
  8084. }
  8085. }
  8086. }
  8087. // devtool hook
  8088. /* istanbul ignore if */
  8089. if (devtools && config.devtools) {
  8090. devtools.emit('flush');
  8091. }
  8092. resetSchedulerState();
  8093. }
  8094. /**
  8095. * Push a watcher into the watcher queue.
  8096. * Jobs with duplicate IDs will be skipped unless it's
  8097. * pushed when the queue is being flushed.
  8098. */
  8099. function queueWatcher (watcher) {
  8100. var id = watcher.id;
  8101. if (has$1[id] == null) {
  8102. has$1[id] = true;
  8103. if (!flushing) {
  8104. queue.push(watcher);
  8105. } else {
  8106. // if already flushing, splice the watcher based on its id
  8107. // if already past its id, it will be run next immediately.
  8108. var i = queue.length - 1;
  8109. while (i >= 0 && queue[i].id > watcher.id) {
  8110. i--;
  8111. }
  8112. queue.splice(Math.max(i, index) + 1, 0, watcher);
  8113. }
  8114. // queue the flush
  8115. if (!waiting) {
  8116. waiting = true;
  8117. nextTick(flushSchedulerQueue);
  8118. }
  8119. }
  8120. }
  8121. /* */
  8122. var uid$1 = 0;
  8123. /**
  8124. * A watcher parses an expression, collects dependencies,
  8125. * and fires callback when the expression value changes.
  8126. * This is used for both the $watch() api and directives.
  8127. */
  8128. var Watcher = function Watcher (
  8129. vm,
  8130. expOrFn,
  8131. cb,
  8132. options
  8133. ) {
  8134. if ( options === void 0 ) options = {};
  8135. this.vm = vm;
  8136. vm._watchers.push(this);
  8137. // options
  8138. this.deep = !!options.deep;
  8139. this.user = !!options.user;
  8140. this.lazy = !!options.lazy;
  8141. this.sync = !!options.sync;
  8142. this.expression = expOrFn.toString();
  8143. this.cb = cb;
  8144. this.id = ++uid$1; // uid for batching
  8145. this.active = true;
  8146. this.dirty = this.lazy; // for lazy watchers
  8147. this.deps = [];
  8148. this.newDeps = [];
  8149. this.depIds = new _Set();
  8150. this.newDepIds = new _Set();
  8151. // parse expression for getter
  8152. if (typeof expOrFn === 'function') {
  8153. this.getter = expOrFn;
  8154. } else {
  8155. this.getter = parsePath(expOrFn);
  8156. if (!this.getter) {
  8157. this.getter = function () {};
  8158. process.env.NODE_ENV !== 'production' && warn(
  8159. "Failed watching path: \"" + expOrFn + "\" " +
  8160. 'Watcher only accepts simple dot-delimited paths. ' +
  8161. 'For full control, use a function instead.',
  8162. vm
  8163. );
  8164. }
  8165. }
  8166. this.value = this.lazy
  8167. ? undefined
  8168. : this.get();
  8169. };
  8170. /**
  8171. * Evaluate the getter, and re-collect dependencies.
  8172. */
  8173. Watcher.prototype.get = function get () {
  8174. pushTarget(this);
  8175. var value = this.getter.call(this.vm, this.vm);
  8176. // "touch" every property so they are all tracked as
  8177. // dependencies for deep watching
  8178. if (this.deep) {
  8179. traverse(value);
  8180. }
  8181. popTarget();
  8182. this.cleanupDeps();
  8183. return value
  8184. };
  8185. /**
  8186. * Add a dependency to this directive.
  8187. */
  8188. Watcher.prototype.addDep = function addDep (dep) {
  8189. var id = dep.id;
  8190. if (!this.newDepIds.has(id)) {
  8191. this.newDepIds.add(id);
  8192. this.newDeps.push(dep);
  8193. if (!this.depIds.has(id)) {
  8194. dep.addSub(this);
  8195. }
  8196. }
  8197. };
  8198. /**
  8199. * Clean up for dependency collection.
  8200. */
  8201. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8202. var this$1 = this;
  8203. var i = this.deps.length;
  8204. while (i--) {
  8205. var dep = this$1.deps[i];
  8206. if (!this$1.newDepIds.has(dep.id)) {
  8207. dep.removeSub(this$1);
  8208. }
  8209. }
  8210. var tmp = this.depIds;
  8211. this.depIds = this.newDepIds;
  8212. this.newDepIds = tmp;
  8213. this.newDepIds.clear();
  8214. tmp = this.deps;
  8215. this.deps = this.newDeps;
  8216. this.newDeps = tmp;
  8217. this.newDeps.length = 0;
  8218. };
  8219. /**
  8220. * Subscriber interface.
  8221. * Will be called when a dependency changes.
  8222. */
  8223. Watcher.prototype.update = function update () {
  8224. /* istanbul ignore else */
  8225. if (this.lazy) {
  8226. this.dirty = true;
  8227. } else if (this.sync) {
  8228. this.run();
  8229. } else {
  8230. queueWatcher(this);
  8231. }
  8232. };
  8233. /**
  8234. * Scheduler job interface.
  8235. * Will be called by the scheduler.
  8236. */
  8237. Watcher.prototype.run = function run () {
  8238. if (this.active) {
  8239. var value = this.get();
  8240. if (
  8241. value !== this.value ||
  8242. // Deep watchers and watchers on Object/Arrays should fire even
  8243. // when the value is the same, because the value may
  8244. // have mutated.
  8245. isObject(value) ||
  8246. this.deep
  8247. ) {
  8248. // set new value
  8249. var oldValue = this.value;
  8250. this.value = value;
  8251. if (this.user) {
  8252. try {
  8253. this.cb.call(this.vm, value, oldValue);
  8254. } catch (e) {
  8255. process.env.NODE_ENV !== 'production' && warn(
  8256. ("Error in watcher \"" + (this.expression) + "\""),
  8257. this.vm
  8258. );
  8259. /* istanbul ignore else */
  8260. if (config.errorHandler) {
  8261. config.errorHandler.call(null, e, this.vm);
  8262. } else {
  8263. throw e
  8264. }
  8265. }
  8266. } else {
  8267. this.cb.call(this.vm, value, oldValue);
  8268. }
  8269. }
  8270. }
  8271. };
  8272. /**
  8273. * Evaluate the value of the watcher.
  8274. * This only gets called for lazy watchers.
  8275. */
  8276. Watcher.prototype.evaluate = function evaluate () {
  8277. this.value = this.get();
  8278. this.dirty = false;
  8279. };
  8280. /**
  8281. * Depend on all deps collected by this watcher.
  8282. */
  8283. Watcher.prototype.depend = function depend () {
  8284. var this$1 = this;
  8285. var i = this.deps.length;
  8286. while (i--) {
  8287. this$1.deps[i].depend();
  8288. }
  8289. };
  8290. /**
  8291. * Remove self from all dependencies' subcriber list.
  8292. */
  8293. Watcher.prototype.teardown = function teardown () {
  8294. var this$1 = this;
  8295. if (this.active) {
  8296. // remove self from vm's watcher list
  8297. // this is a somewhat expensive operation so we skip it
  8298. // if the vm is being destroyed or is performing a v-for
  8299. // re-render (the watcher list is then filtered by v-for).
  8300. if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  8301. remove$1(this.vm._watchers, this);
  8302. }
  8303. var i = this.deps.length;
  8304. while (i--) {
  8305. this$1.deps[i].removeSub(this$1);
  8306. }
  8307. this.active = false;
  8308. }
  8309. };
  8310. /**
  8311. * Recursively traverse an object to evoke all converted
  8312. * getters, so that every nested property inside the object
  8313. * is collected as a "deep" dependency.
  8314. */
  8315. var seenObjects = new _Set();
  8316. function traverse (val, seen) {
  8317. var i, keys;
  8318. if (!seen) {
  8319. seen = seenObjects;
  8320. seen.clear();
  8321. }
  8322. var isA = Array.isArray(val);
  8323. var isO = isObject(val);
  8324. if ((isA || isO) && Object.isExtensible(val)) {
  8325. if (val.__ob__) {
  8326. var depId = val.__ob__.dep.id;
  8327. if (seen.has(depId)) {
  8328. return
  8329. } else {
  8330. seen.add(depId);
  8331. }
  8332. }
  8333. if (isA) {
  8334. i = val.length;
  8335. while (i--) { traverse(val[i], seen); }
  8336. } else if (isO) {
  8337. keys = Object.keys(val);
  8338. i = keys.length;
  8339. while (i--) { traverse(val[keys[i]], seen); }
  8340. }
  8341. }
  8342. }
  8343. /*
  8344. * not type checking this file because flow doesn't play well with
  8345. * dynamically accessing methods on Array prototype
  8346. */
  8347. var arrayProto = Array.prototype;
  8348. var arrayMethods = Object.create(arrayProto);[
  8349. 'push',
  8350. 'pop',
  8351. 'shift',
  8352. 'unshift',
  8353. 'splice',
  8354. 'sort',
  8355. 'reverse'
  8356. ]
  8357. .forEach(function (method) {
  8358. // cache original method
  8359. var original = arrayProto[method];
  8360. def(arrayMethods, method, function mutator () {
  8361. var arguments$1 = arguments;
  8362. // avoid leaking arguments:
  8363. // http://jsperf.com/closure-with-arguments
  8364. var i = arguments.length;
  8365. var args = new Array(i);
  8366. while (i--) {
  8367. args[i] = arguments$1[i];
  8368. }
  8369. var result = original.apply(this, args);
  8370. var ob = this.__ob__;
  8371. var inserted;
  8372. switch (method) {
  8373. case 'push':
  8374. inserted = args;
  8375. break
  8376. case 'unshift':
  8377. inserted = args;
  8378. break
  8379. case 'splice':
  8380. inserted = args.slice(2);
  8381. break
  8382. }
  8383. if (inserted) { ob.observeArray(inserted); }
  8384. // notify change
  8385. ob.dep.notify();
  8386. return result
  8387. });
  8388. });
  8389. /* */
  8390. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  8391. /**
  8392. * By default, when a reactive property is set, the new value is
  8393. * also converted to become reactive. However when passing down props,
  8394. * we don't want to force conversion because the value may be a nested value
  8395. * under a frozen data structure. Converting it would defeat the optimization.
  8396. */
  8397. var observerState = {
  8398. shouldConvert: true,
  8399. isSettingProps: false
  8400. };
  8401. /**
  8402. * Observer class that are attached to each observed
  8403. * object. Once attached, the observer converts target
  8404. * object's property keys into getter/setters that
  8405. * collect dependencies and dispatches updates.
  8406. */
  8407. var Observer = function Observer (value) {
  8408. this.value = value;
  8409. this.dep = new Dep();
  8410. this.vmCount = 0;
  8411. def(value, '__ob__', this);
  8412. if (Array.isArray(value)) {
  8413. var augment = hasProto
  8414. ? protoAugment
  8415. : copyAugment;
  8416. augment(value, arrayMethods, arrayKeys);
  8417. this.observeArray(value);
  8418. } else {
  8419. this.walk(value);
  8420. }
  8421. };
  8422. /**
  8423. * Walk through each property and convert them into
  8424. * getter/setters. This method should only be called when
  8425. * value type is Object.
  8426. */
  8427. Observer.prototype.walk = function walk (obj) {
  8428. var keys = Object.keys(obj);
  8429. for (var i = 0; i < keys.length; i++) {
  8430. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  8431. }
  8432. };
  8433. /**
  8434. * Observe a list of Array items.
  8435. */
  8436. Observer.prototype.observeArray = function observeArray (items) {
  8437. for (var i = 0, l = items.length; i < l; i++) {
  8438. observe(items[i]);
  8439. }
  8440. };
  8441. // helpers
  8442. /**
  8443. * Augment an target Object or Array by intercepting
  8444. * the prototype chain using __proto__
  8445. */
  8446. function protoAugment (target, src) {
  8447. /* eslint-disable no-proto */
  8448. target.__proto__ = src;
  8449. /* eslint-enable no-proto */
  8450. }
  8451. /**
  8452. * Augment an target Object or Array by defining
  8453. * hidden properties.
  8454. *
  8455. * istanbul ignore next
  8456. */
  8457. function copyAugment (target, src, keys) {
  8458. for (var i = 0, l = keys.length; i < l; i++) {
  8459. var key = keys[i];
  8460. def(target, key, src[key]);
  8461. }
  8462. }
  8463. /**
  8464. * Attempt to create an observer instance for a value,
  8465. * returns the new observer if successfully observed,
  8466. * or the existing observer if the value already has one.
  8467. */
  8468. function observe (value) {
  8469. if (!isObject(value)) {
  8470. return
  8471. }
  8472. var ob;
  8473. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  8474. ob = value.__ob__;
  8475. } else if (
  8476. observerState.shouldConvert &&
  8477. !config._isServer &&
  8478. (Array.isArray(value) || isPlainObject(value)) &&
  8479. Object.isExtensible(value) &&
  8480. !value._isVue
  8481. ) {
  8482. ob = new Observer(value);
  8483. }
  8484. return ob
  8485. }
  8486. /**
  8487. * Define a reactive property on an Object.
  8488. */
  8489. function defineReactive$$1 (
  8490. obj,
  8491. key,
  8492. val,
  8493. customSetter
  8494. ) {
  8495. var dep = new Dep();
  8496. var property = Object.getOwnPropertyDescriptor(obj, key);
  8497. if (property && property.configurable === false) {
  8498. return
  8499. }
  8500. // cater for pre-defined getter/setters
  8501. var getter = property && property.get;
  8502. var setter = property && property.set;
  8503. var childOb = observe(val);
  8504. Object.defineProperty(obj, key, {
  8505. enumerable: true,
  8506. configurable: true,
  8507. get: function reactiveGetter () {
  8508. var value = getter ? getter.call(obj) : val;
  8509. if (Dep.target) {
  8510. dep.depend();
  8511. if (childOb) {
  8512. childOb.dep.depend();
  8513. }
  8514. if (Array.isArray(value)) {
  8515. dependArray(value);
  8516. }
  8517. }
  8518. return value
  8519. },
  8520. set: function reactiveSetter (newVal) {
  8521. var value = getter ? getter.call(obj) : val;
  8522. if (newVal === value) {
  8523. return
  8524. }
  8525. if (process.env.NODE_ENV !== 'production' && customSetter) {
  8526. customSetter();
  8527. }
  8528. if (setter) {
  8529. setter.call(obj, newVal);
  8530. } else {
  8531. val = newVal;
  8532. }
  8533. childOb = observe(newVal);
  8534. dep.notify();
  8535. }
  8536. });
  8537. }
  8538. /**
  8539. * Set a property on an object. Adds the new property and
  8540. * triggers change notification if the property doesn't
  8541. * already exist.
  8542. */
  8543. function set (obj, key, val) {
  8544. if (Array.isArray(obj)) {
  8545. obj.splice(key, 1, val);
  8546. return val
  8547. }
  8548. if (hasOwn(obj, key)) {
  8549. obj[key] = val;
  8550. return
  8551. }
  8552. var ob = obj.__ob__;
  8553. if (obj._isVue || (ob && ob.vmCount)) {
  8554. process.env.NODE_ENV !== 'production' && warn(
  8555. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  8556. 'at runtime - declare it upfront in the data option.'
  8557. );
  8558. return
  8559. }
  8560. if (!ob) {
  8561. obj[key] = val;
  8562. return
  8563. }
  8564. defineReactive$$1(ob.value, key, val);
  8565. ob.dep.notify();
  8566. return val
  8567. }
  8568. /**
  8569. * Delete a property and trigger change if necessary.
  8570. */
  8571. function del (obj, key) {
  8572. var ob = obj.__ob__;
  8573. if (obj._isVue || (ob && ob.vmCount)) {
  8574. process.env.NODE_ENV !== 'production' && warn(
  8575. 'Avoid deleting properties on a Vue instance or its root $data ' +
  8576. '- just set it to null.'
  8577. );
  8578. return
  8579. }
  8580. if (!hasOwn(obj, key)) {
  8581. return
  8582. }
  8583. delete obj[key];
  8584. if (!ob) {
  8585. return
  8586. }
  8587. ob.dep.notify();
  8588. }
  8589. /**
  8590. * Collect dependencies on array elements when the array is touched, since
  8591. * we cannot intercept array element access like property getters.
  8592. */
  8593. function dependArray (value) {
  8594. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  8595. e = value[i];
  8596. e && e.__ob__ && e.__ob__.dep.depend();
  8597. if (Array.isArray(e)) {
  8598. dependArray(e);
  8599. }
  8600. }
  8601. }
  8602. /* */
  8603. function initState (vm) {
  8604. vm._watchers = [];
  8605. initProps(vm);
  8606. initData(vm);
  8607. initComputed(vm);
  8608. initMethods(vm);
  8609. initWatch(vm);
  8610. }
  8611. function initProps (vm) {
  8612. var props = vm.$options.props;
  8613. if (props) {
  8614. var propsData = vm.$options.propsData || {};
  8615. var keys = vm.$options._propKeys = Object.keys(props);
  8616. var isRoot = !vm.$parent;
  8617. // root instance props should be converted
  8618. observerState.shouldConvert = isRoot;
  8619. var loop = function ( i ) {
  8620. var key = keys[i];
  8621. /* istanbul ignore else */
  8622. if (process.env.NODE_ENV !== 'production') {
  8623. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
  8624. if (vm.$parent && !observerState.isSettingProps) {
  8625. warn(
  8626. "Avoid mutating a prop directly since the value will be " +
  8627. "overwritten whenever the parent component re-renders. " +
  8628. "Instead, use a data or computed property based on the prop's " +
  8629. "value. Prop being mutated: \"" + key + "\"",
  8630. vm
  8631. );
  8632. }
  8633. });
  8634. } else {
  8635. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm));
  8636. }
  8637. };
  8638. for (var i = 0; i < keys.length; i++) loop( i );
  8639. observerState.shouldConvert = true;
  8640. }
  8641. }
  8642. function initData (vm) {
  8643. var data = vm.$options.data;
  8644. data = vm._data = typeof data === 'function'
  8645. ? data.call(vm)
  8646. : data || {};
  8647. if (!isPlainObject(data)) {
  8648. data = {};
  8649. process.env.NODE_ENV !== 'production' && warn(
  8650. 'data functions should return an object.',
  8651. vm
  8652. );
  8653. }
  8654. // proxy data on instance
  8655. var keys = Object.keys(data);
  8656. var props = vm.$options.props;
  8657. var i = keys.length;
  8658. while (i--) {
  8659. if (props && hasOwn(props, keys[i])) {
  8660. process.env.NODE_ENV !== 'production' && warn(
  8661. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  8662. "Use prop default value instead.",
  8663. vm
  8664. );
  8665. } else {
  8666. proxy(vm, keys[i]);
  8667. }
  8668. }
  8669. // observe data
  8670. observe(data);
  8671. data.__ob__ && data.__ob__.vmCount++;
  8672. }
  8673. var computedSharedDefinition = {
  8674. enumerable: true,
  8675. configurable: true,
  8676. get: noop,
  8677. set: noop
  8678. };
  8679. function initComputed (vm) {
  8680. var computed = vm.$options.computed;
  8681. if (computed) {
  8682. for (var key in computed) {
  8683. var userDef = computed[key];
  8684. if (typeof userDef === 'function') {
  8685. computedSharedDefinition.get = makeComputedGetter(userDef, vm);
  8686. computedSharedDefinition.set = noop;
  8687. } else {
  8688. computedSharedDefinition.get = userDef.get
  8689. ? userDef.cache !== false
  8690. ? makeComputedGetter(userDef.get, vm)
  8691. : bind$1(userDef.get, vm)
  8692. : noop;
  8693. computedSharedDefinition.set = userDef.set
  8694. ? bind$1(userDef.set, vm)
  8695. : noop;
  8696. }
  8697. Object.defineProperty(vm, key, computedSharedDefinition);
  8698. }
  8699. }
  8700. }
  8701. function makeComputedGetter (getter, owner) {
  8702. var watcher = new Watcher(owner, getter, noop, {
  8703. lazy: true
  8704. });
  8705. return function computedGetter () {
  8706. if (watcher.dirty) {
  8707. watcher.evaluate();
  8708. }
  8709. if (Dep.target) {
  8710. watcher.depend();
  8711. }
  8712. return watcher.value
  8713. }
  8714. }
  8715. function initMethods (vm) {
  8716. var methods = vm.$options.methods;
  8717. if (methods) {
  8718. for (var key in methods) {
  8719. vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
  8720. if (process.env.NODE_ENV !== 'production' && methods[key] == null) {
  8721. warn(
  8722. "method \"" + key + "\" has an undefined value in the component definition. " +
  8723. "Did you reference the function correctly?",
  8724. vm
  8725. );
  8726. }
  8727. }
  8728. }
  8729. }
  8730. function initWatch (vm) {
  8731. var watch = vm.$options.watch;
  8732. if (watch) {
  8733. for (var key in watch) {
  8734. var handler = watch[key];
  8735. if (Array.isArray(handler)) {
  8736. for (var i = 0; i < handler.length; i++) {
  8737. createWatcher(vm, key, handler[i]);
  8738. }
  8739. } else {
  8740. createWatcher(vm, key, handler);
  8741. }
  8742. }
  8743. }
  8744. }
  8745. function createWatcher (vm, key, handler) {
  8746. var options;
  8747. if (isPlainObject(handler)) {
  8748. options = handler;
  8749. handler = handler.handler;
  8750. }
  8751. if (typeof handler === 'string') {
  8752. handler = vm[handler];
  8753. }
  8754. vm.$watch(key, handler, options);
  8755. }
  8756. function stateMixin (Vue) {
  8757. // flow somehow has problems with directly declared definition object
  8758. // when using Object.defineProperty, so we have to procedurally build up
  8759. // the object here.
  8760. var dataDef = {};
  8761. dataDef.get = function () {
  8762. return this._data
  8763. };
  8764. if (process.env.NODE_ENV !== 'production') {
  8765. dataDef.set = function (newData) {
  8766. warn(
  8767. 'Avoid replacing instance root $data. ' +
  8768. 'Use nested data properties instead.',
  8769. this
  8770. );
  8771. };
  8772. }
  8773. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8774. Vue.prototype.$set = set;
  8775. Vue.prototype.$delete = del;
  8776. Vue.prototype.$watch = function (
  8777. expOrFn,
  8778. cb,
  8779. options
  8780. ) {
  8781. var vm = this;
  8782. options = options || {};
  8783. options.user = true;
  8784. var watcher = new Watcher(vm, expOrFn, cb, options);
  8785. if (options.immediate) {
  8786. cb.call(vm, watcher.value);
  8787. }
  8788. return function unwatchFn () {
  8789. watcher.teardown();
  8790. }
  8791. };
  8792. }
  8793. function proxy (vm, key) {
  8794. if (!isReserved(key)) {
  8795. Object.defineProperty(vm, key, {
  8796. configurable: true,
  8797. enumerable: true,
  8798. get: function proxyGetter () {
  8799. return vm._data[key]
  8800. },
  8801. set: function proxySetter (val) {
  8802. vm._data[key] = val;
  8803. }
  8804. });
  8805. }
  8806. }
  8807. /* */
  8808. var VNode = function VNode (
  8809. tag,
  8810. data,
  8811. children,
  8812. text,
  8813. elm,
  8814. ns,
  8815. context,
  8816. componentOptions
  8817. ) {
  8818. this.tag = tag;
  8819. this.data = data;
  8820. this.children = children;
  8821. this.text = text;
  8822. this.elm = elm;
  8823. this.ns = ns;
  8824. this.context = context;
  8825. this.functionalContext = undefined;
  8826. this.key = data && data.key;
  8827. this.componentOptions = componentOptions;
  8828. this.child = undefined;
  8829. this.parent = undefined;
  8830. this.raw = false;
  8831. this.isStatic = false;
  8832. this.isRootInsert = true;
  8833. this.isComment = false;
  8834. this.isCloned = false;
  8835. };
  8836. var emptyVNode = function () {
  8837. var node = new VNode();
  8838. node.text = '';
  8839. node.isComment = true;
  8840. return node
  8841. };
  8842. // optimized shallow clone
  8843. // used for static nodes and slot nodes because they may be reused across
  8844. // multiple renders, cloning them avoids errors when DOM manipulations rely
  8845. // on their elm reference.
  8846. function cloneVNode (vnode) {
  8847. var cloned = new VNode(
  8848. vnode.tag,
  8849. vnode.data,
  8850. vnode.children,
  8851. vnode.text,
  8852. vnode.elm,
  8853. vnode.ns,
  8854. vnode.context,
  8855. vnode.componentOptions
  8856. );
  8857. cloned.isStatic = vnode.isStatic;
  8858. cloned.key = vnode.key;
  8859. cloned.isCloned = true;
  8860. return cloned
  8861. }
  8862. function cloneVNodes (vnodes) {
  8863. var res = new Array(vnodes.length);
  8864. for (var i = 0; i < vnodes.length; i++) {
  8865. res[i] = cloneVNode(vnodes[i]);
  8866. }
  8867. return res
  8868. }
  8869. /* */
  8870. function mergeVNodeHook (def, hookKey, hook, key) {
  8871. key = key + hookKey;
  8872. var injectedHash = def.__injected || (def.__injected = {});
  8873. if (!injectedHash[key]) {
  8874. injectedHash[key] = true;
  8875. var oldHook = def[hookKey];
  8876. if (oldHook) {
  8877. def[hookKey] = function () {
  8878. oldHook.apply(this, arguments);
  8879. hook.apply(this, arguments);
  8880. };
  8881. } else {
  8882. def[hookKey] = hook;
  8883. }
  8884. }
  8885. }
  8886. /* */
  8887. function updateListeners (
  8888. on,
  8889. oldOn,
  8890. add,
  8891. remove$$1,
  8892. vm
  8893. ) {
  8894. var name, cur, old, fn, event, capture;
  8895. for (name in on) {
  8896. cur = on[name];
  8897. old = oldOn[name];
  8898. if (!cur) {
  8899. process.env.NODE_ENV !== 'production' && warn(
  8900. "Invalid handler for event \"" + name + "\": got " + String(cur),
  8901. vm
  8902. );
  8903. } else if (!old) {
  8904. capture = name.charAt(0) === '!';
  8905. event = capture ? name.slice(1) : name;
  8906. if (Array.isArray(cur)) {
  8907. add(event, (cur.invoker = arrInvoker(cur)), capture);
  8908. } else {
  8909. if (!cur.invoker) {
  8910. fn = cur;
  8911. cur = on[name] = {};
  8912. cur.fn = fn;
  8913. cur.invoker = fnInvoker(cur);
  8914. }
  8915. add(event, cur.invoker, capture);
  8916. }
  8917. } else if (cur !== old) {
  8918. if (Array.isArray(old)) {
  8919. old.length = cur.length;
  8920. for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
  8921. on[name] = old;
  8922. } else {
  8923. old.fn = cur;
  8924. on[name] = old;
  8925. }
  8926. }
  8927. }
  8928. for (name in oldOn) {
  8929. if (!on[name]) {
  8930. event = name.charAt(0) === '!' ? name.slice(1) : name;
  8931. remove$$1(event, oldOn[name].invoker);
  8932. }
  8933. }
  8934. }
  8935. function arrInvoker (arr) {
  8936. return function (ev) {
  8937. var arguments$1 = arguments;
  8938. var single = arguments.length === 1;
  8939. for (var i = 0; i < arr.length; i++) {
  8940. single ? arr[i](ev) : arr[i].apply(null, arguments$1);
  8941. }
  8942. }
  8943. }
  8944. function fnInvoker (o) {
  8945. return function (ev) {
  8946. var single = arguments.length === 1;
  8947. single ? o.fn(ev) : o.fn.apply(null, arguments);
  8948. }
  8949. }
  8950. /* */
  8951. function normalizeChildren (
  8952. children,
  8953. ns,
  8954. nestedIndex
  8955. ) {
  8956. if (isPrimitive(children)) {
  8957. return [createTextVNode(children)]
  8958. }
  8959. if (Array.isArray(children)) {
  8960. var res = [];
  8961. for (var i = 0, l = children.length; i < l; i++) {
  8962. var c = children[i];
  8963. var last = res[res.length - 1];
  8964. // nested
  8965. if (Array.isArray(c)) {
  8966. res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
  8967. } else if (isPrimitive(c)) {
  8968. if (last && last.text) {
  8969. last.text += String(c);
  8970. } else if (c !== '') {
  8971. // convert primitive to vnode
  8972. res.push(createTextVNode(c));
  8973. }
  8974. } else if (c instanceof VNode) {
  8975. if (c.text && last && last.text) {
  8976. last.text += c.text;
  8977. } else {
  8978. // inherit parent namespace
  8979. if (ns) {
  8980. applyNS(c, ns);
  8981. }
  8982. // default key for nested array children (likely generated by v-for)
  8983. if (c.tag && c.key == null && nestedIndex != null) {
  8984. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  8985. }
  8986. res.push(c);
  8987. }
  8988. }
  8989. }
  8990. return res
  8991. }
  8992. }
  8993. function createTextVNode (val) {
  8994. return new VNode(undefined, undefined, undefined, String(val))
  8995. }
  8996. function applyNS (vnode, ns) {
  8997. if (vnode.tag && !vnode.ns) {
  8998. vnode.ns = ns;
  8999. if (vnode.children) {
  9000. for (var i = 0, l = vnode.children.length; i < l; i++) {
  9001. applyNS(vnode.children[i], ns);
  9002. }
  9003. }
  9004. }
  9005. }
  9006. /* */
  9007. function getFirstComponentChild (children) {
  9008. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  9009. }
  9010. /* */
  9011. var activeInstance = null;
  9012. function initLifecycle (vm) {
  9013. var options = vm.$options;
  9014. // locate first non-abstract parent
  9015. var parent = options.parent;
  9016. if (parent && !options.abstract) {
  9017. while (parent.$options.abstract && parent.$parent) {
  9018. parent = parent.$parent;
  9019. }
  9020. parent.$children.push(vm);
  9021. }
  9022. vm.$parent = parent;
  9023. vm.$root = parent ? parent.$root : vm;
  9024. vm.$children = [];
  9025. vm.$refs = {};
  9026. vm._watcher = null;
  9027. vm._inactive = false;
  9028. vm._isMounted = false;
  9029. vm._isDestroyed = false;
  9030. vm._isBeingDestroyed = false;
  9031. }
  9032. function lifecycleMixin (Vue) {
  9033. Vue.prototype._mount = function (
  9034. el,
  9035. hydrating
  9036. ) {
  9037. var vm = this;
  9038. vm.$el = el;
  9039. if (!vm.$options.render) {
  9040. vm.$options.render = emptyVNode;
  9041. if (process.env.NODE_ENV !== 'production') {
  9042. /* istanbul ignore if */
  9043. if (vm.$options.template) {
  9044. warn(
  9045. 'You are using the runtime-only build of Vue where the template ' +
  9046. 'option is not available. Either pre-compile the templates into ' +
  9047. 'render functions, or use the compiler-included build.',
  9048. vm
  9049. );
  9050. } else {
  9051. warn(
  9052. 'Failed to mount component: template or render function not defined.',
  9053. vm
  9054. );
  9055. }
  9056. }
  9057. }
  9058. callHook(vm, 'beforeMount');
  9059. vm._watcher = new Watcher(vm, function () {
  9060. vm._update(vm._render(), hydrating);
  9061. }, noop);
  9062. hydrating = false;
  9063. // manually mounted instance, call mounted on self
  9064. // mounted is called for render-created child components in its inserted hook
  9065. if (vm.$vnode == null) {
  9066. vm._isMounted = true;
  9067. callHook(vm, 'mounted');
  9068. }
  9069. return vm
  9070. };
  9071. Vue.prototype._update = function (vnode, hydrating) {
  9072. var vm = this;
  9073. if (vm._isMounted) {
  9074. callHook(vm, 'beforeUpdate');
  9075. }
  9076. var prevEl = vm.$el;
  9077. var prevActiveInstance = activeInstance;
  9078. activeInstance = vm;
  9079. var prevVnode = vm._vnode;
  9080. vm._vnode = vnode;
  9081. if (!prevVnode) {
  9082. // Vue.prototype.__patch__ is injected in entry points
  9083. // based on the rendering backend used.
  9084. vm.$el = vm.__patch__(vm.$el, vnode, hydrating);
  9085. } else {
  9086. vm.$el = vm.__patch__(prevVnode, vnode);
  9087. }
  9088. activeInstance = prevActiveInstance;
  9089. // update __vue__ reference
  9090. if (prevEl) {
  9091. prevEl.__vue__ = null;
  9092. }
  9093. if (vm.$el) {
  9094. vm.$el.__vue__ = vm;
  9095. }
  9096. // if parent is an HOC, update its $el as well
  9097. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  9098. vm.$parent.$el = vm.$el;
  9099. }
  9100. if (vm._isMounted) {
  9101. callHook(vm, 'updated');
  9102. }
  9103. };
  9104. Vue.prototype._updateFromParent = function (
  9105. propsData,
  9106. listeners,
  9107. parentVnode,
  9108. renderChildren
  9109. ) {
  9110. var vm = this;
  9111. var hasChildren = !!(vm.$options._renderChildren || renderChildren);
  9112. vm.$options._parentVnode = parentVnode;
  9113. vm.$options._renderChildren = renderChildren;
  9114. // update props
  9115. if (propsData && vm.$options.props) {
  9116. observerState.shouldConvert = false;
  9117. if (process.env.NODE_ENV !== 'production') {
  9118. observerState.isSettingProps = true;
  9119. }
  9120. var propKeys = vm.$options._propKeys || [];
  9121. for (var i = 0; i < propKeys.length; i++) {
  9122. var key = propKeys[i];
  9123. vm[key] = validateProp(key, vm.$options.props, propsData, vm);
  9124. }
  9125. observerState.shouldConvert = true;
  9126. if (process.env.NODE_ENV !== 'production') {
  9127. observerState.isSettingProps = false;
  9128. }
  9129. }
  9130. // update listeners
  9131. if (listeners) {
  9132. var oldListeners = vm.$options._parentListeners;
  9133. vm.$options._parentListeners = listeners;
  9134. vm._updateListeners(listeners, oldListeners);
  9135. }
  9136. // resolve slots + force update if has children
  9137. if (hasChildren) {
  9138. vm.$slots = resolveSlots(renderChildren, vm._renderContext);
  9139. vm.$forceUpdate();
  9140. }
  9141. };
  9142. Vue.prototype.$forceUpdate = function () {
  9143. var vm = this;
  9144. if (vm._watcher) {
  9145. vm._watcher.update();
  9146. }
  9147. };
  9148. Vue.prototype.$destroy = function () {
  9149. var vm = this;
  9150. if (vm._isBeingDestroyed) {
  9151. return
  9152. }
  9153. callHook(vm, 'beforeDestroy');
  9154. vm._isBeingDestroyed = true;
  9155. // remove self from parent
  9156. var parent = vm.$parent;
  9157. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  9158. remove$1(parent.$children, vm);
  9159. }
  9160. // teardown watchers
  9161. if (vm._watcher) {
  9162. vm._watcher.teardown();
  9163. }
  9164. var i = vm._watchers.length;
  9165. while (i--) {
  9166. vm._watchers[i].teardown();
  9167. }
  9168. // remove reference from data ob
  9169. // frozen object may not have observer.
  9170. if (vm._data.__ob__) {
  9171. vm._data.__ob__.vmCount--;
  9172. }
  9173. // call the last hook...
  9174. vm._isDestroyed = true;
  9175. callHook(vm, 'destroyed');
  9176. // turn off all instance listeners.
  9177. vm.$off();
  9178. // remove __vue__ reference
  9179. if (vm.$el) {
  9180. vm.$el.__vue__ = null;
  9181. }
  9182. // invoke destroy hooks on current rendered tree
  9183. vm.__patch__(vm._vnode, null);
  9184. };
  9185. }
  9186. function callHook (vm, hook) {
  9187. var handlers = vm.$options[hook];
  9188. if (handlers) {
  9189. for (var i = 0, j = handlers.length; i < j; i++) {
  9190. handlers[i].call(vm);
  9191. }
  9192. }
  9193. vm.$emit('hook:' + hook);
  9194. }
  9195. /* */
  9196. var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
  9197. var hooksToMerge = Object.keys(hooks);
  9198. function createComponent (
  9199. Ctor,
  9200. data,
  9201. context,
  9202. children,
  9203. tag
  9204. ) {
  9205. if (!Ctor) {
  9206. return
  9207. }
  9208. if (isObject(Ctor)) {
  9209. Ctor = Vue$2.extend(Ctor);
  9210. }
  9211. if (typeof Ctor !== 'function') {
  9212. if (process.env.NODE_ENV !== 'production') {
  9213. warn(("Invalid Component definition: " + (String(Ctor))), context);
  9214. }
  9215. return
  9216. }
  9217. // async component
  9218. if (!Ctor.cid) {
  9219. if (Ctor.resolved) {
  9220. Ctor = Ctor.resolved;
  9221. } else {
  9222. Ctor = resolveAsyncComponent(Ctor, function () {
  9223. // it's ok to queue this on every render because
  9224. // $forceUpdate is buffered by the scheduler.
  9225. context.$forceUpdate();
  9226. });
  9227. if (!Ctor) {
  9228. // return nothing if this is indeed an async component
  9229. // wait for the callback to trigger parent update.
  9230. return
  9231. }
  9232. }
  9233. }
  9234. data = data || {};
  9235. // extract props
  9236. var propsData = extractProps(data, Ctor);
  9237. // functional component
  9238. if (Ctor.options.functional) {
  9239. return createFunctionalComponent(Ctor, propsData, data, context, children)
  9240. }
  9241. // extract listeners, since these needs to be treated as
  9242. // child component listeners instead of DOM listeners
  9243. var listeners = data.on;
  9244. // replace with listeners with .native modifier
  9245. data.on = data.nativeOn;
  9246. if (Ctor.options.abstract) {
  9247. // abstract components do not keep anything
  9248. // other than props & listeners
  9249. data = {};
  9250. }
  9251. // merge component management hooks onto the placeholder node
  9252. mergeHooks(data);
  9253. // return a placeholder vnode
  9254. var name = Ctor.options.name || tag;
  9255. var vnode = new VNode(
  9256. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  9257. data, undefined, undefined, undefined, undefined, context,
  9258. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  9259. );
  9260. return vnode
  9261. }
  9262. function createFunctionalComponent (
  9263. Ctor,
  9264. propsData,
  9265. data,
  9266. context,
  9267. children
  9268. ) {
  9269. var props = {};
  9270. var propOptions = Ctor.options.props;
  9271. if (propOptions) {
  9272. for (var key in propOptions) {
  9273. props[key] = validateProp(key, propOptions, propsData);
  9274. }
  9275. }
  9276. var vnode = Ctor.options.render.call(
  9277. null,
  9278. // ensure the createElement function in functional components
  9279. // gets a unique context - this is necessary for correct named slot check
  9280. bind$1(createElement, { _self: Object.create(context) }),
  9281. {
  9282. props: props,
  9283. data: data,
  9284. parent: context,
  9285. children: normalizeChildren(children),
  9286. slots: function () { return resolveSlots(children, context); }
  9287. }
  9288. );
  9289. if (vnode instanceof VNode) {
  9290. vnode.functionalContext = context;
  9291. if (data.slot) {
  9292. (vnode.data || (vnode.data = {})).slot = data.slot;
  9293. }
  9294. }
  9295. return vnode
  9296. }
  9297. function createComponentInstanceForVnode (
  9298. vnode, // we know it's MountedComponentVNode but flow doesn't
  9299. parent // activeInstance in lifecycle state
  9300. ) {
  9301. var vnodeComponentOptions = vnode.componentOptions;
  9302. var options = {
  9303. _isComponent: true,
  9304. parent: parent,
  9305. propsData: vnodeComponentOptions.propsData,
  9306. _componentTag: vnodeComponentOptions.tag,
  9307. _parentVnode: vnode,
  9308. _parentListeners: vnodeComponentOptions.listeners,
  9309. _renderChildren: vnodeComponentOptions.children
  9310. };
  9311. // check inline-template render functions
  9312. var inlineTemplate = vnode.data.inlineTemplate;
  9313. if (inlineTemplate) {
  9314. options.render = inlineTemplate.render;
  9315. options.staticRenderFns = inlineTemplate.staticRenderFns;
  9316. }
  9317. return new vnodeComponentOptions.Ctor(options)
  9318. }
  9319. function init (vnode, hydrating) {
  9320. if (!vnode.child || vnode.child._isDestroyed) {
  9321. var child = vnode.child = createComponentInstanceForVnode(vnode, activeInstance);
  9322. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  9323. }
  9324. }
  9325. function prepatch (
  9326. oldVnode,
  9327. vnode
  9328. ) {
  9329. var options = vnode.componentOptions;
  9330. var child = vnode.child = oldVnode.child;
  9331. child._updateFromParent(
  9332. options.propsData, // updated props
  9333. options.listeners, // updated listeners
  9334. vnode, // new parent vnode
  9335. options.children // new children
  9336. );
  9337. }
  9338. function insert (vnode) {
  9339. if (!vnode.child._isMounted) {
  9340. vnode.child._isMounted = true;
  9341. callHook(vnode.child, 'mounted');
  9342. }
  9343. if (vnode.data.keepAlive) {
  9344. vnode.child._inactive = false;
  9345. callHook(vnode.child, 'activated');
  9346. }
  9347. }
  9348. function destroy$1 (vnode) {
  9349. if (!vnode.child._isDestroyed) {
  9350. if (!vnode.data.keepAlive) {
  9351. vnode.child.$destroy();
  9352. } else {
  9353. vnode.child._inactive = true;
  9354. callHook(vnode.child, 'deactivated');
  9355. }
  9356. }
  9357. }
  9358. function resolveAsyncComponent (
  9359. factory,
  9360. cb
  9361. ) {
  9362. if (factory.requested) {
  9363. // pool callbacks
  9364. factory.pendingCallbacks.push(cb);
  9365. } else {
  9366. factory.requested = true;
  9367. var cbs = factory.pendingCallbacks = [cb];
  9368. var sync = true;
  9369. var resolve = function (res) {
  9370. if (isObject(res)) {
  9371. res = Vue$2.extend(res);
  9372. }
  9373. // cache resolved
  9374. factory.resolved = res;
  9375. // invoke callbacks only if this is not a synchronous resolve
  9376. // (async resolves are shimmed as synchronous during SSR)
  9377. if (!sync) {
  9378. for (var i = 0, l = cbs.length; i < l; i++) {
  9379. cbs[i](res);
  9380. }
  9381. }
  9382. };
  9383. var reject = function (reason) {
  9384. process.env.NODE_ENV !== 'production' && warn(
  9385. "Failed to resolve async component: " + (String(factory)) +
  9386. (reason ? ("\nReason: " + reason) : '')
  9387. );
  9388. };
  9389. var res = factory(resolve, reject);
  9390. // handle promise
  9391. if (res && typeof res.then === 'function' && !factory.resolved) {
  9392. res.then(resolve, reject);
  9393. }
  9394. sync = false;
  9395. // return in case resolved synchronously
  9396. return factory.resolved
  9397. }
  9398. }
  9399. function extractProps (data, Ctor) {
  9400. // we are only extrating raw values here.
  9401. // validation and default values are handled in the child
  9402. // component itself.
  9403. var propOptions = Ctor.options.props;
  9404. if (!propOptions) {
  9405. return
  9406. }
  9407. var res = {};
  9408. var attrs = data.attrs;
  9409. var props = data.props;
  9410. var domProps = data.domProps;
  9411. if (attrs || props || domProps) {
  9412. for (var key in propOptions) {
  9413. var altKey = hyphenate(key);
  9414. checkProp(res, props, key, altKey, true) ||
  9415. checkProp(res, attrs, key, altKey) ||
  9416. checkProp(res, domProps, key, altKey);
  9417. }
  9418. }
  9419. return res
  9420. }
  9421. function checkProp (
  9422. res,
  9423. hash,
  9424. key,
  9425. altKey,
  9426. preserve
  9427. ) {
  9428. if (hash) {
  9429. if (hasOwn(hash, key)) {
  9430. res[key] = hash[key];
  9431. if (!preserve) {
  9432. delete hash[key];
  9433. }
  9434. return true
  9435. } else if (hasOwn(hash, altKey)) {
  9436. res[key] = hash[altKey];
  9437. if (!preserve) {
  9438. delete hash[altKey];
  9439. }
  9440. return true
  9441. }
  9442. }
  9443. return false
  9444. }
  9445. function mergeHooks (data) {
  9446. if (!data.hook) {
  9447. data.hook = {};
  9448. }
  9449. for (var i = 0; i < hooksToMerge.length; i++) {
  9450. var key = hooksToMerge[i];
  9451. var fromParent = data.hook[key];
  9452. var ours = hooks[key];
  9453. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  9454. }
  9455. }
  9456. function mergeHook$1 (a, b) {
  9457. // since all hooks have at most two args, use fixed args
  9458. // to avoid having to use fn.apply().
  9459. return function (_, __) {
  9460. a(_, __);
  9461. b(_, __);
  9462. }
  9463. }
  9464. /* */
  9465. // wrapper function for providing a more flexible interface
  9466. // without getting yelled at by flow
  9467. function createElement (
  9468. tag,
  9469. data,
  9470. children
  9471. ) {
  9472. if (data && (Array.isArray(data) || typeof data !== 'object')) {
  9473. children = data;
  9474. data = undefined;
  9475. }
  9476. // make sure to use real instance instead of proxy as context
  9477. return _createElement(this._self, tag, data, children)
  9478. }
  9479. function _createElement (
  9480. context,
  9481. tag,
  9482. data,
  9483. children
  9484. ) {
  9485. if (data && data.__ob__) {
  9486. process.env.NODE_ENV !== 'production' && warn(
  9487. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  9488. 'Always create fresh vnode data objects in each render!',
  9489. context
  9490. );
  9491. return
  9492. }
  9493. if (!tag) {
  9494. // in case of component :is set to falsy value
  9495. return emptyVNode()
  9496. }
  9497. if (typeof tag === 'string') {
  9498. var Ctor;
  9499. var ns = config.getTagNamespace(tag);
  9500. if (config.isReservedTag(tag)) {
  9501. // platform built-in elements
  9502. return new VNode(
  9503. tag, data, normalizeChildren(children, ns),
  9504. undefined, undefined, ns, context
  9505. )
  9506. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  9507. // component
  9508. return createComponent(Ctor, data, context, children, tag)
  9509. } else {
  9510. // unknown or unlisted namespaced elements
  9511. // check at runtime because it may get assigned a namespace when its
  9512. // parent normalizes children
  9513. return new VNode(
  9514. tag, data, normalizeChildren(children, ns),
  9515. undefined, undefined, ns, context
  9516. )
  9517. }
  9518. } else {
  9519. // direct component options / constructor
  9520. return createComponent(tag, data, context, children)
  9521. }
  9522. }
  9523. /* */
  9524. function initRender (vm) {
  9525. vm.$vnode = null; // the placeholder node in parent tree
  9526. vm._vnode = null; // the root of the child tree
  9527. vm._staticTrees = null;
  9528. vm._renderContext = vm.$options._parentVnode && vm.$options._parentVnode.context;
  9529. vm.$slots = resolveSlots(vm.$options._renderChildren, vm._renderContext);
  9530. // bind the public createElement fn to this instance
  9531. // so that we get proper render context inside it.
  9532. vm.$createElement = bind$1(createElement, vm);
  9533. if (vm.$options.el) {
  9534. vm.$mount(vm.$options.el);
  9535. }
  9536. }
  9537. function renderMixin (Vue) {
  9538. Vue.prototype.$nextTick = function (fn) {
  9539. nextTick(fn, this);
  9540. };
  9541. Vue.prototype._render = function () {
  9542. var vm = this;
  9543. var ref = vm.$options;
  9544. var render = ref.render;
  9545. var staticRenderFns = ref.staticRenderFns;
  9546. var _parentVnode = ref._parentVnode;
  9547. if (vm._isMounted) {
  9548. // clone slot nodes on re-renders
  9549. for (var key in vm.$slots) {
  9550. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  9551. }
  9552. }
  9553. if (staticRenderFns && !vm._staticTrees) {
  9554. vm._staticTrees = [];
  9555. }
  9556. // set parent vnode. this allows render functions to have access
  9557. // to the data on the placeholder node.
  9558. vm.$vnode = _parentVnode;
  9559. // render self
  9560. var vnode;
  9561. try {
  9562. vnode = render.call(vm._renderProxy, vm.$createElement);
  9563. } catch (e) {
  9564. if (process.env.NODE_ENV !== 'production') {
  9565. warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
  9566. }
  9567. /* istanbul ignore else */
  9568. if (config.errorHandler) {
  9569. config.errorHandler.call(null, e, vm);
  9570. } else {
  9571. if (config._isServer) {
  9572. throw e
  9573. } else {
  9574. setTimeout(function () { throw e }, 0);
  9575. }
  9576. }
  9577. // return previous vnode to prevent render error causing blank component
  9578. vnode = vm._vnode;
  9579. }
  9580. // return empty vnode in case the render function errored out
  9581. if (!(vnode instanceof VNode)) {
  9582. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  9583. warn(
  9584. 'Multiple root nodes returned from render function. Render function ' +
  9585. 'should return a single root node.',
  9586. vm
  9587. );
  9588. }
  9589. vnode = emptyVNode();
  9590. }
  9591. // set parent
  9592. vnode.parent = _parentVnode;
  9593. return vnode
  9594. };
  9595. // shorthands used in render functions
  9596. Vue.prototype._h = createElement;
  9597. // toString for mustaches
  9598. Vue.prototype._s = _toString;
  9599. // number conversion
  9600. Vue.prototype._n = toNumber;
  9601. // empty vnode
  9602. Vue.prototype._e = emptyVNode;
  9603. // loose equal
  9604. Vue.prototype._q = looseEqual;
  9605. // loose indexOf
  9606. Vue.prototype._i = looseIndexOf;
  9607. // render static tree by index
  9608. Vue.prototype._m = function renderStatic (
  9609. index,
  9610. isInFor
  9611. ) {
  9612. var tree = this._staticTrees[index];
  9613. // if has already-rendered static tree and not inside v-for,
  9614. // we can reuse the same tree by doing a shallow clone.
  9615. if (tree && !isInFor) {
  9616. return Array.isArray(tree)
  9617. ? cloneVNodes(tree)
  9618. : cloneVNode(tree)
  9619. }
  9620. // otherwise, render a fresh tree.
  9621. tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
  9622. if (Array.isArray(tree)) {
  9623. for (var i = 0; i < tree.length; i++) {
  9624. if (typeof tree[i] !== 'string') {
  9625. tree[i].isStatic = true;
  9626. tree[i].key = "__static__" + index + "_" + i;
  9627. }
  9628. }
  9629. } else {
  9630. tree.isStatic = true;
  9631. tree.key = "__static__" + index;
  9632. }
  9633. return tree
  9634. };
  9635. // filter resolution helper
  9636. var identity = function (_) { return _; };
  9637. Vue.prototype._f = function resolveFilter (id) {
  9638. return resolveAsset(this.$options, 'filters', id, true) || identity
  9639. };
  9640. // render v-for
  9641. Vue.prototype._l = function renderList (
  9642. val,
  9643. render
  9644. ) {
  9645. var ret, i, l, keys, key;
  9646. if (Array.isArray(val)) {
  9647. ret = new Array(val.length);
  9648. for (i = 0, l = val.length; i < l; i++) {
  9649. ret[i] = render(val[i], i);
  9650. }
  9651. } else if (typeof val === 'number') {
  9652. ret = new Array(val);
  9653. for (i = 0; i < val; i++) {
  9654. ret[i] = render(i + 1, i);
  9655. }
  9656. } else if (isObject(val)) {
  9657. keys = Object.keys(val);
  9658. ret = new Array(keys.length);
  9659. for (i = 0, l = keys.length; i < l; i++) {
  9660. key = keys[i];
  9661. ret[i] = render(val[key], key, i);
  9662. }
  9663. }
  9664. return ret
  9665. };
  9666. // renderSlot
  9667. Vue.prototype._t = function (
  9668. name,
  9669. fallback
  9670. ) {
  9671. var slotNodes = this.$slots[name];
  9672. // warn duplicate slot usage
  9673. if (slotNodes && process.env.NODE_ENV !== 'production') {
  9674. slotNodes._rendered && warn(
  9675. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  9676. "- this will likely cause render errors.",
  9677. this
  9678. );
  9679. slotNodes._rendered = true;
  9680. }
  9681. return slotNodes || fallback
  9682. };
  9683. // apply v-bind object
  9684. Vue.prototype._b = function bindProps (
  9685. data,
  9686. value,
  9687. asProp
  9688. ) {
  9689. if (value) {
  9690. if (!isObject(value)) {
  9691. process.env.NODE_ENV !== 'production' && warn(
  9692. 'v-bind without argument expects an Object or Array value',
  9693. this
  9694. );
  9695. } else {
  9696. if (Array.isArray(value)) {
  9697. value = toObject(value);
  9698. }
  9699. for (var key in value) {
  9700. if (key === 'class' || key === 'style') {
  9701. data[key] = value[key];
  9702. } else {
  9703. var hash = asProp || config.mustUseProp(key)
  9704. ? data.domProps || (data.domProps = {})
  9705. : data.attrs || (data.attrs = {});
  9706. hash[key] = value[key];
  9707. }
  9708. }
  9709. }
  9710. }
  9711. return data
  9712. };
  9713. // expose v-on keyCodes
  9714. Vue.prototype._k = function getKeyCodes (key) {
  9715. return config.keyCodes[key]
  9716. };
  9717. }
  9718. function resolveSlots (
  9719. renderChildren,
  9720. context
  9721. ) {
  9722. var slots = {};
  9723. if (!renderChildren) {
  9724. return slots
  9725. }
  9726. var children = normalizeChildren(renderChildren) || [];
  9727. var defaultSlot = [];
  9728. var name, child;
  9729. for (var i = 0, l = children.length; i < l; i++) {
  9730. child = children[i];
  9731. // named slots should only be respected if the vnode was rendered in the
  9732. // same context.
  9733. if ((child.context === context || child.functionalContext === context) &&
  9734. child.data && (name = child.data.slot)) {
  9735. var slot = (slots[name] || (slots[name] = []));
  9736. if (child.tag === 'template') {
  9737. slot.push.apply(slot, child.children);
  9738. } else {
  9739. slot.push(child);
  9740. }
  9741. } else {
  9742. defaultSlot.push(child);
  9743. }
  9744. }
  9745. // ignore single whitespace
  9746. if (defaultSlot.length && !(
  9747. defaultSlot.length === 1 &&
  9748. (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  9749. )) {
  9750. slots.default = defaultSlot;
  9751. }
  9752. return slots
  9753. }
  9754. /* */
  9755. function initEvents (vm) {
  9756. vm._events = Object.create(null);
  9757. // init parent attached events
  9758. var listeners = vm.$options._parentListeners;
  9759. var on = bind$1(vm.$on, vm);
  9760. var off = bind$1(vm.$off, vm);
  9761. vm._updateListeners = function (listeners, oldListeners) {
  9762. updateListeners(listeners, oldListeners || {}, on, off, vm);
  9763. };
  9764. if (listeners) {
  9765. vm._updateListeners(listeners);
  9766. }
  9767. }
  9768. function eventsMixin (Vue) {
  9769. Vue.prototype.$on = function (event, fn) {
  9770. var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
  9771. return vm
  9772. };
  9773. Vue.prototype.$once = function (event, fn) {
  9774. var vm = this;
  9775. function on () {
  9776. vm.$off(event, on);
  9777. fn.apply(vm, arguments);
  9778. }
  9779. on.fn = fn;
  9780. vm.$on(event, on);
  9781. return vm
  9782. };
  9783. Vue.prototype.$off = function (event, fn) {
  9784. var vm = this;
  9785. // all
  9786. if (!arguments.length) {
  9787. vm._events = Object.create(null);
  9788. return vm
  9789. }
  9790. // specific event
  9791. var cbs = vm._events[event];
  9792. if (!cbs) {
  9793. return vm
  9794. }
  9795. if (arguments.length === 1) {
  9796. vm._events[event] = null;
  9797. return vm
  9798. }
  9799. // specific handler
  9800. var cb;
  9801. var i = cbs.length;
  9802. while (i--) {
  9803. cb = cbs[i];
  9804. if (cb === fn || cb.fn === fn) {
  9805. cbs.splice(i, 1);
  9806. break
  9807. }
  9808. }
  9809. return vm
  9810. };
  9811. Vue.prototype.$emit = function (event) {
  9812. var vm = this;
  9813. var cbs = vm._events[event];
  9814. if (cbs) {
  9815. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  9816. var args = toArray(arguments, 1);
  9817. for (var i = 0, l = cbs.length; i < l; i++) {
  9818. cbs[i].apply(vm, args);
  9819. }
  9820. }
  9821. return vm
  9822. };
  9823. }
  9824. /* */
  9825. var uid = 0;
  9826. function initMixin (Vue) {
  9827. Vue.prototype._init = function (options) {
  9828. var vm = this;
  9829. // a uid
  9830. vm._uid = uid++;
  9831. // a flag to avoid this being observed
  9832. vm._isVue = true;
  9833. // merge options
  9834. if (options && options._isComponent) {
  9835. // optimize internal component instantiation
  9836. // since dynamic options merging is pretty slow, and none of the
  9837. // internal component options needs special treatment.
  9838. initInternalComponent(vm, options);
  9839. } else {
  9840. vm.$options = mergeOptions(
  9841. resolveConstructorOptions(vm),
  9842. options || {},
  9843. vm
  9844. );
  9845. }
  9846. /* istanbul ignore else */
  9847. if (process.env.NODE_ENV !== 'production') {
  9848. initProxy(vm);
  9849. } else {
  9850. vm._renderProxy = vm;
  9851. }
  9852. // expose real self
  9853. vm._self = vm;
  9854. initLifecycle(vm);
  9855. initEvents(vm);
  9856. callHook(vm, 'beforeCreate');
  9857. initState(vm);
  9858. callHook(vm, 'created');
  9859. initRender(vm);
  9860. };
  9861. function initInternalComponent (vm, options) {
  9862. var opts = vm.$options = Object.create(resolveConstructorOptions(vm));
  9863. // doing this because it's faster than dynamic enumeration.
  9864. opts.parent = options.parent;
  9865. opts.propsData = options.propsData;
  9866. opts._parentVnode = options._parentVnode;
  9867. opts._parentListeners = options._parentListeners;
  9868. opts._renderChildren = options._renderChildren;
  9869. opts._componentTag = options._componentTag;
  9870. if (options.render) {
  9871. opts.render = options.render;
  9872. opts.staticRenderFns = options.staticRenderFns;
  9873. }
  9874. }
  9875. function resolveConstructorOptions (vm) {
  9876. var Ctor = vm.constructor;
  9877. var options = Ctor.options;
  9878. if (Ctor.super) {
  9879. var superOptions = Ctor.super.options;
  9880. var cachedSuperOptions = Ctor.superOptions;
  9881. if (superOptions !== cachedSuperOptions) {
  9882. // super option changed
  9883. Ctor.superOptions = superOptions;
  9884. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  9885. if (options.name) {
  9886. options.components[options.name] = Ctor;
  9887. }
  9888. }
  9889. }
  9890. return options
  9891. }
  9892. }
  9893. function Vue$2 (options) {
  9894. if (process.env.NODE_ENV !== 'production' &&
  9895. !(this instanceof Vue$2)) {
  9896. warn('Vue is a constructor and should be called with the `new` keyword');
  9897. }
  9898. this._init(options);
  9899. }
  9900. initMixin(Vue$2);
  9901. stateMixin(Vue$2);
  9902. eventsMixin(Vue$2);
  9903. lifecycleMixin(Vue$2);
  9904. renderMixin(Vue$2);
  9905. var warn = noop;
  9906. var formatComponentName;
  9907. if (process.env.NODE_ENV !== 'production') {
  9908. var hasConsole = typeof console !== 'undefined';
  9909. warn = function (msg, vm) {
  9910. if (hasConsole && (!config.silent)) {
  9911. console.error("[Vue warn]: " + msg + " " + (
  9912. vm ? formatLocation(formatComponentName(vm)) : ''
  9913. ));
  9914. }
  9915. };
  9916. formatComponentName = function (vm) {
  9917. if (vm.$root === vm) {
  9918. return 'root instance'
  9919. }
  9920. var name = vm._isVue
  9921. ? vm.$options.name || vm.$options._componentTag
  9922. : vm.name;
  9923. return (
  9924. (name ? ("component <" + name + ">") : "anonymous component") +
  9925. (vm._isVue && vm.$options.__file ? (" at " + (vm.$options.__file)) : '')
  9926. )
  9927. };
  9928. var formatLocation = function (str) {
  9929. if (str === 'anonymous component') {
  9930. str += " - use the \"name\" option for better debugging messages.";
  9931. }
  9932. return ("\n(found in " + str + ")")
  9933. };
  9934. }
  9935. /* */
  9936. /**
  9937. * Option overwriting strategies are functions that handle
  9938. * how to merge a parent option value and a child option
  9939. * value into the final value.
  9940. */
  9941. var strats = config.optionMergeStrategies;
  9942. /**
  9943. * Options with restrictions
  9944. */
  9945. if (process.env.NODE_ENV !== 'production') {
  9946. strats.el = strats.propsData = function (parent, child, vm, key) {
  9947. if (!vm) {
  9948. warn(
  9949. "option \"" + key + "\" can only be used during instance " +
  9950. 'creation with the `new` keyword.'
  9951. );
  9952. }
  9953. return defaultStrat(parent, child)
  9954. };
  9955. }
  9956. /**
  9957. * Helper that recursively merges two data objects together.
  9958. */
  9959. function mergeData (to, from) {
  9960. var key, toVal, fromVal;
  9961. for (key in from) {
  9962. toVal = to[key];
  9963. fromVal = from[key];
  9964. if (!hasOwn(to, key)) {
  9965. set(to, key, fromVal);
  9966. } else if (isObject(toVal) && isObject(fromVal)) {
  9967. mergeData(toVal, fromVal);
  9968. }
  9969. }
  9970. return to
  9971. }
  9972. /**
  9973. * Data
  9974. */
  9975. strats.data = function (
  9976. parentVal,
  9977. childVal,
  9978. vm
  9979. ) {
  9980. if (!vm) {
  9981. // in a Vue.extend merge, both should be functions
  9982. if (!childVal) {
  9983. return parentVal
  9984. }
  9985. if (typeof childVal !== 'function') {
  9986. process.env.NODE_ENV !== 'production' && warn(
  9987. 'The "data" option should be a function ' +
  9988. 'that returns a per-instance value in component ' +
  9989. 'definitions.',
  9990. vm
  9991. );
  9992. return parentVal
  9993. }
  9994. if (!parentVal) {
  9995. return childVal
  9996. }
  9997. // when parentVal & childVal are both present,
  9998. // we need to return a function that returns the
  9999. // merged result of both functions... no need to
  10000. // check if parentVal is a function here because
  10001. // it has to be a function to pass previous merges.
  10002. return function mergedDataFn () {
  10003. return mergeData(
  10004. childVal.call(this),
  10005. parentVal.call(this)
  10006. )
  10007. }
  10008. } else if (parentVal || childVal) {
  10009. return function mergedInstanceDataFn () {
  10010. // instance merge
  10011. var instanceData = typeof childVal === 'function'
  10012. ? childVal.call(vm)
  10013. : childVal;
  10014. var defaultData = typeof parentVal === 'function'
  10015. ? parentVal.call(vm)
  10016. : undefined;
  10017. if (instanceData) {
  10018. return mergeData(instanceData, defaultData)
  10019. } else {
  10020. return defaultData
  10021. }
  10022. }
  10023. }
  10024. };
  10025. /**
  10026. * Hooks and param attributes are merged as arrays.
  10027. */
  10028. function mergeHook (
  10029. parentVal,
  10030. childVal
  10031. ) {
  10032. return childVal
  10033. ? parentVal
  10034. ? parentVal.concat(childVal)
  10035. : Array.isArray(childVal)
  10036. ? childVal
  10037. : [childVal]
  10038. : parentVal
  10039. }
  10040. config._lifecycleHooks.forEach(function (hook) {
  10041. strats[hook] = mergeHook;
  10042. });
  10043. /**
  10044. * Assets
  10045. *
  10046. * When a vm is present (instance creation), we need to do
  10047. * a three-way merge between constructor options, instance
  10048. * options and parent options.
  10049. */
  10050. function mergeAssets (parentVal, childVal) {
  10051. var res = Object.create(parentVal || null);
  10052. return childVal
  10053. ? extend(res, childVal)
  10054. : res
  10055. }
  10056. config._assetTypes.forEach(function (type) {
  10057. strats[type + 's'] = mergeAssets;
  10058. });
  10059. /**
  10060. * Watchers.
  10061. *
  10062. * Watchers hashes should not overwrite one
  10063. * another, so we merge them as arrays.
  10064. */
  10065. strats.watch = function (parentVal, childVal) {
  10066. /* istanbul ignore if */
  10067. if (!childVal) { return parentVal }
  10068. if (!parentVal) { return childVal }
  10069. var ret = {};
  10070. extend(ret, parentVal);
  10071. for (var key in childVal) {
  10072. var parent = ret[key];
  10073. var child = childVal[key];
  10074. if (parent && !Array.isArray(parent)) {
  10075. parent = [parent];
  10076. }
  10077. ret[key] = parent
  10078. ? parent.concat(child)
  10079. : [child];
  10080. }
  10081. return ret
  10082. };
  10083. /**
  10084. * Other object hashes.
  10085. */
  10086. strats.props =
  10087. strats.methods =
  10088. strats.computed = function (parentVal, childVal) {
  10089. if (!childVal) { return parentVal }
  10090. if (!parentVal) { return childVal }
  10091. var ret = Object.create(null);
  10092. extend(ret, parentVal);
  10093. extend(ret, childVal);
  10094. return ret
  10095. };
  10096. /**
  10097. * Default strategy.
  10098. */
  10099. var defaultStrat = function (parentVal, childVal) {
  10100. return childVal === undefined
  10101. ? parentVal
  10102. : childVal
  10103. };
  10104. /**
  10105. * Make sure component options get converted to actual
  10106. * constructors.
  10107. */
  10108. function normalizeComponents (options) {
  10109. if (options.components) {
  10110. var components = options.components;
  10111. var def;
  10112. for (var key in components) {
  10113. var lower = key.toLowerCase();
  10114. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  10115. process.env.NODE_ENV !== 'production' && warn(
  10116. 'Do not use built-in or reserved HTML elements as component ' +
  10117. 'id: ' + key
  10118. );
  10119. continue
  10120. }
  10121. def = components[key];
  10122. if (isPlainObject(def)) {
  10123. components[key] = Vue$2.extend(def);
  10124. }
  10125. }
  10126. }
  10127. }
  10128. /**
  10129. * Ensure all props option syntax are normalized into the
  10130. * Object-based format.
  10131. */
  10132. function normalizeProps (options) {
  10133. var props = options.props;
  10134. if (!props) { return }
  10135. var res = {};
  10136. var i, val, name;
  10137. if (Array.isArray(props)) {
  10138. i = props.length;
  10139. while (i--) {
  10140. val = props[i];
  10141. if (typeof val === 'string') {
  10142. name = camelize(val);
  10143. res[name] = { type: null };
  10144. } else if (process.env.NODE_ENV !== 'production') {
  10145. warn('props must be strings when using array syntax.');
  10146. }
  10147. }
  10148. } else if (isPlainObject(props)) {
  10149. for (var key in props) {
  10150. val = props[key];
  10151. name = camelize(key);
  10152. res[name] = isPlainObject(val)
  10153. ? val
  10154. : { type: val };
  10155. }
  10156. }
  10157. options.props = res;
  10158. }
  10159. /**
  10160. * Normalize raw function directives into object format.
  10161. */
  10162. function normalizeDirectives (options) {
  10163. var dirs = options.directives;
  10164. if (dirs) {
  10165. for (var key in dirs) {
  10166. var def = dirs[key];
  10167. if (typeof def === 'function') {
  10168. dirs[key] = { bind: def, update: def };
  10169. }
  10170. }
  10171. }
  10172. }
  10173. /**
  10174. * Merge two option objects into a new one.
  10175. * Core utility used in both instantiation and inheritance.
  10176. */
  10177. function mergeOptions (
  10178. parent,
  10179. child,
  10180. vm
  10181. ) {
  10182. normalizeComponents(child);
  10183. normalizeProps(child);
  10184. normalizeDirectives(child);
  10185. var extendsFrom = child.extends;
  10186. if (extendsFrom) {
  10187. parent = typeof extendsFrom === 'function'
  10188. ? mergeOptions(parent, extendsFrom.options, vm)
  10189. : mergeOptions(parent, extendsFrom, vm);
  10190. }
  10191. if (child.mixins) {
  10192. for (var i = 0, l = child.mixins.length; i < l; i++) {
  10193. var mixin = child.mixins[i];
  10194. if (mixin.prototype instanceof Vue$2) {
  10195. mixin = mixin.options;
  10196. }
  10197. parent = mergeOptions(parent, mixin, vm);
  10198. }
  10199. }
  10200. var options = {};
  10201. var key;
  10202. for (key in parent) {
  10203. mergeField(key);
  10204. }
  10205. for (key in child) {
  10206. if (!hasOwn(parent, key)) {
  10207. mergeField(key);
  10208. }
  10209. }
  10210. function mergeField (key) {
  10211. var strat = strats[key] || defaultStrat;
  10212. options[key] = strat(parent[key], child[key], vm, key);
  10213. }
  10214. return options
  10215. }
  10216. /**
  10217. * Resolve an asset.
  10218. * This function is used because child instances need access
  10219. * to assets defined in its ancestor chain.
  10220. */
  10221. function resolveAsset (
  10222. options,
  10223. type,
  10224. id,
  10225. warnMissing
  10226. ) {
  10227. /* istanbul ignore if */
  10228. if (typeof id !== 'string') {
  10229. return
  10230. }
  10231. var assets = options[type];
  10232. var res = assets[id] ||
  10233. // camelCase ID
  10234. assets[camelize(id)] ||
  10235. // Pascal Case ID
  10236. assets[capitalize(camelize(id))];
  10237. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  10238. warn(
  10239. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  10240. options
  10241. );
  10242. }
  10243. return res
  10244. }
  10245. /* */
  10246. function validateProp (
  10247. key,
  10248. propOptions,
  10249. propsData,
  10250. vm
  10251. ) {
  10252. var prop = propOptions[key];
  10253. var absent = !hasOwn(propsData, key);
  10254. var value = propsData[key];
  10255. // handle boolean props
  10256. if (isBooleanType(prop.type)) {
  10257. if (absent && !hasOwn(prop, 'default')) {
  10258. value = false;
  10259. } else if (value === '' || value === hyphenate(key)) {
  10260. value = true;
  10261. }
  10262. }
  10263. // check default value
  10264. if (value === undefined) {
  10265. value = getPropDefaultValue(vm, prop, key);
  10266. // since the default value is a fresh copy,
  10267. // make sure to observe it.
  10268. var prevShouldConvert = observerState.shouldConvert;
  10269. observerState.shouldConvert = true;
  10270. observe(value);
  10271. observerState.shouldConvert = prevShouldConvert;
  10272. }
  10273. if (process.env.NODE_ENV !== 'production') {
  10274. assertProp(prop, key, value, vm, absent);
  10275. }
  10276. return value
  10277. }
  10278. /**
  10279. * Get the default value of a prop.
  10280. */
  10281. function getPropDefaultValue (vm, prop, name) {
  10282. // no default, return undefined
  10283. if (!hasOwn(prop, 'default')) {
  10284. return undefined
  10285. }
  10286. var def = prop.default;
  10287. // warn against non-factory defaults for Object & Array
  10288. if (isObject(def)) {
  10289. process.env.NODE_ENV !== 'production' && warn(
  10290. 'Invalid default value for prop "' + name + '": ' +
  10291. 'Props with type Object/Array must use a factory function ' +
  10292. 'to return the default value.',
  10293. vm
  10294. );
  10295. }
  10296. // call factory function for non-Function types
  10297. return typeof def === 'function' && prop.type !== Function
  10298. ? def.call(vm)
  10299. : def
  10300. }
  10301. /**
  10302. * Assert whether a prop is valid.
  10303. */
  10304. function assertProp (
  10305. prop,
  10306. name,
  10307. value,
  10308. vm,
  10309. absent
  10310. ) {
  10311. if (prop.required && absent) {
  10312. warn(
  10313. 'Missing required prop: "' + name + '"',
  10314. vm
  10315. );
  10316. return
  10317. }
  10318. if (value == null && !prop.required) {
  10319. return
  10320. }
  10321. var type = prop.type;
  10322. var valid = !type || type === true;
  10323. var expectedTypes = [];
  10324. if (type) {
  10325. if (!Array.isArray(type)) {
  10326. type = [type];
  10327. }
  10328. for (var i = 0; i < type.length && !valid; i++) {
  10329. var assertedType = assertType(value, type[i]);
  10330. expectedTypes.push(assertedType.expectedType);
  10331. valid = assertedType.valid;
  10332. }
  10333. }
  10334. if (!valid) {
  10335. warn(
  10336. 'Invalid prop: type check failed for prop "' + name + '".' +
  10337. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  10338. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  10339. vm
  10340. );
  10341. return
  10342. }
  10343. var validator = prop.validator;
  10344. if (validator) {
  10345. if (!validator(value)) {
  10346. warn(
  10347. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  10348. vm
  10349. );
  10350. }
  10351. }
  10352. }
  10353. /**
  10354. * Assert the type of a value
  10355. */
  10356. function assertType (value, type) {
  10357. var valid;
  10358. var expectedType = getType(type);
  10359. if (expectedType === 'String') {
  10360. valid = typeof value === (expectedType = 'string');
  10361. } else if (expectedType === 'Number') {
  10362. valid = typeof value === (expectedType = 'number');
  10363. } else if (expectedType === 'Boolean') {
  10364. valid = typeof value === (expectedType = 'boolean');
  10365. } else if (expectedType === 'Function') {
  10366. valid = typeof value === (expectedType = 'function');
  10367. } else if (expectedType === 'Object') {
  10368. valid = isPlainObject(value);
  10369. } else if (expectedType === 'Array') {
  10370. valid = Array.isArray(value);
  10371. } else {
  10372. valid = value instanceof type;
  10373. }
  10374. return {
  10375. valid: valid,
  10376. expectedType: expectedType
  10377. }
  10378. }
  10379. /**
  10380. * Use function string name to check built-in types,
  10381. * because a simple equality check will fail when running
  10382. * across different vms / iframes.
  10383. */
  10384. function getType (fn) {
  10385. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  10386. return match && match[1]
  10387. }
  10388. function isBooleanType (fn) {
  10389. if (!Array.isArray(fn)) {
  10390. return getType(fn) === 'Boolean'
  10391. }
  10392. for (var i = 0, len = fn.length; i < len; i++) {
  10393. if (getType(fn[i]) === 'Boolean') {
  10394. return true
  10395. }
  10396. }
  10397. /* istanbul ignore next */
  10398. return false
  10399. }
  10400. var util = Object.freeze({
  10401. defineReactive: defineReactive$$1,
  10402. _toString: _toString,
  10403. toNumber: toNumber,
  10404. makeMap: makeMap,
  10405. isBuiltInTag: isBuiltInTag,
  10406. remove: remove$1,
  10407. hasOwn: hasOwn,
  10408. isPrimitive: isPrimitive,
  10409. cached: cached,
  10410. camelize: camelize,
  10411. capitalize: capitalize,
  10412. hyphenate: hyphenate,
  10413. bind: bind$1,
  10414. toArray: toArray,
  10415. extend: extend,
  10416. isObject: isObject,
  10417. isPlainObject: isPlainObject,
  10418. toObject: toObject,
  10419. noop: noop,
  10420. no: no,
  10421. genStaticKeys: genStaticKeys,
  10422. looseEqual: looseEqual,
  10423. looseIndexOf: looseIndexOf,
  10424. isReserved: isReserved,
  10425. def: def,
  10426. parsePath: parsePath,
  10427. hasProto: hasProto,
  10428. inBrowser: inBrowser,
  10429. UA: UA,
  10430. isIE: isIE,
  10431. isIE9: isIE9,
  10432. isEdge: isEdge,
  10433. isAndroid: isAndroid,
  10434. isIOS: isIOS,
  10435. devtools: devtools,
  10436. nextTick: nextTick,
  10437. get _Set () { return _Set; },
  10438. mergeOptions: mergeOptions,
  10439. resolveAsset: resolveAsset,
  10440. get warn () { return warn; },
  10441. get formatComponentName () { return formatComponentName; },
  10442. validateProp: validateProp
  10443. });
  10444. /* */
  10445. function initUse (Vue) {
  10446. Vue.use = function (plugin) {
  10447. /* istanbul ignore if */
  10448. if (plugin.installed) {
  10449. return
  10450. }
  10451. // additional parameters
  10452. var args = toArray(arguments, 1);
  10453. args.unshift(this);
  10454. if (typeof plugin.install === 'function') {
  10455. plugin.install.apply(plugin, args);
  10456. } else {
  10457. plugin.apply(null, args);
  10458. }
  10459. plugin.installed = true;
  10460. return this
  10461. };
  10462. }
  10463. /* */
  10464. function initMixin$1 (Vue) {
  10465. Vue.mixin = function (mixin) {
  10466. Vue.options = mergeOptions(Vue.options, mixin);
  10467. };
  10468. }
  10469. /* */
  10470. function initExtend (Vue) {
  10471. /**
  10472. * Each instance constructor, including Vue, has a unique
  10473. * cid. This enables us to create wrapped "child
  10474. * constructors" for prototypal inheritance and cache them.
  10475. */
  10476. Vue.cid = 0;
  10477. var cid = 1;
  10478. /**
  10479. * Class inheritance
  10480. */
  10481. Vue.extend = function (extendOptions) {
  10482. extendOptions = extendOptions || {};
  10483. var Super = this;
  10484. var isFirstExtend = Super.cid === 0;
  10485. if (isFirstExtend && extendOptions._Ctor) {
  10486. return extendOptions._Ctor
  10487. }
  10488. var name = extendOptions.name || Super.options.name;
  10489. if (process.env.NODE_ENV !== 'production') {
  10490. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  10491. warn(
  10492. 'Invalid component name: "' + name + '". Component names ' +
  10493. 'can only contain alphanumeric characaters and the hyphen.'
  10494. );
  10495. name = null;
  10496. }
  10497. }
  10498. var Sub = function VueComponent (options) {
  10499. this._init(options);
  10500. };
  10501. Sub.prototype = Object.create(Super.prototype);
  10502. Sub.prototype.constructor = Sub;
  10503. Sub.cid = cid++;
  10504. Sub.options = mergeOptions(
  10505. Super.options,
  10506. extendOptions
  10507. );
  10508. Sub['super'] = Super;
  10509. // allow further extension
  10510. Sub.extend = Super.extend;
  10511. // create asset registers, so extended classes
  10512. // can have their private assets too.
  10513. config._assetTypes.forEach(function (type) {
  10514. Sub[type] = Super[type];
  10515. });
  10516. // enable recursive self-lookup
  10517. if (name) {
  10518. Sub.options.components[name] = Sub;
  10519. }
  10520. // keep a reference to the super options at extension time.
  10521. // later at instantiation we can check if Super's options have
  10522. // been updated.
  10523. Sub.superOptions = Super.options;
  10524. Sub.extendOptions = extendOptions;
  10525. // cache constructor
  10526. if (isFirstExtend) {
  10527. extendOptions._Ctor = Sub;
  10528. }
  10529. return Sub
  10530. };
  10531. }
  10532. /* */
  10533. function initAssetRegisters (Vue) {
  10534. /**
  10535. * Create asset registration methods.
  10536. */
  10537. config._assetTypes.forEach(function (type) {
  10538. Vue[type] = function (
  10539. id,
  10540. definition
  10541. ) {
  10542. if (!definition) {
  10543. return this.options[type + 's'][id]
  10544. } else {
  10545. /* istanbul ignore if */
  10546. if (process.env.NODE_ENV !== 'production') {
  10547. if (type === 'component' && config.isReservedTag(id)) {
  10548. warn(
  10549. 'Do not use built-in or reserved HTML elements as component ' +
  10550. 'id: ' + id
  10551. );
  10552. }
  10553. }
  10554. if (type === 'component' && isPlainObject(definition)) {
  10555. definition.name = definition.name || id;
  10556. definition = Vue.extend(definition);
  10557. }
  10558. if (type === 'directive' && typeof definition === 'function') {
  10559. definition = { bind: definition, update: definition };
  10560. }
  10561. this.options[type + 's'][id] = definition;
  10562. return definition
  10563. }
  10564. };
  10565. });
  10566. }
  10567. var KeepAlive = {
  10568. name: 'keep-alive',
  10569. abstract: true,
  10570. created: function created () {
  10571. this.cache = Object.create(null);
  10572. },
  10573. render: function render () {
  10574. var vnode = getFirstComponentChild(this.$slots.default);
  10575. if (vnode && vnode.componentOptions) {
  10576. var opts = vnode.componentOptions;
  10577. var key = vnode.key == null
  10578. // same constructor may get registered as different local components
  10579. // so cid alone is not enough (#3269)
  10580. ? opts.Ctor.cid + '::' + opts.tag
  10581. : vnode.key;
  10582. if (this.cache[key]) {
  10583. vnode.child = this.cache[key].child;
  10584. } else {
  10585. this.cache[key] = vnode;
  10586. }
  10587. vnode.data.keepAlive = true;
  10588. }
  10589. return vnode
  10590. },
  10591. destroyed: function destroyed () {
  10592. var this$1 = this;
  10593. for (var key in this.cache) {
  10594. var vnode = this$1.cache[key];
  10595. callHook(vnode.child, 'deactivated');
  10596. vnode.child.$destroy();
  10597. }
  10598. }
  10599. };
  10600. var builtInComponents = {
  10601. KeepAlive: KeepAlive
  10602. };
  10603. /* */
  10604. function initGlobalAPI (Vue) {
  10605. // config
  10606. var configDef = {};
  10607. configDef.get = function () { return config; };
  10608. if (process.env.NODE_ENV !== 'production') {
  10609. configDef.set = function () {
  10610. warn(
  10611. 'Do not replace the Vue.config object, set individual fields instead.'
  10612. );
  10613. };
  10614. }
  10615. Object.defineProperty(Vue, 'config', configDef);
  10616. Vue.util = util;
  10617. Vue.set = set;
  10618. Vue.delete = del;
  10619. Vue.nextTick = nextTick;
  10620. Vue.options = Object.create(null);
  10621. config._assetTypes.forEach(function (type) {
  10622. Vue.options[type + 's'] = Object.create(null);
  10623. });
  10624. extend(Vue.options.components, builtInComponents);
  10625. initUse(Vue);
  10626. initMixin$1(Vue);
  10627. initExtend(Vue);
  10628. initAssetRegisters(Vue);
  10629. }
  10630. initGlobalAPI(Vue$2);
  10631. Object.defineProperty(Vue$2.prototype, '$isServer', {
  10632. get: function () { return config._isServer; }
  10633. });
  10634. Vue$2.version = '2.0.3';
  10635. /* */
  10636. // attributes that should be using props for binding
  10637. var mustUseProp = makeMap('value,selected,checked,muted');
  10638. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  10639. var isBooleanAttr = makeMap(
  10640. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  10641. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  10642. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  10643. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  10644. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  10645. 'truespeed,typemustmatch,visible'
  10646. );
  10647. var isAttr = makeMap(
  10648. 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  10649. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  10650. 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
  10651. 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  10652. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
  10653. 'form,formaction,headers,<th>,height,hidden,high,href,hreflang,http-equiv,' +
  10654. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  10655. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  10656. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  10657. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  10658. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  10659. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  10660. 'target,title,type,usemap,value,width,wrap'
  10661. );
  10662. var xlinkNS = 'http://www.w3.org/1999/xlink';
  10663. var isXlink = function (name) {
  10664. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  10665. };
  10666. var getXlinkProp = function (name) {
  10667. return isXlink(name) ? name.slice(6, name.length) : ''
  10668. };
  10669. var isFalsyAttrValue = function (val) {
  10670. return val == null || val === false
  10671. };
  10672. /* */
  10673. function genClassForVnode (vnode) {
  10674. var data = vnode.data;
  10675. var parentNode = vnode;
  10676. var childNode = vnode;
  10677. while (childNode.child) {
  10678. childNode = childNode.child._vnode;
  10679. if (childNode.data) {
  10680. data = mergeClassData(childNode.data, data);
  10681. }
  10682. }
  10683. while ((parentNode = parentNode.parent)) {
  10684. if (parentNode.data) {
  10685. data = mergeClassData(data, parentNode.data);
  10686. }
  10687. }
  10688. return genClassFromData(data)
  10689. }
  10690. function mergeClassData (child, parent) {
  10691. return {
  10692. staticClass: concat(child.staticClass, parent.staticClass),
  10693. class: child.class
  10694. ? [child.class, parent.class]
  10695. : parent.class
  10696. }
  10697. }
  10698. function genClassFromData (data) {
  10699. var dynamicClass = data.class;
  10700. var staticClass = data.staticClass;
  10701. if (staticClass || dynamicClass) {
  10702. return concat(staticClass, stringifyClass(dynamicClass))
  10703. }
  10704. /* istanbul ignore next */
  10705. return ''
  10706. }
  10707. function concat (a, b) {
  10708. return a ? b ? (a + ' ' + b) : a : (b || '')
  10709. }
  10710. function stringifyClass (value) {
  10711. var res = '';
  10712. if (!value) {
  10713. return res
  10714. }
  10715. if (typeof value === 'string') {
  10716. return value
  10717. }
  10718. if (Array.isArray(value)) {
  10719. var stringified;
  10720. for (var i = 0, l = value.length; i < l; i++) {
  10721. if (value[i]) {
  10722. if ((stringified = stringifyClass(value[i]))) {
  10723. res += stringified + ' ';
  10724. }
  10725. }
  10726. }
  10727. return res.slice(0, -1)
  10728. }
  10729. if (isObject(value)) {
  10730. for (var key in value) {
  10731. if (value[key]) { res += key + ' '; }
  10732. }
  10733. return res.slice(0, -1)
  10734. }
  10735. /* istanbul ignore next */
  10736. return res
  10737. }
  10738. /* */
  10739. var namespaceMap = {
  10740. svg: 'http://www.w3.org/2000/svg',
  10741. math: 'http://www.w3.org/1998/Math/MathML'
  10742. };
  10743. var isHTMLTag = makeMap(
  10744. 'html,body,base,head,link,meta,style,title,' +
  10745. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  10746. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  10747. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  10748. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  10749. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  10750. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  10751. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  10752. 'output,progress,select,textarea,' +
  10753. 'details,dialog,menu,menuitem,summary,' +
  10754. 'content,element,shadow,template'
  10755. );
  10756. var isUnaryTag = makeMap(
  10757. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  10758. 'link,meta,param,source,track,wbr',
  10759. true
  10760. );
  10761. // Elements that you can, intentionally, leave open
  10762. // (and which close themselves)
  10763. var canBeLeftOpenTag = makeMap(
  10764. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  10765. true
  10766. );
  10767. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  10768. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  10769. var isNonPhrasingTag = makeMap(
  10770. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  10771. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  10772. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  10773. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  10774. 'title,tr,track',
  10775. true
  10776. );
  10777. // this map is intentionally selective, only covering SVG elements that may
  10778. // contain child elements.
  10779. var isSVG = makeMap(
  10780. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,' +
  10781. 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  10782. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  10783. true
  10784. );
  10785. var isReservedTag = function (tag) {
  10786. return isHTMLTag(tag) || isSVG(tag)
  10787. };
  10788. function getTagNamespace (tag) {
  10789. if (isSVG(tag)) {
  10790. return 'svg'
  10791. }
  10792. // basic support for MathML
  10793. // note it doesn't support other MathML elements being component roots
  10794. if (tag === 'math') {
  10795. return 'math'
  10796. }
  10797. }
  10798. var unknownElementCache = Object.create(null);
  10799. function isUnknownElement (tag) {
  10800. /* istanbul ignore if */
  10801. if (!inBrowser) {
  10802. return true
  10803. }
  10804. if (isReservedTag(tag)) {
  10805. return false
  10806. }
  10807. tag = tag.toLowerCase();
  10808. /* istanbul ignore if */
  10809. if (unknownElementCache[tag] != null) {
  10810. return unknownElementCache[tag]
  10811. }
  10812. var el = document.createElement(tag);
  10813. if (tag.indexOf('-') > -1) {
  10814. // http://stackoverflow.com/a/28210364/1070244
  10815. return (unknownElementCache[tag] = (
  10816. el.constructor === window.HTMLUnknownElement ||
  10817. el.constructor === window.HTMLElement
  10818. ))
  10819. } else {
  10820. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  10821. }
  10822. }
  10823. /* */
  10824. /**
  10825. * Query an element selector if it's not an element already.
  10826. */
  10827. function query (el) {
  10828. if (typeof el === 'string') {
  10829. var selector = el;
  10830. el = document.querySelector(el);
  10831. if (!el) {
  10832. process.env.NODE_ENV !== 'production' && warn(
  10833. 'Cannot find element: ' + selector
  10834. );
  10835. return document.createElement('div')
  10836. }
  10837. }
  10838. return el
  10839. }
  10840. /* */
  10841. function createElement$1 (tagName, vnode) {
  10842. var elm = document.createElement(tagName);
  10843. if (tagName !== 'select') {
  10844. return elm
  10845. }
  10846. if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) {
  10847. elm.setAttribute('multiple', 'multiple');
  10848. }
  10849. return elm
  10850. }
  10851. function createElementNS (namespace, tagName) {
  10852. return document.createElementNS(namespaceMap[namespace], tagName)
  10853. }
  10854. function createTextNode (text) {
  10855. return document.createTextNode(text)
  10856. }
  10857. function createComment (text) {
  10858. return document.createComment(text)
  10859. }
  10860. function insertBefore (parentNode, newNode, referenceNode) {
  10861. parentNode.insertBefore(newNode, referenceNode);
  10862. }
  10863. function removeChild (node, child) {
  10864. node.removeChild(child);
  10865. }
  10866. function appendChild (node, child) {
  10867. node.appendChild(child);
  10868. }
  10869. function parentNode (node) {
  10870. return node.parentNode
  10871. }
  10872. function nextSibling (node) {
  10873. return node.nextSibling
  10874. }
  10875. function tagName (node) {
  10876. return node.tagName
  10877. }
  10878. function setTextContent (node, text) {
  10879. node.textContent = text;
  10880. }
  10881. function childNodes (node) {
  10882. return node.childNodes
  10883. }
  10884. function setAttribute (node, key, val) {
  10885. node.setAttribute(key, val);
  10886. }
  10887. var nodeOps = Object.freeze({
  10888. createElement: createElement$1,
  10889. createElementNS: createElementNS,
  10890. createTextNode: createTextNode,
  10891. createComment: createComment,
  10892. insertBefore: insertBefore,
  10893. removeChild: removeChild,
  10894. appendChild: appendChild,
  10895. parentNode: parentNode,
  10896. nextSibling: nextSibling,
  10897. tagName: tagName,
  10898. setTextContent: setTextContent,
  10899. childNodes: childNodes,
  10900. setAttribute: setAttribute
  10901. });
  10902. /* */
  10903. var ref = {
  10904. create: function create (_, vnode) {
  10905. registerRef(vnode);
  10906. },
  10907. update: function update (oldVnode, vnode) {
  10908. if (oldVnode.data.ref !== vnode.data.ref) {
  10909. registerRef(oldVnode, true);
  10910. registerRef(vnode);
  10911. }
  10912. },
  10913. destroy: function destroy (vnode) {
  10914. registerRef(vnode, true);
  10915. }
  10916. };
  10917. function registerRef (vnode, isRemoval) {
  10918. var key = vnode.data.ref;
  10919. if (!key) { return }
  10920. var vm = vnode.context;
  10921. var ref = vnode.child || vnode.elm;
  10922. var refs = vm.$refs;
  10923. if (isRemoval) {
  10924. if (Array.isArray(refs[key])) {
  10925. remove$1(refs[key], ref);
  10926. } else if (refs[key] === ref) {
  10927. refs[key] = undefined;
  10928. }
  10929. } else {
  10930. if (vnode.data.refInFor) {
  10931. if (Array.isArray(refs[key])) {
  10932. refs[key].push(ref);
  10933. } else {
  10934. refs[key] = [ref];
  10935. }
  10936. } else {
  10937. refs[key] = ref;
  10938. }
  10939. }
  10940. }
  10941. /**
  10942. * Virtual DOM patching algorithm based on Snabbdom by
  10943. * Simon Friis Vindum (@paldepind)
  10944. * Licensed under the MIT License
  10945. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  10946. *
  10947. * modified by Evan You (@yyx990803)
  10948. *
  10949. /*
  10950. * Not type-checking this because this file is perf-critical and the cost
  10951. * of making flow understand it is not worth it.
  10952. */
  10953. var emptyNode = new VNode('', {}, []);
  10954. var hooks$1 = ['create', 'update', 'remove', 'destroy'];
  10955. function isUndef (s) {
  10956. return s == null
  10957. }
  10958. function isDef (s) {
  10959. return s != null
  10960. }
  10961. function sameVnode (vnode1, vnode2) {
  10962. return (
  10963. vnode1.key === vnode2.key &&
  10964. vnode1.tag === vnode2.tag &&
  10965. vnode1.isComment === vnode2.isComment &&
  10966. !vnode1.data === !vnode2.data
  10967. )
  10968. }
  10969. function createKeyToOldIdx (children, beginIdx, endIdx) {
  10970. var i, key;
  10971. var map = {};
  10972. for (i = beginIdx; i <= endIdx; ++i) {
  10973. key = children[i].key;
  10974. if (isDef(key)) { map[key] = i; }
  10975. }
  10976. return map
  10977. }
  10978. function createPatchFunction (backend) {
  10979. var i, j;
  10980. var cbs = {};
  10981. var modules = backend.modules;
  10982. var nodeOps = backend.nodeOps;
  10983. for (i = 0; i < hooks$1.length; ++i) {
  10984. cbs[hooks$1[i]] = [];
  10985. for (j = 0; j < modules.length; ++j) {
  10986. if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
  10987. }
  10988. }
  10989. function emptyNodeAt (elm) {
  10990. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  10991. }
  10992. function createRmCb (childElm, listeners) {
  10993. function remove$$1 () {
  10994. if (--remove$$1.listeners === 0) {
  10995. removeElement(childElm);
  10996. }
  10997. }
  10998. remove$$1.listeners = listeners;
  10999. return remove$$1
  11000. }
  11001. function removeElement (el) {
  11002. var parent = nodeOps.parentNode(el);
  11003. nodeOps.removeChild(parent, el);
  11004. }
  11005. function createElm (vnode, insertedVnodeQueue, nested) {
  11006. var i;
  11007. var data = vnode.data;
  11008. vnode.isRootInsert = !nested;
  11009. if (isDef(data)) {
  11010. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode); }
  11011. // after calling the init hook, if the vnode is a child component
  11012. // it should've created a child instance and mounted it. the child
  11013. // component also has set the placeholder vnode's elm.
  11014. // in that case we can just return the element and be done.
  11015. if (isDef(i = vnode.child)) {
  11016. initComponent(vnode, insertedVnodeQueue);
  11017. return vnode.elm
  11018. }
  11019. }
  11020. var children = vnode.children;
  11021. var tag = vnode.tag;
  11022. if (isDef(tag)) {
  11023. if (process.env.NODE_ENV !== 'production') {
  11024. if (
  11025. !vnode.ns &&
  11026. !(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
  11027. config.isUnknownElement(tag)
  11028. ) {
  11029. warn(
  11030. 'Unknown custom element: <' + tag + '> - did you ' +
  11031. 'register the component correctly? For recursive components, ' +
  11032. 'make sure to provide the "name" option.',
  11033. vnode.context
  11034. );
  11035. }
  11036. }
  11037. vnode.elm = vnode.ns
  11038. ? nodeOps.createElementNS(vnode.ns, tag)
  11039. : nodeOps.createElement(tag, vnode);
  11040. setScope(vnode);
  11041. createChildren(vnode, children, insertedVnodeQueue);
  11042. if (isDef(data)) {
  11043. invokeCreateHooks(vnode, insertedVnodeQueue);
  11044. }
  11045. } else if (vnode.isComment) {
  11046. vnode.elm = nodeOps.createComment(vnode.text);
  11047. } else {
  11048. vnode.elm = nodeOps.createTextNode(vnode.text);
  11049. }
  11050. return vnode.elm
  11051. }
  11052. function createChildren (vnode, children, insertedVnodeQueue) {
  11053. if (Array.isArray(children)) {
  11054. for (var i = 0; i < children.length; ++i) {
  11055. nodeOps.appendChild(vnode.elm, createElm(children[i], insertedVnodeQueue, true));
  11056. }
  11057. } else if (isPrimitive(vnode.text)) {
  11058. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  11059. }
  11060. }
  11061. function isPatchable (vnode) {
  11062. while (vnode.child) {
  11063. vnode = vnode.child._vnode;
  11064. }
  11065. return isDef(vnode.tag)
  11066. }
  11067. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  11068. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  11069. cbs.create[i$1](emptyNode, vnode);
  11070. }
  11071. i = vnode.data.hook; // Reuse variable
  11072. if (isDef(i)) {
  11073. if (i.create) { i.create(emptyNode, vnode); }
  11074. if (i.insert) { insertedVnodeQueue.push(vnode); }
  11075. }
  11076. }
  11077. function initComponent (vnode, insertedVnodeQueue) {
  11078. if (vnode.data.pendingInsert) {
  11079. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  11080. }
  11081. vnode.elm = vnode.child.$el;
  11082. if (isPatchable(vnode)) {
  11083. invokeCreateHooks(vnode, insertedVnodeQueue);
  11084. setScope(vnode);
  11085. } else {
  11086. // empty component root.
  11087. // skip all element-related modules except for ref (#3455)
  11088. registerRef(vnode);
  11089. // make sure to invoke the insert hook
  11090. insertedVnodeQueue.push(vnode);
  11091. }
  11092. }
  11093. // set scope id attribute for scoped CSS.
  11094. // this is implemented as a special case to avoid the overhead
  11095. // of going through the normal attribute patching process.
  11096. function setScope (vnode) {
  11097. var i;
  11098. if (isDef(i = vnode.context) && isDef(i = i.$options._scopeId)) {
  11099. nodeOps.setAttribute(vnode.elm, i, '');
  11100. }
  11101. if (isDef(i = activeInstance) &&
  11102. i !== vnode.context &&
  11103. isDef(i = i.$options._scopeId)) {
  11104. nodeOps.setAttribute(vnode.elm, i, '');
  11105. }
  11106. }
  11107. function addVnodes (parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  11108. for (; startIdx <= endIdx; ++startIdx) {
  11109. nodeOps.insertBefore(parentElm, createElm(vnodes[startIdx], insertedVnodeQueue), before);
  11110. }
  11111. }
  11112. function invokeDestroyHook (vnode) {
  11113. var i, j;
  11114. var data = vnode.data;
  11115. if (isDef(data)) {
  11116. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  11117. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  11118. }
  11119. if (isDef(i = vnode.children)) {
  11120. for (j = 0; j < vnode.children.length; ++j) {
  11121. invokeDestroyHook(vnode.children[j]);
  11122. }
  11123. }
  11124. }
  11125. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  11126. for (; startIdx <= endIdx; ++startIdx) {
  11127. var ch = vnodes[startIdx];
  11128. if (isDef(ch)) {
  11129. if (isDef(ch.tag)) {
  11130. removeAndInvokeRemoveHook(ch);
  11131. invokeDestroyHook(ch);
  11132. } else { // Text node
  11133. nodeOps.removeChild(parentElm, ch.elm);
  11134. }
  11135. }
  11136. }
  11137. }
  11138. function removeAndInvokeRemoveHook (vnode, rm) {
  11139. if (rm || isDef(vnode.data)) {
  11140. var listeners = cbs.remove.length + 1;
  11141. if (!rm) {
  11142. // directly removing
  11143. rm = createRmCb(vnode.elm, listeners);
  11144. } else {
  11145. // we have a recursively passed down rm callback
  11146. // increase the listeners count
  11147. rm.listeners += listeners;
  11148. }
  11149. // recursively invoke hooks on child component root node
  11150. if (isDef(i = vnode.child) && isDef(i = i._vnode) && isDef(i.data)) {
  11151. removeAndInvokeRemoveHook(i, rm);
  11152. }
  11153. for (i = 0; i < cbs.remove.length; ++i) {
  11154. cbs.remove[i](vnode, rm);
  11155. }
  11156. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  11157. i(vnode, rm);
  11158. } else {
  11159. rm();
  11160. }
  11161. } else {
  11162. removeElement(vnode.elm);
  11163. }
  11164. }
  11165. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  11166. var oldStartIdx = 0;
  11167. var newStartIdx = 0;
  11168. var oldEndIdx = oldCh.length - 1;
  11169. var oldStartVnode = oldCh[0];
  11170. var oldEndVnode = oldCh[oldEndIdx];
  11171. var newEndIdx = newCh.length - 1;
  11172. var newStartVnode = newCh[0];
  11173. var newEndVnode = newCh[newEndIdx];
  11174. var oldKeyToIdx, idxInOld, elmToMove, before;
  11175. // removeOnly is a special flag used only by <transition-group>
  11176. // to ensure removed elements stay in correct relative positions
  11177. // during leaving transitions
  11178. var canMove = !removeOnly;
  11179. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  11180. if (isUndef(oldStartVnode)) {
  11181. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  11182. } else if (isUndef(oldEndVnode)) {
  11183. oldEndVnode = oldCh[--oldEndIdx];
  11184. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  11185. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  11186. oldStartVnode = oldCh[++oldStartIdx];
  11187. newStartVnode = newCh[++newStartIdx];
  11188. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  11189. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  11190. oldEndVnode = oldCh[--oldEndIdx];
  11191. newEndVnode = newCh[--newEndIdx];
  11192. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  11193. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  11194. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  11195. oldStartVnode = oldCh[++oldStartIdx];
  11196. newEndVnode = newCh[--newEndIdx];
  11197. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  11198. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  11199. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  11200. oldEndVnode = oldCh[--oldEndIdx];
  11201. newStartVnode = newCh[++newStartIdx];
  11202. } else {
  11203. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  11204. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  11205. if (isUndef(idxInOld)) { // New element
  11206. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11207. newStartVnode = newCh[++newStartIdx];
  11208. } else {
  11209. elmToMove = oldCh[idxInOld];
  11210. /* istanbul ignore if */
  11211. if (process.env.NODE_ENV !== 'production' && !elmToMove) {
  11212. warn(
  11213. 'It seems there are duplicate keys that is causing an update error. ' +
  11214. 'Make sure each v-for item has a unique key.'
  11215. );
  11216. }
  11217. if (elmToMove.tag !== newStartVnode.tag) {
  11218. // same key but different element. treat as new element
  11219. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11220. newStartVnode = newCh[++newStartIdx];
  11221. } else {
  11222. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  11223. oldCh[idxInOld] = undefined;
  11224. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  11225. newStartVnode = newCh[++newStartIdx];
  11226. }
  11227. }
  11228. }
  11229. }
  11230. if (oldStartIdx > oldEndIdx) {
  11231. before = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  11232. addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  11233. } else if (newStartIdx > newEndIdx) {
  11234. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  11235. }
  11236. }
  11237. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  11238. if (oldVnode === vnode) {
  11239. return
  11240. }
  11241. // reuse element for static trees.
  11242. // note we only do this if the vnode is cloned -
  11243. // if the new node is not cloned it means the render functions have been
  11244. // reset by the hot-reload-api and we need to do a proper re-render.
  11245. if (vnode.isStatic &&
  11246. oldVnode.isStatic &&
  11247. vnode.key === oldVnode.key &&
  11248. vnode.isCloned) {
  11249. vnode.elm = oldVnode.elm;
  11250. return
  11251. }
  11252. var i;
  11253. var data = vnode.data;
  11254. var hasData = isDef(data);
  11255. if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  11256. i(oldVnode, vnode);
  11257. }
  11258. var elm = vnode.elm = oldVnode.elm;
  11259. var oldCh = oldVnode.children;
  11260. var ch = vnode.children;
  11261. if (hasData && isPatchable(vnode)) {
  11262. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  11263. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  11264. }
  11265. if (isUndef(vnode.text)) {
  11266. if (isDef(oldCh) && isDef(ch)) {
  11267. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  11268. } else if (isDef(ch)) {
  11269. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  11270. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  11271. } else if (isDef(oldCh)) {
  11272. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  11273. } else if (isDef(oldVnode.text)) {
  11274. nodeOps.setTextContent(elm, '');
  11275. }
  11276. } else if (oldVnode.text !== vnode.text) {
  11277. nodeOps.setTextContent(elm, vnode.text);
  11278. }
  11279. if (hasData) {
  11280. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  11281. }
  11282. }
  11283. function invokeInsertHook (vnode, queue, initial) {
  11284. // delay insert hooks for component root nodes, invoke them after the
  11285. // element is really inserted
  11286. if (initial && vnode.parent) {
  11287. vnode.parent.data.pendingInsert = queue;
  11288. } else {
  11289. for (var i = 0; i < queue.length; ++i) {
  11290. queue[i].data.hook.insert(queue[i]);
  11291. }
  11292. }
  11293. }
  11294. var bailed = false;
  11295. function hydrate (elm, vnode, insertedVnodeQueue) {
  11296. if (process.env.NODE_ENV !== 'production') {
  11297. if (!assertNodeMatch(elm, vnode)) {
  11298. return false
  11299. }
  11300. }
  11301. vnode.elm = elm;
  11302. var tag = vnode.tag;
  11303. var data = vnode.data;
  11304. var children = vnode.children;
  11305. if (isDef(data)) {
  11306. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  11307. if (isDef(i = vnode.child)) {
  11308. // child component. it should have hydrated its own tree.
  11309. initComponent(vnode, insertedVnodeQueue);
  11310. return true
  11311. }
  11312. }
  11313. if (isDef(tag)) {
  11314. if (isDef(children)) {
  11315. var childNodes = nodeOps.childNodes(elm);
  11316. // empty element, allow client to pick up and populate children
  11317. if (!childNodes.length) {
  11318. createChildren(vnode, children, insertedVnodeQueue);
  11319. } else {
  11320. var childrenMatch = true;
  11321. if (childNodes.length !== children.length) {
  11322. childrenMatch = false;
  11323. } else {
  11324. for (var i$1 = 0; i$1 < children.length; i$1++) {
  11325. if (!hydrate(childNodes[i$1], children[i$1], insertedVnodeQueue)) {
  11326. childrenMatch = false;
  11327. break
  11328. }
  11329. }
  11330. }
  11331. if (!childrenMatch) {
  11332. if (process.env.NODE_ENV !== 'production' &&
  11333. typeof console !== 'undefined' &&
  11334. !bailed) {
  11335. bailed = true;
  11336. console.warn('Parent: ', elm);
  11337. console.warn('Mismatching childNodes vs. VNodes: ', childNodes, children);
  11338. }
  11339. return false
  11340. }
  11341. }
  11342. }
  11343. if (isDef(data)) {
  11344. invokeCreateHooks(vnode, insertedVnodeQueue);
  11345. }
  11346. }
  11347. return true
  11348. }
  11349. function assertNodeMatch (node, vnode) {
  11350. if (vnode.tag) {
  11351. return (
  11352. vnode.tag.indexOf('vue-component') === 0 ||
  11353. vnode.tag === nodeOps.tagName(node).toLowerCase()
  11354. )
  11355. } else {
  11356. return _toString(vnode.text) === node.data
  11357. }
  11358. }
  11359. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  11360. if (!vnode) {
  11361. if (oldVnode) { invokeDestroyHook(oldVnode); }
  11362. return
  11363. }
  11364. var elm, parent;
  11365. var isInitialPatch = false;
  11366. var insertedVnodeQueue = [];
  11367. if (!oldVnode) {
  11368. // empty mount, create new root element
  11369. isInitialPatch = true;
  11370. createElm(vnode, insertedVnodeQueue);
  11371. } else {
  11372. var isRealElement = isDef(oldVnode.nodeType);
  11373. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  11374. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  11375. } else {
  11376. if (isRealElement) {
  11377. // mounting to a real element
  11378. // check if this is server-rendered content and if we can perform
  11379. // a successful hydration.
  11380. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  11381. oldVnode.removeAttribute('server-rendered');
  11382. hydrating = true;
  11383. }
  11384. if (hydrating) {
  11385. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  11386. invokeInsertHook(vnode, insertedVnodeQueue, true);
  11387. return oldVnode
  11388. } else if (process.env.NODE_ENV !== 'production') {
  11389. warn(
  11390. 'The client-side rendered virtual DOM tree is not matching ' +
  11391. 'server-rendered content. This is likely caused by incorrect ' +
  11392. 'HTML markup, for example nesting block-level elements inside ' +
  11393. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  11394. 'full client-side render.'
  11395. );
  11396. }
  11397. }
  11398. // either not server-rendered, or hydration failed.
  11399. // create an empty node and replace it
  11400. oldVnode = emptyNodeAt(oldVnode);
  11401. }
  11402. elm = oldVnode.elm;
  11403. parent = nodeOps.parentNode(elm);
  11404. createElm(vnode, insertedVnodeQueue);
  11405. // component root element replaced.
  11406. // update parent placeholder node element.
  11407. if (vnode.parent) {
  11408. vnode.parent.elm = vnode.elm;
  11409. if (isPatchable(vnode)) {
  11410. for (var i = 0; i < cbs.create.length; ++i) {
  11411. cbs.create[i](emptyNode, vnode.parent);
  11412. }
  11413. }
  11414. }
  11415. if (parent !== null) {
  11416. nodeOps.insertBefore(parent, vnode.elm, nodeOps.nextSibling(elm));
  11417. removeVnodes(parent, [oldVnode], 0, 0);
  11418. } else if (isDef(oldVnode.tag)) {
  11419. invokeDestroyHook(oldVnode);
  11420. }
  11421. }
  11422. }
  11423. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  11424. return vnode.elm
  11425. }
  11426. }
  11427. /* */
  11428. var directives = {
  11429. create: updateDirectives,
  11430. update: updateDirectives,
  11431. destroy: function unbindDirectives (vnode) {
  11432. updateDirectives(vnode, emptyNode);
  11433. }
  11434. };
  11435. function updateDirectives (
  11436. oldVnode,
  11437. vnode
  11438. ) {
  11439. if (!oldVnode.data.directives && !vnode.data.directives) {
  11440. return
  11441. }
  11442. var isCreate = oldVnode === emptyNode;
  11443. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  11444. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  11445. var dirsWithInsert = [];
  11446. var dirsWithPostpatch = [];
  11447. var key, oldDir, dir;
  11448. for (key in newDirs) {
  11449. oldDir = oldDirs[key];
  11450. dir = newDirs[key];
  11451. if (!oldDir) {
  11452. // new directive, bind
  11453. callHook$1(dir, 'bind', vnode, oldVnode);
  11454. if (dir.def && dir.def.inserted) {
  11455. dirsWithInsert.push(dir);
  11456. }
  11457. } else {
  11458. // existing directive, update
  11459. dir.oldValue = oldDir.value;
  11460. callHook$1(dir, 'update', vnode, oldVnode);
  11461. if (dir.def && dir.def.componentUpdated) {
  11462. dirsWithPostpatch.push(dir);
  11463. }
  11464. }
  11465. }
  11466. if (dirsWithInsert.length) {
  11467. var callInsert = function () {
  11468. dirsWithInsert.forEach(function (dir) {
  11469. callHook$1(dir, 'inserted', vnode, oldVnode);
  11470. });
  11471. };
  11472. if (isCreate) {
  11473. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert');
  11474. } else {
  11475. callInsert();
  11476. }
  11477. }
  11478. if (dirsWithPostpatch.length) {
  11479. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  11480. dirsWithPostpatch.forEach(function (dir) {
  11481. callHook$1(dir, 'componentUpdated', vnode, oldVnode);
  11482. });
  11483. }, 'dir-postpatch');
  11484. }
  11485. if (!isCreate) {
  11486. for (key in oldDirs) {
  11487. if (!newDirs[key]) {
  11488. // no longer present, unbind
  11489. callHook$1(oldDirs[key], 'unbind', oldVnode);
  11490. }
  11491. }
  11492. }
  11493. }
  11494. var emptyModifiers = Object.create(null);
  11495. function normalizeDirectives$1 (
  11496. dirs,
  11497. vm
  11498. ) {
  11499. var res = Object.create(null);
  11500. if (!dirs) {
  11501. return res
  11502. }
  11503. var i, dir;
  11504. for (i = 0; i < dirs.length; i++) {
  11505. dir = dirs[i];
  11506. if (!dir.modifiers) {
  11507. dir.modifiers = emptyModifiers;
  11508. }
  11509. res[getRawDirName(dir)] = dir;
  11510. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  11511. }
  11512. return res
  11513. }
  11514. function getRawDirName (dir) {
  11515. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  11516. }
  11517. function callHook$1 (dir, hook, vnode, oldVnode) {
  11518. var fn = dir.def && dir.def[hook];
  11519. if (fn) {
  11520. fn(vnode.elm, dir, vnode, oldVnode);
  11521. }
  11522. }
  11523. var baseModules = [
  11524. ref,
  11525. directives
  11526. ];
  11527. /* */
  11528. function updateAttrs (oldVnode, vnode) {
  11529. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  11530. return
  11531. }
  11532. var key, cur, old;
  11533. var elm = vnode.elm;
  11534. var oldAttrs = oldVnode.data.attrs || {};
  11535. var attrs = vnode.data.attrs || {};
  11536. // clone observed objects, as the user probably wants to mutate it
  11537. if (attrs.__ob__) {
  11538. attrs = vnode.data.attrs = extend({}, attrs);
  11539. }
  11540. for (key in attrs) {
  11541. cur = attrs[key];
  11542. old = oldAttrs[key];
  11543. if (old !== cur) {
  11544. setAttr(elm, key, cur);
  11545. }
  11546. }
  11547. for (key in oldAttrs) {
  11548. if (attrs[key] == null) {
  11549. if (isXlink(key)) {
  11550. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  11551. } else if (!isEnumeratedAttr(key)) {
  11552. elm.removeAttribute(key);
  11553. }
  11554. }
  11555. }
  11556. }
  11557. function setAttr (el, key, value) {
  11558. if (isBooleanAttr(key)) {
  11559. // set attribute for blank value
  11560. // e.g. <option disabled>Select one</option>
  11561. if (isFalsyAttrValue(value)) {
  11562. el.removeAttribute(key);
  11563. } else {
  11564. el.setAttribute(key, key);
  11565. }
  11566. } else if (isEnumeratedAttr(key)) {
  11567. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  11568. } else if (isXlink(key)) {
  11569. if (isFalsyAttrValue(value)) {
  11570. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  11571. } else {
  11572. el.setAttributeNS(xlinkNS, key, value);
  11573. }
  11574. } else {
  11575. if (isFalsyAttrValue(value)) {
  11576. el.removeAttribute(key);
  11577. } else {
  11578. el.setAttribute(key, value);
  11579. }
  11580. }
  11581. }
  11582. var attrs = {
  11583. create: updateAttrs,
  11584. update: updateAttrs
  11585. };
  11586. /* */
  11587. function updateClass (oldVnode, vnode) {
  11588. var el = vnode.elm;
  11589. var data = vnode.data;
  11590. var oldData = oldVnode.data;
  11591. if (!data.staticClass && !data.class &&
  11592. (!oldData || (!oldData.staticClass && !oldData.class))) {
  11593. return
  11594. }
  11595. var cls = genClassForVnode(vnode);
  11596. // handle transition classes
  11597. var transitionClass = el._transitionClasses;
  11598. if (transitionClass) {
  11599. cls = concat(cls, stringifyClass(transitionClass));
  11600. }
  11601. // set the class
  11602. if (cls !== el._prevClass) {
  11603. el.setAttribute('class', cls);
  11604. el._prevClass = cls;
  11605. }
  11606. }
  11607. var klass = {
  11608. create: updateClass,
  11609. update: updateClass
  11610. };
  11611. // skip type checking this file because we need to attach private properties
  11612. // to elements
  11613. function updateDOMListeners (oldVnode, vnode) {
  11614. if (!oldVnode.data.on && !vnode.data.on) {
  11615. return
  11616. }
  11617. var on = vnode.data.on || {};
  11618. var oldOn = oldVnode.data.on || {};
  11619. var add = vnode.elm._v_add || (vnode.elm._v_add = function (event, handler, capture) {
  11620. vnode.elm.addEventListener(event, handler, capture);
  11621. });
  11622. var remove = vnode.elm._v_remove || (vnode.elm._v_remove = function (event, handler) {
  11623. vnode.elm.removeEventListener(event, handler);
  11624. });
  11625. updateListeners(on, oldOn, add, remove, vnode.context);
  11626. }
  11627. var events = {
  11628. create: updateDOMListeners,
  11629. update: updateDOMListeners
  11630. };
  11631. /* */
  11632. function updateDOMProps (oldVnode, vnode) {
  11633. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  11634. return
  11635. }
  11636. var key, cur;
  11637. var elm = vnode.elm;
  11638. var oldProps = oldVnode.data.domProps || {};
  11639. var props = vnode.data.domProps || {};
  11640. // clone observed objects, as the user probably wants to mutate it
  11641. if (props.__ob__) {
  11642. props = vnode.data.domProps = extend({}, props);
  11643. }
  11644. for (key in oldProps) {
  11645. if (props[key] == null) {
  11646. elm[key] = undefined;
  11647. }
  11648. }
  11649. for (key in props) {
  11650. // ignore children if the node has textContent or innerHTML,
  11651. // as these will throw away existing DOM nodes and cause removal errors
  11652. // on subsequent patches (#3360)
  11653. if ((key === 'textContent' || key === 'innerHTML') && vnode.children) {
  11654. vnode.children.length = 0;
  11655. }
  11656. cur = props[key];
  11657. if (key === 'value') {
  11658. // store value as _value as well since
  11659. // non-string values will be stringified
  11660. elm._value = cur;
  11661. // avoid resetting cursor position when value is the same
  11662. var strCur = cur == null ? '' : String(cur);
  11663. if (elm.value !== strCur && !elm.composing) {
  11664. elm.value = strCur;
  11665. }
  11666. } else {
  11667. elm[key] = cur;
  11668. }
  11669. }
  11670. }
  11671. var domProps = {
  11672. create: updateDOMProps,
  11673. update: updateDOMProps
  11674. };
  11675. /* */
  11676. var prefixes = ['Webkit', 'Moz', 'ms'];
  11677. var testEl;
  11678. var normalize = cached(function (prop) {
  11679. testEl = testEl || document.createElement('div');
  11680. prop = camelize(prop);
  11681. if (prop !== 'filter' && (prop in testEl.style)) {
  11682. return prop
  11683. }
  11684. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  11685. for (var i = 0; i < prefixes.length; i++) {
  11686. var prefixed = prefixes[i] + upper;
  11687. if (prefixed in testEl.style) {
  11688. return prefixed
  11689. }
  11690. }
  11691. });
  11692. function updateStyle (oldVnode, vnode) {
  11693. if ((!oldVnode.data || !oldVnode.data.style) && !vnode.data.style) {
  11694. return
  11695. }
  11696. var cur, name;
  11697. var el = vnode.elm;
  11698. var oldStyle = oldVnode.data.style || {};
  11699. var style = vnode.data.style || {};
  11700. // handle string
  11701. if (typeof style === 'string') {
  11702. el.style.cssText = style;
  11703. return
  11704. }
  11705. var needClone = style.__ob__;
  11706. // handle array syntax
  11707. if (Array.isArray(style)) {
  11708. style = vnode.data.style = toObject(style);
  11709. }
  11710. // clone the style for future updates,
  11711. // in case the user mutates the style object in-place.
  11712. if (needClone) {
  11713. style = vnode.data.style = extend({}, style);
  11714. }
  11715. for (name in oldStyle) {
  11716. if (style[name] == null) {
  11717. el.style[normalize(name)] = '';
  11718. }
  11719. }
  11720. for (name in style) {
  11721. cur = style[name];
  11722. if (cur !== oldStyle[name]) {
  11723. // ie9 setting to null has no effect, must use empty string
  11724. el.style[normalize(name)] = cur == null ? '' : cur;
  11725. }
  11726. }
  11727. }
  11728. var style = {
  11729. create: updateStyle,
  11730. update: updateStyle
  11731. };
  11732. /* */
  11733. /**
  11734. * Add class with compatibility for SVG since classList is not supported on
  11735. * SVG elements in IE
  11736. */
  11737. function addClass (el, cls) {
  11738. /* istanbul ignore else */
  11739. if (el.classList) {
  11740. if (cls.indexOf(' ') > -1) {
  11741. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  11742. } else {
  11743. el.classList.add(cls);
  11744. }
  11745. } else {
  11746. var cur = ' ' + el.getAttribute('class') + ' ';
  11747. if (cur.indexOf(' ' + cls + ' ') < 0) {
  11748. el.setAttribute('class', (cur + cls).trim());
  11749. }
  11750. }
  11751. }
  11752. /**
  11753. * Remove class with compatibility for SVG since classList is not supported on
  11754. * SVG elements in IE
  11755. */
  11756. function removeClass (el, cls) {
  11757. /* istanbul ignore else */
  11758. if (el.classList) {
  11759. if (cls.indexOf(' ') > -1) {
  11760. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  11761. } else {
  11762. el.classList.remove(cls);
  11763. }
  11764. } else {
  11765. var cur = ' ' + el.getAttribute('class') + ' ';
  11766. var tar = ' ' + cls + ' ';
  11767. while (cur.indexOf(tar) >= 0) {
  11768. cur = cur.replace(tar, ' ');
  11769. }
  11770. el.setAttribute('class', cur.trim());
  11771. }
  11772. }
  11773. /* */
  11774. var hasTransition = inBrowser && !isIE9;
  11775. var TRANSITION = 'transition';
  11776. var ANIMATION = 'animation';
  11777. // Transition property/event sniffing
  11778. var transitionProp = 'transition';
  11779. var transitionEndEvent = 'transitionend';
  11780. var animationProp = 'animation';
  11781. var animationEndEvent = 'animationend';
  11782. if (hasTransition) {
  11783. /* istanbul ignore if */
  11784. if (window.ontransitionend === undefined &&
  11785. window.onwebkittransitionend !== undefined) {
  11786. transitionProp = 'WebkitTransition';
  11787. transitionEndEvent = 'webkitTransitionEnd';
  11788. }
  11789. if (window.onanimationend === undefined &&
  11790. window.onwebkitanimationend !== undefined) {
  11791. animationProp = 'WebkitAnimation';
  11792. animationEndEvent = 'webkitAnimationEnd';
  11793. }
  11794. }
  11795. var raf = (inBrowser && window.requestAnimationFrame) || setTimeout;
  11796. function nextFrame (fn) {
  11797. raf(function () {
  11798. raf(fn);
  11799. });
  11800. }
  11801. function addTransitionClass (el, cls) {
  11802. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  11803. addClass(el, cls);
  11804. }
  11805. function removeTransitionClass (el, cls) {
  11806. if (el._transitionClasses) {
  11807. remove$1(el._transitionClasses, cls);
  11808. }
  11809. removeClass(el, cls);
  11810. }
  11811. function whenTransitionEnds (
  11812. el,
  11813. expectedType,
  11814. cb
  11815. ) {
  11816. var ref = getTransitionInfo(el, expectedType);
  11817. var type = ref.type;
  11818. var timeout = ref.timeout;
  11819. var propCount = ref.propCount;
  11820. if (!type) { return cb() }
  11821. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  11822. var ended = 0;
  11823. var end = function () {
  11824. el.removeEventListener(event, onEnd);
  11825. cb();
  11826. };
  11827. var onEnd = function (e) {
  11828. if (e.target === el) {
  11829. if (++ended >= propCount) {
  11830. end();
  11831. }
  11832. }
  11833. };
  11834. setTimeout(function () {
  11835. if (ended < propCount) {
  11836. end();
  11837. }
  11838. }, timeout + 1);
  11839. el.addEventListener(event, onEnd);
  11840. }
  11841. var transformRE = /\b(transform|all)(,|$)/;
  11842. function getTransitionInfo (el, expectedType) {
  11843. var styles = window.getComputedStyle(el);
  11844. var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
  11845. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  11846. var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
  11847. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  11848. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  11849. var animationTimeout = getTimeout(animationDelays, animationDurations);
  11850. var type;
  11851. var timeout = 0;
  11852. var propCount = 0;
  11853. /* istanbul ignore if */
  11854. if (expectedType === TRANSITION) {
  11855. if (transitionTimeout > 0) {
  11856. type = TRANSITION;
  11857. timeout = transitionTimeout;
  11858. propCount = transitionDurations.length;
  11859. }
  11860. } else if (expectedType === ANIMATION) {
  11861. if (animationTimeout > 0) {
  11862. type = ANIMATION;
  11863. timeout = animationTimeout;
  11864. propCount = animationDurations.length;
  11865. }
  11866. } else {
  11867. timeout = Math.max(transitionTimeout, animationTimeout);
  11868. type = timeout > 0
  11869. ? transitionTimeout > animationTimeout
  11870. ? TRANSITION
  11871. : ANIMATION
  11872. : null;
  11873. propCount = type
  11874. ? type === TRANSITION
  11875. ? transitionDurations.length
  11876. : animationDurations.length
  11877. : 0;
  11878. }
  11879. var hasTransform =
  11880. type === TRANSITION &&
  11881. transformRE.test(styles[transitionProp + 'Property']);
  11882. return {
  11883. type: type,
  11884. timeout: timeout,
  11885. propCount: propCount,
  11886. hasTransform: hasTransform
  11887. }
  11888. }
  11889. function getTimeout (delays, durations) {
  11890. return Math.max.apply(null, durations.map(function (d, i) {
  11891. return toMs(d) + toMs(delays[i])
  11892. }))
  11893. }
  11894. function toMs (s) {
  11895. return Number(s.slice(0, -1)) * 1000
  11896. }
  11897. /* */
  11898. function enter (vnode) {
  11899. var el = vnode.elm;
  11900. // call leave callback now
  11901. if (el._leaveCb) {
  11902. el._leaveCb.cancelled = true;
  11903. el._leaveCb();
  11904. }
  11905. var data = resolveTransition(vnode.data.transition);
  11906. if (!data) {
  11907. return
  11908. }
  11909. /* istanbul ignore if */
  11910. if (el._enterCb || el.nodeType !== 1) {
  11911. return
  11912. }
  11913. var css = data.css;
  11914. var type = data.type;
  11915. var enterClass = data.enterClass;
  11916. var enterActiveClass = data.enterActiveClass;
  11917. var appearClass = data.appearClass;
  11918. var appearActiveClass = data.appearActiveClass;
  11919. var beforeEnter = data.beforeEnter;
  11920. var enter = data.enter;
  11921. var afterEnter = data.afterEnter;
  11922. var enterCancelled = data.enterCancelled;
  11923. var beforeAppear = data.beforeAppear;
  11924. var appear = data.appear;
  11925. var afterAppear = data.afterAppear;
  11926. var appearCancelled = data.appearCancelled;
  11927. // activeInstance will always be the <transition> component managing this
  11928. // transition. One edge case to check is when the <transition> is placed
  11929. // as the root node of a child component. In that case we need to check
  11930. // <transition>'s parent for appear check.
  11931. var transitionNode = activeInstance.$vnode;
  11932. var context = transitionNode && transitionNode.parent
  11933. ? transitionNode.parent.context
  11934. : activeInstance;
  11935. var isAppear = !context._isMounted || !vnode.isRootInsert;
  11936. if (isAppear && !appear && appear !== '') {
  11937. return
  11938. }
  11939. var startClass = isAppear ? appearClass : enterClass;
  11940. var activeClass = isAppear ? appearActiveClass : enterActiveClass;
  11941. var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter;
  11942. var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter;
  11943. var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter;
  11944. var enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled;
  11945. var expectsCSS = css !== false && !isIE9;
  11946. var userWantsControl =
  11947. enterHook &&
  11948. // enterHook may be a bound method which exposes
  11949. // the length of original fn as _length
  11950. (enterHook._length || enterHook.length) > 1;
  11951. var cb = el._enterCb = once(function () {
  11952. if (expectsCSS) {
  11953. removeTransitionClass(el, activeClass);
  11954. }
  11955. if (cb.cancelled) {
  11956. if (expectsCSS) {
  11957. removeTransitionClass(el, startClass);
  11958. }
  11959. enterCancelledHook && enterCancelledHook(el);
  11960. } else {
  11961. afterEnterHook && afterEnterHook(el);
  11962. }
  11963. el._enterCb = null;
  11964. });
  11965. if (!vnode.data.show) {
  11966. // remove pending leave element on enter by injecting an insert hook
  11967. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  11968. var parent = el.parentNode;
  11969. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  11970. if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
  11971. pendingNode.elm._leaveCb();
  11972. }
  11973. enterHook && enterHook(el, cb);
  11974. }, 'transition-insert');
  11975. }
  11976. // start enter transition
  11977. beforeEnterHook && beforeEnterHook(el);
  11978. if (expectsCSS) {
  11979. addTransitionClass(el, startClass);
  11980. addTransitionClass(el, activeClass);
  11981. nextFrame(function () {
  11982. removeTransitionClass(el, startClass);
  11983. if (!cb.cancelled && !userWantsControl) {
  11984. whenTransitionEnds(el, type, cb);
  11985. }
  11986. });
  11987. }
  11988. if (vnode.data.show) {
  11989. enterHook && enterHook(el, cb);
  11990. }
  11991. if (!expectsCSS && !userWantsControl) {
  11992. cb();
  11993. }
  11994. }
  11995. function leave (vnode, rm) {
  11996. var el = vnode.elm;
  11997. // call enter callback now
  11998. if (el._enterCb) {
  11999. el._enterCb.cancelled = true;
  12000. el._enterCb();
  12001. }
  12002. var data = resolveTransition(vnode.data.transition);
  12003. if (!data) {
  12004. return rm()
  12005. }
  12006. /* istanbul ignore if */
  12007. if (el._leaveCb || el.nodeType !== 1) {
  12008. return
  12009. }
  12010. var css = data.css;
  12011. var type = data.type;
  12012. var leaveClass = data.leaveClass;
  12013. var leaveActiveClass = data.leaveActiveClass;
  12014. var beforeLeave = data.beforeLeave;
  12015. var leave = data.leave;
  12016. var afterLeave = data.afterLeave;
  12017. var leaveCancelled = data.leaveCancelled;
  12018. var delayLeave = data.delayLeave;
  12019. var expectsCSS = css !== false && !isIE9;
  12020. var userWantsControl =
  12021. leave &&
  12022. // leave hook may be a bound method which exposes
  12023. // the length of original fn as _length
  12024. (leave._length || leave.length) > 1;
  12025. var cb = el._leaveCb = once(function () {
  12026. if (el.parentNode && el.parentNode._pending) {
  12027. el.parentNode._pending[vnode.key] = null;
  12028. }
  12029. if (expectsCSS) {
  12030. removeTransitionClass(el, leaveActiveClass);
  12031. }
  12032. if (cb.cancelled) {
  12033. if (expectsCSS) {
  12034. removeTransitionClass(el, leaveClass);
  12035. }
  12036. leaveCancelled && leaveCancelled(el);
  12037. } else {
  12038. rm();
  12039. afterLeave && afterLeave(el);
  12040. }
  12041. el._leaveCb = null;
  12042. });
  12043. if (delayLeave) {
  12044. delayLeave(performLeave);
  12045. } else {
  12046. performLeave();
  12047. }
  12048. function performLeave () {
  12049. // the delayed leave may have already been cancelled
  12050. if (cb.cancelled) {
  12051. return
  12052. }
  12053. // record leaving element
  12054. if (!vnode.data.show) {
  12055. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  12056. }
  12057. beforeLeave && beforeLeave(el);
  12058. if (expectsCSS) {
  12059. addTransitionClass(el, leaveClass);
  12060. addTransitionClass(el, leaveActiveClass);
  12061. nextFrame(function () {
  12062. removeTransitionClass(el, leaveClass);
  12063. if (!cb.cancelled && !userWantsControl) {
  12064. whenTransitionEnds(el, type, cb);
  12065. }
  12066. });
  12067. }
  12068. leave && leave(el, cb);
  12069. if (!expectsCSS && !userWantsControl) {
  12070. cb();
  12071. }
  12072. }
  12073. }
  12074. function resolveTransition (def$$1) {
  12075. if (!def$$1) {
  12076. return
  12077. }
  12078. /* istanbul ignore else */
  12079. if (typeof def$$1 === 'object') {
  12080. var res = {};
  12081. if (def$$1.css !== false) {
  12082. extend(res, autoCssTransition(def$$1.name || 'v'));
  12083. }
  12084. extend(res, def$$1);
  12085. return res
  12086. } else if (typeof def$$1 === 'string') {
  12087. return autoCssTransition(def$$1)
  12088. }
  12089. }
  12090. var autoCssTransition = cached(function (name) {
  12091. return {
  12092. enterClass: (name + "-enter"),
  12093. leaveClass: (name + "-leave"),
  12094. appearClass: (name + "-enter"),
  12095. enterActiveClass: (name + "-enter-active"),
  12096. leaveActiveClass: (name + "-leave-active"),
  12097. appearActiveClass: (name + "-enter-active")
  12098. }
  12099. });
  12100. function once (fn) {
  12101. var called = false;
  12102. return function () {
  12103. if (!called) {
  12104. called = true;
  12105. fn();
  12106. }
  12107. }
  12108. }
  12109. var transition = inBrowser ? {
  12110. create: function create (_, vnode) {
  12111. if (!vnode.data.show) {
  12112. enter(vnode);
  12113. }
  12114. },
  12115. remove: function remove (vnode, rm) {
  12116. /* istanbul ignore else */
  12117. if (!vnode.data.show) {
  12118. leave(vnode, rm);
  12119. } else {
  12120. rm();
  12121. }
  12122. }
  12123. } : {};
  12124. var platformModules = [
  12125. attrs,
  12126. klass,
  12127. events,
  12128. domProps,
  12129. style,
  12130. transition
  12131. ];
  12132. /* */
  12133. // the directive module should be applied last, after all
  12134. // built-in modules have been applied.
  12135. var modules = platformModules.concat(baseModules);
  12136. var patch$1 = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  12137. /**
  12138. * Not type checking this file because flow doesn't like attaching
  12139. * properties to Elements.
  12140. */
  12141. var modelableTagRE = /^input|select|textarea|vue-component-[0-9]+(-[0-9a-zA-Z_\-]*)?$/;
  12142. /* istanbul ignore if */
  12143. if (isIE9) {
  12144. // http://www.matts411.com/post/internet-explorer-9-oninput/
  12145. document.addEventListener('selectionchange', function () {
  12146. var el = document.activeElement;
  12147. if (el && el.vmodel) {
  12148. trigger(el, 'input');
  12149. }
  12150. });
  12151. }
  12152. var model = {
  12153. inserted: function inserted (el, binding, vnode) {
  12154. if (process.env.NODE_ENV !== 'production') {
  12155. if (!modelableTagRE.test(vnode.tag)) {
  12156. warn(
  12157. "v-model is not supported on element type: <" + (vnode.tag) + ">. " +
  12158. 'If you are working with contenteditable, it\'s recommended to ' +
  12159. 'wrap a library dedicated for that purpose inside a custom component.',
  12160. vnode.context
  12161. );
  12162. }
  12163. }
  12164. if (vnode.tag === 'select') {
  12165. var cb = function () {
  12166. setSelected(el, binding, vnode.context);
  12167. };
  12168. cb();
  12169. /* istanbul ignore if */
  12170. if (isIE || isEdge) {
  12171. setTimeout(cb, 0);
  12172. }
  12173. } else if (
  12174. (vnode.tag === 'textarea' || el.type === 'text') &&
  12175. !binding.modifiers.lazy
  12176. ) {
  12177. if (!isAndroid) {
  12178. el.addEventListener('compositionstart', onCompositionStart);
  12179. el.addEventListener('compositionend', onCompositionEnd);
  12180. }
  12181. /* istanbul ignore if */
  12182. if (isIE9) {
  12183. el.vmodel = true;
  12184. }
  12185. }
  12186. },
  12187. componentUpdated: function componentUpdated (el, binding, vnode) {
  12188. if (vnode.tag === 'select') {
  12189. setSelected(el, binding, vnode.context);
  12190. // in case the options rendered by v-for have changed,
  12191. // it's possible that the value is out-of-sync with the rendered options.
  12192. // detect such cases and filter out values that no longer has a matchig
  12193. // option in the DOM.
  12194. var needReset = el.multiple
  12195. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  12196. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  12197. if (needReset) {
  12198. trigger(el, 'change');
  12199. }
  12200. }
  12201. }
  12202. };
  12203. function setSelected (el, binding, vm) {
  12204. var value = binding.value;
  12205. var isMultiple = el.multiple;
  12206. if (isMultiple && !Array.isArray(value)) {
  12207. process.env.NODE_ENV !== 'production' && warn(
  12208. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  12209. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  12210. vm
  12211. );
  12212. return
  12213. }
  12214. var selected, option;
  12215. for (var i = 0, l = el.options.length; i < l; i++) {
  12216. option = el.options[i];
  12217. if (isMultiple) {
  12218. selected = looseIndexOf(value, getValue(option)) > -1;
  12219. if (option.selected !== selected) {
  12220. option.selected = selected;
  12221. }
  12222. } else {
  12223. if (looseEqual(getValue(option), value)) {
  12224. if (el.selectedIndex !== i) {
  12225. el.selectedIndex = i;
  12226. }
  12227. return
  12228. }
  12229. }
  12230. }
  12231. if (!isMultiple) {
  12232. el.selectedIndex = -1;
  12233. }
  12234. }
  12235. function hasNoMatchingOption (value, options) {
  12236. for (var i = 0, l = options.length; i < l; i++) {
  12237. if (looseEqual(getValue(options[i]), value)) {
  12238. return false
  12239. }
  12240. }
  12241. return true
  12242. }
  12243. function getValue (option) {
  12244. return '_value' in option
  12245. ? option._value
  12246. : option.value
  12247. }
  12248. function onCompositionStart (e) {
  12249. e.target.composing = true;
  12250. }
  12251. function onCompositionEnd (e) {
  12252. e.target.composing = false;
  12253. trigger(e.target, 'input');
  12254. }
  12255. function trigger (el, type) {
  12256. var e = document.createEvent('HTMLEvents');
  12257. e.initEvent(type, true, true);
  12258. el.dispatchEvent(e);
  12259. }
  12260. /* */
  12261. // recursively search for possible transition defined inside the component root
  12262. function locateNode (vnode) {
  12263. return vnode.child && (!vnode.data || !vnode.data.transition)
  12264. ? locateNode(vnode.child._vnode)
  12265. : vnode
  12266. }
  12267. var show = {
  12268. bind: function bind (el, ref, vnode) {
  12269. var value = ref.value;
  12270. vnode = locateNode(vnode);
  12271. var transition = vnode.data && vnode.data.transition;
  12272. if (value && transition && !isIE9) {
  12273. enter(vnode);
  12274. }
  12275. var originalDisplay = el.style.display === 'none' ? '' : el.style.display;
  12276. el.style.display = value ? originalDisplay : 'none';
  12277. el.__vOriginalDisplay = originalDisplay;
  12278. },
  12279. update: function update (el, ref, vnode) {
  12280. var value = ref.value;
  12281. var oldValue = ref.oldValue;
  12282. /* istanbul ignore if */
  12283. if (value === oldValue) { return }
  12284. vnode = locateNode(vnode);
  12285. var transition = vnode.data && vnode.data.transition;
  12286. if (transition && !isIE9) {
  12287. if (value) {
  12288. enter(vnode);
  12289. el.style.display = el.__vOriginalDisplay;
  12290. } else {
  12291. leave(vnode, function () {
  12292. el.style.display = 'none';
  12293. });
  12294. }
  12295. } else {
  12296. el.style.display = value ? el.__vOriginalDisplay : 'none';
  12297. }
  12298. }
  12299. };
  12300. var platformDirectives = {
  12301. model: model,
  12302. show: show
  12303. };
  12304. /* */
  12305. // Provides transition support for a single element/component.
  12306. // supports transition mode (out-in / in-out)
  12307. var transitionProps = {
  12308. name: String,
  12309. appear: Boolean,
  12310. css: Boolean,
  12311. mode: String,
  12312. type: String,
  12313. enterClass: String,
  12314. leaveClass: String,
  12315. enterActiveClass: String,
  12316. leaveActiveClass: String,
  12317. appearClass: String,
  12318. appearActiveClass: String
  12319. };
  12320. // in case the child is also an abstract component, e.g. <keep-alive>
  12321. // we want to recrusively retrieve the real component to be rendered
  12322. function getRealChild (vnode) {
  12323. var compOptions = vnode && vnode.componentOptions;
  12324. if (compOptions && compOptions.Ctor.options.abstract) {
  12325. return getRealChild(getFirstComponentChild(compOptions.children))
  12326. } else {
  12327. return vnode
  12328. }
  12329. }
  12330. function extractTransitionData (comp) {
  12331. var data = {};
  12332. var options = comp.$options;
  12333. // props
  12334. for (var key in options.propsData) {
  12335. data[key] = comp[key];
  12336. }
  12337. // events.
  12338. // extract listeners and pass them directly to the transition methods
  12339. var listeners = options._parentListeners;
  12340. for (var key$1 in listeners) {
  12341. data[camelize(key$1)] = listeners[key$1].fn;
  12342. }
  12343. return data
  12344. }
  12345. function placeholder (h, rawChild) {
  12346. return /\d-keep-alive$/.test(rawChild.tag)
  12347. ? h('keep-alive')
  12348. : null
  12349. }
  12350. function hasParentTransition (vnode) {
  12351. while ((vnode = vnode.parent)) {
  12352. if (vnode.data.transition) {
  12353. return true
  12354. }
  12355. }
  12356. }
  12357. var Transition = {
  12358. name: 'transition',
  12359. props: transitionProps,
  12360. abstract: true,
  12361. render: function render (h) {
  12362. var this$1 = this;
  12363. var children = this.$slots.default;
  12364. if (!children) {
  12365. return
  12366. }
  12367. // filter out text nodes (possible whitespaces)
  12368. children = children.filter(function (c) { return c.tag; });
  12369. /* istanbul ignore if */
  12370. if (!children.length) {
  12371. return
  12372. }
  12373. // warn multiple elements
  12374. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  12375. warn(
  12376. '<transition> can only be used on a single element. Use ' +
  12377. '<transition-group> for lists.',
  12378. this.$parent
  12379. );
  12380. }
  12381. var mode = this.mode;
  12382. // warn invalid mode
  12383. if (process.env.NODE_ENV !== 'production' &&
  12384. mode && mode !== 'in-out' && mode !== 'out-in') {
  12385. warn(
  12386. 'invalid <transition> mode: ' + mode,
  12387. this.$parent
  12388. );
  12389. }
  12390. var rawChild = children[0];
  12391. // if this is a component root node and the component's
  12392. // parent container node also has transition, skip.
  12393. if (hasParentTransition(this.$vnode)) {
  12394. return rawChild
  12395. }
  12396. // apply transition data to child
  12397. // use getRealChild() to ignore abstract components e.g. keep-alive
  12398. var child = getRealChild(rawChild);
  12399. /* istanbul ignore if */
  12400. if (!child) {
  12401. return rawChild
  12402. }
  12403. if (this._leaving) {
  12404. return placeholder(h, rawChild)
  12405. }
  12406. var key = child.key = child.key == null || child.isStatic
  12407. ? ("__v" + (child.tag + this._uid) + "__")
  12408. : child.key;
  12409. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  12410. var oldRawChild = this._vnode;
  12411. var oldChild = getRealChild(oldRawChild);
  12412. // mark v-show
  12413. // so that the transition module can hand over the control to the directive
  12414. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  12415. child.data.show = true;
  12416. }
  12417. if (oldChild && oldChild.data && oldChild.key !== key) {
  12418. // replace old child transition data with fresh one
  12419. // important for dynamic transitions!
  12420. var oldData = oldChild.data.transition = extend({}, data);
  12421. // handle transition mode
  12422. if (mode === 'out-in') {
  12423. // return placeholder node and queue update when leave finishes
  12424. this._leaving = true;
  12425. mergeVNodeHook(oldData, 'afterLeave', function () {
  12426. this$1._leaving = false;
  12427. this$1.$forceUpdate();
  12428. }, key);
  12429. return placeholder(h, rawChild)
  12430. } else if (mode === 'in-out') {
  12431. var delayedLeave;
  12432. var performLeave = function () { delayedLeave(); };
  12433. mergeVNodeHook(data, 'afterEnter', performLeave, key);
  12434. mergeVNodeHook(data, 'enterCancelled', performLeave, key);
  12435. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  12436. delayedLeave = leave;
  12437. }, key);
  12438. }
  12439. }
  12440. return rawChild
  12441. }
  12442. };
  12443. /* */
  12444. // Provides transition support for list items.
  12445. // supports move transitions using the FLIP technique.
  12446. // Because the vdom's children update algorithm is "unstable" - i.e.
  12447. // it doesn't guarantee the relative positioning of removed elements,
  12448. // we force transition-group to update its children into two passes:
  12449. // in the first pass, we remove all nodes that need to be removed,
  12450. // triggering their leaving transition; in the second pass, we insert/move
  12451. // into the final disired state. This way in the second pass removed
  12452. // nodes will remain where they should be.
  12453. var props = extend({
  12454. tag: String,
  12455. moveClass: String
  12456. }, transitionProps);
  12457. delete props.mode;
  12458. var TransitionGroup = {
  12459. props: props,
  12460. render: function render (h) {
  12461. var tag = this.tag || this.$vnode.data.tag || 'span';
  12462. var map = Object.create(null);
  12463. var prevChildren = this.prevChildren = this.children;
  12464. var rawChildren = this.$slots.default || [];
  12465. var children = this.children = [];
  12466. var transitionData = extractTransitionData(this);
  12467. for (var i = 0; i < rawChildren.length; i++) {
  12468. var c = rawChildren[i];
  12469. if (c.tag) {
  12470. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  12471. children.push(c);
  12472. map[c.key] = c
  12473. ;(c.data || (c.data = {})).transition = transitionData;
  12474. } else if (process.env.NODE_ENV !== 'production') {
  12475. var opts = c.componentOptions;
  12476. var name = opts
  12477. ? (opts.Ctor.options.name || opts.tag)
  12478. : c.tag;
  12479. warn(("<transition-group> children must be keyed: <" + name + ">"));
  12480. }
  12481. }
  12482. }
  12483. if (prevChildren) {
  12484. var kept = [];
  12485. var removed = [];
  12486. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  12487. var c$1 = prevChildren[i$1];
  12488. c$1.data.transition = transitionData;
  12489. c$1.data.pos = c$1.elm.getBoundingClientRect();
  12490. if (map[c$1.key]) {
  12491. kept.push(c$1);
  12492. } else {
  12493. removed.push(c$1);
  12494. }
  12495. }
  12496. this.kept = h(tag, null, kept);
  12497. this.removed = removed;
  12498. }
  12499. return h(tag, null, children)
  12500. },
  12501. beforeUpdate: function beforeUpdate () {
  12502. // force removing pass
  12503. this.__patch__(
  12504. this._vnode,
  12505. this.kept,
  12506. false, // hydrating
  12507. true // removeOnly (!important, avoids unnecessary moves)
  12508. );
  12509. this._vnode = this.kept;
  12510. },
  12511. updated: function updated () {
  12512. var children = this.prevChildren;
  12513. var moveClass = this.moveClass || (this.name + '-move');
  12514. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  12515. return
  12516. }
  12517. // we divide the work into three loops to avoid mixing DOM reads and writes
  12518. // in each iteration - which helps prevent layout thrashing.
  12519. children.forEach(callPendingCbs);
  12520. children.forEach(recordPosition);
  12521. children.forEach(applyTranslation);
  12522. // force reflow to put everything in position
  12523. var f = document.body.offsetHeight; // eslint-disable-line
  12524. children.forEach(function (c) {
  12525. if (c.data.moved) {
  12526. var el = c.elm;
  12527. var s = el.style;
  12528. addTransitionClass(el, moveClass);
  12529. s.transform = s.WebkitTransform = s.transitionDuration = '';
  12530. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  12531. if (!e || /transform$/.test(e.propertyName)) {
  12532. el.removeEventListener(transitionEndEvent, cb);
  12533. el._moveCb = null;
  12534. removeTransitionClass(el, moveClass);
  12535. }
  12536. });
  12537. }
  12538. });
  12539. },
  12540. methods: {
  12541. hasMove: function hasMove (el, moveClass) {
  12542. /* istanbul ignore if */
  12543. if (!hasTransition) {
  12544. return false
  12545. }
  12546. if (this._hasMove != null) {
  12547. return this._hasMove
  12548. }
  12549. addTransitionClass(el, moveClass);
  12550. var info = getTransitionInfo(el);
  12551. removeTransitionClass(el, moveClass);
  12552. return (this._hasMove = info.hasTransform)
  12553. }
  12554. }
  12555. };
  12556. function callPendingCbs (c) {
  12557. /* istanbul ignore if */
  12558. if (c.elm._moveCb) {
  12559. c.elm._moveCb();
  12560. }
  12561. /* istanbul ignore if */
  12562. if (c.elm._enterCb) {
  12563. c.elm._enterCb();
  12564. }
  12565. }
  12566. function recordPosition (c) {
  12567. c.data.newPos = c.elm.getBoundingClientRect();
  12568. }
  12569. function applyTranslation (c) {
  12570. var oldPos = c.data.pos;
  12571. var newPos = c.data.newPos;
  12572. var dx = oldPos.left - newPos.left;
  12573. var dy = oldPos.top - newPos.top;
  12574. if (dx || dy) {
  12575. c.data.moved = true;
  12576. var s = c.elm.style;
  12577. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  12578. s.transitionDuration = '0s';
  12579. }
  12580. }
  12581. var platformComponents = {
  12582. Transition: Transition,
  12583. TransitionGroup: TransitionGroup
  12584. };
  12585. /* */
  12586. // install platform specific utils
  12587. Vue$2.config.isUnknownElement = isUnknownElement;
  12588. Vue$2.config.isReservedTag = isReservedTag;
  12589. Vue$2.config.getTagNamespace = getTagNamespace;
  12590. Vue$2.config.mustUseProp = mustUseProp;
  12591. // install platform runtime directives & components
  12592. extend(Vue$2.options.directives, platformDirectives);
  12593. extend(Vue$2.options.components, platformComponents);
  12594. // install platform patch function
  12595. Vue$2.prototype.__patch__ = config._isServer ? noop : patch$1;
  12596. // wrap mount
  12597. Vue$2.prototype.$mount = function (
  12598. el,
  12599. hydrating
  12600. ) {
  12601. el = el && !config._isServer ? query(el) : undefined;
  12602. return this._mount(el, hydrating)
  12603. };
  12604. // devtools global hook
  12605. /* istanbul ignore next */
  12606. setTimeout(function () {
  12607. if (config.devtools) {
  12608. if (devtools) {
  12609. devtools.emit('init', Vue$2);
  12610. } else if (
  12611. process.env.NODE_ENV !== 'production' &&
  12612. inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
  12613. ) {
  12614. console.log(
  12615. 'Download the Vue Devtools for a better development experience:\n' +
  12616. 'https://github.com/vuejs/vue-devtools'
  12617. );
  12618. }
  12619. }
  12620. }, 0);
  12621. module.exports = Vue$2;
  12622. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  12623. /***/ },
  12624. /* 48 */
  12625. /***/ function(module, exports, __webpack_require__) {
  12626. module.exports = { "default": __webpack_require__(177), __esModule: true };
  12627. /***/ },
  12628. /* 49 */
  12629. /***/ function(module, exports, __webpack_require__) {
  12630. var ciphers = __webpack_require__(166)
  12631. exports.createCipher = exports.Cipher = ciphers.createCipher
  12632. exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
  12633. var deciphers = __webpack_require__(165)
  12634. exports.createDecipher = exports.Decipher = deciphers.createDecipher
  12635. exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
  12636. var modes = __webpack_require__(36)
  12637. function getCiphers () {
  12638. return Object.keys(modes)
  12639. }
  12640. exports.listCiphers = exports.getCiphers = getCiphers
  12641. /***/ },
  12642. /* 50 */
  12643. /***/ function(module, exports, __webpack_require__) {
  12644. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(2);
  12645. var randomBytes = __webpack_require__(31);
  12646. module.exports = crt;
  12647. function blind(priv) {
  12648. var r = getr(priv);
  12649. var blinder = r.toRed(bn.mont(priv.modulus))
  12650. .redPow(new bn(priv.publicExponent)).fromRed();
  12651. return {
  12652. blinder: blinder,
  12653. unblinder:r.invm(priv.modulus)
  12654. };
  12655. }
  12656. function crt(msg, priv) {
  12657. var blinds = blind(priv);
  12658. var len = priv.modulus.byteLength();
  12659. var mod = bn.mont(priv.modulus);
  12660. var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
  12661. var c1 = blinded.toRed(bn.mont(priv.prime1));
  12662. var c2 = blinded.toRed(bn.mont(priv.prime2));
  12663. var qinv = priv.coefficient;
  12664. var p = priv.prime1;
  12665. var q = priv.prime2;
  12666. var m1 = c1.redPow(priv.exponent1);
  12667. var m2 = c2.redPow(priv.exponent2);
  12668. m1 = m1.fromRed();
  12669. m2 = m2.fromRed();
  12670. var h = m1.isub(m2).imul(qinv).umod(p);
  12671. h.imul(q);
  12672. m2.iadd(h);
  12673. return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
  12674. }
  12675. crt.getr = getr;
  12676. function getr(priv) {
  12677. var len = priv.modulus.byteLength();
  12678. var r = new bn(randomBytes(len));
  12679. while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
  12680. r = new bn(randomBytes(len));
  12681. }
  12682. return r;
  12683. }
  12684. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  12685. /***/ },
  12686. /* 51 */
  12687. /***/ function(module, exports, __webpack_require__) {
  12688. "use strict";
  12689. /* WEBPACK VAR INJECTION */(function(global) {'use strict';
  12690. var buffer = __webpack_require__(0);
  12691. var Buffer = buffer.Buffer;
  12692. var SlowBuffer = buffer.SlowBuffer;
  12693. var MAX_LEN = buffer.kMaxLength || 2147483647;
  12694. exports.alloc = function alloc(size, fill, encoding) {
  12695. if (typeof Buffer.alloc === 'function') {
  12696. return Buffer.alloc(size, fill, encoding);
  12697. }
  12698. if (typeof encoding === 'number') {
  12699. throw new TypeError('encoding must not be number');
  12700. }
  12701. if (typeof size !== 'number') {
  12702. throw new TypeError('size must be a number');
  12703. }
  12704. if (size > MAX_LEN) {
  12705. throw new RangeError('size is too large');
  12706. }
  12707. var enc = encoding;
  12708. var _fill = fill;
  12709. if (_fill === undefined) {
  12710. enc = undefined;
  12711. _fill = 0;
  12712. }
  12713. var buf = new Buffer(size);
  12714. if (typeof _fill === 'string') {
  12715. var fillBuf = new Buffer(_fill, enc);
  12716. var flen = fillBuf.length;
  12717. var i = -1;
  12718. while (++i < size) {
  12719. buf[i] = fillBuf[i % flen];
  12720. }
  12721. } else {
  12722. buf.fill(_fill);
  12723. }
  12724. return buf;
  12725. }
  12726. exports.allocUnsafe = function allocUnsafe(size) {
  12727. if (typeof Buffer.allocUnsafe === 'function') {
  12728. return Buffer.allocUnsafe(size);
  12729. }
  12730. if (typeof size !== 'number') {
  12731. throw new TypeError('size must be a number');
  12732. }
  12733. if (size > MAX_LEN) {
  12734. throw new RangeError('size is too large');
  12735. }
  12736. return new Buffer(size);
  12737. }
  12738. exports.from = function from(value, encodingOrOffset, length) {
  12739. if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
  12740. return Buffer.from(value, encodingOrOffset, length);
  12741. }
  12742. if (typeof value === 'number') {
  12743. throw new TypeError('"value" argument must not be a number');
  12744. }
  12745. if (typeof value === 'string') {
  12746. return new Buffer(value, encodingOrOffset);
  12747. }
  12748. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  12749. var offset = encodingOrOffset;
  12750. if (arguments.length === 1) {
  12751. return new Buffer(value);
  12752. }
  12753. if (typeof offset === 'undefined') {
  12754. offset = 0;
  12755. }
  12756. var len = length;
  12757. if (typeof len === 'undefined') {
  12758. len = value.byteLength - offset;
  12759. }
  12760. if (offset >= value.byteLength) {
  12761. throw new RangeError('\'offset\' is out of bounds');
  12762. }
  12763. if (len > value.byteLength - offset) {
  12764. throw new RangeError('\'length\' is out of bounds');
  12765. }
  12766. return new Buffer(value.slice(offset, offset + len));
  12767. }
  12768. if (Buffer.isBuffer(value)) {
  12769. var out = new Buffer(value.length);
  12770. value.copy(out, 0, 0, value.length);
  12771. return out;
  12772. }
  12773. if (value) {
  12774. if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
  12775. return new Buffer(value);
  12776. }
  12777. if (value.type === 'Buffer' && Array.isArray(value.data)) {
  12778. return new Buffer(value.data);
  12779. }
  12780. }
  12781. throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
  12782. }
  12783. exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
  12784. if (typeof Buffer.allocUnsafeSlow === 'function') {
  12785. return Buffer.allocUnsafeSlow(size);
  12786. }
  12787. if (typeof size !== 'number') {
  12788. throw new TypeError('size must be a number');
  12789. }
  12790. if (size >= MAX_LEN) {
  12791. throw new RangeError('size is too large');
  12792. }
  12793. return new SlowBuffer(size);
  12794. }
  12795. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  12796. /***/ },
  12797. /* 52 */
  12798. /***/ function(module, exports) {
  12799. module.exports = function(it){
  12800. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  12801. return it;
  12802. };
  12803. /***/ },
  12804. /* 53 */
  12805. /***/ function(module, exports) {
  12806. // 7.2.1 RequireObjectCoercible(argument)
  12807. module.exports = function(it){
  12808. if(it == undefined)throw TypeError("Can't call method on " + it);
  12809. return it;
  12810. };
  12811. /***/ },
  12812. /* 54 */
  12813. /***/ function(module, exports, __webpack_require__) {
  12814. var isObject = __webpack_require__(42)
  12815. , document = __webpack_require__(6).document
  12816. // in old IE typeof document.createElement is 'object'
  12817. , is = isObject(document) && isObject(document.createElement);
  12818. module.exports = function(it){
  12819. return is ? document.createElement(it) : {};
  12820. };
  12821. /***/ },
  12822. /* 55 */
  12823. /***/ function(module, exports) {
  12824. module.exports = function(exec){
  12825. try {
  12826. return !!exec();
  12827. } catch(e){
  12828. return true;
  12829. }
  12830. };
  12831. /***/ },
  12832. /* 56 */
  12833. /***/ function(module, exports, __webpack_require__) {
  12834. var def = __webpack_require__(28).f
  12835. , has = __webpack_require__(41)
  12836. , TAG = __webpack_require__(5)('toStringTag');
  12837. module.exports = function(it, tag, stat){
  12838. if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
  12839. };
  12840. /***/ },
  12841. /* 57 */
  12842. /***/ function(module, exports, __webpack_require__) {
  12843. var shared = __webpack_require__(99)('keys')
  12844. , uid = __webpack_require__(103);
  12845. module.exports = function(key){
  12846. return shared[key] || (shared[key] = uid(key));
  12847. };
  12848. /***/ },
  12849. /* 58 */
  12850. /***/ function(module, exports) {
  12851. // 7.1.4 ToInteger
  12852. var ceil = Math.ceil
  12853. , floor = Math.floor;
  12854. module.exports = function(it){
  12855. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  12856. };
  12857. /***/ },
  12858. /* 59 */
  12859. /***/ function(module, exports, __webpack_require__) {
  12860. // to indexed object, toObject with fallback for non-array-like ES3 strings
  12861. var IObject = __webpack_require__(94)
  12862. , defined = __webpack_require__(53);
  12863. module.exports = function(it){
  12864. return IObject(defined(it));
  12865. };
  12866. /***/ },
  12867. /* 60 */
  12868. /***/ function(module, exports, __webpack_require__) {
  12869. "use strict";
  12870. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  12871. var createHash = __webpack_require__(16);
  12872. var inherits = __webpack_require__(1)
  12873. var Transform = __webpack_require__(19).Transform
  12874. var ZEROS = new Buffer(128)
  12875. ZEROS.fill(0)
  12876. function Hmac(alg, key) {
  12877. Transform.call(this)
  12878. alg = alg.toLowerCase()
  12879. if (typeof key === 'string') {
  12880. key = new Buffer(key)
  12881. }
  12882. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  12883. this._alg = alg
  12884. this._key = key
  12885. if (key.length > blocksize) {
  12886. key = createHash(alg).update(key).digest()
  12887. } else if (key.length < blocksize) {
  12888. key = Buffer.concat([key, ZEROS], blocksize)
  12889. }
  12890. var ipad = this._ipad = new Buffer(blocksize)
  12891. var opad = this._opad = new Buffer(blocksize)
  12892. for (var i = 0; i < blocksize; i++) {
  12893. ipad[i] = key[i] ^ 0x36
  12894. opad[i] = key[i] ^ 0x5C
  12895. }
  12896. this._hash = createHash(alg).update(ipad)
  12897. }
  12898. inherits(Hmac, Transform)
  12899. Hmac.prototype.update = function (data, enc) {
  12900. this._hash.update(data, enc)
  12901. return this
  12902. }
  12903. Hmac.prototype._transform = function (data, _, next) {
  12904. this._hash.update(data)
  12905. next()
  12906. }
  12907. Hmac.prototype._flush = function (next) {
  12908. this.push(this.digest())
  12909. next()
  12910. }
  12911. Hmac.prototype.digest = function (enc) {
  12912. var h = this._hash.digest()
  12913. return createHash(this._alg).update(this._opad).update(h).digest(enc)
  12914. }
  12915. module.exports = function createHmac(alg, key) {
  12916. return new Hmac(alg, key)
  12917. }
  12918. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  12919. /***/ },
  12920. /* 61 */
  12921. /***/ function(module, exports, __webpack_require__) {
  12922. "use strict";
  12923. 'use strict';
  12924. exports.utils = __webpack_require__(229);
  12925. exports.Cipher = __webpack_require__(226);
  12926. exports.DES = __webpack_require__(227);
  12927. exports.CBC = __webpack_require__(225);
  12928. exports.EDE = __webpack_require__(228);
  12929. /***/ },
  12930. /* 62 */
  12931. /***/ function(module, exports, __webpack_require__) {
  12932. "use strict";
  12933. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  12934. if (!process.version ||
  12935. process.version.indexOf('v0.') === 0 ||
  12936. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12937. module.exports = nextTick;
  12938. } else {
  12939. module.exports = process.nextTick;
  12940. }
  12941. function nextTick(fn, arg1, arg2, arg3) {
  12942. if (typeof fn !== 'function') {
  12943. throw new TypeError('"callback" argument must be a function');
  12944. }
  12945. var len = arguments.length;
  12946. var args, i;
  12947. switch (len) {
  12948. case 0:
  12949. case 1:
  12950. return process.nextTick(fn);
  12951. case 2:
  12952. return process.nextTick(function afterTickOne() {
  12953. fn.call(null, arg1);
  12954. });
  12955. case 3:
  12956. return process.nextTick(function afterTickTwo() {
  12957. fn.call(null, arg1, arg2);
  12958. });
  12959. case 4:
  12960. return process.nextTick(function afterTickThree() {
  12961. fn.call(null, arg1, arg2, arg3);
  12962. });
  12963. default:
  12964. args = new Array(len - 1);
  12965. i = 0;
  12966. while (i < args.length) {
  12967. args[i++] = arguments[i];
  12968. }
  12969. return process.nextTick(function afterTick() {
  12970. fn.apply(null, args);
  12971. });
  12972. }
  12973. }
  12974. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  12975. /***/ },
  12976. /* 63 */
  12977. /***/ function(module, exports, __webpack_require__) {
  12978. "use strict";
  12979. // a transform stream is a readable/writable stream where you do
  12980. // something with the data. Sometimes it's called a "filter",
  12981. // but that's not a great name for it, since that implies a thing where
  12982. // some bits pass through, and others are simply ignored. (That would
  12983. // be a valid example of a transform, of course.)
  12984. //
  12985. // While the output is causally related to the input, it's not a
  12986. // necessarily symmetric or synchronous transformation. For example,
  12987. // a zlib stream might take multiple plain-text writes(), and then
  12988. // emit a single compressed chunk some time in the future.
  12989. //
  12990. // Here's how this works:
  12991. //
  12992. // The Transform stream has all the aspects of the readable and writable
  12993. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  12994. // internally, and returns false if there's a lot of pending writes
  12995. // buffered up. When you call read(), that calls _read(n) until
  12996. // there's enough pending readable data buffered up.
  12997. //
  12998. // In a transform stream, the written data is placed in a buffer. When
  12999. // _read(n) is called, it transforms the queued up data, calling the
  13000. // buffered _write cb's as it consumes chunks. If consuming a single
  13001. // written chunk would result in multiple output chunks, then the first
  13002. // outputted bit calls the readcb, and subsequent chunks just go into
  13003. // the read buffer, and will cause it to emit 'readable' if necessary.
  13004. //
  13005. // This way, back-pressure is actually determined by the reading side,
  13006. // since _read has to be called to start processing a new chunk. However,
  13007. // a pathological inflate type of transform can cause excessive buffering
  13008. // here. For example, imagine a stream where every byte of input is
  13009. // interpreted as an integer from 0-255, and then results in that many
  13010. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  13011. // 1kb of data being output. In this case, you could write a very small
  13012. // amount of input, and end up with a very large amount of output. In
  13013. // such a pathological inflating mechanism, there'd be no way to tell
  13014. // the system to stop doing the transform. A single 4MB write could
  13015. // cause the system to run out of memory.
  13016. //
  13017. // However, even in such a pathological case, only a single written chunk
  13018. // would be consumed, and then the rest would wait (un-transformed) until
  13019. // the results of the previous transformed chunk were consumed.
  13020. 'use strict';
  13021. module.exports = Transform;
  13022. var Duplex = __webpack_require__(10);
  13023. /*<replacement>*/
  13024. var util = __webpack_require__(29);
  13025. util.inherits = __webpack_require__(1);
  13026. /*</replacement>*/
  13027. util.inherits(Transform, Duplex);
  13028. function TransformState(stream) {
  13029. this.afterTransform = function (er, data) {
  13030. return afterTransform(stream, er, data);
  13031. };
  13032. this.needTransform = false;
  13033. this.transforming = false;
  13034. this.writecb = null;
  13035. this.writechunk = null;
  13036. this.writeencoding = null;
  13037. }
  13038. function afterTransform(stream, er, data) {
  13039. var ts = stream._transformState;
  13040. ts.transforming = false;
  13041. var cb = ts.writecb;
  13042. if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
  13043. ts.writechunk = null;
  13044. ts.writecb = null;
  13045. if (data !== null && data !== undefined) stream.push(data);
  13046. cb(er);
  13047. var rs = stream._readableState;
  13048. rs.reading = false;
  13049. if (rs.needReadable || rs.length < rs.highWaterMark) {
  13050. stream._read(rs.highWaterMark);
  13051. }
  13052. }
  13053. function Transform(options) {
  13054. if (!(this instanceof Transform)) return new Transform(options);
  13055. Duplex.call(this, options);
  13056. this._transformState = new TransformState(this);
  13057. // when the writable side finishes, then flush out anything remaining.
  13058. var stream = this;
  13059. // start out asking for a readable event once data is transformed.
  13060. this._readableState.needReadable = true;
  13061. // we have implemented the _read method, and done the other things
  13062. // that Readable wants before the first _read call, so unset the
  13063. // sync guard flag.
  13064. this._readableState.sync = false;
  13065. if (options) {
  13066. if (typeof options.transform === 'function') this._transform = options.transform;
  13067. if (typeof options.flush === 'function') this._flush = options.flush;
  13068. }
  13069. this.once('prefinish', function () {
  13070. if (typeof this._flush === 'function') this._flush(function (er) {
  13071. done(stream, er);
  13072. });else done(stream);
  13073. });
  13074. }
  13075. Transform.prototype.push = function (chunk, encoding) {
  13076. this._transformState.needTransform = false;
  13077. return Duplex.prototype.push.call(this, chunk, encoding);
  13078. };
  13079. // This is the part where you do stuff!
  13080. // override this function in implementation classes.
  13081. // 'chunk' is an input chunk.
  13082. //
  13083. // Call `push(newChunk)` to pass along transformed output
  13084. // to the readable side. You may call 'push' zero or more times.
  13085. //
  13086. // Call `cb(err)` when you are done with this chunk. If you pass
  13087. // an error, then that'll put the hurt on the whole operation. If you
  13088. // never call cb(), then you'll never get another chunk.
  13089. Transform.prototype._transform = function (chunk, encoding, cb) {
  13090. throw new Error('Not implemented');
  13091. };
  13092. Transform.prototype._write = function (chunk, encoding, cb) {
  13093. var ts = this._transformState;
  13094. ts.writecb = cb;
  13095. ts.writechunk = chunk;
  13096. ts.writeencoding = encoding;
  13097. if (!ts.transforming) {
  13098. var rs = this._readableState;
  13099. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  13100. }
  13101. };
  13102. // Doesn't matter what the args are here.
  13103. // _transform does all the work.
  13104. // That we got here means that the readable side wants more data.
  13105. Transform.prototype._read = function (n) {
  13106. var ts = this._transformState;
  13107. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  13108. ts.transforming = true;
  13109. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  13110. } else {
  13111. // mark that we need a transform, so that any data that comes in
  13112. // will get processed, now that we've asked for it.
  13113. ts.needTransform = true;
  13114. }
  13115. };
  13116. function done(stream, er) {
  13117. if (er) return stream.emit('error', er);
  13118. // if there's nothing in the write buffer, then that means
  13119. // that nothing more will ever be provided
  13120. var ws = stream._writableState;
  13121. var ts = stream._transformState;
  13122. if (ws.length) throw new Error('Calling transform done when ws.length != 0');
  13123. if (ts.transforming) throw new Error('Calling transform done when still transforming');
  13124. return stream.push(null);
  13125. }
  13126. /***/ },
  13127. /* 64 */
  13128. /***/ function(module, exports, __webpack_require__) {
  13129. "use strict";
  13130. /* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
  13131. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13132. // the drain event emission and buffering.
  13133. 'use strict';
  13134. module.exports = Writable;
  13135. /*<replacement>*/
  13136. var processNextTick = __webpack_require__(62);
  13137. /*</replacement>*/
  13138. /*<replacement>*/
  13139. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
  13140. /*</replacement>*/
  13141. Writable.WritableState = WritableState;
  13142. /*<replacement>*/
  13143. var util = __webpack_require__(29);
  13144. util.inherits = __webpack_require__(1);
  13145. /*</replacement>*/
  13146. /*<replacement>*/
  13147. var internalUtil = {
  13148. deprecate: __webpack_require__(282)
  13149. };
  13150. /*</replacement>*/
  13151. /*<replacement>*/
  13152. var Stream;
  13153. (function () {
  13154. try {
  13155. Stream = __webpack_require__(19);
  13156. } catch (_) {} finally {
  13157. if (!Stream) Stream = __webpack_require__(44).EventEmitter;
  13158. }
  13159. })();
  13160. /*</replacement>*/
  13161. var Buffer = __webpack_require__(0).Buffer;
  13162. /*<replacement>*/
  13163. var bufferShim = __webpack_require__(51);
  13164. /*</replacement>*/
  13165. util.inherits(Writable, Stream);
  13166. function nop() {}
  13167. function WriteReq(chunk, encoding, cb) {
  13168. this.chunk = chunk;
  13169. this.encoding = encoding;
  13170. this.callback = cb;
  13171. this.next = null;
  13172. }
  13173. var Duplex;
  13174. function WritableState(options, stream) {
  13175. Duplex = Duplex || __webpack_require__(10);
  13176. options = options || {};
  13177. // object stream flag to indicate whether or not this stream
  13178. // contains buffers or objects.
  13179. this.objectMode = !!options.objectMode;
  13180. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13181. // the point at which write() starts returning false
  13182. // Note: 0 is a valid value, means that we always return false if
  13183. // the entire buffer is not flushed immediately on write()
  13184. var hwm = options.highWaterMark;
  13185. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13186. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  13187. // cast to ints.
  13188. this.highWaterMark = ~ ~this.highWaterMark;
  13189. this.needDrain = false;
  13190. // at the start of calling end()
  13191. this.ending = false;
  13192. // when end() has been called, and returned
  13193. this.ended = false;
  13194. // when 'finish' is emitted
  13195. this.finished = false;
  13196. // should we decode strings into buffers before passing to _write?
  13197. // this is here so that some node-core streams can optimize string
  13198. // handling at a lower level.
  13199. var noDecode = options.decodeStrings === false;
  13200. this.decodeStrings = !noDecode;
  13201. // Crypto is kind of old and crusty. Historically, its default string
  13202. // encoding is 'binary' so we have to make this configurable.
  13203. // Everything else in the universe uses 'utf8', though.
  13204. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13205. // not an actual buffer we keep track of, but a measurement
  13206. // of how much we're waiting to get pushed to some underlying
  13207. // socket or file.
  13208. this.length = 0;
  13209. // a flag to see when we're in the middle of a write.
  13210. this.writing = false;
  13211. // when true all writes will be buffered until .uncork() call
  13212. this.corked = 0;
  13213. // a flag to be able to tell if the onwrite cb is called immediately,
  13214. // or on a later tick. We set this to true at first, because any
  13215. // actions that shouldn't happen until "later" should generally also
  13216. // not happen before the first write call.
  13217. this.sync = true;
  13218. // a flag to know if we're processing previously buffered items, which
  13219. // may call the _write() callback in the same tick, so that we don't
  13220. // end up in an overlapped onwrite situation.
  13221. this.bufferProcessing = false;
  13222. // the callback that's passed to _write(chunk,cb)
  13223. this.onwrite = function (er) {
  13224. onwrite(stream, er);
  13225. };
  13226. // the callback that the user supplies to write(chunk,encoding,cb)
  13227. this.writecb = null;
  13228. // the amount that is being written when _write is called.
  13229. this.writelen = 0;
  13230. this.bufferedRequest = null;
  13231. this.lastBufferedRequest = null;
  13232. // number of pending user-supplied write callbacks
  13233. // this must be 0 before 'finish' can be emitted
  13234. this.pendingcb = 0;
  13235. // emit prefinish if the only thing we're waiting for is _write cbs
  13236. // This is relevant for synchronous Transform streams
  13237. this.prefinished = false;
  13238. // True if the error was already emitted and should not be thrown again
  13239. this.errorEmitted = false;
  13240. // count buffered requests
  13241. this.bufferedRequestCount = 0;
  13242. // allocate the first CorkedRequest, there is always
  13243. // one allocated and free to use, and we maintain at most two
  13244. this.corkedRequestsFree = new CorkedRequest(this);
  13245. }
  13246. WritableState.prototype.getBuffer = function writableStateGetBuffer() {
  13247. var current = this.bufferedRequest;
  13248. var out = [];
  13249. while (current) {
  13250. out.push(current);
  13251. current = current.next;
  13252. }
  13253. return out;
  13254. };
  13255. (function () {
  13256. try {
  13257. Object.defineProperty(WritableState.prototype, 'buffer', {
  13258. get: internalUtil.deprecate(function () {
  13259. return this.getBuffer();
  13260. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
  13261. });
  13262. } catch (_) {}
  13263. })();
  13264. var Duplex;
  13265. function Writable(options) {
  13266. Duplex = Duplex || __webpack_require__(10);
  13267. // Writable ctor is applied to Duplexes, though they're not
  13268. // instanceof Writable, they're instanceof Readable.
  13269. if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
  13270. this._writableState = new WritableState(options, this);
  13271. // legacy.
  13272. this.writable = true;
  13273. if (options) {
  13274. if (typeof options.write === 'function') this._write = options.write;
  13275. if (typeof options.writev === 'function') this._writev = options.writev;
  13276. }
  13277. Stream.call(this);
  13278. }
  13279. // Otherwise people can pipe Writable streams, which is just wrong.
  13280. Writable.prototype.pipe = function () {
  13281. this.emit('error', new Error('Cannot pipe, not readable'));
  13282. };
  13283. function writeAfterEnd(stream, cb) {
  13284. var er = new Error('write after end');
  13285. // TODO: defer error events consistently everywhere, not just the cb
  13286. stream.emit('error', er);
  13287. processNextTick(cb, er);
  13288. }
  13289. // If we get something that is not a buffer, string, null, or undefined,
  13290. // and we're not in objectMode, then that's an error.
  13291. // Otherwise stream chunks are all considered to be of length=1, and the
  13292. // watermarks determine how many objects to keep in the buffer, rather than
  13293. // how many bytes or characters.
  13294. function validChunk(stream, state, chunk, cb) {
  13295. var valid = true;
  13296. var er = false;
  13297. // Always throw error if a null is written
  13298. // if we are not in object mode then throw
  13299. // if it is not a buffer, string, or undefined.
  13300. if (chunk === null) {
  13301. er = new TypeError('May not write null values to stream');
  13302. } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  13303. er = new TypeError('Invalid non-string/buffer chunk');
  13304. }
  13305. if (er) {
  13306. stream.emit('error', er);
  13307. processNextTick(cb, er);
  13308. valid = false;
  13309. }
  13310. return valid;
  13311. }
  13312. Writable.prototype.write = function (chunk, encoding, cb) {
  13313. var state = this._writableState;
  13314. var ret = false;
  13315. if (typeof encoding === 'function') {
  13316. cb = encoding;
  13317. encoding = null;
  13318. }
  13319. if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  13320. if (typeof cb !== 'function') cb = nop;
  13321. if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
  13322. state.pendingcb++;
  13323. ret = writeOrBuffer(this, state, chunk, encoding, cb);
  13324. }
  13325. return ret;
  13326. };
  13327. Writable.prototype.cork = function () {
  13328. var state = this._writableState;
  13329. state.corked++;
  13330. };
  13331. Writable.prototype.uncork = function () {
  13332. var state = this._writableState;
  13333. if (state.corked) {
  13334. state.corked--;
  13335. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  13336. }
  13337. };
  13338. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  13339. // node::ParseEncoding() requires lower case.
  13340. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  13341. 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);
  13342. this._writableState.defaultEncoding = encoding;
  13343. return this;
  13344. };
  13345. function decodeChunk(state, chunk, encoding) {
  13346. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  13347. chunk = bufferShim.from(chunk, encoding);
  13348. }
  13349. return chunk;
  13350. }
  13351. // if we're already writing something, then just put this
  13352. // in the queue, and wait our turn. Otherwise, call _write
  13353. // If we return false, then we need a drain event, so set that flag.
  13354. function writeOrBuffer(stream, state, chunk, encoding, cb) {
  13355. chunk = decodeChunk(state, chunk, encoding);
  13356. if (Buffer.isBuffer(chunk)) encoding = 'buffer';
  13357. var len = state.objectMode ? 1 : chunk.length;
  13358. state.length += len;
  13359. var ret = state.length < state.highWaterMark;
  13360. // we must ensure that previous needDrain will not be reset to false.
  13361. if (!ret) state.needDrain = true;
  13362. if (state.writing || state.corked) {
  13363. var last = state.lastBufferedRequest;
  13364. state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
  13365. if (last) {
  13366. last.next = state.lastBufferedRequest;
  13367. } else {
  13368. state.bufferedRequest = state.lastBufferedRequest;
  13369. }
  13370. state.bufferedRequestCount += 1;
  13371. } else {
  13372. doWrite(stream, state, false, len, chunk, encoding, cb);
  13373. }
  13374. return ret;
  13375. }
  13376. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  13377. state.writelen = len;
  13378. state.writecb = cb;
  13379. state.writing = true;
  13380. state.sync = true;
  13381. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  13382. state.sync = false;
  13383. }
  13384. function onwriteError(stream, state, sync, er, cb) {
  13385. --state.pendingcb;
  13386. if (sync) processNextTick(cb, er);else cb(er);
  13387. stream._writableState.errorEmitted = true;
  13388. stream.emit('error', er);
  13389. }
  13390. function onwriteStateUpdate(state) {
  13391. state.writing = false;
  13392. state.writecb = null;
  13393. state.length -= state.writelen;
  13394. state.writelen = 0;
  13395. }
  13396. function onwrite(stream, er) {
  13397. var state = stream._writableState;
  13398. var sync = state.sync;
  13399. var cb = state.writecb;
  13400. onwriteStateUpdate(state);
  13401. if (er) onwriteError(stream, state, sync, er, cb);else {
  13402. // Check if we're actually ready to finish, but don't emit yet
  13403. var finished = needFinish(state);
  13404. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  13405. clearBuffer(stream, state);
  13406. }
  13407. if (sync) {
  13408. /*<replacement>*/
  13409. asyncWrite(afterWrite, stream, state, finished, cb);
  13410. /*</replacement>*/
  13411. } else {
  13412. afterWrite(stream, state, finished, cb);
  13413. }
  13414. }
  13415. }
  13416. function afterWrite(stream, state, finished, cb) {
  13417. if (!finished) onwriteDrain(stream, state);
  13418. state.pendingcb--;
  13419. cb();
  13420. finishMaybe(stream, state);
  13421. }
  13422. // Must force callback to be called on nextTick, so that we don't
  13423. // emit 'drain' before the write() consumer gets the 'false' return
  13424. // value, and has a chance to attach a 'drain' listener.
  13425. function onwriteDrain(stream, state) {
  13426. if (state.length === 0 && state.needDrain) {
  13427. state.needDrain = false;
  13428. stream.emit('drain');
  13429. }
  13430. }
  13431. // if there's something in the buffer waiting, then process it
  13432. function clearBuffer(stream, state) {
  13433. state.bufferProcessing = true;
  13434. var entry = state.bufferedRequest;
  13435. if (stream._writev && entry && entry.next) {
  13436. // Fast case, write everything using _writev()
  13437. var l = state.bufferedRequestCount;
  13438. var buffer = new Array(l);
  13439. var holder = state.corkedRequestsFree;
  13440. holder.entry = entry;
  13441. var count = 0;
  13442. while (entry) {
  13443. buffer[count] = entry;
  13444. entry = entry.next;
  13445. count += 1;
  13446. }
  13447. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  13448. // doWrite is almost always async, defer these to save a bit of time
  13449. // as the hot path ends with doWrite
  13450. state.pendingcb++;
  13451. state.lastBufferedRequest = null;
  13452. if (holder.next) {
  13453. state.corkedRequestsFree = holder.next;
  13454. holder.next = null;
  13455. } else {
  13456. state.corkedRequestsFree = new CorkedRequest(state);
  13457. }
  13458. } else {
  13459. // Slow case, write chunks one-by-one
  13460. while (entry) {
  13461. var chunk = entry.chunk;
  13462. var encoding = entry.encoding;
  13463. var cb = entry.callback;
  13464. var len = state.objectMode ? 1 : chunk.length;
  13465. doWrite(stream, state, false, len, chunk, encoding, cb);
  13466. entry = entry.next;
  13467. // if we didn't call the onwrite immediately, then
  13468. // it means that we need to wait until it does.
  13469. // also, that means that the chunk and cb are currently
  13470. // being processed, so move the buffer counter past them.
  13471. if (state.writing) {
  13472. break;
  13473. }
  13474. }
  13475. if (entry === null) state.lastBufferedRequest = null;
  13476. }
  13477. state.bufferedRequestCount = 0;
  13478. state.bufferedRequest = entry;
  13479. state.bufferProcessing = false;
  13480. }
  13481. Writable.prototype._write = function (chunk, encoding, cb) {
  13482. cb(new Error('not implemented'));
  13483. };
  13484. Writable.prototype._writev = null;
  13485. Writable.prototype.end = function (chunk, encoding, cb) {
  13486. var state = this._writableState;
  13487. if (typeof chunk === 'function') {
  13488. cb = chunk;
  13489. chunk = null;
  13490. encoding = null;
  13491. } else if (typeof encoding === 'function') {
  13492. cb = encoding;
  13493. encoding = null;
  13494. }
  13495. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  13496. // .end() fully uncorks
  13497. if (state.corked) {
  13498. state.corked = 1;
  13499. this.uncork();
  13500. }
  13501. // ignore unnecessary end() calls.
  13502. if (!state.ending && !state.finished) endWritable(this, state, cb);
  13503. };
  13504. function needFinish(state) {
  13505. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  13506. }
  13507. function prefinish(stream, state) {
  13508. if (!state.prefinished) {
  13509. state.prefinished = true;
  13510. stream.emit('prefinish');
  13511. }
  13512. }
  13513. function finishMaybe(stream, state) {
  13514. var need = needFinish(state);
  13515. if (need) {
  13516. if (state.pendingcb === 0) {
  13517. prefinish(stream, state);
  13518. state.finished = true;
  13519. stream.emit('finish');
  13520. } else {
  13521. prefinish(stream, state);
  13522. }
  13523. }
  13524. return need;
  13525. }
  13526. function endWritable(stream, state, cb) {
  13527. state.ending = true;
  13528. finishMaybe(stream, state);
  13529. if (cb) {
  13530. if (state.finished) processNextTick(cb);else stream.once('finish', cb);
  13531. }
  13532. state.ended = true;
  13533. stream.writable = false;
  13534. }
  13535. // It seems a linked list but it is not
  13536. // there will be only 2 of these for each stream
  13537. function CorkedRequest(state) {
  13538. var _this = this;
  13539. this.next = null;
  13540. this.entry = null;
  13541. this.finish = function (err) {
  13542. var entry = _this.entry;
  13543. _this.entry = null;
  13544. while (entry) {
  13545. var cb = entry.callback;
  13546. state.pendingcb--;
  13547. cb(err);
  13548. entry = entry.next;
  13549. }
  13550. if (state.corkedRequestsFree) {
  13551. state.corkedRequestsFree.next = _this;
  13552. } else {
  13553. state.corkedRequestsFree = _this;
  13554. }
  13555. };
  13556. }
  13557. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(66).setImmediate))
  13558. /***/ },
  13559. /* 65 */
  13560. /***/ function(module, exports, __webpack_require__) {
  13561. // Copyright Joyent, Inc. and other Node contributors.
  13562. //
  13563. // Permission is hereby granted, free of charge, to any person obtaining a
  13564. // copy of this software and associated documentation files (the
  13565. // "Software"), to deal in the Software without restriction, including
  13566. // without limitation the rights to use, copy, modify, merge, publish,
  13567. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13568. // persons to whom the Software is furnished to do so, subject to the
  13569. // following conditions:
  13570. //
  13571. // The above copyright notice and this permission notice shall be included
  13572. // in all copies or substantial portions of the Software.
  13573. //
  13574. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13575. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13576. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13577. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13578. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13579. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13580. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13581. var Buffer = __webpack_require__(0).Buffer;
  13582. var isBufferEncoding = Buffer.isEncoding
  13583. || function(encoding) {
  13584. switch (encoding && encoding.toLowerCase()) {
  13585. 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': return true;
  13586. default: return false;
  13587. }
  13588. }
  13589. function assertEncoding(encoding) {
  13590. if (encoding && !isBufferEncoding(encoding)) {
  13591. throw new Error('Unknown encoding: ' + encoding);
  13592. }
  13593. }
  13594. // StringDecoder provides an interface for efficiently splitting a series of
  13595. // buffers into a series of JS strings without breaking apart multi-byte
  13596. // characters. CESU-8 is handled as part of the UTF-8 encoding.
  13597. //
  13598. // @TODO Handling all encodings inside a single object makes it very difficult
  13599. // to reason about this code, so it should be split up in the future.
  13600. // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
  13601. // points as used by CESU-8.
  13602. var StringDecoder = exports.StringDecoder = function(encoding) {
  13603. this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
  13604. assertEncoding(encoding);
  13605. switch (this.encoding) {
  13606. case 'utf8':
  13607. // CESU-8 represents each of Surrogate Pair by 3-bytes
  13608. this.surrogateSize = 3;
  13609. break;
  13610. case 'ucs2':
  13611. case 'utf16le':
  13612. // UTF-16 represents each of Surrogate Pair by 2-bytes
  13613. this.surrogateSize = 2;
  13614. this.detectIncompleteChar = utf16DetectIncompleteChar;
  13615. break;
  13616. case 'base64':
  13617. // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
  13618. this.surrogateSize = 3;
  13619. this.detectIncompleteChar = base64DetectIncompleteChar;
  13620. break;
  13621. default:
  13622. this.write = passThroughWrite;
  13623. return;
  13624. }
  13625. // Enough space to store all bytes of a single character. UTF-8 needs 4
  13626. // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
  13627. this.charBuffer = new Buffer(6);
  13628. // Number of bytes received for the current incomplete multi-byte character.
  13629. this.charReceived = 0;
  13630. // Number of bytes expected for the current incomplete multi-byte character.
  13631. this.charLength = 0;
  13632. };
  13633. // write decodes the given buffer and returns it as JS string that is
  13634. // guaranteed to not contain any partial multi-byte characters. Any partial
  13635. // character found at the end of the buffer is buffered up, and will be
  13636. // returned when calling write again with the remaining bytes.
  13637. //
  13638. // Note: Converting a Buffer containing an orphan surrogate to a String
  13639. // currently works, but converting a String to a Buffer (via `new Buffer`, or
  13640. // Buffer#write) will replace incomplete surrogates with the unicode
  13641. // replacement character. See https://codereview.chromium.org/121173009/ .
  13642. StringDecoder.prototype.write = function(buffer) {
  13643. var charStr = '';
  13644. // if our last write ended with an incomplete multibyte character
  13645. while (this.charLength) {
  13646. // determine how many remaining bytes this buffer has to offer for this char
  13647. var available = (buffer.length >= this.charLength - this.charReceived) ?
  13648. this.charLength - this.charReceived :
  13649. buffer.length;
  13650. // add the new bytes to the char buffer
  13651. buffer.copy(this.charBuffer, this.charReceived, 0, available);
  13652. this.charReceived += available;
  13653. if (this.charReceived < this.charLength) {
  13654. // still not enough chars in this buffer? wait for more ...
  13655. return '';
  13656. }
  13657. // remove bytes belonging to the current character from the buffer
  13658. buffer = buffer.slice(available, buffer.length);
  13659. // get the character that was split
  13660. charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
  13661. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  13662. var charCode = charStr.charCodeAt(charStr.length - 1);
  13663. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  13664. this.charLength += this.surrogateSize;
  13665. charStr = '';
  13666. continue;
  13667. }
  13668. this.charReceived = this.charLength = 0;
  13669. // if there are no more bytes in this buffer, just emit our char
  13670. if (buffer.length === 0) {
  13671. return charStr;
  13672. }
  13673. break;
  13674. }
  13675. // determine and set charLength / charReceived
  13676. this.detectIncompleteChar(buffer);
  13677. var end = buffer.length;
  13678. if (this.charLength) {
  13679. // buffer the incomplete character bytes we got
  13680. buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
  13681. end -= this.charReceived;
  13682. }
  13683. charStr += buffer.toString(this.encoding, 0, end);
  13684. var end = charStr.length - 1;
  13685. var charCode = charStr.charCodeAt(end);
  13686. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  13687. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  13688. var size = this.surrogateSize;
  13689. this.charLength += size;
  13690. this.charReceived += size;
  13691. this.charBuffer.copy(this.charBuffer, size, 0, size);
  13692. buffer.copy(this.charBuffer, 0, 0, size);
  13693. return charStr.substring(0, end);
  13694. }
  13695. // or just emit the charStr
  13696. return charStr;
  13697. };
  13698. // detectIncompleteChar determines if there is an incomplete UTF-8 character at
  13699. // the end of the given buffer. If so, it sets this.charLength to the byte
  13700. // length that character, and sets this.charReceived to the number of bytes
  13701. // that are available for this character.
  13702. StringDecoder.prototype.detectIncompleteChar = function(buffer) {
  13703. // determine how many bytes we have to check at the end of this buffer
  13704. var i = (buffer.length >= 3) ? 3 : buffer.length;
  13705. // Figure out if one of the last i bytes of our buffer announces an
  13706. // incomplete char.
  13707. for (; i > 0; i--) {
  13708. var c = buffer[buffer.length - i];
  13709. // See http://en.wikipedia.org/wiki/UTF-8#Description
  13710. // 110XXXXX
  13711. if (i == 1 && c >> 5 == 0x06) {
  13712. this.charLength = 2;
  13713. break;
  13714. }
  13715. // 1110XXXX
  13716. if (i <= 2 && c >> 4 == 0x0E) {
  13717. this.charLength = 3;
  13718. break;
  13719. }
  13720. // 11110XXX
  13721. if (i <= 3 && c >> 3 == 0x1E) {
  13722. this.charLength = 4;
  13723. break;
  13724. }
  13725. }
  13726. this.charReceived = i;
  13727. };
  13728. StringDecoder.prototype.end = function(buffer) {
  13729. var res = '';
  13730. if (buffer && buffer.length)
  13731. res = this.write(buffer);
  13732. if (this.charReceived) {
  13733. var cr = this.charReceived;
  13734. var buf = this.charBuffer;
  13735. var enc = this.encoding;
  13736. res += buf.slice(0, cr).toString(enc);
  13737. }
  13738. return res;
  13739. };
  13740. function passThroughWrite(buffer) {
  13741. return buffer.toString(this.encoding);
  13742. }
  13743. function utf16DetectIncompleteChar(buffer) {
  13744. this.charReceived = buffer.length % 2;
  13745. this.charLength = this.charReceived ? 2 : 0;
  13746. }
  13747. function base64DetectIncompleteChar(buffer) {
  13748. this.charReceived = buffer.length % 3;
  13749. this.charLength = this.charReceived ? 3 : 0;
  13750. }
  13751. /***/ },
  13752. /* 66 */
  13753. /***/ function(module, exports, __webpack_require__) {
  13754. /* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(7).nextTick;
  13755. var apply = Function.prototype.apply;
  13756. var slice = Array.prototype.slice;
  13757. var immediateIds = {};
  13758. var nextImmediateId = 0;
  13759. // DOM APIs, for completeness
  13760. exports.setTimeout = function() {
  13761. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  13762. };
  13763. exports.setInterval = function() {
  13764. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  13765. };
  13766. exports.clearTimeout =
  13767. exports.clearInterval = function(timeout) { timeout.close(); };
  13768. function Timeout(id, clearFn) {
  13769. this._id = id;
  13770. this._clearFn = clearFn;
  13771. }
  13772. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  13773. Timeout.prototype.close = function() {
  13774. this._clearFn.call(window, this._id);
  13775. };
  13776. // Does not start the time, just sets up the members needed.
  13777. exports.enroll = function(item, msecs) {
  13778. clearTimeout(item._idleTimeoutId);
  13779. item._idleTimeout = msecs;
  13780. };
  13781. exports.unenroll = function(item) {
  13782. clearTimeout(item._idleTimeoutId);
  13783. item._idleTimeout = -1;
  13784. };
  13785. exports._unrefActive = exports.active = function(item) {
  13786. clearTimeout(item._idleTimeoutId);
  13787. var msecs = item._idleTimeout;
  13788. if (msecs >= 0) {
  13789. item._idleTimeoutId = setTimeout(function onTimeout() {
  13790. if (item._onTimeout)
  13791. item._onTimeout();
  13792. }, msecs);
  13793. }
  13794. };
  13795. // That's not how node.js implements it but the exposed api is the same.
  13796. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  13797. var id = nextImmediateId++;
  13798. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  13799. immediateIds[id] = true;
  13800. nextTick(function onNextTick() {
  13801. if (immediateIds[id]) {
  13802. // fn.call() is faster so we optimize for the common use-case
  13803. // @see http://jsperf.com/call-apply-segu
  13804. if (args) {
  13805. fn.apply(null, args);
  13806. } else {
  13807. fn.call(null);
  13808. }
  13809. // Prevent ids from leaking
  13810. exports.clearImmediate(id);
  13811. }
  13812. });
  13813. return id;
  13814. };
  13815. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  13816. delete immediateIds[id];
  13817. };
  13818. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(66).setImmediate, __webpack_require__(66).clearImmediate))
  13819. /***/ },
  13820. /* 67 */
  13821. /***/ function(module, exports, __webpack_require__) {
  13822. var inherits = __webpack_require__(1);
  13823. var Reporter = __webpack_require__(21).Reporter;
  13824. var Buffer = __webpack_require__(0).Buffer;
  13825. function DecoderBuffer(base, options) {
  13826. Reporter.call(this, options);
  13827. if (!Buffer.isBuffer(base)) {
  13828. this.error('Input not Buffer');
  13829. return;
  13830. }
  13831. this.base = base;
  13832. this.offset = 0;
  13833. this.length = base.length;
  13834. }
  13835. inherits(DecoderBuffer, Reporter);
  13836. exports.DecoderBuffer = DecoderBuffer;
  13837. DecoderBuffer.prototype.save = function save() {
  13838. return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
  13839. };
  13840. DecoderBuffer.prototype.restore = function restore(save) {
  13841. // Return skipped data
  13842. var res = new DecoderBuffer(this.base);
  13843. res.offset = save.offset;
  13844. res.length = this.offset;
  13845. this.offset = save.offset;
  13846. Reporter.prototype.restore.call(this, save.reporter);
  13847. return res;
  13848. };
  13849. DecoderBuffer.prototype.isEmpty = function isEmpty() {
  13850. return this.offset === this.length;
  13851. };
  13852. DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
  13853. if (this.offset + 1 <= this.length)
  13854. return this.base.readUInt8(this.offset++, true);
  13855. else
  13856. return this.error(fail || 'DecoderBuffer overrun');
  13857. }
  13858. DecoderBuffer.prototype.skip = function skip(bytes, fail) {
  13859. if (!(this.offset + bytes <= this.length))
  13860. return this.error(fail || 'DecoderBuffer overrun');
  13861. var res = new DecoderBuffer(this.base);
  13862. // Share reporter state
  13863. res._reporterState = this._reporterState;
  13864. res.offset = this.offset;
  13865. res.length = this.offset + bytes;
  13866. this.offset += bytes;
  13867. return res;
  13868. }
  13869. DecoderBuffer.prototype.raw = function raw(save) {
  13870. return this.base.slice(save ? save.offset : this.offset, this.length);
  13871. }
  13872. function EncoderBuffer(value, reporter) {
  13873. if (Array.isArray(value)) {
  13874. this.length = 0;
  13875. this.value = value.map(function(item) {
  13876. if (!(item instanceof EncoderBuffer))
  13877. item = new EncoderBuffer(item, reporter);
  13878. this.length += item.length;
  13879. return item;
  13880. }, this);
  13881. } else if (typeof value === 'number') {
  13882. if (!(0 <= value && value <= 0xff))
  13883. return reporter.error('non-byte EncoderBuffer value');
  13884. this.value = value;
  13885. this.length = 1;
  13886. } else if (typeof value === 'string') {
  13887. this.value = value;
  13888. this.length = Buffer.byteLength(value);
  13889. } else if (Buffer.isBuffer(value)) {
  13890. this.value = value;
  13891. this.length = value.length;
  13892. } else {
  13893. return reporter.error('Unsupported type: ' + typeof value);
  13894. }
  13895. }
  13896. exports.EncoderBuffer = EncoderBuffer;
  13897. EncoderBuffer.prototype.join = function join(out, offset) {
  13898. if (!out)
  13899. out = new Buffer(this.length);
  13900. if (!offset)
  13901. offset = 0;
  13902. if (this.length === 0)
  13903. return out;
  13904. if (Array.isArray(this.value)) {
  13905. this.value.forEach(function(item) {
  13906. item.join(out, offset);
  13907. offset += item.length;
  13908. });
  13909. } else {
  13910. if (typeof this.value === 'number')
  13911. out[offset] = this.value;
  13912. else if (typeof this.value === 'string')
  13913. out.write(this.value, offset);
  13914. else if (Buffer.isBuffer(this.value))
  13915. this.value.copy(out, offset);
  13916. offset += this.length;
  13917. }
  13918. return out;
  13919. };
  13920. /***/ },
  13921. /* 68 */
  13922. /***/ function(module, exports, __webpack_require__) {
  13923. var constants = exports;
  13924. // Helper
  13925. constants._reverse = function reverse(map) {
  13926. var res = {};
  13927. Object.keys(map).forEach(function(key) {
  13928. // Convert key to integer if it is stringified
  13929. if ((key | 0) == key)
  13930. key = key | 0;
  13931. var value = map[key];
  13932. res[value] = key;
  13933. });
  13934. return res;
  13935. };
  13936. constants.der = __webpack_require__(127);
  13937. /***/ },
  13938. /* 69 */
  13939. /***/ function(module, exports, __webpack_require__) {
  13940. var inherits = __webpack_require__(1);
  13941. var asn1 = __webpack_require__(33);
  13942. var base = asn1.base;
  13943. var bignum = asn1.bignum;
  13944. // Import DER constants
  13945. var der = asn1.constants.der;
  13946. function DERDecoder(entity) {
  13947. this.enc = 'der';
  13948. this.name = entity.name;
  13949. this.entity = entity;
  13950. // Construct base tree
  13951. this.tree = new DERNode();
  13952. this.tree._init(entity.body);
  13953. };
  13954. module.exports = DERDecoder;
  13955. DERDecoder.prototype.decode = function decode(data, options) {
  13956. if (!(data instanceof base.DecoderBuffer))
  13957. data = new base.DecoderBuffer(data, options);
  13958. return this.tree._decode(data, options);
  13959. };
  13960. // Tree methods
  13961. function DERNode(parent) {
  13962. base.Node.call(this, 'der', parent);
  13963. }
  13964. inherits(DERNode, base.Node);
  13965. DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
  13966. if (buffer.isEmpty())
  13967. return false;
  13968. var state = buffer.save();
  13969. var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
  13970. if (buffer.isError(decodedTag))
  13971. return decodedTag;
  13972. buffer.restore(state);
  13973. return decodedTag.tag === tag || decodedTag.tagStr === tag ||
  13974. (decodedTag.tagStr + 'of') === tag || any;
  13975. };
  13976. DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
  13977. var decodedTag = derDecodeTag(buffer,
  13978. 'Failed to decode tag of "' + tag + '"');
  13979. if (buffer.isError(decodedTag))
  13980. return decodedTag;
  13981. var len = derDecodeLen(buffer,
  13982. decodedTag.primitive,
  13983. 'Failed to get length of "' + tag + '"');
  13984. // Failure
  13985. if (buffer.isError(len))
  13986. return len;
  13987. if (!any &&
  13988. decodedTag.tag !== tag &&
  13989. decodedTag.tagStr !== tag &&
  13990. decodedTag.tagStr + 'of' !== tag) {
  13991. return buffer.error('Failed to match tag: "' + tag + '"');
  13992. }
  13993. if (decodedTag.primitive || len !== null)
  13994. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  13995. // Indefinite length... find END tag
  13996. var state = buffer.save();
  13997. var res = this._skipUntilEnd(
  13998. buffer,
  13999. 'Failed to skip indefinite length body: "' + this.tag + '"');
  14000. if (buffer.isError(res))
  14001. return res;
  14002. len = buffer.offset - state.offset;
  14003. buffer.restore(state);
  14004. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  14005. };
  14006. DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
  14007. while (true) {
  14008. var tag = derDecodeTag(buffer, fail);
  14009. if (buffer.isError(tag))
  14010. return tag;
  14011. var len = derDecodeLen(buffer, tag.primitive, fail);
  14012. if (buffer.isError(len))
  14013. return len;
  14014. var res;
  14015. if (tag.primitive || len !== null)
  14016. res = buffer.skip(len)
  14017. else
  14018. res = this._skipUntilEnd(buffer, fail);
  14019. // Failure
  14020. if (buffer.isError(res))
  14021. return res;
  14022. if (tag.tagStr === 'end')
  14023. break;
  14024. }
  14025. };
  14026. DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
  14027. options) {
  14028. var result = [];
  14029. while (!buffer.isEmpty()) {
  14030. var possibleEnd = this._peekTag(buffer, 'end');
  14031. if (buffer.isError(possibleEnd))
  14032. return possibleEnd;
  14033. var res = decoder.decode(buffer, 'der', options);
  14034. if (buffer.isError(res) && possibleEnd)
  14035. break;
  14036. result.push(res);
  14037. }
  14038. return result;
  14039. };
  14040. DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
  14041. if (tag === 'bitstr') {
  14042. var unused = buffer.readUInt8();
  14043. if (buffer.isError(unused))
  14044. return unused;
  14045. return { unused: unused, data: buffer.raw() };
  14046. } else if (tag === 'bmpstr') {
  14047. var raw = buffer.raw();
  14048. if (raw.length % 2 === 1)
  14049. return buffer.error('Decoding of string type: bmpstr length mismatch');
  14050. var str = '';
  14051. for (var i = 0; i < raw.length / 2; i++) {
  14052. str += String.fromCharCode(raw.readUInt16BE(i * 2));
  14053. }
  14054. return str;
  14055. } else if (tag === 'numstr') {
  14056. var numstr = buffer.raw().toString('ascii');
  14057. if (!this._isNumstr(numstr)) {
  14058. return buffer.error('Decoding of string type: ' +
  14059. 'numstr unsupported characters');
  14060. }
  14061. return numstr;
  14062. } else if (tag === 'octstr') {
  14063. return buffer.raw();
  14064. } else if (tag === 'printstr') {
  14065. var printstr = buffer.raw().toString('ascii');
  14066. if (!this._isPrintstr(printstr)) {
  14067. return buffer.error('Decoding of string type: ' +
  14068. 'printstr unsupported characters');
  14069. }
  14070. return printstr;
  14071. } else if (/str$/.test(tag)) {
  14072. return buffer.raw().toString();
  14073. } else {
  14074. return buffer.error('Decoding of string type: ' + tag + ' unsupported');
  14075. }
  14076. };
  14077. DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
  14078. var result;
  14079. var identifiers = [];
  14080. var ident = 0;
  14081. while (!buffer.isEmpty()) {
  14082. var subident = buffer.readUInt8();
  14083. ident <<= 7;
  14084. ident |= subident & 0x7f;
  14085. if ((subident & 0x80) === 0) {
  14086. identifiers.push(ident);
  14087. ident = 0;
  14088. }
  14089. }
  14090. if (subident & 0x80)
  14091. identifiers.push(ident);
  14092. var first = (identifiers[0] / 40) | 0;
  14093. var second = identifiers[0] % 40;
  14094. if (relative)
  14095. result = identifiers;
  14096. else
  14097. result = [first, second].concat(identifiers.slice(1));
  14098. if (values) {
  14099. var tmp = values[result.join(' ')];
  14100. if (tmp === undefined)
  14101. tmp = values[result.join('.')];
  14102. if (tmp !== undefined)
  14103. result = tmp;
  14104. }
  14105. return result;
  14106. };
  14107. DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
  14108. var str = buffer.raw().toString();
  14109. if (tag === 'gentime') {
  14110. var year = str.slice(0, 4) | 0;
  14111. var mon = str.slice(4, 6) | 0;
  14112. var day = str.slice(6, 8) | 0;
  14113. var hour = str.slice(8, 10) | 0;
  14114. var min = str.slice(10, 12) | 0;
  14115. var sec = str.slice(12, 14) | 0;
  14116. } else if (tag === 'utctime') {
  14117. var year = str.slice(0, 2) | 0;
  14118. var mon = str.slice(2, 4) | 0;
  14119. var day = str.slice(4, 6) | 0;
  14120. var hour = str.slice(6, 8) | 0;
  14121. var min = str.slice(8, 10) | 0;
  14122. var sec = str.slice(10, 12) | 0;
  14123. if (year < 70)
  14124. year = 2000 + year;
  14125. else
  14126. year = 1900 + year;
  14127. } else {
  14128. return buffer.error('Decoding ' + tag + ' time is not supported yet');
  14129. }
  14130. return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
  14131. };
  14132. DERNode.prototype._decodeNull = function decodeNull(buffer) {
  14133. return null;
  14134. };
  14135. DERNode.prototype._decodeBool = function decodeBool(buffer) {
  14136. var res = buffer.readUInt8();
  14137. if (buffer.isError(res))
  14138. return res;
  14139. else
  14140. return res !== 0;
  14141. };
  14142. DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
  14143. // Bigint, return as it is (assume big endian)
  14144. var raw = buffer.raw();
  14145. var res = new bignum(raw);
  14146. if (values)
  14147. res = values[res.toString(10)] || res;
  14148. return res;
  14149. };
  14150. DERNode.prototype._use = function use(entity, obj) {
  14151. if (typeof entity === 'function')
  14152. entity = entity(obj);
  14153. return entity._getDecoder('der').tree;
  14154. };
  14155. // Utility methods
  14156. function derDecodeTag(buf, fail) {
  14157. var tag = buf.readUInt8(fail);
  14158. if (buf.isError(tag))
  14159. return tag;
  14160. var cls = der.tagClass[tag >> 6];
  14161. var primitive = (tag & 0x20) === 0;
  14162. // Multi-octet tag - load
  14163. if ((tag & 0x1f) === 0x1f) {
  14164. var oct = tag;
  14165. tag = 0;
  14166. while ((oct & 0x80) === 0x80) {
  14167. oct = buf.readUInt8(fail);
  14168. if (buf.isError(oct))
  14169. return oct;
  14170. tag <<= 7;
  14171. tag |= oct & 0x7f;
  14172. }
  14173. } else {
  14174. tag &= 0x1f;
  14175. }
  14176. var tagStr = der.tag[tag];
  14177. return {
  14178. cls: cls,
  14179. primitive: primitive,
  14180. tag: tag,
  14181. tagStr: tagStr
  14182. };
  14183. }
  14184. function derDecodeLen(buf, primitive, fail) {
  14185. var len = buf.readUInt8(fail);
  14186. if (buf.isError(len))
  14187. return len;
  14188. // Indefinite form
  14189. if (!primitive && len === 0x80)
  14190. return null;
  14191. // Definite form
  14192. if ((len & 0x80) === 0) {
  14193. // Short form
  14194. return len;
  14195. }
  14196. // Long form
  14197. var num = len & 0x7f;
  14198. if (num >= 4)
  14199. return buf.error('length octect is too long');
  14200. len = 0;
  14201. for (var i = 0; i < num; i++) {
  14202. len <<= 8;
  14203. var j = buf.readUInt8(fail);
  14204. if (buf.isError(j))
  14205. return j;
  14206. len |= j;
  14207. }
  14208. return len;
  14209. }
  14210. /***/ },
  14211. /* 70 */
  14212. /***/ function(module, exports, __webpack_require__) {
  14213. var inherits = __webpack_require__(1);
  14214. var Buffer = __webpack_require__(0).Buffer;
  14215. var asn1 = __webpack_require__(33);
  14216. var base = asn1.base;
  14217. // Import DER constants
  14218. var der = asn1.constants.der;
  14219. function DEREncoder(entity) {
  14220. this.enc = 'der';
  14221. this.name = entity.name;
  14222. this.entity = entity;
  14223. // Construct base tree
  14224. this.tree = new DERNode();
  14225. this.tree._init(entity.body);
  14226. };
  14227. module.exports = DEREncoder;
  14228. DEREncoder.prototype.encode = function encode(data, reporter) {
  14229. return this.tree._encode(data, reporter).join();
  14230. };
  14231. // Tree methods
  14232. function DERNode(parent) {
  14233. base.Node.call(this, 'der', parent);
  14234. }
  14235. inherits(DERNode, base.Node);
  14236. DERNode.prototype._encodeComposite = function encodeComposite(tag,
  14237. primitive,
  14238. cls,
  14239. content) {
  14240. var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
  14241. // Short form
  14242. if (content.length < 0x80) {
  14243. var header = new Buffer(2);
  14244. header[0] = encodedTag;
  14245. header[1] = content.length;
  14246. return this._createEncoderBuffer([ header, content ]);
  14247. }
  14248. // Long form
  14249. // Count octets required to store length
  14250. var lenOctets = 1;
  14251. for (var i = content.length; i >= 0x100; i >>= 8)
  14252. lenOctets++;
  14253. var header = new Buffer(1 + 1 + lenOctets);
  14254. header[0] = encodedTag;
  14255. header[1] = 0x80 | lenOctets;
  14256. for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
  14257. header[i] = j & 0xff;
  14258. return this._createEncoderBuffer([ header, content ]);
  14259. };
  14260. DERNode.prototype._encodeStr = function encodeStr(str, tag) {
  14261. if (tag === 'bitstr') {
  14262. return this._createEncoderBuffer([ str.unused | 0, str.data ]);
  14263. } else if (tag === 'bmpstr') {
  14264. var buf = new Buffer(str.length * 2);
  14265. for (var i = 0; i < str.length; i++) {
  14266. buf.writeUInt16BE(str.charCodeAt(i), i * 2);
  14267. }
  14268. return this._createEncoderBuffer(buf);
  14269. } else if (tag === 'numstr') {
  14270. if (!this._isNumstr(str)) {
  14271. return this.reporter.error('Encoding of string type: numstr supports ' +
  14272. 'only digits and space');
  14273. }
  14274. return this._createEncoderBuffer(str);
  14275. } else if (tag === 'printstr') {
  14276. if (!this._isPrintstr(str)) {
  14277. return this.reporter.error('Encoding of string type: printstr supports ' +
  14278. 'only latin upper and lower case letters, ' +
  14279. 'digits, space, apostrophe, left and rigth ' +
  14280. 'parenthesis, plus sign, comma, hyphen, ' +
  14281. 'dot, slash, colon, equal sign, ' +
  14282. 'question mark');
  14283. }
  14284. return this._createEncoderBuffer(str);
  14285. } else if (/str$/.test(tag)) {
  14286. return this._createEncoderBuffer(str);
  14287. } else {
  14288. return this.reporter.error('Encoding of string type: ' + tag +
  14289. ' unsupported');
  14290. }
  14291. };
  14292. DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
  14293. if (typeof id === 'string') {
  14294. if (!values)
  14295. return this.reporter.error('string objid given, but no values map found');
  14296. if (!values.hasOwnProperty(id))
  14297. return this.reporter.error('objid not found in values map');
  14298. id = values[id].split(/[\s\.]+/g);
  14299. for (var i = 0; i < id.length; i++)
  14300. id[i] |= 0;
  14301. } else if (Array.isArray(id)) {
  14302. id = id.slice();
  14303. for (var i = 0; i < id.length; i++)
  14304. id[i] |= 0;
  14305. }
  14306. if (!Array.isArray(id)) {
  14307. return this.reporter.error('objid() should be either array or string, ' +
  14308. 'got: ' + JSON.stringify(id));
  14309. }
  14310. if (!relative) {
  14311. if (id[1] >= 40)
  14312. return this.reporter.error('Second objid identifier OOB');
  14313. id.splice(0, 2, id[0] * 40 + id[1]);
  14314. }
  14315. // Count number of octets
  14316. var size = 0;
  14317. for (var i = 0; i < id.length; i++) {
  14318. var ident = id[i];
  14319. for (size++; ident >= 0x80; ident >>= 7)
  14320. size++;
  14321. }
  14322. var objid = new Buffer(size);
  14323. var offset = objid.length - 1;
  14324. for (var i = id.length - 1; i >= 0; i--) {
  14325. var ident = id[i];
  14326. objid[offset--] = ident & 0x7f;
  14327. while ((ident >>= 7) > 0)
  14328. objid[offset--] = 0x80 | (ident & 0x7f);
  14329. }
  14330. return this._createEncoderBuffer(objid);
  14331. };
  14332. function two(num) {
  14333. if (num < 10)
  14334. return '0' + num;
  14335. else
  14336. return num;
  14337. }
  14338. DERNode.prototype._encodeTime = function encodeTime(time, tag) {
  14339. var str;
  14340. var date = new Date(time);
  14341. if (tag === 'gentime') {
  14342. str = [
  14343. two(date.getFullYear()),
  14344. two(date.getUTCMonth() + 1),
  14345. two(date.getUTCDate()),
  14346. two(date.getUTCHours()),
  14347. two(date.getUTCMinutes()),
  14348. two(date.getUTCSeconds()),
  14349. 'Z'
  14350. ].join('');
  14351. } else if (tag === 'utctime') {
  14352. str = [
  14353. two(date.getFullYear() % 100),
  14354. two(date.getUTCMonth() + 1),
  14355. two(date.getUTCDate()),
  14356. two(date.getUTCHours()),
  14357. two(date.getUTCMinutes()),
  14358. two(date.getUTCSeconds()),
  14359. 'Z'
  14360. ].join('');
  14361. } else {
  14362. this.reporter.error('Encoding ' + tag + ' time is not supported yet');
  14363. }
  14364. return this._encodeStr(str, 'octstr');
  14365. };
  14366. DERNode.prototype._encodeNull = function encodeNull() {
  14367. return this._createEncoderBuffer('');
  14368. };
  14369. DERNode.prototype._encodeInt = function encodeInt(num, values) {
  14370. if (typeof num === 'string') {
  14371. if (!values)
  14372. return this.reporter.error('String int or enum given, but no values map');
  14373. if (!values.hasOwnProperty(num)) {
  14374. return this.reporter.error('Values map doesn\'t contain: ' +
  14375. JSON.stringify(num));
  14376. }
  14377. num = values[num];
  14378. }
  14379. // Bignum, assume big endian
  14380. if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
  14381. var numArray = num.toArray();
  14382. if (!num.sign && numArray[0] & 0x80) {
  14383. numArray.unshift(0);
  14384. }
  14385. num = new Buffer(numArray);
  14386. }
  14387. if (Buffer.isBuffer(num)) {
  14388. var size = num.length;
  14389. if (num.length === 0)
  14390. size++;
  14391. var out = new Buffer(size);
  14392. num.copy(out);
  14393. if (num.length === 0)
  14394. out[0] = 0
  14395. return this._createEncoderBuffer(out);
  14396. }
  14397. if (num < 0x80)
  14398. return this._createEncoderBuffer(num);
  14399. if (num < 0x100)
  14400. return this._createEncoderBuffer([0, num]);
  14401. var size = 1;
  14402. for (var i = num; i >= 0x100; i >>= 8)
  14403. size++;
  14404. var out = new Array(size);
  14405. for (var i = out.length - 1; i >= 0; i--) {
  14406. out[i] = num & 0xff;
  14407. num >>= 8;
  14408. }
  14409. if(out[0] & 0x80) {
  14410. out.unshift(0);
  14411. }
  14412. return this._createEncoderBuffer(new Buffer(out));
  14413. };
  14414. DERNode.prototype._encodeBool = function encodeBool(value) {
  14415. return this._createEncoderBuffer(value ? 0xff : 0);
  14416. };
  14417. DERNode.prototype._use = function use(entity, obj) {
  14418. if (typeof entity === 'function')
  14419. entity = entity(obj);
  14420. return entity._getEncoder('der').tree;
  14421. };
  14422. DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
  14423. var state = this._baseState;
  14424. var i;
  14425. if (state['default'] === null)
  14426. return false;
  14427. var data = dataBuffer.join();
  14428. if (state.defaultBuffer === undefined)
  14429. state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
  14430. if (data.length !== state.defaultBuffer.length)
  14431. return false;
  14432. for (i=0; i < data.length; i++)
  14433. if (data[i] !== state.defaultBuffer[i])
  14434. return false;
  14435. return true;
  14436. };
  14437. // Utility methods
  14438. function encodeTag(tag, primitive, cls, reporter) {
  14439. var res;
  14440. if (tag === 'seqof')
  14441. tag = 'seq';
  14442. else if (tag === 'setof')
  14443. tag = 'set';
  14444. if (der.tagByName.hasOwnProperty(tag))
  14445. res = der.tagByName[tag];
  14446. else if (typeof tag === 'number' && (tag | 0) === tag)
  14447. res = tag;
  14448. else
  14449. return reporter.error('Unknown tag: ' + tag);
  14450. if (res >= 0x1f)
  14451. return reporter.error('Multi-octet tag encoding unsupported');
  14452. if (!primitive)
  14453. res |= 0x20;
  14454. res |= (der.tagClassByName[cls || 'universal'] << 6);
  14455. return res;
  14456. }
  14457. /***/ },
  14458. /* 71 */
  14459. /***/ function(module, exports, __webpack_require__) {
  14460. module.exports = __webpack_require__(132);
  14461. /***/ },
  14462. /* 72 */
  14463. /***/ function(module, exports, __webpack_require__) {
  14464. "use strict";
  14465. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  14466. var utils = __webpack_require__(4);
  14467. var settle = __webpack_require__(138);
  14468. var buildURL = __webpack_require__(141);
  14469. var parseHeaders = __webpack_require__(147);
  14470. var isURLSameOrigin = __webpack_require__(145);
  14471. var createError = __webpack_require__(75);
  14472. var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(140);
  14473. module.exports = function xhrAdapter(config) {
  14474. return new Promise(function dispatchXhrRequest(resolve, reject) {
  14475. var requestData = config.data;
  14476. var requestHeaders = config.headers;
  14477. if (utils.isFormData(requestData)) {
  14478. delete requestHeaders['Content-Type']; // Let the browser set it
  14479. }
  14480. var request = new XMLHttpRequest();
  14481. var loadEvent = 'onreadystatechange';
  14482. var xDomain = false;
  14483. // For IE 8/9 CORS support
  14484. // Only supports POST and GET calls and doesn't returns the response headers.
  14485. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  14486. if (process.env.NODE_ENV !== 'test' &&
  14487. typeof window !== 'undefined' &&
  14488. window.XDomainRequest && !('withCredentials' in request) &&
  14489. !isURLSameOrigin(config.url)) {
  14490. request = new window.XDomainRequest();
  14491. loadEvent = 'onload';
  14492. xDomain = true;
  14493. request.onprogress = function handleProgress() {};
  14494. request.ontimeout = function handleTimeout() {};
  14495. }
  14496. // HTTP basic authentication
  14497. if (config.auth) {
  14498. var username = config.auth.username || '';
  14499. var password = config.auth.password || '';
  14500. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  14501. }
  14502. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  14503. // Set the request timeout in MS
  14504. request.timeout = config.timeout;
  14505. // Listen for ready state
  14506. request[loadEvent] = function handleLoad() {
  14507. if (!request || (request.readyState !== 4 && !xDomain)) {
  14508. return;
  14509. }
  14510. // The request errored out and we didn't get a response, this will be
  14511. // handled by onerror instead
  14512. // With one exception: request that using file: protocol, most browsers
  14513. // will return status as 0 even though it's a successful request
  14514. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  14515. return;
  14516. }
  14517. // Prepare the response
  14518. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  14519. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  14520. var response = {
  14521. data: responseData,
  14522. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  14523. status: request.status === 1223 ? 204 : request.status,
  14524. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  14525. headers: responseHeaders,
  14526. config: config,
  14527. request: request
  14528. };
  14529. settle(resolve, reject, response);
  14530. // Clean up request
  14531. request = null;
  14532. };
  14533. // Handle low level network errors
  14534. request.onerror = function handleError() {
  14535. // Real errors are hidden from us by the browser
  14536. // onerror should only fire if it's a network error
  14537. reject(createError('Network Error', config));
  14538. // Clean up request
  14539. request = null;
  14540. };
  14541. // Handle timeout
  14542. request.ontimeout = function handleTimeout() {
  14543. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  14544. // Clean up request
  14545. request = null;
  14546. };
  14547. // Add xsrf header
  14548. // This is only done if running in a standard browser environment.
  14549. // Specifically not if we're in a web worker, or react-native.
  14550. if (utils.isStandardBrowserEnv()) {
  14551. var cookies = __webpack_require__(143);
  14552. // Add xsrf header
  14553. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  14554. cookies.read(config.xsrfCookieName) :
  14555. undefined;
  14556. if (xsrfValue) {
  14557. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  14558. }
  14559. }
  14560. // Add headers to the request
  14561. if ('setRequestHeader' in request) {
  14562. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  14563. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  14564. // Remove Content-Type if data is undefined
  14565. delete requestHeaders[key];
  14566. } else {
  14567. // Otherwise add header to the request
  14568. request.setRequestHeader(key, val);
  14569. }
  14570. });
  14571. }
  14572. // Add withCredentials to request if needed
  14573. if (config.withCredentials) {
  14574. request.withCredentials = true;
  14575. }
  14576. // Add responseType to request if needed
  14577. if (config.responseType) {
  14578. try {
  14579. request.responseType = config.responseType;
  14580. } catch (e) {
  14581. if (request.responseType !== 'json') {
  14582. throw e;
  14583. }
  14584. }
  14585. }
  14586. // Handle progress if needed
  14587. if (typeof config.onDownloadProgress === 'function') {
  14588. request.addEventListener('progress', config.onDownloadProgress);
  14589. }
  14590. // Not all browsers support upload events
  14591. if (typeof config.onUploadProgress === 'function' && request.upload) {
  14592. request.upload.addEventListener('progress', config.onUploadProgress);
  14593. }
  14594. if (config.cancelToken) {
  14595. // Handle cancellation
  14596. config.cancelToken.promise.then(function onCanceled(cancel) {
  14597. if (!request) {
  14598. return;
  14599. }
  14600. request.abort();
  14601. reject(cancel);
  14602. // Clean up request
  14603. request = null;
  14604. });
  14605. }
  14606. if (requestData === undefined) {
  14607. requestData = null;
  14608. }
  14609. // Send the request
  14610. request.send(requestData);
  14611. });
  14612. };
  14613. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  14614. /***/ },
  14615. /* 73 */
  14616. /***/ function(module, exports) {
  14617. "use strict";
  14618. 'use strict';
  14619. /**
  14620. * A `Cancel` is an object that is thrown when an operation is canceled.
  14621. *
  14622. * @class
  14623. * @param {string=} message The message.
  14624. */
  14625. function Cancel(message) {
  14626. this.message = message;
  14627. }
  14628. Cancel.prototype.toString = function toString() {
  14629. return 'Cancel' + (this.message ? ': ' + this.message : '');
  14630. };
  14631. Cancel.prototype.__CANCEL__ = true;
  14632. module.exports = Cancel;
  14633. /***/ },
  14634. /* 74 */
  14635. /***/ function(module, exports) {
  14636. "use strict";
  14637. 'use strict';
  14638. module.exports = function isCancel(value) {
  14639. return !!(value && value.__CANCEL__);
  14640. };
  14641. /***/ },
  14642. /* 75 */
  14643. /***/ function(module, exports, __webpack_require__) {
  14644. "use strict";
  14645. 'use strict';
  14646. var enhanceError = __webpack_require__(137);
  14647. /**
  14648. * Create an Error with the specified message, config, error code, and response.
  14649. *
  14650. * @param {string} message The error message.
  14651. * @param {Object} config The config.
  14652. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  14653. @ @param {Object} [response] The response.
  14654. * @returns {Error} The created error.
  14655. */
  14656. module.exports = function createError(message, config, code, response) {
  14657. var error = new Error(message);
  14658. return enhanceError(error, config, code, response);
  14659. };
  14660. /***/ },
  14661. /* 76 */
  14662. /***/ function(module, exports, __webpack_require__) {
  14663. "use strict";
  14664. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  14665. var utils = __webpack_require__(4);
  14666. var normalizeHeaderName = __webpack_require__(146);
  14667. var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  14668. var DEFAULT_CONTENT_TYPE = {
  14669. 'Content-Type': 'application/x-www-form-urlencoded'
  14670. };
  14671. function setContentTypeIfUnset(headers, value) {
  14672. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  14673. headers['Content-Type'] = value;
  14674. }
  14675. }
  14676. function getDefaultAdapter() {
  14677. var adapter;
  14678. if (typeof XMLHttpRequest !== 'undefined') {
  14679. // For browsers use XHR adapter
  14680. adapter = __webpack_require__(72);
  14681. } else if (typeof process !== 'undefined') {
  14682. // For node use HTTP adapter
  14683. adapter = __webpack_require__(72);
  14684. }
  14685. return adapter;
  14686. }
  14687. module.exports = {
  14688. adapter: getDefaultAdapter(),
  14689. transformRequest: [function transformRequest(data, headers) {
  14690. normalizeHeaderName(headers, 'Content-Type');
  14691. if (utils.isFormData(data) ||
  14692. utils.isArrayBuffer(data) ||
  14693. utils.isStream(data) ||
  14694. utils.isFile(data) ||
  14695. utils.isBlob(data)
  14696. ) {
  14697. return data;
  14698. }
  14699. if (utils.isArrayBufferView(data)) {
  14700. return data.buffer;
  14701. }
  14702. if (utils.isURLSearchParams(data)) {
  14703. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  14704. return data.toString();
  14705. }
  14706. if (utils.isObject(data)) {
  14707. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  14708. return JSON.stringify(data);
  14709. }
  14710. return data;
  14711. }],
  14712. transformResponse: [function transformResponse(data) {
  14713. /*eslint no-param-reassign:0*/
  14714. if (typeof data === 'string') {
  14715. data = data.replace(PROTECTION_PREFIX, '');
  14716. try {
  14717. data = JSON.parse(data);
  14718. } catch (e) { /* Ignore */ }
  14719. }
  14720. return data;
  14721. }],
  14722. headers: {
  14723. common: {
  14724. 'Accept': 'application/json, text/plain, */*'
  14725. },
  14726. patch: utils.merge(DEFAULT_CONTENT_TYPE),
  14727. post: utils.merge(DEFAULT_CONTENT_TYPE),
  14728. put: utils.merge(DEFAULT_CONTENT_TYPE)
  14729. },
  14730. timeout: 0,
  14731. xsrfCookieName: 'XSRF-TOKEN',
  14732. xsrfHeaderName: 'X-XSRF-TOKEN',
  14733. maxContentLength: -1,
  14734. validateStatus: function validateStatus(status) {
  14735. return status >= 200 && status < 300;
  14736. }
  14737. };
  14738. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  14739. /***/ },
  14740. /* 77 */
  14741. /***/ function(module, exports) {
  14742. "use strict";
  14743. 'use strict';
  14744. module.exports = function bind(fn, thisArg) {
  14745. return function wrap() {
  14746. var args = new Array(arguments.length);
  14747. for (var i = 0; i < args.length; i++) {
  14748. args[i] = arguments[i];
  14749. }
  14750. return fn.apply(thisArg, args);
  14751. };
  14752. };
  14753. /***/ },
  14754. /* 78 */
  14755. /***/ function(module, exports, __webpack_require__) {
  14756. "use strict";
  14757. "use strict";
  14758. Object.defineProperty(exports, "__esModule", {
  14759. value: true
  14760. });
  14761. var _classCallCheck2 = __webpack_require__(23);
  14762. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  14763. var _createClass2 = __webpack_require__(24);
  14764. var _createClass3 = _interopRequireDefault(_createClass2);
  14765. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14766. var Password = function () {
  14767. function Password(password) {
  14768. (0, _classCallCheck3.default)(this, Password);
  14769. this.password = password;
  14770. this.options = {
  14771. uppercase: password.uppercase,
  14772. lowercase: password.lowercase,
  14773. numbers: password.numbers,
  14774. symbols: password.symbols,
  14775. length: password.length,
  14776. counter: password.counter
  14777. };
  14778. }
  14779. (0, _createClass3.default)(Password, [{
  14780. key: "isNewPassword",
  14781. value: function isNewPassword(passwords) {
  14782. var _this = this;
  14783. var isNew = true;
  14784. passwords.forEach(function (pwd) {
  14785. if (pwd.site === _this.password.site && pwd.login === _this.password.login) {
  14786. isNew = false;
  14787. }
  14788. });
  14789. return isNew;
  14790. }
  14791. }, {
  14792. key: "json",
  14793. value: function json() {
  14794. return this.password;
  14795. }
  14796. }]);
  14797. return Password;
  14798. }();
  14799. exports.default = Password;
  14800. /***/ },
  14801. /* 79 */
  14802. /***/ function(module, exports, __webpack_require__) {
  14803. module.exports = { "default": __webpack_require__(178), __esModule: true };
  14804. /***/ },
  14805. /* 80 */
  14806. /***/ function(module, exports, __webpack_require__) {
  14807. module.exports = { "default": __webpack_require__(179), __esModule: true };
  14808. /***/ },
  14809. /* 81 */
  14810. /***/ function(module, exports, __webpack_require__) {
  14811. var r;
  14812. module.exports = function rand(len) {
  14813. if (!r)
  14814. r = new Rand(null);
  14815. return r.generate(len);
  14816. };
  14817. function Rand(rand) {
  14818. this.rand = rand;
  14819. }
  14820. module.exports.Rand = Rand;
  14821. Rand.prototype.generate = function generate(len) {
  14822. return this._rand(len);
  14823. };
  14824. if (typeof window === 'object') {
  14825. if (window.crypto && window.crypto.getRandomValues) {
  14826. // Modern browsers
  14827. Rand.prototype._rand = function _rand(n) {
  14828. var arr = new Uint8Array(n);
  14829. window.crypto.getRandomValues(arr);
  14830. return arr;
  14831. };
  14832. } else if (window.msCrypto && window.msCrypto.getRandomValues) {
  14833. // IE
  14834. Rand.prototype._rand = function _rand(n) {
  14835. var arr = new Uint8Array(n);
  14836. window.msCrypto.getRandomValues(arr);
  14837. return arr;
  14838. };
  14839. } else {
  14840. // Old junk
  14841. Rand.prototype._rand = function() {
  14842. throw new Error('Not implemented yet');
  14843. };
  14844. }
  14845. } else {
  14846. // Node.js or Web worker
  14847. try {
  14848. var crypto = __webpack_require__(311);
  14849. Rand.prototype._rand = function _rand(n) {
  14850. return crypto.randomBytes(n);
  14851. };
  14852. } catch (e) {
  14853. // Emulate crypto API using randy
  14854. Rand.prototype._rand = function _rand(n) {
  14855. var res = new Uint8Array(n);
  14856. for (var i = 0; i < res.length; i++)
  14857. res[i] = this.rand.getByte();
  14858. return res;
  14859. };
  14860. }
  14861. }
  14862. /***/ },
  14863. /* 82 */
  14864. /***/ function(module, exports, __webpack_require__) {
  14865. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  14866. var Transform = __webpack_require__(12)
  14867. var inherits = __webpack_require__(1)
  14868. var GHASH = __webpack_require__(167)
  14869. var xor = __webpack_require__(26)
  14870. inherits(StreamCipher, Transform)
  14871. module.exports = StreamCipher
  14872. function StreamCipher (mode, key, iv, decrypt) {
  14873. if (!(this instanceof StreamCipher)) {
  14874. return new StreamCipher(mode, key, iv)
  14875. }
  14876. Transform.call(this)
  14877. this._finID = Buffer.concat([iv, new Buffer([0, 0, 0, 1])])
  14878. iv = Buffer.concat([iv, new Buffer([0, 0, 0, 2])])
  14879. this._cipher = new aes.AES(key)
  14880. this._prev = new Buffer(iv.length)
  14881. this._cache = new Buffer('')
  14882. this._secCache = new Buffer('')
  14883. this._decrypt = decrypt
  14884. this._alen = 0
  14885. this._len = 0
  14886. iv.copy(this._prev)
  14887. this._mode = mode
  14888. var h = new Buffer(4)
  14889. h.fill(0)
  14890. this._ghash = new GHASH(this._cipher.encryptBlock(h))
  14891. this._authTag = null
  14892. this._called = false
  14893. }
  14894. StreamCipher.prototype._update = function (chunk) {
  14895. if (!this._called && this._alen) {
  14896. var rump = 16 - (this._alen % 16)
  14897. if (rump < 16) {
  14898. rump = new Buffer(rump)
  14899. rump.fill(0)
  14900. this._ghash.update(rump)
  14901. }
  14902. }
  14903. this._called = true
  14904. var out = this._mode.encrypt(this, chunk)
  14905. if (this._decrypt) {
  14906. this._ghash.update(chunk)
  14907. } else {
  14908. this._ghash.update(out)
  14909. }
  14910. this._len += chunk.length
  14911. return out
  14912. }
  14913. StreamCipher.prototype._final = function () {
  14914. if (this._decrypt && !this._authTag) {
  14915. throw new Error('Unsupported state or unable to authenticate data')
  14916. }
  14917. var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
  14918. if (this._decrypt) {
  14919. if (xorTest(tag, this._authTag)) {
  14920. throw new Error('Unsupported state or unable to authenticate data')
  14921. }
  14922. } else {
  14923. this._authTag = tag
  14924. }
  14925. this._cipher.scrub()
  14926. }
  14927. StreamCipher.prototype.getAuthTag = function getAuthTag () {
  14928. if (!this._decrypt && Buffer.isBuffer(this._authTag)) {
  14929. return this._authTag
  14930. } else {
  14931. throw new Error('Attempting to get auth tag in unsupported state')
  14932. }
  14933. }
  14934. StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
  14935. if (this._decrypt) {
  14936. this._authTag = tag
  14937. } else {
  14938. throw new Error('Attempting to set auth tag in unsupported state')
  14939. }
  14940. }
  14941. StreamCipher.prototype.setAAD = function setAAD (buf) {
  14942. if (!this._called) {
  14943. this._ghash.update(buf)
  14944. this._alen += buf.length
  14945. } else {
  14946. throw new Error('Attempting to set AAD in unsupported state')
  14947. }
  14948. }
  14949. function xorTest (a, b) {
  14950. var out = 0
  14951. if (a.length !== b.length) {
  14952. out++
  14953. }
  14954. var len = Math.min(a.length, b.length)
  14955. var i = -1
  14956. while (++i < len) {
  14957. out += (a[i] ^ b[i])
  14958. }
  14959. return out
  14960. }
  14961. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  14962. /***/ },
  14963. /* 83 */
  14964. /***/ function(module, exports, __webpack_require__) {
  14965. var xor = __webpack_require__(26)
  14966. exports.encrypt = function (self, block) {
  14967. var data = xor(block, self._prev)
  14968. self._prev = self._cipher.encryptBlock(data)
  14969. return self._prev
  14970. }
  14971. exports.decrypt = function (self, block) {
  14972. var pad = self._prev
  14973. self._prev = block
  14974. var out = self._cipher.decryptBlock(block)
  14975. return xor(out, pad)
  14976. }
  14977. /***/ },
  14978. /* 84 */
  14979. /***/ function(module, exports, __webpack_require__) {
  14980. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  14981. exports.encrypt = function (self, data, decrypt) {
  14982. var out = new Buffer('')
  14983. var len
  14984. while (data.length) {
  14985. if (self._cache.length === 0) {
  14986. self._cache = self._cipher.encryptBlock(self._prev)
  14987. self._prev = new Buffer('')
  14988. }
  14989. if (self._cache.length <= data.length) {
  14990. len = self._cache.length
  14991. out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
  14992. data = data.slice(len)
  14993. } else {
  14994. out = Buffer.concat([out, encryptStart(self, data, decrypt)])
  14995. break
  14996. }
  14997. }
  14998. return out
  14999. }
  15000. function encryptStart (self, data, decrypt) {
  15001. var len = data.length
  15002. var out = xor(data, self._cache)
  15003. self._cache = self._cache.slice(len)
  15004. self._prev = Buffer.concat([self._prev, decrypt ? data : out])
  15005. return out
  15006. }
  15007. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15008. /***/ },
  15009. /* 85 */
  15010. /***/ function(module, exports, __webpack_require__) {
  15011. /* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) {
  15012. var pad
  15013. var i = -1
  15014. var len = 8
  15015. var out = 0
  15016. var bit, value
  15017. while (++i < len) {
  15018. pad = self._cipher.encryptBlock(self._prev)
  15019. bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
  15020. value = pad[0] ^ bit
  15021. out += ((value & 0x80) >> (i % 8))
  15022. self._prev = shiftIn(self._prev, decrypt ? bit : value)
  15023. }
  15024. return out
  15025. }
  15026. exports.encrypt = function (self, chunk, decrypt) {
  15027. var len = chunk.length
  15028. var out = new Buffer(len)
  15029. var i = -1
  15030. while (++i < len) {
  15031. out[i] = encryptByte(self, chunk[i], decrypt)
  15032. }
  15033. return out
  15034. }
  15035. function shiftIn (buffer, value) {
  15036. var len = buffer.length
  15037. var i = -1
  15038. var out = new Buffer(buffer.length)
  15039. buffer = Buffer.concat([buffer, new Buffer([value])])
  15040. while (++i < len) {
  15041. out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  15042. }
  15043. return out
  15044. }
  15045. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15046. /***/ },
  15047. /* 86 */
  15048. /***/ function(module, exports, __webpack_require__) {
  15049. /* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) {
  15050. var pad = self._cipher.encryptBlock(self._prev)
  15051. var out = pad[0] ^ byteParam
  15052. self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt ? byteParam : out])])
  15053. return out
  15054. }
  15055. exports.encrypt = function (self, chunk, decrypt) {
  15056. var len = chunk.length
  15057. var out = new Buffer(len)
  15058. var i = -1
  15059. while (++i < len) {
  15060. out[i] = encryptByte(self, chunk[i], decrypt)
  15061. }
  15062. return out
  15063. }
  15064. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15065. /***/ },
  15066. /* 87 */
  15067. /***/ function(module, exports) {
  15068. exports.encrypt = function (self, block) {
  15069. return self._cipher.encryptBlock(block)
  15070. }
  15071. exports.decrypt = function (self, block) {
  15072. return self._cipher.decryptBlock(block)
  15073. }
  15074. /***/ },
  15075. /* 88 */
  15076. /***/ function(module, exports, __webpack_require__) {
  15077. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  15078. function getBlock (self) {
  15079. self._prev = self._cipher.encryptBlock(self._prev)
  15080. return self._prev
  15081. }
  15082. exports.encrypt = function (self, chunk) {
  15083. while (self._cache.length < chunk.length) {
  15084. self._cache = Buffer.concat([self._cache, getBlock(self)])
  15085. }
  15086. var pad = self._cache.slice(0, chunk.length)
  15087. self._cache = self._cache.slice(chunk.length)
  15088. return xor(chunk, pad)
  15089. }
  15090. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15091. /***/ },
  15092. /* 89 */
  15093. /***/ function(module, exports, __webpack_require__) {
  15094. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  15095. var Transform = __webpack_require__(12)
  15096. var inherits = __webpack_require__(1)
  15097. inherits(StreamCipher, Transform)
  15098. module.exports = StreamCipher
  15099. function StreamCipher (mode, key, iv, decrypt) {
  15100. if (!(this instanceof StreamCipher)) {
  15101. return new StreamCipher(mode, key, iv)
  15102. }
  15103. Transform.call(this)
  15104. this._cipher = new aes.AES(key)
  15105. this._prev = new Buffer(iv.length)
  15106. this._cache = new Buffer('')
  15107. this._secCache = new Buffer('')
  15108. this._decrypt = decrypt
  15109. iv.copy(this._prev)
  15110. this._mode = mode
  15111. }
  15112. StreamCipher.prototype._update = function (chunk) {
  15113. return this._mode.encrypt(this, chunk, this._decrypt)
  15114. }
  15115. StreamCipher.prototype._final = function () {
  15116. this._cipher.scrub()
  15117. }
  15118. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15119. /***/ },
  15120. /* 90 */
  15121. /***/ function(module, exports) {
  15122. "use strict";
  15123. 'use strict'
  15124. exports['1.3.132.0.10'] = 'secp256k1'
  15125. exports['1.3.132.0.33'] = 'p224'
  15126. exports['1.2.840.10045.3.1.1'] = 'p192'
  15127. exports['1.2.840.10045.3.1.7'] = 'p256'
  15128. exports['1.3.132.0.34'] = 'p384'
  15129. exports['1.3.132.0.35'] = 'p521'
  15130. /***/ },
  15131. /* 91 */
  15132. /***/ function(module, exports, __webpack_require__) {
  15133. // getting tag from 19.1.3.6 Object.prototype.toString()
  15134. var cof = __webpack_require__(38)
  15135. , TAG = __webpack_require__(5)('toStringTag')
  15136. // ES3 wrong here
  15137. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  15138. // fallback for IE11 Script Access Denied error
  15139. var tryGet = function(it, key){
  15140. try {
  15141. return it[key];
  15142. } catch(e){ /* empty */ }
  15143. };
  15144. module.exports = function(it){
  15145. var O, T, B;
  15146. return it === undefined ? 'Undefined' : it === null ? 'Null'
  15147. // @@toStringTag case
  15148. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  15149. // builtinTag case
  15150. : ARG ? cof(O)
  15151. // ES3 arguments fallback
  15152. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  15153. };
  15154. /***/ },
  15155. /* 92 */
  15156. /***/ function(module, exports) {
  15157. // IE 8- don't enum bug keys
  15158. module.exports = (
  15159. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  15160. ).split(',');
  15161. /***/ },
  15162. /* 93 */
  15163. /***/ function(module, exports, __webpack_require__) {
  15164. module.exports = __webpack_require__(6).document && document.documentElement;
  15165. /***/ },
  15166. /* 94 */
  15167. /***/ function(module, exports, __webpack_require__) {
  15168. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  15169. var cof = __webpack_require__(38);
  15170. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  15171. return cof(it) == 'String' ? it.split('') : Object(it);
  15172. };
  15173. /***/ },
  15174. /* 95 */
  15175. /***/ function(module, exports, __webpack_require__) {
  15176. "use strict";
  15177. 'use strict';
  15178. var LIBRARY = __webpack_require__(96)
  15179. , $export = __webpack_require__(40)
  15180. , redefine = __webpack_require__(200)
  15181. , hide = __webpack_require__(15)
  15182. , has = __webpack_require__(41)
  15183. , Iterators = __webpack_require__(27)
  15184. , $iterCreate = __webpack_require__(188)
  15185. , setToStringTag = __webpack_require__(56)
  15186. , getPrototypeOf = __webpack_require__(196)
  15187. , ITERATOR = __webpack_require__(5)('iterator')
  15188. , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
  15189. , FF_ITERATOR = '@@iterator'
  15190. , KEYS = 'keys'
  15191. , VALUES = 'values';
  15192. var returnThis = function(){ return this; };
  15193. module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
  15194. $iterCreate(Constructor, NAME, next);
  15195. var getMethod = function(kind){
  15196. if(!BUGGY && kind in proto)return proto[kind];
  15197. switch(kind){
  15198. case KEYS: return function keys(){ return new Constructor(this, kind); };
  15199. case VALUES: return function values(){ return new Constructor(this, kind); };
  15200. } return function entries(){ return new Constructor(this, kind); };
  15201. };
  15202. var TAG = NAME + ' Iterator'
  15203. , DEF_VALUES = DEFAULT == VALUES
  15204. , VALUES_BUG = false
  15205. , proto = Base.prototype
  15206. , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
  15207. , $default = $native || getMethod(DEFAULT)
  15208. , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
  15209. , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
  15210. , methods, key, IteratorPrototype;
  15211. // Fix native
  15212. if($anyNative){
  15213. IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
  15214. if(IteratorPrototype !== Object.prototype){
  15215. // Set @@toStringTag to native iterators
  15216. setToStringTag(IteratorPrototype, TAG, true);
  15217. // fix for some old engines
  15218. if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
  15219. }
  15220. }
  15221. // fix Array#{values, @@iterator}.name in V8 / FF
  15222. if(DEF_VALUES && $native && $native.name !== VALUES){
  15223. VALUES_BUG = true;
  15224. $default = function values(){ return $native.call(this); };
  15225. }
  15226. // Define iterator
  15227. if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
  15228. hide(proto, ITERATOR, $default);
  15229. }
  15230. // Plug for library
  15231. Iterators[NAME] = $default;
  15232. Iterators[TAG] = returnThis;
  15233. if(DEFAULT){
  15234. methods = {
  15235. values: DEF_VALUES ? $default : getMethod(VALUES),
  15236. keys: IS_SET ? $default : getMethod(KEYS),
  15237. entries: $entries
  15238. };
  15239. if(FORCED)for(key in methods){
  15240. if(!(key in proto))redefine(proto, key, methods[key]);
  15241. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  15242. }
  15243. return methods;
  15244. };
  15245. /***/ },
  15246. /* 96 */
  15247. /***/ function(module, exports) {
  15248. module.exports = true;
  15249. /***/ },
  15250. /* 97 */
  15251. /***/ function(module, exports, __webpack_require__) {
  15252. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  15253. var $keys = __webpack_require__(197)
  15254. , enumBugKeys = __webpack_require__(92);
  15255. module.exports = Object.keys || function keys(O){
  15256. return $keys(O, enumBugKeys);
  15257. };
  15258. /***/ },
  15259. /* 98 */
  15260. /***/ function(module, exports) {
  15261. module.exports = function(bitmap, value){
  15262. return {
  15263. enumerable : !(bitmap & 1),
  15264. configurable: !(bitmap & 2),
  15265. writable : !(bitmap & 4),
  15266. value : value
  15267. };
  15268. };
  15269. /***/ },
  15270. /* 99 */
  15271. /***/ function(module, exports, __webpack_require__) {
  15272. var global = __webpack_require__(6)
  15273. , SHARED = '__core-js_shared__'
  15274. , store = global[SHARED] || (global[SHARED] = {});
  15275. module.exports = function(key){
  15276. return store[key] || (store[key] = {});
  15277. };
  15278. /***/ },
  15279. /* 100 */
  15280. /***/ function(module, exports, __webpack_require__) {
  15281. var ctx = __webpack_require__(39)
  15282. , invoke = __webpack_require__(185)
  15283. , html = __webpack_require__(93)
  15284. , cel = __webpack_require__(54)
  15285. , global = __webpack_require__(6)
  15286. , process = global.process
  15287. , setTask = global.setImmediate
  15288. , clearTask = global.clearImmediate
  15289. , MessageChannel = global.MessageChannel
  15290. , counter = 0
  15291. , queue = {}
  15292. , ONREADYSTATECHANGE = 'onreadystatechange'
  15293. , defer, channel, port;
  15294. var run = function(){
  15295. var id = +this;
  15296. if(queue.hasOwnProperty(id)){
  15297. var fn = queue[id];
  15298. delete queue[id];
  15299. fn();
  15300. }
  15301. };
  15302. var listener = function(event){
  15303. run.call(event.data);
  15304. };
  15305. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  15306. if(!setTask || !clearTask){
  15307. setTask = function setImmediate(fn){
  15308. var args = [], i = 1;
  15309. while(arguments.length > i)args.push(arguments[i++]);
  15310. queue[++counter] = function(){
  15311. invoke(typeof fn == 'function' ? fn : Function(fn), args);
  15312. };
  15313. defer(counter);
  15314. return counter;
  15315. };
  15316. clearTask = function clearImmediate(id){
  15317. delete queue[id];
  15318. };
  15319. // Node.js 0.8-
  15320. if(__webpack_require__(38)(process) == 'process'){
  15321. defer = function(id){
  15322. process.nextTick(ctx(run, id, 1));
  15323. };
  15324. // Browsers with MessageChannel, includes WebWorkers
  15325. } else if(MessageChannel){
  15326. channel = new MessageChannel;
  15327. port = channel.port2;
  15328. channel.port1.onmessage = listener;
  15329. defer = ctx(port.postMessage, port, 1);
  15330. // Browsers with postMessage, skip WebWorkers
  15331. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  15332. } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
  15333. defer = function(id){
  15334. global.postMessage(id + '', '*');
  15335. };
  15336. global.addEventListener('message', listener, false);
  15337. // IE8-
  15338. } else if(ONREADYSTATECHANGE in cel('script')){
  15339. defer = function(id){
  15340. html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
  15341. html.removeChild(this);
  15342. run.call(id);
  15343. };
  15344. };
  15345. // Rest old browsers
  15346. } else {
  15347. defer = function(id){
  15348. setTimeout(ctx(run, id, 1), 0);
  15349. };
  15350. }
  15351. }
  15352. module.exports = {
  15353. set: setTask,
  15354. clear: clearTask
  15355. };
  15356. /***/ },
  15357. /* 101 */
  15358. /***/ function(module, exports, __webpack_require__) {
  15359. // 7.1.15 ToLength
  15360. var toInteger = __webpack_require__(58)
  15361. , min = Math.min;
  15362. module.exports = function(it){
  15363. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  15364. };
  15365. /***/ },
  15366. /* 102 */
  15367. /***/ function(module, exports, __webpack_require__) {
  15368. // 7.1.13 ToObject(argument)
  15369. var defined = __webpack_require__(53);
  15370. module.exports = function(it){
  15371. return Object(defined(it));
  15372. };
  15373. /***/ },
  15374. /* 103 */
  15375. /***/ function(module, exports) {
  15376. var id = 0
  15377. , px = Math.random();
  15378. module.exports = function(key){
  15379. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  15380. };
  15381. /***/ },
  15382. /* 104 */
  15383. /***/ function(module, exports, __webpack_require__) {
  15384. "use strict";
  15385. 'use strict';
  15386. /*
  15387. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  15388. * Digest Algorithm, as defined in RFC 1321.
  15389. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
  15390. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15391. * Distributed under the BSD License
  15392. * See http://pajhome.org.uk/crypt/md5 for more info.
  15393. */
  15394. var helpers = __webpack_require__(215);
  15395. /*
  15396. * Calculate the MD5 of an array of little-endian words, and a bit length
  15397. */
  15398. function core_md5(x, len)
  15399. {
  15400. /* append padding */
  15401. x[len >> 5] |= 0x80 << ((len) % 32);
  15402. x[(((len + 64) >>> 9) << 4) + 14] = len;
  15403. var a = 1732584193;
  15404. var b = -271733879;
  15405. var c = -1732584194;
  15406. var d = 271733878;
  15407. for(var i = 0; i < x.length; i += 16)
  15408. {
  15409. var olda = a;
  15410. var oldb = b;
  15411. var oldc = c;
  15412. var oldd = d;
  15413. a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
  15414. d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
  15415. c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
  15416. b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
  15417. a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
  15418. d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
  15419. c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
  15420. b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
  15421. a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
  15422. d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
  15423. c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
  15424. b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
  15425. a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
  15426. d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
  15427. c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
  15428. b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
  15429. a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
  15430. d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
  15431. c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
  15432. b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
  15433. a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
  15434. d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
  15435. c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
  15436. b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
  15437. a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
  15438. d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
  15439. c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
  15440. b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
  15441. a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
  15442. d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
  15443. c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
  15444. b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
  15445. a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
  15446. d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
  15447. c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
  15448. b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
  15449. a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
  15450. d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
  15451. c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
  15452. b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
  15453. a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
  15454. d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
  15455. c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
  15456. b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
  15457. a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
  15458. d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
  15459. c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
  15460. b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
  15461. a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
  15462. d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
  15463. c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
  15464. b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
  15465. a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
  15466. d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
  15467. c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
  15468. b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
  15469. a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
  15470. d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
  15471. c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
  15472. b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
  15473. a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
  15474. d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
  15475. c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
  15476. b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
  15477. a = safe_add(a, olda);
  15478. b = safe_add(b, oldb);
  15479. c = safe_add(c, oldc);
  15480. d = safe_add(d, oldd);
  15481. }
  15482. return Array(a, b, c, d);
  15483. }
  15484. /*
  15485. * These functions implement the four basic operations the algorithm uses.
  15486. */
  15487. function md5_cmn(q, a, b, x, s, t)
  15488. {
  15489. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
  15490. }
  15491. function md5_ff(a, b, c, d, x, s, t)
  15492. {
  15493. return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
  15494. }
  15495. function md5_gg(a, b, c, d, x, s, t)
  15496. {
  15497. return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
  15498. }
  15499. function md5_hh(a, b, c, d, x, s, t)
  15500. {
  15501. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  15502. }
  15503. function md5_ii(a, b, c, d, x, s, t)
  15504. {
  15505. return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
  15506. }
  15507. /*
  15508. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  15509. * to work around bugs in some JS interpreters.
  15510. */
  15511. function safe_add(x, y)
  15512. {
  15513. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  15514. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  15515. return (msw << 16) | (lsw & 0xFFFF);
  15516. }
  15517. /*
  15518. * Bitwise rotate a 32-bit number to the left.
  15519. */
  15520. function bit_rol(num, cnt)
  15521. {
  15522. return (num << cnt) | (num >>> (32 - cnt));
  15523. }
  15524. module.exports = function md5(buf) {
  15525. return helpers.hash(buf, core_md5, 16);
  15526. };
  15527. /***/ },
  15528. /* 105 */
  15529. /***/ function(module, exports, __webpack_require__) {
  15530. var randomBytes = __webpack_require__(31);
  15531. module.exports = findPrime;
  15532. findPrime.simpleSieve = simpleSieve;
  15533. findPrime.fermatTest = fermatTest;
  15534. var BN = __webpack_require__(2);
  15535. var TWENTYFOUR = new BN(24);
  15536. var MillerRabin = __webpack_require__(109);
  15537. var millerRabin = new MillerRabin();
  15538. var ONE = new BN(1);
  15539. var TWO = new BN(2);
  15540. var FIVE = new BN(5);
  15541. var SIXTEEN = new BN(16);
  15542. var EIGHT = new BN(8);
  15543. var TEN = new BN(10);
  15544. var THREE = new BN(3);
  15545. var SEVEN = new BN(7);
  15546. var ELEVEN = new BN(11);
  15547. var FOUR = new BN(4);
  15548. var TWELVE = new BN(12);
  15549. var primes = null;
  15550. function _getPrimes() {
  15551. if (primes !== null)
  15552. return primes;
  15553. var limit = 0x100000;
  15554. var res = [];
  15555. res[0] = 2;
  15556. for (var i = 1, k = 3; k < limit; k += 2) {
  15557. var sqrt = Math.ceil(Math.sqrt(k));
  15558. for (var j = 0; j < i && res[j] <= sqrt; j++)
  15559. if (k % res[j] === 0)
  15560. break;
  15561. if (i !== j && res[j] <= sqrt)
  15562. continue;
  15563. res[i++] = k;
  15564. }
  15565. primes = res;
  15566. return res;
  15567. }
  15568. function simpleSieve(p) {
  15569. var primes = _getPrimes();
  15570. for (var i = 0; i < primes.length; i++)
  15571. if (p.modn(primes[i]) === 0) {
  15572. if (p.cmpn(primes[i]) === 0) {
  15573. return true;
  15574. } else {
  15575. return false;
  15576. }
  15577. }
  15578. return true;
  15579. }
  15580. function fermatTest(p) {
  15581. var red = BN.mont(p);
  15582. return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
  15583. }
  15584. function findPrime(bits, gen) {
  15585. if (bits < 16) {
  15586. // this is what openssl does
  15587. if (gen === 2 || gen === 5) {
  15588. return new BN([0x8c, 0x7b]);
  15589. } else {
  15590. return new BN([0x8c, 0x27]);
  15591. }
  15592. }
  15593. gen = new BN(gen);
  15594. var num, n2;
  15595. while (true) {
  15596. num = new BN(randomBytes(Math.ceil(bits / 8)));
  15597. while (num.bitLength() > bits) {
  15598. num.ishrn(1);
  15599. }
  15600. if (num.isEven()) {
  15601. num.iadd(ONE);
  15602. }
  15603. if (!num.testn(1)) {
  15604. num.iadd(TWO);
  15605. }
  15606. if (!gen.cmp(TWO)) {
  15607. while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
  15608. num.iadd(FOUR);
  15609. }
  15610. } else if (!gen.cmp(FIVE)) {
  15611. while (num.mod(TEN).cmp(THREE)) {
  15612. num.iadd(FOUR);
  15613. }
  15614. }
  15615. n2 = num.shrn(1);
  15616. if (simpleSieve(n2) && simpleSieve(num) &&
  15617. fermatTest(n2) && fermatTest(num) &&
  15618. millerRabin.test(n2) && millerRabin.test(num)) {
  15619. return num;
  15620. }
  15621. }
  15622. }
  15623. /***/ },
  15624. /* 106 */
  15625. /***/ function(module, exports) {
  15626. var toString = {}.toString;
  15627. module.exports = Array.isArray || function (arr) {
  15628. return toString.call(arr) == '[object Array]';
  15629. };
  15630. /***/ },
  15631. /* 107 */
  15632. /***/ function(module, exports) {
  15633. module.exports = {
  15634. "sha1": "da39a3ee 5e6b4b0d 3255bfef 95601890 afd80709",
  15635. "sha224": "d14a028c 2a3a2bc9 476102bb 288234c4 15a2b01f 828ea62a c5b3e42f",
  15636. "sha256": "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855",
  15637. "sha384": "38b060a7 51ac9638 4cd9327e b1b1e36a 21fdb711 14be0743 4c0cc7bf 63f6e1da 274edebf e76f65fb d51ad2f1 4898b95b",
  15638. "sha512": "cf83e135 7eefb8bd f1542850 d66d8007 d620e405 0b5715dc 83f4a921 d36ce9ce 47d0d13c 5d85f2b0 ff8318d2 877eec2f 63b931bd 47417a81 a538327a f927da3e",
  15639. "sha512/224": "6ed0dd02 806fa89e 25de060c 19d3ac86 cabb87d6 a0ddd05c 333b84f4",
  15640. "sha512/256": "c672b8d1 ef56ed28 ab87c362 2c511406 9bdd3ad7 b8f97374 98d0c01e cef0967a"
  15641. };
  15642. /***/ },
  15643. /* 108 */
  15644. /***/ function(module, exports, __webpack_require__) {
  15645. "use strict";
  15646. 'use strict';
  15647. var _crypto = __webpack_require__(216);
  15648. var _crypto2 = _interopRequireDefault(_crypto);
  15649. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15650. module.exports = {
  15651. encryptLogin: _encryptLogin,
  15652. renderPassword: _renderPassword,
  15653. createFingerprint: createFingerprint,
  15654. _deriveEncryptedLogin: _deriveEncryptedLogin,
  15655. _getPasswordTemplate: _getPasswordTemplate,
  15656. _prettyPrint: _prettyPrint,
  15657. _string2charCodes: _string2charCodes,
  15658. _getCharType: _getCharType,
  15659. _getPasswordChar: _getPasswordChar,
  15660. _createHmac: _createHmac
  15661. };
  15662. function _encryptLogin(login, masterPassword) {
  15663. return new Promise(function (resolve, reject) {
  15664. if (!login || !masterPassword) {
  15665. reject('login and master password parameters could not be empty');
  15666. }
  15667. var iterations = 8192;
  15668. var keylen = 32;
  15669. _crypto2.default.pbkdf2(masterPassword, login, iterations, keylen, 'sha256', function (error, key) {
  15670. if (error) {
  15671. reject('error in pbkdf2');
  15672. } else {
  15673. resolve(key.toString('hex'));
  15674. }
  15675. });
  15676. });
  15677. }
  15678. function _renderPassword(encryptedLogin, site, passwordOptions) {
  15679. return _deriveEncryptedLogin(encryptedLogin, site, passwordOptions).then(function (derivedEncryptedLogin) {
  15680. var template = _getPasswordTemplate(passwordOptions);
  15681. return _prettyPrint(derivedEncryptedLogin, template);
  15682. });
  15683. }
  15684. function _createHmac(encryptedLogin, salt) {
  15685. return new Promise(function (resolve) {
  15686. resolve(_crypto2.default.createHmac('sha256', encryptedLogin).update(salt).digest('hex'));
  15687. });
  15688. }
  15689. function _deriveEncryptedLogin(encryptedLogin, site) {
  15690. var passwordOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { length: 12, counter: 1 };
  15691. var salt = site + passwordOptions.counter.toString();
  15692. return _createHmac(encryptedLogin, salt).then(function (derivedHash) {
  15693. return derivedHash.substring(0, passwordOptions.length);
  15694. });
  15695. }
  15696. function _getPasswordTemplate(passwordTypes) {
  15697. var templates = {
  15698. lowercase: 'vc',
  15699. uppercase: 'VC',
  15700. numbers: 'n',
  15701. symbols: 's'
  15702. };
  15703. var template = '';
  15704. for (var templateKey in templates) {
  15705. if (passwordTypes.hasOwnProperty(templateKey) && passwordTypes[templateKey]) {
  15706. template += templates[templateKey];
  15707. }
  15708. }
  15709. return template;
  15710. }
  15711. function _prettyPrint(hash, template) {
  15712. var password = '';
  15713. _string2charCodes(hash).forEach(function (charCode, index) {
  15714. var charType = _getCharType(template, index);
  15715. password += _getPasswordChar(charType, charCode);
  15716. });
  15717. return password;
  15718. }
  15719. function _string2charCodes(text) {
  15720. var charCodes = [];
  15721. for (var i = 0; i < text.length; i++) {
  15722. charCodes.push(text.charCodeAt(i));
  15723. }
  15724. return charCodes;
  15725. }
  15726. function _getCharType(template, index) {
  15727. return template[index % template.length];
  15728. }
  15729. function _getPasswordChar(charType, index) {
  15730. var passwordsChars = {
  15731. V: 'AEIOUY',
  15732. C: 'BCDFGHJKLMNPQRSTVWXZ',
  15733. v: 'aeiouy',
  15734. c: 'bcdfghjklmnpqrstvwxz',
  15735. A: 'AEIOUYBCDFGHJKLMNPQRSTVWXZ',
  15736. a: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz',
  15737. n: '0123456789',
  15738. s: '@&%?,=[]_:-+*$#!\'^~;()/.',
  15739. x: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz0123456789@&%?,=[]_:-+*$#!\'^~;()/.'
  15740. };
  15741. var passwordChar = passwordsChars[charType];
  15742. return passwordChar[index % passwordChar.length];
  15743. }
  15744. function createFingerprint(str) {
  15745. return new Promise(function (resolve) {
  15746. resolve(_crypto2.default.createHmac('sha256', str).digest('hex'));
  15747. });
  15748. }
  15749. /***/ },
  15750. /* 109 */
  15751. /***/ function(module, exports, __webpack_require__) {
  15752. var bn = __webpack_require__(2);
  15753. var brorand = __webpack_require__(81);
  15754. function MillerRabin(rand) {
  15755. this.rand = rand || new brorand.Rand();
  15756. }
  15757. module.exports = MillerRabin;
  15758. MillerRabin.create = function create(rand) {
  15759. return new MillerRabin(rand);
  15760. };
  15761. MillerRabin.prototype._rand = function _rand(n) {
  15762. var len = n.bitLength();
  15763. var buf = this.rand.generate(Math.ceil(len / 8));
  15764. // Set low bits
  15765. buf[0] |= 3;
  15766. // Mask high bits
  15767. var mask = len & 0x7;
  15768. if (mask !== 0)
  15769. buf[buf.length - 1] >>= 7 - mask;
  15770. return new bn(buf);
  15771. }
  15772. MillerRabin.prototype.test = function test(n, k, cb) {
  15773. var len = n.bitLength();
  15774. var red = bn.mont(n);
  15775. var rone = new bn(1).toRed(red);
  15776. if (!k)
  15777. k = Math.max(1, (len / 48) | 0);
  15778. // Find d and s, (n - 1) = (2 ^ s) * d;
  15779. var n1 = n.subn(1);
  15780. var n2 = n1.subn(1);
  15781. for (var s = 0; !n1.testn(s); s++) {}
  15782. var d = n.shrn(s);
  15783. var rn1 = n1.toRed(red);
  15784. var prime = true;
  15785. for (; k > 0; k--) {
  15786. var a = this._rand(n2);
  15787. if (cb)
  15788. cb(a);
  15789. var x = a.toRed(red).redPow(d);
  15790. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  15791. continue;
  15792. for (var i = 1; i < s; i++) {
  15793. x = x.redSqr();
  15794. if (x.cmp(rone) === 0)
  15795. return false;
  15796. if (x.cmp(rn1) === 0)
  15797. break;
  15798. }
  15799. if (i === s)
  15800. return false;
  15801. }
  15802. return prime;
  15803. };
  15804. MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
  15805. var len = n.bitLength();
  15806. var red = bn.mont(n);
  15807. var rone = new bn(1).toRed(red);
  15808. if (!k)
  15809. k = Math.max(1, (len / 48) | 0);
  15810. // Find d and s, (n - 1) = (2 ^ s) * d;
  15811. var n1 = n.subn(1);
  15812. var n2 = n1.subn(1);
  15813. for (var s = 0; !n1.testn(s); s++) {}
  15814. var d = n.shrn(s);
  15815. var rn1 = n1.toRed(red);
  15816. for (; k > 0; k--) {
  15817. var a = this._rand(n2);
  15818. var g = n.gcd(a);
  15819. if (g.cmpn(1) !== 0)
  15820. return g;
  15821. var x = a.toRed(red).redPow(d);
  15822. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  15823. continue;
  15824. for (var i = 1; i < s; i++) {
  15825. x = x.redSqr();
  15826. if (x.cmp(rone) === 0)
  15827. return x.fromRed().subn(1).gcd(n);
  15828. if (x.cmp(rn1) === 0)
  15829. break;
  15830. }
  15831. if (i === s) {
  15832. x = x.redSqr();
  15833. return x.fromRed().subn(1).gcd(n);
  15834. }
  15835. }
  15836. return false;
  15837. };
  15838. /***/ },
  15839. /* 110 */
  15840. /***/ function(module, exports, __webpack_require__) {
  15841. /* WEBPACK VAR INJECTION */(function(process, Buffer) {var createHmac = __webpack_require__(60)
  15842. var checkParameters = __webpack_require__(264)
  15843. exports.pbkdf2 = function (password, salt, iterations, keylen, digest, callback) {
  15844. if (typeof digest === 'function') {
  15845. callback = digest
  15846. digest = undefined
  15847. }
  15848. checkParameters(iterations, keylen)
  15849. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  15850. setTimeout(function () {
  15851. callback(null, exports.pbkdf2Sync(password, salt, iterations, keylen, digest))
  15852. })
  15853. }
  15854. var defaultEncoding
  15855. if (process.browser) {
  15856. defaultEncoding = 'utf-8'
  15857. } else {
  15858. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  15859. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  15860. }
  15861. exports.pbkdf2Sync = function (password, salt, iterations, keylen, digest) {
  15862. if (!Buffer.isBuffer(password)) password = new Buffer(password, defaultEncoding)
  15863. if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, defaultEncoding)
  15864. checkParameters(iterations, keylen)
  15865. digest = digest || 'sha1'
  15866. var hLen
  15867. var l = 1
  15868. var DK = new Buffer(keylen)
  15869. var block1 = new Buffer(salt.length + 4)
  15870. salt.copy(block1, 0, 0, salt.length)
  15871. var r
  15872. var T
  15873. for (var i = 1; i <= l; i++) {
  15874. block1.writeUInt32BE(i, salt.length)
  15875. var U = createHmac(digest, password).update(block1).digest()
  15876. if (!hLen) {
  15877. hLen = U.length
  15878. T = new Buffer(hLen)
  15879. l = Math.ceil(keylen / hLen)
  15880. r = keylen - (l - 1) * hLen
  15881. }
  15882. U.copy(T, 0, 0, hLen)
  15883. for (var j = 1; j < iterations; j++) {
  15884. U = createHmac(digest, password).update(U).digest()
  15885. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  15886. }
  15887. var destPos = (i - 1) * hLen
  15888. var len = (i === l ? r : hLen)
  15889. T.copy(DK, destPos, 0, len)
  15890. }
  15891. return DK
  15892. }
  15893. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(0).Buffer))
  15894. /***/ },
  15895. /* 111 */
  15896. /***/ function(module, exports, __webpack_require__) {
  15897. /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(16);
  15898. module.exports = function (seed, len) {
  15899. var t = new Buffer('');
  15900. var i = 0, c;
  15901. while (t.length < len) {
  15902. c = i2ops(i++);
  15903. t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);
  15904. }
  15905. return t.slice(0, len);
  15906. };
  15907. function i2ops(c) {
  15908. var out = new Buffer(4);
  15909. out.writeUInt32BE(c,0);
  15910. return out;
  15911. }
  15912. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15913. /***/ },
  15914. /* 112 */
  15915. /***/ function(module, exports, __webpack_require__) {
  15916. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(2);
  15917. function withPublic(paddedMsg, key) {
  15918. return new Buffer(paddedMsg
  15919. .toRed(bn.mont(key.modulus))
  15920. .redPow(new bn(key.publicExponent))
  15921. .fromRed()
  15922. .toArray());
  15923. }
  15924. module.exports = withPublic;
  15925. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15926. /***/ },
  15927. /* 113 */
  15928. /***/ function(module, exports) {
  15929. module.exports = function xor(a, b) {
  15930. var len = a.length;
  15931. var i = -1;
  15932. while (++i < len) {
  15933. a[i] ^= b[i];
  15934. }
  15935. return a
  15936. };
  15937. /***/ },
  15938. /* 114 */
  15939. /***/ function(module, exports, __webpack_require__) {
  15940. "use strict";
  15941. // a passthrough stream.
  15942. // basically just the most minimal sort of Transform stream.
  15943. // Every written chunk gets output as-is.
  15944. 'use strict';
  15945. module.exports = PassThrough;
  15946. var Transform = __webpack_require__(63);
  15947. /*<replacement>*/
  15948. var util = __webpack_require__(29);
  15949. util.inherits = __webpack_require__(1);
  15950. /*</replacement>*/
  15951. util.inherits(PassThrough, Transform);
  15952. function PassThrough(options) {
  15953. if (!(this instanceof PassThrough)) return new PassThrough(options);
  15954. Transform.call(this, options);
  15955. }
  15956. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  15957. cb(null, chunk);
  15958. };
  15959. /***/ },
  15960. /* 115 */
  15961. /***/ function(module, exports, __webpack_require__) {
  15962. "use strict";
  15963. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  15964. module.exports = Readable;
  15965. /*<replacement>*/
  15966. var processNextTick = __webpack_require__(62);
  15967. /*</replacement>*/
  15968. /*<replacement>*/
  15969. var isArray = __webpack_require__(106);
  15970. /*</replacement>*/
  15971. Readable.ReadableState = ReadableState;
  15972. /*<replacement>*/
  15973. var EE = __webpack_require__(44).EventEmitter;
  15974. var EElistenerCount = function (emitter, type) {
  15975. return emitter.listeners(type).length;
  15976. };
  15977. /*</replacement>*/
  15978. /*<replacement>*/
  15979. var Stream;
  15980. (function () {
  15981. try {
  15982. Stream = __webpack_require__(19);
  15983. } catch (_) {} finally {
  15984. if (!Stream) Stream = __webpack_require__(44).EventEmitter;
  15985. }
  15986. })();
  15987. /*</replacement>*/
  15988. var Buffer = __webpack_require__(0).Buffer;
  15989. /*<replacement>*/
  15990. var bufferShim = __webpack_require__(51);
  15991. /*</replacement>*/
  15992. /*<replacement>*/
  15993. var util = __webpack_require__(29);
  15994. util.inherits = __webpack_require__(1);
  15995. /*</replacement>*/
  15996. /*<replacement>*/
  15997. var debugUtil = __webpack_require__(312);
  15998. var debug = void 0;
  15999. if (debugUtil && debugUtil.debuglog) {
  16000. debug = debugUtil.debuglog('stream');
  16001. } else {
  16002. debug = function () {};
  16003. }
  16004. /*</replacement>*/
  16005. var BufferList = __webpack_require__(269);
  16006. var StringDecoder;
  16007. util.inherits(Readable, Stream);
  16008. function prependListener(emitter, event, fn) {
  16009. if (typeof emitter.prependListener === 'function') {
  16010. return emitter.prependListener(event, fn);
  16011. } else {
  16012. // This is a hack to make sure that our error handler is attached before any
  16013. // userland ones. NEVER DO THIS. This is here only because this code needs
  16014. // to continue to work with older versions of Node.js that do not include
  16015. // the prependListener() method. The goal is to eventually remove this hack.
  16016. 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]];
  16017. }
  16018. }
  16019. var Duplex;
  16020. function ReadableState(options, stream) {
  16021. Duplex = Duplex || __webpack_require__(10);
  16022. options = options || {};
  16023. // object stream flag. Used to make read(n) ignore n and to
  16024. // make all the buffer merging and length checks go away
  16025. this.objectMode = !!options.objectMode;
  16026. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  16027. // the point at which it stops calling _read() to fill the buffer
  16028. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  16029. var hwm = options.highWaterMark;
  16030. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  16031. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  16032. // cast to ints.
  16033. this.highWaterMark = ~ ~this.highWaterMark;
  16034. // A linked list is used to store data chunks instead of an array because the
  16035. // linked list can remove elements from the beginning faster than
  16036. // array.shift()
  16037. this.buffer = new BufferList();
  16038. this.length = 0;
  16039. this.pipes = null;
  16040. this.pipesCount = 0;
  16041. this.flowing = null;
  16042. this.ended = false;
  16043. this.endEmitted = false;
  16044. this.reading = false;
  16045. // a flag to be able to tell if the onwrite cb is called immediately,
  16046. // or on a later tick. We set this to true at first, because any
  16047. // actions that shouldn't happen until "later" should generally also
  16048. // not happen before the first write call.
  16049. this.sync = true;
  16050. // whenever we return null, then we set a flag to say
  16051. // that we're awaiting a 'readable' event emission.
  16052. this.needReadable = false;
  16053. this.emittedReadable = false;
  16054. this.readableListening = false;
  16055. this.resumeScheduled = false;
  16056. // Crypto is kind of old and crusty. Historically, its default string
  16057. // encoding is 'binary' so we have to make this configurable.
  16058. // Everything else in the universe uses 'utf8', though.
  16059. this.defaultEncoding = options.defaultEncoding || 'utf8';
  16060. // when piping, we only care about 'readable' events that happen
  16061. // after read()ing all the bytes and not getting any pushback.
  16062. this.ranOut = false;
  16063. // the number of writers that are awaiting a drain event in .pipe()s
  16064. this.awaitDrain = 0;
  16065. // if true, a maybeReadMore has been scheduled
  16066. this.readingMore = false;
  16067. this.decoder = null;
  16068. this.encoding = null;
  16069. if (options.encoding) {
  16070. if (!StringDecoder) StringDecoder = __webpack_require__(65).StringDecoder;
  16071. this.decoder = new StringDecoder(options.encoding);
  16072. this.encoding = options.encoding;
  16073. }
  16074. }
  16075. var Duplex;
  16076. function Readable(options) {
  16077. Duplex = Duplex || __webpack_require__(10);
  16078. if (!(this instanceof Readable)) return new Readable(options);
  16079. this._readableState = new ReadableState(options, this);
  16080. // legacy
  16081. this.readable = true;
  16082. if (options && typeof options.read === 'function') this._read = options.read;
  16083. Stream.call(this);
  16084. }
  16085. // Manually shove something into the read() buffer.
  16086. // This returns true if the highWaterMark has not been hit yet,
  16087. // similar to how Writable.write() returns true if you should
  16088. // write() some more.
  16089. Readable.prototype.push = function (chunk, encoding) {
  16090. var state = this._readableState;
  16091. if (!state.objectMode && typeof chunk === 'string') {
  16092. encoding = encoding || state.defaultEncoding;
  16093. if (encoding !== state.encoding) {
  16094. chunk = bufferShim.from(chunk, encoding);
  16095. encoding = '';
  16096. }
  16097. }
  16098. return readableAddChunk(this, state, chunk, encoding, false);
  16099. };
  16100. // Unshift should *always* be something directly out of read()
  16101. Readable.prototype.unshift = function (chunk) {
  16102. var state = this._readableState;
  16103. return readableAddChunk(this, state, chunk, '', true);
  16104. };
  16105. Readable.prototype.isPaused = function () {
  16106. return this._readableState.flowing === false;
  16107. };
  16108. function readableAddChunk(stream, state, chunk, encoding, addToFront) {
  16109. var er = chunkInvalid(state, chunk);
  16110. if (er) {
  16111. stream.emit('error', er);
  16112. } else if (chunk === null) {
  16113. state.reading = false;
  16114. onEofChunk(stream, state);
  16115. } else if (state.objectMode || chunk && chunk.length > 0) {
  16116. if (state.ended && !addToFront) {
  16117. var e = new Error('stream.push() after EOF');
  16118. stream.emit('error', e);
  16119. } else if (state.endEmitted && addToFront) {
  16120. var _e = new Error('stream.unshift() after end event');
  16121. stream.emit('error', _e);
  16122. } else {
  16123. var skipAdd;
  16124. if (state.decoder && !addToFront && !encoding) {
  16125. chunk = state.decoder.write(chunk);
  16126. skipAdd = !state.objectMode && chunk.length === 0;
  16127. }
  16128. if (!addToFront) state.reading = false;
  16129. // Don't add to the buffer if we've decoded to an empty string chunk and
  16130. // we're not in object mode
  16131. if (!skipAdd) {
  16132. // if we want the data now, just emit it.
  16133. if (state.flowing && state.length === 0 && !state.sync) {
  16134. stream.emit('data', chunk);
  16135. stream.read(0);
  16136. } else {
  16137. // update the buffer info.
  16138. state.length += state.objectMode ? 1 : chunk.length;
  16139. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  16140. if (state.needReadable) emitReadable(stream);
  16141. }
  16142. }
  16143. maybeReadMore(stream, state);
  16144. }
  16145. } else if (!addToFront) {
  16146. state.reading = false;
  16147. }
  16148. return needMoreData(state);
  16149. }
  16150. // if it's past the high water mark, we can push in some more.
  16151. // Also, if we have no data yet, we can stand some
  16152. // more bytes. This is to work around cases where hwm=0,
  16153. // such as the repl. Also, if the push() triggered a
  16154. // readable event, and the user called read(largeNumber) such that
  16155. // needReadable was set, then we ought to push more, so that another
  16156. // 'readable' event will be triggered.
  16157. function needMoreData(state) {
  16158. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  16159. }
  16160. // backwards compatibility.
  16161. Readable.prototype.setEncoding = function (enc) {
  16162. if (!StringDecoder) StringDecoder = __webpack_require__(65).StringDecoder;
  16163. this._readableState.decoder = new StringDecoder(enc);
  16164. this._readableState.encoding = enc;
  16165. return this;
  16166. };
  16167. // Don't raise the hwm > 8MB
  16168. var MAX_HWM = 0x800000;
  16169. function computeNewHighWaterMark(n) {
  16170. if (n >= MAX_HWM) {
  16171. n = MAX_HWM;
  16172. } else {
  16173. // Get the next highest power of 2 to prevent increasing hwm excessively in
  16174. // tiny amounts
  16175. n--;
  16176. n |= n >>> 1;
  16177. n |= n >>> 2;
  16178. n |= n >>> 4;
  16179. n |= n >>> 8;
  16180. n |= n >>> 16;
  16181. n++;
  16182. }
  16183. return n;
  16184. }
  16185. // This function is designed to be inlinable, so please take care when making
  16186. // changes to the function body.
  16187. function howMuchToRead(n, state) {
  16188. if (n <= 0 || state.length === 0 && state.ended) return 0;
  16189. if (state.objectMode) return 1;
  16190. if (n !== n) {
  16191. // Only flow one buffer at a time
  16192. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  16193. }
  16194. // If we're asking for more than the current hwm, then raise the hwm.
  16195. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  16196. if (n <= state.length) return n;
  16197. // Don't have enough
  16198. if (!state.ended) {
  16199. state.needReadable = true;
  16200. return 0;
  16201. }
  16202. return state.length;
  16203. }
  16204. // you can override either this method, or the async _read(n) below.
  16205. Readable.prototype.read = function (n) {
  16206. debug('read', n);
  16207. n = parseInt(n, 10);
  16208. var state = this._readableState;
  16209. var nOrig = n;
  16210. if (n !== 0) state.emittedReadable = false;
  16211. // if we're doing read(0) to trigger a readable event, but we
  16212. // already have a bunch of data in the buffer, then just trigger
  16213. // the 'readable' event and move on.
  16214. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  16215. debug('read: emitReadable', state.length, state.ended);
  16216. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  16217. return null;
  16218. }
  16219. n = howMuchToRead(n, state);
  16220. // if we've ended, and we're now clear, then finish it up.
  16221. if (n === 0 && state.ended) {
  16222. if (state.length === 0) endReadable(this);
  16223. return null;
  16224. }
  16225. // All the actual chunk generation logic needs to be
  16226. // *below* the call to _read. The reason is that in certain
  16227. // synthetic stream cases, such as passthrough streams, _read
  16228. // may be a completely synchronous operation which may change
  16229. // the state of the read buffer, providing enough data when
  16230. // before there was *not* enough.
  16231. //
  16232. // So, the steps are:
  16233. // 1. Figure out what the state of things will be after we do
  16234. // a read from the buffer.
  16235. //
  16236. // 2. If that resulting state will trigger a _read, then call _read.
  16237. // Note that this may be asynchronous, or synchronous. Yes, it is
  16238. // deeply ugly to write APIs this way, but that still doesn't mean
  16239. // that the Readable class should behave improperly, as streams are
  16240. // designed to be sync/async agnostic.
  16241. // Take note if the _read call is sync or async (ie, if the read call
  16242. // has returned yet), so that we know whether or not it's safe to emit
  16243. // 'readable' etc.
  16244. //
  16245. // 3. Actually pull the requested chunks out of the buffer and return.
  16246. // if we need a readable event, then we need to do some reading.
  16247. var doRead = state.needReadable;
  16248. debug('need readable', doRead);
  16249. // if we currently have less than the highWaterMark, then also read some
  16250. if (state.length === 0 || state.length - n < state.highWaterMark) {
  16251. doRead = true;
  16252. debug('length less than watermark', doRead);
  16253. }
  16254. // however, if we've ended, then there's no point, and if we're already
  16255. // reading, then it's unnecessary.
  16256. if (state.ended || state.reading) {
  16257. doRead = false;
  16258. debug('reading or ended', doRead);
  16259. } else if (doRead) {
  16260. debug('do read');
  16261. state.reading = true;
  16262. state.sync = true;
  16263. // if the length is currently zero, then we *need* a readable event.
  16264. if (state.length === 0) state.needReadable = true;
  16265. // call internal read method
  16266. this._read(state.highWaterMark);
  16267. state.sync = false;
  16268. // If _read pushed data synchronously, then `reading` will be false,
  16269. // and we need to re-evaluate how much data we can return to the user.
  16270. if (!state.reading) n = howMuchToRead(nOrig, state);
  16271. }
  16272. var ret;
  16273. if (n > 0) ret = fromList(n, state);else ret = null;
  16274. if (ret === null) {
  16275. state.needReadable = true;
  16276. n = 0;
  16277. } else {
  16278. state.length -= n;
  16279. }
  16280. if (state.length === 0) {
  16281. // If we have nothing in the buffer, then we want to know
  16282. // as soon as we *do* get something into the buffer.
  16283. if (!state.ended) state.needReadable = true;
  16284. // If we tried to read() past the EOF, then emit end on the next tick.
  16285. if (nOrig !== n && state.ended) endReadable(this);
  16286. }
  16287. if (ret !== null) this.emit('data', ret);
  16288. return ret;
  16289. };
  16290. function chunkInvalid(state, chunk) {
  16291. var er = null;
  16292. if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
  16293. er = new TypeError('Invalid non-string/buffer chunk');
  16294. }
  16295. return er;
  16296. }
  16297. function onEofChunk(stream, state) {
  16298. if (state.ended) return;
  16299. if (state.decoder) {
  16300. var chunk = state.decoder.end();
  16301. if (chunk && chunk.length) {
  16302. state.buffer.push(chunk);
  16303. state.length += state.objectMode ? 1 : chunk.length;
  16304. }
  16305. }
  16306. state.ended = true;
  16307. // emit 'readable' now to make sure it gets picked up.
  16308. emitReadable(stream);
  16309. }
  16310. // Don't emit readable right away in sync mode, because this can trigger
  16311. // another read() call => stack overflow. This way, it might trigger
  16312. // a nextTick recursion warning, but that's not so bad.
  16313. function emitReadable(stream) {
  16314. var state = stream._readableState;
  16315. state.needReadable = false;
  16316. if (!state.emittedReadable) {
  16317. debug('emitReadable', state.flowing);
  16318. state.emittedReadable = true;
  16319. if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
  16320. }
  16321. }
  16322. function emitReadable_(stream) {
  16323. debug('emit readable');
  16324. stream.emit('readable');
  16325. flow(stream);
  16326. }
  16327. // at this point, the user has presumably seen the 'readable' event,
  16328. // and called read() to consume some data. that may have triggered
  16329. // in turn another _read(n) call, in which case reading = true if
  16330. // it's in progress.
  16331. // However, if we're not ended, or reading, and the length < hwm,
  16332. // then go ahead and try to read some more preemptively.
  16333. function maybeReadMore(stream, state) {
  16334. if (!state.readingMore) {
  16335. state.readingMore = true;
  16336. processNextTick(maybeReadMore_, stream, state);
  16337. }
  16338. }
  16339. function maybeReadMore_(stream, state) {
  16340. var len = state.length;
  16341. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  16342. debug('maybeReadMore read 0');
  16343. stream.read(0);
  16344. if (len === state.length)
  16345. // didn't get any data, stop spinning.
  16346. break;else len = state.length;
  16347. }
  16348. state.readingMore = false;
  16349. }
  16350. // abstract method. to be overridden in specific implementation classes.
  16351. // call cb(er, data) where data is <= n in length.
  16352. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  16353. // arbitrary, and perhaps not very meaningful.
  16354. Readable.prototype._read = function (n) {
  16355. this.emit('error', new Error('not implemented'));
  16356. };
  16357. Readable.prototype.pipe = function (dest, pipeOpts) {
  16358. var src = this;
  16359. var state = this._readableState;
  16360. switch (state.pipesCount) {
  16361. case 0:
  16362. state.pipes = dest;
  16363. break;
  16364. case 1:
  16365. state.pipes = [state.pipes, dest];
  16366. break;
  16367. default:
  16368. state.pipes.push(dest);
  16369. break;
  16370. }
  16371. state.pipesCount += 1;
  16372. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  16373. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  16374. var endFn = doEnd ? onend : cleanup;
  16375. if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
  16376. dest.on('unpipe', onunpipe);
  16377. function onunpipe(readable) {
  16378. debug('onunpipe');
  16379. if (readable === src) {
  16380. cleanup();
  16381. }
  16382. }
  16383. function onend() {
  16384. debug('onend');
  16385. dest.end();
  16386. }
  16387. // when the dest drains, it reduces the awaitDrain counter
  16388. // on the source. This would be more elegant with a .once()
  16389. // handler in flow(), but adding and removing repeatedly is
  16390. // too slow.
  16391. var ondrain = pipeOnDrain(src);
  16392. dest.on('drain', ondrain);
  16393. var cleanedUp = false;
  16394. function cleanup() {
  16395. debug('cleanup');
  16396. // cleanup event handlers once the pipe is broken
  16397. dest.removeListener('close', onclose);
  16398. dest.removeListener('finish', onfinish);
  16399. dest.removeListener('drain', ondrain);
  16400. dest.removeListener('error', onerror);
  16401. dest.removeListener('unpipe', onunpipe);
  16402. src.removeListener('end', onend);
  16403. src.removeListener('end', cleanup);
  16404. src.removeListener('data', ondata);
  16405. cleanedUp = true;
  16406. // if the reader is waiting for a drain event from this
  16407. // specific writer, then it would cause it to never start
  16408. // flowing again.
  16409. // So, if this is awaiting a drain, then we just call it now.
  16410. // If we don't know, then assume that we are waiting for one.
  16411. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  16412. }
  16413. // If the user pushes more data while we're writing to dest then we'll end up
  16414. // in ondata again. However, we only want to increase awaitDrain once because
  16415. // dest will only emit one 'drain' event for the multiple writes.
  16416. // => Introduce a guard on increasing awaitDrain.
  16417. var increasedAwaitDrain = false;
  16418. src.on('data', ondata);
  16419. function ondata(chunk) {
  16420. debug('ondata');
  16421. increasedAwaitDrain = false;
  16422. var ret = dest.write(chunk);
  16423. if (false === ret && !increasedAwaitDrain) {
  16424. // If the user unpiped during `dest.write()`, it is possible
  16425. // to get stuck in a permanently paused state if that write
  16426. // also returned false.
  16427. // => Check whether `dest` is still a piping destination.
  16428. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  16429. debug('false write response, pause', src._readableState.awaitDrain);
  16430. src._readableState.awaitDrain++;
  16431. increasedAwaitDrain = true;
  16432. }
  16433. src.pause();
  16434. }
  16435. }
  16436. // if the dest has an error, then stop piping into it.
  16437. // however, don't suppress the throwing behavior for this.
  16438. function onerror(er) {
  16439. debug('onerror', er);
  16440. unpipe();
  16441. dest.removeListener('error', onerror);
  16442. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  16443. }
  16444. // Make sure our error handler is attached before userland ones.
  16445. prependListener(dest, 'error', onerror);
  16446. // Both close and finish should trigger unpipe, but only once.
  16447. function onclose() {
  16448. dest.removeListener('finish', onfinish);
  16449. unpipe();
  16450. }
  16451. dest.once('close', onclose);
  16452. function onfinish() {
  16453. debug('onfinish');
  16454. dest.removeListener('close', onclose);
  16455. unpipe();
  16456. }
  16457. dest.once('finish', onfinish);
  16458. function unpipe() {
  16459. debug('unpipe');
  16460. src.unpipe(dest);
  16461. }
  16462. // tell the dest that it's being piped to
  16463. dest.emit('pipe', src);
  16464. // start the flow if it hasn't been started already.
  16465. if (!state.flowing) {
  16466. debug('pipe resume');
  16467. src.resume();
  16468. }
  16469. return dest;
  16470. };
  16471. function pipeOnDrain(src) {
  16472. return function () {
  16473. var state = src._readableState;
  16474. debug('pipeOnDrain', state.awaitDrain);
  16475. if (state.awaitDrain) state.awaitDrain--;
  16476. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  16477. state.flowing = true;
  16478. flow(src);
  16479. }
  16480. };
  16481. }
  16482. Readable.prototype.unpipe = function (dest) {
  16483. var state = this._readableState;
  16484. // if we're not piping anywhere, then do nothing.
  16485. if (state.pipesCount === 0) return this;
  16486. // just one destination. most common case.
  16487. if (state.pipesCount === 1) {
  16488. // passed in one, but it's not the right one.
  16489. if (dest && dest !== state.pipes) return this;
  16490. if (!dest) dest = state.pipes;
  16491. // got a match.
  16492. state.pipes = null;
  16493. state.pipesCount = 0;
  16494. state.flowing = false;
  16495. if (dest) dest.emit('unpipe', this);
  16496. return this;
  16497. }
  16498. // slow case. multiple pipe destinations.
  16499. if (!dest) {
  16500. // remove all.
  16501. var dests = state.pipes;
  16502. var len = state.pipesCount;
  16503. state.pipes = null;
  16504. state.pipesCount = 0;
  16505. state.flowing = false;
  16506. for (var _i = 0; _i < len; _i++) {
  16507. dests[_i].emit('unpipe', this);
  16508. }return this;
  16509. }
  16510. // try to find the right one.
  16511. var i = indexOf(state.pipes, dest);
  16512. if (i === -1) return this;
  16513. state.pipes.splice(i, 1);
  16514. state.pipesCount -= 1;
  16515. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  16516. dest.emit('unpipe', this);
  16517. return this;
  16518. };
  16519. // set up data events if they are asked for
  16520. // Ensure readable listeners eventually get something
  16521. Readable.prototype.on = function (ev, fn) {
  16522. var res = Stream.prototype.on.call(this, ev, fn);
  16523. if (ev === 'data') {
  16524. // Start flowing on next tick if stream isn't explicitly paused
  16525. if (this._readableState.flowing !== false) this.resume();
  16526. } else if (ev === 'readable') {
  16527. var state = this._readableState;
  16528. if (!state.endEmitted && !state.readableListening) {
  16529. state.readableListening = state.needReadable = true;
  16530. state.emittedReadable = false;
  16531. if (!state.reading) {
  16532. processNextTick(nReadingNextTick, this);
  16533. } else if (state.length) {
  16534. emitReadable(this, state);
  16535. }
  16536. }
  16537. }
  16538. return res;
  16539. };
  16540. Readable.prototype.addListener = Readable.prototype.on;
  16541. function nReadingNextTick(self) {
  16542. debug('readable nexttick read 0');
  16543. self.read(0);
  16544. }
  16545. // pause() and resume() are remnants of the legacy readable stream API
  16546. // If the user uses them, then switch into old mode.
  16547. Readable.prototype.resume = function () {
  16548. var state = this._readableState;
  16549. if (!state.flowing) {
  16550. debug('resume');
  16551. state.flowing = true;
  16552. resume(this, state);
  16553. }
  16554. return this;
  16555. };
  16556. function resume(stream, state) {
  16557. if (!state.resumeScheduled) {
  16558. state.resumeScheduled = true;
  16559. processNextTick(resume_, stream, state);
  16560. }
  16561. }
  16562. function resume_(stream, state) {
  16563. if (!state.reading) {
  16564. debug('resume read 0');
  16565. stream.read(0);
  16566. }
  16567. state.resumeScheduled = false;
  16568. state.awaitDrain = 0;
  16569. stream.emit('resume');
  16570. flow(stream);
  16571. if (state.flowing && !state.reading) stream.read(0);
  16572. }
  16573. Readable.prototype.pause = function () {
  16574. debug('call pause flowing=%j', this._readableState.flowing);
  16575. if (false !== this._readableState.flowing) {
  16576. debug('pause');
  16577. this._readableState.flowing = false;
  16578. this.emit('pause');
  16579. }
  16580. return this;
  16581. };
  16582. function flow(stream) {
  16583. var state = stream._readableState;
  16584. debug('flow', state.flowing);
  16585. while (state.flowing && stream.read() !== null) {}
  16586. }
  16587. // wrap an old-style stream as the async data source.
  16588. // This is *not* part of the readable stream interface.
  16589. // It is an ugly unfortunate mess of history.
  16590. Readable.prototype.wrap = function (stream) {
  16591. var state = this._readableState;
  16592. var paused = false;
  16593. var self = this;
  16594. stream.on('end', function () {
  16595. debug('wrapped end');
  16596. if (state.decoder && !state.ended) {
  16597. var chunk = state.decoder.end();
  16598. if (chunk && chunk.length) self.push(chunk);
  16599. }
  16600. self.push(null);
  16601. });
  16602. stream.on('data', function (chunk) {
  16603. debug('wrapped data');
  16604. if (state.decoder) chunk = state.decoder.write(chunk);
  16605. // don't skip over falsy values in objectMode
  16606. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  16607. var ret = self.push(chunk);
  16608. if (!ret) {
  16609. paused = true;
  16610. stream.pause();
  16611. }
  16612. });
  16613. // proxy all the other methods.
  16614. // important when wrapping filters and duplexes.
  16615. for (var i in stream) {
  16616. if (this[i] === undefined && typeof stream[i] === 'function') {
  16617. this[i] = function (method) {
  16618. return function () {
  16619. return stream[method].apply(stream, arguments);
  16620. };
  16621. }(i);
  16622. }
  16623. }
  16624. // proxy certain important events.
  16625. var events = ['error', 'close', 'destroy', 'pause', 'resume'];
  16626. forEach(events, function (ev) {
  16627. stream.on(ev, self.emit.bind(self, ev));
  16628. });
  16629. // when we try to consume some more bytes, simply unpause the
  16630. // underlying stream.
  16631. self._read = function (n) {
  16632. debug('wrapped _read', n);
  16633. if (paused) {
  16634. paused = false;
  16635. stream.resume();
  16636. }
  16637. };
  16638. return self;
  16639. };
  16640. // exposed for testing purposes only.
  16641. Readable._fromList = fromList;
  16642. // Pluck off n bytes from an array of buffers.
  16643. // Length is the combined lengths of all the buffers in the list.
  16644. // This function is designed to be inlinable, so please take care when making
  16645. // changes to the function body.
  16646. function fromList(n, state) {
  16647. // nothing buffered
  16648. if (state.length === 0) return null;
  16649. var ret;
  16650. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  16651. // read it all, truncate the list
  16652. 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);
  16653. state.buffer.clear();
  16654. } else {
  16655. // read part of list
  16656. ret = fromListPartial(n, state.buffer, state.decoder);
  16657. }
  16658. return ret;
  16659. }
  16660. // Extracts only enough buffered data to satisfy the amount requested.
  16661. // This function is designed to be inlinable, so please take care when making
  16662. // changes to the function body.
  16663. function fromListPartial(n, list, hasStrings) {
  16664. var ret;
  16665. if (n < list.head.data.length) {
  16666. // slice is the same for buffers and strings
  16667. ret = list.head.data.slice(0, n);
  16668. list.head.data = list.head.data.slice(n);
  16669. } else if (n === list.head.data.length) {
  16670. // first chunk is a perfect match
  16671. ret = list.shift();
  16672. } else {
  16673. // result spans more than one buffer
  16674. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  16675. }
  16676. return ret;
  16677. }
  16678. // Copies a specified amount of characters from the list of buffered data
  16679. // chunks.
  16680. // This function is designed to be inlinable, so please take care when making
  16681. // changes to the function body.
  16682. function copyFromBufferString(n, list) {
  16683. var p = list.head;
  16684. var c = 1;
  16685. var ret = p.data;
  16686. n -= ret.length;
  16687. while (p = p.next) {
  16688. var str = p.data;
  16689. var nb = n > str.length ? str.length : n;
  16690. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  16691. n -= nb;
  16692. if (n === 0) {
  16693. if (nb === str.length) {
  16694. ++c;
  16695. if (p.next) list.head = p.next;else list.head = list.tail = null;
  16696. } else {
  16697. list.head = p;
  16698. p.data = str.slice(nb);
  16699. }
  16700. break;
  16701. }
  16702. ++c;
  16703. }
  16704. list.length -= c;
  16705. return ret;
  16706. }
  16707. // Copies a specified amount of bytes from the list of buffered data chunks.
  16708. // This function is designed to be inlinable, so please take care when making
  16709. // changes to the function body.
  16710. function copyFromBuffer(n, list) {
  16711. var ret = bufferShim.allocUnsafe(n);
  16712. var p = list.head;
  16713. var c = 1;
  16714. p.data.copy(ret);
  16715. n -= p.data.length;
  16716. while (p = p.next) {
  16717. var buf = p.data;
  16718. var nb = n > buf.length ? buf.length : n;
  16719. buf.copy(ret, ret.length - n, 0, nb);
  16720. n -= nb;
  16721. if (n === 0) {
  16722. if (nb === buf.length) {
  16723. ++c;
  16724. if (p.next) list.head = p.next;else list.head = list.tail = null;
  16725. } else {
  16726. list.head = p;
  16727. p.data = buf.slice(nb);
  16728. }
  16729. break;
  16730. }
  16731. ++c;
  16732. }
  16733. list.length -= c;
  16734. return ret;
  16735. }
  16736. function endReadable(stream) {
  16737. var state = stream._readableState;
  16738. // If we get here before consuming all the bytes, then that is a
  16739. // bug in node. Should never happen.
  16740. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  16741. if (!state.endEmitted) {
  16742. state.ended = true;
  16743. processNextTick(endReadableNT, state, stream);
  16744. }
  16745. }
  16746. function endReadableNT(state, stream) {
  16747. // Check that we didn't get one last unshift.
  16748. if (!state.endEmitted && state.length === 0) {
  16749. state.endEmitted = true;
  16750. stream.readable = false;
  16751. stream.emit('end');
  16752. }
  16753. }
  16754. function forEach(xs, f) {
  16755. for (var i = 0, l = xs.length; i < l; i++) {
  16756. f(xs[i], i);
  16757. }
  16758. }
  16759. function indexOf(xs, x) {
  16760. for (var i = 0, l = xs.length; i < l; i++) {
  16761. if (xs[i] === x) return i;
  16762. }
  16763. return -1;
  16764. }
  16765. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  16766. /***/ },
  16767. /* 116 */
  16768. /***/ function(module, exports, __webpack_require__) {
  16769. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  16770. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  16771. * in FIPS 180-2
  16772. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  16773. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  16774. *
  16775. */
  16776. var inherits = __webpack_require__(1)
  16777. var Hash = __webpack_require__(18)
  16778. var K = [
  16779. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  16780. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  16781. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  16782. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  16783. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  16784. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  16785. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  16786. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  16787. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  16788. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  16789. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  16790. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  16791. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  16792. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  16793. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  16794. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  16795. ]
  16796. var W = new Array(64)
  16797. function Sha256 () {
  16798. this.init()
  16799. this._w = W // new Array(64)
  16800. Hash.call(this, 64, 56)
  16801. }
  16802. inherits(Sha256, Hash)
  16803. Sha256.prototype.init = function () {
  16804. this._a = 0x6a09e667
  16805. this._b = 0xbb67ae85
  16806. this._c = 0x3c6ef372
  16807. this._d = 0xa54ff53a
  16808. this._e = 0x510e527f
  16809. this._f = 0x9b05688c
  16810. this._g = 0x1f83d9ab
  16811. this._h = 0x5be0cd19
  16812. return this
  16813. }
  16814. function ch (x, y, z) {
  16815. return z ^ (x & (y ^ z))
  16816. }
  16817. function maj (x, y, z) {
  16818. return (x & y) | (z & (x | y))
  16819. }
  16820. function sigma0 (x) {
  16821. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  16822. }
  16823. function sigma1 (x) {
  16824. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  16825. }
  16826. function gamma0 (x) {
  16827. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  16828. }
  16829. function gamma1 (x) {
  16830. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  16831. }
  16832. Sha256.prototype._update = function (M) {
  16833. var W = this._w
  16834. var a = this._a | 0
  16835. var b = this._b | 0
  16836. var c = this._c | 0
  16837. var d = this._d | 0
  16838. var e = this._e | 0
  16839. var f = this._f | 0
  16840. var g = this._g | 0
  16841. var h = this._h | 0
  16842. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  16843. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  16844. for (var j = 0; j < 64; ++j) {
  16845. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  16846. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  16847. h = g
  16848. g = f
  16849. f = e
  16850. e = (d + T1) | 0
  16851. d = c
  16852. c = b
  16853. b = a
  16854. a = (T1 + T2) | 0
  16855. }
  16856. this._a = (a + this._a) | 0
  16857. this._b = (b + this._b) | 0
  16858. this._c = (c + this._c) | 0
  16859. this._d = (d + this._d) | 0
  16860. this._e = (e + this._e) | 0
  16861. this._f = (f + this._f) | 0
  16862. this._g = (g + this._g) | 0
  16863. this._h = (h + this._h) | 0
  16864. }
  16865. Sha256.prototype._hash = function () {
  16866. var H = new Buffer(32)
  16867. H.writeInt32BE(this._a, 0)
  16868. H.writeInt32BE(this._b, 4)
  16869. H.writeInt32BE(this._c, 8)
  16870. H.writeInt32BE(this._d, 12)
  16871. H.writeInt32BE(this._e, 16)
  16872. H.writeInt32BE(this._f, 20)
  16873. H.writeInt32BE(this._g, 24)
  16874. H.writeInt32BE(this._h, 28)
  16875. return H
  16876. }
  16877. module.exports = Sha256
  16878. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  16879. /***/ },
  16880. /* 117 */
  16881. /***/ function(module, exports, __webpack_require__) {
  16882. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  16883. var Hash = __webpack_require__(18)
  16884. var K = [
  16885. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  16886. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  16887. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  16888. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  16889. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  16890. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  16891. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  16892. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  16893. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  16894. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  16895. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  16896. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  16897. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  16898. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  16899. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  16900. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  16901. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  16902. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  16903. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  16904. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  16905. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  16906. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  16907. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  16908. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  16909. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  16910. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  16911. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  16912. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  16913. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  16914. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  16915. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  16916. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  16917. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  16918. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  16919. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  16920. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  16921. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  16922. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  16923. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  16924. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  16925. ]
  16926. var W = new Array(160)
  16927. function Sha512 () {
  16928. this.init()
  16929. this._w = W
  16930. Hash.call(this, 128, 112)
  16931. }
  16932. inherits(Sha512, Hash)
  16933. Sha512.prototype.init = function () {
  16934. this._ah = 0x6a09e667
  16935. this._bh = 0xbb67ae85
  16936. this._ch = 0x3c6ef372
  16937. this._dh = 0xa54ff53a
  16938. this._eh = 0x510e527f
  16939. this._fh = 0x9b05688c
  16940. this._gh = 0x1f83d9ab
  16941. this._hh = 0x5be0cd19
  16942. this._al = 0xf3bcc908
  16943. this._bl = 0x84caa73b
  16944. this._cl = 0xfe94f82b
  16945. this._dl = 0x5f1d36f1
  16946. this._el = 0xade682d1
  16947. this._fl = 0x2b3e6c1f
  16948. this._gl = 0xfb41bd6b
  16949. this._hl = 0x137e2179
  16950. return this
  16951. }
  16952. function Ch (x, y, z) {
  16953. return z ^ (x & (y ^ z))
  16954. }
  16955. function maj (x, y, z) {
  16956. return (x & y) | (z & (x | y))
  16957. }
  16958. function sigma0 (x, xl) {
  16959. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  16960. }
  16961. function sigma1 (x, xl) {
  16962. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  16963. }
  16964. function Gamma0 (x, xl) {
  16965. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  16966. }
  16967. function Gamma0l (x, xl) {
  16968. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  16969. }
  16970. function Gamma1 (x, xl) {
  16971. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  16972. }
  16973. function Gamma1l (x, xl) {
  16974. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  16975. }
  16976. function getCarry (a, b) {
  16977. return (a >>> 0) < (b >>> 0) ? 1 : 0
  16978. }
  16979. Sha512.prototype._update = function (M) {
  16980. var W = this._w
  16981. var ah = this._ah | 0
  16982. var bh = this._bh | 0
  16983. var ch = this._ch | 0
  16984. var dh = this._dh | 0
  16985. var eh = this._eh | 0
  16986. var fh = this._fh | 0
  16987. var gh = this._gh | 0
  16988. var hh = this._hh | 0
  16989. var al = this._al | 0
  16990. var bl = this._bl | 0
  16991. var cl = this._cl | 0
  16992. var dl = this._dl | 0
  16993. var el = this._el | 0
  16994. var fl = this._fl | 0
  16995. var gl = this._gl | 0
  16996. var hl = this._hl | 0
  16997. for (var i = 0; i < 32; i += 2) {
  16998. W[i] = M.readInt32BE(i * 4)
  16999. W[i + 1] = M.readInt32BE(i * 4 + 4)
  17000. }
  17001. for (; i < 160; i += 2) {
  17002. var xh = W[i - 15 * 2]
  17003. var xl = W[i - 15 * 2 + 1]
  17004. var gamma0 = Gamma0(xh, xl)
  17005. var gamma0l = Gamma0l(xl, xh)
  17006. xh = W[i - 2 * 2]
  17007. xl = W[i - 2 * 2 + 1]
  17008. var gamma1 = Gamma1(xh, xl)
  17009. var gamma1l = Gamma1l(xl, xh)
  17010. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  17011. var Wi7h = W[i - 7 * 2]
  17012. var Wi7l = W[i - 7 * 2 + 1]
  17013. var Wi16h = W[i - 16 * 2]
  17014. var Wi16l = W[i - 16 * 2 + 1]
  17015. var Wil = (gamma0l + Wi7l) | 0
  17016. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  17017. Wil = (Wil + gamma1l) | 0
  17018. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  17019. Wil = (Wil + Wi16l) | 0
  17020. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  17021. W[i] = Wih
  17022. W[i + 1] = Wil
  17023. }
  17024. for (var j = 0; j < 160; j += 2) {
  17025. Wih = W[j]
  17026. Wil = W[j + 1]
  17027. var majh = maj(ah, bh, ch)
  17028. var majl = maj(al, bl, cl)
  17029. var sigma0h = sigma0(ah, al)
  17030. var sigma0l = sigma0(al, ah)
  17031. var sigma1h = sigma1(eh, el)
  17032. var sigma1l = sigma1(el, eh)
  17033. // t1 = h + sigma1 + ch + K[j] + W[j]
  17034. var Kih = K[j]
  17035. var Kil = K[j + 1]
  17036. var chh = Ch(eh, fh, gh)
  17037. var chl = Ch(el, fl, gl)
  17038. var t1l = (hl + sigma1l) | 0
  17039. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  17040. t1l = (t1l + chl) | 0
  17041. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  17042. t1l = (t1l + Kil) | 0
  17043. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  17044. t1l = (t1l + Wil) | 0
  17045. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  17046. // t2 = sigma0 + maj
  17047. var t2l = (sigma0l + majl) | 0
  17048. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  17049. hh = gh
  17050. hl = gl
  17051. gh = fh
  17052. gl = fl
  17053. fh = eh
  17054. fl = el
  17055. el = (dl + t1l) | 0
  17056. eh = (dh + t1h + getCarry(el, dl)) | 0
  17057. dh = ch
  17058. dl = cl
  17059. ch = bh
  17060. cl = bl
  17061. bh = ah
  17062. bl = al
  17063. al = (t1l + t2l) | 0
  17064. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  17065. }
  17066. this._al = (this._al + al) | 0
  17067. this._bl = (this._bl + bl) | 0
  17068. this._cl = (this._cl + cl) | 0
  17069. this._dl = (this._dl + dl) | 0
  17070. this._el = (this._el + el) | 0
  17071. this._fl = (this._fl + fl) | 0
  17072. this._gl = (this._gl + gl) | 0
  17073. this._hl = (this._hl + hl) | 0
  17074. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  17075. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  17076. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  17077. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  17078. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  17079. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  17080. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  17081. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  17082. }
  17083. Sha512.prototype._hash = function () {
  17084. var H = new Buffer(64)
  17085. function writeInt64BE (h, l, offset) {
  17086. H.writeInt32BE(h, offset)
  17087. H.writeInt32BE(l, offset + 4)
  17088. }
  17089. writeInt64BE(this._ah, this._al, 0)
  17090. writeInt64BE(this._bh, this._bl, 8)
  17091. writeInt64BE(this._ch, this._cl, 16)
  17092. writeInt64BE(this._dh, this._dl, 24)
  17093. writeInt64BE(this._eh, this._el, 32)
  17094. writeInt64BE(this._fh, this._fl, 40)
  17095. writeInt64BE(this._gh, this._gl, 48)
  17096. writeInt64BE(this._hh, this._hl, 56)
  17097. return H
  17098. }
  17099. module.exports = Sha512
  17100. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  17101. /***/ },
  17102. /* 118 */
  17103. /***/ function(module, exports, __webpack_require__) {
  17104. "use strict";
  17105. 'use strict';
  17106. Object.defineProperty(exports, "__esModule", {
  17107. value: true
  17108. });
  17109. var _vue = __webpack_require__(47);
  17110. var _vue2 = _interopRequireDefault(_vue);
  17111. var _vueRouter = __webpack_require__(303);
  17112. var _vueRouter2 = _interopRequireDefault(_vueRouter);
  17113. var _PasswordGenerator = __webpack_require__(289);
  17114. var _PasswordGenerator2 = _interopRequireDefault(_PasswordGenerator);
  17115. var _Login = __webpack_require__(288);
  17116. var _Login2 = _interopRequireDefault(_Login);
  17117. var _PasswordReset = __webpack_require__(290);
  17118. var _PasswordReset2 = _interopRequireDefault(_PasswordReset);
  17119. var _PasswordResetConfirm = __webpack_require__(291);
  17120. var _PasswordResetConfirm2 = _interopRequireDefault(_PasswordResetConfirm);
  17121. var _Passwords = __webpack_require__(292);
  17122. var _Passwords2 = _interopRequireDefault(_Passwords);
  17123. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17124. _vue2.default.use(_vueRouter2.default);
  17125. var routes = [{ path: '/', name: 'home', component: _PasswordGenerator2.default }, { path: '/login', name: 'login', component: _Login2.default }, { path: '/passwords/', name: 'passwords', component: _Passwords2.default }, { path: '/passwords/:id', name: 'password', component: _PasswordGenerator2.default }, { path: '/password/reset', name: 'passwordReset', component: _PasswordReset2.default }, { path: '/password/reset/confirm/:uid/:token', name: 'passwordResetConfirm', component: _PasswordResetConfirm2.default }];
  17126. var router = new _vueRouter2.default({
  17127. routes: routes
  17128. });
  17129. exports.default = router;
  17130. /***/ },
  17131. /* 119 */
  17132. /***/ function(module, exports, __webpack_require__) {
  17133. "use strict";
  17134. 'use strict';
  17135. Object.defineProperty(exports, "__esModule", {
  17136. value: true
  17137. });
  17138. var _assign = __webpack_require__(48);
  17139. var _assign2 = _interopRequireDefault(_assign);
  17140. var _extends2 = __webpack_require__(25);
  17141. var _extends3 = _interopRequireDefault(_extends2);
  17142. var _vue = __webpack_require__(47);
  17143. var _vue2 = _interopRequireDefault(_vue);
  17144. var _vuex = __webpack_require__(11);
  17145. var _vuex2 = _interopRequireDefault(_vuex);
  17146. var _auth = __webpack_require__(34);
  17147. var _auth2 = _interopRequireDefault(_auth);
  17148. var _http = __webpack_require__(158);
  17149. var _http2 = _interopRequireDefault(_http);
  17150. var _storage = __webpack_require__(22);
  17151. var _storage2 = _interopRequireDefault(_storage);
  17152. var _password = __webpack_require__(78);
  17153. var _password2 = _interopRequireDefault(_password);
  17154. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17155. _vue2.default.use(_vuex2.default);
  17156. var storage = new _storage2.default();
  17157. var auth = new _auth2.default(storage);
  17158. var PasswordsAPI = new _http2.default('passwords', storage);
  17159. var defaultPassword = {
  17160. id: '',
  17161. site: '',
  17162. login: '',
  17163. uppercase: true,
  17164. lowercase: true,
  17165. numbers: true,
  17166. symbols: true,
  17167. length: 12,
  17168. counter: 1
  17169. };
  17170. var state = {
  17171. authenticated: auth.isAuthenticated(),
  17172. email: '',
  17173. passwordStatus: 'CLEAN',
  17174. passwords: [],
  17175. baseURL: 'https://lesspass.com',
  17176. password: (0, _extends3.default)({}, defaultPassword)
  17177. };
  17178. var mutations = {
  17179. LOGOUT: function LOGOUT(state) {
  17180. state.authenticated = false;
  17181. },
  17182. USER_AUTHENTICATED: function USER_AUTHENTICATED(state, user) {
  17183. state.authenticated = true;
  17184. state.email = user.email;
  17185. },
  17186. SET_PASSWORDS: function SET_PASSWORDS(state, passwords) {
  17187. state.passwords = passwords;
  17188. },
  17189. SET_PASSWORD: function SET_PASSWORD(state, _ref) {
  17190. var password = _ref.password;
  17191. state.password = password;
  17192. },
  17193. DELETE_PASSWORD: function DELETE_PASSWORD(state, _ref2) {
  17194. var id = _ref2.id;
  17195. var passwords = state.passwords;
  17196. state.passwords = passwords.filter(function (password) {
  17197. return password.id !== id;
  17198. });
  17199. if (state.password.id === id) {
  17200. state.password = state.defaultPassword;
  17201. }
  17202. },
  17203. PASSWORD_CLEAN: function PASSWORD_CLEAN(state) {
  17204. setTimeout(function () {
  17205. state.passwordStatus = 'CLEAN';
  17206. }, 5000);
  17207. },
  17208. CHANGE_PASSWORD_STATUS: function CHANGE_PASSWORD_STATUS(state, status) {
  17209. state.passwordStatus = status;
  17210. },
  17211. SET_DEFAULT_PASSWORD: function SET_DEFAULT_PASSWORD(state) {
  17212. state.password = (0, _assign2.default)({}, defaultPassword);
  17213. },
  17214. UPDATE_SITE: function UPDATE_SITE(state, _ref3) {
  17215. var site = _ref3.site;
  17216. state.password.site = site;
  17217. },
  17218. UPDATE_BASE_URL: function UPDATE_BASE_URL(state, _ref4) {
  17219. var baseURL = _ref4.baseURL;
  17220. state.baseURL = baseURL;
  17221. },
  17222. UPDATE_EMAIL: function UPDATE_EMAIL(state, _ref5) {
  17223. var email = _ref5.email;
  17224. state.email = email;
  17225. }
  17226. };
  17227. var actions = {
  17228. USER_AUTHENTICATED: function USER_AUTHENTICATED(_ref6, user) {
  17229. var commit = _ref6.commit;
  17230. return commit('USER_AUTHENTICATED', user);
  17231. },
  17232. LOGOUT: function LOGOUT(_ref7) {
  17233. var commit = _ref7.commit;
  17234. auth.logout();
  17235. commit('LOGOUT');
  17236. },
  17237. SAVE_OR_UPDATE_PASSWORD: function SAVE_OR_UPDATE_PASSWORD(_ref8) {
  17238. var commit = _ref8.commit,
  17239. state = _ref8.state,
  17240. dispatch = _ref8.dispatch;
  17241. var password = new _password2.default(state.password);
  17242. if (password.isNewPassword(state.passwords)) {
  17243. PasswordsAPI.create(password.json()).then(function () {
  17244. commit('CHANGE_PASSWORD_STATUS', 'CREATED');
  17245. commit('PASSWORD_CLEAN');
  17246. dispatch('FETCH_PASSWORDS');
  17247. });
  17248. } else {
  17249. PasswordsAPI.update(password.json()).then(function () {
  17250. commit('CHANGE_PASSWORD_STATUS', 'UPDATED');
  17251. commit('PASSWORD_CLEAN');
  17252. dispatch('FETCH_PASSWORDS');
  17253. });
  17254. }
  17255. },
  17256. REFRESH_TOKEN: function REFRESH_TOKEN(_ref9) {
  17257. var commit = _ref9.commit;
  17258. if (auth.isAuthenticated()) {
  17259. auth.refreshToken().catch(function () {
  17260. commit('LOGOUT');
  17261. });
  17262. }
  17263. },
  17264. PASSWORD_CHANGE: function PASSWORD_CHANGE(_ref10, _ref11) {
  17265. var commit = _ref10.commit;
  17266. var password = _ref11.password;
  17267. commit('SET_PASSWORD', { password: password });
  17268. },
  17269. PASSWORD_GENERATED: function PASSWORD_GENERATED(_ref12) {
  17270. var commit = _ref12.commit;
  17271. commit('CHANGE_PASSWORD_STATUS', 'DIRTY');
  17272. },
  17273. FETCH_PASSWORDS: function FETCH_PASSWORDS(_ref13) {
  17274. var commit = _ref13.commit;
  17275. if (auth.isAuthenticated()) {
  17276. PasswordsAPI.all().then(function (response) {
  17277. return commit('SET_PASSWORDS', response.data.results);
  17278. });
  17279. }
  17280. },
  17281. FETCH_PASSWORD: function FETCH_PASSWORD(_ref14, _ref15) {
  17282. var commit = _ref14.commit;
  17283. var id = _ref15.id;
  17284. PasswordsAPI.get({ id: id }).then(function (response) {
  17285. return commit('SET_PASSWORD', { password: response.data });
  17286. });
  17287. },
  17288. DELETE_PASSWORD: function DELETE_PASSWORD(_ref16, _ref17) {
  17289. var commit = _ref16.commit;
  17290. var id = _ref17.id;
  17291. PasswordsAPI.remove({ id: id }).then(function () {
  17292. commit('DELETE_PASSWORD', { id: id });
  17293. });
  17294. },
  17295. LOAD_DEFAULT_PASSWORD: function LOAD_DEFAULT_PASSWORD(_ref18) {
  17296. var commit = _ref18.commit;
  17297. commit('SET_DEFAULT_PASSWORD');
  17298. }
  17299. };
  17300. var getters = {
  17301. passwords: function passwords(state) {
  17302. return state.passwords;
  17303. },
  17304. password: function password(state) {
  17305. return state.password;
  17306. },
  17307. isAuthenticated: function isAuthenticated(state) {
  17308. return state.authenticated;
  17309. },
  17310. isGuest: function isGuest(state) {
  17311. return !state.authenticated;
  17312. },
  17313. passwordStatus: function passwordStatus(state) {
  17314. return state.passwordStatus;
  17315. },
  17316. email: function email(state) {
  17317. return state.email;
  17318. }
  17319. };
  17320. exports.default = new _vuex2.default.Store({
  17321. state: (0, _assign2.default)(state, storage.json()),
  17322. getters: getters,
  17323. actions: actions,
  17324. mutations: mutations
  17325. });
  17326. /***/ },
  17327. /* 120 */
  17328. /***/ function(module, exports) {
  17329. // removed by extract-text-webpack-plugin
  17330. /***/ },
  17331. /* 121 */
  17332. 120,
  17333. /* 122 */
  17334. 120,
  17335. /* 123 */
  17336. /***/ function(module, exports, __webpack_require__) {
  17337. var __vue_exports__, __vue_options__
  17338. /* styles */
  17339. __webpack_require__(307)
  17340. /* script */
  17341. __vue_exports__ = __webpack_require__(149)
  17342. /* template */
  17343. var __vue_template__ = __webpack_require__(298)
  17344. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  17345. if (
  17346. typeof __vue_exports__.default === "object" ||
  17347. typeof __vue_exports__.default === "function"
  17348. ) {
  17349. __vue_options__ = __vue_exports__ = __vue_exports__.default
  17350. }
  17351. if (typeof __vue_options__ === "function") {
  17352. __vue_options__ = __vue_options__.options
  17353. }
  17354. __vue_options__.render = __vue_template__.render
  17355. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  17356. module.exports = __vue_exports__
  17357. /***/ },
  17358. /* 124 */
  17359. /***/ function(module, exports, __webpack_require__) {
  17360. var asn1 = __webpack_require__(33);
  17361. var inherits = __webpack_require__(1);
  17362. var api = exports;
  17363. api.define = function define(name, body) {
  17364. return new Entity(name, body);
  17365. };
  17366. function Entity(name, body) {
  17367. this.name = name;
  17368. this.body = body;
  17369. this.decoders = {};
  17370. this.encoders = {};
  17371. };
  17372. Entity.prototype._createNamed = function createNamed(base) {
  17373. var named;
  17374. try {
  17375. named = __webpack_require__(283).runInThisContext(
  17376. '(function ' + this.name + '(entity) {\n' +
  17377. ' this._initNamed(entity);\n' +
  17378. '})'
  17379. );
  17380. } catch (e) {
  17381. named = function (entity) {
  17382. this._initNamed(entity);
  17383. };
  17384. }
  17385. inherits(named, base);
  17386. named.prototype._initNamed = function initnamed(entity) {
  17387. base.call(this, entity);
  17388. };
  17389. return new named(this);
  17390. };
  17391. Entity.prototype._getDecoder = function _getDecoder(enc) {
  17392. enc = enc || 'der';
  17393. // Lazily create decoder
  17394. if (!this.decoders.hasOwnProperty(enc))
  17395. this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
  17396. return this.decoders[enc];
  17397. };
  17398. Entity.prototype.decode = function decode(data, enc, options) {
  17399. return this._getDecoder(enc).decode(data, options);
  17400. };
  17401. Entity.prototype._getEncoder = function _getEncoder(enc) {
  17402. enc = enc || 'der';
  17403. // Lazily create encoder
  17404. if (!this.encoders.hasOwnProperty(enc))
  17405. this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
  17406. return this.encoders[enc];
  17407. };
  17408. Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
  17409. return this._getEncoder(enc).encode(data, reporter);
  17410. };
  17411. /***/ },
  17412. /* 125 */
  17413. /***/ function(module, exports, __webpack_require__) {
  17414. var Reporter = __webpack_require__(21).Reporter;
  17415. var EncoderBuffer = __webpack_require__(21).EncoderBuffer;
  17416. var DecoderBuffer = __webpack_require__(21).DecoderBuffer;
  17417. var assert = __webpack_require__(30);
  17418. // Supported tags
  17419. var tags = [
  17420. 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
  17421. 'gentime', 'utctime', 'null_', 'enum', 'int',
  17422. 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
  17423. 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
  17424. ];
  17425. // Public methods list
  17426. var methods = [
  17427. 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
  17428. 'any', 'contains'
  17429. ].concat(tags);
  17430. // Overrided methods list
  17431. var overrided = [
  17432. '_peekTag', '_decodeTag', '_use',
  17433. '_decodeStr', '_decodeObjid', '_decodeTime',
  17434. '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
  17435. '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
  17436. '_encodeNull', '_encodeInt', '_encodeBool'
  17437. ];
  17438. function Node(enc, parent) {
  17439. var state = {};
  17440. this._baseState = state;
  17441. state.enc = enc;
  17442. state.parent = parent || null;
  17443. state.children = null;
  17444. // State
  17445. state.tag = null;
  17446. state.args = null;
  17447. state.reverseArgs = null;
  17448. state.choice = null;
  17449. state.optional = false;
  17450. state.any = false;
  17451. state.obj = false;
  17452. state.use = null;
  17453. state.useDecoder = null;
  17454. state.key = null;
  17455. state['default'] = null;
  17456. state.explicit = null;
  17457. state.implicit = null;
  17458. state.contains = null;
  17459. // Should create new instance on each method
  17460. if (!state.parent) {
  17461. state.children = [];
  17462. this._wrap();
  17463. }
  17464. }
  17465. module.exports = Node;
  17466. var stateProps = [
  17467. 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
  17468. 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
  17469. 'implicit', 'contains'
  17470. ];
  17471. Node.prototype.clone = function clone() {
  17472. var state = this._baseState;
  17473. var cstate = {};
  17474. stateProps.forEach(function(prop) {
  17475. cstate[prop] = state[prop];
  17476. });
  17477. var res = new this.constructor(cstate.parent);
  17478. res._baseState = cstate;
  17479. return res;
  17480. };
  17481. Node.prototype._wrap = function wrap() {
  17482. var state = this._baseState;
  17483. methods.forEach(function(method) {
  17484. this[method] = function _wrappedMethod() {
  17485. var clone = new this.constructor(this);
  17486. state.children.push(clone);
  17487. return clone[method].apply(clone, arguments);
  17488. };
  17489. }, this);
  17490. };
  17491. Node.prototype._init = function init(body) {
  17492. var state = this._baseState;
  17493. assert(state.parent === null);
  17494. body.call(this);
  17495. // Filter children
  17496. state.children = state.children.filter(function(child) {
  17497. return child._baseState.parent === this;
  17498. }, this);
  17499. assert.equal(state.children.length, 1, 'Root node can have only one child');
  17500. };
  17501. Node.prototype._useArgs = function useArgs(args) {
  17502. var state = this._baseState;
  17503. // Filter children and args
  17504. var children = args.filter(function(arg) {
  17505. return arg instanceof this.constructor;
  17506. }, this);
  17507. args = args.filter(function(arg) {
  17508. return !(arg instanceof this.constructor);
  17509. }, this);
  17510. if (children.length !== 0) {
  17511. assert(state.children === null);
  17512. state.children = children;
  17513. // Replace parent to maintain backward link
  17514. children.forEach(function(child) {
  17515. child._baseState.parent = this;
  17516. }, this);
  17517. }
  17518. if (args.length !== 0) {
  17519. assert(state.args === null);
  17520. state.args = args;
  17521. state.reverseArgs = args.map(function(arg) {
  17522. if (typeof arg !== 'object' || arg.constructor !== Object)
  17523. return arg;
  17524. var res = {};
  17525. Object.keys(arg).forEach(function(key) {
  17526. if (key == (key | 0))
  17527. key |= 0;
  17528. var value = arg[key];
  17529. res[value] = key;
  17530. });
  17531. return res;
  17532. });
  17533. }
  17534. };
  17535. //
  17536. // Overrided methods
  17537. //
  17538. overrided.forEach(function(method) {
  17539. Node.prototype[method] = function _overrided() {
  17540. var state = this._baseState;
  17541. throw new Error(method + ' not implemented for encoding: ' + state.enc);
  17542. };
  17543. });
  17544. //
  17545. // Public methods
  17546. //
  17547. tags.forEach(function(tag) {
  17548. Node.prototype[tag] = function _tagMethod() {
  17549. var state = this._baseState;
  17550. var args = Array.prototype.slice.call(arguments);
  17551. assert(state.tag === null);
  17552. state.tag = tag;
  17553. this._useArgs(args);
  17554. return this;
  17555. };
  17556. });
  17557. Node.prototype.use = function use(item) {
  17558. var state = this._baseState;
  17559. assert(state.use === null);
  17560. state.use = item;
  17561. return this;
  17562. };
  17563. Node.prototype.optional = function optional() {
  17564. var state = this._baseState;
  17565. state.optional = true;
  17566. return this;
  17567. };
  17568. Node.prototype.def = function def(val) {
  17569. var state = this._baseState;
  17570. assert(state['default'] === null);
  17571. state['default'] = val;
  17572. state.optional = true;
  17573. return this;
  17574. };
  17575. Node.prototype.explicit = function explicit(num) {
  17576. var state = this._baseState;
  17577. assert(state.explicit === null && state.implicit === null);
  17578. state.explicit = num;
  17579. return this;
  17580. };
  17581. Node.prototype.implicit = function implicit(num) {
  17582. var state = this._baseState;
  17583. assert(state.explicit === null && state.implicit === null);
  17584. state.implicit = num;
  17585. return this;
  17586. };
  17587. Node.prototype.obj = function obj() {
  17588. var state = this._baseState;
  17589. var args = Array.prototype.slice.call(arguments);
  17590. state.obj = true;
  17591. if (args.length !== 0)
  17592. this._useArgs(args);
  17593. return this;
  17594. };
  17595. Node.prototype.key = function key(newKey) {
  17596. var state = this._baseState;
  17597. assert(state.key === null);
  17598. state.key = newKey;
  17599. return this;
  17600. };
  17601. Node.prototype.any = function any() {
  17602. var state = this._baseState;
  17603. state.any = true;
  17604. return this;
  17605. };
  17606. Node.prototype.choice = function choice(obj) {
  17607. var state = this._baseState;
  17608. assert(state.choice === null);
  17609. state.choice = obj;
  17610. this._useArgs(Object.keys(obj).map(function(key) {
  17611. return obj[key];
  17612. }));
  17613. return this;
  17614. };
  17615. Node.prototype.contains = function contains(item) {
  17616. var state = this._baseState;
  17617. assert(state.use === null);
  17618. state.contains = item;
  17619. return this;
  17620. };
  17621. //
  17622. // Decoding
  17623. //
  17624. Node.prototype._decode = function decode(input, options) {
  17625. var state = this._baseState;
  17626. // Decode root node
  17627. if (state.parent === null)
  17628. return input.wrapResult(state.children[0]._decode(input, options));
  17629. var result = state['default'];
  17630. var present = true;
  17631. var prevKey = null;
  17632. if (state.key !== null)
  17633. prevKey = input.enterKey(state.key);
  17634. // Check if tag is there
  17635. if (state.optional) {
  17636. var tag = null;
  17637. if (state.explicit !== null)
  17638. tag = state.explicit;
  17639. else if (state.implicit !== null)
  17640. tag = state.implicit;
  17641. else if (state.tag !== null)
  17642. tag = state.tag;
  17643. if (tag === null && !state.any) {
  17644. // Trial and Error
  17645. var save = input.save();
  17646. try {
  17647. if (state.choice === null)
  17648. this._decodeGeneric(state.tag, input, options);
  17649. else
  17650. this._decodeChoice(input, options);
  17651. present = true;
  17652. } catch (e) {
  17653. present = false;
  17654. }
  17655. input.restore(save);
  17656. } else {
  17657. present = this._peekTag(input, tag, state.any);
  17658. if (input.isError(present))
  17659. return present;
  17660. }
  17661. }
  17662. // Push object on stack
  17663. var prevObj;
  17664. if (state.obj && present)
  17665. prevObj = input.enterObject();
  17666. if (present) {
  17667. // Unwrap explicit values
  17668. if (state.explicit !== null) {
  17669. var explicit = this._decodeTag(input, state.explicit);
  17670. if (input.isError(explicit))
  17671. return explicit;
  17672. input = explicit;
  17673. }
  17674. var start = input.offset;
  17675. // Unwrap implicit and normal values
  17676. if (state.use === null && state.choice === null) {
  17677. if (state.any)
  17678. var save = input.save();
  17679. var body = this._decodeTag(
  17680. input,
  17681. state.implicit !== null ? state.implicit : state.tag,
  17682. state.any
  17683. );
  17684. if (input.isError(body))
  17685. return body;
  17686. if (state.any)
  17687. result = input.raw(save);
  17688. else
  17689. input = body;
  17690. }
  17691. if (options && options.track && state.tag !== null)
  17692. options.track(input.path(), start, input.length, 'tagged');
  17693. if (options && options.track && state.tag !== null)
  17694. options.track(input.path(), input.offset, input.length, 'content');
  17695. // Select proper method for tag
  17696. if (state.any)
  17697. result = result;
  17698. else if (state.choice === null)
  17699. result = this._decodeGeneric(state.tag, input, options);
  17700. else
  17701. result = this._decodeChoice(input, options);
  17702. if (input.isError(result))
  17703. return result;
  17704. // Decode children
  17705. if (!state.any && state.choice === null && state.children !== null) {
  17706. state.children.forEach(function decodeChildren(child) {
  17707. // NOTE: We are ignoring errors here, to let parser continue with other
  17708. // parts of encoded data
  17709. child._decode(input, options);
  17710. });
  17711. }
  17712. // Decode contained/encoded by schema, only in bit or octet strings
  17713. if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
  17714. var data = new DecoderBuffer(result);
  17715. result = this._getUse(state.contains, input._reporterState.obj)
  17716. ._decode(data, options);
  17717. }
  17718. }
  17719. // Pop object
  17720. if (state.obj && present)
  17721. result = input.leaveObject(prevObj);
  17722. // Set key
  17723. if (state.key !== null && (result !== null || present === true))
  17724. input.leaveKey(prevKey, state.key, result);
  17725. else if (prevKey !== null)
  17726. input.exitKey(prevKey);
  17727. return result;
  17728. };
  17729. Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
  17730. var state = this._baseState;
  17731. if (tag === 'seq' || tag === 'set')
  17732. return null;
  17733. if (tag === 'seqof' || tag === 'setof')
  17734. return this._decodeList(input, tag, state.args[0], options);
  17735. else if (/str$/.test(tag))
  17736. return this._decodeStr(input, tag, options);
  17737. else if (tag === 'objid' && state.args)
  17738. return this._decodeObjid(input, state.args[0], state.args[1], options);
  17739. else if (tag === 'objid')
  17740. return this._decodeObjid(input, null, null, options);
  17741. else if (tag === 'gentime' || tag === 'utctime')
  17742. return this._decodeTime(input, tag, options);
  17743. else if (tag === 'null_')
  17744. return this._decodeNull(input, options);
  17745. else if (tag === 'bool')
  17746. return this._decodeBool(input, options);
  17747. else if (tag === 'int' || tag === 'enum')
  17748. return this._decodeInt(input, state.args && state.args[0], options);
  17749. if (state.use !== null) {
  17750. return this._getUse(state.use, input._reporterState.obj)
  17751. ._decode(input, options);
  17752. } else {
  17753. return input.error('unknown tag: ' + tag);
  17754. }
  17755. };
  17756. Node.prototype._getUse = function _getUse(entity, obj) {
  17757. var state = this._baseState;
  17758. // Create altered use decoder if implicit is set
  17759. state.useDecoder = this._use(entity, obj);
  17760. assert(state.useDecoder._baseState.parent === null);
  17761. state.useDecoder = state.useDecoder._baseState.children[0];
  17762. if (state.implicit !== state.useDecoder._baseState.implicit) {
  17763. state.useDecoder = state.useDecoder.clone();
  17764. state.useDecoder._baseState.implicit = state.implicit;
  17765. }
  17766. return state.useDecoder;
  17767. };
  17768. Node.prototype._decodeChoice = function decodeChoice(input, options) {
  17769. var state = this._baseState;
  17770. var result = null;
  17771. var match = false;
  17772. Object.keys(state.choice).some(function(key) {
  17773. var save = input.save();
  17774. var node = state.choice[key];
  17775. try {
  17776. var value = node._decode(input, options);
  17777. if (input.isError(value))
  17778. return false;
  17779. result = { type: key, value: value };
  17780. match = true;
  17781. } catch (e) {
  17782. input.restore(save);
  17783. return false;
  17784. }
  17785. return true;
  17786. }, this);
  17787. if (!match)
  17788. return input.error('Choice not matched');
  17789. return result;
  17790. };
  17791. //
  17792. // Encoding
  17793. //
  17794. Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
  17795. return new EncoderBuffer(data, this.reporter);
  17796. };
  17797. Node.prototype._encode = function encode(data, reporter, parent) {
  17798. var state = this._baseState;
  17799. if (state['default'] !== null && state['default'] === data)
  17800. return;
  17801. var result = this._encodeValue(data, reporter, parent);
  17802. if (result === undefined)
  17803. return;
  17804. if (this._skipDefault(result, reporter, parent))
  17805. return;
  17806. return result;
  17807. };
  17808. Node.prototype._encodeValue = function encode(data, reporter, parent) {
  17809. var state = this._baseState;
  17810. // Decode root node
  17811. if (state.parent === null)
  17812. return state.children[0]._encode(data, reporter || new Reporter());
  17813. var result = null;
  17814. // Set reporter to share it with a child class
  17815. this.reporter = reporter;
  17816. // Check if data is there
  17817. if (state.optional && data === undefined) {
  17818. if (state['default'] !== null)
  17819. data = state['default']
  17820. else
  17821. return;
  17822. }
  17823. // Encode children first
  17824. var content = null;
  17825. var primitive = false;
  17826. if (state.any) {
  17827. // Anything that was given is translated to buffer
  17828. result = this._createEncoderBuffer(data);
  17829. } else if (state.choice) {
  17830. result = this._encodeChoice(data, reporter);
  17831. } else if (state.contains) {
  17832. content = this._getUse(state.contains, parent)._encode(data, reporter);
  17833. primitive = true;
  17834. } else if (state.children) {
  17835. content = state.children.map(function(child) {
  17836. if (child._baseState.tag === 'null_')
  17837. return child._encode(null, reporter, data);
  17838. if (child._baseState.key === null)
  17839. return reporter.error('Child should have a key');
  17840. var prevKey = reporter.enterKey(child._baseState.key);
  17841. if (typeof data !== 'object')
  17842. return reporter.error('Child expected, but input is not object');
  17843. var res = child._encode(data[child._baseState.key], reporter, data);
  17844. reporter.leaveKey(prevKey);
  17845. return res;
  17846. }, this).filter(function(child) {
  17847. return child;
  17848. });
  17849. content = this._createEncoderBuffer(content);
  17850. } else {
  17851. if (state.tag === 'seqof' || state.tag === 'setof') {
  17852. // TODO(indutny): this should be thrown on DSL level
  17853. if (!(state.args && state.args.length === 1))
  17854. return reporter.error('Too many args for : ' + state.tag);
  17855. if (!Array.isArray(data))
  17856. return reporter.error('seqof/setof, but data is not Array');
  17857. var child = this.clone();
  17858. child._baseState.implicit = null;
  17859. content = this._createEncoderBuffer(data.map(function(item) {
  17860. var state = this._baseState;
  17861. return this._getUse(state.args[0], data)._encode(item, reporter);
  17862. }, child));
  17863. } else if (state.use !== null) {
  17864. result = this._getUse(state.use, parent)._encode(data, reporter);
  17865. } else {
  17866. content = this._encodePrimitive(state.tag, data);
  17867. primitive = true;
  17868. }
  17869. }
  17870. // Encode data itself
  17871. var result;
  17872. if (!state.any && state.choice === null) {
  17873. var tag = state.implicit !== null ? state.implicit : state.tag;
  17874. var cls = state.implicit === null ? 'universal' : 'context';
  17875. if (tag === null) {
  17876. if (state.use === null)
  17877. reporter.error('Tag could be ommited only for .use()');
  17878. } else {
  17879. if (state.use === null)
  17880. result = this._encodeComposite(tag, primitive, cls, content);
  17881. }
  17882. }
  17883. // Wrap in explicit
  17884. if (state.explicit !== null)
  17885. result = this._encodeComposite(state.explicit, false, 'context', result);
  17886. return result;
  17887. };
  17888. Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
  17889. var state = this._baseState;
  17890. var node = state.choice[data.type];
  17891. if (!node) {
  17892. assert(
  17893. false,
  17894. data.type + ' not found in ' +
  17895. JSON.stringify(Object.keys(state.choice)));
  17896. }
  17897. return node._encode(data.value, reporter);
  17898. };
  17899. Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
  17900. var state = this._baseState;
  17901. if (/str$/.test(tag))
  17902. return this._encodeStr(data, tag);
  17903. else if (tag === 'objid' && state.args)
  17904. return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
  17905. else if (tag === 'objid')
  17906. return this._encodeObjid(data, null, null);
  17907. else if (tag === 'gentime' || tag === 'utctime')
  17908. return this._encodeTime(data, tag);
  17909. else if (tag === 'null_')
  17910. return this._encodeNull();
  17911. else if (tag === 'int' || tag === 'enum')
  17912. return this._encodeInt(data, state.args && state.reverseArgs[0]);
  17913. else if (tag === 'bool')
  17914. return this._encodeBool(data);
  17915. else
  17916. throw new Error('Unsupported tag: ' + tag);
  17917. };
  17918. Node.prototype._isNumstr = function isNumstr(str) {
  17919. return /^[0-9 ]*$/.test(str);
  17920. };
  17921. Node.prototype._isPrintstr = function isPrintstr(str) {
  17922. return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
  17923. };
  17924. /***/ },
  17925. /* 126 */
  17926. /***/ function(module, exports, __webpack_require__) {
  17927. var inherits = __webpack_require__(1);
  17928. function Reporter(options) {
  17929. this._reporterState = {
  17930. obj: null,
  17931. path: [],
  17932. options: options || {},
  17933. errors: []
  17934. };
  17935. }
  17936. exports.Reporter = Reporter;
  17937. Reporter.prototype.isError = function isError(obj) {
  17938. return obj instanceof ReporterError;
  17939. };
  17940. Reporter.prototype.save = function save() {
  17941. var state = this._reporterState;
  17942. return { obj: state.obj, pathLen: state.path.length };
  17943. };
  17944. Reporter.prototype.restore = function restore(data) {
  17945. var state = this._reporterState;
  17946. state.obj = data.obj;
  17947. state.path = state.path.slice(0, data.pathLen);
  17948. };
  17949. Reporter.prototype.enterKey = function enterKey(key) {
  17950. return this._reporterState.path.push(key);
  17951. };
  17952. Reporter.prototype.exitKey = function exitKey(index) {
  17953. var state = this._reporterState;
  17954. state.path = state.path.slice(0, index - 1);
  17955. };
  17956. Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
  17957. var state = this._reporterState;
  17958. this.exitKey(index);
  17959. if (state.obj !== null)
  17960. state.obj[key] = value;
  17961. };
  17962. Reporter.prototype.path = function path() {
  17963. return this._reporterState.path.join('/');
  17964. };
  17965. Reporter.prototype.enterObject = function enterObject() {
  17966. var state = this._reporterState;
  17967. var prev = state.obj;
  17968. state.obj = {};
  17969. return prev;
  17970. };
  17971. Reporter.prototype.leaveObject = function leaveObject(prev) {
  17972. var state = this._reporterState;
  17973. var now = state.obj;
  17974. state.obj = prev;
  17975. return now;
  17976. };
  17977. Reporter.prototype.error = function error(msg) {
  17978. var err;
  17979. var state = this._reporterState;
  17980. var inherited = msg instanceof ReporterError;
  17981. if (inherited) {
  17982. err = msg;
  17983. } else {
  17984. err = new ReporterError(state.path.map(function(elem) {
  17985. return '[' + JSON.stringify(elem) + ']';
  17986. }).join(''), msg.message || msg, msg.stack);
  17987. }
  17988. if (!state.options.partial)
  17989. throw err;
  17990. if (!inherited)
  17991. state.errors.push(err);
  17992. return err;
  17993. };
  17994. Reporter.prototype.wrapResult = function wrapResult(result) {
  17995. var state = this._reporterState;
  17996. if (!state.options.partial)
  17997. return result;
  17998. return {
  17999. result: this.isError(result) ? null : result,
  18000. errors: state.errors
  18001. };
  18002. };
  18003. function ReporterError(path, msg) {
  18004. this.path = path;
  18005. this.rethrow(msg);
  18006. };
  18007. inherits(ReporterError, Error);
  18008. ReporterError.prototype.rethrow = function rethrow(msg) {
  18009. this.message = msg + ' at: ' + (this.path || '(shallow)');
  18010. if (Error.captureStackTrace)
  18011. Error.captureStackTrace(this, ReporterError);
  18012. if (!this.stack) {
  18013. try {
  18014. // IE only adds stack when thrown
  18015. throw new Error(this.message);
  18016. } catch (e) {
  18017. this.stack = e.stack;
  18018. }
  18019. }
  18020. return this;
  18021. };
  18022. /***/ },
  18023. /* 127 */
  18024. /***/ function(module, exports, __webpack_require__) {
  18025. var constants = __webpack_require__(68);
  18026. exports.tagClass = {
  18027. 0: 'universal',
  18028. 1: 'application',
  18029. 2: 'context',
  18030. 3: 'private'
  18031. };
  18032. exports.tagClassByName = constants._reverse(exports.tagClass);
  18033. exports.tag = {
  18034. 0x00: 'end',
  18035. 0x01: 'bool',
  18036. 0x02: 'int',
  18037. 0x03: 'bitstr',
  18038. 0x04: 'octstr',
  18039. 0x05: 'null_',
  18040. 0x06: 'objid',
  18041. 0x07: 'objDesc',
  18042. 0x08: 'external',
  18043. 0x09: 'real',
  18044. 0x0a: 'enum',
  18045. 0x0b: 'embed',
  18046. 0x0c: 'utf8str',
  18047. 0x0d: 'relativeOid',
  18048. 0x10: 'seq',
  18049. 0x11: 'set',
  18050. 0x12: 'numstr',
  18051. 0x13: 'printstr',
  18052. 0x14: 't61str',
  18053. 0x15: 'videostr',
  18054. 0x16: 'ia5str',
  18055. 0x17: 'utctime',
  18056. 0x18: 'gentime',
  18057. 0x19: 'graphstr',
  18058. 0x1a: 'iso646str',
  18059. 0x1b: 'genstr',
  18060. 0x1c: 'unistr',
  18061. 0x1d: 'charstr',
  18062. 0x1e: 'bmpstr'
  18063. };
  18064. exports.tagByName = constants._reverse(exports.tag);
  18065. /***/ },
  18066. /* 128 */
  18067. /***/ function(module, exports, __webpack_require__) {
  18068. var decoders = exports;
  18069. decoders.der = __webpack_require__(69);
  18070. decoders.pem = __webpack_require__(129);
  18071. /***/ },
  18072. /* 129 */
  18073. /***/ function(module, exports, __webpack_require__) {
  18074. var inherits = __webpack_require__(1);
  18075. var Buffer = __webpack_require__(0).Buffer;
  18076. var DERDecoder = __webpack_require__(69);
  18077. function PEMDecoder(entity) {
  18078. DERDecoder.call(this, entity);
  18079. this.enc = 'pem';
  18080. };
  18081. inherits(PEMDecoder, DERDecoder);
  18082. module.exports = PEMDecoder;
  18083. PEMDecoder.prototype.decode = function decode(data, options) {
  18084. var lines = data.toString().split(/[\r\n]+/g);
  18085. var label = options.label.toUpperCase();
  18086. var re = /^-----(BEGIN|END) ([^-]+)-----$/;
  18087. var start = -1;
  18088. var end = -1;
  18089. for (var i = 0; i < lines.length; i++) {
  18090. var match = lines[i].match(re);
  18091. if (match === null)
  18092. continue;
  18093. if (match[2] !== label)
  18094. continue;
  18095. if (start === -1) {
  18096. if (match[1] !== 'BEGIN')
  18097. break;
  18098. start = i;
  18099. } else {
  18100. if (match[1] !== 'END')
  18101. break;
  18102. end = i;
  18103. break;
  18104. }
  18105. }
  18106. if (start === -1 || end === -1)
  18107. throw new Error('PEM section not found for: ' + label);
  18108. var base64 = lines.slice(start + 1, end).join('');
  18109. // Remove excessive symbols
  18110. base64.replace(/[^a-z0-9\+\/=]+/gi, '');
  18111. var input = new Buffer(base64, 'base64');
  18112. return DERDecoder.prototype.decode.call(this, input, options);
  18113. };
  18114. /***/ },
  18115. /* 130 */
  18116. /***/ function(module, exports, __webpack_require__) {
  18117. var encoders = exports;
  18118. encoders.der = __webpack_require__(70);
  18119. encoders.pem = __webpack_require__(131);
  18120. /***/ },
  18121. /* 131 */
  18122. /***/ function(module, exports, __webpack_require__) {
  18123. var inherits = __webpack_require__(1);
  18124. var DEREncoder = __webpack_require__(70);
  18125. function PEMEncoder(entity) {
  18126. DEREncoder.call(this, entity);
  18127. this.enc = 'pem';
  18128. };
  18129. inherits(PEMEncoder, DEREncoder);
  18130. module.exports = PEMEncoder;
  18131. PEMEncoder.prototype.encode = function encode(data, options) {
  18132. var buf = DEREncoder.prototype.encode.call(this, data);
  18133. var p = buf.toString('base64');
  18134. var out = [ '-----BEGIN ' + options.label + '-----' ];
  18135. for (var i = 0; i < p.length; i += 64)
  18136. out.push(p.slice(i, i + 64));
  18137. out.push('-----END ' + options.label + '-----');
  18138. return out.join('\n');
  18139. };
  18140. /***/ },
  18141. /* 132 */
  18142. /***/ function(module, exports, __webpack_require__) {
  18143. "use strict";
  18144. 'use strict';
  18145. var utils = __webpack_require__(4);
  18146. var bind = __webpack_require__(77);
  18147. var Axios = __webpack_require__(134);
  18148. /**
  18149. * Create an instance of Axios
  18150. *
  18151. * @param {Object} defaultConfig The default config for the instance
  18152. * @return {Axios} A new instance of Axios
  18153. */
  18154. function createInstance(defaultConfig) {
  18155. var context = new Axios(defaultConfig);
  18156. var instance = bind(Axios.prototype.request, context);
  18157. // Copy axios.prototype to instance
  18158. utils.extend(instance, Axios.prototype, context);
  18159. // Copy context to instance
  18160. utils.extend(instance, context);
  18161. return instance;
  18162. }
  18163. // Create the default instance to be exported
  18164. var axios = createInstance();
  18165. // Expose Axios class to allow class inheritance
  18166. axios.Axios = Axios;
  18167. // Factory for creating new instances
  18168. axios.create = function create(defaultConfig) {
  18169. return createInstance(defaultConfig);
  18170. };
  18171. // Expose Cancel & CancelToken
  18172. axios.Cancel = __webpack_require__(73);
  18173. axios.CancelToken = __webpack_require__(133);
  18174. axios.isCancel = __webpack_require__(74);
  18175. // Expose all/spread
  18176. axios.all = function all(promises) {
  18177. return Promise.all(promises);
  18178. };
  18179. axios.spread = __webpack_require__(148);
  18180. module.exports = axios;
  18181. // Allow use of default import syntax in TypeScript
  18182. module.exports.default = axios;
  18183. /***/ },
  18184. /* 133 */
  18185. /***/ function(module, exports, __webpack_require__) {
  18186. "use strict";
  18187. 'use strict';
  18188. var Cancel = __webpack_require__(73);
  18189. /**
  18190. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  18191. *
  18192. * @class
  18193. * @param {Function} executor The executor function.
  18194. */
  18195. function CancelToken(executor) {
  18196. if (typeof executor !== 'function') {
  18197. throw new TypeError('executor must be a function.');
  18198. }
  18199. var resolvePromise;
  18200. this.promise = new Promise(function promiseExecutor(resolve) {
  18201. resolvePromise = resolve;
  18202. });
  18203. var token = this;
  18204. executor(function cancel(message) {
  18205. if (token.reason) {
  18206. // Cancellation has already been requested
  18207. return;
  18208. }
  18209. token.reason = new Cancel(message);
  18210. resolvePromise(token.reason);
  18211. });
  18212. }
  18213. /**
  18214. * Throws a `Cancel` if cancellation has been requested.
  18215. */
  18216. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  18217. if (this.reason) {
  18218. throw this.reason;
  18219. }
  18220. };
  18221. /**
  18222. * Returns an object that contains a new `CancelToken` and a function that, when called,
  18223. * cancels the `CancelToken`.
  18224. */
  18225. CancelToken.source = function source() {
  18226. var cancel;
  18227. var token = new CancelToken(function executor(c) {
  18228. cancel = c;
  18229. });
  18230. return {
  18231. token: token,
  18232. cancel: cancel
  18233. };
  18234. };
  18235. module.exports = CancelToken;
  18236. /***/ },
  18237. /* 134 */
  18238. /***/ function(module, exports, __webpack_require__) {
  18239. "use strict";
  18240. 'use strict';
  18241. var defaults = __webpack_require__(76);
  18242. var utils = __webpack_require__(4);
  18243. var InterceptorManager = __webpack_require__(135);
  18244. var dispatchRequest = __webpack_require__(136);
  18245. var isAbsoluteURL = __webpack_require__(144);
  18246. var combineURLs = __webpack_require__(142);
  18247. /**
  18248. * Create a new instance of Axios
  18249. *
  18250. * @param {Object} defaultConfig The default config for the instance
  18251. */
  18252. function Axios(defaultConfig) {
  18253. this.defaults = utils.merge(defaults, defaultConfig);
  18254. this.interceptors = {
  18255. request: new InterceptorManager(),
  18256. response: new InterceptorManager()
  18257. };
  18258. }
  18259. /**
  18260. * Dispatch a request
  18261. *
  18262. * @param {Object} config The config specific for this request (merged with this.defaults)
  18263. */
  18264. Axios.prototype.request = function request(config) {
  18265. /*eslint no-param-reassign:0*/
  18266. // Allow for axios('example/url'[, config]) a la fetch API
  18267. if (typeof config === 'string') {
  18268. config = utils.merge({
  18269. url: arguments[0]
  18270. }, arguments[1]);
  18271. }
  18272. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  18273. // Support baseURL config
  18274. if (config.baseURL && !isAbsoluteURL(config.url)) {
  18275. config.url = combineURLs(config.baseURL, config.url);
  18276. }
  18277. // Hook up interceptors middleware
  18278. var chain = [dispatchRequest, undefined];
  18279. var promise = Promise.resolve(config);
  18280. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  18281. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  18282. });
  18283. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  18284. chain.push(interceptor.fulfilled, interceptor.rejected);
  18285. });
  18286. while (chain.length) {
  18287. promise = promise.then(chain.shift(), chain.shift());
  18288. }
  18289. return promise;
  18290. };
  18291. // Provide aliases for supported request methods
  18292. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  18293. /*eslint func-names:0*/
  18294. Axios.prototype[method] = function(url, config) {
  18295. return this.request(utils.merge(config || {}, {
  18296. method: method,
  18297. url: url
  18298. }));
  18299. };
  18300. });
  18301. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  18302. /*eslint func-names:0*/
  18303. Axios.prototype[method] = function(url, data, config) {
  18304. return this.request(utils.merge(config || {}, {
  18305. method: method,
  18306. url: url,
  18307. data: data
  18308. }));
  18309. };
  18310. });
  18311. module.exports = Axios;
  18312. /***/ },
  18313. /* 135 */
  18314. /***/ function(module, exports, __webpack_require__) {
  18315. "use strict";
  18316. 'use strict';
  18317. var utils = __webpack_require__(4);
  18318. function InterceptorManager() {
  18319. this.handlers = [];
  18320. }
  18321. /**
  18322. * Add a new interceptor to the stack
  18323. *
  18324. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  18325. * @param {Function} rejected The function to handle `reject` for a `Promise`
  18326. *
  18327. * @return {Number} An ID used to remove interceptor later
  18328. */
  18329. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  18330. this.handlers.push({
  18331. fulfilled: fulfilled,
  18332. rejected: rejected
  18333. });
  18334. return this.handlers.length - 1;
  18335. };
  18336. /**
  18337. * Remove an interceptor from the stack
  18338. *
  18339. * @param {Number} id The ID that was returned by `use`
  18340. */
  18341. InterceptorManager.prototype.eject = function eject(id) {
  18342. if (this.handlers[id]) {
  18343. this.handlers[id] = null;
  18344. }
  18345. };
  18346. /**
  18347. * Iterate over all the registered interceptors
  18348. *
  18349. * This method is particularly useful for skipping over any
  18350. * interceptors that may have become `null` calling `eject`.
  18351. *
  18352. * @param {Function} fn The function to call for each interceptor
  18353. */
  18354. InterceptorManager.prototype.forEach = function forEach(fn) {
  18355. utils.forEach(this.handlers, function forEachHandler(h) {
  18356. if (h !== null) {
  18357. fn(h);
  18358. }
  18359. });
  18360. };
  18361. module.exports = InterceptorManager;
  18362. /***/ },
  18363. /* 136 */
  18364. /***/ function(module, exports, __webpack_require__) {
  18365. "use strict";
  18366. 'use strict';
  18367. var utils = __webpack_require__(4);
  18368. var transformData = __webpack_require__(139);
  18369. var isCancel = __webpack_require__(74);
  18370. var defaults = __webpack_require__(76);
  18371. /**
  18372. * Throws a `Cancel` if cancellation has been requested.
  18373. */
  18374. function throwIfCancellationRequested(config) {
  18375. if (config.cancelToken) {
  18376. config.cancelToken.throwIfRequested();
  18377. }
  18378. }
  18379. /**
  18380. * Dispatch a request to the server using the configured adapter.
  18381. *
  18382. * @param {object} config The config that is to be used for the request
  18383. * @returns {Promise} The Promise to be fulfilled
  18384. */
  18385. module.exports = function dispatchRequest(config) {
  18386. throwIfCancellationRequested(config);
  18387. // Ensure headers exist
  18388. config.headers = config.headers || {};
  18389. // Transform request data
  18390. config.data = transformData(
  18391. config.data,
  18392. config.headers,
  18393. config.transformRequest
  18394. );
  18395. // Flatten headers
  18396. config.headers = utils.merge(
  18397. config.headers.common || {},
  18398. config.headers[config.method] || {},
  18399. config.headers || {}
  18400. );
  18401. utils.forEach(
  18402. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  18403. function cleanHeaderConfig(method) {
  18404. delete config.headers[method];
  18405. }
  18406. );
  18407. var adapter = config.adapter || defaults.adapter;
  18408. return adapter(config).then(function onAdapterResolution(response) {
  18409. throwIfCancellationRequested(config);
  18410. // Transform response data
  18411. response.data = transformData(
  18412. response.data,
  18413. response.headers,
  18414. config.transformResponse
  18415. );
  18416. return response;
  18417. }, function onAdapterRejection(reason) {
  18418. if (!isCancel(reason)) {
  18419. throwIfCancellationRequested(config);
  18420. // Transform response data
  18421. if (reason && reason.response) {
  18422. reason.response.data = transformData(
  18423. reason.response.data,
  18424. reason.response.headers,
  18425. config.transformResponse
  18426. );
  18427. }
  18428. }
  18429. return Promise.reject(reason);
  18430. });
  18431. };
  18432. /***/ },
  18433. /* 137 */
  18434. /***/ function(module, exports) {
  18435. "use strict";
  18436. 'use strict';
  18437. /**
  18438. * Update an Error with the specified config, error code, and response.
  18439. *
  18440. * @param {Error} error The error to update.
  18441. * @param {Object} config The config.
  18442. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  18443. @ @param {Object} [response] The response.
  18444. * @returns {Error} The error.
  18445. */
  18446. module.exports = function enhanceError(error, config, code, response) {
  18447. error.config = config;
  18448. if (code) {
  18449. error.code = code;
  18450. }
  18451. error.response = response;
  18452. return error;
  18453. };
  18454. /***/ },
  18455. /* 138 */
  18456. /***/ function(module, exports, __webpack_require__) {
  18457. "use strict";
  18458. 'use strict';
  18459. var createError = __webpack_require__(75);
  18460. /**
  18461. * Resolve or reject a Promise based on response status.
  18462. *
  18463. * @param {Function} resolve A function that resolves the promise.
  18464. * @param {Function} reject A function that rejects the promise.
  18465. * @param {object} response The response.
  18466. */
  18467. module.exports = function settle(resolve, reject, response) {
  18468. var validateStatus = response.config.validateStatus;
  18469. // Note: status is not exposed by XDomainRequest
  18470. if (!response.status || !validateStatus || validateStatus(response.status)) {
  18471. resolve(response);
  18472. } else {
  18473. reject(createError(
  18474. 'Request failed with status code ' + response.status,
  18475. response.config,
  18476. null,
  18477. response
  18478. ));
  18479. }
  18480. };
  18481. /***/ },
  18482. /* 139 */
  18483. /***/ function(module, exports, __webpack_require__) {
  18484. "use strict";
  18485. 'use strict';
  18486. var utils = __webpack_require__(4);
  18487. /**
  18488. * Transform the data for a request or a response
  18489. *
  18490. * @param {Object|String} data The data to be transformed
  18491. * @param {Array} headers The headers for the request or response
  18492. * @param {Array|Function} fns A single function or Array of functions
  18493. * @returns {*} The resulting transformed data
  18494. */
  18495. module.exports = function transformData(data, headers, fns) {
  18496. /*eslint no-param-reassign:0*/
  18497. utils.forEach(fns, function transform(fn) {
  18498. data = fn(data, headers);
  18499. });
  18500. return data;
  18501. };
  18502. /***/ },
  18503. /* 140 */
  18504. /***/ function(module, exports) {
  18505. "use strict";
  18506. 'use strict';
  18507. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  18508. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  18509. function E() {
  18510. this.message = 'String contains an invalid character';
  18511. }
  18512. E.prototype = new Error;
  18513. E.prototype.code = 5;
  18514. E.prototype.name = 'InvalidCharacterError';
  18515. function btoa(input) {
  18516. var str = String(input);
  18517. var output = '';
  18518. for (
  18519. // initialize result and counter
  18520. var block, charCode, idx = 0, map = chars;
  18521. // if the next str index does not exist:
  18522. // change the mapping table to "="
  18523. // check if d has no fractional digits
  18524. str.charAt(idx | 0) || (map = '=', idx % 1);
  18525. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  18526. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  18527. ) {
  18528. charCode = str.charCodeAt(idx += 3 / 4);
  18529. if (charCode > 0xFF) {
  18530. throw new E();
  18531. }
  18532. block = block << 8 | charCode;
  18533. }
  18534. return output;
  18535. }
  18536. module.exports = btoa;
  18537. /***/ },
  18538. /* 141 */
  18539. /***/ function(module, exports, __webpack_require__) {
  18540. "use strict";
  18541. 'use strict';
  18542. var utils = __webpack_require__(4);
  18543. function encode(val) {
  18544. return encodeURIComponent(val).
  18545. replace(/%40/gi, '@').
  18546. replace(/%3A/gi, ':').
  18547. replace(/%24/g, '$').
  18548. replace(/%2C/gi, ',').
  18549. replace(/%20/g, '+').
  18550. replace(/%5B/gi, '[').
  18551. replace(/%5D/gi, ']');
  18552. }
  18553. /**
  18554. * Build a URL by appending params to the end
  18555. *
  18556. * @param {string} url The base of the url (e.g., http://www.google.com)
  18557. * @param {object} [params] The params to be appended
  18558. * @returns {string} The formatted url
  18559. */
  18560. module.exports = function buildURL(url, params, paramsSerializer) {
  18561. /*eslint no-param-reassign:0*/
  18562. if (!params) {
  18563. return url;
  18564. }
  18565. var serializedParams;
  18566. if (paramsSerializer) {
  18567. serializedParams = paramsSerializer(params);
  18568. } else if (utils.isURLSearchParams(params)) {
  18569. serializedParams = params.toString();
  18570. } else {
  18571. var parts = [];
  18572. utils.forEach(params, function serialize(val, key) {
  18573. if (val === null || typeof val === 'undefined') {
  18574. return;
  18575. }
  18576. if (utils.isArray(val)) {
  18577. key = key + '[]';
  18578. }
  18579. if (!utils.isArray(val)) {
  18580. val = [val];
  18581. }
  18582. utils.forEach(val, function parseValue(v) {
  18583. if (utils.isDate(v)) {
  18584. v = v.toISOString();
  18585. } else if (utils.isObject(v)) {
  18586. v = JSON.stringify(v);
  18587. }
  18588. parts.push(encode(key) + '=' + encode(v));
  18589. });
  18590. });
  18591. serializedParams = parts.join('&');
  18592. }
  18593. if (serializedParams) {
  18594. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  18595. }
  18596. return url;
  18597. };
  18598. /***/ },
  18599. /* 142 */
  18600. /***/ function(module, exports) {
  18601. "use strict";
  18602. 'use strict';
  18603. /**
  18604. * Creates a new URL by combining the specified URLs
  18605. *
  18606. * @param {string} baseURL The base URL
  18607. * @param {string} relativeURL The relative URL
  18608. * @returns {string} The combined URL
  18609. */
  18610. module.exports = function combineURLs(baseURL, relativeURL) {
  18611. return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  18612. };
  18613. /***/ },
  18614. /* 143 */
  18615. /***/ function(module, exports, __webpack_require__) {
  18616. "use strict";
  18617. 'use strict';
  18618. var utils = __webpack_require__(4);
  18619. module.exports = (
  18620. utils.isStandardBrowserEnv() ?
  18621. // Standard browser envs support document.cookie
  18622. (function standardBrowserEnv() {
  18623. return {
  18624. write: function write(name, value, expires, path, domain, secure) {
  18625. var cookie = [];
  18626. cookie.push(name + '=' + encodeURIComponent(value));
  18627. if (utils.isNumber(expires)) {
  18628. cookie.push('expires=' + new Date(expires).toGMTString());
  18629. }
  18630. if (utils.isString(path)) {
  18631. cookie.push('path=' + path);
  18632. }
  18633. if (utils.isString(domain)) {
  18634. cookie.push('domain=' + domain);
  18635. }
  18636. if (secure === true) {
  18637. cookie.push('secure');
  18638. }
  18639. document.cookie = cookie.join('; ');
  18640. },
  18641. read: function read(name) {
  18642. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  18643. return (match ? decodeURIComponent(match[3]) : null);
  18644. },
  18645. remove: function remove(name) {
  18646. this.write(name, '', Date.now() - 86400000);
  18647. }
  18648. };
  18649. })() :
  18650. // Non standard browser env (web workers, react-native) lack needed support.
  18651. (function nonStandardBrowserEnv() {
  18652. return {
  18653. write: function write() {},
  18654. read: function read() { return null; },
  18655. remove: function remove() {}
  18656. };
  18657. })()
  18658. );
  18659. /***/ },
  18660. /* 144 */
  18661. /***/ function(module, exports) {
  18662. "use strict";
  18663. 'use strict';
  18664. /**
  18665. * Determines whether the specified URL is absolute
  18666. *
  18667. * @param {string} url The URL to test
  18668. * @returns {boolean} True if the specified URL is absolute, otherwise false
  18669. */
  18670. module.exports = function isAbsoluteURL(url) {
  18671. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  18672. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  18673. // by any combination of letters, digits, plus, period, or hyphen.
  18674. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  18675. };
  18676. /***/ },
  18677. /* 145 */
  18678. /***/ function(module, exports, __webpack_require__) {
  18679. "use strict";
  18680. 'use strict';
  18681. var utils = __webpack_require__(4);
  18682. module.exports = (
  18683. utils.isStandardBrowserEnv() ?
  18684. // Standard browser envs have full support of the APIs needed to test
  18685. // whether the request URL is of the same origin as current location.
  18686. (function standardBrowserEnv() {
  18687. var msie = /(msie|trident)/i.test(navigator.userAgent);
  18688. var urlParsingNode = document.createElement('a');
  18689. var originURL;
  18690. /**
  18691. * Parse a URL to discover it's components
  18692. *
  18693. * @param {String} url The URL to be parsed
  18694. * @returns {Object}
  18695. */
  18696. function resolveURL(url) {
  18697. var href = url;
  18698. if (msie) {
  18699. // IE needs attribute set twice to normalize properties
  18700. urlParsingNode.setAttribute('href', href);
  18701. href = urlParsingNode.href;
  18702. }
  18703. urlParsingNode.setAttribute('href', href);
  18704. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  18705. return {
  18706. href: urlParsingNode.href,
  18707. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  18708. host: urlParsingNode.host,
  18709. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  18710. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  18711. hostname: urlParsingNode.hostname,
  18712. port: urlParsingNode.port,
  18713. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  18714. urlParsingNode.pathname :
  18715. '/' + urlParsingNode.pathname
  18716. };
  18717. }
  18718. originURL = resolveURL(window.location.href);
  18719. /**
  18720. * Determine if a URL shares the same origin as the current location
  18721. *
  18722. * @param {String} requestURL The URL to test
  18723. * @returns {boolean} True if URL shares the same origin, otherwise false
  18724. */
  18725. return function isURLSameOrigin(requestURL) {
  18726. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  18727. return (parsed.protocol === originURL.protocol &&
  18728. parsed.host === originURL.host);
  18729. };
  18730. })() :
  18731. // Non standard browser envs (web workers, react-native) lack needed support.
  18732. (function nonStandardBrowserEnv() {
  18733. return function isURLSameOrigin() {
  18734. return true;
  18735. };
  18736. })()
  18737. );
  18738. /***/ },
  18739. /* 146 */
  18740. /***/ function(module, exports, __webpack_require__) {
  18741. "use strict";
  18742. 'use strict';
  18743. var utils = __webpack_require__(4);
  18744. module.exports = function normalizeHeaderName(headers, normalizedName) {
  18745. utils.forEach(headers, function processHeader(value, name) {
  18746. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  18747. headers[normalizedName] = value;
  18748. delete headers[name];
  18749. }
  18750. });
  18751. };
  18752. /***/ },
  18753. /* 147 */
  18754. /***/ function(module, exports, __webpack_require__) {
  18755. "use strict";
  18756. 'use strict';
  18757. var utils = __webpack_require__(4);
  18758. /**
  18759. * Parse headers into an object
  18760. *
  18761. * ```
  18762. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  18763. * Content-Type: application/json
  18764. * Connection: keep-alive
  18765. * Transfer-Encoding: chunked
  18766. * ```
  18767. *
  18768. * @param {String} headers Headers needing to be parsed
  18769. * @returns {Object} Headers parsed into an object
  18770. */
  18771. module.exports = function parseHeaders(headers) {
  18772. var parsed = {};
  18773. var key;
  18774. var val;
  18775. var i;
  18776. if (!headers) { return parsed; }
  18777. utils.forEach(headers.split('\n'), function parser(line) {
  18778. i = line.indexOf(':');
  18779. key = utils.trim(line.substr(0, i)).toLowerCase();
  18780. val = utils.trim(line.substr(i + 1));
  18781. if (key) {
  18782. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  18783. }
  18784. });
  18785. return parsed;
  18786. };
  18787. /***/ },
  18788. /* 148 */
  18789. /***/ function(module, exports) {
  18790. "use strict";
  18791. 'use strict';
  18792. /**
  18793. * Syntactic sugar for invoking a function and expanding an array for arguments.
  18794. *
  18795. * Common use case would be to use `Function.prototype.apply`.
  18796. *
  18797. * ```js
  18798. * function f(x, y, z) {}
  18799. * var args = [1, 2, 3];
  18800. * f.apply(null, args);
  18801. * ```
  18802. *
  18803. * With `spread` this example can be re-written.
  18804. *
  18805. * ```js
  18806. * spread(function(x, y, z) {})([1, 2, 3]);
  18807. * ```
  18808. *
  18809. * @param {Function} callback
  18810. * @returns {Function}
  18811. */
  18812. module.exports = function spread(callback) {
  18813. return function wrap(arr) {
  18814. return callback.apply(null, arr);
  18815. };
  18816. };
  18817. /***/ },
  18818. /* 149 */
  18819. /***/ function(module, exports, __webpack_require__) {
  18820. "use strict";
  18821. 'use strict';
  18822. Object.defineProperty(exports, "__esModule", {
  18823. value: true
  18824. });
  18825. var _Menu = __webpack_require__(286);
  18826. var _Menu2 = _interopRequireDefault(_Menu);
  18827. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18828. exports.default = {
  18829. name: 'LessPass',
  18830. components: {
  18831. 'lesspass-menu': _Menu2.default
  18832. },
  18833. created: function created() {
  18834. var _this = this;
  18835. var fiveMinutes = 1000 * 60 * 5;
  18836. this.$store.dispatch('REFRESH_TOKEN');
  18837. setInterval(function () {
  18838. _this.$store.dispatch('REFRESH_TOKEN');
  18839. }, fiveMinutes);
  18840. }
  18841. };
  18842. /***/ },
  18843. /* 150 */
  18844. /***/ function(module, exports) {
  18845. "use strict";
  18846. "use strict";
  18847. Object.defineProperty(exports, "__esModule", {
  18848. value: true
  18849. });
  18850. exports.default = {
  18851. data: function data() {
  18852. return {
  18853. pending: false
  18854. };
  18855. },
  18856. props: {
  18857. action: { type: Function, required: true },
  18858. text: { type: String, required: true },
  18859. object: { type: Object, required: true }
  18860. },
  18861. methods: {
  18862. confirm: function (_confirm) {
  18863. function confirm() {
  18864. return _confirm.apply(this, arguments);
  18865. }
  18866. confirm.toString = function () {
  18867. return _confirm.toString();
  18868. };
  18869. return confirm;
  18870. }(function () {
  18871. this.pending = true;
  18872. var response = confirm(this.text);
  18873. if (response == true) {
  18874. this.action(this.object);
  18875. }
  18876. })
  18877. }
  18878. };
  18879. /***/ },
  18880. /* 151 */
  18881. /***/ function(module, exports, __webpack_require__) {
  18882. "use strict";
  18883. 'use strict';
  18884. Object.defineProperty(exports, "__esModule", {
  18885. value: true
  18886. });
  18887. var _lesspass = __webpack_require__(108);
  18888. var _lesspass2 = _interopRequireDefault(_lesspass);
  18889. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18890. exports.default = {
  18891. data: function data() {
  18892. return {
  18893. icon1: '',
  18894. icon2: '',
  18895. icon3: '',
  18896. color1: '',
  18897. color2: '',
  18898. color3: ''
  18899. };
  18900. },
  18901. props: ['fingerprint'],
  18902. watch: {
  18903. fingerprint: function fingerprint(newFingerprint) {
  18904. var _this = this;
  18905. if (!newFingerprint) {
  18906. return;
  18907. }
  18908. _lesspass2.default.createFingerprint(newFingerprint).then(function (sha256) {
  18909. var hash1 = sha256.substring(0, 6);
  18910. var hash2 = sha256.substring(6, 12);
  18911. var hash3 = sha256.substring(12, 18);
  18912. _this.icon1 = _this.getIcon(hash1);
  18913. _this.icon2 = _this.getIcon(hash2);
  18914. _this.icon3 = _this.getIcon(hash3);
  18915. _this.color1 = _this.getColor(hash1);
  18916. _this.color2 = _this.getColor(hash2);
  18917. _this.color3 = _this.getColor(hash3);
  18918. });
  18919. }
  18920. },
  18921. methods: {
  18922. getColor: function getColor(color) {
  18923. var colors = ['#000000', '#074750', '#009191', '#FF6CB6', '#FFB5DA', '#490092', '#006CDB', '#B66DFF', '#6DB5FE', '#B5DAFE', '#920000', '#924900', '#DB6D00', '#24FE23'];
  18924. var index = parseInt(color, 16) % colors.length;
  18925. return colors[index];
  18926. },
  18927. getIcon: function getIcon(hash) {
  18928. var icons = ['fa-hashtag', 'fa-heart', 'fa-hotel', 'fa-university', 'fa-plug', 'fa-ambulance', 'fa-bus', 'fa-car', 'fa-plane', 'fa-rocket', 'fa-ship', 'fa-subway', 'fa-truck', 'fa-jpy', 'fa-eur', 'fa-btc', 'fa-usd', 'fa-gbp', 'fa-archive', 'fa-area-chart', 'fa-bed', 'fa-beer', 'fa-bell', 'fa-binoculars', 'fa-birthday-cake', 'fa-bomb', 'fa-briefcase', 'fa-bug', 'fa-camera', 'fa-cart-plus', 'fa-certificate', 'fa-coffee', 'fa-cloud', 'fa-coffee', 'fa-comment', 'fa-cube', 'fa-cutlery', 'fa-database', 'fa-diamond', 'fa-exclamation-circle', 'fa-eye', 'fa-flag', 'fa-flask', 'fa-futbol-o', 'fa-gamepad', 'fa-graduation-cap'];
  18929. var index = parseInt(hash, 16) % icons.length;
  18930. return icons[index];
  18931. }
  18932. }
  18933. };
  18934. /***/ },
  18935. /* 152 */
  18936. /***/ function(module, exports, __webpack_require__) {
  18937. "use strict";
  18938. 'use strict';
  18939. Object.defineProperty(exports, "__esModule", {
  18940. value: true
  18941. });
  18942. var _vuex = __webpack_require__(11);
  18943. exports.default = {
  18944. methods: {
  18945. logout: function logout() {
  18946. this.$store.dispatch('LOGOUT');
  18947. this.$router.push({ name: 'home' });
  18948. },
  18949. saveOrUpdatePassword: function saveOrUpdatePassword() {
  18950. this.$store.dispatch('SAVE_OR_UPDATE_PASSWORD');
  18951. }
  18952. },
  18953. computed: (0, _vuex.mapGetters)(['isAuthenticated', 'isGuest', 'email', 'passwordStatus'])
  18954. };
  18955. /***/ },
  18956. /* 153 */
  18957. /***/ function(module, exports, __webpack_require__) {
  18958. "use strict";
  18959. 'use strict';
  18960. Object.defineProperty(exports, "__esModule", {
  18961. value: true
  18962. });
  18963. var _extends2 = __webpack_require__(25);
  18964. var _extends3 = _interopRequireDefault(_extends2);
  18965. var _auth = __webpack_require__(34);
  18966. var _auth2 = _interopRequireDefault(_auth);
  18967. var _storage = __webpack_require__(22);
  18968. var _storage2 = _interopRequireDefault(_storage);
  18969. var _vuex = __webpack_require__(11);
  18970. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18971. var defaultErrors = {
  18972. userNameAlreadyExist: false,
  18973. baseURLRequired: false,
  18974. emailRequired: false,
  18975. passwordRequired: false
  18976. };
  18977. exports.default = {
  18978. data: function data() {
  18979. var storage = new _storage2.default();
  18980. var auth = new _auth2.default(storage);
  18981. return {
  18982. auth: auth,
  18983. storage: storage,
  18984. password: '',
  18985. showError: false,
  18986. errorMessage: '',
  18987. loadingRegister: false,
  18988. loadingSignIn: false,
  18989. errors: (0, _extends3.default)({}, defaultErrors)
  18990. };
  18991. },
  18992. methods: {
  18993. noErrors: function noErrors() {
  18994. return !(this.errors.userNameAlreadyExist || this.errors.emailRequired || this.errors.passwordRequired || this.errors.baseURLRequired || this.showError);
  18995. },
  18996. formIsValid: function formIsValid() {
  18997. this.cleanErrors();
  18998. var formIsValid = true;
  18999. if (!this.email) {
  19000. this.errors.emailRequired = true;
  19001. formIsValid = false;
  19002. }
  19003. if (!this.password) {
  19004. this.errors.passwordRequired = true;
  19005. formIsValid = false;
  19006. }
  19007. if (!this.baseURL) {
  19008. this.errors.baseURLRequired = true;
  19009. formIsValid = false;
  19010. }
  19011. return formIsValid;
  19012. },
  19013. cleanErrors: function cleanErrors() {
  19014. this.loadingRegister = false;
  19015. this.loadingSignIn = false;
  19016. this.showError = false;
  19017. this.errorMessage = '';
  19018. this.errors = (0, _extends3.default)({}, defaultErrors);
  19019. },
  19020. signIn: function signIn() {
  19021. var _this = this;
  19022. if (this.formIsValid()) {
  19023. (function () {
  19024. _this.loadingSignIn = true;
  19025. var email = _this.email;
  19026. var password = _this.password;
  19027. var baseURL = _this.baseURL;
  19028. _this.auth.login({ email: email, password: password }, baseURL).then(function () {
  19029. _this.loadingSignIn = false;
  19030. _this.storage.save({ baseURL: baseURL, email: email });
  19031. _this.$store.dispatch('USER_AUTHENTICATED', { email: email });
  19032. _this.$router.push({ name: 'home' });
  19033. }).catch(function (err) {
  19034. _this.cleanErrors();
  19035. if (err.response === undefined) {
  19036. if (baseURL === "https://lesspass.com") {
  19037. _this.showErrorMessage();
  19038. } else {
  19039. _this.showErrorMessage('Your LessPass Database is not running');
  19040. }
  19041. } else if (err.response.status === 400) {
  19042. _this.showErrorMessage('Your email and/or password is not good. Do you have an account ?');
  19043. } else {
  19044. _this.showErrorMessage();
  19045. }
  19046. });
  19047. })();
  19048. }
  19049. },
  19050. register: function register() {
  19051. var _this2 = this;
  19052. if (this.formIsValid()) {
  19053. this.loadingRegister = true;
  19054. var email = this.email;
  19055. var password = this.password;
  19056. var baseURL = this.baseURL;
  19057. this.auth.register({ email: email, password: password }, baseURL).then(function () {
  19058. _this2.loadingRegister = false;
  19059. _this2.signIn();
  19060. }).catch(function (err) {
  19061. _this2.cleanErrors();
  19062. if (err.response && err.response.data.email[0].indexOf('already exists') !== -1) {
  19063. _this2.errors.userNameAlreadyExist = true;
  19064. } else {
  19065. _this2.showErrorMessage();
  19066. }
  19067. });
  19068. }
  19069. },
  19070. showErrorMessage: function showErrorMessage() {
  19071. var errorMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Oops! Something went wrong. Retry in a few minutes.';
  19072. this.errorMessage = errorMessage;
  19073. this.showError = true;
  19074. }
  19075. },
  19076. computed: {
  19077. baseURL: {
  19078. get: function get() {
  19079. return this.$store.state.baseURL;
  19080. },
  19081. set: function set(baseURL) {
  19082. this.$store.commit('UPDATE_BASE_URL', { baseURL: baseURL });
  19083. }
  19084. },
  19085. email: {
  19086. get: function get() {
  19087. return this.$store.state.email;
  19088. },
  19089. set: function set(email) {
  19090. this.$store.commit('UPDATE_EMAIL', { email: email });
  19091. }
  19092. }
  19093. }
  19094. };
  19095. /***/ },
  19096. /* 154 */
  19097. /***/ function(module, exports, __webpack_require__) {
  19098. "use strict";
  19099. 'use strict';
  19100. Object.defineProperty(exports, "__esModule", {
  19101. value: true
  19102. });
  19103. var _extends2 = __webpack_require__(25);
  19104. var _extends3 = _interopRequireDefault(_extends2);
  19105. var _lesspass = __webpack_require__(108);
  19106. var _lesspass2 = _interopRequireDefault(_lesspass);
  19107. var _vuex = __webpack_require__(11);
  19108. var _clipboard = __webpack_require__(175);
  19109. var _clipboard2 = _interopRequireDefault(_clipboard);
  19110. var _lodash = __webpack_require__(261);
  19111. var _lodash2 = _interopRequireDefault(_lodash);
  19112. var _tooltip = __webpack_require__(160);
  19113. var _password = __webpack_require__(78);
  19114. var _password2 = _interopRequireDefault(_password);
  19115. var _urlParser = __webpack_require__(161);
  19116. var _RemoveAutoComplete = __webpack_require__(287);
  19117. var _RemoveAutoComplete2 = _interopRequireDefault(_RemoveAutoComplete);
  19118. var _Fingerprint = __webpack_require__(285);
  19119. var _Fingerprint2 = _interopRequireDefault(_Fingerprint);
  19120. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19121. function fetchPasswords(store) {
  19122. return store.dispatch('FETCH_PASSWORDS');
  19123. }
  19124. exports.default = {
  19125. name: 'password-generator-view',
  19126. components: {
  19127. RemoveAutoComplete: _RemoveAutoComplete2.default,
  19128. Fingerprint: _Fingerprint2.default
  19129. },
  19130. computed: (0, _vuex.mapGetters)(['passwords', 'password']),
  19131. preFetch: fetchPasswords,
  19132. beforeMount: function beforeMount() {
  19133. var _this = this;
  19134. var id = this.$route.params.id;
  19135. if (id) {
  19136. this.$store.dispatch('FETCH_PASSWORD', { id: id });
  19137. } else {
  19138. fetchPasswords(this.$store);
  19139. }
  19140. (0, _urlParser.getSite)().then(function (site) {
  19141. if (site) {
  19142. _this.$store.commit('UPDATE_SITE', { site: site });
  19143. }
  19144. });
  19145. var clipboard = new _clipboard2.default('#copyPasswordButton');
  19146. clipboard.on('success', function (event) {
  19147. if (event.text) {
  19148. (0, _tooltip.showTooltip)(event.trigger, 'copied !');
  19149. }
  19150. });
  19151. },
  19152. data: function data() {
  19153. return {
  19154. masterPassword: '',
  19155. encryptedLogin: '',
  19156. generatedPassword: '',
  19157. cleanTimeout: null
  19158. };
  19159. },
  19160. watch: {
  19161. 'password.site': function passwordSite(newValue) {
  19162. var values = newValue.split(" | ");
  19163. if (values.length === 2) {
  19164. var site = values[0];
  19165. var login = values[1];
  19166. var passwords = this.passwords;
  19167. for (var i = 0; i < passwords.length; i++) {
  19168. var password = passwords[i];
  19169. if (password.site === site && password.login === login) {
  19170. this.$store.dispatch('PASSWORD_CHANGE', { password: (0, _extends3.default)({}, password) });
  19171. this.$refs.masterPassword.focus();
  19172. break;
  19173. }
  19174. }
  19175. }
  19176. this.renderPassword();
  19177. },
  19178. 'password.login': function passwordLogin() {
  19179. this.encryptedLogin = '';
  19180. this.encryptLogin();
  19181. },
  19182. 'password.uppercase': function passwordUppercase() {
  19183. this.renderPassword();
  19184. },
  19185. 'password.lowercase': function passwordLowercase() {
  19186. this.renderPassword();
  19187. },
  19188. 'password.numbers': function passwordNumbers() {
  19189. this.renderPassword();
  19190. },
  19191. 'password.symbols': function passwordSymbols() {
  19192. this.renderPassword();
  19193. },
  19194. 'password.length': function passwordLength() {
  19195. this.renderPassword();
  19196. },
  19197. 'password.counter': function passwordCounter() {
  19198. this.renderPassword();
  19199. },
  19200. 'masterPassword': function masterPassword() {
  19201. this.encryptedLogin = '';
  19202. this.encryptLogin();
  19203. },
  19204. 'encryptedLogin': function encryptedLogin() {
  19205. this.renderPassword();
  19206. },
  19207. 'generatedPassword': function generatedPassword() {
  19208. this.cleanFormInSeconds(30);
  19209. }
  19210. },
  19211. methods: {
  19212. encryptLogin: (0, _lodash2.default)(function () {
  19213. var _this2 = this;
  19214. if (this.password.login && this.masterPassword) {
  19215. _lesspass2.default.encryptLogin(this.password.login, this.masterPassword).then(function (encryptedLogin) {
  19216. _this2.encryptedLogin = encryptedLogin;
  19217. });
  19218. }
  19219. }, 500),
  19220. showMasterPassword: function showMasterPassword() {
  19221. if (this.$refs.masterPassword.type === 'password') {
  19222. this.$refs.masterPassword.type = 'text';
  19223. } else {
  19224. this.$refs.masterPassword.type = 'password';
  19225. }
  19226. },
  19227. cleanFormInSeconds: function cleanFormInSeconds(seconds) {
  19228. var _this3 = this;
  19229. clearTimeout(this.cleanTimeout);
  19230. this.cleanTimeout = setTimeout(function () {
  19231. _this3.$store.commit('PASSWORD_CLEAN');
  19232. _this3.masterPassword = '';
  19233. _this3.encryptedLogin = '';
  19234. _this3.generatedPassword = '';
  19235. }, 1000 * seconds);
  19236. },
  19237. renderPassword: function renderPassword() {
  19238. var _this4 = this;
  19239. if (!this.encryptedLogin || !this.password.site) {
  19240. this.generatedPassword = '';
  19241. return;
  19242. }
  19243. var password = new _password2.default(this.password);
  19244. _lesspass2.default.renderPassword(this.encryptedLogin, this.password.site, password.options).then(function (generatedPassword) {
  19245. _this4.$store.dispatch('PASSWORD_GENERATED');
  19246. _this4.generatedPassword = generatedPassword;
  19247. });
  19248. }
  19249. }
  19250. };
  19251. /***/ },
  19252. /* 155 */
  19253. /***/ function(module, exports, __webpack_require__) {
  19254. "use strict";
  19255. 'use strict';
  19256. Object.defineProperty(exports, "__esModule", {
  19257. value: true
  19258. });
  19259. var _auth = __webpack_require__(34);
  19260. var _auth2 = _interopRequireDefault(_auth);
  19261. var _storage = __webpack_require__(22);
  19262. var _storage2 = _interopRequireDefault(_storage);
  19263. var _vuex = __webpack_require__(11);
  19264. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19265. exports.default = {
  19266. data: function data() {
  19267. var storage = new _storage2.default();
  19268. var auth = new _auth2.default(storage);
  19269. return {
  19270. auth: auth,
  19271. storage: storage,
  19272. email: '',
  19273. emailRequired: false,
  19274. showError: false,
  19275. loading: false,
  19276. successMessage: false
  19277. };
  19278. },
  19279. methods: {
  19280. cleanErrors: function cleanErrors() {
  19281. this.loading = false;
  19282. this.emailRequired = false;
  19283. this.showError = false;
  19284. this.successMessage = false;
  19285. },
  19286. noErrors: function noErrors() {
  19287. return !(this.emailRequired || this.showError);
  19288. },
  19289. resetPassword: function resetPassword() {
  19290. var _this = this;
  19291. this.cleanErrors();
  19292. if (!this.email) {
  19293. this.emailRequired = true;
  19294. return;
  19295. }
  19296. this.loading = true;
  19297. this.auth.resetPassword({ email: this.email }).then(function () {
  19298. _this.cleanErrors();
  19299. _this.successMessage = true;
  19300. }).catch(function () {
  19301. _this.cleanErrors();
  19302. _this.showError = true;
  19303. });
  19304. }
  19305. }
  19306. };
  19307. /***/ },
  19308. /* 156 */
  19309. /***/ function(module, exports, __webpack_require__) {
  19310. "use strict";
  19311. 'use strict';
  19312. Object.defineProperty(exports, "__esModule", {
  19313. value: true
  19314. });
  19315. var _auth = __webpack_require__(34);
  19316. var _auth2 = _interopRequireDefault(_auth);
  19317. var _storage = __webpack_require__(22);
  19318. var _storage2 = _interopRequireDefault(_storage);
  19319. var _vuex = __webpack_require__(11);
  19320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19321. exports.default = {
  19322. data: function data() {
  19323. var storage = new _storage2.default();
  19324. var auth = new _auth2.default(storage);
  19325. return {
  19326. auth: auth,
  19327. storage: storage,
  19328. new_password: '',
  19329. passwordRequired: false,
  19330. showError: false,
  19331. successMessage: false,
  19332. errorMessage: 'Oops! Something went wrong. Retry in a few minutes.'
  19333. };
  19334. },
  19335. methods: {
  19336. cleanErrors: function cleanErrors() {
  19337. this.passwordRequired = false;
  19338. this.showError = false;
  19339. this.successMessage = false;
  19340. },
  19341. noErrors: function noErrors() {
  19342. return !(this.passwordRequired || this.showError);
  19343. },
  19344. resetPasswordConfirm: function resetPasswordConfirm() {
  19345. var _this = this;
  19346. this.cleanErrors();
  19347. if (!this.new_password) {
  19348. this.passwordRequired = true;
  19349. return;
  19350. }
  19351. this.auth.confirmResetPassword({
  19352. uid: this.$route.params.uid,
  19353. token: this.$route.params.token,
  19354. new_password: this.new_password
  19355. }).then(function () {
  19356. _this.successMessage = true;
  19357. }).catch(function (err) {
  19358. if (err.response.status === 400) {
  19359. _this.errorMessage = 'This password reset link become invalid.';
  19360. }
  19361. _this.showError = true;
  19362. });
  19363. }
  19364. }
  19365. };
  19366. /***/ },
  19367. /* 157 */
  19368. /***/ function(module, exports, __webpack_require__) {
  19369. "use strict";
  19370. 'use strict';
  19371. Object.defineProperty(exports, "__esModule", {
  19372. value: true
  19373. });
  19374. var _extends2 = __webpack_require__(25);
  19375. var _extends3 = _interopRequireDefault(_extends2);
  19376. var _DeleteButton = __webpack_require__(284);
  19377. var _DeleteButton2 = _interopRequireDefault(_DeleteButton);
  19378. var _vuex = __webpack_require__(11);
  19379. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19380. function fetchPasswords(store) {
  19381. return store.dispatch('FETCH_PASSWORDS');
  19382. }
  19383. exports.default = {
  19384. name: 'passwords-view',
  19385. data: function data() {
  19386. return {
  19387. searchQuery: ''
  19388. };
  19389. },
  19390. components: { DeleteButton: _DeleteButton2.default },
  19391. computed: (0, _extends3.default)({}, (0, _vuex.mapGetters)(['passwords', 'email']), {
  19392. filteredPasswords: function filteredPasswords() {
  19393. var _this = this;
  19394. return this.passwords.filter(function (password) {
  19395. return password.site.indexOf(_this.searchQuery) > -1 || password.login.indexOf(_this.searchQuery) > -1;
  19396. });
  19397. }
  19398. }),
  19399. preFetch: fetchPasswords,
  19400. beforeMount: function beforeMount() {
  19401. fetchPasswords(this.$store);
  19402. },
  19403. methods: {
  19404. deletePassword: function deletePassword(password) {
  19405. return this.$store.dispatch('DELETE_PASSWORD', { id: password.id });
  19406. }
  19407. }
  19408. };
  19409. /***/ },
  19410. /* 158 */
  19411. /***/ function(module, exports, __webpack_require__) {
  19412. "use strict";
  19413. 'use strict';
  19414. Object.defineProperty(exports, "__esModule", {
  19415. value: true
  19416. });
  19417. var _extends2 = __webpack_require__(25);
  19418. var _extends3 = _interopRequireDefault(_extends2);
  19419. var _classCallCheck2 = __webpack_require__(23);
  19420. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  19421. var _createClass2 = __webpack_require__(24);
  19422. var _createClass3 = _interopRequireDefault(_createClass2);
  19423. var _axios = __webpack_require__(71);
  19424. var _axios2 = _interopRequireDefault(_axios);
  19425. var _storage = __webpack_require__(22);
  19426. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19427. var HTTP = function () {
  19428. function HTTP(resource, storage) {
  19429. (0, _classCallCheck3.default)(this, HTTP);
  19430. this.storage = storage;
  19431. this.resource = resource;
  19432. }
  19433. (0, _createClass3.default)(HTTP, [{
  19434. key: 'getRequestConfig',
  19435. value: function getRequestConfig() {
  19436. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19437. var config = this.storage.json();
  19438. return (0, _extends3.default)({}, params, {
  19439. baseURL: config.baseURL,
  19440. headers: { Authorization: 'JWT ' + config[_storage.TOKEN_KEY] }
  19441. });
  19442. }
  19443. }, {
  19444. key: 'create',
  19445. value: function create(resource) {
  19446. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19447. return _axios2.default.post('/api/' + this.resource + '/', resource, this.getRequestConfig(params));
  19448. }
  19449. }, {
  19450. key: 'all',
  19451. value: function all() {
  19452. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19453. return _axios2.default.get('/api/' + this.resource + '/', this.getRequestConfig(params));
  19454. }
  19455. }, {
  19456. key: 'get',
  19457. value: function get(resource) {
  19458. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19459. return _axios2.default.get('/api/' + this.resource + '/' + resource.id + '/', this.getRequestConfig(params));
  19460. }
  19461. }, {
  19462. key: 'update',
  19463. value: function update(resource) {
  19464. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19465. return _axios2.default.put('/api/' + this.resource + '/' + resource.id + '/', resource, this.getRequestConfig(params));
  19466. }
  19467. }, {
  19468. key: 'remove',
  19469. value: function remove(resource) {
  19470. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19471. return _axios2.default.delete('/api/' + this.resource + '/' + resource.id + '/', this.getRequestConfig(params));
  19472. }
  19473. }]);
  19474. return HTTP;
  19475. }();
  19476. exports.default = HTTP;
  19477. /***/ },
  19478. /* 159 */
  19479. /***/ function(module, exports, __webpack_require__) {
  19480. "use strict";
  19481. 'use strict';
  19482. Object.defineProperty(exports, "__esModule", {
  19483. value: true
  19484. });
  19485. exports.TOKEN_KEY = undefined;
  19486. var _classCallCheck2 = __webpack_require__(23);
  19487. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  19488. var _createClass2 = __webpack_require__(24);
  19489. var _createClass3 = _interopRequireDefault(_createClass2);
  19490. var _jwtDecode = __webpack_require__(260);
  19491. var _jwtDecode2 = _interopRequireDefault(_jwtDecode);
  19492. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19493. var TOKEN_KEY = exports.TOKEN_KEY = 'jwt';
  19494. var Token = function () {
  19495. function Token(tokenName) {
  19496. (0, _classCallCheck3.default)(this, Token);
  19497. this.name = tokenName;
  19498. }
  19499. (0, _createClass3.default)(Token, [{
  19500. key: 'stillValid',
  19501. value: function stillValid() {
  19502. var now = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  19503. try {
  19504. return this._expirationDateSuperiorTo(now);
  19505. } catch (err) {
  19506. return false;
  19507. }
  19508. }
  19509. }, {
  19510. key: 'expiresInMinutes',
  19511. value: function expiresInMinutes(minutes) {
  19512. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
  19513. try {
  19514. var nowPlusDuration = new Date(now.getTime() + minutes * 60000);
  19515. return this._expirationDateInferiorTo(nowPlusDuration);
  19516. } catch (err) {
  19517. return false;
  19518. }
  19519. }
  19520. }, {
  19521. key: '_expirationDateInferiorTo',
  19522. value: function _expirationDateInferiorTo(date) {
  19523. var expireDate = this._getTokenExpirationDate();
  19524. return expireDate < date;
  19525. }
  19526. }, {
  19527. key: '_expirationDateSuperiorTo',
  19528. value: function _expirationDateSuperiorTo(date) {
  19529. return !this._expirationDateInferiorTo(date);
  19530. }
  19531. }, {
  19532. key: '_getTokenExpirationDate',
  19533. value: function _getTokenExpirationDate() {
  19534. var decodedToken = (0, _jwtDecode2.default)(this.name);
  19535. return new Date(decodedToken.exp * 1000);
  19536. }
  19537. }]);
  19538. return Token;
  19539. }();
  19540. exports.default = Token;
  19541. /***/ },
  19542. /* 160 */
  19543. /***/ function(module, exports) {
  19544. "use strict";
  19545. 'use strict';
  19546. Object.defineProperty(exports, "__esModule", {
  19547. value: true
  19548. });
  19549. exports.showTooltip = showTooltip;
  19550. function showTooltip(elem, msg) {
  19551. var classNames = elem.className;
  19552. elem.setAttribute('class', classNames + ' hint--top');
  19553. elem.setAttribute('aria-label', msg);
  19554. setTimeout(function () {
  19555. elem.setAttribute('class', classNames);
  19556. }, 2000);
  19557. }
  19558. /***/ },
  19559. /* 161 */
  19560. /***/ function(module, exports, __webpack_require__) {
  19561. "use strict";
  19562. 'use strict';
  19563. Object.defineProperty(exports, "__esModule", {
  19564. value: true
  19565. });
  19566. exports.getSite = exports.getCurrentUrl = exports.isWebExtension = exports._ipIsValid = exports.getDomainName = undefined;
  19567. var _promise = __webpack_require__(80);
  19568. var _promise2 = _interopRequireDefault(_promise);
  19569. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19570. function _ipIsValid(ipAddress) {
  19571. return Boolean(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipAddress));
  19572. }
  19573. function getDomainName(urlStr) {
  19574. var matches = urlStr.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
  19575. return matches && matches[1];
  19576. }
  19577. function isWebExtension() {
  19578. if (typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined') {
  19579. return typeof chrome.tabs.query === 'function';
  19580. }
  19581. return false;
  19582. }
  19583. function getCurrentUrl() {
  19584. return new _promise2.default(function (resolve) {
  19585. chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
  19586. resolve(tabs[0].url);
  19587. });
  19588. });
  19589. }
  19590. function getSite() {
  19591. if (isWebExtension()) {
  19592. return getCurrentUrl().then(function (currentUrl) {
  19593. return getDomainName(currentUrl);
  19594. });
  19595. }
  19596. return new _promise2.default(function (resolve) {
  19597. resolve('');
  19598. });
  19599. }
  19600. exports.getDomainName = getDomainName;
  19601. exports._ipIsValid = _ipIsValid;
  19602. exports.isWebExtension = isWebExtension;
  19603. exports.getCurrentUrl = getCurrentUrl;
  19604. exports.getSite = getSite;
  19605. /***/ },
  19606. /* 162 */
  19607. /***/ function(module, exports, __webpack_require__) {
  19608. module.exports = { "default": __webpack_require__(176), __esModule: true };
  19609. /***/ },
  19610. /* 163 */
  19611. /***/ function(module, exports, __webpack_require__) {
  19612. "use strict";
  19613. "use strict";
  19614. exports.__esModule = true;
  19615. var _defineProperty = __webpack_require__(79);
  19616. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  19617. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19618. exports.default = function (obj, key, value) {
  19619. if (key in obj) {
  19620. (0, _defineProperty2.default)(obj, key, {
  19621. value: value,
  19622. enumerable: true,
  19623. configurable: true,
  19624. writable: true
  19625. });
  19626. } else {
  19627. obj[key] = value;
  19628. }
  19629. return obj;
  19630. };
  19631. /***/ },
  19632. /* 164 */
  19633. /***/ function(module, exports) {
  19634. "use strict";
  19635. 'use strict'
  19636. exports.byteLength = byteLength
  19637. exports.toByteArray = toByteArray
  19638. exports.fromByteArray = fromByteArray
  19639. var lookup = []
  19640. var revLookup = []
  19641. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  19642. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  19643. for (var i = 0, len = code.length; i < len; ++i) {
  19644. lookup[i] = code[i]
  19645. revLookup[code.charCodeAt(i)] = i
  19646. }
  19647. revLookup['-'.charCodeAt(0)] = 62
  19648. revLookup['_'.charCodeAt(0)] = 63
  19649. function placeHoldersCount (b64) {
  19650. var len = b64.length
  19651. if (len % 4 > 0) {
  19652. throw new Error('Invalid string. Length must be a multiple of 4')
  19653. }
  19654. // the number of equal signs (place holders)
  19655. // if there are two placeholders, than the two characters before it
  19656. // represent one byte
  19657. // if there is only one, then the three characters before it represent 2 bytes
  19658. // this is just a cheap hack to not do indexOf twice
  19659. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  19660. }
  19661. function byteLength (b64) {
  19662. // base64 is 4/3 + up to two characters of the original data
  19663. return b64.length * 3 / 4 - placeHoldersCount(b64)
  19664. }
  19665. function toByteArray (b64) {
  19666. var i, j, l, tmp, placeHolders, arr
  19667. var len = b64.length
  19668. placeHolders = placeHoldersCount(b64)
  19669. arr = new Arr(len * 3 / 4 - placeHolders)
  19670. // if there are placeholders, only get up to the last complete 4 chars
  19671. l = placeHolders > 0 ? len - 4 : len
  19672. var L = 0
  19673. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  19674. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  19675. arr[L++] = (tmp >> 16) & 0xFF
  19676. arr[L++] = (tmp >> 8) & 0xFF
  19677. arr[L++] = tmp & 0xFF
  19678. }
  19679. if (placeHolders === 2) {
  19680. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  19681. arr[L++] = tmp & 0xFF
  19682. } else if (placeHolders === 1) {
  19683. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  19684. arr[L++] = (tmp >> 8) & 0xFF
  19685. arr[L++] = tmp & 0xFF
  19686. }
  19687. return arr
  19688. }
  19689. function tripletToBase64 (num) {
  19690. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  19691. }
  19692. function encodeChunk (uint8, start, end) {
  19693. var tmp
  19694. var output = []
  19695. for (var i = start; i < end; i += 3) {
  19696. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  19697. output.push(tripletToBase64(tmp))
  19698. }
  19699. return output.join('')
  19700. }
  19701. function fromByteArray (uint8) {
  19702. var tmp
  19703. var len = uint8.length
  19704. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  19705. var output = ''
  19706. var parts = []
  19707. var maxChunkLength = 16383 // must be multiple of 3
  19708. // go through the array every three bytes, we'll deal with trailing stuff later
  19709. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  19710. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  19711. }
  19712. // pad the end with zeros, but make sure to not forget the extra bytes
  19713. if (extraBytes === 1) {
  19714. tmp = uint8[len - 1]
  19715. output += lookup[tmp >> 2]
  19716. output += lookup[(tmp << 4) & 0x3F]
  19717. output += '=='
  19718. } else if (extraBytes === 2) {
  19719. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  19720. output += lookup[tmp >> 10]
  19721. output += lookup[(tmp >> 4) & 0x3F]
  19722. output += lookup[(tmp << 2) & 0x3F]
  19723. output += '='
  19724. }
  19725. parts.push(output)
  19726. return parts.join('')
  19727. }
  19728. /***/ },
  19729. /* 165 */
  19730. /***/ function(module, exports, __webpack_require__) {
  19731. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  19732. var Transform = __webpack_require__(12)
  19733. var inherits = __webpack_require__(1)
  19734. var modes = __webpack_require__(36)
  19735. var StreamCipher = __webpack_require__(89)
  19736. var AuthCipher = __webpack_require__(82)
  19737. var ebtk = __webpack_require__(45)
  19738. inherits(Decipher, Transform)
  19739. function Decipher (mode, key, iv) {
  19740. if (!(this instanceof Decipher)) {
  19741. return new Decipher(mode, key, iv)
  19742. }
  19743. Transform.call(this)
  19744. this._cache = new Splitter()
  19745. this._last = void 0
  19746. this._cipher = new aes.AES(key)
  19747. this._prev = new Buffer(iv.length)
  19748. iv.copy(this._prev)
  19749. this._mode = mode
  19750. this._autopadding = true
  19751. }
  19752. Decipher.prototype._update = function (data) {
  19753. this._cache.add(data)
  19754. var chunk
  19755. var thing
  19756. var out = []
  19757. while ((chunk = this._cache.get(this._autopadding))) {
  19758. thing = this._mode.decrypt(this, chunk)
  19759. out.push(thing)
  19760. }
  19761. return Buffer.concat(out)
  19762. }
  19763. Decipher.prototype._final = function () {
  19764. var chunk = this._cache.flush()
  19765. if (this._autopadding) {
  19766. return unpad(this._mode.decrypt(this, chunk))
  19767. } else if (chunk) {
  19768. throw new Error('data not multiple of block length')
  19769. }
  19770. }
  19771. Decipher.prototype.setAutoPadding = function (setTo) {
  19772. this._autopadding = !!setTo
  19773. return this
  19774. }
  19775. function Splitter () {
  19776. if (!(this instanceof Splitter)) {
  19777. return new Splitter()
  19778. }
  19779. this.cache = new Buffer('')
  19780. }
  19781. Splitter.prototype.add = function (data) {
  19782. this.cache = Buffer.concat([this.cache, data])
  19783. }
  19784. Splitter.prototype.get = function (autoPadding) {
  19785. var out
  19786. if (autoPadding) {
  19787. if (this.cache.length > 16) {
  19788. out = this.cache.slice(0, 16)
  19789. this.cache = this.cache.slice(16)
  19790. return out
  19791. }
  19792. } else {
  19793. if (this.cache.length >= 16) {
  19794. out = this.cache.slice(0, 16)
  19795. this.cache = this.cache.slice(16)
  19796. return out
  19797. }
  19798. }
  19799. return null
  19800. }
  19801. Splitter.prototype.flush = function () {
  19802. if (this.cache.length) {
  19803. return this.cache
  19804. }
  19805. }
  19806. function unpad (last) {
  19807. var padded = last[15]
  19808. var i = -1
  19809. while (++i < padded) {
  19810. if (last[(i + (16 - padded))] !== padded) {
  19811. throw new Error('unable to decrypt data')
  19812. }
  19813. }
  19814. if (padded === 16) {
  19815. return
  19816. }
  19817. return last.slice(0, 16 - padded)
  19818. }
  19819. var modelist = {
  19820. ECB: __webpack_require__(87),
  19821. CBC: __webpack_require__(83),
  19822. CFB: __webpack_require__(84),
  19823. CFB8: __webpack_require__(86),
  19824. CFB1: __webpack_require__(85),
  19825. OFB: __webpack_require__(88),
  19826. CTR: __webpack_require__(37),
  19827. GCM: __webpack_require__(37)
  19828. }
  19829. function createDecipheriv (suite, password, iv) {
  19830. var config = modes[suite.toLowerCase()]
  19831. if (!config) {
  19832. throw new TypeError('invalid suite type')
  19833. }
  19834. if (typeof iv === 'string') {
  19835. iv = new Buffer(iv)
  19836. }
  19837. if (typeof password === 'string') {
  19838. password = new Buffer(password)
  19839. }
  19840. if (password.length !== config.key / 8) {
  19841. throw new TypeError('invalid key length ' + password.length)
  19842. }
  19843. if (iv.length !== config.iv) {
  19844. throw new TypeError('invalid iv length ' + iv.length)
  19845. }
  19846. if (config.type === 'stream') {
  19847. return new StreamCipher(modelist[config.mode], password, iv, true)
  19848. } else if (config.type === 'auth') {
  19849. return new AuthCipher(modelist[config.mode], password, iv, true)
  19850. }
  19851. return new Decipher(modelist[config.mode], password, iv)
  19852. }
  19853. function createDecipher (suite, password) {
  19854. var config = modes[suite.toLowerCase()]
  19855. if (!config) {
  19856. throw new TypeError('invalid suite type')
  19857. }
  19858. var keys = ebtk(password, false, config.key, config.iv)
  19859. return createDecipheriv(suite, keys.key, keys.iv)
  19860. }
  19861. exports.createDecipher = createDecipher
  19862. exports.createDecipheriv = createDecipheriv
  19863. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  19864. /***/ },
  19865. /* 166 */
  19866. /***/ function(module, exports, __webpack_require__) {
  19867. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  19868. var Transform = __webpack_require__(12)
  19869. var inherits = __webpack_require__(1)
  19870. var modes = __webpack_require__(36)
  19871. var ebtk = __webpack_require__(45)
  19872. var StreamCipher = __webpack_require__(89)
  19873. var AuthCipher = __webpack_require__(82)
  19874. inherits(Cipher, Transform)
  19875. function Cipher (mode, key, iv) {
  19876. if (!(this instanceof Cipher)) {
  19877. return new Cipher(mode, key, iv)
  19878. }
  19879. Transform.call(this)
  19880. this._cache = new Splitter()
  19881. this._cipher = new aes.AES(key)
  19882. this._prev = new Buffer(iv.length)
  19883. iv.copy(this._prev)
  19884. this._mode = mode
  19885. this._autopadding = true
  19886. }
  19887. Cipher.prototype._update = function (data) {
  19888. this._cache.add(data)
  19889. var chunk
  19890. var thing
  19891. var out = []
  19892. while ((chunk = this._cache.get())) {
  19893. thing = this._mode.encrypt(this, chunk)
  19894. out.push(thing)
  19895. }
  19896. return Buffer.concat(out)
  19897. }
  19898. Cipher.prototype._final = function () {
  19899. var chunk = this._cache.flush()
  19900. if (this._autopadding) {
  19901. chunk = this._mode.encrypt(this, chunk)
  19902. this._cipher.scrub()
  19903. return chunk
  19904. } else if (chunk.toString('hex') !== '10101010101010101010101010101010') {
  19905. this._cipher.scrub()
  19906. throw new Error('data not multiple of block length')
  19907. }
  19908. }
  19909. Cipher.prototype.setAutoPadding = function (setTo) {
  19910. this._autopadding = !!setTo
  19911. return this
  19912. }
  19913. function Splitter () {
  19914. if (!(this instanceof Splitter)) {
  19915. return new Splitter()
  19916. }
  19917. this.cache = new Buffer('')
  19918. }
  19919. Splitter.prototype.add = function (data) {
  19920. this.cache = Buffer.concat([this.cache, data])
  19921. }
  19922. Splitter.prototype.get = function () {
  19923. if (this.cache.length > 15) {
  19924. var out = this.cache.slice(0, 16)
  19925. this.cache = this.cache.slice(16)
  19926. return out
  19927. }
  19928. return null
  19929. }
  19930. Splitter.prototype.flush = function () {
  19931. var len = 16 - this.cache.length
  19932. var padBuff = new Buffer(len)
  19933. var i = -1
  19934. while (++i < len) {
  19935. padBuff.writeUInt8(len, i)
  19936. }
  19937. var out = Buffer.concat([this.cache, padBuff])
  19938. return out
  19939. }
  19940. var modelist = {
  19941. ECB: __webpack_require__(87),
  19942. CBC: __webpack_require__(83),
  19943. CFB: __webpack_require__(84),
  19944. CFB8: __webpack_require__(86),
  19945. CFB1: __webpack_require__(85),
  19946. OFB: __webpack_require__(88),
  19947. CTR: __webpack_require__(37),
  19948. GCM: __webpack_require__(37)
  19949. }
  19950. function createCipheriv (suite, password, iv) {
  19951. var config = modes[suite.toLowerCase()]
  19952. if (!config) {
  19953. throw new TypeError('invalid suite type')
  19954. }
  19955. if (typeof iv === 'string') {
  19956. iv = new Buffer(iv)
  19957. }
  19958. if (typeof password === 'string') {
  19959. password = new Buffer(password)
  19960. }
  19961. if (password.length !== config.key / 8) {
  19962. throw new TypeError('invalid key length ' + password.length)
  19963. }
  19964. if (iv.length !== config.iv) {
  19965. throw new TypeError('invalid iv length ' + iv.length)
  19966. }
  19967. if (config.type === 'stream') {
  19968. return new StreamCipher(modelist[config.mode], password, iv)
  19969. } else if (config.type === 'auth') {
  19970. return new AuthCipher(modelist[config.mode], password, iv)
  19971. }
  19972. return new Cipher(modelist[config.mode], password, iv)
  19973. }
  19974. function createCipher (suite, password) {
  19975. var config = modes[suite.toLowerCase()]
  19976. if (!config) {
  19977. throw new TypeError('invalid suite type')
  19978. }
  19979. var keys = ebtk(password, false, config.key, config.iv)
  19980. return createCipheriv(suite, keys.key, keys.iv)
  19981. }
  19982. exports.createCipheriv = createCipheriv
  19983. exports.createCipher = createCipher
  19984. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  19985. /***/ },
  19986. /* 167 */
  19987. /***/ function(module, exports, __webpack_require__) {
  19988. /* WEBPACK VAR INJECTION */(function(Buffer) {var zeros = new Buffer(16)
  19989. zeros.fill(0)
  19990. module.exports = GHASH
  19991. function GHASH (key) {
  19992. this.h = key
  19993. this.state = new Buffer(16)
  19994. this.state.fill(0)
  19995. this.cache = new Buffer('')
  19996. }
  19997. // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
  19998. // by Juho Vähä-Herttua
  19999. GHASH.prototype.ghash = function (block) {
  20000. var i = -1
  20001. while (++i < block.length) {
  20002. this.state[i] ^= block[i]
  20003. }
  20004. this._multiply()
  20005. }
  20006. GHASH.prototype._multiply = function () {
  20007. var Vi = toArray(this.h)
  20008. var Zi = [0, 0, 0, 0]
  20009. var j, xi, lsb_Vi
  20010. var i = -1
  20011. while (++i < 128) {
  20012. xi = (this.state[~~(i / 8)] & (1 << (7 - i % 8))) !== 0
  20013. if (xi) {
  20014. // Z_i+1 = Z_i ^ V_i
  20015. Zi = xor(Zi, Vi)
  20016. }
  20017. // Store the value of LSB(V_i)
  20018. lsb_Vi = (Vi[3] & 1) !== 0
  20019. // V_i+1 = V_i >> 1
  20020. for (j = 3; j > 0; j--) {
  20021. Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
  20022. }
  20023. Vi[0] = Vi[0] >>> 1
  20024. // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
  20025. if (lsb_Vi) {
  20026. Vi[0] = Vi[0] ^ (0xe1 << 24)
  20027. }
  20028. }
  20029. this.state = fromArray(Zi)
  20030. }
  20031. GHASH.prototype.update = function (buf) {
  20032. this.cache = Buffer.concat([this.cache, buf])
  20033. var chunk
  20034. while (this.cache.length >= 16) {
  20035. chunk = this.cache.slice(0, 16)
  20036. this.cache = this.cache.slice(16)
  20037. this.ghash(chunk)
  20038. }
  20039. }
  20040. GHASH.prototype.final = function (abl, bl) {
  20041. if (this.cache.length) {
  20042. this.ghash(Buffer.concat([this.cache, zeros], 16))
  20043. }
  20044. this.ghash(fromArray([
  20045. 0, abl,
  20046. 0, bl
  20047. ]))
  20048. return this.state
  20049. }
  20050. function toArray (buf) {
  20051. return [
  20052. buf.readUInt32BE(0),
  20053. buf.readUInt32BE(4),
  20054. buf.readUInt32BE(8),
  20055. buf.readUInt32BE(12)
  20056. ]
  20057. }
  20058. function fromArray (out) {
  20059. out = out.map(fixup_uint32)
  20060. var buf = new Buffer(16)
  20061. buf.writeUInt32BE(out[0], 0)
  20062. buf.writeUInt32BE(out[1], 4)
  20063. buf.writeUInt32BE(out[2], 8)
  20064. buf.writeUInt32BE(out[3], 12)
  20065. return buf
  20066. }
  20067. var uint_max = Math.pow(2, 32)
  20068. function fixup_uint32 (x) {
  20069. var ret, x_pos
  20070. ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x
  20071. return ret
  20072. }
  20073. function xor (a, b) {
  20074. return [
  20075. a[0] ^ b[0],
  20076. a[1] ^ b[1],
  20077. a[2] ^ b[2],
  20078. a[3] ^ b[3]
  20079. ]
  20080. }
  20081. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20082. /***/ },
  20083. /* 168 */
  20084. /***/ function(module, exports, __webpack_require__) {
  20085. var ebtk = __webpack_require__(45)
  20086. var aes = __webpack_require__(49)
  20087. var DES = __webpack_require__(169)
  20088. var desModes = __webpack_require__(170)
  20089. var aesModes = __webpack_require__(36)
  20090. function createCipher (suite, password) {
  20091. var keyLen, ivLen
  20092. suite = suite.toLowerCase()
  20093. if (aesModes[suite]) {
  20094. keyLen = aesModes[suite].key
  20095. ivLen = aesModes[suite].iv
  20096. } else if (desModes[suite]) {
  20097. keyLen = desModes[suite].key * 8
  20098. ivLen = desModes[suite].iv
  20099. } else {
  20100. throw new TypeError('invalid suite type')
  20101. }
  20102. var keys = ebtk(password, false, keyLen, ivLen)
  20103. return createCipheriv(suite, keys.key, keys.iv)
  20104. }
  20105. function createDecipher (suite, password) {
  20106. var keyLen, ivLen
  20107. suite = suite.toLowerCase()
  20108. if (aesModes[suite]) {
  20109. keyLen = aesModes[suite].key
  20110. ivLen = aesModes[suite].iv
  20111. } else if (desModes[suite]) {
  20112. keyLen = desModes[suite].key * 8
  20113. ivLen = desModes[suite].iv
  20114. } else {
  20115. throw new TypeError('invalid suite type')
  20116. }
  20117. var keys = ebtk(password, false, keyLen, ivLen)
  20118. return createDecipheriv(suite, keys.key, keys.iv)
  20119. }
  20120. function createCipheriv (suite, key, iv) {
  20121. suite = suite.toLowerCase()
  20122. if (aesModes[suite]) {
  20123. return aes.createCipheriv(suite, key, iv)
  20124. } else if (desModes[suite]) {
  20125. return new DES({
  20126. key: key,
  20127. iv: iv,
  20128. mode: suite
  20129. })
  20130. } else {
  20131. throw new TypeError('invalid suite type')
  20132. }
  20133. }
  20134. function createDecipheriv (suite, key, iv) {
  20135. suite = suite.toLowerCase()
  20136. if (aesModes[suite]) {
  20137. return aes.createDecipheriv(suite, key, iv)
  20138. } else if (desModes[suite]) {
  20139. return new DES({
  20140. key: key,
  20141. iv: iv,
  20142. mode: suite,
  20143. decrypt: true
  20144. })
  20145. } else {
  20146. throw new TypeError('invalid suite type')
  20147. }
  20148. }
  20149. exports.createCipher = exports.Cipher = createCipher
  20150. exports.createCipheriv = exports.Cipheriv = createCipheriv
  20151. exports.createDecipher = exports.Decipher = createDecipher
  20152. exports.createDecipheriv = exports.Decipheriv = createDecipheriv
  20153. function getCiphers () {
  20154. return Object.keys(desModes).concat(aes.getCiphers())
  20155. }
  20156. exports.listCiphers = exports.getCiphers = getCiphers
  20157. /***/ },
  20158. /* 169 */
  20159. /***/ function(module, exports, __webpack_require__) {
  20160. /* WEBPACK VAR INJECTION */(function(Buffer) {var CipherBase = __webpack_require__(12)
  20161. var des = __webpack_require__(61)
  20162. var inherits = __webpack_require__(1)
  20163. var modes = {
  20164. 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
  20165. 'des-ede3': des.EDE,
  20166. 'des-ede-cbc': des.CBC.instantiate(des.EDE),
  20167. 'des-ede': des.EDE,
  20168. 'des-cbc': des.CBC.instantiate(des.DES),
  20169. 'des-ecb': des.DES
  20170. }
  20171. modes.des = modes['des-cbc']
  20172. modes.des3 = modes['des-ede3-cbc']
  20173. module.exports = DES
  20174. inherits(DES, CipherBase)
  20175. function DES (opts) {
  20176. CipherBase.call(this)
  20177. var modeName = opts.mode.toLowerCase()
  20178. var mode = modes[modeName]
  20179. var type
  20180. if (opts.decrypt) {
  20181. type = 'decrypt'
  20182. } else {
  20183. type = 'encrypt'
  20184. }
  20185. var key = opts.key
  20186. if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
  20187. key = Buffer.concat([key, key.slice(0, 8)])
  20188. }
  20189. var iv = opts.iv
  20190. this._des = mode.create({
  20191. key: key,
  20192. iv: iv,
  20193. type: type
  20194. })
  20195. }
  20196. DES.prototype._update = function (data) {
  20197. return new Buffer(this._des.update(data))
  20198. }
  20199. DES.prototype._final = function () {
  20200. return new Buffer(this._des.final())
  20201. }
  20202. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20203. /***/ },
  20204. /* 170 */
  20205. /***/ function(module, exports) {
  20206. exports['des-ecb'] = {
  20207. key: 8,
  20208. iv: 0
  20209. }
  20210. exports['des-cbc'] = exports.des = {
  20211. key: 8,
  20212. iv: 8
  20213. }
  20214. exports['des-ede3-cbc'] = exports.des3 = {
  20215. key: 24,
  20216. iv: 8
  20217. }
  20218. exports['des-ede3'] = {
  20219. key: 24,
  20220. iv: 0
  20221. }
  20222. exports['des-ede-cbc'] = {
  20223. key: 16,
  20224. iv: 8
  20225. }
  20226. exports['des-ede'] = {
  20227. key: 16,
  20228. iv: 0
  20229. }
  20230. /***/ },
  20231. /* 171 */
  20232. /***/ function(module, exports, __webpack_require__) {
  20233. /* WEBPACK VAR INJECTION */(function(Buffer) {var _algos = __webpack_require__(107)
  20234. var createHash = __webpack_require__(16)
  20235. var inherits = __webpack_require__(1)
  20236. var sign = __webpack_require__(172)
  20237. var stream = __webpack_require__(19)
  20238. var verify = __webpack_require__(173)
  20239. var algos = {}
  20240. Object.keys(_algos).forEach(function (key) {
  20241. algos[key] = algos[key.toLowerCase()] = _algos[key]
  20242. })
  20243. function Sign (algorithm) {
  20244. stream.Writable.call(this)
  20245. var data = algos[algorithm]
  20246. if (!data) {
  20247. throw new Error('Unknown message digest')
  20248. }
  20249. this._hashType = data.hash
  20250. this._hash = createHash(data.hash)
  20251. this._tag = data.id
  20252. this._signType = data.sign
  20253. }
  20254. inherits(Sign, stream.Writable)
  20255. Sign.prototype._write = function _write (data, _, done) {
  20256. this._hash.update(data)
  20257. done()
  20258. }
  20259. Sign.prototype.update = function update (data, enc) {
  20260. if (typeof data === 'string') {
  20261. data = new Buffer(data, enc)
  20262. }
  20263. this._hash.update(data)
  20264. return this
  20265. }
  20266. Sign.prototype.sign = function signMethod (key, enc) {
  20267. this.end()
  20268. var hash = this._hash.digest()
  20269. var sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._signType)
  20270. return enc ? sig.toString(enc) : sig
  20271. }
  20272. function Verify (algorithm) {
  20273. stream.Writable.call(this)
  20274. var data = algos[algorithm]
  20275. if (!data) {
  20276. throw new Error('Unknown message digest')
  20277. }
  20278. this._hash = createHash(data.hash)
  20279. this._tag = data.id
  20280. this._signType = data.sign
  20281. }
  20282. inherits(Verify, stream.Writable)
  20283. Verify.prototype._write = function _write (data, _, done) {
  20284. this._hash.update(data)
  20285. done()
  20286. }
  20287. Verify.prototype.update = function update (data, enc) {
  20288. if (typeof data === 'string') {
  20289. data = new Buffer(data, enc)
  20290. }
  20291. this._hash.update(data)
  20292. return this
  20293. }
  20294. Verify.prototype.verify = function verifyMethod (key, sig, enc) {
  20295. if (typeof sig === 'string') {
  20296. sig = new Buffer(sig, enc)
  20297. }
  20298. this.end()
  20299. var hash = this._hash.digest()
  20300. return verify(sig, Buffer.concat([this._tag, hash]), key, this._signType)
  20301. }
  20302. function createSign (algorithm) {
  20303. return new Sign(algorithm)
  20304. }
  20305. function createVerify (algorithm) {
  20306. return new Verify(algorithm)
  20307. }
  20308. module.exports = {
  20309. Sign: createSign,
  20310. Verify: createVerify,
  20311. createSign: createSign,
  20312. createVerify: createVerify
  20313. }
  20314. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20315. /***/ },
  20316. /* 172 */
  20317. /***/ function(module, exports, __webpack_require__) {
  20318. /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  20319. var createHmac = __webpack_require__(60)
  20320. var crt = __webpack_require__(50)
  20321. var curves = __webpack_require__(90)
  20322. var elliptic = __webpack_require__(3)
  20323. var parseKeys = __webpack_require__(46)
  20324. var BN = __webpack_require__(2)
  20325. var EC = elliptic.ec
  20326. function sign (hash, key, hashType, signType) {
  20327. var priv = parseKeys(key)
  20328. if (priv.curve) {
  20329. if (signType !== 'ecdsa') throw new Error('wrong private key type')
  20330. return ecSign(hash, priv)
  20331. } else if (priv.type === 'dsa') {
  20332. if (signType !== 'dsa') {
  20333. throw new Error('wrong private key type')
  20334. }
  20335. return dsaSign(hash, priv, hashType)
  20336. } else {
  20337. if (signType !== 'rsa') throw new Error('wrong private key type')
  20338. }
  20339. var len = priv.modulus.byteLength()
  20340. var pad = [ 0, 1 ]
  20341. while (hash.length + pad.length + 1 < len) {
  20342. pad.push(0xff)
  20343. }
  20344. pad.push(0x00)
  20345. var i = -1
  20346. while (++i < hash.length) {
  20347. pad.push(hash[i])
  20348. }
  20349. var out = crt(pad, priv)
  20350. return out
  20351. }
  20352. function ecSign (hash, priv) {
  20353. var curveId = curves[priv.curve.join('.')]
  20354. if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
  20355. var curve = new EC(curveId)
  20356. var key = curve.genKeyPair()
  20357. key._importPrivate(priv.privateKey)
  20358. var out = key.sign(hash)
  20359. return new Buffer(out.toDER())
  20360. }
  20361. function dsaSign (hash, priv, algo) {
  20362. var x = priv.params.priv_key
  20363. var p = priv.params.p
  20364. var q = priv.params.q
  20365. var g = priv.params.g
  20366. var r = new BN(0)
  20367. var k
  20368. var H = bits2int(hash, q).mod(q)
  20369. var s = false
  20370. var kv = getKey(x, q, hash, algo)
  20371. while (s === false) {
  20372. k = makeKey(q, kv, algo)
  20373. r = makeR(g, k, p, q)
  20374. s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
  20375. if (!s.cmpn(0)) {
  20376. s = false
  20377. r = new BN(0)
  20378. }
  20379. }
  20380. return toDER(r, s)
  20381. }
  20382. function toDER (r, s) {
  20383. r = r.toArray()
  20384. s = s.toArray()
  20385. // Pad values
  20386. if (r[0] & 0x80) {
  20387. r = [ 0 ].concat(r)
  20388. }
  20389. // Pad values
  20390. if (s[0] & 0x80) {
  20391. s = [0].concat(s)
  20392. }
  20393. var total = r.length + s.length + 4
  20394. var res = [ 0x30, total, 0x02, r.length ]
  20395. res = res.concat(r, [ 0x02, s.length ], s)
  20396. return new Buffer(res)
  20397. }
  20398. function getKey (x, q, hash, algo) {
  20399. x = new Buffer(x.toArray())
  20400. if (x.length < q.byteLength()) {
  20401. var zeros = new Buffer(q.byteLength() - x.length)
  20402. zeros.fill(0)
  20403. x = Buffer.concat([zeros, x])
  20404. }
  20405. var hlen = hash.length
  20406. var hbits = bits2octets(hash, q)
  20407. var v = new Buffer(hlen)
  20408. v.fill(1)
  20409. var k = new Buffer(hlen)
  20410. k.fill(0)
  20411. k = createHmac(algo, k)
  20412. .update(v)
  20413. .update(new Buffer([0]))
  20414. .update(x)
  20415. .update(hbits)
  20416. .digest()
  20417. v = createHmac(algo, k)
  20418. .update(v)
  20419. .digest()
  20420. k = createHmac(algo, k)
  20421. .update(v)
  20422. .update(new Buffer([1]))
  20423. .update(x)
  20424. .update(hbits)
  20425. .digest()
  20426. v = createHmac(algo, k)
  20427. .update(v)
  20428. .digest()
  20429. return {
  20430. k: k,
  20431. v: v
  20432. }
  20433. }
  20434. function bits2int (obits, q) {
  20435. var bits = new BN(obits)
  20436. var shift = (obits.length << 3) - q.bitLength()
  20437. if (shift > 0) {
  20438. bits.ishrn(shift)
  20439. }
  20440. return bits
  20441. }
  20442. function bits2octets (bits, q) {
  20443. bits = bits2int(bits, q)
  20444. bits = bits.mod(q)
  20445. var out = new Buffer(bits.toArray())
  20446. if (out.length < q.byteLength()) {
  20447. var zeros = new Buffer(q.byteLength() - out.length)
  20448. zeros.fill(0)
  20449. out = Buffer.concat([zeros, out])
  20450. }
  20451. return out
  20452. }
  20453. function makeKey (q, kv, algo) {
  20454. var t, k
  20455. do {
  20456. t = new Buffer('')
  20457. while (t.length * 8 < q.bitLength()) {
  20458. kv.v = createHmac(algo, kv.k)
  20459. .update(kv.v)
  20460. .digest()
  20461. t = Buffer.concat([t, kv.v])
  20462. }
  20463. k = bits2int(t, q)
  20464. kv.k = createHmac(algo, kv.k)
  20465. .update(kv.v)
  20466. .update(new Buffer([0]))
  20467. .digest()
  20468. kv.v = createHmac(algo, kv.k)
  20469. .update(kv.v)
  20470. .digest()
  20471. } while (k.cmp(q) !== -1)
  20472. return k
  20473. }
  20474. function makeR (g, k, p, q) {
  20475. return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
  20476. }
  20477. module.exports = sign
  20478. module.exports.getKey = getKey
  20479. module.exports.makeKey = makeKey
  20480. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20481. /***/ },
  20482. /* 173 */
  20483. /***/ function(module, exports, __webpack_require__) {
  20484. /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  20485. var curves = __webpack_require__(90)
  20486. var elliptic = __webpack_require__(3)
  20487. var parseKeys = __webpack_require__(46)
  20488. var BN = __webpack_require__(2)
  20489. var EC = elliptic.ec
  20490. function verify (sig, hash, key, signType) {
  20491. var pub = parseKeys(key)
  20492. if (pub.type === 'ec') {
  20493. if (signType !== 'ecdsa') {
  20494. throw new Error('wrong public key type')
  20495. }
  20496. return ecVerify(sig, hash, pub)
  20497. } else if (pub.type === 'dsa') {
  20498. if (signType !== 'dsa') {
  20499. throw new Error('wrong public key type')
  20500. }
  20501. return dsaVerify(sig, hash, pub)
  20502. } else {
  20503. if (signType !== 'rsa') {
  20504. throw new Error('wrong public key type')
  20505. }
  20506. }
  20507. var len = pub.modulus.byteLength()
  20508. var pad = [ 1 ]
  20509. var padNum = 0
  20510. while (hash.length + pad.length + 2 < len) {
  20511. pad.push(0xff)
  20512. padNum++
  20513. }
  20514. pad.push(0x00)
  20515. var i = -1
  20516. while (++i < hash.length) {
  20517. pad.push(hash[i])
  20518. }
  20519. pad = new Buffer(pad)
  20520. var red = BN.mont(pub.modulus)
  20521. sig = new BN(sig).toRed(red)
  20522. sig = sig.redPow(new BN(pub.publicExponent))
  20523. sig = new Buffer(sig.fromRed().toArray())
  20524. var out = 0
  20525. if (padNum < 8) {
  20526. out = 1
  20527. }
  20528. len = Math.min(sig.length, pad.length)
  20529. if (sig.length !== pad.length) {
  20530. out = 1
  20531. }
  20532. i = -1
  20533. while (++i < len) {
  20534. out |= (sig[i] ^ pad[i])
  20535. }
  20536. return out === 0
  20537. }
  20538. function ecVerify (sig, hash, pub) {
  20539. var curveId = curves[pub.data.algorithm.curve.join('.')]
  20540. if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
  20541. var curve = new EC(curveId)
  20542. var pubkey = pub.data.subjectPrivateKey.data
  20543. return curve.verify(hash, sig, pubkey)
  20544. }
  20545. function dsaVerify (sig, hash, pub) {
  20546. var p = pub.data.p
  20547. var q = pub.data.q
  20548. var g = pub.data.g
  20549. var y = pub.data.pub_key
  20550. var unpacked = parseKeys.signature.decode(sig, 'der')
  20551. var s = unpacked.s
  20552. var r = unpacked.r
  20553. checkValue(s, q)
  20554. checkValue(r, q)
  20555. var montp = BN.mont(p)
  20556. var w = s.invm(q)
  20557. var v = g.toRed(montp)
  20558. .redPow(new BN(hash).mul(w).mod(q))
  20559. .fromRed()
  20560. .mul(
  20561. y.toRed(montp)
  20562. .redPow(r.mul(w).mod(q))
  20563. .fromRed()
  20564. ).mod(p).mod(q)
  20565. return !v.cmp(r)
  20566. }
  20567. function checkValue (b, q) {
  20568. if (b.cmpn(0) <= 0) {
  20569. throw new Error('invalid sig')
  20570. }
  20571. if (b.cmp(q) >= q) {
  20572. throw new Error('invalid sig')
  20573. }
  20574. }
  20575. module.exports = verify
  20576. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20577. /***/ },
  20578. /* 174 */
  20579. /***/ function(module, exports, __webpack_require__) {
  20580. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  20581. if (true) {
  20582. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(275)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  20583. } else if (typeof exports !== "undefined") {
  20584. factory(module, require('select'));
  20585. } else {
  20586. var mod = {
  20587. exports: {}
  20588. };
  20589. factory(mod, global.select);
  20590. global.clipboardAction = mod.exports;
  20591. }
  20592. })(this, function (module, _select) {
  20593. 'use strict';
  20594. var _select2 = _interopRequireDefault(_select);
  20595. function _interopRequireDefault(obj) {
  20596. return obj && obj.__esModule ? obj : {
  20597. default: obj
  20598. };
  20599. }
  20600. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  20601. return typeof obj;
  20602. } : function (obj) {
  20603. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  20604. };
  20605. function _classCallCheck(instance, Constructor) {
  20606. if (!(instance instanceof Constructor)) {
  20607. throw new TypeError("Cannot call a class as a function");
  20608. }
  20609. }
  20610. var _createClass = function () {
  20611. function defineProperties(target, props) {
  20612. for (var i = 0; i < props.length; i++) {
  20613. var descriptor = props[i];
  20614. descriptor.enumerable = descriptor.enumerable || false;
  20615. descriptor.configurable = true;
  20616. if ("value" in descriptor) descriptor.writable = true;
  20617. Object.defineProperty(target, descriptor.key, descriptor);
  20618. }
  20619. }
  20620. return function (Constructor, protoProps, staticProps) {
  20621. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  20622. if (staticProps) defineProperties(Constructor, staticProps);
  20623. return Constructor;
  20624. };
  20625. }();
  20626. var ClipboardAction = function () {
  20627. /**
  20628. * @param {Object} options
  20629. */
  20630. function ClipboardAction(options) {
  20631. _classCallCheck(this, ClipboardAction);
  20632. this.resolveOptions(options);
  20633. this.initSelection();
  20634. }
  20635. /**
  20636. * Defines base properties passed from constructor.
  20637. * @param {Object} options
  20638. */
  20639. _createClass(ClipboardAction, [{
  20640. key: 'resolveOptions',
  20641. value: function resolveOptions() {
  20642. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20643. this.action = options.action;
  20644. this.emitter = options.emitter;
  20645. this.target = options.target;
  20646. this.text = options.text;
  20647. this.trigger = options.trigger;
  20648. this.selectedText = '';
  20649. }
  20650. }, {
  20651. key: 'initSelection',
  20652. value: function initSelection() {
  20653. if (this.text) {
  20654. this.selectFake();
  20655. } else if (this.target) {
  20656. this.selectTarget();
  20657. }
  20658. }
  20659. }, {
  20660. key: 'selectFake',
  20661. value: function selectFake() {
  20662. var _this = this;
  20663. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  20664. this.removeFake();
  20665. this.fakeHandlerCallback = function () {
  20666. return _this.removeFake();
  20667. };
  20668. this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
  20669. this.fakeElem = document.createElement('textarea');
  20670. // Prevent zooming on iOS
  20671. this.fakeElem.style.fontSize = '12pt';
  20672. // Reset box model
  20673. this.fakeElem.style.border = '0';
  20674. this.fakeElem.style.padding = '0';
  20675. this.fakeElem.style.margin = '0';
  20676. // Move element out of screen horizontally
  20677. this.fakeElem.style.position = 'absolute';
  20678. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  20679. // Move element to the same position vertically
  20680. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  20681. this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
  20682. this.fakeElem.style.top = yPosition + 'px';
  20683. this.fakeElem.setAttribute('readonly', '');
  20684. this.fakeElem.value = this.text;
  20685. document.body.appendChild(this.fakeElem);
  20686. this.selectedText = (0, _select2.default)(this.fakeElem);
  20687. this.copyText();
  20688. }
  20689. }, {
  20690. key: 'removeFake',
  20691. value: function removeFake() {
  20692. if (this.fakeHandler) {
  20693. document.body.removeEventListener('click', this.fakeHandlerCallback);
  20694. this.fakeHandler = null;
  20695. this.fakeHandlerCallback = null;
  20696. }
  20697. if (this.fakeElem) {
  20698. document.body.removeChild(this.fakeElem);
  20699. this.fakeElem = null;
  20700. }
  20701. }
  20702. }, {
  20703. key: 'selectTarget',
  20704. value: function selectTarget() {
  20705. this.selectedText = (0, _select2.default)(this.target);
  20706. this.copyText();
  20707. }
  20708. }, {
  20709. key: 'copyText',
  20710. value: function copyText() {
  20711. var succeeded = void 0;
  20712. try {
  20713. succeeded = document.execCommand(this.action);
  20714. } catch (err) {
  20715. succeeded = false;
  20716. }
  20717. this.handleResult(succeeded);
  20718. }
  20719. }, {
  20720. key: 'handleResult',
  20721. value: function handleResult(succeeded) {
  20722. this.emitter.emit(succeeded ? 'success' : 'error', {
  20723. action: this.action,
  20724. text: this.selectedText,
  20725. trigger: this.trigger,
  20726. clearSelection: this.clearSelection.bind(this)
  20727. });
  20728. }
  20729. }, {
  20730. key: 'clearSelection',
  20731. value: function clearSelection() {
  20732. if (this.target) {
  20733. this.target.blur();
  20734. }
  20735. window.getSelection().removeAllRanges();
  20736. }
  20737. }, {
  20738. key: 'destroy',
  20739. value: function destroy() {
  20740. this.removeFake();
  20741. }
  20742. }, {
  20743. key: 'action',
  20744. set: function set() {
  20745. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  20746. this._action = action;
  20747. if (this._action !== 'copy' && this._action !== 'cut') {
  20748. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  20749. }
  20750. },
  20751. get: function get() {
  20752. return this._action;
  20753. }
  20754. }, {
  20755. key: 'target',
  20756. set: function set(target) {
  20757. if (target !== undefined) {
  20758. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  20759. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  20760. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  20761. }
  20762. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  20763. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  20764. }
  20765. this._target = target;
  20766. } else {
  20767. throw new Error('Invalid "target" value, use a valid Element');
  20768. }
  20769. }
  20770. },
  20771. get: function get() {
  20772. return this._target;
  20773. }
  20774. }]);
  20775. return ClipboardAction;
  20776. }();
  20777. module.exports = ClipboardAction;
  20778. });
  20779. /***/ },
  20780. /* 175 */
  20781. /***/ function(module, exports, __webpack_require__) {
  20782. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  20783. if (true) {
  20784. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(174), __webpack_require__(281), __webpack_require__(247)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  20785. } else if (typeof exports !== "undefined") {
  20786. factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
  20787. } else {
  20788. var mod = {
  20789. exports: {}
  20790. };
  20791. factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
  20792. global.clipboard = mod.exports;
  20793. }
  20794. })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
  20795. 'use strict';
  20796. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  20797. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  20798. var _goodListener2 = _interopRequireDefault(_goodListener);
  20799. function _interopRequireDefault(obj) {
  20800. return obj && obj.__esModule ? obj : {
  20801. default: obj
  20802. };
  20803. }
  20804. function _classCallCheck(instance, Constructor) {
  20805. if (!(instance instanceof Constructor)) {
  20806. throw new TypeError("Cannot call a class as a function");
  20807. }
  20808. }
  20809. var _createClass = function () {
  20810. function defineProperties(target, props) {
  20811. for (var i = 0; i < props.length; i++) {
  20812. var descriptor = props[i];
  20813. descriptor.enumerable = descriptor.enumerable || false;
  20814. descriptor.configurable = true;
  20815. if ("value" in descriptor) descriptor.writable = true;
  20816. Object.defineProperty(target, descriptor.key, descriptor);
  20817. }
  20818. }
  20819. return function (Constructor, protoProps, staticProps) {
  20820. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  20821. if (staticProps) defineProperties(Constructor, staticProps);
  20822. return Constructor;
  20823. };
  20824. }();
  20825. function _possibleConstructorReturn(self, call) {
  20826. if (!self) {
  20827. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  20828. }
  20829. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  20830. }
  20831. function _inherits(subClass, superClass) {
  20832. if (typeof superClass !== "function" && superClass !== null) {
  20833. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  20834. }
  20835. subClass.prototype = Object.create(superClass && superClass.prototype, {
  20836. constructor: {
  20837. value: subClass,
  20838. enumerable: false,
  20839. writable: true,
  20840. configurable: true
  20841. }
  20842. });
  20843. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  20844. }
  20845. var Clipboard = function (_Emitter) {
  20846. _inherits(Clipboard, _Emitter);
  20847. /**
  20848. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  20849. * @param {Object} options
  20850. */
  20851. function Clipboard(trigger, options) {
  20852. _classCallCheck(this, Clipboard);
  20853. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  20854. _this.resolveOptions(options);
  20855. _this.listenClick(trigger);
  20856. return _this;
  20857. }
  20858. /**
  20859. * Defines if attributes would be resolved using internal setter functions
  20860. * or custom functions that were passed in the constructor.
  20861. * @param {Object} options
  20862. */
  20863. _createClass(Clipboard, [{
  20864. key: 'resolveOptions',
  20865. value: function resolveOptions() {
  20866. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20867. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  20868. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  20869. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  20870. }
  20871. }, {
  20872. key: 'listenClick',
  20873. value: function listenClick(trigger) {
  20874. var _this2 = this;
  20875. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  20876. return _this2.onClick(e);
  20877. });
  20878. }
  20879. }, {
  20880. key: 'onClick',
  20881. value: function onClick(e) {
  20882. var trigger = e.delegateTarget || e.currentTarget;
  20883. if (this.clipboardAction) {
  20884. this.clipboardAction = null;
  20885. }
  20886. this.clipboardAction = new _clipboardAction2.default({
  20887. action: this.action(trigger),
  20888. target: this.target(trigger),
  20889. text: this.text(trigger),
  20890. trigger: trigger,
  20891. emitter: this
  20892. });
  20893. }
  20894. }, {
  20895. key: 'defaultAction',
  20896. value: function defaultAction(trigger) {
  20897. return getAttributeValue('action', trigger);
  20898. }
  20899. }, {
  20900. key: 'defaultTarget',
  20901. value: function defaultTarget(trigger) {
  20902. var selector = getAttributeValue('target', trigger);
  20903. if (selector) {
  20904. return document.querySelector(selector);
  20905. }
  20906. }
  20907. }, {
  20908. key: 'defaultText',
  20909. value: function defaultText(trigger) {
  20910. return getAttributeValue('text', trigger);
  20911. }
  20912. }, {
  20913. key: 'destroy',
  20914. value: function destroy() {
  20915. this.listener.destroy();
  20916. if (this.clipboardAction) {
  20917. this.clipboardAction.destroy();
  20918. this.clipboardAction = null;
  20919. }
  20920. }
  20921. }]);
  20922. return Clipboard;
  20923. }(_tinyEmitter2.default);
  20924. /**
  20925. * Helper function to retrieve attribute value.
  20926. * @param {String} suffix
  20927. * @param {Element} element
  20928. */
  20929. function getAttributeValue(suffix, element) {
  20930. var attribute = 'data-clipboard-' + suffix;
  20931. if (!element.hasAttribute(attribute)) {
  20932. return;
  20933. }
  20934. return element.getAttribute(attribute);
  20935. }
  20936. module.exports = Clipboard;
  20937. });
  20938. /***/ },
  20939. /* 176 */
  20940. /***/ function(module, exports, __webpack_require__) {
  20941. var core = __webpack_require__(8)
  20942. , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
  20943. module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
  20944. return $JSON.stringify.apply($JSON, arguments);
  20945. };
  20946. /***/ },
  20947. /* 177 */
  20948. /***/ function(module, exports, __webpack_require__) {
  20949. __webpack_require__(208);
  20950. module.exports = __webpack_require__(8).Object.assign;
  20951. /***/ },
  20952. /* 178 */
  20953. /***/ function(module, exports, __webpack_require__) {
  20954. __webpack_require__(209);
  20955. var $Object = __webpack_require__(8).Object;
  20956. module.exports = function defineProperty(it, key, desc){
  20957. return $Object.defineProperty(it, key, desc);
  20958. };
  20959. /***/ },
  20960. /* 179 */
  20961. /***/ function(module, exports, __webpack_require__) {
  20962. __webpack_require__(210);
  20963. __webpack_require__(212);
  20964. __webpack_require__(213);
  20965. __webpack_require__(211);
  20966. module.exports = __webpack_require__(8).Promise;
  20967. /***/ },
  20968. /* 180 */
  20969. /***/ function(module, exports) {
  20970. module.exports = function(){ /* empty */ };
  20971. /***/ },
  20972. /* 181 */
  20973. /***/ function(module, exports) {
  20974. module.exports = function(it, Constructor, name, forbiddenField){
  20975. if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
  20976. throw TypeError(name + ': incorrect invocation!');
  20977. } return it;
  20978. };
  20979. /***/ },
  20980. /* 182 */
  20981. /***/ function(module, exports, __webpack_require__) {
  20982. // false -> Array#indexOf
  20983. // true -> Array#includes
  20984. var toIObject = __webpack_require__(59)
  20985. , toLength = __webpack_require__(101)
  20986. , toIndex = __webpack_require__(204);
  20987. module.exports = function(IS_INCLUDES){
  20988. return function($this, el, fromIndex){
  20989. var O = toIObject($this)
  20990. , length = toLength(O.length)
  20991. , index = toIndex(fromIndex, length)
  20992. , value;
  20993. // Array#includes uses SameValueZero equality algorithm
  20994. if(IS_INCLUDES && el != el)while(length > index){
  20995. value = O[index++];
  20996. if(value != value)return true;
  20997. // Array#toIndex ignores holes, Array#includes - not
  20998. } else for(;length > index; index++)if(IS_INCLUDES || index in O){
  20999. if(O[index] === el)return IS_INCLUDES || index || 0;
  21000. } return !IS_INCLUDES && -1;
  21001. };
  21002. };
  21003. /***/ },
  21004. /* 183 */
  21005. /***/ function(module, exports, __webpack_require__) {
  21006. var ctx = __webpack_require__(39)
  21007. , call = __webpack_require__(187)
  21008. , isArrayIter = __webpack_require__(186)
  21009. , anObject = __webpack_require__(13)
  21010. , toLength = __webpack_require__(101)
  21011. , getIterFn = __webpack_require__(206)
  21012. , BREAK = {}
  21013. , RETURN = {};
  21014. var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
  21015. var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
  21016. , f = ctx(fn, that, entries ? 2 : 1)
  21017. , index = 0
  21018. , length, step, iterator, result;
  21019. if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
  21020. // fast case for arrays with default iterator
  21021. if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
  21022. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  21023. if(result === BREAK || result === RETURN)return result;
  21024. } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
  21025. result = call(iterator, f, step.value, entries);
  21026. if(result === BREAK || result === RETURN)return result;
  21027. }
  21028. };
  21029. exports.BREAK = BREAK;
  21030. exports.RETURN = RETURN;
  21031. /***/ },
  21032. /* 184 */
  21033. /***/ function(module, exports, __webpack_require__) {
  21034. module.exports = !__webpack_require__(14) && !__webpack_require__(55)(function(){
  21035. return Object.defineProperty(__webpack_require__(54)('div'), 'a', {get: function(){ return 7; }}).a != 7;
  21036. });
  21037. /***/ },
  21038. /* 185 */
  21039. /***/ function(module, exports) {
  21040. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  21041. module.exports = function(fn, args, that){
  21042. var un = that === undefined;
  21043. switch(args.length){
  21044. case 0: return un ? fn()
  21045. : fn.call(that);
  21046. case 1: return un ? fn(args[0])
  21047. : fn.call(that, args[0]);
  21048. case 2: return un ? fn(args[0], args[1])
  21049. : fn.call(that, args[0], args[1]);
  21050. case 3: return un ? fn(args[0], args[1], args[2])
  21051. : fn.call(that, args[0], args[1], args[2]);
  21052. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  21053. : fn.call(that, args[0], args[1], args[2], args[3]);
  21054. } return fn.apply(that, args);
  21055. };
  21056. /***/ },
  21057. /* 186 */
  21058. /***/ function(module, exports, __webpack_require__) {
  21059. // check on default Array iterator
  21060. var Iterators = __webpack_require__(27)
  21061. , ITERATOR = __webpack_require__(5)('iterator')
  21062. , ArrayProto = Array.prototype;
  21063. module.exports = function(it){
  21064. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  21065. };
  21066. /***/ },
  21067. /* 187 */
  21068. /***/ function(module, exports, __webpack_require__) {
  21069. // call something on iterator step with safe closing on error
  21070. var anObject = __webpack_require__(13);
  21071. module.exports = function(iterator, fn, value, entries){
  21072. try {
  21073. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  21074. // 7.4.6 IteratorClose(iterator, completion)
  21075. } catch(e){
  21076. var ret = iterator['return'];
  21077. if(ret !== undefined)anObject(ret.call(iterator));
  21078. throw e;
  21079. }
  21080. };
  21081. /***/ },
  21082. /* 188 */
  21083. /***/ function(module, exports, __webpack_require__) {
  21084. "use strict";
  21085. 'use strict';
  21086. var create = __webpack_require__(193)
  21087. , descriptor = __webpack_require__(98)
  21088. , setToStringTag = __webpack_require__(56)
  21089. , IteratorPrototype = {};
  21090. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  21091. __webpack_require__(15)(IteratorPrototype, __webpack_require__(5)('iterator'), function(){ return this; });
  21092. module.exports = function(Constructor, NAME, next){
  21093. Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
  21094. setToStringTag(Constructor, NAME + ' Iterator');
  21095. };
  21096. /***/ },
  21097. /* 189 */
  21098. /***/ function(module, exports, __webpack_require__) {
  21099. var ITERATOR = __webpack_require__(5)('iterator')
  21100. , SAFE_CLOSING = false;
  21101. try {
  21102. var riter = [7][ITERATOR]();
  21103. riter['return'] = function(){ SAFE_CLOSING = true; };
  21104. Array.from(riter, function(){ throw 2; });
  21105. } catch(e){ /* empty */ }
  21106. module.exports = function(exec, skipClosing){
  21107. if(!skipClosing && !SAFE_CLOSING)return false;
  21108. var safe = false;
  21109. try {
  21110. var arr = [7]
  21111. , iter = arr[ITERATOR]();
  21112. iter.next = function(){ return {done: safe = true}; };
  21113. arr[ITERATOR] = function(){ return iter; };
  21114. exec(arr);
  21115. } catch(e){ /* empty */ }
  21116. return safe;
  21117. };
  21118. /***/ },
  21119. /* 190 */
  21120. /***/ function(module, exports) {
  21121. module.exports = function(done, value){
  21122. return {value: value, done: !!done};
  21123. };
  21124. /***/ },
  21125. /* 191 */
  21126. /***/ function(module, exports, __webpack_require__) {
  21127. var global = __webpack_require__(6)
  21128. , macrotask = __webpack_require__(100).set
  21129. , Observer = global.MutationObserver || global.WebKitMutationObserver
  21130. , process = global.process
  21131. , Promise = global.Promise
  21132. , isNode = __webpack_require__(38)(process) == 'process';
  21133. module.exports = function(){
  21134. var head, last, notify;
  21135. var flush = function(){
  21136. var parent, fn;
  21137. if(isNode && (parent = process.domain))parent.exit();
  21138. while(head){
  21139. fn = head.fn;
  21140. head = head.next;
  21141. try {
  21142. fn();
  21143. } catch(e){
  21144. if(head)notify();
  21145. else last = undefined;
  21146. throw e;
  21147. }
  21148. } last = undefined;
  21149. if(parent)parent.enter();
  21150. };
  21151. // Node.js
  21152. if(isNode){
  21153. notify = function(){
  21154. process.nextTick(flush);
  21155. };
  21156. // browsers with MutationObserver
  21157. } else if(Observer){
  21158. var toggle = true
  21159. , node = document.createTextNode('');
  21160. new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
  21161. notify = function(){
  21162. node.data = toggle = !toggle;
  21163. };
  21164. // environments with maybe non-completely correct, but existent Promise
  21165. } else if(Promise && Promise.resolve){
  21166. var promise = Promise.resolve();
  21167. notify = function(){
  21168. promise.then(flush);
  21169. };
  21170. // for other environments - macrotask based on:
  21171. // - setImmediate
  21172. // - MessageChannel
  21173. // - window.postMessag
  21174. // - onreadystatechange
  21175. // - setTimeout
  21176. } else {
  21177. notify = function(){
  21178. // strange IE + webpack dev server bug - use .call(global)
  21179. macrotask.call(global, flush);
  21180. };
  21181. }
  21182. return function(fn){
  21183. var task = {fn: fn, next: undefined};
  21184. if(last)last.next = task;
  21185. if(!head){
  21186. head = task;
  21187. notify();
  21188. } last = task;
  21189. };
  21190. };
  21191. /***/ },
  21192. /* 192 */
  21193. /***/ function(module, exports, __webpack_require__) {
  21194. "use strict";
  21195. 'use strict';
  21196. // 19.1.2.1 Object.assign(target, source, ...)
  21197. var getKeys = __webpack_require__(97)
  21198. , gOPS = __webpack_require__(195)
  21199. , pIE = __webpack_require__(198)
  21200. , toObject = __webpack_require__(102)
  21201. , IObject = __webpack_require__(94)
  21202. , $assign = Object.assign;
  21203. // should work with symbols and should have deterministic property order (V8 bug)
  21204. module.exports = !$assign || __webpack_require__(55)(function(){
  21205. var A = {}
  21206. , B = {}
  21207. , S = Symbol()
  21208. , K = 'abcdefghijklmnopqrst';
  21209. A[S] = 7;
  21210. K.split('').forEach(function(k){ B[k] = k; });
  21211. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  21212. }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
  21213. var T = toObject(target)
  21214. , aLen = arguments.length
  21215. , index = 1
  21216. , getSymbols = gOPS.f
  21217. , isEnum = pIE.f;
  21218. while(aLen > index){
  21219. var S = IObject(arguments[index++])
  21220. , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
  21221. , length = keys.length
  21222. , j = 0
  21223. , key;
  21224. while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
  21225. } return T;
  21226. } : $assign;
  21227. /***/ },
  21228. /* 193 */
  21229. /***/ function(module, exports, __webpack_require__) {
  21230. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  21231. var anObject = __webpack_require__(13)
  21232. , dPs = __webpack_require__(194)
  21233. , enumBugKeys = __webpack_require__(92)
  21234. , IE_PROTO = __webpack_require__(57)('IE_PROTO')
  21235. , Empty = function(){ /* empty */ }
  21236. , PROTOTYPE = 'prototype';
  21237. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  21238. var createDict = function(){
  21239. // Thrash, waste and sodomy: IE GC bug
  21240. var iframe = __webpack_require__(54)('iframe')
  21241. , i = enumBugKeys.length
  21242. , lt = '<'
  21243. , gt = '>'
  21244. , iframeDocument;
  21245. iframe.style.display = 'none';
  21246. __webpack_require__(93).appendChild(iframe);
  21247. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  21248. // createDict = iframe.contentWindow.Object;
  21249. // html.removeChild(iframe);
  21250. iframeDocument = iframe.contentWindow.document;
  21251. iframeDocument.open();
  21252. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  21253. iframeDocument.close();
  21254. createDict = iframeDocument.F;
  21255. while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
  21256. return createDict();
  21257. };
  21258. module.exports = Object.create || function create(O, Properties){
  21259. var result;
  21260. if(O !== null){
  21261. Empty[PROTOTYPE] = anObject(O);
  21262. result = new Empty;
  21263. Empty[PROTOTYPE] = null;
  21264. // add "__proto__" for Object.getPrototypeOf polyfill
  21265. result[IE_PROTO] = O;
  21266. } else result = createDict();
  21267. return Properties === undefined ? result : dPs(result, Properties);
  21268. };
  21269. /***/ },
  21270. /* 194 */
  21271. /***/ function(module, exports, __webpack_require__) {
  21272. var dP = __webpack_require__(28)
  21273. , anObject = __webpack_require__(13)
  21274. , getKeys = __webpack_require__(97);
  21275. module.exports = __webpack_require__(14) ? Object.defineProperties : function defineProperties(O, Properties){
  21276. anObject(O);
  21277. var keys = getKeys(Properties)
  21278. , length = keys.length
  21279. , i = 0
  21280. , P;
  21281. while(length > i)dP.f(O, P = keys[i++], Properties[P]);
  21282. return O;
  21283. };
  21284. /***/ },
  21285. /* 195 */
  21286. /***/ function(module, exports) {
  21287. exports.f = Object.getOwnPropertySymbols;
  21288. /***/ },
  21289. /* 196 */
  21290. /***/ function(module, exports, __webpack_require__) {
  21291. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  21292. var has = __webpack_require__(41)
  21293. , toObject = __webpack_require__(102)
  21294. , IE_PROTO = __webpack_require__(57)('IE_PROTO')
  21295. , ObjectProto = Object.prototype;
  21296. module.exports = Object.getPrototypeOf || function(O){
  21297. O = toObject(O);
  21298. if(has(O, IE_PROTO))return O[IE_PROTO];
  21299. if(typeof O.constructor == 'function' && O instanceof O.constructor){
  21300. return O.constructor.prototype;
  21301. } return O instanceof Object ? ObjectProto : null;
  21302. };
  21303. /***/ },
  21304. /* 197 */
  21305. /***/ function(module, exports, __webpack_require__) {
  21306. var has = __webpack_require__(41)
  21307. , toIObject = __webpack_require__(59)
  21308. , arrayIndexOf = __webpack_require__(182)(false)
  21309. , IE_PROTO = __webpack_require__(57)('IE_PROTO');
  21310. module.exports = function(object, names){
  21311. var O = toIObject(object)
  21312. , i = 0
  21313. , result = []
  21314. , key;
  21315. for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
  21316. // Don't enum bug & hidden keys
  21317. while(names.length > i)if(has(O, key = names[i++])){
  21318. ~arrayIndexOf(result, key) || result.push(key);
  21319. }
  21320. return result;
  21321. };
  21322. /***/ },
  21323. /* 198 */
  21324. /***/ function(module, exports) {
  21325. exports.f = {}.propertyIsEnumerable;
  21326. /***/ },
  21327. /* 199 */
  21328. /***/ function(module, exports, __webpack_require__) {
  21329. var hide = __webpack_require__(15);
  21330. module.exports = function(target, src, safe){
  21331. for(var key in src){
  21332. if(safe && target[key])target[key] = src[key];
  21333. else hide(target, key, src[key]);
  21334. } return target;
  21335. };
  21336. /***/ },
  21337. /* 200 */
  21338. /***/ function(module, exports, __webpack_require__) {
  21339. module.exports = __webpack_require__(15);
  21340. /***/ },
  21341. /* 201 */
  21342. /***/ function(module, exports, __webpack_require__) {
  21343. "use strict";
  21344. 'use strict';
  21345. var global = __webpack_require__(6)
  21346. , core = __webpack_require__(8)
  21347. , dP = __webpack_require__(28)
  21348. , DESCRIPTORS = __webpack_require__(14)
  21349. , SPECIES = __webpack_require__(5)('species');
  21350. module.exports = function(KEY){
  21351. var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  21352. if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
  21353. configurable: true,
  21354. get: function(){ return this; }
  21355. });
  21356. };
  21357. /***/ },
  21358. /* 202 */
  21359. /***/ function(module, exports, __webpack_require__) {
  21360. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  21361. var anObject = __webpack_require__(13)
  21362. , aFunction = __webpack_require__(52)
  21363. , SPECIES = __webpack_require__(5)('species');
  21364. module.exports = function(O, D){
  21365. var C = anObject(O).constructor, S;
  21366. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
  21367. };
  21368. /***/ },
  21369. /* 203 */
  21370. /***/ function(module, exports, __webpack_require__) {
  21371. var toInteger = __webpack_require__(58)
  21372. , defined = __webpack_require__(53);
  21373. // true -> String#at
  21374. // false -> String#codePointAt
  21375. module.exports = function(TO_STRING){
  21376. return function(that, pos){
  21377. var s = String(defined(that))
  21378. , i = toInteger(pos)
  21379. , l = s.length
  21380. , a, b;
  21381. if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
  21382. a = s.charCodeAt(i);
  21383. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  21384. ? TO_STRING ? s.charAt(i) : a
  21385. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  21386. };
  21387. };
  21388. /***/ },
  21389. /* 204 */
  21390. /***/ function(module, exports, __webpack_require__) {
  21391. var toInteger = __webpack_require__(58)
  21392. , max = Math.max
  21393. , min = Math.min;
  21394. module.exports = function(index, length){
  21395. index = toInteger(index);
  21396. return index < 0 ? max(index + length, 0) : min(index, length);
  21397. };
  21398. /***/ },
  21399. /* 205 */
  21400. /***/ function(module, exports, __webpack_require__) {
  21401. // 7.1.1 ToPrimitive(input [, PreferredType])
  21402. var isObject = __webpack_require__(42);
  21403. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  21404. // and the second argument - flag - preferred type is a string
  21405. module.exports = function(it, S){
  21406. if(!isObject(it))return it;
  21407. var fn, val;
  21408. if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  21409. if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
  21410. if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  21411. throw TypeError("Can't convert object to primitive value");
  21412. };
  21413. /***/ },
  21414. /* 206 */
  21415. /***/ function(module, exports, __webpack_require__) {
  21416. var classof = __webpack_require__(91)
  21417. , ITERATOR = __webpack_require__(5)('iterator')
  21418. , Iterators = __webpack_require__(27);
  21419. module.exports = __webpack_require__(8).getIteratorMethod = function(it){
  21420. if(it != undefined)return it[ITERATOR]
  21421. || it['@@iterator']
  21422. || Iterators[classof(it)];
  21423. };
  21424. /***/ },
  21425. /* 207 */
  21426. /***/ function(module, exports, __webpack_require__) {
  21427. "use strict";
  21428. 'use strict';
  21429. var addToUnscopables = __webpack_require__(180)
  21430. , step = __webpack_require__(190)
  21431. , Iterators = __webpack_require__(27)
  21432. , toIObject = __webpack_require__(59);
  21433. // 22.1.3.4 Array.prototype.entries()
  21434. // 22.1.3.13 Array.prototype.keys()
  21435. // 22.1.3.29 Array.prototype.values()
  21436. // 22.1.3.30 Array.prototype[@@iterator]()
  21437. module.exports = __webpack_require__(95)(Array, 'Array', function(iterated, kind){
  21438. this._t = toIObject(iterated); // target
  21439. this._i = 0; // next index
  21440. this._k = kind; // kind
  21441. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  21442. }, function(){
  21443. var O = this._t
  21444. , kind = this._k
  21445. , index = this._i++;
  21446. if(!O || index >= O.length){
  21447. this._t = undefined;
  21448. return step(1);
  21449. }
  21450. if(kind == 'keys' )return step(0, index);
  21451. if(kind == 'values')return step(0, O[index]);
  21452. return step(0, [index, O[index]]);
  21453. }, 'values');
  21454. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  21455. Iterators.Arguments = Iterators.Array;
  21456. addToUnscopables('keys');
  21457. addToUnscopables('values');
  21458. addToUnscopables('entries');
  21459. /***/ },
  21460. /* 208 */
  21461. /***/ function(module, exports, __webpack_require__) {
  21462. // 19.1.3.1 Object.assign(target, source)
  21463. var $export = __webpack_require__(40);
  21464. $export($export.S + $export.F, 'Object', {assign: __webpack_require__(192)});
  21465. /***/ },
  21466. /* 209 */
  21467. /***/ function(module, exports, __webpack_require__) {
  21468. var $export = __webpack_require__(40);
  21469. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  21470. $export($export.S + $export.F * !__webpack_require__(14), 'Object', {defineProperty: __webpack_require__(28).f});
  21471. /***/ },
  21472. /* 210 */
  21473. /***/ function(module, exports) {
  21474. /***/ },
  21475. /* 211 */
  21476. /***/ function(module, exports, __webpack_require__) {
  21477. "use strict";
  21478. 'use strict';
  21479. var LIBRARY = __webpack_require__(96)
  21480. , global = __webpack_require__(6)
  21481. , ctx = __webpack_require__(39)
  21482. , classof = __webpack_require__(91)
  21483. , $export = __webpack_require__(40)
  21484. , isObject = __webpack_require__(42)
  21485. , aFunction = __webpack_require__(52)
  21486. , anInstance = __webpack_require__(181)
  21487. , forOf = __webpack_require__(183)
  21488. , speciesConstructor = __webpack_require__(202)
  21489. , task = __webpack_require__(100).set
  21490. , microtask = __webpack_require__(191)()
  21491. , PROMISE = 'Promise'
  21492. , TypeError = global.TypeError
  21493. , process = global.process
  21494. , $Promise = global[PROMISE]
  21495. , process = global.process
  21496. , isNode = classof(process) == 'process'
  21497. , empty = function(){ /* empty */ }
  21498. , Internal, GenericPromiseCapability, Wrapper;
  21499. var USE_NATIVE = !!function(){
  21500. try {
  21501. // correct subclassing with @@species support
  21502. var promise = $Promise.resolve(1)
  21503. , FakePromise = (promise.constructor = {})[__webpack_require__(5)('species')] = function(exec){ exec(empty, empty); };
  21504. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  21505. return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  21506. } catch(e){ /* empty */ }
  21507. }();
  21508. // helpers
  21509. var sameConstructor = function(a, b){
  21510. // with library wrapper special case
  21511. return a === b || a === $Promise && b === Wrapper;
  21512. };
  21513. var isThenable = function(it){
  21514. var then;
  21515. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  21516. };
  21517. var newPromiseCapability = function(C){
  21518. return sameConstructor($Promise, C)
  21519. ? new PromiseCapability(C)
  21520. : new GenericPromiseCapability(C);
  21521. };
  21522. var PromiseCapability = GenericPromiseCapability = function(C){
  21523. var resolve, reject;
  21524. this.promise = new C(function($$resolve, $$reject){
  21525. if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
  21526. resolve = $$resolve;
  21527. reject = $$reject;
  21528. });
  21529. this.resolve = aFunction(resolve);
  21530. this.reject = aFunction(reject);
  21531. };
  21532. var perform = function(exec){
  21533. try {
  21534. exec();
  21535. } catch(e){
  21536. return {error: e};
  21537. }
  21538. };
  21539. var notify = function(promise, isReject){
  21540. if(promise._n)return;
  21541. promise._n = true;
  21542. var chain = promise._c;
  21543. microtask(function(){
  21544. var value = promise._v
  21545. , ok = promise._s == 1
  21546. , i = 0;
  21547. var run = function(reaction){
  21548. var handler = ok ? reaction.ok : reaction.fail
  21549. , resolve = reaction.resolve
  21550. , reject = reaction.reject
  21551. , domain = reaction.domain
  21552. , result, then;
  21553. try {
  21554. if(handler){
  21555. if(!ok){
  21556. if(promise._h == 2)onHandleUnhandled(promise);
  21557. promise._h = 1;
  21558. }
  21559. if(handler === true)result = value;
  21560. else {
  21561. if(domain)domain.enter();
  21562. result = handler(value);
  21563. if(domain)domain.exit();
  21564. }
  21565. if(result === reaction.promise){
  21566. reject(TypeError('Promise-chain cycle'));
  21567. } else if(then = isThenable(result)){
  21568. then.call(result, resolve, reject);
  21569. } else resolve(result);
  21570. } else reject(value);
  21571. } catch(e){
  21572. reject(e);
  21573. }
  21574. };
  21575. while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
  21576. promise._c = [];
  21577. promise._n = false;
  21578. if(isReject && !promise._h)onUnhandled(promise);
  21579. });
  21580. };
  21581. var onUnhandled = function(promise){
  21582. task.call(global, function(){
  21583. var value = promise._v
  21584. , abrupt, handler, console;
  21585. if(isUnhandled(promise)){
  21586. abrupt = perform(function(){
  21587. if(isNode){
  21588. process.emit('unhandledRejection', value, promise);
  21589. } else if(handler = global.onunhandledrejection){
  21590. handler({promise: promise, reason: value});
  21591. } else if((console = global.console) && console.error){
  21592. console.error('Unhandled promise rejection', value);
  21593. }
  21594. });
  21595. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  21596. promise._h = isNode || isUnhandled(promise) ? 2 : 1;
  21597. } promise._a = undefined;
  21598. if(abrupt)throw abrupt.error;
  21599. });
  21600. };
  21601. var isUnhandled = function(promise){
  21602. if(promise._h == 1)return false;
  21603. var chain = promise._a || promise._c
  21604. , i = 0
  21605. , reaction;
  21606. while(chain.length > i){
  21607. reaction = chain[i++];
  21608. if(reaction.fail || !isUnhandled(reaction.promise))return false;
  21609. } return true;
  21610. };
  21611. var onHandleUnhandled = function(promise){
  21612. task.call(global, function(){
  21613. var handler;
  21614. if(isNode){
  21615. process.emit('rejectionHandled', promise);
  21616. } else if(handler = global.onrejectionhandled){
  21617. handler({promise: promise, reason: promise._v});
  21618. }
  21619. });
  21620. };
  21621. var $reject = function(value){
  21622. var promise = this;
  21623. if(promise._d)return;
  21624. promise._d = true;
  21625. promise = promise._w || promise; // unwrap
  21626. promise._v = value;
  21627. promise._s = 2;
  21628. if(!promise._a)promise._a = promise._c.slice();
  21629. notify(promise, true);
  21630. };
  21631. var $resolve = function(value){
  21632. var promise = this
  21633. , then;
  21634. if(promise._d)return;
  21635. promise._d = true;
  21636. promise = promise._w || promise; // unwrap
  21637. try {
  21638. if(promise === value)throw TypeError("Promise can't be resolved itself");
  21639. if(then = isThenable(value)){
  21640. microtask(function(){
  21641. var wrapper = {_w: promise, _d: false}; // wrap
  21642. try {
  21643. then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
  21644. } catch(e){
  21645. $reject.call(wrapper, e);
  21646. }
  21647. });
  21648. } else {
  21649. promise._v = value;
  21650. promise._s = 1;
  21651. notify(promise, false);
  21652. }
  21653. } catch(e){
  21654. $reject.call({_w: promise, _d: false}, e); // wrap
  21655. }
  21656. };
  21657. // constructor polyfill
  21658. if(!USE_NATIVE){
  21659. // 25.4.3.1 Promise(executor)
  21660. $Promise = function Promise(executor){
  21661. anInstance(this, $Promise, PROMISE, '_h');
  21662. aFunction(executor);
  21663. Internal.call(this);
  21664. try {
  21665. executor(ctx($resolve, this, 1), ctx($reject, this, 1));
  21666. } catch(err){
  21667. $reject.call(this, err);
  21668. }
  21669. };
  21670. Internal = function Promise(executor){
  21671. this._c = []; // <- awaiting reactions
  21672. this._a = undefined; // <- checked in isUnhandled reactions
  21673. this._s = 0; // <- state
  21674. this._d = false; // <- done
  21675. this._v = undefined; // <- value
  21676. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  21677. this._n = false; // <- notify
  21678. };
  21679. Internal.prototype = __webpack_require__(199)($Promise.prototype, {
  21680. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  21681. then: function then(onFulfilled, onRejected){
  21682. var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
  21683. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  21684. reaction.fail = typeof onRejected == 'function' && onRejected;
  21685. reaction.domain = isNode ? process.domain : undefined;
  21686. this._c.push(reaction);
  21687. if(this._a)this._a.push(reaction);
  21688. if(this._s)notify(this, false);
  21689. return reaction.promise;
  21690. },
  21691. // 25.4.5.1 Promise.prototype.catch(onRejected)
  21692. 'catch': function(onRejected){
  21693. return this.then(undefined, onRejected);
  21694. }
  21695. });
  21696. PromiseCapability = function(){
  21697. var promise = new Internal;
  21698. this.promise = promise;
  21699. this.resolve = ctx($resolve, promise, 1);
  21700. this.reject = ctx($reject, promise, 1);
  21701. };
  21702. }
  21703. $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
  21704. __webpack_require__(56)($Promise, PROMISE);
  21705. __webpack_require__(201)(PROMISE);
  21706. Wrapper = __webpack_require__(8)[PROMISE];
  21707. // statics
  21708. $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  21709. // 25.4.4.5 Promise.reject(r)
  21710. reject: function reject(r){
  21711. var capability = newPromiseCapability(this)
  21712. , $$reject = capability.reject;
  21713. $$reject(r);
  21714. return capability.promise;
  21715. }
  21716. });
  21717. $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  21718. // 25.4.4.6 Promise.resolve(x)
  21719. resolve: function resolve(x){
  21720. // instanceof instead of internal slot check because we should fix it without replacement native Promise core
  21721. if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
  21722. var capability = newPromiseCapability(this)
  21723. , $$resolve = capability.resolve;
  21724. $$resolve(x);
  21725. return capability.promise;
  21726. }
  21727. });
  21728. $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(189)(function(iter){
  21729. $Promise.all(iter)['catch'](empty);
  21730. })), PROMISE, {
  21731. // 25.4.4.1 Promise.all(iterable)
  21732. all: function all(iterable){
  21733. var C = this
  21734. , capability = newPromiseCapability(C)
  21735. , resolve = capability.resolve
  21736. , reject = capability.reject;
  21737. var abrupt = perform(function(){
  21738. var values = []
  21739. , index = 0
  21740. , remaining = 1;
  21741. forOf(iterable, false, function(promise){
  21742. var $index = index++
  21743. , alreadyCalled = false;
  21744. values.push(undefined);
  21745. remaining++;
  21746. C.resolve(promise).then(function(value){
  21747. if(alreadyCalled)return;
  21748. alreadyCalled = true;
  21749. values[$index] = value;
  21750. --remaining || resolve(values);
  21751. }, reject);
  21752. });
  21753. --remaining || resolve(values);
  21754. });
  21755. if(abrupt)reject(abrupt.error);
  21756. return capability.promise;
  21757. },
  21758. // 25.4.4.4 Promise.race(iterable)
  21759. race: function race(iterable){
  21760. var C = this
  21761. , capability = newPromiseCapability(C)
  21762. , reject = capability.reject;
  21763. var abrupt = perform(function(){
  21764. forOf(iterable, false, function(promise){
  21765. C.resolve(promise).then(capability.resolve, reject);
  21766. });
  21767. });
  21768. if(abrupt)reject(abrupt.error);
  21769. return capability.promise;
  21770. }
  21771. });
  21772. /***/ },
  21773. /* 212 */
  21774. /***/ function(module, exports, __webpack_require__) {
  21775. "use strict";
  21776. 'use strict';
  21777. var $at = __webpack_require__(203)(true);
  21778. // 21.1.3.27 String.prototype[@@iterator]()
  21779. __webpack_require__(95)(String, 'String', function(iterated){
  21780. this._t = String(iterated); // target
  21781. this._i = 0; // next index
  21782. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  21783. }, function(){
  21784. var O = this._t
  21785. , index = this._i
  21786. , point;
  21787. if(index >= O.length)return {value: undefined, done: true};
  21788. point = $at(O, index);
  21789. this._i += point.length;
  21790. return {value: point, done: false};
  21791. });
  21792. /***/ },
  21793. /* 213 */
  21794. /***/ function(module, exports, __webpack_require__) {
  21795. __webpack_require__(207);
  21796. var global = __webpack_require__(6)
  21797. , hide = __webpack_require__(15)
  21798. , Iterators = __webpack_require__(27)
  21799. , TO_STRING_TAG = __webpack_require__(5)('toStringTag');
  21800. for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
  21801. var NAME = collections[i]
  21802. , Collection = global[NAME]
  21803. , proto = Collection && Collection.prototype;
  21804. if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
  21805. Iterators[NAME] = Iterators.Array;
  21806. }
  21807. /***/ },
  21808. /* 214 */
  21809. /***/ function(module, exports, __webpack_require__) {
  21810. /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(3);
  21811. var BN = __webpack_require__(2);
  21812. module.exports = function createECDH(curve) {
  21813. return new ECDH(curve);
  21814. };
  21815. var aliases = {
  21816. secp256k1: {
  21817. name: 'secp256k1',
  21818. byteLength: 32
  21819. },
  21820. secp224r1: {
  21821. name: 'p224',
  21822. byteLength: 28
  21823. },
  21824. prime256v1: {
  21825. name: 'p256',
  21826. byteLength: 32
  21827. },
  21828. prime192v1: {
  21829. name: 'p192',
  21830. byteLength: 24
  21831. },
  21832. ed25519: {
  21833. name: 'ed25519',
  21834. byteLength: 32
  21835. },
  21836. secp384r1: {
  21837. name: 'p384',
  21838. byteLength: 48
  21839. },
  21840. secp521r1: {
  21841. name: 'p521',
  21842. byteLength: 66
  21843. }
  21844. };
  21845. aliases.p224 = aliases.secp224r1;
  21846. aliases.p256 = aliases.secp256r1 = aliases.prime256v1;
  21847. aliases.p192 = aliases.secp192r1 = aliases.prime192v1;
  21848. aliases.p384 = aliases.secp384r1;
  21849. aliases.p521 = aliases.secp521r1;
  21850. function ECDH(curve) {
  21851. this.curveType = aliases[curve];
  21852. if (!this.curveType ) {
  21853. this.curveType = {
  21854. name: curve
  21855. };
  21856. }
  21857. this.curve = new elliptic.ec(this.curveType.name);
  21858. this.keys = void 0;
  21859. }
  21860. ECDH.prototype.generateKeys = function (enc, format) {
  21861. this.keys = this.curve.genKeyPair();
  21862. return this.getPublicKey(enc, format);
  21863. };
  21864. ECDH.prototype.computeSecret = function (other, inenc, enc) {
  21865. inenc = inenc || 'utf8';
  21866. if (!Buffer.isBuffer(other)) {
  21867. other = new Buffer(other, inenc);
  21868. }
  21869. var otherPub = this.curve.keyFromPublic(other).getPublic();
  21870. var out = otherPub.mul(this.keys.getPrivate()).getX();
  21871. return formatReturnValue(out, enc, this.curveType.byteLength);
  21872. };
  21873. ECDH.prototype.getPublicKey = function (enc, format) {
  21874. var key = this.keys.getPublic(format === 'compressed', true);
  21875. if (format === 'hybrid') {
  21876. if (key[key.length - 1] % 2) {
  21877. key[0] = 7;
  21878. } else {
  21879. key [0] = 6;
  21880. }
  21881. }
  21882. return formatReturnValue(key, enc);
  21883. };
  21884. ECDH.prototype.getPrivateKey = function (enc) {
  21885. return formatReturnValue(this.keys.getPrivate(), enc);
  21886. };
  21887. ECDH.prototype.setPublicKey = function (pub, enc) {
  21888. enc = enc || 'utf8';
  21889. if (!Buffer.isBuffer(pub)) {
  21890. pub = new Buffer(pub, enc);
  21891. }
  21892. this.keys._importPublic(pub);
  21893. return this;
  21894. };
  21895. ECDH.prototype.setPrivateKey = function (priv, enc) {
  21896. enc = enc || 'utf8';
  21897. if (!Buffer.isBuffer(priv)) {
  21898. priv = new Buffer(priv, enc);
  21899. }
  21900. var _priv = new BN(priv);
  21901. _priv = _priv.toString(16);
  21902. this.keys._importPrivate(_priv);
  21903. return this;
  21904. };
  21905. function formatReturnValue(bn, enc, len) {
  21906. if (!Array.isArray(bn)) {
  21907. bn = bn.toArray();
  21908. }
  21909. var buf = new Buffer(bn);
  21910. if (len && buf.length < len) {
  21911. var zeros = new Buffer(len - buf.length);
  21912. zeros.fill(0);
  21913. buf = Buffer.concat([zeros, buf]);
  21914. }
  21915. if (!enc) {
  21916. return buf;
  21917. } else {
  21918. return buf.toString(enc);
  21919. }
  21920. }
  21921. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  21922. /***/ },
  21923. /* 215 */
  21924. /***/ function(module, exports, __webpack_require__) {
  21925. "use strict";
  21926. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  21927. var intSize = 4;
  21928. var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
  21929. var chrsz = 8;
  21930. function toArray(buf, bigEndian) {
  21931. if ((buf.length % intSize) !== 0) {
  21932. var len = buf.length + (intSize - (buf.length % intSize));
  21933. buf = Buffer.concat([buf, zeroBuffer], len);
  21934. }
  21935. var arr = [];
  21936. var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
  21937. for (var i = 0; i < buf.length; i += intSize) {
  21938. arr.push(fn.call(buf, i));
  21939. }
  21940. return arr;
  21941. }
  21942. function toBuffer(arr, size, bigEndian) {
  21943. var buf = new Buffer(size);
  21944. var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
  21945. for (var i = 0; i < arr.length; i++) {
  21946. fn.call(buf, arr[i], i * 4, true);
  21947. }
  21948. return buf;
  21949. }
  21950. function hash(buf, fn, hashSize, bigEndian) {
  21951. if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
  21952. var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
  21953. return toBuffer(arr, hashSize, bigEndian);
  21954. }
  21955. exports.hash = hash;
  21956. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  21957. /***/ },
  21958. /* 216 */
  21959. /***/ function(module, exports, __webpack_require__) {
  21960. "use strict";
  21961. 'use strict'
  21962. exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(31)
  21963. exports.createHash = exports.Hash = __webpack_require__(16)
  21964. exports.createHmac = exports.Hmac = __webpack_require__(60)
  21965. var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(__webpack_require__(107)))
  21966. exports.getHashes = function () {
  21967. return hashes
  21968. }
  21969. var p = __webpack_require__(110)
  21970. exports.pbkdf2 = p.pbkdf2
  21971. exports.pbkdf2Sync = p.pbkdf2Sync
  21972. var aes = __webpack_require__(168)
  21973. ;[
  21974. 'Cipher',
  21975. 'createCipher',
  21976. 'Cipheriv',
  21977. 'createCipheriv',
  21978. 'Decipher',
  21979. 'createDecipher',
  21980. 'Decipheriv',
  21981. 'createDecipheriv',
  21982. 'getCiphers',
  21983. 'listCiphers'
  21984. ].forEach(function (key) {
  21985. exports[key] = aes[key]
  21986. })
  21987. var dh = __webpack_require__(230)
  21988. ;[
  21989. 'DiffieHellmanGroup',
  21990. 'createDiffieHellmanGroup',
  21991. 'getDiffieHellman',
  21992. 'createDiffieHellman',
  21993. 'DiffieHellman'
  21994. ].forEach(function (key) {
  21995. exports[key] = dh[key]
  21996. })
  21997. var sign = __webpack_require__(171)
  21998. ;[
  21999. 'createSign',
  22000. 'Sign',
  22001. 'createVerify',
  22002. 'Verify'
  22003. ].forEach(function (key) {
  22004. exports[key] = sign[key]
  22005. })
  22006. exports.createECDH = __webpack_require__(214)
  22007. var publicEncrypt = __webpack_require__(265)
  22008. ;[
  22009. 'publicEncrypt',
  22010. 'privateEncrypt',
  22011. 'publicDecrypt',
  22012. 'privateDecrypt'
  22013. ].forEach(function (key) {
  22014. exports[key] = publicEncrypt[key]
  22015. })
  22016. // the least I can do is make error messages for the rest of the node.js/crypto api.
  22017. ;[
  22018. 'createCredentials'
  22019. ].forEach(function (name) {
  22020. exports[name] = function () {
  22021. throw new Error([
  22022. 'sorry, ' + name + ' is not implemented yet',
  22023. 'we accept pull requests',
  22024. 'https://github.com/crypto-browserify/crypto-browserify'
  22025. ].join('\n'))
  22026. }
  22027. })
  22028. /***/ },
  22029. /* 217 */
  22030. /***/ function(module, exports, __webpack_require__) {
  22031. exports = module.exports = __webpack_require__(17)();
  22032. // imports
  22033. // module
  22034. exports.push([module.i, "\n#fingerprint {\n min-width: 90px;\n text-align: center;\n background-color: transparent;\n color: white;\n}\n#fingerprint i {\n color: black;\n position: relative;\n padding: 0;\n text-shadow: 1px 1px 0 white;\n font-size: 1.3em;\n}\n", ""]);
  22035. // exports
  22036. /***/ },
  22037. /* 218 */
  22038. /***/ function(module, exports, __webpack_require__) {
  22039. exports = module.exports = __webpack_require__(17)();
  22040. // imports
  22041. // module
  22042. exports.push([module.i, "\n#passwords {\n max-height: 320px;\n overflow-y: scroll;\n overflow-x: hidden;\n}\n", ""]);
  22043. // exports
  22044. /***/ },
  22045. /* 219 */
  22046. /***/ function(module, exports, __webpack_require__) {
  22047. exports = module.exports = __webpack_require__(17)();
  22048. // imports
  22049. // module
  22050. exports.push([module.i, "\n#password-generator {\n color: #555;\n}\n.inner-addon i {\n position: absolute;\n padding: 10px;\n pointer-events: none;\n z-index: 10;\n}\n.inner-addon {\n position: relative;\n}\n.left-addon i {\n left: 0;\n}\n.right-addon i {\n right: 0;\n}\n.left-addon input {\n padding-left: 30px;\n}\n.right-addon input {\n padding-right: 30px;\n}\n", ""]);
  22051. // exports
  22052. /***/ },
  22053. /* 220 */
  22054. /***/ function(module, exports, __webpack_require__) {
  22055. exports = module.exports = __webpack_require__(17)();
  22056. // imports
  22057. // module
  22058. exports.push([module.i, "\n#lesspass .white-link {\n color: white;\n}\n#lesspass .white-link:hover, #lesspass .white-link:focus, #lesspass .white-link:active {\n text-decoration: none;\n color: white;\n}\n#lesspass, #lesspass * {\n border-radius: 0 !important;\n}\n", ""]);
  22059. // exports
  22060. /***/ },
  22061. /* 221 */
  22062. /***/ function(module, exports, __webpack_require__) {
  22063. exports = module.exports = __webpack_require__(17)();
  22064. // imports
  22065. // module
  22066. exports.push([module.i, "\n.fa-white {\n color: #ffffff;\n}\n", ""]);
  22067. // exports
  22068. /***/ },
  22069. /* 222 */
  22070. /***/ function(module, exports, __webpack_require__) {
  22071. exports = module.exports = __webpack_require__(17)();
  22072. // imports
  22073. // module
  22074. exports.push([module.i, "\n.card-header-dark {\n background-color: #555;\n border-color: #555;\n color: #FFF;\n}\n.grey-link {\n color: #373a3c;\n text-decoration: none;\n}\n.grey-link:hover, .grey-link:focus, .grey-link:active {\n color: #373a3c;\n text-decoration: none;\n}\n.white-link {\n color: white;\n}\n.white-link:hover, .white-link:focus, .white-link:active {\n text-decoration: none;\n color: white;\n}\n.fa-clickable {\n cursor: pointer;\n}\n", ""]);
  22075. // exports
  22076. /***/ },
  22077. /* 223 */
  22078. /***/ function(module, exports) {
  22079. /**
  22080. * A polyfill for Element.matches()
  22081. */
  22082. if (Element && !Element.prototype.matches) {
  22083. var proto = Element.prototype;
  22084. proto.matches = proto.matchesSelector ||
  22085. proto.mozMatchesSelector ||
  22086. proto.msMatchesSelector ||
  22087. proto.oMatchesSelector ||
  22088. proto.webkitMatchesSelector;
  22089. }
  22090. /**
  22091. * Finds the closest parent that matches a selector.
  22092. *
  22093. * @param {Element} element
  22094. * @param {String} selector
  22095. * @return {Function}
  22096. */
  22097. function closest (element, selector) {
  22098. while (element && element !== document) {
  22099. if (element.matches(selector)) return element;
  22100. element = element.parentNode;
  22101. }
  22102. }
  22103. module.exports = closest;
  22104. /***/ },
  22105. /* 224 */
  22106. /***/ function(module, exports, __webpack_require__) {
  22107. var closest = __webpack_require__(223);
  22108. /**
  22109. * Delegates event to a selector.
  22110. *
  22111. * @param {Element} element
  22112. * @param {String} selector
  22113. * @param {String} type
  22114. * @param {Function} callback
  22115. * @param {Boolean} useCapture
  22116. * @return {Object}
  22117. */
  22118. function delegate(element, selector, type, callback, useCapture) {
  22119. var listenerFn = listener.apply(this, arguments);
  22120. element.addEventListener(type, listenerFn, useCapture);
  22121. return {
  22122. destroy: function() {
  22123. element.removeEventListener(type, listenerFn, useCapture);
  22124. }
  22125. }
  22126. }
  22127. /**
  22128. * Finds closest match and invokes callback.
  22129. *
  22130. * @param {Element} element
  22131. * @param {String} selector
  22132. * @param {String} type
  22133. * @param {Function} callback
  22134. * @return {Function}
  22135. */
  22136. function listener(element, selector, type, callback) {
  22137. return function(e) {
  22138. e.delegateTarget = closest(e.target, selector);
  22139. if (e.delegateTarget) {
  22140. callback.call(element, e);
  22141. }
  22142. }
  22143. }
  22144. module.exports = delegate;
  22145. /***/ },
  22146. /* 225 */
  22147. /***/ function(module, exports, __webpack_require__) {
  22148. "use strict";
  22149. 'use strict';
  22150. var assert = __webpack_require__(30);
  22151. var inherits = __webpack_require__(1);
  22152. var proto = {};
  22153. function CBCState(iv) {
  22154. assert.equal(iv.length, 8, 'Invalid IV length');
  22155. this.iv = new Array(8);
  22156. for (var i = 0; i < this.iv.length; i++)
  22157. this.iv[i] = iv[i];
  22158. }
  22159. function instantiate(Base) {
  22160. function CBC(options) {
  22161. Base.call(this, options);
  22162. this._cbcInit();
  22163. }
  22164. inherits(CBC, Base);
  22165. var keys = Object.keys(proto);
  22166. for (var i = 0; i < keys.length; i++) {
  22167. var key = keys[i];
  22168. CBC.prototype[key] = proto[key];
  22169. }
  22170. CBC.create = function create(options) {
  22171. return new CBC(options);
  22172. };
  22173. return CBC;
  22174. }
  22175. exports.instantiate = instantiate;
  22176. proto._cbcInit = function _cbcInit() {
  22177. var state = new CBCState(this.options.iv);
  22178. this._cbcState = state;
  22179. };
  22180. proto._update = function _update(inp, inOff, out, outOff) {
  22181. var state = this._cbcState;
  22182. var superProto = this.constructor.super_.prototype;
  22183. var iv = state.iv;
  22184. if (this.type === 'encrypt') {
  22185. for (var i = 0; i < this.blockSize; i++)
  22186. iv[i] ^= inp[inOff + i];
  22187. superProto._update.call(this, iv, 0, out, outOff);
  22188. for (var i = 0; i < this.blockSize; i++)
  22189. iv[i] = out[outOff + i];
  22190. } else {
  22191. superProto._update.call(this, inp, inOff, out, outOff);
  22192. for (var i = 0; i < this.blockSize; i++)
  22193. out[outOff + i] ^= iv[i];
  22194. for (var i = 0; i < this.blockSize; i++)
  22195. iv[i] = inp[inOff + i];
  22196. }
  22197. };
  22198. /***/ },
  22199. /* 226 */
  22200. /***/ function(module, exports, __webpack_require__) {
  22201. "use strict";
  22202. 'use strict';
  22203. var assert = __webpack_require__(30);
  22204. function Cipher(options) {
  22205. this.options = options;
  22206. this.type = this.options.type;
  22207. this.blockSize = 8;
  22208. this._init();
  22209. this.buffer = new Array(this.blockSize);
  22210. this.bufferOff = 0;
  22211. }
  22212. module.exports = Cipher;
  22213. Cipher.prototype._init = function _init() {
  22214. // Might be overrided
  22215. };
  22216. Cipher.prototype.update = function update(data) {
  22217. if (data.length === 0)
  22218. return [];
  22219. if (this.type === 'decrypt')
  22220. return this._updateDecrypt(data);
  22221. else
  22222. return this._updateEncrypt(data);
  22223. };
  22224. Cipher.prototype._buffer = function _buffer(data, off) {
  22225. // Append data to buffer
  22226. var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
  22227. for (var i = 0; i < min; i++)
  22228. this.buffer[this.bufferOff + i] = data[off + i];
  22229. this.bufferOff += min;
  22230. // Shift next
  22231. return min;
  22232. };
  22233. Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
  22234. this._update(this.buffer, 0, out, off);
  22235. this.bufferOff = 0;
  22236. return this.blockSize;
  22237. };
  22238. Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
  22239. var inputOff = 0;
  22240. var outputOff = 0;
  22241. var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
  22242. var out = new Array(count * this.blockSize);
  22243. if (this.bufferOff !== 0) {
  22244. inputOff += this._buffer(data, inputOff);
  22245. if (this.bufferOff === this.buffer.length)
  22246. outputOff += this._flushBuffer(out, outputOff);
  22247. }
  22248. // Write blocks
  22249. var max = data.length - ((data.length - inputOff) % this.blockSize);
  22250. for (; inputOff < max; inputOff += this.blockSize) {
  22251. this._update(data, inputOff, out, outputOff);
  22252. outputOff += this.blockSize;
  22253. }
  22254. // Queue rest
  22255. for (; inputOff < data.length; inputOff++, this.bufferOff++)
  22256. this.buffer[this.bufferOff] = data[inputOff];
  22257. return out;
  22258. };
  22259. Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
  22260. var inputOff = 0;
  22261. var outputOff = 0;
  22262. var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
  22263. var out = new Array(count * this.blockSize);
  22264. // TODO(indutny): optimize it, this is far from optimal
  22265. for (; count > 0; count--) {
  22266. inputOff += this._buffer(data, inputOff);
  22267. outputOff += this._flushBuffer(out, outputOff);
  22268. }
  22269. // Buffer rest of the input
  22270. inputOff += this._buffer(data, inputOff);
  22271. return out;
  22272. };
  22273. Cipher.prototype.final = function final(buffer) {
  22274. var first;
  22275. if (buffer)
  22276. first = this.update(buffer);
  22277. var last;
  22278. if (this.type === 'encrypt')
  22279. last = this._finalEncrypt();
  22280. else
  22281. last = this._finalDecrypt();
  22282. if (first)
  22283. return first.concat(last);
  22284. else
  22285. return last;
  22286. };
  22287. Cipher.prototype._pad = function _pad(buffer, off) {
  22288. if (off === 0)
  22289. return false;
  22290. while (off < buffer.length)
  22291. buffer[off++] = 0;
  22292. return true;
  22293. };
  22294. Cipher.prototype._finalEncrypt = function _finalEncrypt() {
  22295. if (!this._pad(this.buffer, this.bufferOff))
  22296. return [];
  22297. var out = new Array(this.blockSize);
  22298. this._update(this.buffer, 0, out, 0);
  22299. return out;
  22300. };
  22301. Cipher.prototype._unpad = function _unpad(buffer) {
  22302. return buffer;
  22303. };
  22304. Cipher.prototype._finalDecrypt = function _finalDecrypt() {
  22305. assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
  22306. var out = new Array(this.blockSize);
  22307. this._flushBuffer(out, 0);
  22308. return this._unpad(out);
  22309. };
  22310. /***/ },
  22311. /* 227 */
  22312. /***/ function(module, exports, __webpack_require__) {
  22313. "use strict";
  22314. 'use strict';
  22315. var assert = __webpack_require__(30);
  22316. var inherits = __webpack_require__(1);
  22317. var des = __webpack_require__(61);
  22318. var utils = des.utils;
  22319. var Cipher = des.Cipher;
  22320. function DESState() {
  22321. this.tmp = new Array(2);
  22322. this.keys = null;
  22323. }
  22324. function DES(options) {
  22325. Cipher.call(this, options);
  22326. var state = new DESState();
  22327. this._desState = state;
  22328. this.deriveKeys(state, options.key);
  22329. }
  22330. inherits(DES, Cipher);
  22331. module.exports = DES;
  22332. DES.create = function create(options) {
  22333. return new DES(options);
  22334. };
  22335. var shiftTable = [
  22336. 1, 1, 2, 2, 2, 2, 2, 2,
  22337. 1, 2, 2, 2, 2, 2, 2, 1
  22338. ];
  22339. DES.prototype.deriveKeys = function deriveKeys(state, key) {
  22340. state.keys = new Array(16 * 2);
  22341. assert.equal(key.length, this.blockSize, 'Invalid key length');
  22342. var kL = utils.readUInt32BE(key, 0);
  22343. var kR = utils.readUInt32BE(key, 4);
  22344. utils.pc1(kL, kR, state.tmp, 0);
  22345. kL = state.tmp[0];
  22346. kR = state.tmp[1];
  22347. for (var i = 0; i < state.keys.length; i += 2) {
  22348. var shift = shiftTable[i >>> 1];
  22349. kL = utils.r28shl(kL, shift);
  22350. kR = utils.r28shl(kR, shift);
  22351. utils.pc2(kL, kR, state.keys, i);
  22352. }
  22353. };
  22354. DES.prototype._update = function _update(inp, inOff, out, outOff) {
  22355. var state = this._desState;
  22356. var l = utils.readUInt32BE(inp, inOff);
  22357. var r = utils.readUInt32BE(inp, inOff + 4);
  22358. // Initial Permutation
  22359. utils.ip(l, r, state.tmp, 0);
  22360. l = state.tmp[0];
  22361. r = state.tmp[1];
  22362. if (this.type === 'encrypt')
  22363. this._encrypt(state, l, r, state.tmp, 0);
  22364. else
  22365. this._decrypt(state, l, r, state.tmp, 0);
  22366. l = state.tmp[0];
  22367. r = state.tmp[1];
  22368. utils.writeUInt32BE(out, l, outOff);
  22369. utils.writeUInt32BE(out, r, outOff + 4);
  22370. };
  22371. DES.prototype._pad = function _pad(buffer, off) {
  22372. var value = buffer.length - off;
  22373. for (var i = off; i < buffer.length; i++)
  22374. buffer[i] = value;
  22375. return true;
  22376. };
  22377. DES.prototype._unpad = function _unpad(buffer) {
  22378. var pad = buffer[buffer.length - 1];
  22379. for (var i = buffer.length - pad; i < buffer.length; i++)
  22380. assert.equal(buffer[i], pad);
  22381. return buffer.slice(0, buffer.length - pad);
  22382. };
  22383. DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
  22384. var l = lStart;
  22385. var r = rStart;
  22386. // Apply f() x16 times
  22387. for (var i = 0; i < state.keys.length; i += 2) {
  22388. var keyL = state.keys[i];
  22389. var keyR = state.keys[i + 1];
  22390. // f(r, k)
  22391. utils.expand(r, state.tmp, 0);
  22392. keyL ^= state.tmp[0];
  22393. keyR ^= state.tmp[1];
  22394. var s = utils.substitute(keyL, keyR);
  22395. var f = utils.permute(s);
  22396. var t = r;
  22397. r = (l ^ f) >>> 0;
  22398. l = t;
  22399. }
  22400. // Reverse Initial Permutation
  22401. utils.rip(r, l, out, off);
  22402. };
  22403. DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
  22404. var l = rStart;
  22405. var r = lStart;
  22406. // Apply f() x16 times
  22407. for (var i = state.keys.length - 2; i >= 0; i -= 2) {
  22408. var keyL = state.keys[i];
  22409. var keyR = state.keys[i + 1];
  22410. // f(r, k)
  22411. utils.expand(l, state.tmp, 0);
  22412. keyL ^= state.tmp[0];
  22413. keyR ^= state.tmp[1];
  22414. var s = utils.substitute(keyL, keyR);
  22415. var f = utils.permute(s);
  22416. var t = l;
  22417. l = (r ^ f) >>> 0;
  22418. r = t;
  22419. }
  22420. // Reverse Initial Permutation
  22421. utils.rip(l, r, out, off);
  22422. };
  22423. /***/ },
  22424. /* 228 */
  22425. /***/ function(module, exports, __webpack_require__) {
  22426. "use strict";
  22427. 'use strict';
  22428. var assert = __webpack_require__(30);
  22429. var inherits = __webpack_require__(1);
  22430. var des = __webpack_require__(61);
  22431. var Cipher = des.Cipher;
  22432. var DES = des.DES;
  22433. function EDEState(type, key) {
  22434. assert.equal(key.length, 24, 'Invalid key length');
  22435. var k1 = key.slice(0, 8);
  22436. var k2 = key.slice(8, 16);
  22437. var k3 = key.slice(16, 24);
  22438. if (type === 'encrypt') {
  22439. this.ciphers = [
  22440. DES.create({ type: 'encrypt', key: k1 }),
  22441. DES.create({ type: 'decrypt', key: k2 }),
  22442. DES.create({ type: 'encrypt', key: k3 })
  22443. ];
  22444. } else {
  22445. this.ciphers = [
  22446. DES.create({ type: 'decrypt', key: k3 }),
  22447. DES.create({ type: 'encrypt', key: k2 }),
  22448. DES.create({ type: 'decrypt', key: k1 })
  22449. ];
  22450. }
  22451. }
  22452. function EDE(options) {
  22453. Cipher.call(this, options);
  22454. var state = new EDEState(this.type, this.options.key);
  22455. this._edeState = state;
  22456. }
  22457. inherits(EDE, Cipher);
  22458. module.exports = EDE;
  22459. EDE.create = function create(options) {
  22460. return new EDE(options);
  22461. };
  22462. EDE.prototype._update = function _update(inp, inOff, out, outOff) {
  22463. var state = this._edeState;
  22464. state.ciphers[0]._update(inp, inOff, out, outOff);
  22465. state.ciphers[1]._update(out, outOff, out, outOff);
  22466. state.ciphers[2]._update(out, outOff, out, outOff);
  22467. };
  22468. EDE.prototype._pad = DES.prototype._pad;
  22469. EDE.prototype._unpad = DES.prototype._unpad;
  22470. /***/ },
  22471. /* 229 */
  22472. /***/ function(module, exports) {
  22473. "use strict";
  22474. 'use strict';
  22475. exports.readUInt32BE = function readUInt32BE(bytes, off) {
  22476. var res = (bytes[0 + off] << 24) |
  22477. (bytes[1 + off] << 16) |
  22478. (bytes[2 + off] << 8) |
  22479. bytes[3 + off];
  22480. return res >>> 0;
  22481. };
  22482. exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
  22483. bytes[0 + off] = value >>> 24;
  22484. bytes[1 + off] = (value >>> 16) & 0xff;
  22485. bytes[2 + off] = (value >>> 8) & 0xff;
  22486. bytes[3 + off] = value & 0xff;
  22487. };
  22488. exports.ip = function ip(inL, inR, out, off) {
  22489. var outL = 0;
  22490. var outR = 0;
  22491. for (var i = 6; i >= 0; i -= 2) {
  22492. for (var j = 0; j <= 24; j += 8) {
  22493. outL <<= 1;
  22494. outL |= (inR >>> (j + i)) & 1;
  22495. }
  22496. for (var j = 0; j <= 24; j += 8) {
  22497. outL <<= 1;
  22498. outL |= (inL >>> (j + i)) & 1;
  22499. }
  22500. }
  22501. for (var i = 6; i >= 0; i -= 2) {
  22502. for (var j = 1; j <= 25; j += 8) {
  22503. outR <<= 1;
  22504. outR |= (inR >>> (j + i)) & 1;
  22505. }
  22506. for (var j = 1; j <= 25; j += 8) {
  22507. outR <<= 1;
  22508. outR |= (inL >>> (j + i)) & 1;
  22509. }
  22510. }
  22511. out[off + 0] = outL >>> 0;
  22512. out[off + 1] = outR >>> 0;
  22513. };
  22514. exports.rip = function rip(inL, inR, out, off) {
  22515. var outL = 0;
  22516. var outR = 0;
  22517. for (var i = 0; i < 4; i++) {
  22518. for (var j = 24; j >= 0; j -= 8) {
  22519. outL <<= 1;
  22520. outL |= (inR >>> (j + i)) & 1;
  22521. outL <<= 1;
  22522. outL |= (inL >>> (j + i)) & 1;
  22523. }
  22524. }
  22525. for (var i = 4; i < 8; i++) {
  22526. for (var j = 24; j >= 0; j -= 8) {
  22527. outR <<= 1;
  22528. outR |= (inR >>> (j + i)) & 1;
  22529. outR <<= 1;
  22530. outR |= (inL >>> (j + i)) & 1;
  22531. }
  22532. }
  22533. out[off + 0] = outL >>> 0;
  22534. out[off + 1] = outR >>> 0;
  22535. };
  22536. exports.pc1 = function pc1(inL, inR, out, off) {
  22537. var outL = 0;
  22538. var outR = 0;
  22539. // 7, 15, 23, 31, 39, 47, 55, 63
  22540. // 6, 14, 22, 30, 39, 47, 55, 63
  22541. // 5, 13, 21, 29, 39, 47, 55, 63
  22542. // 4, 12, 20, 28
  22543. for (var i = 7; i >= 5; i--) {
  22544. for (var j = 0; j <= 24; j += 8) {
  22545. outL <<= 1;
  22546. outL |= (inR >> (j + i)) & 1;
  22547. }
  22548. for (var j = 0; j <= 24; j += 8) {
  22549. outL <<= 1;
  22550. outL |= (inL >> (j + i)) & 1;
  22551. }
  22552. }
  22553. for (var j = 0; j <= 24; j += 8) {
  22554. outL <<= 1;
  22555. outL |= (inR >> (j + i)) & 1;
  22556. }
  22557. // 1, 9, 17, 25, 33, 41, 49, 57
  22558. // 2, 10, 18, 26, 34, 42, 50, 58
  22559. // 3, 11, 19, 27, 35, 43, 51, 59
  22560. // 36, 44, 52, 60
  22561. for (var i = 1; i <= 3; i++) {
  22562. for (var j = 0; j <= 24; j += 8) {
  22563. outR <<= 1;
  22564. outR |= (inR >> (j + i)) & 1;
  22565. }
  22566. for (var j = 0; j <= 24; j += 8) {
  22567. outR <<= 1;
  22568. outR |= (inL >> (j + i)) & 1;
  22569. }
  22570. }
  22571. for (var j = 0; j <= 24; j += 8) {
  22572. outR <<= 1;
  22573. outR |= (inL >> (j + i)) & 1;
  22574. }
  22575. out[off + 0] = outL >>> 0;
  22576. out[off + 1] = outR >>> 0;
  22577. };
  22578. exports.r28shl = function r28shl(num, shift) {
  22579. return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
  22580. };
  22581. var pc2table = [
  22582. // inL => outL
  22583. 14, 11, 17, 4, 27, 23, 25, 0,
  22584. 13, 22, 7, 18, 5, 9, 16, 24,
  22585. 2, 20, 12, 21, 1, 8, 15, 26,
  22586. // inR => outR
  22587. 15, 4, 25, 19, 9, 1, 26, 16,
  22588. 5, 11, 23, 8, 12, 7, 17, 0,
  22589. 22, 3, 10, 14, 6, 20, 27, 24
  22590. ];
  22591. exports.pc2 = function pc2(inL, inR, out, off) {
  22592. var outL = 0;
  22593. var outR = 0;
  22594. var len = pc2table.length >>> 1;
  22595. for (var i = 0; i < len; i++) {
  22596. outL <<= 1;
  22597. outL |= (inL >>> pc2table[i]) & 0x1;
  22598. }
  22599. for (var i = len; i < pc2table.length; i++) {
  22600. outR <<= 1;
  22601. outR |= (inR >>> pc2table[i]) & 0x1;
  22602. }
  22603. out[off + 0] = outL >>> 0;
  22604. out[off + 1] = outR >>> 0;
  22605. };
  22606. exports.expand = function expand(r, out, off) {
  22607. var outL = 0;
  22608. var outR = 0;
  22609. outL = ((r & 1) << 5) | (r >>> 27);
  22610. for (var i = 23; i >= 15; i -= 4) {
  22611. outL <<= 6;
  22612. outL |= (r >>> i) & 0x3f;
  22613. }
  22614. for (var i = 11; i >= 3; i -= 4) {
  22615. outR |= (r >>> i) & 0x3f;
  22616. outR <<= 6;
  22617. }
  22618. outR |= ((r & 0x1f) << 1) | (r >>> 31);
  22619. out[off + 0] = outL >>> 0;
  22620. out[off + 1] = outR >>> 0;
  22621. };
  22622. var sTable = [
  22623. 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
  22624. 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
  22625. 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
  22626. 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
  22627. 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
  22628. 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
  22629. 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
  22630. 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
  22631. 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
  22632. 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
  22633. 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
  22634. 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
  22635. 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
  22636. 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
  22637. 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
  22638. 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
  22639. 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
  22640. 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
  22641. 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
  22642. 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
  22643. 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
  22644. 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
  22645. 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  22646. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
  22647. 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
  22648. 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
  22649. 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
  22650. 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
  22651. 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
  22652. 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
  22653. 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
  22654. 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  22655. ];
  22656. exports.substitute = function substitute(inL, inR) {
  22657. var out = 0;
  22658. for (var i = 0; i < 4; i++) {
  22659. var b = (inL >>> (18 - i * 6)) & 0x3f;
  22660. var sb = sTable[i * 0x40 + b];
  22661. out <<= 4;
  22662. out |= sb;
  22663. }
  22664. for (var i = 0; i < 4; i++) {
  22665. var b = (inR >>> (18 - i * 6)) & 0x3f;
  22666. var sb = sTable[4 * 0x40 + i * 0x40 + b];
  22667. out <<= 4;
  22668. out |= sb;
  22669. }
  22670. return out >>> 0;
  22671. };
  22672. var permuteTable = [
  22673. 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
  22674. 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
  22675. ];
  22676. exports.permute = function permute(num) {
  22677. var out = 0;
  22678. for (var i = 0; i < permuteTable.length; i++) {
  22679. out <<= 1;
  22680. out |= (num >>> permuteTable[i]) & 0x1;
  22681. }
  22682. return out >>> 0;
  22683. };
  22684. exports.padSplit = function padSplit(num, size, group) {
  22685. var str = num.toString(2);
  22686. while (str.length < size)
  22687. str = '0' + str;
  22688. var out = [];
  22689. for (var i = 0; i < size; i += group)
  22690. out.push(str.slice(i, i + group));
  22691. return out.join(' ');
  22692. };
  22693. /***/ },
  22694. /* 230 */
  22695. /***/ function(module, exports, __webpack_require__) {
  22696. /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(105)
  22697. var primes = __webpack_require__(255)
  22698. var DH = __webpack_require__(231)
  22699. function getDiffieHellman (mod) {
  22700. var prime = new Buffer(primes[mod].prime, 'hex')
  22701. var gen = new Buffer(primes[mod].gen, 'hex')
  22702. return new DH(prime, gen)
  22703. }
  22704. var ENCODINGS = {
  22705. 'binary': true, 'hex': true, 'base64': true
  22706. }
  22707. function createDiffieHellman (prime, enc, generator, genc) {
  22708. if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
  22709. return createDiffieHellman(prime, 'binary', enc, generator)
  22710. }
  22711. enc = enc || 'binary'
  22712. genc = genc || 'binary'
  22713. generator = generator || new Buffer([2])
  22714. if (!Buffer.isBuffer(generator)) {
  22715. generator = new Buffer(generator, genc)
  22716. }
  22717. if (typeof prime === 'number') {
  22718. return new DH(generatePrime(prime, generator), generator, true)
  22719. }
  22720. if (!Buffer.isBuffer(prime)) {
  22721. prime = new Buffer(prime, enc)
  22722. }
  22723. return new DH(prime, generator, true)
  22724. }
  22725. exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
  22726. exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
  22727. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  22728. /***/ },
  22729. /* 231 */
  22730. /***/ function(module, exports, __webpack_require__) {
  22731. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(2);
  22732. var MillerRabin = __webpack_require__(109);
  22733. var millerRabin = new MillerRabin();
  22734. var TWENTYFOUR = new BN(24);
  22735. var ELEVEN = new BN(11);
  22736. var TEN = new BN(10);
  22737. var THREE = new BN(3);
  22738. var SEVEN = new BN(7);
  22739. var primes = __webpack_require__(105);
  22740. var randomBytes = __webpack_require__(31);
  22741. module.exports = DH;
  22742. function setPublicKey(pub, enc) {
  22743. enc = enc || 'utf8';
  22744. if (!Buffer.isBuffer(pub)) {
  22745. pub = new Buffer(pub, enc);
  22746. }
  22747. this._pub = new BN(pub);
  22748. return this;
  22749. }
  22750. function setPrivateKey(priv, enc) {
  22751. enc = enc || 'utf8';
  22752. if (!Buffer.isBuffer(priv)) {
  22753. priv = new Buffer(priv, enc);
  22754. }
  22755. this._priv = new BN(priv);
  22756. return this;
  22757. }
  22758. var primeCache = {};
  22759. function checkPrime(prime, generator) {
  22760. var gen = generator.toString('hex');
  22761. var hex = [gen, prime.toString(16)].join('_');
  22762. if (hex in primeCache) {
  22763. return primeCache[hex];
  22764. }
  22765. var error = 0;
  22766. if (prime.isEven() ||
  22767. !primes.simpleSieve ||
  22768. !primes.fermatTest(prime) ||
  22769. !millerRabin.test(prime)) {
  22770. //not a prime so +1
  22771. error += 1;
  22772. if (gen === '02' || gen === '05') {
  22773. // we'd be able to check the generator
  22774. // it would fail so +8
  22775. error += 8;
  22776. } else {
  22777. //we wouldn't be able to test the generator
  22778. // so +4
  22779. error += 4;
  22780. }
  22781. primeCache[hex] = error;
  22782. return error;
  22783. }
  22784. if (!millerRabin.test(prime.shrn(1))) {
  22785. //not a safe prime
  22786. error += 2;
  22787. }
  22788. var rem;
  22789. switch (gen) {
  22790. case '02':
  22791. if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
  22792. // unsuidable generator
  22793. error += 8;
  22794. }
  22795. break;
  22796. case '05':
  22797. rem = prime.mod(TEN);
  22798. if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
  22799. // prime mod 10 needs to equal 3 or 7
  22800. error += 8;
  22801. }
  22802. break;
  22803. default:
  22804. error += 4;
  22805. }
  22806. primeCache[hex] = error;
  22807. return error;
  22808. }
  22809. function DH(prime, generator, malleable) {
  22810. this.setGenerator(generator);
  22811. this.__prime = new BN(prime);
  22812. this._prime = BN.mont(this.__prime);
  22813. this._primeLen = prime.length;
  22814. this._pub = undefined;
  22815. this._priv = undefined;
  22816. this._primeCode = undefined;
  22817. if (malleable) {
  22818. this.setPublicKey = setPublicKey;
  22819. this.setPrivateKey = setPrivateKey;
  22820. } else {
  22821. this._primeCode = 8;
  22822. }
  22823. }
  22824. Object.defineProperty(DH.prototype, 'verifyError', {
  22825. enumerable: true,
  22826. get: function () {
  22827. if (typeof this._primeCode !== 'number') {
  22828. this._primeCode = checkPrime(this.__prime, this.__gen);
  22829. }
  22830. return this._primeCode;
  22831. }
  22832. });
  22833. DH.prototype.generateKeys = function () {
  22834. if (!this._priv) {
  22835. this._priv = new BN(randomBytes(this._primeLen));
  22836. }
  22837. this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
  22838. return this.getPublicKey();
  22839. };
  22840. DH.prototype.computeSecret = function (other) {
  22841. other = new BN(other);
  22842. other = other.toRed(this._prime);
  22843. var secret = other.redPow(this._priv).fromRed();
  22844. var out = new Buffer(secret.toArray());
  22845. var prime = this.getPrime();
  22846. if (out.length < prime.length) {
  22847. var front = new Buffer(prime.length - out.length);
  22848. front.fill(0);
  22849. out = Buffer.concat([front, out]);
  22850. }
  22851. return out;
  22852. };
  22853. DH.prototype.getPublicKey = function getPublicKey(enc) {
  22854. return formatReturnValue(this._pub, enc);
  22855. };
  22856. DH.prototype.getPrivateKey = function getPrivateKey(enc) {
  22857. return formatReturnValue(this._priv, enc);
  22858. };
  22859. DH.prototype.getPrime = function (enc) {
  22860. return formatReturnValue(this.__prime, enc);
  22861. };
  22862. DH.prototype.getGenerator = function (enc) {
  22863. return formatReturnValue(this._gen, enc);
  22864. };
  22865. DH.prototype.setGenerator = function (gen, enc) {
  22866. enc = enc || 'utf8';
  22867. if (!Buffer.isBuffer(gen)) {
  22868. gen = new Buffer(gen, enc);
  22869. }
  22870. this.__gen = gen;
  22871. this._gen = new BN(gen);
  22872. return this;
  22873. };
  22874. function formatReturnValue(bn, enc) {
  22875. var buf = new Buffer(bn.toArray());
  22876. if (!enc) {
  22877. return buf;
  22878. } else {
  22879. return buf.toString(enc);
  22880. }
  22881. }
  22882. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  22883. /***/ },
  22884. /* 232 */
  22885. /***/ function(module, exports, __webpack_require__) {
  22886. "use strict";
  22887. 'use strict';
  22888. var BN = __webpack_require__(2);
  22889. var elliptic = __webpack_require__(3);
  22890. var utils = elliptic.utils;
  22891. var getNAF = utils.getNAF;
  22892. var getJSF = utils.getJSF;
  22893. var assert = utils.assert;
  22894. function BaseCurve(type, conf) {
  22895. this.type = type;
  22896. this.p = new BN(conf.p, 16);
  22897. // Use Montgomery, when there is no fast reduction for the prime
  22898. this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
  22899. // Useful for many curves
  22900. this.zero = new BN(0).toRed(this.red);
  22901. this.one = new BN(1).toRed(this.red);
  22902. this.two = new BN(2).toRed(this.red);
  22903. // Curve configuration, optional
  22904. this.n = conf.n && new BN(conf.n, 16);
  22905. this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
  22906. // Temporary arrays
  22907. this._wnafT1 = new Array(4);
  22908. this._wnafT2 = new Array(4);
  22909. this._wnafT3 = new Array(4);
  22910. this._wnafT4 = new Array(4);
  22911. // Generalized Greg Maxwell's trick
  22912. var adjustCount = this.n && this.p.div(this.n);
  22913. if (!adjustCount || adjustCount.cmpn(100) > 0) {
  22914. this.redN = null;
  22915. } else {
  22916. this._maxwellTrick = true;
  22917. this.redN = this.n.toRed(this.red);
  22918. }
  22919. }
  22920. module.exports = BaseCurve;
  22921. BaseCurve.prototype.point = function point() {
  22922. throw new Error('Not implemented');
  22923. };
  22924. BaseCurve.prototype.validate = function validate() {
  22925. throw new Error('Not implemented');
  22926. };
  22927. BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
  22928. assert(p.precomputed);
  22929. var doubles = p._getDoubles();
  22930. var naf = getNAF(k, 1);
  22931. var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
  22932. I /= 3;
  22933. // Translate into more windowed form
  22934. var repr = [];
  22935. for (var j = 0; j < naf.length; j += doubles.step) {
  22936. var nafW = 0;
  22937. for (var k = j + doubles.step - 1; k >= j; k--)
  22938. nafW = (nafW << 1) + naf[k];
  22939. repr.push(nafW);
  22940. }
  22941. var a = this.jpoint(null, null, null);
  22942. var b = this.jpoint(null, null, null);
  22943. for (var i = I; i > 0; i--) {
  22944. for (var j = 0; j < repr.length; j++) {
  22945. var nafW = repr[j];
  22946. if (nafW === i)
  22947. b = b.mixedAdd(doubles.points[j]);
  22948. else if (nafW === -i)
  22949. b = b.mixedAdd(doubles.points[j].neg());
  22950. }
  22951. a = a.add(b);
  22952. }
  22953. return a.toP();
  22954. };
  22955. BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
  22956. var w = 4;
  22957. // Precompute window
  22958. var nafPoints = p._getNAFPoints(w);
  22959. w = nafPoints.wnd;
  22960. var wnd = nafPoints.points;
  22961. // Get NAF form
  22962. var naf = getNAF(k, w);
  22963. // Add `this`*(N+1) for every w-NAF index
  22964. var acc = this.jpoint(null, null, null);
  22965. for (var i = naf.length - 1; i >= 0; i--) {
  22966. // Count zeroes
  22967. for (var k = 0; i >= 0 && naf[i] === 0; i--)
  22968. k++;
  22969. if (i >= 0)
  22970. k++;
  22971. acc = acc.dblp(k);
  22972. if (i < 0)
  22973. break;
  22974. var z = naf[i];
  22975. assert(z !== 0);
  22976. if (p.type === 'affine') {
  22977. // J +- P
  22978. if (z > 0)
  22979. acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
  22980. else
  22981. acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
  22982. } else {
  22983. // J +- J
  22984. if (z > 0)
  22985. acc = acc.add(wnd[(z - 1) >> 1]);
  22986. else
  22987. acc = acc.add(wnd[(-z - 1) >> 1].neg());
  22988. }
  22989. }
  22990. return p.type === 'affine' ? acc.toP() : acc;
  22991. };
  22992. BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
  22993. points,
  22994. coeffs,
  22995. len,
  22996. jacobianResult) {
  22997. var wndWidth = this._wnafT1;
  22998. var wnd = this._wnafT2;
  22999. var naf = this._wnafT3;
  23000. // Fill all arrays
  23001. var max = 0;
  23002. for (var i = 0; i < len; i++) {
  23003. var p = points[i];
  23004. var nafPoints = p._getNAFPoints(defW);
  23005. wndWidth[i] = nafPoints.wnd;
  23006. wnd[i] = nafPoints.points;
  23007. }
  23008. // Comb small window NAFs
  23009. for (var i = len - 1; i >= 1; i -= 2) {
  23010. var a = i - 1;
  23011. var b = i;
  23012. if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
  23013. naf[a] = getNAF(coeffs[a], wndWidth[a]);
  23014. naf[b] = getNAF(coeffs[b], wndWidth[b]);
  23015. max = Math.max(naf[a].length, max);
  23016. max = Math.max(naf[b].length, max);
  23017. continue;
  23018. }
  23019. var comb = [
  23020. points[a], /* 1 */
  23021. null, /* 3 */
  23022. null, /* 5 */
  23023. points[b] /* 7 */
  23024. ];
  23025. // Try to avoid Projective points, if possible
  23026. if (points[a].y.cmp(points[b].y) === 0) {
  23027. comb[1] = points[a].add(points[b]);
  23028. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  23029. } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
  23030. comb[1] = points[a].toJ().mixedAdd(points[b]);
  23031. comb[2] = points[a].add(points[b].neg());
  23032. } else {
  23033. comb[1] = points[a].toJ().mixedAdd(points[b]);
  23034. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  23035. }
  23036. var index = [
  23037. -3, /* -1 -1 */
  23038. -1, /* -1 0 */
  23039. -5, /* -1 1 */
  23040. -7, /* 0 -1 */
  23041. 0, /* 0 0 */
  23042. 7, /* 0 1 */
  23043. 5, /* 1 -1 */
  23044. 1, /* 1 0 */
  23045. 3 /* 1 1 */
  23046. ];
  23047. var jsf = getJSF(coeffs[a], coeffs[b]);
  23048. max = Math.max(jsf[0].length, max);
  23049. naf[a] = new Array(max);
  23050. naf[b] = new Array(max);
  23051. for (var j = 0; j < max; j++) {
  23052. var ja = jsf[0][j] | 0;
  23053. var jb = jsf[1][j] | 0;
  23054. naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
  23055. naf[b][j] = 0;
  23056. wnd[a] = comb;
  23057. }
  23058. }
  23059. var acc = this.jpoint(null, null, null);
  23060. var tmp = this._wnafT4;
  23061. for (var i = max; i >= 0; i--) {
  23062. var k = 0;
  23063. while (i >= 0) {
  23064. var zero = true;
  23065. for (var j = 0; j < len; j++) {
  23066. tmp[j] = naf[j][i] | 0;
  23067. if (tmp[j] !== 0)
  23068. zero = false;
  23069. }
  23070. if (!zero)
  23071. break;
  23072. k++;
  23073. i--;
  23074. }
  23075. if (i >= 0)
  23076. k++;
  23077. acc = acc.dblp(k);
  23078. if (i < 0)
  23079. break;
  23080. for (var j = 0; j < len; j++) {
  23081. var z = tmp[j];
  23082. var p;
  23083. if (z === 0)
  23084. continue;
  23085. else if (z > 0)
  23086. p = wnd[j][(z - 1) >> 1];
  23087. else if (z < 0)
  23088. p = wnd[j][(-z - 1) >> 1].neg();
  23089. if (p.type === 'affine')
  23090. acc = acc.mixedAdd(p);
  23091. else
  23092. acc = acc.add(p);
  23093. }
  23094. }
  23095. // Zeroify references
  23096. for (var i = 0; i < len; i++)
  23097. wnd[i] = null;
  23098. if (jacobianResult)
  23099. return acc;
  23100. else
  23101. return acc.toP();
  23102. };
  23103. function BasePoint(curve, type) {
  23104. this.curve = curve;
  23105. this.type = type;
  23106. this.precomputed = null;
  23107. }
  23108. BaseCurve.BasePoint = BasePoint;
  23109. BasePoint.prototype.eq = function eq(/*other*/) {
  23110. throw new Error('Not implemented');
  23111. };
  23112. BasePoint.prototype.validate = function validate() {
  23113. return this.curve.validate(this);
  23114. };
  23115. BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  23116. bytes = utils.toArray(bytes, enc);
  23117. var len = this.p.byteLength();
  23118. // uncompressed, hybrid-odd, hybrid-even
  23119. if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
  23120. bytes.length - 1 === 2 * len) {
  23121. if (bytes[0] === 0x06)
  23122. assert(bytes[bytes.length - 1] % 2 === 0);
  23123. else if (bytes[0] === 0x07)
  23124. assert(bytes[bytes.length - 1] % 2 === 1);
  23125. var res = this.point(bytes.slice(1, 1 + len),
  23126. bytes.slice(1 + len, 1 + 2 * len));
  23127. return res;
  23128. } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
  23129. bytes.length - 1 === len) {
  23130. return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
  23131. }
  23132. throw new Error('Unknown point format');
  23133. };
  23134. BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
  23135. return this.encode(enc, true);
  23136. };
  23137. BasePoint.prototype._encode = function _encode(compact) {
  23138. var len = this.curve.p.byteLength();
  23139. var x = this.getX().toArray('be', len);
  23140. if (compact)
  23141. return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
  23142. return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
  23143. };
  23144. BasePoint.prototype.encode = function encode(enc, compact) {
  23145. return utils.encode(this._encode(compact), enc);
  23146. };
  23147. BasePoint.prototype.precompute = function precompute(power) {
  23148. if (this.precomputed)
  23149. return this;
  23150. var precomputed = {
  23151. doubles: null,
  23152. naf: null,
  23153. beta: null
  23154. };
  23155. precomputed.naf = this._getNAFPoints(8);
  23156. precomputed.doubles = this._getDoubles(4, power);
  23157. precomputed.beta = this._getBeta();
  23158. this.precomputed = precomputed;
  23159. return this;
  23160. };
  23161. BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
  23162. if (!this.precomputed)
  23163. return false;
  23164. var doubles = this.precomputed.doubles;
  23165. if (!doubles)
  23166. return false;
  23167. return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
  23168. };
  23169. BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
  23170. if (this.precomputed && this.precomputed.doubles)
  23171. return this.precomputed.doubles;
  23172. var doubles = [ this ];
  23173. var acc = this;
  23174. for (var i = 0; i < power; i += step) {
  23175. for (var j = 0; j < step; j++)
  23176. acc = acc.dbl();
  23177. doubles.push(acc);
  23178. }
  23179. return {
  23180. step: step,
  23181. points: doubles
  23182. };
  23183. };
  23184. BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
  23185. if (this.precomputed && this.precomputed.naf)
  23186. return this.precomputed.naf;
  23187. var res = [ this ];
  23188. var max = (1 << wnd) - 1;
  23189. var dbl = max === 1 ? null : this.dbl();
  23190. for (var i = 1; i < max; i++)
  23191. res[i] = res[i - 1].add(dbl);
  23192. return {
  23193. wnd: wnd,
  23194. points: res
  23195. };
  23196. };
  23197. BasePoint.prototype._getBeta = function _getBeta() {
  23198. return null;
  23199. };
  23200. BasePoint.prototype.dblp = function dblp(k) {
  23201. var r = this;
  23202. for (var i = 0; i < k; i++)
  23203. r = r.dbl();
  23204. return r;
  23205. };
  23206. /***/ },
  23207. /* 233 */
  23208. /***/ function(module, exports, __webpack_require__) {
  23209. "use strict";
  23210. 'use strict';
  23211. var curve = __webpack_require__(43);
  23212. var elliptic = __webpack_require__(3);
  23213. var BN = __webpack_require__(2);
  23214. var inherits = __webpack_require__(1);
  23215. var Base = curve.base;
  23216. var assert = elliptic.utils.assert;
  23217. function EdwardsCurve(conf) {
  23218. // NOTE: Important as we are creating point in Base.call()
  23219. this.twisted = (conf.a | 0) !== 1;
  23220. this.mOneA = this.twisted && (conf.a | 0) === -1;
  23221. this.extended = this.mOneA;
  23222. Base.call(this, 'edwards', conf);
  23223. this.a = new BN(conf.a, 16).umod(this.red.m);
  23224. this.a = this.a.toRed(this.red);
  23225. this.c = new BN(conf.c, 16).toRed(this.red);
  23226. this.c2 = this.c.redSqr();
  23227. this.d = new BN(conf.d, 16).toRed(this.red);
  23228. this.dd = this.d.redAdd(this.d);
  23229. assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
  23230. this.oneC = (conf.c | 0) === 1;
  23231. }
  23232. inherits(EdwardsCurve, Base);
  23233. module.exports = EdwardsCurve;
  23234. EdwardsCurve.prototype._mulA = function _mulA(num) {
  23235. if (this.mOneA)
  23236. return num.redNeg();
  23237. else
  23238. return this.a.redMul(num);
  23239. };
  23240. EdwardsCurve.prototype._mulC = function _mulC(num) {
  23241. if (this.oneC)
  23242. return num;
  23243. else
  23244. return this.c.redMul(num);
  23245. };
  23246. // Just for compatibility with Short curve
  23247. EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
  23248. return this.point(x, y, z, t);
  23249. };
  23250. EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23251. x = new BN(x, 16);
  23252. if (!x.red)
  23253. x = x.toRed(this.red);
  23254. var x2 = x.redSqr();
  23255. var rhs = this.c2.redSub(this.a.redMul(x2));
  23256. var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
  23257. var y2 = rhs.redMul(lhs.redInvm());
  23258. var y = y2.redSqrt();
  23259. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23260. throw new Error('invalid point');
  23261. var isOdd = y.fromRed().isOdd();
  23262. if (odd && !isOdd || !odd && isOdd)
  23263. y = y.redNeg();
  23264. return this.point(x, y);
  23265. };
  23266. EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
  23267. y = new BN(y, 16);
  23268. if (!y.red)
  23269. y = y.toRed(this.red);
  23270. // x^2 = (y^2 - 1) / (d y^2 + 1)
  23271. var y2 = y.redSqr();
  23272. var lhs = y2.redSub(this.one);
  23273. var rhs = y2.redMul(this.d).redAdd(this.one);
  23274. var x2 = lhs.redMul(rhs.redInvm());
  23275. if (x2.cmp(this.zero) === 0) {
  23276. if (odd)
  23277. throw new Error('invalid point');
  23278. else
  23279. return this.point(this.zero, y);
  23280. }
  23281. var x = x2.redSqrt();
  23282. if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
  23283. throw new Error('invalid point');
  23284. if (x.isOdd() !== odd)
  23285. x = x.redNeg();
  23286. return this.point(x, y);
  23287. };
  23288. EdwardsCurve.prototype.validate = function validate(point) {
  23289. if (point.isInfinity())
  23290. return true;
  23291. // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
  23292. point.normalize();
  23293. var x2 = point.x.redSqr();
  23294. var y2 = point.y.redSqr();
  23295. var lhs = x2.redMul(this.a).redAdd(y2);
  23296. var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
  23297. return lhs.cmp(rhs) === 0;
  23298. };
  23299. function Point(curve, x, y, z, t) {
  23300. Base.BasePoint.call(this, curve, 'projective');
  23301. if (x === null && y === null && z === null) {
  23302. this.x = this.curve.zero;
  23303. this.y = this.curve.one;
  23304. this.z = this.curve.one;
  23305. this.t = this.curve.zero;
  23306. this.zOne = true;
  23307. } else {
  23308. this.x = new BN(x, 16);
  23309. this.y = new BN(y, 16);
  23310. this.z = z ? new BN(z, 16) : this.curve.one;
  23311. this.t = t && new BN(t, 16);
  23312. if (!this.x.red)
  23313. this.x = this.x.toRed(this.curve.red);
  23314. if (!this.y.red)
  23315. this.y = this.y.toRed(this.curve.red);
  23316. if (!this.z.red)
  23317. this.z = this.z.toRed(this.curve.red);
  23318. if (this.t && !this.t.red)
  23319. this.t = this.t.toRed(this.curve.red);
  23320. this.zOne = this.z === this.curve.one;
  23321. // Use extended coordinates
  23322. if (this.curve.extended && !this.t) {
  23323. this.t = this.x.redMul(this.y);
  23324. if (!this.zOne)
  23325. this.t = this.t.redMul(this.z.redInvm());
  23326. }
  23327. }
  23328. }
  23329. inherits(Point, Base.BasePoint);
  23330. EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23331. return Point.fromJSON(this, obj);
  23332. };
  23333. EdwardsCurve.prototype.point = function point(x, y, z, t) {
  23334. return new Point(this, x, y, z, t);
  23335. };
  23336. Point.fromJSON = function fromJSON(curve, obj) {
  23337. return new Point(curve, obj[0], obj[1], obj[2]);
  23338. };
  23339. Point.prototype.inspect = function inspect() {
  23340. if (this.isInfinity())
  23341. return '<EC Point Infinity>';
  23342. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23343. ' y: ' + this.y.fromRed().toString(16, 2) +
  23344. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23345. };
  23346. Point.prototype.isInfinity = function isInfinity() {
  23347. // XXX This code assumes that zero is always zero in red
  23348. return this.x.cmpn(0) === 0 &&
  23349. this.y.cmp(this.z) === 0;
  23350. };
  23351. Point.prototype._extDbl = function _extDbl() {
  23352. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23353. // #doubling-dbl-2008-hwcd
  23354. // 4M + 4S
  23355. // A = X1^2
  23356. var a = this.x.redSqr();
  23357. // B = Y1^2
  23358. var b = this.y.redSqr();
  23359. // C = 2 * Z1^2
  23360. var c = this.z.redSqr();
  23361. c = c.redIAdd(c);
  23362. // D = a * A
  23363. var d = this.curve._mulA(a);
  23364. // E = (X1 + Y1)^2 - A - B
  23365. var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
  23366. // G = D + B
  23367. var g = d.redAdd(b);
  23368. // F = G - C
  23369. var f = g.redSub(c);
  23370. // H = D - B
  23371. var h = d.redSub(b);
  23372. // X3 = E * F
  23373. var nx = e.redMul(f);
  23374. // Y3 = G * H
  23375. var ny = g.redMul(h);
  23376. // T3 = E * H
  23377. var nt = e.redMul(h);
  23378. // Z3 = F * G
  23379. var nz = f.redMul(g);
  23380. return this.curve.point(nx, ny, nz, nt);
  23381. };
  23382. Point.prototype._projDbl = function _projDbl() {
  23383. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23384. // #doubling-dbl-2008-bbjlp
  23385. // #doubling-dbl-2007-bl
  23386. // and others
  23387. // Generally 3M + 4S or 2M + 4S
  23388. // B = (X1 + Y1)^2
  23389. var b = this.x.redAdd(this.y).redSqr();
  23390. // C = X1^2
  23391. var c = this.x.redSqr();
  23392. // D = Y1^2
  23393. var d = this.y.redSqr();
  23394. var nx;
  23395. var ny;
  23396. var nz;
  23397. if (this.curve.twisted) {
  23398. // E = a * C
  23399. var e = this.curve._mulA(c);
  23400. // F = E + D
  23401. var f = e.redAdd(d);
  23402. if (this.zOne) {
  23403. // X3 = (B - C - D) * (F - 2)
  23404. nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
  23405. // Y3 = F * (E - D)
  23406. ny = f.redMul(e.redSub(d));
  23407. // Z3 = F^2 - 2 * F
  23408. nz = f.redSqr().redSub(f).redSub(f);
  23409. } else {
  23410. // H = Z1^2
  23411. var h = this.z.redSqr();
  23412. // J = F - 2 * H
  23413. var j = f.redSub(h).redISub(h);
  23414. // X3 = (B-C-D)*J
  23415. nx = b.redSub(c).redISub(d).redMul(j);
  23416. // Y3 = F * (E - D)
  23417. ny = f.redMul(e.redSub(d));
  23418. // Z3 = F * J
  23419. nz = f.redMul(j);
  23420. }
  23421. } else {
  23422. // E = C + D
  23423. var e = c.redAdd(d);
  23424. // H = (c * Z1)^2
  23425. var h = this.curve._mulC(this.c.redMul(this.z)).redSqr();
  23426. // J = E - 2 * H
  23427. var j = e.redSub(h).redSub(h);
  23428. // X3 = c * (B - E) * J
  23429. nx = this.curve._mulC(b.redISub(e)).redMul(j);
  23430. // Y3 = c * E * (C - D)
  23431. ny = this.curve._mulC(e).redMul(c.redISub(d));
  23432. // Z3 = E * J
  23433. nz = e.redMul(j);
  23434. }
  23435. return this.curve.point(nx, ny, nz);
  23436. };
  23437. Point.prototype.dbl = function dbl() {
  23438. if (this.isInfinity())
  23439. return this;
  23440. // Double in extended coordinates
  23441. if (this.curve.extended)
  23442. return this._extDbl();
  23443. else
  23444. return this._projDbl();
  23445. };
  23446. Point.prototype._extAdd = function _extAdd(p) {
  23447. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23448. // #addition-add-2008-hwcd-3
  23449. // 8M
  23450. // A = (Y1 - X1) * (Y2 - X2)
  23451. var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
  23452. // B = (Y1 + X1) * (Y2 + X2)
  23453. var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
  23454. // C = T1 * k * T2
  23455. var c = this.t.redMul(this.curve.dd).redMul(p.t);
  23456. // D = Z1 * 2 * Z2
  23457. var d = this.z.redMul(p.z.redAdd(p.z));
  23458. // E = B - A
  23459. var e = b.redSub(a);
  23460. // F = D - C
  23461. var f = d.redSub(c);
  23462. // G = D + C
  23463. var g = d.redAdd(c);
  23464. // H = B + A
  23465. var h = b.redAdd(a);
  23466. // X3 = E * F
  23467. var nx = e.redMul(f);
  23468. // Y3 = G * H
  23469. var ny = g.redMul(h);
  23470. // T3 = E * H
  23471. var nt = e.redMul(h);
  23472. // Z3 = F * G
  23473. var nz = f.redMul(g);
  23474. return this.curve.point(nx, ny, nz, nt);
  23475. };
  23476. Point.prototype._projAdd = function _projAdd(p) {
  23477. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23478. // #addition-add-2008-bbjlp
  23479. // #addition-add-2007-bl
  23480. // 10M + 1S
  23481. // A = Z1 * Z2
  23482. var a = this.z.redMul(p.z);
  23483. // B = A^2
  23484. var b = a.redSqr();
  23485. // C = X1 * X2
  23486. var c = this.x.redMul(p.x);
  23487. // D = Y1 * Y2
  23488. var d = this.y.redMul(p.y);
  23489. // E = d * C * D
  23490. var e = this.curve.d.redMul(c).redMul(d);
  23491. // F = B - E
  23492. var f = b.redSub(e);
  23493. // G = B + E
  23494. var g = b.redAdd(e);
  23495. // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
  23496. var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
  23497. var nx = a.redMul(f).redMul(tmp);
  23498. var ny;
  23499. var nz;
  23500. if (this.curve.twisted) {
  23501. // Y3 = A * G * (D - a * C)
  23502. ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
  23503. // Z3 = F * G
  23504. nz = f.redMul(g);
  23505. } else {
  23506. // Y3 = A * G * (D - C)
  23507. ny = a.redMul(g).redMul(d.redSub(c));
  23508. // Z3 = c * F * G
  23509. nz = this.curve._mulC(f).redMul(g);
  23510. }
  23511. return this.curve.point(nx, ny, nz);
  23512. };
  23513. Point.prototype.add = function add(p) {
  23514. if (this.isInfinity())
  23515. return p;
  23516. if (p.isInfinity())
  23517. return this;
  23518. if (this.curve.extended)
  23519. return this._extAdd(p);
  23520. else
  23521. return this._projAdd(p);
  23522. };
  23523. Point.prototype.mul = function mul(k) {
  23524. if (this._hasDoubles(k))
  23525. return this.curve._fixedNafMul(this, k);
  23526. else
  23527. return this.curve._wnafMul(this, k);
  23528. };
  23529. Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
  23530. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
  23531. };
  23532. Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
  23533. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
  23534. };
  23535. Point.prototype.normalize = function normalize() {
  23536. if (this.zOne)
  23537. return this;
  23538. // Normalize coordinates
  23539. var zi = this.z.redInvm();
  23540. this.x = this.x.redMul(zi);
  23541. this.y = this.y.redMul(zi);
  23542. if (this.t)
  23543. this.t = this.t.redMul(zi);
  23544. this.z = this.curve.one;
  23545. this.zOne = true;
  23546. return this;
  23547. };
  23548. Point.prototype.neg = function neg() {
  23549. return this.curve.point(this.x.redNeg(),
  23550. this.y,
  23551. this.z,
  23552. this.t && this.t.redNeg());
  23553. };
  23554. Point.prototype.getX = function getX() {
  23555. this.normalize();
  23556. return this.x.fromRed();
  23557. };
  23558. Point.prototype.getY = function getY() {
  23559. this.normalize();
  23560. return this.y.fromRed();
  23561. };
  23562. Point.prototype.eq = function eq(other) {
  23563. return this === other ||
  23564. this.getX().cmp(other.getX()) === 0 &&
  23565. this.getY().cmp(other.getY()) === 0;
  23566. };
  23567. Point.prototype.eqXToP = function eqXToP(x) {
  23568. var rx = x.toRed(this.curve.red).redMul(this.z);
  23569. if (this.x.cmp(rx) === 0)
  23570. return true;
  23571. var xc = x.clone();
  23572. var t = this.curve.redN.redMul(this.z);
  23573. for (;;) {
  23574. xc.iadd(this.curve.n);
  23575. if (xc.cmp(this.curve.p) >= 0)
  23576. return false;
  23577. rx.redIAdd(t);
  23578. if (this.x.cmp(rx) === 0)
  23579. return true;
  23580. }
  23581. return false;
  23582. };
  23583. // Compatibility with BaseCurve
  23584. Point.prototype.toP = Point.prototype.normalize;
  23585. Point.prototype.mixedAdd = Point.prototype.add;
  23586. /***/ },
  23587. /* 234 */
  23588. /***/ function(module, exports, __webpack_require__) {
  23589. "use strict";
  23590. 'use strict';
  23591. var curve = __webpack_require__(43);
  23592. var BN = __webpack_require__(2);
  23593. var inherits = __webpack_require__(1);
  23594. var Base = curve.base;
  23595. var elliptic = __webpack_require__(3);
  23596. var utils = elliptic.utils;
  23597. function MontCurve(conf) {
  23598. Base.call(this, 'mont', conf);
  23599. this.a = new BN(conf.a, 16).toRed(this.red);
  23600. this.b = new BN(conf.b, 16).toRed(this.red);
  23601. this.i4 = new BN(4).toRed(this.red).redInvm();
  23602. this.two = new BN(2).toRed(this.red);
  23603. this.a24 = this.i4.redMul(this.a.redAdd(this.two));
  23604. }
  23605. inherits(MontCurve, Base);
  23606. module.exports = MontCurve;
  23607. MontCurve.prototype.validate = function validate(point) {
  23608. var x = point.normalize().x;
  23609. var x2 = x.redSqr();
  23610. var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
  23611. var y = rhs.redSqrt();
  23612. return y.redSqr().cmp(rhs) === 0;
  23613. };
  23614. function Point(curve, x, z) {
  23615. Base.BasePoint.call(this, curve, 'projective');
  23616. if (x === null && z === null) {
  23617. this.x = this.curve.one;
  23618. this.z = this.curve.zero;
  23619. } else {
  23620. this.x = new BN(x, 16);
  23621. this.z = new BN(z, 16);
  23622. if (!this.x.red)
  23623. this.x = this.x.toRed(this.curve.red);
  23624. if (!this.z.red)
  23625. this.z = this.z.toRed(this.curve.red);
  23626. }
  23627. }
  23628. inherits(Point, Base.BasePoint);
  23629. MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  23630. return this.point(utils.toArray(bytes, enc), 1);
  23631. };
  23632. MontCurve.prototype.point = function point(x, z) {
  23633. return new Point(this, x, z);
  23634. };
  23635. MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23636. return Point.fromJSON(this, obj);
  23637. };
  23638. Point.prototype.precompute = function precompute() {
  23639. // No-op
  23640. };
  23641. Point.prototype._encode = function _encode() {
  23642. return this.getX().toArray('be', this.curve.p.byteLength());
  23643. };
  23644. Point.fromJSON = function fromJSON(curve, obj) {
  23645. return new Point(curve, obj[0], obj[1] || curve.one);
  23646. };
  23647. Point.prototype.inspect = function inspect() {
  23648. if (this.isInfinity())
  23649. return '<EC Point Infinity>';
  23650. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23651. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23652. };
  23653. Point.prototype.isInfinity = function isInfinity() {
  23654. // XXX This code assumes that zero is always zero in red
  23655. return this.z.cmpn(0) === 0;
  23656. };
  23657. Point.prototype.dbl = function dbl() {
  23658. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
  23659. // 2M + 2S + 4A
  23660. // A = X1 + Z1
  23661. var a = this.x.redAdd(this.z);
  23662. // AA = A^2
  23663. var aa = a.redSqr();
  23664. // B = X1 - Z1
  23665. var b = this.x.redSub(this.z);
  23666. // BB = B^2
  23667. var bb = b.redSqr();
  23668. // C = AA - BB
  23669. var c = aa.redSub(bb);
  23670. // X3 = AA * BB
  23671. var nx = aa.redMul(bb);
  23672. // Z3 = C * (BB + A24 * C)
  23673. var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
  23674. return this.curve.point(nx, nz);
  23675. };
  23676. Point.prototype.add = function add() {
  23677. throw new Error('Not supported on Montgomery curve');
  23678. };
  23679. Point.prototype.diffAdd = function diffAdd(p, diff) {
  23680. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
  23681. // 4M + 2S + 6A
  23682. // A = X2 + Z2
  23683. var a = this.x.redAdd(this.z);
  23684. // B = X2 - Z2
  23685. var b = this.x.redSub(this.z);
  23686. // C = X3 + Z3
  23687. var c = p.x.redAdd(p.z);
  23688. // D = X3 - Z3
  23689. var d = p.x.redSub(p.z);
  23690. // DA = D * A
  23691. var da = d.redMul(a);
  23692. // CB = C * B
  23693. var cb = c.redMul(b);
  23694. // X5 = Z1 * (DA + CB)^2
  23695. var nx = diff.z.redMul(da.redAdd(cb).redSqr());
  23696. // Z5 = X1 * (DA - CB)^2
  23697. var nz = diff.x.redMul(da.redISub(cb).redSqr());
  23698. return this.curve.point(nx, nz);
  23699. };
  23700. Point.prototype.mul = function mul(k) {
  23701. var t = k.clone();
  23702. var a = this; // (N / 2) * Q + Q
  23703. var b = this.curve.point(null, null); // (N / 2) * Q
  23704. var c = this; // Q
  23705. for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
  23706. bits.push(t.andln(1));
  23707. for (var i = bits.length - 1; i >= 0; i--) {
  23708. if (bits[i] === 0) {
  23709. // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
  23710. a = a.diffAdd(b, c);
  23711. // N * Q = 2 * ((N / 2) * Q + Q))
  23712. b = b.dbl();
  23713. } else {
  23714. // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
  23715. b = a.diffAdd(b, c);
  23716. // N * Q + Q = 2 * ((N / 2) * Q + Q)
  23717. a = a.dbl();
  23718. }
  23719. }
  23720. return b;
  23721. };
  23722. Point.prototype.mulAdd = function mulAdd() {
  23723. throw new Error('Not supported on Montgomery curve');
  23724. };
  23725. Point.prototype.jumlAdd = function jumlAdd() {
  23726. throw new Error('Not supported on Montgomery curve');
  23727. };
  23728. Point.prototype.eq = function eq(other) {
  23729. return this.getX().cmp(other.getX()) === 0;
  23730. };
  23731. Point.prototype.normalize = function normalize() {
  23732. this.x = this.x.redMul(this.z.redInvm());
  23733. this.z = this.curve.one;
  23734. return this;
  23735. };
  23736. Point.prototype.getX = function getX() {
  23737. // Normalize coordinates
  23738. this.normalize();
  23739. return this.x.fromRed();
  23740. };
  23741. /***/ },
  23742. /* 235 */
  23743. /***/ function(module, exports, __webpack_require__) {
  23744. "use strict";
  23745. 'use strict';
  23746. var curve = __webpack_require__(43);
  23747. var elliptic = __webpack_require__(3);
  23748. var BN = __webpack_require__(2);
  23749. var inherits = __webpack_require__(1);
  23750. var Base = curve.base;
  23751. var assert = elliptic.utils.assert;
  23752. function ShortCurve(conf) {
  23753. Base.call(this, 'short', conf);
  23754. this.a = new BN(conf.a, 16).toRed(this.red);
  23755. this.b = new BN(conf.b, 16).toRed(this.red);
  23756. this.tinv = this.two.redInvm();
  23757. this.zeroA = this.a.fromRed().cmpn(0) === 0;
  23758. this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
  23759. // If the curve is endomorphic, precalculate beta and lambda
  23760. this.endo = this._getEndomorphism(conf);
  23761. this._endoWnafT1 = new Array(4);
  23762. this._endoWnafT2 = new Array(4);
  23763. }
  23764. inherits(ShortCurve, Base);
  23765. module.exports = ShortCurve;
  23766. ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
  23767. // No efficient endomorphism
  23768. if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
  23769. return;
  23770. // Compute beta and lambda, that lambda * P = (beta * Px; Py)
  23771. var beta;
  23772. var lambda;
  23773. if (conf.beta) {
  23774. beta = new BN(conf.beta, 16).toRed(this.red);
  23775. } else {
  23776. var betas = this._getEndoRoots(this.p);
  23777. // Choose the smallest beta
  23778. beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
  23779. beta = beta.toRed(this.red);
  23780. }
  23781. if (conf.lambda) {
  23782. lambda = new BN(conf.lambda, 16);
  23783. } else {
  23784. // Choose the lambda that is matching selected beta
  23785. var lambdas = this._getEndoRoots(this.n);
  23786. if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
  23787. lambda = lambdas[0];
  23788. } else {
  23789. lambda = lambdas[1];
  23790. assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
  23791. }
  23792. }
  23793. // Get basis vectors, used for balanced length-two representation
  23794. var basis;
  23795. if (conf.basis) {
  23796. basis = conf.basis.map(function(vec) {
  23797. return {
  23798. a: new BN(vec.a, 16),
  23799. b: new BN(vec.b, 16)
  23800. };
  23801. });
  23802. } else {
  23803. basis = this._getEndoBasis(lambda);
  23804. }
  23805. return {
  23806. beta: beta,
  23807. lambda: lambda,
  23808. basis: basis
  23809. };
  23810. };
  23811. ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
  23812. // Find roots of for x^2 + x + 1 in F
  23813. // Root = (-1 +- Sqrt(-3)) / 2
  23814. //
  23815. var red = num === this.p ? this.red : BN.mont(num);
  23816. var tinv = new BN(2).toRed(red).redInvm();
  23817. var ntinv = tinv.redNeg();
  23818. var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
  23819. var l1 = ntinv.redAdd(s).fromRed();
  23820. var l2 = ntinv.redSub(s).fromRed();
  23821. return [ l1, l2 ];
  23822. };
  23823. ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
  23824. // aprxSqrt >= sqrt(this.n)
  23825. var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
  23826. // 3.74
  23827. // Run EGCD, until r(L + 1) < aprxSqrt
  23828. var u = lambda;
  23829. var v = this.n.clone();
  23830. var x1 = new BN(1);
  23831. var y1 = new BN(0);
  23832. var x2 = new BN(0);
  23833. var y2 = new BN(1);
  23834. // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
  23835. var a0;
  23836. var b0;
  23837. // First vector
  23838. var a1;
  23839. var b1;
  23840. // Second vector
  23841. var a2;
  23842. var b2;
  23843. var prevR;
  23844. var i = 0;
  23845. var r;
  23846. var x;
  23847. while (u.cmpn(0) !== 0) {
  23848. var q = v.div(u);
  23849. r = v.sub(q.mul(u));
  23850. x = x2.sub(q.mul(x1));
  23851. var y = y2.sub(q.mul(y1));
  23852. if (!a1 && r.cmp(aprxSqrt) < 0) {
  23853. a0 = prevR.neg();
  23854. b0 = x1;
  23855. a1 = r.neg();
  23856. b1 = x;
  23857. } else if (a1 && ++i === 2) {
  23858. break;
  23859. }
  23860. prevR = r;
  23861. v = u;
  23862. u = r;
  23863. x2 = x1;
  23864. x1 = x;
  23865. y2 = y1;
  23866. y1 = y;
  23867. }
  23868. a2 = r.neg();
  23869. b2 = x;
  23870. var len1 = a1.sqr().add(b1.sqr());
  23871. var len2 = a2.sqr().add(b2.sqr());
  23872. if (len2.cmp(len1) >= 0) {
  23873. a2 = a0;
  23874. b2 = b0;
  23875. }
  23876. // Normalize signs
  23877. if (a1.negative) {
  23878. a1 = a1.neg();
  23879. b1 = b1.neg();
  23880. }
  23881. if (a2.negative) {
  23882. a2 = a2.neg();
  23883. b2 = b2.neg();
  23884. }
  23885. return [
  23886. { a: a1, b: b1 },
  23887. { a: a2, b: b2 }
  23888. ];
  23889. };
  23890. ShortCurve.prototype._endoSplit = function _endoSplit(k) {
  23891. var basis = this.endo.basis;
  23892. var v1 = basis[0];
  23893. var v2 = basis[1];
  23894. var c1 = v2.b.mul(k).divRound(this.n);
  23895. var c2 = v1.b.neg().mul(k).divRound(this.n);
  23896. var p1 = c1.mul(v1.a);
  23897. var p2 = c2.mul(v2.a);
  23898. var q1 = c1.mul(v1.b);
  23899. var q2 = c2.mul(v2.b);
  23900. // Calculate answer
  23901. var k1 = k.sub(p1).sub(p2);
  23902. var k2 = q1.add(q2).neg();
  23903. return { k1: k1, k2: k2 };
  23904. };
  23905. ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23906. x = new BN(x, 16);
  23907. if (!x.red)
  23908. x = x.toRed(this.red);
  23909. var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
  23910. var y = y2.redSqrt();
  23911. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23912. throw new Error('invalid point');
  23913. // XXX Is there any way to tell if the number is odd without converting it
  23914. // to non-red form?
  23915. var isOdd = y.fromRed().isOdd();
  23916. if (odd && !isOdd || !odd && isOdd)
  23917. y = y.redNeg();
  23918. return this.point(x, y);
  23919. };
  23920. ShortCurve.prototype.validate = function validate(point) {
  23921. if (point.inf)
  23922. return true;
  23923. var x = point.x;
  23924. var y = point.y;
  23925. var ax = this.a.redMul(x);
  23926. var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
  23927. return y.redSqr().redISub(rhs).cmpn(0) === 0;
  23928. };
  23929. ShortCurve.prototype._endoWnafMulAdd =
  23930. function _endoWnafMulAdd(points, coeffs, jacobianResult) {
  23931. var npoints = this._endoWnafT1;
  23932. var ncoeffs = this._endoWnafT2;
  23933. for (var i = 0; i < points.length; i++) {
  23934. var split = this._endoSplit(coeffs[i]);
  23935. var p = points[i];
  23936. var beta = p._getBeta();
  23937. if (split.k1.negative) {
  23938. split.k1.ineg();
  23939. p = p.neg(true);
  23940. }
  23941. if (split.k2.negative) {
  23942. split.k2.ineg();
  23943. beta = beta.neg(true);
  23944. }
  23945. npoints[i * 2] = p;
  23946. npoints[i * 2 + 1] = beta;
  23947. ncoeffs[i * 2] = split.k1;
  23948. ncoeffs[i * 2 + 1] = split.k2;
  23949. }
  23950. var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
  23951. // Clean-up references to points and coefficients
  23952. for (var j = 0; j < i * 2; j++) {
  23953. npoints[j] = null;
  23954. ncoeffs[j] = null;
  23955. }
  23956. return res;
  23957. };
  23958. function Point(curve, x, y, isRed) {
  23959. Base.BasePoint.call(this, curve, 'affine');
  23960. if (x === null && y === null) {
  23961. this.x = null;
  23962. this.y = null;
  23963. this.inf = true;
  23964. } else {
  23965. this.x = new BN(x, 16);
  23966. this.y = new BN(y, 16);
  23967. // Force redgomery representation when loading from JSON
  23968. if (isRed) {
  23969. this.x.forceRed(this.curve.red);
  23970. this.y.forceRed(this.curve.red);
  23971. }
  23972. if (!this.x.red)
  23973. this.x = this.x.toRed(this.curve.red);
  23974. if (!this.y.red)
  23975. this.y = this.y.toRed(this.curve.red);
  23976. this.inf = false;
  23977. }
  23978. }
  23979. inherits(Point, Base.BasePoint);
  23980. ShortCurve.prototype.point = function point(x, y, isRed) {
  23981. return new Point(this, x, y, isRed);
  23982. };
  23983. ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
  23984. return Point.fromJSON(this, obj, red);
  23985. };
  23986. Point.prototype._getBeta = function _getBeta() {
  23987. if (!this.curve.endo)
  23988. return;
  23989. var pre = this.precomputed;
  23990. if (pre && pre.beta)
  23991. return pre.beta;
  23992. var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  23993. if (pre) {
  23994. var curve = this.curve;
  23995. var endoMul = function(p) {
  23996. return curve.point(p.x.redMul(curve.endo.beta), p.y);
  23997. };
  23998. pre.beta = beta;
  23999. beta.precomputed = {
  24000. beta: null,
  24001. naf: pre.naf && {
  24002. wnd: pre.naf.wnd,
  24003. points: pre.naf.points.map(endoMul)
  24004. },
  24005. doubles: pre.doubles && {
  24006. step: pre.doubles.step,
  24007. points: pre.doubles.points.map(endoMul)
  24008. }
  24009. };
  24010. }
  24011. return beta;
  24012. };
  24013. Point.prototype.toJSON = function toJSON() {
  24014. if (!this.precomputed)
  24015. return [ this.x, this.y ];
  24016. return [ this.x, this.y, this.precomputed && {
  24017. doubles: this.precomputed.doubles && {
  24018. step: this.precomputed.doubles.step,
  24019. points: this.precomputed.doubles.points.slice(1)
  24020. },
  24021. naf: this.precomputed.naf && {
  24022. wnd: this.precomputed.naf.wnd,
  24023. points: this.precomputed.naf.points.slice(1)
  24024. }
  24025. } ];
  24026. };
  24027. Point.fromJSON = function fromJSON(curve, obj, red) {
  24028. if (typeof obj === 'string')
  24029. obj = JSON.parse(obj);
  24030. var res = curve.point(obj[0], obj[1], red);
  24031. if (!obj[2])
  24032. return res;
  24033. function obj2point(obj) {
  24034. return curve.point(obj[0], obj[1], red);
  24035. }
  24036. var pre = obj[2];
  24037. res.precomputed = {
  24038. beta: null,
  24039. doubles: pre.doubles && {
  24040. step: pre.doubles.step,
  24041. points: [ res ].concat(pre.doubles.points.map(obj2point))
  24042. },
  24043. naf: pre.naf && {
  24044. wnd: pre.naf.wnd,
  24045. points: [ res ].concat(pre.naf.points.map(obj2point))
  24046. }
  24047. };
  24048. return res;
  24049. };
  24050. Point.prototype.inspect = function inspect() {
  24051. if (this.isInfinity())
  24052. return '<EC Point Infinity>';
  24053. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  24054. ' y: ' + this.y.fromRed().toString(16, 2) + '>';
  24055. };
  24056. Point.prototype.isInfinity = function isInfinity() {
  24057. return this.inf;
  24058. };
  24059. Point.prototype.add = function add(p) {
  24060. // O + P = P
  24061. if (this.inf)
  24062. return p;
  24063. // P + O = P
  24064. if (p.inf)
  24065. return this;
  24066. // P + P = 2P
  24067. if (this.eq(p))
  24068. return this.dbl();
  24069. // P + (-P) = O
  24070. if (this.neg().eq(p))
  24071. return this.curve.point(null, null);
  24072. // P + Q = O
  24073. if (this.x.cmp(p.x) === 0)
  24074. return this.curve.point(null, null);
  24075. var c = this.y.redSub(p.y);
  24076. if (c.cmpn(0) !== 0)
  24077. c = c.redMul(this.x.redSub(p.x).redInvm());
  24078. var nx = c.redSqr().redISub(this.x).redISub(p.x);
  24079. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  24080. return this.curve.point(nx, ny);
  24081. };
  24082. Point.prototype.dbl = function dbl() {
  24083. if (this.inf)
  24084. return this;
  24085. // 2P = O
  24086. var ys1 = this.y.redAdd(this.y);
  24087. if (ys1.cmpn(0) === 0)
  24088. return this.curve.point(null, null);
  24089. var a = this.curve.a;
  24090. var x2 = this.x.redSqr();
  24091. var dyinv = ys1.redInvm();
  24092. var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
  24093. var nx = c.redSqr().redISub(this.x.redAdd(this.x));
  24094. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  24095. return this.curve.point(nx, ny);
  24096. };
  24097. Point.prototype.getX = function getX() {
  24098. return this.x.fromRed();
  24099. };
  24100. Point.prototype.getY = function getY() {
  24101. return this.y.fromRed();
  24102. };
  24103. Point.prototype.mul = function mul(k) {
  24104. k = new BN(k, 16);
  24105. if (this._hasDoubles(k))
  24106. return this.curve._fixedNafMul(this, k);
  24107. else if (this.curve.endo)
  24108. return this.curve._endoWnafMulAdd([ this ], [ k ]);
  24109. else
  24110. return this.curve._wnafMul(this, k);
  24111. };
  24112. Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
  24113. var points = [ this, p2 ];
  24114. var coeffs = [ k1, k2 ];
  24115. if (this.curve.endo)
  24116. return this.curve._endoWnafMulAdd(points, coeffs);
  24117. else
  24118. return this.curve._wnafMulAdd(1, points, coeffs, 2);
  24119. };
  24120. Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
  24121. var points = [ this, p2 ];
  24122. var coeffs = [ k1, k2 ];
  24123. if (this.curve.endo)
  24124. return this.curve._endoWnafMulAdd(points, coeffs, true);
  24125. else
  24126. return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
  24127. };
  24128. Point.prototype.eq = function eq(p) {
  24129. return this === p ||
  24130. this.inf === p.inf &&
  24131. (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
  24132. };
  24133. Point.prototype.neg = function neg(_precompute) {
  24134. if (this.inf)
  24135. return this;
  24136. var res = this.curve.point(this.x, this.y.redNeg());
  24137. if (_precompute && this.precomputed) {
  24138. var pre = this.precomputed;
  24139. var negate = function(p) {
  24140. return p.neg();
  24141. };
  24142. res.precomputed = {
  24143. naf: pre.naf && {
  24144. wnd: pre.naf.wnd,
  24145. points: pre.naf.points.map(negate)
  24146. },
  24147. doubles: pre.doubles && {
  24148. step: pre.doubles.step,
  24149. points: pre.doubles.points.map(negate)
  24150. }
  24151. };
  24152. }
  24153. return res;
  24154. };
  24155. Point.prototype.toJ = function toJ() {
  24156. if (this.inf)
  24157. return this.curve.jpoint(null, null, null);
  24158. var res = this.curve.jpoint(this.x, this.y, this.curve.one);
  24159. return res;
  24160. };
  24161. function JPoint(curve, x, y, z) {
  24162. Base.BasePoint.call(this, curve, 'jacobian');
  24163. if (x === null && y === null && z === null) {
  24164. this.x = this.curve.one;
  24165. this.y = this.curve.one;
  24166. this.z = new BN(0);
  24167. } else {
  24168. this.x = new BN(x, 16);
  24169. this.y = new BN(y, 16);
  24170. this.z = new BN(z, 16);
  24171. }
  24172. if (!this.x.red)
  24173. this.x = this.x.toRed(this.curve.red);
  24174. if (!this.y.red)
  24175. this.y = this.y.toRed(this.curve.red);
  24176. if (!this.z.red)
  24177. this.z = this.z.toRed(this.curve.red);
  24178. this.zOne = this.z === this.curve.one;
  24179. }
  24180. inherits(JPoint, Base.BasePoint);
  24181. ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
  24182. return new JPoint(this, x, y, z);
  24183. };
  24184. JPoint.prototype.toP = function toP() {
  24185. if (this.isInfinity())
  24186. return this.curve.point(null, null);
  24187. var zinv = this.z.redInvm();
  24188. var zinv2 = zinv.redSqr();
  24189. var ax = this.x.redMul(zinv2);
  24190. var ay = this.y.redMul(zinv2).redMul(zinv);
  24191. return this.curve.point(ax, ay);
  24192. };
  24193. JPoint.prototype.neg = function neg() {
  24194. return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
  24195. };
  24196. JPoint.prototype.add = function add(p) {
  24197. // O + P = P
  24198. if (this.isInfinity())
  24199. return p;
  24200. // P + O = P
  24201. if (p.isInfinity())
  24202. return this;
  24203. // 12M + 4S + 7A
  24204. var pz2 = p.z.redSqr();
  24205. var z2 = this.z.redSqr();
  24206. var u1 = this.x.redMul(pz2);
  24207. var u2 = p.x.redMul(z2);
  24208. var s1 = this.y.redMul(pz2.redMul(p.z));
  24209. var s2 = p.y.redMul(z2.redMul(this.z));
  24210. var h = u1.redSub(u2);
  24211. var r = s1.redSub(s2);
  24212. if (h.cmpn(0) === 0) {
  24213. if (r.cmpn(0) !== 0)
  24214. return this.curve.jpoint(null, null, null);
  24215. else
  24216. return this.dbl();
  24217. }
  24218. var h2 = h.redSqr();
  24219. var h3 = h2.redMul(h);
  24220. var v = u1.redMul(h2);
  24221. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  24222. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  24223. var nz = this.z.redMul(p.z).redMul(h);
  24224. return this.curve.jpoint(nx, ny, nz);
  24225. };
  24226. JPoint.prototype.mixedAdd = function mixedAdd(p) {
  24227. // O + P = P
  24228. if (this.isInfinity())
  24229. return p.toJ();
  24230. // P + O = P
  24231. if (p.isInfinity())
  24232. return this;
  24233. // 8M + 3S + 7A
  24234. var z2 = this.z.redSqr();
  24235. var u1 = this.x;
  24236. var u2 = p.x.redMul(z2);
  24237. var s1 = this.y;
  24238. var s2 = p.y.redMul(z2).redMul(this.z);
  24239. var h = u1.redSub(u2);
  24240. var r = s1.redSub(s2);
  24241. if (h.cmpn(0) === 0) {
  24242. if (r.cmpn(0) !== 0)
  24243. return this.curve.jpoint(null, null, null);
  24244. else
  24245. return this.dbl();
  24246. }
  24247. var h2 = h.redSqr();
  24248. var h3 = h2.redMul(h);
  24249. var v = u1.redMul(h2);
  24250. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  24251. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  24252. var nz = this.z.redMul(h);
  24253. return this.curve.jpoint(nx, ny, nz);
  24254. };
  24255. JPoint.prototype.dblp = function dblp(pow) {
  24256. if (pow === 0)
  24257. return this;
  24258. if (this.isInfinity())
  24259. return this;
  24260. if (!pow)
  24261. return this.dbl();
  24262. if (this.curve.zeroA || this.curve.threeA) {
  24263. var r = this;
  24264. for (var i = 0; i < pow; i++)
  24265. r = r.dbl();
  24266. return r;
  24267. }
  24268. // 1M + 2S + 1A + N * (4S + 5M + 8A)
  24269. // N = 1 => 6M + 6S + 9A
  24270. var a = this.curve.a;
  24271. var tinv = this.curve.tinv;
  24272. var jx = this.x;
  24273. var jy = this.y;
  24274. var jz = this.z;
  24275. var jz4 = jz.redSqr().redSqr();
  24276. // Reuse results
  24277. var jyd = jy.redAdd(jy);
  24278. for (var i = 0; i < pow; i++) {
  24279. var jx2 = jx.redSqr();
  24280. var jyd2 = jyd.redSqr();
  24281. var jyd4 = jyd2.redSqr();
  24282. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  24283. var t1 = jx.redMul(jyd2);
  24284. var nx = c.redSqr().redISub(t1.redAdd(t1));
  24285. var t2 = t1.redISub(nx);
  24286. var dny = c.redMul(t2);
  24287. dny = dny.redIAdd(dny).redISub(jyd4);
  24288. var nz = jyd.redMul(jz);
  24289. if (i + 1 < pow)
  24290. jz4 = jz4.redMul(jyd4);
  24291. jx = nx;
  24292. jz = nz;
  24293. jyd = dny;
  24294. }
  24295. return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
  24296. };
  24297. JPoint.prototype.dbl = function dbl() {
  24298. if (this.isInfinity())
  24299. return this;
  24300. if (this.curve.zeroA)
  24301. return this._zeroDbl();
  24302. else if (this.curve.threeA)
  24303. return this._threeDbl();
  24304. else
  24305. return this._dbl();
  24306. };
  24307. JPoint.prototype._zeroDbl = function _zeroDbl() {
  24308. var nx;
  24309. var ny;
  24310. var nz;
  24311. // Z = 1
  24312. if (this.zOne) {
  24313. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  24314. // #doubling-mdbl-2007-bl
  24315. // 1M + 5S + 14A
  24316. // XX = X1^2
  24317. var xx = this.x.redSqr();
  24318. // YY = Y1^2
  24319. var yy = this.y.redSqr();
  24320. // YYYY = YY^2
  24321. var yyyy = yy.redSqr();
  24322. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  24323. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24324. s = s.redIAdd(s);
  24325. // M = 3 * XX + a; a = 0
  24326. var m = xx.redAdd(xx).redIAdd(xx);
  24327. // T = M ^ 2 - 2*S
  24328. var t = m.redSqr().redISub(s).redISub(s);
  24329. // 8 * YYYY
  24330. var yyyy8 = yyyy.redIAdd(yyyy);
  24331. yyyy8 = yyyy8.redIAdd(yyyy8);
  24332. yyyy8 = yyyy8.redIAdd(yyyy8);
  24333. // X3 = T
  24334. nx = t;
  24335. // Y3 = M * (S - T) - 8 * YYYY
  24336. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  24337. // Z3 = 2*Y1
  24338. nz = this.y.redAdd(this.y);
  24339. } else {
  24340. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  24341. // #doubling-dbl-2009-l
  24342. // 2M + 5S + 13A
  24343. // A = X1^2
  24344. var a = this.x.redSqr();
  24345. // B = Y1^2
  24346. var b = this.y.redSqr();
  24347. // C = B^2
  24348. var c = b.redSqr();
  24349. // D = 2 * ((X1 + B)^2 - A - C)
  24350. var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
  24351. d = d.redIAdd(d);
  24352. // E = 3 * A
  24353. var e = a.redAdd(a).redIAdd(a);
  24354. // F = E^2
  24355. var f = e.redSqr();
  24356. // 8 * C
  24357. var c8 = c.redIAdd(c);
  24358. c8 = c8.redIAdd(c8);
  24359. c8 = c8.redIAdd(c8);
  24360. // X3 = F - 2 * D
  24361. nx = f.redISub(d).redISub(d);
  24362. // Y3 = E * (D - X3) - 8 * C
  24363. ny = e.redMul(d.redISub(nx)).redISub(c8);
  24364. // Z3 = 2 * Y1 * Z1
  24365. nz = this.y.redMul(this.z);
  24366. nz = nz.redIAdd(nz);
  24367. }
  24368. return this.curve.jpoint(nx, ny, nz);
  24369. };
  24370. JPoint.prototype._threeDbl = function _threeDbl() {
  24371. var nx;
  24372. var ny;
  24373. var nz;
  24374. // Z = 1
  24375. if (this.zOne) {
  24376. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
  24377. // #doubling-mdbl-2007-bl
  24378. // 1M + 5S + 15A
  24379. // XX = X1^2
  24380. var xx = this.x.redSqr();
  24381. // YY = Y1^2
  24382. var yy = this.y.redSqr();
  24383. // YYYY = YY^2
  24384. var yyyy = yy.redSqr();
  24385. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  24386. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24387. s = s.redIAdd(s);
  24388. // M = 3 * XX + a
  24389. var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
  24390. // T = M^2 - 2 * S
  24391. var t = m.redSqr().redISub(s).redISub(s);
  24392. // X3 = T
  24393. nx = t;
  24394. // Y3 = M * (S - T) - 8 * YYYY
  24395. var yyyy8 = yyyy.redIAdd(yyyy);
  24396. yyyy8 = yyyy8.redIAdd(yyyy8);
  24397. yyyy8 = yyyy8.redIAdd(yyyy8);
  24398. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  24399. // Z3 = 2 * Y1
  24400. nz = this.y.redAdd(this.y);
  24401. } else {
  24402. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
  24403. // 3M + 5S
  24404. // delta = Z1^2
  24405. var delta = this.z.redSqr();
  24406. // gamma = Y1^2
  24407. var gamma = this.y.redSqr();
  24408. // beta = X1 * gamma
  24409. var beta = this.x.redMul(gamma);
  24410. // alpha = 3 * (X1 - delta) * (X1 + delta)
  24411. var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
  24412. alpha = alpha.redAdd(alpha).redIAdd(alpha);
  24413. // X3 = alpha^2 - 8 * beta
  24414. var beta4 = beta.redIAdd(beta);
  24415. beta4 = beta4.redIAdd(beta4);
  24416. var beta8 = beta4.redAdd(beta4);
  24417. nx = alpha.redSqr().redISub(beta8);
  24418. // Z3 = (Y1 + Z1)^2 - gamma - delta
  24419. nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
  24420. // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
  24421. var ggamma8 = gamma.redSqr();
  24422. ggamma8 = ggamma8.redIAdd(ggamma8);
  24423. ggamma8 = ggamma8.redIAdd(ggamma8);
  24424. ggamma8 = ggamma8.redIAdd(ggamma8);
  24425. ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
  24426. }
  24427. return this.curve.jpoint(nx, ny, nz);
  24428. };
  24429. JPoint.prototype._dbl = function _dbl() {
  24430. var a = this.curve.a;
  24431. // 4M + 6S + 10A
  24432. var jx = this.x;
  24433. var jy = this.y;
  24434. var jz = this.z;
  24435. var jz4 = jz.redSqr().redSqr();
  24436. var jx2 = jx.redSqr();
  24437. var jy2 = jy.redSqr();
  24438. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  24439. var jxd4 = jx.redAdd(jx);
  24440. jxd4 = jxd4.redIAdd(jxd4);
  24441. var t1 = jxd4.redMul(jy2);
  24442. var nx = c.redSqr().redISub(t1.redAdd(t1));
  24443. var t2 = t1.redISub(nx);
  24444. var jyd8 = jy2.redSqr();
  24445. jyd8 = jyd8.redIAdd(jyd8);
  24446. jyd8 = jyd8.redIAdd(jyd8);
  24447. jyd8 = jyd8.redIAdd(jyd8);
  24448. var ny = c.redMul(t2).redISub(jyd8);
  24449. var nz = jy.redAdd(jy).redMul(jz);
  24450. return this.curve.jpoint(nx, ny, nz);
  24451. };
  24452. JPoint.prototype.trpl = function trpl() {
  24453. if (!this.curve.zeroA)
  24454. return this.dbl().add(this);
  24455. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
  24456. // 5M + 10S + ...
  24457. // XX = X1^2
  24458. var xx = this.x.redSqr();
  24459. // YY = Y1^2
  24460. var yy = this.y.redSqr();
  24461. // ZZ = Z1^2
  24462. var zz = this.z.redSqr();
  24463. // YYYY = YY^2
  24464. var yyyy = yy.redSqr();
  24465. // M = 3 * XX + a * ZZ2; a = 0
  24466. var m = xx.redAdd(xx).redIAdd(xx);
  24467. // MM = M^2
  24468. var mm = m.redSqr();
  24469. // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
  24470. var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24471. e = e.redIAdd(e);
  24472. e = e.redAdd(e).redIAdd(e);
  24473. e = e.redISub(mm);
  24474. // EE = E^2
  24475. var ee = e.redSqr();
  24476. // T = 16*YYYY
  24477. var t = yyyy.redIAdd(yyyy);
  24478. t = t.redIAdd(t);
  24479. t = t.redIAdd(t);
  24480. t = t.redIAdd(t);
  24481. // U = (M + E)^2 - MM - EE - T
  24482. var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
  24483. // X3 = 4 * (X1 * EE - 4 * YY * U)
  24484. var yyu4 = yy.redMul(u);
  24485. yyu4 = yyu4.redIAdd(yyu4);
  24486. yyu4 = yyu4.redIAdd(yyu4);
  24487. var nx = this.x.redMul(ee).redISub(yyu4);
  24488. nx = nx.redIAdd(nx);
  24489. nx = nx.redIAdd(nx);
  24490. // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
  24491. var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
  24492. ny = ny.redIAdd(ny);
  24493. ny = ny.redIAdd(ny);
  24494. ny = ny.redIAdd(ny);
  24495. // Z3 = (Z1 + E)^2 - ZZ - EE
  24496. var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
  24497. return this.curve.jpoint(nx, ny, nz);
  24498. };
  24499. JPoint.prototype.mul = function mul(k, kbase) {
  24500. k = new BN(k, kbase);
  24501. return this.curve._wnafMul(this, k);
  24502. };
  24503. JPoint.prototype.eq = function eq(p) {
  24504. if (p.type === 'affine')
  24505. return this.eq(p.toJ());
  24506. if (this === p)
  24507. return true;
  24508. // x1 * z2^2 == x2 * z1^2
  24509. var z2 = this.z.redSqr();
  24510. var pz2 = p.z.redSqr();
  24511. if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
  24512. return false;
  24513. // y1 * z2^3 == y2 * z1^3
  24514. var z3 = z2.redMul(this.z);
  24515. var pz3 = pz2.redMul(p.z);
  24516. return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
  24517. };
  24518. JPoint.prototype.eqXToP = function eqXToP(x) {
  24519. var zs = this.z.redSqr();
  24520. var rx = x.toRed(this.curve.red).redMul(zs);
  24521. if (this.x.cmp(rx) === 0)
  24522. return true;
  24523. var xc = x.clone();
  24524. var t = this.curve.redN.redMul(zs);
  24525. for (;;) {
  24526. xc.iadd(this.curve.n);
  24527. if (xc.cmp(this.curve.p) >= 0)
  24528. return false;
  24529. rx.redIAdd(t);
  24530. if (this.x.cmp(rx) === 0)
  24531. return true;
  24532. }
  24533. return false;
  24534. };
  24535. JPoint.prototype.inspect = function inspect() {
  24536. if (this.isInfinity())
  24537. return '<EC JPoint Infinity>';
  24538. return '<EC JPoint x: ' + this.x.toString(16, 2) +
  24539. ' y: ' + this.y.toString(16, 2) +
  24540. ' z: ' + this.z.toString(16, 2) + '>';
  24541. };
  24542. JPoint.prototype.isInfinity = function isInfinity() {
  24543. // XXX This code assumes that zero is always zero in red
  24544. return this.z.cmpn(0) === 0;
  24545. };
  24546. /***/ },
  24547. /* 236 */
  24548. /***/ function(module, exports, __webpack_require__) {
  24549. "use strict";
  24550. 'use strict';
  24551. var curves = exports;
  24552. var hash = __webpack_require__(9);
  24553. var elliptic = __webpack_require__(3);
  24554. var assert = elliptic.utils.assert;
  24555. function PresetCurve(options) {
  24556. if (options.type === 'short')
  24557. this.curve = new elliptic.curve.short(options);
  24558. else if (options.type === 'edwards')
  24559. this.curve = new elliptic.curve.edwards(options);
  24560. else
  24561. this.curve = new elliptic.curve.mont(options);
  24562. this.g = this.curve.g;
  24563. this.n = this.curve.n;
  24564. this.hash = options.hash;
  24565. assert(this.g.validate(), 'Invalid curve');
  24566. assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
  24567. }
  24568. curves.PresetCurve = PresetCurve;
  24569. function defineCurve(name, options) {
  24570. Object.defineProperty(curves, name, {
  24571. configurable: true,
  24572. enumerable: true,
  24573. get: function() {
  24574. var curve = new PresetCurve(options);
  24575. Object.defineProperty(curves, name, {
  24576. configurable: true,
  24577. enumerable: true,
  24578. value: curve
  24579. });
  24580. return curve;
  24581. }
  24582. });
  24583. }
  24584. defineCurve('p192', {
  24585. type: 'short',
  24586. prime: 'p192',
  24587. p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
  24588. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
  24589. b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
  24590. n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
  24591. hash: hash.sha256,
  24592. gRed: false,
  24593. g: [
  24594. '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
  24595. '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
  24596. ]
  24597. });
  24598. defineCurve('p224', {
  24599. type: 'short',
  24600. prime: 'p224',
  24601. p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
  24602. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
  24603. b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
  24604. n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
  24605. hash: hash.sha256,
  24606. gRed: false,
  24607. g: [
  24608. 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
  24609. 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
  24610. ]
  24611. });
  24612. defineCurve('p256', {
  24613. type: 'short',
  24614. prime: null,
  24615. p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
  24616. a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
  24617. b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
  24618. n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
  24619. hash: hash.sha256,
  24620. gRed: false,
  24621. g: [
  24622. '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
  24623. '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
  24624. ]
  24625. });
  24626. defineCurve('p384', {
  24627. type: 'short',
  24628. prime: null,
  24629. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24630. 'fffffffe ffffffff 00000000 00000000 ffffffff',
  24631. a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24632. 'fffffffe ffffffff 00000000 00000000 fffffffc',
  24633. b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
  24634. '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
  24635. n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
  24636. 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
  24637. hash: hash.sha384,
  24638. gRed: false,
  24639. g: [
  24640. 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
  24641. '5502f25d bf55296c 3a545e38 72760ab7',
  24642. '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
  24643. '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
  24644. ]
  24645. });
  24646. defineCurve('p521', {
  24647. type: 'short',
  24648. prime: null,
  24649. p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24650. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24651. 'ffffffff ffffffff ffffffff ffffffff ffffffff',
  24652. a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24653. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24654. 'ffffffff ffffffff ffffffff ffffffff fffffffc',
  24655. b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
  24656. '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
  24657. '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
  24658. n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24659. 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
  24660. 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
  24661. hash: hash.sha512,
  24662. gRed: false,
  24663. g: [
  24664. '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
  24665. '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
  24666. 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
  24667. '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
  24668. '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
  24669. '3fad0761 353c7086 a272c240 88be9476 9fd16650'
  24670. ]
  24671. });
  24672. defineCurve('curve25519', {
  24673. type: 'mont',
  24674. prime: 'p25519',
  24675. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  24676. a: '76d06',
  24677. b: '0',
  24678. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  24679. hash: hash.sha256,
  24680. gRed: false,
  24681. g: [
  24682. '9'
  24683. ]
  24684. });
  24685. defineCurve('ed25519', {
  24686. type: 'edwards',
  24687. prime: 'p25519',
  24688. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  24689. a: '-1',
  24690. c: '1',
  24691. // -121665 * (121666^(-1)) (mod P)
  24692. d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
  24693. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  24694. hash: hash.sha256,
  24695. gRed: false,
  24696. g: [
  24697. '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
  24698. // 4/5
  24699. '6666666666666666666666666666666666666666666666666666666666666658'
  24700. ]
  24701. });
  24702. var pre;
  24703. try {
  24704. pre = __webpack_require__(244);
  24705. } catch (e) {
  24706. pre = undefined;
  24707. }
  24708. defineCurve('secp256k1', {
  24709. type: 'short',
  24710. prime: 'k256',
  24711. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
  24712. a: '0',
  24713. b: '7',
  24714. n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
  24715. h: '1',
  24716. hash: hash.sha256,
  24717. // Precomputed endomorphism
  24718. beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
  24719. lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
  24720. basis: [
  24721. {
  24722. a: '3086d221a7d46bcde86c90e49284eb15',
  24723. b: '-e4437ed6010e88286f547fa90abfe4c3'
  24724. },
  24725. {
  24726. a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
  24727. b: '3086d221a7d46bcde86c90e49284eb15'
  24728. }
  24729. ],
  24730. gRed: false,
  24731. g: [
  24732. '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
  24733. '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  24734. pre
  24735. ]
  24736. });
  24737. /***/ },
  24738. /* 237 */
  24739. /***/ function(module, exports, __webpack_require__) {
  24740. "use strict";
  24741. 'use strict';
  24742. var BN = __webpack_require__(2);
  24743. var elliptic = __webpack_require__(3);
  24744. var utils = elliptic.utils;
  24745. var assert = utils.assert;
  24746. var KeyPair = __webpack_require__(238);
  24747. var Signature = __webpack_require__(239);
  24748. function EC(options) {
  24749. if (!(this instanceof EC))
  24750. return new EC(options);
  24751. // Shortcut `elliptic.ec(curve-name)`
  24752. if (typeof options === 'string') {
  24753. assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);
  24754. options = elliptic.curves[options];
  24755. }
  24756. // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
  24757. if (options instanceof elliptic.curves.PresetCurve)
  24758. options = { curve: options };
  24759. this.curve = options.curve.curve;
  24760. this.n = this.curve.n;
  24761. this.nh = this.n.ushrn(1);
  24762. this.g = this.curve.g;
  24763. // Point on curve
  24764. this.g = options.curve.g;
  24765. this.g.precompute(options.curve.n.bitLength() + 1);
  24766. // Hash for function for DRBG
  24767. this.hash = options.hash || options.curve.hash;
  24768. }
  24769. module.exports = EC;
  24770. EC.prototype.keyPair = function keyPair(options) {
  24771. return new KeyPair(this, options);
  24772. };
  24773. EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
  24774. return KeyPair.fromPrivate(this, priv, enc);
  24775. };
  24776. EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
  24777. return KeyPair.fromPublic(this, pub, enc);
  24778. };
  24779. EC.prototype.genKeyPair = function genKeyPair(options) {
  24780. if (!options)
  24781. options = {};
  24782. // Instantiate Hmac_DRBG
  24783. var drbg = new elliptic.hmacDRBG({
  24784. hash: this.hash,
  24785. pers: options.pers,
  24786. entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
  24787. nonce: this.n.toArray()
  24788. });
  24789. var bytes = this.n.byteLength();
  24790. var ns2 = this.n.sub(new BN(2));
  24791. do {
  24792. var priv = new BN(drbg.generate(bytes));
  24793. if (priv.cmp(ns2) > 0)
  24794. continue;
  24795. priv.iaddn(1);
  24796. return this.keyFromPrivate(priv);
  24797. } while (true);
  24798. };
  24799. EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
  24800. var delta = msg.byteLength() * 8 - this.n.bitLength();
  24801. if (delta > 0)
  24802. msg = msg.ushrn(delta);
  24803. if (!truncOnly && msg.cmp(this.n) >= 0)
  24804. return msg.sub(this.n);
  24805. else
  24806. return msg;
  24807. };
  24808. EC.prototype.sign = function sign(msg, key, enc, options) {
  24809. if (typeof enc === 'object') {
  24810. options = enc;
  24811. enc = null;
  24812. }
  24813. if (!options)
  24814. options = {};
  24815. key = this.keyFromPrivate(key, enc);
  24816. msg = this._truncateToN(new BN(msg, 16));
  24817. // Zero-extend key to provide enough entropy
  24818. var bytes = this.n.byteLength();
  24819. var bkey = key.getPrivate().toArray('be', bytes);
  24820. // Zero-extend nonce to have the same byte size as N
  24821. var nonce = msg.toArray('be', bytes);
  24822. // Instantiate Hmac_DRBG
  24823. var drbg = new elliptic.hmacDRBG({
  24824. hash: this.hash,
  24825. entropy: bkey,
  24826. nonce: nonce,
  24827. pers: options.pers,
  24828. persEnc: options.persEnc
  24829. });
  24830. // Number of bytes to generate
  24831. var ns1 = this.n.sub(new BN(1));
  24832. for (var iter = 0; true; iter++) {
  24833. var k = options.k ?
  24834. options.k(iter) :
  24835. new BN(drbg.generate(this.n.byteLength()));
  24836. k = this._truncateToN(k, true);
  24837. if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
  24838. continue;
  24839. var kp = this.g.mul(k);
  24840. if (kp.isInfinity())
  24841. continue;
  24842. var kpX = kp.getX();
  24843. var r = kpX.umod(this.n);
  24844. if (r.cmpn(0) === 0)
  24845. continue;
  24846. var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
  24847. s = s.umod(this.n);
  24848. if (s.cmpn(0) === 0)
  24849. continue;
  24850. var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
  24851. (kpX.cmp(r) !== 0 ? 2 : 0);
  24852. // Use complement of `s`, if it is > `n / 2`
  24853. if (options.canonical && s.cmp(this.nh) > 0) {
  24854. s = this.n.sub(s);
  24855. recoveryParam ^= 1;
  24856. }
  24857. return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
  24858. }
  24859. };
  24860. EC.prototype.verify = function verify(msg, signature, key, enc) {
  24861. msg = this._truncateToN(new BN(msg, 16));
  24862. key = this.keyFromPublic(key, enc);
  24863. signature = new Signature(signature, 'hex');
  24864. // Perform primitive values validation
  24865. var r = signature.r;
  24866. var s = signature.s;
  24867. if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
  24868. return false;
  24869. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
  24870. return false;
  24871. // Validate signature
  24872. var sinv = s.invm(this.n);
  24873. var u1 = sinv.mul(msg).umod(this.n);
  24874. var u2 = sinv.mul(r).umod(this.n);
  24875. if (!this.curve._maxwellTrick) {
  24876. var p = this.g.mulAdd(u1, key.getPublic(), u2);
  24877. if (p.isInfinity())
  24878. return false;
  24879. return p.getX().umod(this.n).cmp(r) === 0;
  24880. }
  24881. // NOTE: Greg Maxwell's trick, inspired by:
  24882. // https://git.io/vad3K
  24883. var p = this.g.jmulAdd(u1, key.getPublic(), u2);
  24884. if (p.isInfinity())
  24885. return false;
  24886. // Compare `p.x` of Jacobian point with `r`,
  24887. // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
  24888. // inverse of `p.z^2`
  24889. return p.eqXToP(r);
  24890. };
  24891. EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
  24892. assert((3 & j) === j, 'The recovery param is more than two bits');
  24893. signature = new Signature(signature, enc);
  24894. var n = this.n;
  24895. var e = new BN(msg);
  24896. var r = signature.r;
  24897. var s = signature.s;
  24898. // A set LSB signifies that the y-coordinate is odd
  24899. var isYOdd = j & 1;
  24900. var isSecondKey = j >> 1;
  24901. if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
  24902. throw new Error('Unable to find sencond key candinate');
  24903. // 1.1. Let x = r + jn.
  24904. if (isSecondKey)
  24905. r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
  24906. else
  24907. r = this.curve.pointFromX(r, isYOdd);
  24908. var rInv = signature.r.invm(n);
  24909. var s1 = n.sub(e).mul(rInv).umod(n);
  24910. var s2 = s.mul(rInv).umod(n);
  24911. // 1.6.1 Compute Q = r^-1 (sR - eG)
  24912. // Q = r^-1 (sR + -eG)
  24913. return this.g.mulAdd(s1, r, s2);
  24914. };
  24915. EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
  24916. signature = new Signature(signature, enc);
  24917. if (signature.recoveryParam !== null)
  24918. return signature.recoveryParam;
  24919. for (var i = 0; i < 4; i++) {
  24920. var Qprime;
  24921. try {
  24922. Qprime = this.recoverPubKey(e, signature, i);
  24923. } catch (e) {
  24924. continue;
  24925. }
  24926. if (Qprime.eq(Q))
  24927. return i;
  24928. }
  24929. throw new Error('Unable to find valid recovery factor');
  24930. };
  24931. /***/ },
  24932. /* 238 */
  24933. /***/ function(module, exports, __webpack_require__) {
  24934. "use strict";
  24935. 'use strict';
  24936. var BN = __webpack_require__(2);
  24937. function KeyPair(ec, options) {
  24938. this.ec = ec;
  24939. this.priv = null;
  24940. this.pub = null;
  24941. // KeyPair(ec, { priv: ..., pub: ... })
  24942. if (options.priv)
  24943. this._importPrivate(options.priv, options.privEnc);
  24944. if (options.pub)
  24945. this._importPublic(options.pub, options.pubEnc);
  24946. }
  24947. module.exports = KeyPair;
  24948. KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
  24949. if (pub instanceof KeyPair)
  24950. return pub;
  24951. return new KeyPair(ec, {
  24952. pub: pub,
  24953. pubEnc: enc
  24954. });
  24955. };
  24956. KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
  24957. if (priv instanceof KeyPair)
  24958. return priv;
  24959. return new KeyPair(ec, {
  24960. priv: priv,
  24961. privEnc: enc
  24962. });
  24963. };
  24964. KeyPair.prototype.validate = function validate() {
  24965. var pub = this.getPublic();
  24966. if (pub.isInfinity())
  24967. return { result: false, reason: 'Invalid public key' };
  24968. if (!pub.validate())
  24969. return { result: false, reason: 'Public key is not a point' };
  24970. if (!pub.mul(this.ec.curve.n).isInfinity())
  24971. return { result: false, reason: 'Public key * N != O' };
  24972. return { result: true, reason: null };
  24973. };
  24974. KeyPair.prototype.getPublic = function getPublic(compact, enc) {
  24975. // compact is optional argument
  24976. if (typeof compact === 'string') {
  24977. enc = compact;
  24978. compact = null;
  24979. }
  24980. if (!this.pub)
  24981. this.pub = this.ec.g.mul(this.priv);
  24982. if (!enc)
  24983. return this.pub;
  24984. return this.pub.encode(enc, compact);
  24985. };
  24986. KeyPair.prototype.getPrivate = function getPrivate(enc) {
  24987. if (enc === 'hex')
  24988. return this.priv.toString(16, 2);
  24989. else
  24990. return this.priv;
  24991. };
  24992. KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
  24993. this.priv = new BN(key, enc || 16);
  24994. // Ensure that the priv won't be bigger than n, otherwise we may fail
  24995. // in fixed multiplication method
  24996. this.priv = this.priv.umod(this.ec.curve.n);
  24997. };
  24998. KeyPair.prototype._importPublic = function _importPublic(key, enc) {
  24999. if (key.x || key.y) {
  25000. this.pub = this.ec.curve.point(key.x, key.y);
  25001. return;
  25002. }
  25003. this.pub = this.ec.curve.decodePoint(key, enc);
  25004. };
  25005. // ECDH
  25006. KeyPair.prototype.derive = function derive(pub) {
  25007. return pub.mul(this.priv).getX();
  25008. };
  25009. // ECDSA
  25010. KeyPair.prototype.sign = function sign(msg, enc, options) {
  25011. return this.ec.sign(msg, this, enc, options);
  25012. };
  25013. KeyPair.prototype.verify = function verify(msg, signature) {
  25014. return this.ec.verify(msg, signature, this);
  25015. };
  25016. KeyPair.prototype.inspect = function inspect() {
  25017. return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
  25018. ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
  25019. };
  25020. /***/ },
  25021. /* 239 */
  25022. /***/ function(module, exports, __webpack_require__) {
  25023. "use strict";
  25024. 'use strict';
  25025. var BN = __webpack_require__(2);
  25026. var elliptic = __webpack_require__(3);
  25027. var utils = elliptic.utils;
  25028. var assert = utils.assert;
  25029. function Signature(options, enc) {
  25030. if (options instanceof Signature)
  25031. return options;
  25032. if (this._importDER(options, enc))
  25033. return;
  25034. assert(options.r && options.s, 'Signature without r or s');
  25035. this.r = new BN(options.r, 16);
  25036. this.s = new BN(options.s, 16);
  25037. if (options.recoveryParam === undefined)
  25038. this.recoveryParam = null;
  25039. else
  25040. this.recoveryParam = options.recoveryParam;
  25041. }
  25042. module.exports = Signature;
  25043. function Position() {
  25044. this.place = 0;
  25045. }
  25046. function getLength(buf, p) {
  25047. var initial = buf[p.place++];
  25048. if (!(initial & 0x80)) {
  25049. return initial;
  25050. }
  25051. var octetLen = initial & 0xf;
  25052. var val = 0;
  25053. for (var i = 0, off = p.place; i < octetLen; i++, off++) {
  25054. val <<= 8;
  25055. val |= buf[off];
  25056. }
  25057. p.place = off;
  25058. return val;
  25059. }
  25060. function rmPadding(buf) {
  25061. var i = 0;
  25062. var len = buf.length - 1;
  25063. while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
  25064. i++;
  25065. }
  25066. if (i === 0) {
  25067. return buf;
  25068. }
  25069. return buf.slice(i);
  25070. }
  25071. Signature.prototype._importDER = function _importDER(data, enc) {
  25072. data = utils.toArray(data, enc);
  25073. var p = new Position();
  25074. if (data[p.place++] !== 0x30) {
  25075. return false;
  25076. }
  25077. var len = getLength(data, p);
  25078. if ((len + p.place) !== data.length) {
  25079. return false;
  25080. }
  25081. if (data[p.place++] !== 0x02) {
  25082. return false;
  25083. }
  25084. var rlen = getLength(data, p);
  25085. var r = data.slice(p.place, rlen + p.place);
  25086. p.place += rlen;
  25087. if (data[p.place++] !== 0x02) {
  25088. return false;
  25089. }
  25090. var slen = getLength(data, p);
  25091. if (data.length !== slen + p.place) {
  25092. return false;
  25093. }
  25094. var s = data.slice(p.place, slen + p.place);
  25095. if (r[0] === 0 && (r[1] & 0x80)) {
  25096. r = r.slice(1);
  25097. }
  25098. if (s[0] === 0 && (s[1] & 0x80)) {
  25099. s = s.slice(1);
  25100. }
  25101. this.r = new BN(r);
  25102. this.s = new BN(s);
  25103. this.recoveryParam = null;
  25104. return true;
  25105. };
  25106. function constructLength(arr, len) {
  25107. if (len < 0x80) {
  25108. arr.push(len);
  25109. return;
  25110. }
  25111. var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
  25112. arr.push(octets | 0x80);
  25113. while (--octets) {
  25114. arr.push((len >>> (octets << 3)) & 0xff);
  25115. }
  25116. arr.push(len);
  25117. }
  25118. Signature.prototype.toDER = function toDER(enc) {
  25119. var r = this.r.toArray();
  25120. var s = this.s.toArray();
  25121. // Pad values
  25122. if (r[0] & 0x80)
  25123. r = [ 0 ].concat(r);
  25124. // Pad values
  25125. if (s[0] & 0x80)
  25126. s = [ 0 ].concat(s);
  25127. r = rmPadding(r);
  25128. s = rmPadding(s);
  25129. while (!s[0] && !(s[1] & 0x80)) {
  25130. s = s.slice(1);
  25131. }
  25132. var arr = [ 0x02 ];
  25133. constructLength(arr, r.length);
  25134. arr = arr.concat(r);
  25135. arr.push(0x02);
  25136. constructLength(arr, s.length);
  25137. var backHalf = arr.concat(s);
  25138. var res = [ 0x30 ];
  25139. constructLength(res, backHalf.length);
  25140. res = res.concat(backHalf);
  25141. return utils.encode(res, enc);
  25142. };
  25143. /***/ },
  25144. /* 240 */
  25145. /***/ function(module, exports, __webpack_require__) {
  25146. "use strict";
  25147. 'use strict';
  25148. var hash = __webpack_require__(9);
  25149. var elliptic = __webpack_require__(3);
  25150. var utils = elliptic.utils;
  25151. var assert = utils.assert;
  25152. var parseBytes = utils.parseBytes;
  25153. var KeyPair = __webpack_require__(241);
  25154. var Signature = __webpack_require__(242);
  25155. function EDDSA(curve) {
  25156. assert(curve === 'ed25519', 'only tested with ed25519 so far');
  25157. if (!(this instanceof EDDSA))
  25158. return new EDDSA(curve);
  25159. var curve = elliptic.curves[curve].curve;
  25160. this.curve = curve;
  25161. this.g = curve.g;
  25162. this.g.precompute(curve.n.bitLength() + 1);
  25163. this.pointClass = curve.point().constructor;
  25164. this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
  25165. this.hash = hash.sha512;
  25166. }
  25167. module.exports = EDDSA;
  25168. /**
  25169. * @param {Array|String} message - message bytes
  25170. * @param {Array|String|KeyPair} secret - secret bytes or a keypair
  25171. * @returns {Signature} - signature
  25172. */
  25173. EDDSA.prototype.sign = function sign(message, secret) {
  25174. message = parseBytes(message);
  25175. var key = this.keyFromSecret(secret);
  25176. var r = this.hashInt(key.messagePrefix(), message);
  25177. var R = this.g.mul(r);
  25178. var Rencoded = this.encodePoint(R);
  25179. var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
  25180. .mul(key.priv());
  25181. var S = r.add(s_).umod(this.curve.n);
  25182. return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
  25183. };
  25184. /**
  25185. * @param {Array} message - message bytes
  25186. * @param {Array|String|Signature} sig - sig bytes
  25187. * @param {Array|String|Point|KeyPair} pub - public key
  25188. * @returns {Boolean} - true if public key matches sig of message
  25189. */
  25190. EDDSA.prototype.verify = function verify(message, sig, pub) {
  25191. message = parseBytes(message);
  25192. sig = this.makeSignature(sig);
  25193. var key = this.keyFromPublic(pub);
  25194. var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
  25195. var SG = this.g.mul(sig.S());
  25196. var RplusAh = sig.R().add(key.pub().mul(h));
  25197. return RplusAh.eq(SG);
  25198. };
  25199. EDDSA.prototype.hashInt = function hashInt() {
  25200. var hash = this.hash();
  25201. for (var i = 0; i < arguments.length; i++)
  25202. hash.update(arguments[i]);
  25203. return utils.intFromLE(hash.digest()).umod(this.curve.n);
  25204. };
  25205. EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
  25206. return KeyPair.fromPublic(this, pub);
  25207. };
  25208. EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
  25209. return KeyPair.fromSecret(this, secret);
  25210. };
  25211. EDDSA.prototype.makeSignature = function makeSignature(sig) {
  25212. if (sig instanceof Signature)
  25213. return sig;
  25214. return new Signature(this, sig);
  25215. };
  25216. /**
  25217. * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
  25218. *
  25219. * EDDSA defines methods for encoding and decoding points and integers. These are
  25220. * helper convenience methods, that pass along to utility functions implied
  25221. * parameters.
  25222. *
  25223. */
  25224. EDDSA.prototype.encodePoint = function encodePoint(point) {
  25225. var enc = point.getY().toArray('le', this.encodingLength);
  25226. enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
  25227. return enc;
  25228. };
  25229. EDDSA.prototype.decodePoint = function decodePoint(bytes) {
  25230. bytes = utils.parseBytes(bytes);
  25231. var lastIx = bytes.length - 1;
  25232. var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
  25233. var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
  25234. var y = utils.intFromLE(normed);
  25235. return this.curve.pointFromY(y, xIsOdd);
  25236. };
  25237. EDDSA.prototype.encodeInt = function encodeInt(num) {
  25238. return num.toArray('le', this.encodingLength);
  25239. };
  25240. EDDSA.prototype.decodeInt = function decodeInt(bytes) {
  25241. return utils.intFromLE(bytes);
  25242. };
  25243. EDDSA.prototype.isPoint = function isPoint(val) {
  25244. return val instanceof this.pointClass;
  25245. };
  25246. /***/ },
  25247. /* 241 */
  25248. /***/ function(module, exports, __webpack_require__) {
  25249. "use strict";
  25250. 'use strict';
  25251. var elliptic = __webpack_require__(3);
  25252. var utils = elliptic.utils;
  25253. var assert = utils.assert;
  25254. var parseBytes = utils.parseBytes;
  25255. var cachedProperty = utils.cachedProperty;
  25256. /**
  25257. * @param {EDDSA} eddsa - instance
  25258. * @param {Object} params - public/private key parameters
  25259. *
  25260. * @param {Array<Byte>} [params.secret] - secret seed bytes
  25261. * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
  25262. * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
  25263. *
  25264. */
  25265. function KeyPair(eddsa, params) {
  25266. this.eddsa = eddsa;
  25267. this._secret = parseBytes(params.secret);
  25268. if (eddsa.isPoint(params.pub))
  25269. this._pub = params.pub;
  25270. else
  25271. this._pubBytes = parseBytes(params.pub);
  25272. }
  25273. KeyPair.fromPublic = function fromPublic(eddsa, pub) {
  25274. if (pub instanceof KeyPair)
  25275. return pub;
  25276. return new KeyPair(eddsa, { pub: pub });
  25277. };
  25278. KeyPair.fromSecret = function fromSecret(eddsa, secret) {
  25279. if (secret instanceof KeyPair)
  25280. return secret;
  25281. return new KeyPair(eddsa, { secret: secret });
  25282. };
  25283. KeyPair.prototype.secret = function secret() {
  25284. return this._secret;
  25285. };
  25286. cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
  25287. return this.eddsa.encodePoint(this.pub());
  25288. });
  25289. cachedProperty(KeyPair, 'pub', function pub() {
  25290. if (this._pubBytes)
  25291. return this.eddsa.decodePoint(this._pubBytes);
  25292. return this.eddsa.g.mul(this.priv());
  25293. });
  25294. cachedProperty(KeyPair, 'privBytes', function privBytes() {
  25295. var eddsa = this.eddsa;
  25296. var hash = this.hash();
  25297. var lastIx = eddsa.encodingLength - 1;
  25298. var a = hash.slice(0, eddsa.encodingLength);
  25299. a[0] &= 248;
  25300. a[lastIx] &= 127;
  25301. a[lastIx] |= 64;
  25302. return a;
  25303. });
  25304. cachedProperty(KeyPair, 'priv', function priv() {
  25305. return this.eddsa.decodeInt(this.privBytes());
  25306. });
  25307. cachedProperty(KeyPair, 'hash', function hash() {
  25308. return this.eddsa.hash().update(this.secret()).digest();
  25309. });
  25310. cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
  25311. return this.hash().slice(this.eddsa.encodingLength);
  25312. });
  25313. KeyPair.prototype.sign = function sign(message) {
  25314. assert(this._secret, 'KeyPair can only verify');
  25315. return this.eddsa.sign(message, this);
  25316. };
  25317. KeyPair.prototype.verify = function verify(message, sig) {
  25318. return this.eddsa.verify(message, sig, this);
  25319. };
  25320. KeyPair.prototype.getSecret = function getSecret(enc) {
  25321. assert(this._secret, 'KeyPair is public only');
  25322. return utils.encode(this.secret(), enc);
  25323. };
  25324. KeyPair.prototype.getPublic = function getPublic(enc) {
  25325. return utils.encode(this.pubBytes(), enc);
  25326. };
  25327. module.exports = KeyPair;
  25328. /***/ },
  25329. /* 242 */
  25330. /***/ function(module, exports, __webpack_require__) {
  25331. "use strict";
  25332. 'use strict';
  25333. var BN = __webpack_require__(2);
  25334. var elliptic = __webpack_require__(3);
  25335. var utils = elliptic.utils;
  25336. var assert = utils.assert;
  25337. var cachedProperty = utils.cachedProperty;
  25338. var parseBytes = utils.parseBytes;
  25339. /**
  25340. * @param {EDDSA} eddsa - eddsa instance
  25341. * @param {Array<Bytes>|Object} sig -
  25342. * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
  25343. * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
  25344. * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
  25345. * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
  25346. */
  25347. function Signature(eddsa, sig) {
  25348. this.eddsa = eddsa;
  25349. if (typeof sig !== 'object')
  25350. sig = parseBytes(sig);
  25351. if (Array.isArray(sig)) {
  25352. sig = {
  25353. R: sig.slice(0, eddsa.encodingLength),
  25354. S: sig.slice(eddsa.encodingLength)
  25355. };
  25356. }
  25357. assert(sig.R && sig.S, 'Signature without R or S');
  25358. if (eddsa.isPoint(sig.R))
  25359. this._R = sig.R;
  25360. if (sig.S instanceof BN)
  25361. this._S = sig.S;
  25362. this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
  25363. this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
  25364. }
  25365. cachedProperty(Signature, 'S', function S() {
  25366. return this.eddsa.decodeInt(this.Sencoded());
  25367. });
  25368. cachedProperty(Signature, 'R', function R() {
  25369. return this.eddsa.decodePoint(this.Rencoded());
  25370. });
  25371. cachedProperty(Signature, 'Rencoded', function Rencoded() {
  25372. return this.eddsa.encodePoint(this.R());
  25373. });
  25374. cachedProperty(Signature, 'Sencoded', function Sencoded() {
  25375. return this.eddsa.encodeInt(this.S());
  25376. });
  25377. Signature.prototype.toBytes = function toBytes() {
  25378. return this.Rencoded().concat(this.Sencoded());
  25379. };
  25380. Signature.prototype.toHex = function toHex() {
  25381. return utils.encode(this.toBytes(), 'hex').toUpperCase();
  25382. };
  25383. module.exports = Signature;
  25384. /***/ },
  25385. /* 243 */
  25386. /***/ function(module, exports, __webpack_require__) {
  25387. "use strict";
  25388. 'use strict';
  25389. var hash = __webpack_require__(9);
  25390. var elliptic = __webpack_require__(3);
  25391. var utils = elliptic.utils;
  25392. var assert = utils.assert;
  25393. function HmacDRBG(options) {
  25394. if (!(this instanceof HmacDRBG))
  25395. return new HmacDRBG(options);
  25396. this.hash = options.hash;
  25397. this.predResist = !!options.predResist;
  25398. this.outLen = this.hash.outSize;
  25399. this.minEntropy = options.minEntropy || this.hash.hmacStrength;
  25400. this.reseed = null;
  25401. this.reseedInterval = null;
  25402. this.K = null;
  25403. this.V = null;
  25404. var entropy = utils.toArray(options.entropy, options.entropyEnc);
  25405. var nonce = utils.toArray(options.nonce, options.nonceEnc);
  25406. var pers = utils.toArray(options.pers, options.persEnc);
  25407. assert(entropy.length >= (this.minEntropy / 8),
  25408. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25409. this._init(entropy, nonce, pers);
  25410. }
  25411. module.exports = HmacDRBG;
  25412. HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
  25413. var seed = entropy.concat(nonce).concat(pers);
  25414. this.K = new Array(this.outLen / 8);
  25415. this.V = new Array(this.outLen / 8);
  25416. for (var i = 0; i < this.V.length; i++) {
  25417. this.K[i] = 0x00;
  25418. this.V[i] = 0x01;
  25419. }
  25420. this._update(seed);
  25421. this.reseed = 1;
  25422. this.reseedInterval = 0x1000000000000; // 2^48
  25423. };
  25424. HmacDRBG.prototype._hmac = function hmac() {
  25425. return new hash.hmac(this.hash, this.K);
  25426. };
  25427. HmacDRBG.prototype._update = function update(seed) {
  25428. var kmac = this._hmac()
  25429. .update(this.V)
  25430. .update([ 0x00 ]);
  25431. if (seed)
  25432. kmac = kmac.update(seed);
  25433. this.K = kmac.digest();
  25434. this.V = this._hmac().update(this.V).digest();
  25435. if (!seed)
  25436. return;
  25437. this.K = this._hmac()
  25438. .update(this.V)
  25439. .update([ 0x01 ])
  25440. .update(seed)
  25441. .digest();
  25442. this.V = this._hmac().update(this.V).digest();
  25443. };
  25444. HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
  25445. // Optional entropy enc
  25446. if (typeof entropyEnc !== 'string') {
  25447. addEnc = add;
  25448. add = entropyEnc;
  25449. entropyEnc = null;
  25450. }
  25451. entropy = utils.toBuffer(entropy, entropyEnc);
  25452. add = utils.toBuffer(add, addEnc);
  25453. assert(entropy.length >= (this.minEntropy / 8),
  25454. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25455. this._update(entropy.concat(add || []));
  25456. this.reseed = 1;
  25457. };
  25458. HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
  25459. if (this.reseed > this.reseedInterval)
  25460. throw new Error('Reseed is required');
  25461. // Optional encoding
  25462. if (typeof enc !== 'string') {
  25463. addEnc = add;
  25464. add = enc;
  25465. enc = null;
  25466. }
  25467. // Optional additional data
  25468. if (add) {
  25469. add = utils.toArray(add, addEnc);
  25470. this._update(add);
  25471. }
  25472. var temp = [];
  25473. while (temp.length < len) {
  25474. this.V = this._hmac().update(this.V).digest();
  25475. temp = temp.concat(this.V);
  25476. }
  25477. var res = temp.slice(0, len);
  25478. this._update(add);
  25479. this.reseed++;
  25480. return utils.encode(res, enc);
  25481. };
  25482. /***/ },
  25483. /* 244 */
  25484. /***/ function(module, exports) {
  25485. module.exports = {
  25486. doubles: {
  25487. step: 4,
  25488. points: [
  25489. [
  25490. 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
  25491. 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
  25492. ],
  25493. [
  25494. '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
  25495. '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
  25496. ],
  25497. [
  25498. '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
  25499. 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
  25500. ],
  25501. [
  25502. '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
  25503. '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
  25504. ],
  25505. [
  25506. '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
  25507. '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
  25508. ],
  25509. [
  25510. '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
  25511. '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
  25512. ],
  25513. [
  25514. 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
  25515. '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
  25516. ],
  25517. [
  25518. '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
  25519. 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
  25520. ],
  25521. [
  25522. 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
  25523. '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
  25524. ],
  25525. [
  25526. 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
  25527. 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
  25528. ],
  25529. [
  25530. 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
  25531. '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
  25532. ],
  25533. [
  25534. '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
  25535. '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
  25536. ],
  25537. [
  25538. '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
  25539. '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
  25540. ],
  25541. [
  25542. '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
  25543. '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
  25544. ],
  25545. [
  25546. '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
  25547. '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
  25548. ],
  25549. [
  25550. '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
  25551. '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
  25552. ],
  25553. [
  25554. '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
  25555. '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
  25556. ],
  25557. [
  25558. '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
  25559. '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
  25560. ],
  25561. [
  25562. '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
  25563. 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
  25564. ],
  25565. [
  25566. 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
  25567. '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
  25568. ],
  25569. [
  25570. 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
  25571. '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
  25572. ],
  25573. [
  25574. '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
  25575. '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
  25576. ],
  25577. [
  25578. '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
  25579. '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
  25580. ],
  25581. [
  25582. 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
  25583. '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
  25584. ],
  25585. [
  25586. '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
  25587. 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
  25588. ],
  25589. [
  25590. 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
  25591. '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
  25592. ],
  25593. [
  25594. 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
  25595. 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
  25596. ],
  25597. [
  25598. 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
  25599. '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
  25600. ],
  25601. [
  25602. 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
  25603. 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
  25604. ],
  25605. [
  25606. 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
  25607. '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
  25608. ],
  25609. [
  25610. '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
  25611. 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
  25612. ],
  25613. [
  25614. '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
  25615. '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
  25616. ],
  25617. [
  25618. 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
  25619. '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
  25620. ],
  25621. [
  25622. '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
  25623. 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
  25624. ],
  25625. [
  25626. 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
  25627. '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
  25628. ],
  25629. [
  25630. 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
  25631. '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
  25632. ],
  25633. [
  25634. 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
  25635. 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
  25636. ],
  25637. [
  25638. '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
  25639. '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
  25640. ],
  25641. [
  25642. '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
  25643. '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
  25644. ],
  25645. [
  25646. '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
  25647. 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
  25648. ],
  25649. [
  25650. '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
  25651. '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
  25652. ],
  25653. [
  25654. 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
  25655. '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
  25656. ],
  25657. [
  25658. '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
  25659. '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
  25660. ],
  25661. [
  25662. '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
  25663. 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
  25664. ],
  25665. [
  25666. '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
  25667. '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
  25668. ],
  25669. [
  25670. 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
  25671. '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
  25672. ],
  25673. [
  25674. '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
  25675. 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
  25676. ],
  25677. [
  25678. 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
  25679. 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
  25680. ],
  25681. [
  25682. 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
  25683. '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
  25684. ],
  25685. [
  25686. '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
  25687. 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
  25688. ],
  25689. [
  25690. '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
  25691. 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
  25692. ],
  25693. [
  25694. 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
  25695. '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
  25696. ],
  25697. [
  25698. 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
  25699. '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
  25700. ],
  25701. [
  25702. 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
  25703. '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
  25704. ],
  25705. [
  25706. '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
  25707. 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
  25708. ],
  25709. [
  25710. '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
  25711. '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
  25712. ],
  25713. [
  25714. 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
  25715. 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
  25716. ],
  25717. [
  25718. '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
  25719. 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
  25720. ],
  25721. [
  25722. '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
  25723. '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
  25724. ],
  25725. [
  25726. '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
  25727. '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
  25728. ],
  25729. [
  25730. 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
  25731. 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
  25732. ],
  25733. [
  25734. '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
  25735. '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
  25736. ],
  25737. [
  25738. '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
  25739. '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
  25740. ],
  25741. [
  25742. 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
  25743. '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
  25744. ],
  25745. [
  25746. 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
  25747. 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
  25748. ]
  25749. ]
  25750. },
  25751. naf: {
  25752. wnd: 7,
  25753. points: [
  25754. [
  25755. 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
  25756. '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
  25757. ],
  25758. [
  25759. '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
  25760. 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
  25761. ],
  25762. [
  25763. '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
  25764. '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
  25765. ],
  25766. [
  25767. 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
  25768. 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
  25769. ],
  25770. [
  25771. '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
  25772. 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
  25773. ],
  25774. [
  25775. 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
  25776. 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
  25777. ],
  25778. [
  25779. 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
  25780. '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
  25781. ],
  25782. [
  25783. 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
  25784. '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
  25785. ],
  25786. [
  25787. '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
  25788. '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
  25789. ],
  25790. [
  25791. '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
  25792. '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
  25793. ],
  25794. [
  25795. '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
  25796. '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
  25797. ],
  25798. [
  25799. '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
  25800. '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
  25801. ],
  25802. [
  25803. 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
  25804. 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
  25805. ],
  25806. [
  25807. 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
  25808. '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
  25809. ],
  25810. [
  25811. '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
  25812. 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
  25813. ],
  25814. [
  25815. '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
  25816. 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
  25817. ],
  25818. [
  25819. '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
  25820. '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
  25821. ],
  25822. [
  25823. '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
  25824. '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
  25825. ],
  25826. [
  25827. '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
  25828. '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
  25829. ],
  25830. [
  25831. '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
  25832. 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
  25833. ],
  25834. [
  25835. 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
  25836. 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
  25837. ],
  25838. [
  25839. '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
  25840. '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
  25841. ],
  25842. [
  25843. '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
  25844. '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
  25845. ],
  25846. [
  25847. 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
  25848. 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
  25849. ],
  25850. [
  25851. '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
  25852. '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
  25853. ],
  25854. [
  25855. 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
  25856. 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
  25857. ],
  25858. [
  25859. 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
  25860. 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
  25861. ],
  25862. [
  25863. '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
  25864. '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
  25865. ],
  25866. [
  25867. '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
  25868. '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
  25869. ],
  25870. [
  25871. '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
  25872. '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
  25873. ],
  25874. [
  25875. 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
  25876. '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
  25877. ],
  25878. [
  25879. '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
  25880. '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
  25881. ],
  25882. [
  25883. 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
  25884. '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
  25885. ],
  25886. [
  25887. '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
  25888. 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
  25889. ],
  25890. [
  25891. '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
  25892. 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
  25893. ],
  25894. [
  25895. 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
  25896. 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
  25897. ],
  25898. [
  25899. '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
  25900. '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
  25901. ],
  25902. [
  25903. '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
  25904. 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
  25905. ],
  25906. [
  25907. 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
  25908. 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
  25909. ],
  25910. [
  25911. '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
  25912. '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
  25913. ],
  25914. [
  25915. '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
  25916. 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
  25917. ],
  25918. [
  25919. '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
  25920. '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
  25921. ],
  25922. [
  25923. '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
  25924. 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
  25925. ],
  25926. [
  25927. 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
  25928. '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
  25929. ],
  25930. [
  25931. '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
  25932. '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
  25933. ],
  25934. [
  25935. '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
  25936. 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
  25937. ],
  25938. [
  25939. '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
  25940. 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
  25941. ],
  25942. [
  25943. 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
  25944. 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
  25945. ],
  25946. [
  25947. 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
  25948. 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
  25949. ],
  25950. [
  25951. '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
  25952. '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
  25953. ],
  25954. [
  25955. '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
  25956. '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
  25957. ],
  25958. [
  25959. 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
  25960. '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
  25961. ],
  25962. [
  25963. 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
  25964. 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
  25965. ],
  25966. [
  25967. '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
  25968. '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
  25969. ],
  25970. [
  25971. '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
  25972. '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
  25973. ],
  25974. [
  25975. 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
  25976. '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
  25977. ],
  25978. [
  25979. '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
  25980. '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
  25981. ],
  25982. [
  25983. 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
  25984. 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
  25985. ],
  25986. [
  25987. '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
  25988. 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
  25989. ],
  25990. [
  25991. '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
  25992. '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
  25993. ],
  25994. [
  25995. 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
  25996. '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
  25997. ],
  25998. [
  25999. 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
  26000. '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
  26001. ],
  26002. [
  26003. '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
  26004. '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
  26005. ],
  26006. [
  26007. '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
  26008. '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
  26009. ],
  26010. [
  26011. '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
  26012. 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
  26013. ],
  26014. [
  26015. '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
  26016. 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
  26017. ],
  26018. [
  26019. '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
  26020. '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
  26021. ],
  26022. [
  26023. '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
  26024. '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
  26025. ],
  26026. [
  26027. '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
  26028. '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
  26029. ],
  26030. [
  26031. '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
  26032. 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
  26033. ],
  26034. [
  26035. 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
  26036. 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
  26037. ],
  26038. [
  26039. '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
  26040. 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
  26041. ],
  26042. [
  26043. 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
  26044. '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
  26045. ],
  26046. [
  26047. 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
  26048. '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
  26049. ],
  26050. [
  26051. 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
  26052. '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
  26053. ],
  26054. [
  26055. 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
  26056. '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
  26057. ],
  26058. [
  26059. '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
  26060. 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
  26061. ],
  26062. [
  26063. '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
  26064. '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
  26065. ],
  26066. [
  26067. '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
  26068. 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
  26069. ],
  26070. [
  26071. 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
  26072. 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
  26073. ],
  26074. [
  26075. 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
  26076. '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
  26077. ],
  26078. [
  26079. 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
  26080. 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
  26081. ],
  26082. [
  26083. 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
  26084. '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
  26085. ],
  26086. [
  26087. '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
  26088. '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
  26089. ],
  26090. [
  26091. 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
  26092. '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
  26093. ],
  26094. [
  26095. 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
  26096. '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
  26097. ],
  26098. [
  26099. '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
  26100. '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
  26101. ],
  26102. [
  26103. '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
  26104. 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
  26105. ],
  26106. [
  26107. 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
  26108. '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
  26109. ],
  26110. [
  26111. 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
  26112. '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
  26113. ],
  26114. [
  26115. 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
  26116. '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
  26117. ],
  26118. [
  26119. '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
  26120. '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
  26121. ],
  26122. [
  26123. 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
  26124. 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
  26125. ],
  26126. [
  26127. '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
  26128. 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
  26129. ],
  26130. [
  26131. 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
  26132. 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
  26133. ],
  26134. [
  26135. 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
  26136. '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
  26137. ],
  26138. [
  26139. '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
  26140. 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
  26141. ],
  26142. [
  26143. 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
  26144. '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
  26145. ],
  26146. [
  26147. 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
  26148. '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
  26149. ],
  26150. [
  26151. 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
  26152. '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
  26153. ],
  26154. [
  26155. '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
  26156. 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
  26157. ],
  26158. [
  26159. '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
  26160. 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
  26161. ],
  26162. [
  26163. 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
  26164. '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
  26165. ],
  26166. [
  26167. '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
  26168. 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
  26169. ],
  26170. [
  26171. '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
  26172. '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
  26173. ],
  26174. [
  26175. '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
  26176. 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
  26177. ],
  26178. [
  26179. 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
  26180. 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
  26181. ],
  26182. [
  26183. '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
  26184. 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
  26185. ],
  26186. [
  26187. '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
  26188. '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
  26189. ],
  26190. [
  26191. '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
  26192. 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
  26193. ],
  26194. [
  26195. '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
  26196. '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
  26197. ],
  26198. [
  26199. 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
  26200. 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
  26201. ],
  26202. [
  26203. '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
  26204. '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
  26205. ],
  26206. [
  26207. 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
  26208. '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
  26209. ],
  26210. [
  26211. '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
  26212. '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
  26213. ],
  26214. [
  26215. 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
  26216. 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
  26217. ],
  26218. [
  26219. 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
  26220. '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
  26221. ],
  26222. [
  26223. 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
  26224. 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
  26225. ],
  26226. [
  26227. '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
  26228. 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
  26229. ],
  26230. [
  26231. '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
  26232. '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
  26233. ],
  26234. [
  26235. '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
  26236. 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
  26237. ],
  26238. [
  26239. '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
  26240. '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
  26241. ],
  26242. [
  26243. '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
  26244. '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
  26245. ],
  26246. [
  26247. '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
  26248. 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
  26249. ],
  26250. [
  26251. '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
  26252. '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
  26253. ],
  26254. [
  26255. '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
  26256. '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
  26257. ],
  26258. [
  26259. '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
  26260. '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
  26261. ]
  26262. ]
  26263. }
  26264. };
  26265. /***/ },
  26266. /* 245 */
  26267. /***/ function(module, exports, __webpack_require__) {
  26268. "use strict";
  26269. 'use strict';
  26270. var utils = exports;
  26271. var BN = __webpack_require__(2);
  26272. utils.assert = function assert(val, msg) {
  26273. if (!val)
  26274. throw new Error(msg || 'Assertion failed');
  26275. };
  26276. function toArray(msg, enc) {
  26277. if (Array.isArray(msg))
  26278. return msg.slice();
  26279. if (!msg)
  26280. return [];
  26281. var res = [];
  26282. if (typeof msg !== 'string') {
  26283. for (var i = 0; i < msg.length; i++)
  26284. res[i] = msg[i] | 0;
  26285. return res;
  26286. }
  26287. if (!enc) {
  26288. for (var i = 0; i < msg.length; i++) {
  26289. var c = msg.charCodeAt(i);
  26290. var hi = c >> 8;
  26291. var lo = c & 0xff;
  26292. if (hi)
  26293. res.push(hi, lo);
  26294. else
  26295. res.push(lo);
  26296. }
  26297. } else if (enc === 'hex') {
  26298. msg = msg.replace(/[^a-z0-9]+/ig, '');
  26299. if (msg.length % 2 !== 0)
  26300. msg = '0' + msg;
  26301. for (var i = 0; i < msg.length; i += 2)
  26302. res.push(parseInt(msg[i] + msg[i + 1], 16));
  26303. }
  26304. return res;
  26305. }
  26306. utils.toArray = toArray;
  26307. function zero2(word) {
  26308. if (word.length === 1)
  26309. return '0' + word;
  26310. else
  26311. return word;
  26312. }
  26313. utils.zero2 = zero2;
  26314. function toHex(msg) {
  26315. var res = '';
  26316. for (var i = 0; i < msg.length; i++)
  26317. res += zero2(msg[i].toString(16));
  26318. return res;
  26319. }
  26320. utils.toHex = toHex;
  26321. utils.encode = function encode(arr, enc) {
  26322. if (enc === 'hex')
  26323. return toHex(arr);
  26324. else
  26325. return arr;
  26326. };
  26327. // Represent num in a w-NAF form
  26328. function getNAF(num, w) {
  26329. var naf = [];
  26330. var ws = 1 << (w + 1);
  26331. var k = num.clone();
  26332. while (k.cmpn(1) >= 0) {
  26333. var z;
  26334. if (k.isOdd()) {
  26335. var mod = k.andln(ws - 1);
  26336. if (mod > (ws >> 1) - 1)
  26337. z = (ws >> 1) - mod;
  26338. else
  26339. z = mod;
  26340. k.isubn(z);
  26341. } else {
  26342. z = 0;
  26343. }
  26344. naf.push(z);
  26345. // Optimization, shift by word if possible
  26346. var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
  26347. for (var i = 1; i < shift; i++)
  26348. naf.push(0);
  26349. k.iushrn(shift);
  26350. }
  26351. return naf;
  26352. }
  26353. utils.getNAF = getNAF;
  26354. // Represent k1, k2 in a Joint Sparse Form
  26355. function getJSF(k1, k2) {
  26356. var jsf = [
  26357. [],
  26358. []
  26359. ];
  26360. k1 = k1.clone();
  26361. k2 = k2.clone();
  26362. var d1 = 0;
  26363. var d2 = 0;
  26364. while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
  26365. // First phase
  26366. var m14 = (k1.andln(3) + d1) & 3;
  26367. var m24 = (k2.andln(3) + d2) & 3;
  26368. if (m14 === 3)
  26369. m14 = -1;
  26370. if (m24 === 3)
  26371. m24 = -1;
  26372. var u1;
  26373. if ((m14 & 1) === 0) {
  26374. u1 = 0;
  26375. } else {
  26376. var m8 = (k1.andln(7) + d1) & 7;
  26377. if ((m8 === 3 || m8 === 5) && m24 === 2)
  26378. u1 = -m14;
  26379. else
  26380. u1 = m14;
  26381. }
  26382. jsf[0].push(u1);
  26383. var u2;
  26384. if ((m24 & 1) === 0) {
  26385. u2 = 0;
  26386. } else {
  26387. var m8 = (k2.andln(7) + d2) & 7;
  26388. if ((m8 === 3 || m8 === 5) && m14 === 2)
  26389. u2 = -m24;
  26390. else
  26391. u2 = m24;
  26392. }
  26393. jsf[1].push(u2);
  26394. // Second phase
  26395. if (2 * d1 === u1 + 1)
  26396. d1 = 1 - d1;
  26397. if (2 * d2 === u2 + 1)
  26398. d2 = 1 - d2;
  26399. k1.iushrn(1);
  26400. k2.iushrn(1);
  26401. }
  26402. return jsf;
  26403. }
  26404. utils.getJSF = getJSF;
  26405. function cachedProperty(obj, name, computer) {
  26406. var key = '_' + name;
  26407. obj.prototype[name] = function cachedProperty() {
  26408. return this[key] !== undefined ? this[key] :
  26409. this[key] = computer.call(this);
  26410. };
  26411. }
  26412. utils.cachedProperty = cachedProperty;
  26413. function parseBytes(bytes) {
  26414. return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
  26415. bytes;
  26416. }
  26417. utils.parseBytes = parseBytes;
  26418. function intFromLE(bytes) {
  26419. return new BN(bytes, 'hex', 'le');
  26420. }
  26421. utils.intFromLE = intFromLE;
  26422. /***/ },
  26423. /* 246 */
  26424. /***/ function(module, exports) {
  26425. /**
  26426. * Check if argument is a HTML element.
  26427. *
  26428. * @param {Object} value
  26429. * @return {Boolean}
  26430. */
  26431. exports.node = function(value) {
  26432. return value !== undefined
  26433. && value instanceof HTMLElement
  26434. && value.nodeType === 1;
  26435. };
  26436. /**
  26437. * Check if argument is a list of HTML elements.
  26438. *
  26439. * @param {Object} value
  26440. * @return {Boolean}
  26441. */
  26442. exports.nodeList = function(value) {
  26443. var type = Object.prototype.toString.call(value);
  26444. return value !== undefined
  26445. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  26446. && ('length' in value)
  26447. && (value.length === 0 || exports.node(value[0]));
  26448. };
  26449. /**
  26450. * Check if argument is a string.
  26451. *
  26452. * @param {Object} value
  26453. * @return {Boolean}
  26454. */
  26455. exports.string = function(value) {
  26456. return typeof value === 'string'
  26457. || value instanceof String;
  26458. };
  26459. /**
  26460. * Check if argument is a function.
  26461. *
  26462. * @param {Object} value
  26463. * @return {Boolean}
  26464. */
  26465. exports.fn = function(value) {
  26466. var type = Object.prototype.toString.call(value);
  26467. return type === '[object Function]';
  26468. };
  26469. /***/ },
  26470. /* 247 */
  26471. /***/ function(module, exports, __webpack_require__) {
  26472. var is = __webpack_require__(246);
  26473. var delegate = __webpack_require__(224);
  26474. /**
  26475. * Validates all params and calls the right
  26476. * listener function based on its target type.
  26477. *
  26478. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  26479. * @param {String} type
  26480. * @param {Function} callback
  26481. * @return {Object}
  26482. */
  26483. function listen(target, type, callback) {
  26484. if (!target && !type && !callback) {
  26485. throw new Error('Missing required arguments');
  26486. }
  26487. if (!is.string(type)) {
  26488. throw new TypeError('Second argument must be a String');
  26489. }
  26490. if (!is.fn(callback)) {
  26491. throw new TypeError('Third argument must be a Function');
  26492. }
  26493. if (is.node(target)) {
  26494. return listenNode(target, type, callback);
  26495. }
  26496. else if (is.nodeList(target)) {
  26497. return listenNodeList(target, type, callback);
  26498. }
  26499. else if (is.string(target)) {
  26500. return listenSelector(target, type, callback);
  26501. }
  26502. else {
  26503. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  26504. }
  26505. }
  26506. /**
  26507. * Adds an event listener to a HTML element
  26508. * and returns a remove listener function.
  26509. *
  26510. * @param {HTMLElement} node
  26511. * @param {String} type
  26512. * @param {Function} callback
  26513. * @return {Object}
  26514. */
  26515. function listenNode(node, type, callback) {
  26516. node.addEventListener(type, callback);
  26517. return {
  26518. destroy: function() {
  26519. node.removeEventListener(type, callback);
  26520. }
  26521. }
  26522. }
  26523. /**
  26524. * Add an event listener to a list of HTML elements
  26525. * and returns a remove listener function.
  26526. *
  26527. * @param {NodeList|HTMLCollection} nodeList
  26528. * @param {String} type
  26529. * @param {Function} callback
  26530. * @return {Object}
  26531. */
  26532. function listenNodeList(nodeList, type, callback) {
  26533. Array.prototype.forEach.call(nodeList, function(node) {
  26534. node.addEventListener(type, callback);
  26535. });
  26536. return {
  26537. destroy: function() {
  26538. Array.prototype.forEach.call(nodeList, function(node) {
  26539. node.removeEventListener(type, callback);
  26540. });
  26541. }
  26542. }
  26543. }
  26544. /**
  26545. * Add an event listener to a selector
  26546. * and returns a remove listener function.
  26547. *
  26548. * @param {String} selector
  26549. * @param {String} type
  26550. * @param {Function} callback
  26551. * @return {Object}
  26552. */
  26553. function listenSelector(selector, type, callback) {
  26554. return delegate(document.body, selector, type, callback);
  26555. }
  26556. module.exports = listen;
  26557. /***/ },
  26558. /* 248 */
  26559. /***/ function(module, exports, __webpack_require__) {
  26560. var hash = __webpack_require__(9);
  26561. var utils = hash.utils;
  26562. var assert = utils.assert;
  26563. function BlockHash() {
  26564. this.pending = null;
  26565. this.pendingTotal = 0;
  26566. this.blockSize = this.constructor.blockSize;
  26567. this.outSize = this.constructor.outSize;
  26568. this.hmacStrength = this.constructor.hmacStrength;
  26569. this.padLength = this.constructor.padLength / 8;
  26570. this.endian = 'big';
  26571. this._delta8 = this.blockSize / 8;
  26572. this._delta32 = this.blockSize / 32;
  26573. }
  26574. exports.BlockHash = BlockHash;
  26575. BlockHash.prototype.update = function update(msg, enc) {
  26576. // Convert message to array, pad it, and join into 32bit blocks
  26577. msg = utils.toArray(msg, enc);
  26578. if (!this.pending)
  26579. this.pending = msg;
  26580. else
  26581. this.pending = this.pending.concat(msg);
  26582. this.pendingTotal += msg.length;
  26583. // Enough data, try updating
  26584. if (this.pending.length >= this._delta8) {
  26585. msg = this.pending;
  26586. // Process pending data in blocks
  26587. var r = msg.length % this._delta8;
  26588. this.pending = msg.slice(msg.length - r, msg.length);
  26589. if (this.pending.length === 0)
  26590. this.pending = null;
  26591. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  26592. for (var i = 0; i < msg.length; i += this._delta32)
  26593. this._update(msg, i, i + this._delta32);
  26594. }
  26595. return this;
  26596. };
  26597. BlockHash.prototype.digest = function digest(enc) {
  26598. this.update(this._pad());
  26599. assert(this.pending === null);
  26600. return this._digest(enc);
  26601. };
  26602. BlockHash.prototype._pad = function pad() {
  26603. var len = this.pendingTotal;
  26604. var bytes = this._delta8;
  26605. var k = bytes - ((len + this.padLength) % bytes);
  26606. var res = new Array(k + this.padLength);
  26607. res[0] = 0x80;
  26608. for (var i = 1; i < k; i++)
  26609. res[i] = 0;
  26610. // Append length
  26611. len <<= 3;
  26612. if (this.endian === 'big') {
  26613. for (var t = 8; t < this.padLength; t++)
  26614. res[i++] = 0;
  26615. res[i++] = 0;
  26616. res[i++] = 0;
  26617. res[i++] = 0;
  26618. res[i++] = 0;
  26619. res[i++] = (len >>> 24) & 0xff;
  26620. res[i++] = (len >>> 16) & 0xff;
  26621. res[i++] = (len >>> 8) & 0xff;
  26622. res[i++] = len & 0xff;
  26623. } else {
  26624. res[i++] = len & 0xff;
  26625. res[i++] = (len >>> 8) & 0xff;
  26626. res[i++] = (len >>> 16) & 0xff;
  26627. res[i++] = (len >>> 24) & 0xff;
  26628. res[i++] = 0;
  26629. res[i++] = 0;
  26630. res[i++] = 0;
  26631. res[i++] = 0;
  26632. for (var t = 8; t < this.padLength; t++)
  26633. res[i++] = 0;
  26634. }
  26635. return res;
  26636. };
  26637. /***/ },
  26638. /* 249 */
  26639. /***/ function(module, exports, __webpack_require__) {
  26640. var hmac = exports;
  26641. var hash = __webpack_require__(9);
  26642. var utils = hash.utils;
  26643. var assert = utils.assert;
  26644. function Hmac(hash, key, enc) {
  26645. if (!(this instanceof Hmac))
  26646. return new Hmac(hash, key, enc);
  26647. this.Hash = hash;
  26648. this.blockSize = hash.blockSize / 8;
  26649. this.outSize = hash.outSize / 8;
  26650. this.inner = null;
  26651. this.outer = null;
  26652. this._init(utils.toArray(key, enc));
  26653. }
  26654. module.exports = Hmac;
  26655. Hmac.prototype._init = function init(key) {
  26656. // Shorten key, if needed
  26657. if (key.length > this.blockSize)
  26658. key = new this.Hash().update(key).digest();
  26659. assert(key.length <= this.blockSize);
  26660. // Add padding to key
  26661. for (var i = key.length; i < this.blockSize; i++)
  26662. key.push(0);
  26663. for (var i = 0; i < key.length; i++)
  26664. key[i] ^= 0x36;
  26665. this.inner = new this.Hash().update(key);
  26666. // 0x36 ^ 0x5c = 0x6a
  26667. for (var i = 0; i < key.length; i++)
  26668. key[i] ^= 0x6a;
  26669. this.outer = new this.Hash().update(key);
  26670. };
  26671. Hmac.prototype.update = function update(msg, enc) {
  26672. this.inner.update(msg, enc);
  26673. return this;
  26674. };
  26675. Hmac.prototype.digest = function digest(enc) {
  26676. this.outer.update(this.inner.digest());
  26677. return this.outer.digest(enc);
  26678. };
  26679. /***/ },
  26680. /* 250 */
  26681. /***/ function(module, exports, __webpack_require__) {
  26682. var hash = __webpack_require__(9);
  26683. var utils = hash.utils;
  26684. var rotl32 = utils.rotl32;
  26685. var sum32 = utils.sum32;
  26686. var sum32_3 = utils.sum32_3;
  26687. var sum32_4 = utils.sum32_4;
  26688. var BlockHash = hash.common.BlockHash;
  26689. function RIPEMD160() {
  26690. if (!(this instanceof RIPEMD160))
  26691. return new RIPEMD160();
  26692. BlockHash.call(this);
  26693. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
  26694. this.endian = 'little';
  26695. }
  26696. utils.inherits(RIPEMD160, BlockHash);
  26697. exports.ripemd160 = RIPEMD160;
  26698. RIPEMD160.blockSize = 512;
  26699. RIPEMD160.outSize = 160;
  26700. RIPEMD160.hmacStrength = 192;
  26701. RIPEMD160.padLength = 64;
  26702. RIPEMD160.prototype._update = function update(msg, start) {
  26703. var A = this.h[0];
  26704. var B = this.h[1];
  26705. var C = this.h[2];
  26706. var D = this.h[3];
  26707. var E = this.h[4];
  26708. var Ah = A;
  26709. var Bh = B;
  26710. var Ch = C;
  26711. var Dh = D;
  26712. var Eh = E;
  26713. for (var j = 0; j < 80; j++) {
  26714. var T = sum32(
  26715. rotl32(
  26716. sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
  26717. s[j]),
  26718. E);
  26719. A = E;
  26720. E = D;
  26721. D = rotl32(C, 10);
  26722. C = B;
  26723. B = T;
  26724. T = sum32(
  26725. rotl32(
  26726. sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
  26727. sh[j]),
  26728. Eh);
  26729. Ah = Eh;
  26730. Eh = Dh;
  26731. Dh = rotl32(Ch, 10);
  26732. Ch = Bh;
  26733. Bh = T;
  26734. }
  26735. T = sum32_3(this.h[1], C, Dh);
  26736. this.h[1] = sum32_3(this.h[2], D, Eh);
  26737. this.h[2] = sum32_3(this.h[3], E, Ah);
  26738. this.h[3] = sum32_3(this.h[4], A, Bh);
  26739. this.h[4] = sum32_3(this.h[0], B, Ch);
  26740. this.h[0] = T;
  26741. };
  26742. RIPEMD160.prototype._digest = function digest(enc) {
  26743. if (enc === 'hex')
  26744. return utils.toHex32(this.h, 'little');
  26745. else
  26746. return utils.split32(this.h, 'little');
  26747. };
  26748. function f(j, x, y, z) {
  26749. if (j <= 15)
  26750. return x ^ y ^ z;
  26751. else if (j <= 31)
  26752. return (x & y) | ((~x) & z);
  26753. else if (j <= 47)
  26754. return (x | (~y)) ^ z;
  26755. else if (j <= 63)
  26756. return (x & z) | (y & (~z));
  26757. else
  26758. return x ^ (y | (~z));
  26759. }
  26760. function K(j) {
  26761. if (j <= 15)
  26762. return 0x00000000;
  26763. else if (j <= 31)
  26764. return 0x5a827999;
  26765. else if (j <= 47)
  26766. return 0x6ed9eba1;
  26767. else if (j <= 63)
  26768. return 0x8f1bbcdc;
  26769. else
  26770. return 0xa953fd4e;
  26771. }
  26772. function Kh(j) {
  26773. if (j <= 15)
  26774. return 0x50a28be6;
  26775. else if (j <= 31)
  26776. return 0x5c4dd124;
  26777. else if (j <= 47)
  26778. return 0x6d703ef3;
  26779. else if (j <= 63)
  26780. return 0x7a6d76e9;
  26781. else
  26782. return 0x00000000;
  26783. }
  26784. var r = [
  26785. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  26786. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  26787. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  26788. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  26789. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  26790. ];
  26791. var rh = [
  26792. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  26793. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  26794. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  26795. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  26796. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  26797. ];
  26798. var s = [
  26799. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  26800. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  26801. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  26802. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  26803. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  26804. ];
  26805. var sh = [
  26806. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  26807. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  26808. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  26809. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  26810. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  26811. ];
  26812. /***/ },
  26813. /* 251 */
  26814. /***/ function(module, exports, __webpack_require__) {
  26815. var hash = __webpack_require__(9);
  26816. var utils = hash.utils;
  26817. var assert = utils.assert;
  26818. var rotr32 = utils.rotr32;
  26819. var rotl32 = utils.rotl32;
  26820. var sum32 = utils.sum32;
  26821. var sum32_4 = utils.sum32_4;
  26822. var sum32_5 = utils.sum32_5;
  26823. var rotr64_hi = utils.rotr64_hi;
  26824. var rotr64_lo = utils.rotr64_lo;
  26825. var shr64_hi = utils.shr64_hi;
  26826. var shr64_lo = utils.shr64_lo;
  26827. var sum64 = utils.sum64;
  26828. var sum64_hi = utils.sum64_hi;
  26829. var sum64_lo = utils.sum64_lo;
  26830. var sum64_4_hi = utils.sum64_4_hi;
  26831. var sum64_4_lo = utils.sum64_4_lo;
  26832. var sum64_5_hi = utils.sum64_5_hi;
  26833. var sum64_5_lo = utils.sum64_5_lo;
  26834. var BlockHash = hash.common.BlockHash;
  26835. var sha256_K = [
  26836. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  26837. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  26838. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  26839. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  26840. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  26841. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  26842. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  26843. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  26844. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  26845. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  26846. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  26847. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  26848. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  26849. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  26850. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  26851. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  26852. ];
  26853. var sha512_K = [
  26854. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  26855. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  26856. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  26857. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  26858. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  26859. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  26860. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  26861. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  26862. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  26863. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  26864. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  26865. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  26866. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  26867. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  26868. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  26869. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  26870. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  26871. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  26872. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  26873. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  26874. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  26875. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  26876. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  26877. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  26878. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  26879. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  26880. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  26881. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  26882. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  26883. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  26884. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  26885. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  26886. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  26887. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  26888. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  26889. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  26890. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  26891. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  26892. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  26893. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  26894. ];
  26895. var sha1_K = [
  26896. 0x5A827999, 0x6ED9EBA1,
  26897. 0x8F1BBCDC, 0xCA62C1D6
  26898. ];
  26899. function SHA256() {
  26900. if (!(this instanceof SHA256))
  26901. return new SHA256();
  26902. BlockHash.call(this);
  26903. this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  26904. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ];
  26905. this.k = sha256_K;
  26906. this.W = new Array(64);
  26907. }
  26908. utils.inherits(SHA256, BlockHash);
  26909. exports.sha256 = SHA256;
  26910. SHA256.blockSize = 512;
  26911. SHA256.outSize = 256;
  26912. SHA256.hmacStrength = 192;
  26913. SHA256.padLength = 64;
  26914. SHA256.prototype._update = function _update(msg, start) {
  26915. var W = this.W;
  26916. for (var i = 0; i < 16; i++)
  26917. W[i] = msg[start + i];
  26918. for (; i < W.length; i++)
  26919. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  26920. var a = this.h[0];
  26921. var b = this.h[1];
  26922. var c = this.h[2];
  26923. var d = this.h[3];
  26924. var e = this.h[4];
  26925. var f = this.h[5];
  26926. var g = this.h[6];
  26927. var h = this.h[7];
  26928. assert(this.k.length === W.length);
  26929. for (var i = 0; i < W.length; i++) {
  26930. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  26931. var T2 = sum32(s0_256(a), maj32(a, b, c));
  26932. h = g;
  26933. g = f;
  26934. f = e;
  26935. e = sum32(d, T1);
  26936. d = c;
  26937. c = b;
  26938. b = a;
  26939. a = sum32(T1, T2);
  26940. }
  26941. this.h[0] = sum32(this.h[0], a);
  26942. this.h[1] = sum32(this.h[1], b);
  26943. this.h[2] = sum32(this.h[2], c);
  26944. this.h[3] = sum32(this.h[3], d);
  26945. this.h[4] = sum32(this.h[4], e);
  26946. this.h[5] = sum32(this.h[5], f);
  26947. this.h[6] = sum32(this.h[6], g);
  26948. this.h[7] = sum32(this.h[7], h);
  26949. };
  26950. SHA256.prototype._digest = function digest(enc) {
  26951. if (enc === 'hex')
  26952. return utils.toHex32(this.h, 'big');
  26953. else
  26954. return utils.split32(this.h, 'big');
  26955. };
  26956. function SHA224() {
  26957. if (!(this instanceof SHA224))
  26958. return new SHA224();
  26959. SHA256.call(this);
  26960. this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  26961. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
  26962. }
  26963. utils.inherits(SHA224, SHA256);
  26964. exports.sha224 = SHA224;
  26965. SHA224.blockSize = 512;
  26966. SHA224.outSize = 224;
  26967. SHA224.hmacStrength = 192;
  26968. SHA224.padLength = 64;
  26969. SHA224.prototype._digest = function digest(enc) {
  26970. // Just truncate output
  26971. if (enc === 'hex')
  26972. return utils.toHex32(this.h.slice(0, 7), 'big');
  26973. else
  26974. return utils.split32(this.h.slice(0, 7), 'big');
  26975. };
  26976. function SHA512() {
  26977. if (!(this instanceof SHA512))
  26978. return new SHA512();
  26979. BlockHash.call(this);
  26980. this.h = [ 0x6a09e667, 0xf3bcc908,
  26981. 0xbb67ae85, 0x84caa73b,
  26982. 0x3c6ef372, 0xfe94f82b,
  26983. 0xa54ff53a, 0x5f1d36f1,
  26984. 0x510e527f, 0xade682d1,
  26985. 0x9b05688c, 0x2b3e6c1f,
  26986. 0x1f83d9ab, 0xfb41bd6b,
  26987. 0x5be0cd19, 0x137e2179 ];
  26988. this.k = sha512_K;
  26989. this.W = new Array(160);
  26990. }
  26991. utils.inherits(SHA512, BlockHash);
  26992. exports.sha512 = SHA512;
  26993. SHA512.blockSize = 1024;
  26994. SHA512.outSize = 512;
  26995. SHA512.hmacStrength = 192;
  26996. SHA512.padLength = 128;
  26997. SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
  26998. var W = this.W;
  26999. // 32 x 32bit words
  27000. for (var i = 0; i < 32; i++)
  27001. W[i] = msg[start + i];
  27002. for (; i < W.length; i += 2) {
  27003. var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
  27004. var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
  27005. var c1_hi = W[i - 14]; // i - 7
  27006. var c1_lo = W[i - 13];
  27007. var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
  27008. var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
  27009. var c3_hi = W[i - 32]; // i - 16
  27010. var c3_lo = W[i - 31];
  27011. W[i] = sum64_4_hi(c0_hi, c0_lo,
  27012. c1_hi, c1_lo,
  27013. c2_hi, c2_lo,
  27014. c3_hi, c3_lo);
  27015. W[i + 1] = sum64_4_lo(c0_hi, c0_lo,
  27016. c1_hi, c1_lo,
  27017. c2_hi, c2_lo,
  27018. c3_hi, c3_lo);
  27019. }
  27020. };
  27021. SHA512.prototype._update = function _update(msg, start) {
  27022. this._prepareBlock(msg, start);
  27023. var W = this.W;
  27024. var ah = this.h[0];
  27025. var al = this.h[1];
  27026. var bh = this.h[2];
  27027. var bl = this.h[3];
  27028. var ch = this.h[4];
  27029. var cl = this.h[5];
  27030. var dh = this.h[6];
  27031. var dl = this.h[7];
  27032. var eh = this.h[8];
  27033. var el = this.h[9];
  27034. var fh = this.h[10];
  27035. var fl = this.h[11];
  27036. var gh = this.h[12];
  27037. var gl = this.h[13];
  27038. var hh = this.h[14];
  27039. var hl = this.h[15];
  27040. assert(this.k.length === W.length);
  27041. for (var i = 0; i < W.length; i += 2) {
  27042. var c0_hi = hh;
  27043. var c0_lo = hl;
  27044. var c1_hi = s1_512_hi(eh, el);
  27045. var c1_lo = s1_512_lo(eh, el);
  27046. var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
  27047. var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
  27048. var c3_hi = this.k[i];
  27049. var c3_lo = this.k[i + 1];
  27050. var c4_hi = W[i];
  27051. var c4_lo = W[i + 1];
  27052. var T1_hi = sum64_5_hi(c0_hi, c0_lo,
  27053. c1_hi, c1_lo,
  27054. c2_hi, c2_lo,
  27055. c3_hi, c3_lo,
  27056. c4_hi, c4_lo);
  27057. var T1_lo = sum64_5_lo(c0_hi, c0_lo,
  27058. c1_hi, c1_lo,
  27059. c2_hi, c2_lo,
  27060. c3_hi, c3_lo,
  27061. c4_hi, c4_lo);
  27062. var c0_hi = s0_512_hi(ah, al);
  27063. var c0_lo = s0_512_lo(ah, al);
  27064. var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
  27065. var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
  27066. var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
  27067. var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
  27068. hh = gh;
  27069. hl = gl;
  27070. gh = fh;
  27071. gl = fl;
  27072. fh = eh;
  27073. fl = el;
  27074. eh = sum64_hi(dh, dl, T1_hi, T1_lo);
  27075. el = sum64_lo(dl, dl, T1_hi, T1_lo);
  27076. dh = ch;
  27077. dl = cl;
  27078. ch = bh;
  27079. cl = bl;
  27080. bh = ah;
  27081. bl = al;
  27082. ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
  27083. al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
  27084. }
  27085. sum64(this.h, 0, ah, al);
  27086. sum64(this.h, 2, bh, bl);
  27087. sum64(this.h, 4, ch, cl);
  27088. sum64(this.h, 6, dh, dl);
  27089. sum64(this.h, 8, eh, el);
  27090. sum64(this.h, 10, fh, fl);
  27091. sum64(this.h, 12, gh, gl);
  27092. sum64(this.h, 14, hh, hl);
  27093. };
  27094. SHA512.prototype._digest = function digest(enc) {
  27095. if (enc === 'hex')
  27096. return utils.toHex32(this.h, 'big');
  27097. else
  27098. return utils.split32(this.h, 'big');
  27099. };
  27100. function SHA384() {
  27101. if (!(this instanceof SHA384))
  27102. return new SHA384();
  27103. SHA512.call(this);
  27104. this.h = [ 0xcbbb9d5d, 0xc1059ed8,
  27105. 0x629a292a, 0x367cd507,
  27106. 0x9159015a, 0x3070dd17,
  27107. 0x152fecd8, 0xf70e5939,
  27108. 0x67332667, 0xffc00b31,
  27109. 0x8eb44a87, 0x68581511,
  27110. 0xdb0c2e0d, 0x64f98fa7,
  27111. 0x47b5481d, 0xbefa4fa4 ];
  27112. }
  27113. utils.inherits(SHA384, SHA512);
  27114. exports.sha384 = SHA384;
  27115. SHA384.blockSize = 1024;
  27116. SHA384.outSize = 384;
  27117. SHA384.hmacStrength = 192;
  27118. SHA384.padLength = 128;
  27119. SHA384.prototype._digest = function digest(enc) {
  27120. if (enc === 'hex')
  27121. return utils.toHex32(this.h.slice(0, 12), 'big');
  27122. else
  27123. return utils.split32(this.h.slice(0, 12), 'big');
  27124. };
  27125. function SHA1() {
  27126. if (!(this instanceof SHA1))
  27127. return new SHA1();
  27128. BlockHash.call(this);
  27129. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe,
  27130. 0x10325476, 0xc3d2e1f0 ];
  27131. this.W = new Array(80);
  27132. }
  27133. utils.inherits(SHA1, BlockHash);
  27134. exports.sha1 = SHA1;
  27135. SHA1.blockSize = 512;
  27136. SHA1.outSize = 160;
  27137. SHA1.hmacStrength = 80;
  27138. SHA1.padLength = 64;
  27139. SHA1.prototype._update = function _update(msg, start) {
  27140. var W = this.W;
  27141. for (var i = 0; i < 16; i++)
  27142. W[i] = msg[start + i];
  27143. for(; i < W.length; i++)
  27144. W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
  27145. var a = this.h[0];
  27146. var b = this.h[1];
  27147. var c = this.h[2];
  27148. var d = this.h[3];
  27149. var e = this.h[4];
  27150. for (var i = 0; i < W.length; i++) {
  27151. var s = ~~(i / 20);
  27152. var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
  27153. e = d;
  27154. d = c;
  27155. c = rotl32(b, 30);
  27156. b = a;
  27157. a = t;
  27158. }
  27159. this.h[0] = sum32(this.h[0], a);
  27160. this.h[1] = sum32(this.h[1], b);
  27161. this.h[2] = sum32(this.h[2], c);
  27162. this.h[3] = sum32(this.h[3], d);
  27163. this.h[4] = sum32(this.h[4], e);
  27164. };
  27165. SHA1.prototype._digest = function digest(enc) {
  27166. if (enc === 'hex')
  27167. return utils.toHex32(this.h, 'big');
  27168. else
  27169. return utils.split32(this.h, 'big');
  27170. };
  27171. function ch32(x, y, z) {
  27172. return (x & y) ^ ((~x) & z);
  27173. }
  27174. function maj32(x, y, z) {
  27175. return (x & y) ^ (x & z) ^ (y & z);
  27176. }
  27177. function p32(x, y, z) {
  27178. return x ^ y ^ z;
  27179. }
  27180. function s0_256(x) {
  27181. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  27182. }
  27183. function s1_256(x) {
  27184. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  27185. }
  27186. function g0_256(x) {
  27187. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  27188. }
  27189. function g1_256(x) {
  27190. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  27191. }
  27192. function ft_1(s, x, y, z) {
  27193. if (s === 0)
  27194. return ch32(x, y, z);
  27195. if (s === 1 || s === 3)
  27196. return p32(x, y, z);
  27197. if (s === 2)
  27198. return maj32(x, y, z);
  27199. }
  27200. function ch64_hi(xh, xl, yh, yl, zh, zl) {
  27201. var r = (xh & yh) ^ ((~xh) & zh);
  27202. if (r < 0)
  27203. r += 0x100000000;
  27204. return r;
  27205. }
  27206. function ch64_lo(xh, xl, yh, yl, zh, zl) {
  27207. var r = (xl & yl) ^ ((~xl) & zl);
  27208. if (r < 0)
  27209. r += 0x100000000;
  27210. return r;
  27211. }
  27212. function maj64_hi(xh, xl, yh, yl, zh, zl) {
  27213. var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
  27214. if (r < 0)
  27215. r += 0x100000000;
  27216. return r;
  27217. }
  27218. function maj64_lo(xh, xl, yh, yl, zh, zl) {
  27219. var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
  27220. if (r < 0)
  27221. r += 0x100000000;
  27222. return r;
  27223. }
  27224. function s0_512_hi(xh, xl) {
  27225. var c0_hi = rotr64_hi(xh, xl, 28);
  27226. var c1_hi = rotr64_hi(xl, xh, 2); // 34
  27227. var c2_hi = rotr64_hi(xl, xh, 7); // 39
  27228. var r = c0_hi ^ c1_hi ^ c2_hi;
  27229. if (r < 0)
  27230. r += 0x100000000;
  27231. return r;
  27232. }
  27233. function s0_512_lo(xh, xl) {
  27234. var c0_lo = rotr64_lo(xh, xl, 28);
  27235. var c1_lo = rotr64_lo(xl, xh, 2); // 34
  27236. var c2_lo = rotr64_lo(xl, xh, 7); // 39
  27237. var r = c0_lo ^ c1_lo ^ c2_lo;
  27238. if (r < 0)
  27239. r += 0x100000000;
  27240. return r;
  27241. }
  27242. function s1_512_hi(xh, xl) {
  27243. var c0_hi = rotr64_hi(xh, xl, 14);
  27244. var c1_hi = rotr64_hi(xh, xl, 18);
  27245. var c2_hi = rotr64_hi(xl, xh, 9); // 41
  27246. var r = c0_hi ^ c1_hi ^ c2_hi;
  27247. if (r < 0)
  27248. r += 0x100000000;
  27249. return r;
  27250. }
  27251. function s1_512_lo(xh, xl) {
  27252. var c0_lo = rotr64_lo(xh, xl, 14);
  27253. var c1_lo = rotr64_lo(xh, xl, 18);
  27254. var c2_lo = rotr64_lo(xl, xh, 9); // 41
  27255. var r = c0_lo ^ c1_lo ^ c2_lo;
  27256. if (r < 0)
  27257. r += 0x100000000;
  27258. return r;
  27259. }
  27260. function g0_512_hi(xh, xl) {
  27261. var c0_hi = rotr64_hi(xh, xl, 1);
  27262. var c1_hi = rotr64_hi(xh, xl, 8);
  27263. var c2_hi = shr64_hi(xh, xl, 7);
  27264. var r = c0_hi ^ c1_hi ^ c2_hi;
  27265. if (r < 0)
  27266. r += 0x100000000;
  27267. return r;
  27268. }
  27269. function g0_512_lo(xh, xl) {
  27270. var c0_lo = rotr64_lo(xh, xl, 1);
  27271. var c1_lo = rotr64_lo(xh, xl, 8);
  27272. var c2_lo = shr64_lo(xh, xl, 7);
  27273. var r = c0_lo ^ c1_lo ^ c2_lo;
  27274. if (r < 0)
  27275. r += 0x100000000;
  27276. return r;
  27277. }
  27278. function g1_512_hi(xh, xl) {
  27279. var c0_hi = rotr64_hi(xh, xl, 19);
  27280. var c1_hi = rotr64_hi(xl, xh, 29); // 61
  27281. var c2_hi = shr64_hi(xh, xl, 6);
  27282. var r = c0_hi ^ c1_hi ^ c2_hi;
  27283. if (r < 0)
  27284. r += 0x100000000;
  27285. return r;
  27286. }
  27287. function g1_512_lo(xh, xl) {
  27288. var c0_lo = rotr64_lo(xh, xl, 19);
  27289. var c1_lo = rotr64_lo(xl, xh, 29); // 61
  27290. var c2_lo = shr64_lo(xh, xl, 6);
  27291. var r = c0_lo ^ c1_lo ^ c2_lo;
  27292. if (r < 0)
  27293. r += 0x100000000;
  27294. return r;
  27295. }
  27296. /***/ },
  27297. /* 252 */
  27298. /***/ function(module, exports, __webpack_require__) {
  27299. var utils = exports;
  27300. var inherits = __webpack_require__(1);
  27301. function toArray(msg, enc) {
  27302. if (Array.isArray(msg))
  27303. return msg.slice();
  27304. if (!msg)
  27305. return [];
  27306. var res = [];
  27307. if (typeof msg === 'string') {
  27308. if (!enc) {
  27309. for (var i = 0; i < msg.length; i++) {
  27310. var c = msg.charCodeAt(i);
  27311. var hi = c >> 8;
  27312. var lo = c & 0xff;
  27313. if (hi)
  27314. res.push(hi, lo);
  27315. else
  27316. res.push(lo);
  27317. }
  27318. } else if (enc === 'hex') {
  27319. msg = msg.replace(/[^a-z0-9]+/ig, '');
  27320. if (msg.length % 2 !== 0)
  27321. msg = '0' + msg;
  27322. for (var i = 0; i < msg.length; i += 2)
  27323. res.push(parseInt(msg[i] + msg[i + 1], 16));
  27324. }
  27325. } else {
  27326. for (var i = 0; i < msg.length; i++)
  27327. res[i] = msg[i] | 0;
  27328. }
  27329. return res;
  27330. }
  27331. utils.toArray = toArray;
  27332. function toHex(msg) {
  27333. var res = '';
  27334. for (var i = 0; i < msg.length; i++)
  27335. res += zero2(msg[i].toString(16));
  27336. return res;
  27337. }
  27338. utils.toHex = toHex;
  27339. function htonl(w) {
  27340. var res = (w >>> 24) |
  27341. ((w >>> 8) & 0xff00) |
  27342. ((w << 8) & 0xff0000) |
  27343. ((w & 0xff) << 24);
  27344. return res >>> 0;
  27345. }
  27346. utils.htonl = htonl;
  27347. function toHex32(msg, endian) {
  27348. var res = '';
  27349. for (var i = 0; i < msg.length; i++) {
  27350. var w = msg[i];
  27351. if (endian === 'little')
  27352. w = htonl(w);
  27353. res += zero8(w.toString(16));
  27354. }
  27355. return res;
  27356. }
  27357. utils.toHex32 = toHex32;
  27358. function zero2(word) {
  27359. if (word.length === 1)
  27360. return '0' + word;
  27361. else
  27362. return word;
  27363. }
  27364. utils.zero2 = zero2;
  27365. function zero8(word) {
  27366. if (word.length === 7)
  27367. return '0' + word;
  27368. else if (word.length === 6)
  27369. return '00' + word;
  27370. else if (word.length === 5)
  27371. return '000' + word;
  27372. else if (word.length === 4)
  27373. return '0000' + word;
  27374. else if (word.length === 3)
  27375. return '00000' + word;
  27376. else if (word.length === 2)
  27377. return '000000' + word;
  27378. else if (word.length === 1)
  27379. return '0000000' + word;
  27380. else
  27381. return word;
  27382. }
  27383. utils.zero8 = zero8;
  27384. function join32(msg, start, end, endian) {
  27385. var len = end - start;
  27386. assert(len % 4 === 0);
  27387. var res = new Array(len / 4);
  27388. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  27389. var w;
  27390. if (endian === 'big')
  27391. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  27392. else
  27393. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  27394. res[i] = w >>> 0;
  27395. }
  27396. return res;
  27397. }
  27398. utils.join32 = join32;
  27399. function split32(msg, endian) {
  27400. var res = new Array(msg.length * 4);
  27401. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  27402. var m = msg[i];
  27403. if (endian === 'big') {
  27404. res[k] = m >>> 24;
  27405. res[k + 1] = (m >>> 16) & 0xff;
  27406. res[k + 2] = (m >>> 8) & 0xff;
  27407. res[k + 3] = m & 0xff;
  27408. } else {
  27409. res[k + 3] = m >>> 24;
  27410. res[k + 2] = (m >>> 16) & 0xff;
  27411. res[k + 1] = (m >>> 8) & 0xff;
  27412. res[k] = m & 0xff;
  27413. }
  27414. }
  27415. return res;
  27416. }
  27417. utils.split32 = split32;
  27418. function rotr32(w, b) {
  27419. return (w >>> b) | (w << (32 - b));
  27420. }
  27421. utils.rotr32 = rotr32;
  27422. function rotl32(w, b) {
  27423. return (w << b) | (w >>> (32 - b));
  27424. }
  27425. utils.rotl32 = rotl32;
  27426. function sum32(a, b) {
  27427. return (a + b) >>> 0;
  27428. }
  27429. utils.sum32 = sum32;
  27430. function sum32_3(a, b, c) {
  27431. return (a + b + c) >>> 0;
  27432. }
  27433. utils.sum32_3 = sum32_3;
  27434. function sum32_4(a, b, c, d) {
  27435. return (a + b + c + d) >>> 0;
  27436. }
  27437. utils.sum32_4 = sum32_4;
  27438. function sum32_5(a, b, c, d, e) {
  27439. return (a + b + c + d + e) >>> 0;
  27440. }
  27441. utils.sum32_5 = sum32_5;
  27442. function assert(cond, msg) {
  27443. if (!cond)
  27444. throw new Error(msg || 'Assertion failed');
  27445. }
  27446. utils.assert = assert;
  27447. utils.inherits = inherits;
  27448. function sum64(buf, pos, ah, al) {
  27449. var bh = buf[pos];
  27450. var bl = buf[pos + 1];
  27451. var lo = (al + bl) >>> 0;
  27452. var hi = (lo < al ? 1 : 0) + ah + bh;
  27453. buf[pos] = hi >>> 0;
  27454. buf[pos + 1] = lo;
  27455. }
  27456. exports.sum64 = sum64;
  27457. function sum64_hi(ah, al, bh, bl) {
  27458. var lo = (al + bl) >>> 0;
  27459. var hi = (lo < al ? 1 : 0) + ah + bh;
  27460. return hi >>> 0;
  27461. };
  27462. exports.sum64_hi = sum64_hi;
  27463. function sum64_lo(ah, al, bh, bl) {
  27464. var lo = al + bl;
  27465. return lo >>> 0;
  27466. };
  27467. exports.sum64_lo = sum64_lo;
  27468. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  27469. var carry = 0;
  27470. var lo = al;
  27471. lo = (lo + bl) >>> 0;
  27472. carry += lo < al ? 1 : 0;
  27473. lo = (lo + cl) >>> 0;
  27474. carry += lo < cl ? 1 : 0;
  27475. lo = (lo + dl) >>> 0;
  27476. carry += lo < dl ? 1 : 0;
  27477. var hi = ah + bh + ch + dh + carry;
  27478. return hi >>> 0;
  27479. };
  27480. exports.sum64_4_hi = sum64_4_hi;
  27481. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  27482. var lo = al + bl + cl + dl;
  27483. return lo >>> 0;
  27484. };
  27485. exports.sum64_4_lo = sum64_4_lo;
  27486. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  27487. var carry = 0;
  27488. var lo = al;
  27489. lo = (lo + bl) >>> 0;
  27490. carry += lo < al ? 1 : 0;
  27491. lo = (lo + cl) >>> 0;
  27492. carry += lo < cl ? 1 : 0;
  27493. lo = (lo + dl) >>> 0;
  27494. carry += lo < dl ? 1 : 0;
  27495. lo = (lo + el) >>> 0;
  27496. carry += lo < el ? 1 : 0;
  27497. var hi = ah + bh + ch + dh + eh + carry;
  27498. return hi >>> 0;
  27499. };
  27500. exports.sum64_5_hi = sum64_5_hi;
  27501. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  27502. var lo = al + bl + cl + dl + el;
  27503. return lo >>> 0;
  27504. };
  27505. exports.sum64_5_lo = sum64_5_lo;
  27506. function rotr64_hi(ah, al, num) {
  27507. var r = (al << (32 - num)) | (ah >>> num);
  27508. return r >>> 0;
  27509. };
  27510. exports.rotr64_hi = rotr64_hi;
  27511. function rotr64_lo(ah, al, num) {
  27512. var r = (ah << (32 - num)) | (al >>> num);
  27513. return r >>> 0;
  27514. };
  27515. exports.rotr64_lo = rotr64_lo;
  27516. function shr64_hi(ah, al, num) {
  27517. return ah >>> num;
  27518. };
  27519. exports.shr64_hi = shr64_hi;
  27520. function shr64_lo(ah, al, num) {
  27521. var r = (ah << (32 - num)) | (al >>> num);
  27522. return r >>> 0;
  27523. };
  27524. exports.shr64_lo = shr64_lo;
  27525. /***/ },
  27526. /* 253 */
  27527. /***/ function(module, exports) {
  27528. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  27529. var e, m
  27530. var eLen = nBytes * 8 - mLen - 1
  27531. var eMax = (1 << eLen) - 1
  27532. var eBias = eMax >> 1
  27533. var nBits = -7
  27534. var i = isLE ? (nBytes - 1) : 0
  27535. var d = isLE ? -1 : 1
  27536. var s = buffer[offset + i]
  27537. i += d
  27538. e = s & ((1 << (-nBits)) - 1)
  27539. s >>= (-nBits)
  27540. nBits += eLen
  27541. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  27542. m = e & ((1 << (-nBits)) - 1)
  27543. e >>= (-nBits)
  27544. nBits += mLen
  27545. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  27546. if (e === 0) {
  27547. e = 1 - eBias
  27548. } else if (e === eMax) {
  27549. return m ? NaN : ((s ? -1 : 1) * Infinity)
  27550. } else {
  27551. m = m + Math.pow(2, mLen)
  27552. e = e - eBias
  27553. }
  27554. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  27555. }
  27556. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  27557. var e, m, c
  27558. var eLen = nBytes * 8 - mLen - 1
  27559. var eMax = (1 << eLen) - 1
  27560. var eBias = eMax >> 1
  27561. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  27562. var i = isLE ? 0 : (nBytes - 1)
  27563. var d = isLE ? 1 : -1
  27564. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  27565. value = Math.abs(value)
  27566. if (isNaN(value) || value === Infinity) {
  27567. m = isNaN(value) ? 1 : 0
  27568. e = eMax
  27569. } else {
  27570. e = Math.floor(Math.log(value) / Math.LN2)
  27571. if (value * (c = Math.pow(2, -e)) < 1) {
  27572. e--
  27573. c *= 2
  27574. }
  27575. if (e + eBias >= 1) {
  27576. value += rt / c
  27577. } else {
  27578. value += rt * Math.pow(2, 1 - eBias)
  27579. }
  27580. if (value * c >= 2) {
  27581. e++
  27582. c /= 2
  27583. }
  27584. if (e + eBias >= eMax) {
  27585. m = 0
  27586. e = eMax
  27587. } else if (e + eBias >= 1) {
  27588. m = (value * c - 1) * Math.pow(2, mLen)
  27589. e = e + eBias
  27590. } else {
  27591. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  27592. e = 0
  27593. }
  27594. }
  27595. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  27596. e = (e << mLen) | m
  27597. eLen += mLen
  27598. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  27599. buffer[offset + i - d] |= s * 128
  27600. }
  27601. /***/ },
  27602. /* 254 */
  27603. /***/ function(module, exports) {
  27604. var indexOf = [].indexOf;
  27605. module.exports = function(arr, obj){
  27606. if (indexOf) return arr.indexOf(obj);
  27607. for (var i = 0; i < arr.length; ++i) {
  27608. if (arr[i] === obj) return i;
  27609. }
  27610. return -1;
  27611. };
  27612. /***/ },
  27613. /* 255 */
  27614. /***/ function(module, exports) {
  27615. module.exports = {
  27616. "modp1": {
  27617. "gen": "02",
  27618. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
  27619. },
  27620. "modp2": {
  27621. "gen": "02",
  27622. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
  27623. },
  27624. "modp5": {
  27625. "gen": "02",
  27626. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
  27627. },
  27628. "modp14": {
  27629. "gen": "02",
  27630. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
  27631. },
  27632. "modp15": {
  27633. "gen": "02",
  27634. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
  27635. },
  27636. "modp16": {
  27637. "gen": "02",
  27638. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
  27639. },
  27640. "modp17": {
  27641. "gen": "02",
  27642. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
  27643. },
  27644. "modp18": {
  27645. "gen": "02",
  27646. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
  27647. }
  27648. };
  27649. /***/ },
  27650. /* 256 */
  27651. /***/ function(module, exports) {
  27652. module.exports = {
  27653. "_args": [
  27654. [
  27655. {
  27656. "raw": "elliptic@^6.0.0",
  27657. "scope": null,
  27658. "escapedName": "elliptic",
  27659. "name": "elliptic",
  27660. "rawSpec": "^6.0.0",
  27661. "spec": ">=6.0.0 <7.0.0",
  27662. "type": "range"
  27663. },
  27664. "/home/guillaume/workspace/lesspass/pure/node_modules/browserify-sign"
  27665. ]
  27666. ],
  27667. "_from": "elliptic@>=6.0.0 <7.0.0",
  27668. "_id": "elliptic@6.3.2",
  27669. "_inCache": true,
  27670. "_location": "/elliptic",
  27671. "_nodeVersion": "6.3.0",
  27672. "_npmOperationalInternal": {
  27673. "host": "packages-16-east.internal.npmjs.com",
  27674. "tmp": "tmp/elliptic-6.3.2.tgz_1473938837205_0.3108903462998569"
  27675. },
  27676. "_npmUser": {
  27677. "name": "indutny",
  27678. "email": "fedor@indutny.com"
  27679. },
  27680. "_npmVersion": "3.10.3",
  27681. "_phantomChildren": {},
  27682. "_requested": {
  27683. "raw": "elliptic@^6.0.0",
  27684. "scope": null,
  27685. "escapedName": "elliptic",
  27686. "name": "elliptic",
  27687. "rawSpec": "^6.0.0",
  27688. "spec": ">=6.0.0 <7.0.0",
  27689. "type": "range"
  27690. },
  27691. "_requiredBy": [
  27692. "/browserify-sign",
  27693. "/create-ecdh"
  27694. ],
  27695. "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz",
  27696. "_shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48",
  27697. "_shrinkwrap": null,
  27698. "_spec": "elliptic@^6.0.0",
  27699. "_where": "/home/guillaume/workspace/lesspass/pure/node_modules/browserify-sign",
  27700. "author": {
  27701. "name": "Fedor Indutny",
  27702. "email": "fedor@indutny.com"
  27703. },
  27704. "bugs": {
  27705. "url": "https://github.com/indutny/elliptic/issues"
  27706. },
  27707. "dependencies": {
  27708. "bn.js": "^4.4.0",
  27709. "brorand": "^1.0.1",
  27710. "hash.js": "^1.0.0",
  27711. "inherits": "^2.0.1"
  27712. },
  27713. "description": "EC cryptography",
  27714. "devDependencies": {
  27715. "brfs": "^1.4.3",
  27716. "coveralls": "^2.11.3",
  27717. "grunt": "^0.4.5",
  27718. "grunt-browserify": "^5.0.0",
  27719. "grunt-contrib-connect": "^1.0.0",
  27720. "grunt-contrib-copy": "^1.0.0",
  27721. "grunt-contrib-uglify": "^1.0.1",
  27722. "grunt-mocha-istanbul": "^3.0.1",
  27723. "grunt-saucelabs": "^8.6.2",
  27724. "istanbul": "^0.4.2",
  27725. "jscs": "^2.9.0",
  27726. "jshint": "^2.6.0",
  27727. "mocha": "^2.1.0"
  27728. },
  27729. "directories": {},
  27730. "dist": {
  27731. "shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48",
  27732. "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz"
  27733. },
  27734. "files": [
  27735. "lib"
  27736. ],
  27737. "gitHead": "cbace4683a4a548dc0306ef36756151a20299cd5",
  27738. "homepage": "https://github.com/indutny/elliptic",
  27739. "keywords": [
  27740. "EC",
  27741. "Elliptic",
  27742. "curve",
  27743. "Cryptography"
  27744. ],
  27745. "license": "MIT",
  27746. "main": "lib/elliptic.js",
  27747. "maintainers": [
  27748. {
  27749. "name": "indutny",
  27750. "email": "fedor@indutny.com"
  27751. }
  27752. ],
  27753. "name": "elliptic",
  27754. "optionalDependencies": {},
  27755. "readme": "ERROR: No README data found!",
  27756. "repository": {
  27757. "type": "git",
  27758. "url": "git+ssh://git@github.com/indutny/elliptic.git"
  27759. },
  27760. "scripts": {
  27761. "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
  27762. "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
  27763. "lint": "npm run jscs && npm run jshint",
  27764. "test": "npm run lint && npm run unit",
  27765. "unit": "istanbul test _mocha --reporter=spec test/index.js",
  27766. "version": "grunt dist && git add dist/"
  27767. },
  27768. "version": "6.3.2"
  27769. };
  27770. /***/ },
  27771. /* 257 */
  27772. /***/ function(module, exports) {
  27773. module.exports = {
  27774. "2.16.840.1.101.3.4.1.1": "aes-128-ecb",
  27775. "2.16.840.1.101.3.4.1.2": "aes-128-cbc",
  27776. "2.16.840.1.101.3.4.1.3": "aes-128-ofb",
  27777. "2.16.840.1.101.3.4.1.4": "aes-128-cfb",
  27778. "2.16.840.1.101.3.4.1.21": "aes-192-ecb",
  27779. "2.16.840.1.101.3.4.1.22": "aes-192-cbc",
  27780. "2.16.840.1.101.3.4.1.23": "aes-192-ofb",
  27781. "2.16.840.1.101.3.4.1.24": "aes-192-cfb",
  27782. "2.16.840.1.101.3.4.1.41": "aes-256-ecb",
  27783. "2.16.840.1.101.3.4.1.42": "aes-256-cbc",
  27784. "2.16.840.1.101.3.4.1.43": "aes-256-ofb",
  27785. "2.16.840.1.101.3.4.1.44": "aes-256-cfb"
  27786. };
  27787. /***/ },
  27788. /* 258 */
  27789. /***/ function(module, exports) {
  27790. /**
  27791. * The code was extracted from:
  27792. * https://github.com/davidchambers/Base64.js
  27793. */
  27794. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  27795. function InvalidCharacterError(message) {
  27796. this.message = message;
  27797. }
  27798. InvalidCharacterError.prototype = new Error();
  27799. InvalidCharacterError.prototype.name = 'InvalidCharacterError';
  27800. function polyfill (input) {
  27801. var str = String(input).replace(/=+$/, '');
  27802. if (str.length % 4 == 1) {
  27803. throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
  27804. }
  27805. for (
  27806. // initialize result and counters
  27807. var bc = 0, bs, buffer, idx = 0, output = '';
  27808. // get next character
  27809. buffer = str.charAt(idx++);
  27810. // character found in table? initialize bit storage and add its ascii value;
  27811. ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
  27812. // and if not first of each 4 characters,
  27813. // convert the first 8 bits to one ascii character
  27814. bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
  27815. ) {
  27816. // try to find character in table (0-63, not found => -1)
  27817. buffer = chars.indexOf(buffer);
  27818. }
  27819. return output;
  27820. }
  27821. module.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
  27822. /***/ },
  27823. /* 259 */
  27824. /***/ function(module, exports, __webpack_require__) {
  27825. var atob = __webpack_require__(258);
  27826. function b64DecodeUnicode(str) {
  27827. return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
  27828. var code = p.charCodeAt(0).toString(16).toUpperCase();
  27829. if (code.length < 2) {
  27830. code = '0' + code;
  27831. }
  27832. return '%' + code;
  27833. }));
  27834. }
  27835. module.exports = function(str) {
  27836. var output = str.replace(/-/g, "+").replace(/_/g, "/");
  27837. switch (output.length % 4) {
  27838. case 0:
  27839. break;
  27840. case 2:
  27841. output += "==";
  27842. break;
  27843. case 3:
  27844. output += "=";
  27845. break;
  27846. default:
  27847. throw "Illegal base64url string!";
  27848. }
  27849. try{
  27850. return b64DecodeUnicode(output);
  27851. } catch (err) {
  27852. return atob(output);
  27853. }
  27854. };
  27855. /***/ },
  27856. /* 260 */
  27857. /***/ function(module, exports, __webpack_require__) {
  27858. "use strict";
  27859. 'use strict';
  27860. var base64_url_decode = __webpack_require__(259);
  27861. module.exports = function (token,options) {
  27862. if (typeof token !== 'string') {
  27863. throw new Error('Invalid token specified');
  27864. }
  27865. options = options || {};
  27866. var pos = options.header === true ? 0 : 1;
  27867. return JSON.parse(base64_url_decode(token.split('.')[pos]));
  27868. };
  27869. /***/ },
  27870. /* 261 */
  27871. /***/ function(module, exports, __webpack_require__) {
  27872. /* WEBPACK VAR INJECTION */(function(global) {/**
  27873. * lodash (Custom Build) <https://lodash.com/>
  27874. * Build: `lodash modularize exports="npm" -o ./`
  27875. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  27876. * Released under MIT license <https://lodash.com/license>
  27877. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  27878. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  27879. */
  27880. /** Used as the `TypeError` message for "Functions" methods. */
  27881. var FUNC_ERROR_TEXT = 'Expected a function';
  27882. /** Used as references for various `Number` constants. */
  27883. var NAN = 0 / 0;
  27884. /** `Object#toString` result references. */
  27885. var symbolTag = '[object Symbol]';
  27886. /** Used to match leading and trailing whitespace. */
  27887. var reTrim = /^\s+|\s+$/g;
  27888. /** Used to detect bad signed hexadecimal string values. */
  27889. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  27890. /** Used to detect binary string values. */
  27891. var reIsBinary = /^0b[01]+$/i;
  27892. /** Used to detect octal string values. */
  27893. var reIsOctal = /^0o[0-7]+$/i;
  27894. /** Built-in method references without a dependency on `root`. */
  27895. var freeParseInt = parseInt;
  27896. /** Detect free variable `global` from Node.js. */
  27897. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  27898. /** Detect free variable `self`. */
  27899. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  27900. /** Used as a reference to the global object. */
  27901. var root = freeGlobal || freeSelf || Function('return this')();
  27902. /** Used for built-in method references. */
  27903. var objectProto = Object.prototype;
  27904. /**
  27905. * Used to resolve the
  27906. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  27907. * of values.
  27908. */
  27909. var objectToString = objectProto.toString;
  27910. /* Built-in method references for those with the same name as other `lodash` methods. */
  27911. var nativeMax = Math.max,
  27912. nativeMin = Math.min;
  27913. /**
  27914. * Gets the timestamp of the number of milliseconds that have elapsed since
  27915. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27916. *
  27917. * @static
  27918. * @memberOf _
  27919. * @since 2.4.0
  27920. * @category Date
  27921. * @returns {number} Returns the timestamp.
  27922. * @example
  27923. *
  27924. * _.defer(function(stamp) {
  27925. * console.log(_.now() - stamp);
  27926. * }, _.now());
  27927. * // => Logs the number of milliseconds it took for the deferred invocation.
  27928. */
  27929. var now = function() {
  27930. return root.Date.now();
  27931. };
  27932. /**
  27933. * Creates a debounced function that delays invoking `func` until after `wait`
  27934. * milliseconds have elapsed since the last time the debounced function was
  27935. * invoked. The debounced function comes with a `cancel` method to cancel
  27936. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27937. * Provide `options` to indicate whether `func` should be invoked on the
  27938. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27939. * with the last arguments provided to the debounced function. Subsequent
  27940. * calls to the debounced function return the result of the last `func`
  27941. * invocation.
  27942. *
  27943. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27944. * invoked on the trailing edge of the timeout only if the debounced function
  27945. * is invoked more than once during the `wait` timeout.
  27946. *
  27947. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27948. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27949. *
  27950. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27951. * for details over the differences between `_.debounce` and `_.throttle`.
  27952. *
  27953. * @static
  27954. * @memberOf _
  27955. * @since 0.1.0
  27956. * @category Function
  27957. * @param {Function} func The function to debounce.
  27958. * @param {number} [wait=0] The number of milliseconds to delay.
  27959. * @param {Object} [options={}] The options object.
  27960. * @param {boolean} [options.leading=false]
  27961. * Specify invoking on the leading edge of the timeout.
  27962. * @param {number} [options.maxWait]
  27963. * The maximum time `func` is allowed to be delayed before it's invoked.
  27964. * @param {boolean} [options.trailing=true]
  27965. * Specify invoking on the trailing edge of the timeout.
  27966. * @returns {Function} Returns the new debounced function.
  27967. * @example
  27968. *
  27969. * // Avoid costly calculations while the window size is in flux.
  27970. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27971. *
  27972. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27973. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27974. * 'leading': true,
  27975. * 'trailing': false
  27976. * }));
  27977. *
  27978. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27979. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27980. * var source = new EventSource('/stream');
  27981. * jQuery(source).on('message', debounced);
  27982. *
  27983. * // Cancel the trailing debounced invocation.
  27984. * jQuery(window).on('popstate', debounced.cancel);
  27985. */
  27986. function debounce(func, wait, options) {
  27987. var lastArgs,
  27988. lastThis,
  27989. maxWait,
  27990. result,
  27991. timerId,
  27992. lastCallTime,
  27993. lastInvokeTime = 0,
  27994. leading = false,
  27995. maxing = false,
  27996. trailing = true;
  27997. if (typeof func != 'function') {
  27998. throw new TypeError(FUNC_ERROR_TEXT);
  27999. }
  28000. wait = toNumber(wait) || 0;
  28001. if (isObject(options)) {
  28002. leading = !!options.leading;
  28003. maxing = 'maxWait' in options;
  28004. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28005. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28006. }
  28007. function invokeFunc(time) {
  28008. var args = lastArgs,
  28009. thisArg = lastThis;
  28010. lastArgs = lastThis = undefined;
  28011. lastInvokeTime = time;
  28012. result = func.apply(thisArg, args);
  28013. return result;
  28014. }
  28015. function leadingEdge(time) {
  28016. // Reset any `maxWait` timer.
  28017. lastInvokeTime = time;
  28018. // Start the timer for the trailing edge.
  28019. timerId = setTimeout(timerExpired, wait);
  28020. // Invoke the leading edge.
  28021. return leading ? invokeFunc(time) : result;
  28022. }
  28023. function remainingWait(time) {
  28024. var timeSinceLastCall = time - lastCallTime,
  28025. timeSinceLastInvoke = time - lastInvokeTime,
  28026. result = wait - timeSinceLastCall;
  28027. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  28028. }
  28029. function shouldInvoke(time) {
  28030. var timeSinceLastCall = time - lastCallTime,
  28031. timeSinceLastInvoke = time - lastInvokeTime;
  28032. // Either this is the first call, activity has stopped and we're at the
  28033. // trailing edge, the system time has gone backwards and we're treating
  28034. // it as the trailing edge, or we've hit the `maxWait` limit.
  28035. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28036. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28037. }
  28038. function timerExpired() {
  28039. var time = now();
  28040. if (shouldInvoke(time)) {
  28041. return trailingEdge(time);
  28042. }
  28043. // Restart the timer.
  28044. timerId = setTimeout(timerExpired, remainingWait(time));
  28045. }
  28046. function trailingEdge(time) {
  28047. timerId = undefined;
  28048. // Only invoke if we have `lastArgs` which means `func` has been
  28049. // debounced at least once.
  28050. if (trailing && lastArgs) {
  28051. return invokeFunc(time);
  28052. }
  28053. lastArgs = lastThis = undefined;
  28054. return result;
  28055. }
  28056. function cancel() {
  28057. if (timerId !== undefined) {
  28058. clearTimeout(timerId);
  28059. }
  28060. lastInvokeTime = 0;
  28061. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28062. }
  28063. function flush() {
  28064. return timerId === undefined ? result : trailingEdge(now());
  28065. }
  28066. function debounced() {
  28067. var time = now(),
  28068. isInvoking = shouldInvoke(time);
  28069. lastArgs = arguments;
  28070. lastThis = this;
  28071. lastCallTime = time;
  28072. if (isInvoking) {
  28073. if (timerId === undefined) {
  28074. return leadingEdge(lastCallTime);
  28075. }
  28076. if (maxing) {
  28077. // Handle invocations in a tight loop.
  28078. timerId = setTimeout(timerExpired, wait);
  28079. return invokeFunc(lastCallTime);
  28080. }
  28081. }
  28082. if (timerId === undefined) {
  28083. timerId = setTimeout(timerExpired, wait);
  28084. }
  28085. return result;
  28086. }
  28087. debounced.cancel = cancel;
  28088. debounced.flush = flush;
  28089. return debounced;
  28090. }
  28091. /**
  28092. * Checks if `value` is the
  28093. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28094. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28095. *
  28096. * @static
  28097. * @memberOf _
  28098. * @since 0.1.0
  28099. * @category Lang
  28100. * @param {*} value The value to check.
  28101. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28102. * @example
  28103. *
  28104. * _.isObject({});
  28105. * // => true
  28106. *
  28107. * _.isObject([1, 2, 3]);
  28108. * // => true
  28109. *
  28110. * _.isObject(_.noop);
  28111. * // => true
  28112. *
  28113. * _.isObject(null);
  28114. * // => false
  28115. */
  28116. function isObject(value) {
  28117. var type = typeof value;
  28118. return !!value && (type == 'object' || type == 'function');
  28119. }
  28120. /**
  28121. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28122. * and has a `typeof` result of "object".
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 4.0.0
  28127. * @category Lang
  28128. * @param {*} value The value to check.
  28129. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28130. * @example
  28131. *
  28132. * _.isObjectLike({});
  28133. * // => true
  28134. *
  28135. * _.isObjectLike([1, 2, 3]);
  28136. * // => true
  28137. *
  28138. * _.isObjectLike(_.noop);
  28139. * // => false
  28140. *
  28141. * _.isObjectLike(null);
  28142. * // => false
  28143. */
  28144. function isObjectLike(value) {
  28145. return !!value && typeof value == 'object';
  28146. }
  28147. /**
  28148. * Checks if `value` is classified as a `Symbol` primitive or object.
  28149. *
  28150. * @static
  28151. * @memberOf _
  28152. * @since 4.0.0
  28153. * @category Lang
  28154. * @param {*} value The value to check.
  28155. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  28156. * @example
  28157. *
  28158. * _.isSymbol(Symbol.iterator);
  28159. * // => true
  28160. *
  28161. * _.isSymbol('abc');
  28162. * // => false
  28163. */
  28164. function isSymbol(value) {
  28165. return typeof value == 'symbol' ||
  28166. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  28167. }
  28168. /**
  28169. * Converts `value` to a number.
  28170. *
  28171. * @static
  28172. * @memberOf _
  28173. * @since 4.0.0
  28174. * @category Lang
  28175. * @param {*} value The value to process.
  28176. * @returns {number} Returns the number.
  28177. * @example
  28178. *
  28179. * _.toNumber(3.2);
  28180. * // => 3.2
  28181. *
  28182. * _.toNumber(Number.MIN_VALUE);
  28183. * // => 5e-324
  28184. *
  28185. * _.toNumber(Infinity);
  28186. * // => Infinity
  28187. *
  28188. * _.toNumber('3.2');
  28189. * // => 3.2
  28190. */
  28191. function toNumber(value) {
  28192. if (typeof value == 'number') {
  28193. return value;
  28194. }
  28195. if (isSymbol(value)) {
  28196. return NAN;
  28197. }
  28198. if (isObject(value)) {
  28199. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  28200. value = isObject(other) ? (other + '') : other;
  28201. }
  28202. if (typeof value != 'string') {
  28203. return value === 0 ? value : +value;
  28204. }
  28205. value = value.replace(reTrim, '');
  28206. var isBinary = reIsBinary.test(value);
  28207. return (isBinary || reIsOctal.test(value))
  28208. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  28209. : (reIsBadHex.test(value) ? NAN : +value);
  28210. }
  28211. module.exports = debounce;
  28212. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  28213. /***/ },
  28214. /* 262 */
  28215. /***/ function(module, exports, __webpack_require__) {
  28216. // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
  28217. // Fedor, you are amazing.
  28218. var asn1 = __webpack_require__(33)
  28219. var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
  28220. this.seq().obj(
  28221. this.key('version').int(),
  28222. this.key('modulus').int(),
  28223. this.key('publicExponent').int(),
  28224. this.key('privateExponent').int(),
  28225. this.key('prime1').int(),
  28226. this.key('prime2').int(),
  28227. this.key('exponent1').int(),
  28228. this.key('exponent2').int(),
  28229. this.key('coefficient').int()
  28230. )
  28231. })
  28232. exports.RSAPrivateKey = RSAPrivateKey
  28233. var RSAPublicKey = asn1.define('RSAPublicKey', function () {
  28234. this.seq().obj(
  28235. this.key('modulus').int(),
  28236. this.key('publicExponent').int()
  28237. )
  28238. })
  28239. exports.RSAPublicKey = RSAPublicKey
  28240. var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
  28241. this.seq().obj(
  28242. this.key('algorithm').use(AlgorithmIdentifier),
  28243. this.key('subjectPublicKey').bitstr()
  28244. )
  28245. })
  28246. exports.PublicKey = PublicKey
  28247. var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
  28248. this.seq().obj(
  28249. this.key('algorithm').objid(),
  28250. this.key('none').null_().optional(),
  28251. this.key('curve').objid().optional(),
  28252. this.key('params').seq().obj(
  28253. this.key('p').int(),
  28254. this.key('q').int(),
  28255. this.key('g').int()
  28256. ).optional()
  28257. )
  28258. })
  28259. var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
  28260. this.seq().obj(
  28261. this.key('version').int(),
  28262. this.key('algorithm').use(AlgorithmIdentifier),
  28263. this.key('subjectPrivateKey').octstr()
  28264. )
  28265. })
  28266. exports.PrivateKey = PrivateKeyInfo
  28267. var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
  28268. this.seq().obj(
  28269. this.key('algorithm').seq().obj(
  28270. this.key('id').objid(),
  28271. this.key('decrypt').seq().obj(
  28272. this.key('kde').seq().obj(
  28273. this.key('id').objid(),
  28274. this.key('kdeparams').seq().obj(
  28275. this.key('salt').octstr(),
  28276. this.key('iters').int()
  28277. )
  28278. ),
  28279. this.key('cipher').seq().obj(
  28280. this.key('algo').objid(),
  28281. this.key('iv').octstr()
  28282. )
  28283. )
  28284. ),
  28285. this.key('subjectPrivateKey').octstr()
  28286. )
  28287. })
  28288. exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
  28289. var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
  28290. this.seq().obj(
  28291. this.key('version').int(),
  28292. this.key('p').int(),
  28293. this.key('q').int(),
  28294. this.key('g').int(),
  28295. this.key('pub_key').int(),
  28296. this.key('priv_key').int()
  28297. )
  28298. })
  28299. exports.DSAPrivateKey = DSAPrivateKey
  28300. exports.DSAparam = asn1.define('DSAparam', function () {
  28301. this.int()
  28302. })
  28303. var ECPrivateKey = asn1.define('ECPrivateKey', function () {
  28304. this.seq().obj(
  28305. this.key('version').int(),
  28306. this.key('privateKey').octstr(),
  28307. this.key('parameters').optional().explicit(0).use(ECParameters),
  28308. this.key('publicKey').optional().explicit(1).bitstr()
  28309. )
  28310. })
  28311. exports.ECPrivateKey = ECPrivateKey
  28312. var ECParameters = asn1.define('ECParameters', function () {
  28313. this.choice({
  28314. namedCurve: this.objid()
  28315. })
  28316. })
  28317. exports.signature = asn1.define('signature', function () {
  28318. this.seq().obj(
  28319. this.key('r').int(),
  28320. this.key('s').int()
  28321. )
  28322. })
  28323. /***/ },
  28324. /* 263 */
  28325. /***/ function(module, exports, __webpack_require__) {
  28326. /* WEBPACK VAR INJECTION */(function(Buffer) {// adapted from https://github.com/apatil/pemstrip
  28327. var findProc = /Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m
  28328. var startRegex = /^-----BEGIN (.*) KEY-----\r?\n/m
  28329. var fullRegex = /^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m
  28330. var evp = __webpack_require__(45)
  28331. var ciphers = __webpack_require__(49)
  28332. module.exports = function (okey, password) {
  28333. var key = okey.toString()
  28334. var match = key.match(findProc)
  28335. var decrypted
  28336. if (!match) {
  28337. var match2 = key.match(fullRegex)
  28338. decrypted = new Buffer(match2[2].replace(/\r?\n/g, ''), 'base64')
  28339. } else {
  28340. var suite = 'aes' + match[1]
  28341. var iv = new Buffer(match[2], 'hex')
  28342. var cipherText = new Buffer(match[3].replace(/\r?\n/g, ''), 'base64')
  28343. var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
  28344. var out = []
  28345. var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
  28346. out.push(cipher.update(cipherText))
  28347. out.push(cipher.final())
  28348. decrypted = Buffer.concat(out)
  28349. }
  28350. var tag = key.match(startRegex)[1] + ' KEY'
  28351. return {
  28352. tag: tag,
  28353. data: decrypted
  28354. }
  28355. }
  28356. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28357. /***/ },
  28358. /* 264 */
  28359. /***/ function(module, exports) {
  28360. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  28361. module.exports = function (iterations, keylen) {
  28362. if (typeof iterations !== 'number') {
  28363. throw new TypeError('Iterations not a number')
  28364. }
  28365. if (iterations < 0) {
  28366. throw new TypeError('Bad iterations')
  28367. }
  28368. if (typeof keylen !== 'number') {
  28369. throw new TypeError('Key length not a number')
  28370. }
  28371. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  28372. throw new TypeError('Bad key length')
  28373. }
  28374. }
  28375. /***/ },
  28376. /* 265 */
  28377. /***/ function(module, exports, __webpack_require__) {
  28378. exports.publicEncrypt = __webpack_require__(267);
  28379. exports.privateDecrypt = __webpack_require__(266);
  28380. exports.privateEncrypt = function privateEncrypt(key, buf) {
  28381. return exports.publicEncrypt(key, buf, true);
  28382. };
  28383. exports.publicDecrypt = function publicDecrypt(key, buf) {
  28384. return exports.privateDecrypt(key, buf, true);
  28385. };
  28386. /***/ },
  28387. /* 266 */
  28388. /***/ function(module, exports, __webpack_require__) {
  28389. /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
  28390. var mgf = __webpack_require__(111);
  28391. var xor = __webpack_require__(113);
  28392. var bn = __webpack_require__(2);
  28393. var crt = __webpack_require__(50);
  28394. var createHash = __webpack_require__(16);
  28395. var withPublic = __webpack_require__(112);
  28396. module.exports = function privateDecrypt(private_key, enc, reverse) {
  28397. var padding;
  28398. if (private_key.padding) {
  28399. padding = private_key.padding;
  28400. } else if (reverse) {
  28401. padding = 1;
  28402. } else {
  28403. padding = 4;
  28404. }
  28405. var key = parseKeys(private_key);
  28406. var k = key.modulus.byteLength();
  28407. if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
  28408. throw new Error('decryption error');
  28409. }
  28410. var msg;
  28411. if (reverse) {
  28412. msg = withPublic(new bn(enc), key);
  28413. } else {
  28414. msg = crt(enc, key);
  28415. }
  28416. var zBuffer = new Buffer(k - msg.length);
  28417. zBuffer.fill(0);
  28418. msg = Buffer.concat([zBuffer, msg], k);
  28419. if (padding === 4) {
  28420. return oaep(key, msg);
  28421. } else if (padding === 1) {
  28422. return pkcs1(key, msg, reverse);
  28423. } else if (padding === 3) {
  28424. return msg;
  28425. } else {
  28426. throw new Error('unknown padding');
  28427. }
  28428. };
  28429. function oaep(key, msg){
  28430. var n = key.modulus;
  28431. var k = key.modulus.byteLength();
  28432. var mLen = msg.length;
  28433. var iHash = createHash('sha1').update(new Buffer('')).digest();
  28434. var hLen = iHash.length;
  28435. var hLen2 = 2 * hLen;
  28436. if (msg[0] !== 0) {
  28437. throw new Error('decryption error');
  28438. }
  28439. var maskedSeed = msg.slice(1, hLen + 1);
  28440. var maskedDb = msg.slice(hLen + 1);
  28441. var seed = xor(maskedSeed, mgf(maskedDb, hLen));
  28442. var db = xor(maskedDb, mgf(seed, k - hLen - 1));
  28443. if (compare(iHash, db.slice(0, hLen))) {
  28444. throw new Error('decryption error');
  28445. }
  28446. var i = hLen;
  28447. while (db[i] === 0) {
  28448. i++;
  28449. }
  28450. if (db[i++] !== 1) {
  28451. throw new Error('decryption error');
  28452. }
  28453. return db.slice(i);
  28454. }
  28455. function pkcs1(key, msg, reverse){
  28456. var p1 = msg.slice(0, 2);
  28457. var i = 2;
  28458. var status = 0;
  28459. while (msg[i++] !== 0) {
  28460. if (i >= msg.length) {
  28461. status++;
  28462. break;
  28463. }
  28464. }
  28465. var ps = msg.slice(2, i - 1);
  28466. var p2 = msg.slice(i - 1, i);
  28467. if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){
  28468. status++;
  28469. }
  28470. if (ps.length < 8) {
  28471. status++;
  28472. }
  28473. if (status) {
  28474. throw new Error('decryption error');
  28475. }
  28476. return msg.slice(i);
  28477. }
  28478. function compare(a, b){
  28479. a = new Buffer(a);
  28480. b = new Buffer(b);
  28481. var dif = 0;
  28482. var len = a.length;
  28483. if (a.length !== b.length) {
  28484. dif++;
  28485. len = Math.min(a.length, b.length);
  28486. }
  28487. var i = -1;
  28488. while (++i < len) {
  28489. dif += (a[i] ^ b[i]);
  28490. }
  28491. return dif;
  28492. }
  28493. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28494. /***/ },
  28495. /* 267 */
  28496. /***/ function(module, exports, __webpack_require__) {
  28497. /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
  28498. var randomBytes = __webpack_require__(31);
  28499. var createHash = __webpack_require__(16);
  28500. var mgf = __webpack_require__(111);
  28501. var xor = __webpack_require__(113);
  28502. var bn = __webpack_require__(2);
  28503. var withPublic = __webpack_require__(112);
  28504. var crt = __webpack_require__(50);
  28505. var constants = {
  28506. RSA_PKCS1_OAEP_PADDING: 4,
  28507. RSA_PKCS1_PADDIN: 1,
  28508. RSA_NO_PADDING: 3
  28509. };
  28510. module.exports = function publicEncrypt(public_key, msg, reverse) {
  28511. var padding;
  28512. if (public_key.padding) {
  28513. padding = public_key.padding;
  28514. } else if (reverse) {
  28515. padding = 1;
  28516. } else {
  28517. padding = 4;
  28518. }
  28519. var key = parseKeys(public_key);
  28520. var paddedMsg;
  28521. if (padding === 4) {
  28522. paddedMsg = oaep(key, msg);
  28523. } else if (padding === 1) {
  28524. paddedMsg = pkcs1(key, msg, reverse);
  28525. } else if (padding === 3) {
  28526. paddedMsg = new bn(msg);
  28527. if (paddedMsg.cmp(key.modulus) >= 0) {
  28528. throw new Error('data too long for modulus');
  28529. }
  28530. } else {
  28531. throw new Error('unknown padding');
  28532. }
  28533. if (reverse) {
  28534. return crt(paddedMsg, key);
  28535. } else {
  28536. return withPublic(paddedMsg, key);
  28537. }
  28538. };
  28539. function oaep(key, msg){
  28540. var k = key.modulus.byteLength();
  28541. var mLen = msg.length;
  28542. var iHash = createHash('sha1').update(new Buffer('')).digest();
  28543. var hLen = iHash.length;
  28544. var hLen2 = 2 * hLen;
  28545. if (mLen > k - hLen2 - 2) {
  28546. throw new Error('message too long');
  28547. }
  28548. var ps = new Buffer(k - mLen - hLen2 - 2);
  28549. ps.fill(0);
  28550. var dblen = k - hLen - 1;
  28551. var seed = randomBytes(hLen);
  28552. var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen));
  28553. var maskedSeed = xor(seed, mgf(maskedDb, hLen));
  28554. return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k));
  28555. }
  28556. function pkcs1(key, msg, reverse){
  28557. var mLen = msg.length;
  28558. var k = key.modulus.byteLength();
  28559. if (mLen > k - 11) {
  28560. throw new Error('message too long');
  28561. }
  28562. var ps;
  28563. if (reverse) {
  28564. ps = new Buffer(k - mLen - 3);
  28565. ps.fill(0xff);
  28566. } else {
  28567. ps = nonZero(k - mLen - 3);
  28568. }
  28569. return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k));
  28570. }
  28571. function nonZero(len, crypto) {
  28572. var out = new Buffer(len);
  28573. var i = 0;
  28574. var cache = randomBytes(len*2);
  28575. var cur = 0;
  28576. var num;
  28577. while (i < len) {
  28578. if (cur === cache.length) {
  28579. cache = randomBytes(len*2);
  28580. cur = 0;
  28581. }
  28582. num = cache[cur++];
  28583. if (num) {
  28584. out[i++] = num;
  28585. }
  28586. }
  28587. return out;
  28588. }
  28589. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28590. /***/ },
  28591. /* 268 */
  28592. /***/ function(module, exports, __webpack_require__) {
  28593. module.exports = __webpack_require__(10)
  28594. /***/ },
  28595. /* 269 */
  28596. /***/ function(module, exports, __webpack_require__) {
  28597. "use strict";
  28598. 'use strict';
  28599. var Buffer = __webpack_require__(0).Buffer;
  28600. /*<replacement>*/
  28601. var bufferShim = __webpack_require__(51);
  28602. /*</replacement>*/
  28603. module.exports = BufferList;
  28604. function BufferList() {
  28605. this.head = null;
  28606. this.tail = null;
  28607. this.length = 0;
  28608. }
  28609. BufferList.prototype.push = function (v) {
  28610. var entry = { data: v, next: null };
  28611. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  28612. this.tail = entry;
  28613. ++this.length;
  28614. };
  28615. BufferList.prototype.unshift = function (v) {
  28616. var entry = { data: v, next: this.head };
  28617. if (this.length === 0) this.tail = entry;
  28618. this.head = entry;
  28619. ++this.length;
  28620. };
  28621. BufferList.prototype.shift = function () {
  28622. if (this.length === 0) return;
  28623. var ret = this.head.data;
  28624. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  28625. --this.length;
  28626. return ret;
  28627. };
  28628. BufferList.prototype.clear = function () {
  28629. this.head = this.tail = null;
  28630. this.length = 0;
  28631. };
  28632. BufferList.prototype.join = function (s) {
  28633. if (this.length === 0) return '';
  28634. var p = this.head;
  28635. var ret = '' + p.data;
  28636. while (p = p.next) {
  28637. ret += s + p.data;
  28638. }return ret;
  28639. };
  28640. BufferList.prototype.concat = function (n) {
  28641. if (this.length === 0) return bufferShim.alloc(0);
  28642. if (this.length === 1) return this.head.data;
  28643. var ret = bufferShim.allocUnsafe(n >>> 0);
  28644. var p = this.head;
  28645. var i = 0;
  28646. while (p) {
  28647. p.data.copy(ret, i);
  28648. i += p.data.length;
  28649. p = p.next;
  28650. }
  28651. return ret;
  28652. };
  28653. /***/ },
  28654. /* 270 */
  28655. /***/ function(module, exports, __webpack_require__) {
  28656. module.exports = __webpack_require__(114)
  28657. /***/ },
  28658. /* 271 */
  28659. /***/ function(module, exports, __webpack_require__) {
  28660. /* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){
  28661. try {
  28662. return __webpack_require__(19); // hack to fix a circular dependency issue when used with browserify
  28663. } catch(_){}
  28664. }());
  28665. exports = module.exports = __webpack_require__(115);
  28666. exports.Stream = Stream || exports;
  28667. exports.Readable = exports;
  28668. exports.Writable = __webpack_require__(64);
  28669. exports.Duplex = __webpack_require__(10);
  28670. exports.Transform = __webpack_require__(63);
  28671. exports.PassThrough = __webpack_require__(114);
  28672. if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
  28673. module.exports = Stream;
  28674. }
  28675. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  28676. /***/ },
  28677. /* 272 */
  28678. /***/ function(module, exports, __webpack_require__) {
  28679. module.exports = __webpack_require__(63)
  28680. /***/ },
  28681. /* 273 */
  28682. /***/ function(module, exports, __webpack_require__) {
  28683. module.exports = __webpack_require__(64)
  28684. /***/ },
  28685. /* 274 */
  28686. /***/ function(module, exports, __webpack_require__) {
  28687. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28688. CryptoJS v3.1.2
  28689. code.google.com/p/crypto-js
  28690. (c) 2009-2013 by Jeff Mott. All rights reserved.
  28691. code.google.com/p/crypto-js/wiki/License
  28692. */
  28693. /** @preserve
  28694. (c) 2012 by Cédric Mesnil. All rights reserved.
  28695. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  28696. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  28697. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  28698. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28699. */
  28700. // constants table
  28701. var zl = [
  28702. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  28703. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  28704. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  28705. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  28706. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  28707. ]
  28708. var zr = [
  28709. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  28710. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  28711. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  28712. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  28713. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  28714. ]
  28715. var sl = [
  28716. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  28717. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  28718. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  28719. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  28720. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  28721. ]
  28722. var sr = [
  28723. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  28724. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  28725. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  28726. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  28727. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  28728. ]
  28729. var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
  28730. var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
  28731. function bytesToWords (bytes) {
  28732. var words = []
  28733. for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
  28734. words[b >>> 5] |= bytes[i] << (24 - b % 32)
  28735. }
  28736. return words
  28737. }
  28738. function wordsToBytes (words) {
  28739. var bytes = []
  28740. for (var b = 0; b < words.length * 32; b += 8) {
  28741. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
  28742. }
  28743. return bytes
  28744. }
  28745. function processBlock (H, M, offset) {
  28746. // swap endian
  28747. for (var i = 0; i < 16; i++) {
  28748. var offset_i = offset + i
  28749. var M_offset_i = M[offset_i]
  28750. // Swap
  28751. M[offset_i] = (
  28752. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  28753. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  28754. )
  28755. }
  28756. // Working variables
  28757. var al, bl, cl, dl, el
  28758. var ar, br, cr, dr, er
  28759. ar = al = H[0]
  28760. br = bl = H[1]
  28761. cr = cl = H[2]
  28762. dr = dl = H[3]
  28763. er = el = H[4]
  28764. // computation
  28765. var t
  28766. for (i = 0; i < 80; i += 1) {
  28767. t = (al + M[offset + zl[i]]) | 0
  28768. if (i < 16) {
  28769. t += f1(bl, cl, dl) + hl[0]
  28770. } else if (i < 32) {
  28771. t += f2(bl, cl, dl) + hl[1]
  28772. } else if (i < 48) {
  28773. t += f3(bl, cl, dl) + hl[2]
  28774. } else if (i < 64) {
  28775. t += f4(bl, cl, dl) + hl[3]
  28776. } else {// if (i<80) {
  28777. t += f5(bl, cl, dl) + hl[4]
  28778. }
  28779. t = t | 0
  28780. t = rotl(t, sl[i])
  28781. t = (t + el) | 0
  28782. al = el
  28783. el = dl
  28784. dl = rotl(cl, 10)
  28785. cl = bl
  28786. bl = t
  28787. t = (ar + M[offset + zr[i]]) | 0
  28788. if (i < 16) {
  28789. t += f5(br, cr, dr) + hr[0]
  28790. } else if (i < 32) {
  28791. t += f4(br, cr, dr) + hr[1]
  28792. } else if (i < 48) {
  28793. t += f3(br, cr, dr) + hr[2]
  28794. } else if (i < 64) {
  28795. t += f2(br, cr, dr) + hr[3]
  28796. } else {// if (i<80) {
  28797. t += f1(br, cr, dr) + hr[4]
  28798. }
  28799. t = t | 0
  28800. t = rotl(t, sr[i])
  28801. t = (t + er) | 0
  28802. ar = er
  28803. er = dr
  28804. dr = rotl(cr, 10)
  28805. cr = br
  28806. br = t
  28807. }
  28808. // intermediate hash value
  28809. t = (H[1] + cl + dr) | 0
  28810. H[1] = (H[2] + dl + er) | 0
  28811. H[2] = (H[3] + el + ar) | 0
  28812. H[3] = (H[4] + al + br) | 0
  28813. H[4] = (H[0] + bl + cr) | 0
  28814. H[0] = t
  28815. }
  28816. function f1 (x, y, z) {
  28817. return ((x) ^ (y) ^ (z))
  28818. }
  28819. function f2 (x, y, z) {
  28820. return (((x) & (y)) | ((~x) & (z)))
  28821. }
  28822. function f3 (x, y, z) {
  28823. return (((x) | (~(y))) ^ (z))
  28824. }
  28825. function f4 (x, y, z) {
  28826. return (((x) & (z)) | ((y) & (~(z))))
  28827. }
  28828. function f5 (x, y, z) {
  28829. return ((x) ^ ((y) | (~(z))))
  28830. }
  28831. function rotl (x, n) {
  28832. return (x << n) | (x >>> (32 - n))
  28833. }
  28834. function ripemd160 (message) {
  28835. var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
  28836. if (typeof message === 'string') {
  28837. message = new Buffer(message, 'utf8')
  28838. }
  28839. var m = bytesToWords(message)
  28840. var nBitsLeft = message.length * 8
  28841. var nBitsTotal = message.length * 8
  28842. // Add padding
  28843. m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
  28844. m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  28845. (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
  28846. (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
  28847. )
  28848. for (var i = 0; i < m.length; i += 16) {
  28849. processBlock(H, m, i)
  28850. }
  28851. // swap endian
  28852. for (i = 0; i < 5; i++) {
  28853. // shortcut
  28854. var H_i = H[i]
  28855. // Swap
  28856. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  28857. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
  28858. }
  28859. var digestbytes = wordsToBytes(H)
  28860. return new Buffer(digestbytes)
  28861. }
  28862. module.exports = ripemd160
  28863. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28864. /***/ },
  28865. /* 275 */
  28866. /***/ function(module, exports) {
  28867. function select(element) {
  28868. var selectedText;
  28869. if (element.nodeName === 'SELECT') {
  28870. element.focus();
  28871. selectedText = element.value;
  28872. }
  28873. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  28874. element.focus();
  28875. element.setSelectionRange(0, element.value.length);
  28876. selectedText = element.value;
  28877. }
  28878. else {
  28879. if (element.hasAttribute('contenteditable')) {
  28880. element.focus();
  28881. }
  28882. var selection = window.getSelection();
  28883. var range = document.createRange();
  28884. range.selectNodeContents(element);
  28885. selection.removeAllRanges();
  28886. selection.addRange(range);
  28887. selectedText = selection.toString();
  28888. }
  28889. return selectedText;
  28890. }
  28891. module.exports = select;
  28892. /***/ },
  28893. /* 276 */
  28894. /***/ function(module, exports, __webpack_require__) {
  28895. var exports = module.exports = function SHA (algorithm) {
  28896. algorithm = algorithm.toLowerCase()
  28897. var Algorithm = exports[algorithm]
  28898. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  28899. return new Algorithm()
  28900. }
  28901. exports.sha = __webpack_require__(277)
  28902. exports.sha1 = __webpack_require__(278)
  28903. exports.sha224 = __webpack_require__(279)
  28904. exports.sha256 = __webpack_require__(116)
  28905. exports.sha384 = __webpack_require__(280)
  28906. exports.sha512 = __webpack_require__(117)
  28907. /***/ },
  28908. /* 277 */
  28909. /***/ function(module, exports, __webpack_require__) {
  28910. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28911. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  28912. * in FIPS PUB 180-1
  28913. * This source code is derived from sha1.js of the same repository.
  28914. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  28915. * operation was added.
  28916. */
  28917. var inherits = __webpack_require__(1)
  28918. var Hash = __webpack_require__(18)
  28919. var K = [
  28920. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  28921. ]
  28922. var W = new Array(80)
  28923. function Sha () {
  28924. this.init()
  28925. this._w = W
  28926. Hash.call(this, 64, 56)
  28927. }
  28928. inherits(Sha, Hash)
  28929. Sha.prototype.init = function () {
  28930. this._a = 0x67452301
  28931. this._b = 0xefcdab89
  28932. this._c = 0x98badcfe
  28933. this._d = 0x10325476
  28934. this._e = 0xc3d2e1f0
  28935. return this
  28936. }
  28937. function rotl5 (num) {
  28938. return (num << 5) | (num >>> 27)
  28939. }
  28940. function rotl30 (num) {
  28941. return (num << 30) | (num >>> 2)
  28942. }
  28943. function ft (s, b, c, d) {
  28944. if (s === 0) return (b & c) | ((~b) & d)
  28945. if (s === 2) return (b & c) | (b & d) | (c & d)
  28946. return b ^ c ^ d
  28947. }
  28948. Sha.prototype._update = function (M) {
  28949. var W = this._w
  28950. var a = this._a | 0
  28951. var b = this._b | 0
  28952. var c = this._c | 0
  28953. var d = this._d | 0
  28954. var e = this._e | 0
  28955. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  28956. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  28957. for (var j = 0; j < 80; ++j) {
  28958. var s = ~~(j / 20)
  28959. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  28960. e = d
  28961. d = c
  28962. c = rotl30(b)
  28963. b = a
  28964. a = t
  28965. }
  28966. this._a = (a + this._a) | 0
  28967. this._b = (b + this._b) | 0
  28968. this._c = (c + this._c) | 0
  28969. this._d = (d + this._d) | 0
  28970. this._e = (e + this._e) | 0
  28971. }
  28972. Sha.prototype._hash = function () {
  28973. var H = new Buffer(20)
  28974. H.writeInt32BE(this._a | 0, 0)
  28975. H.writeInt32BE(this._b | 0, 4)
  28976. H.writeInt32BE(this._c | 0, 8)
  28977. H.writeInt32BE(this._d | 0, 12)
  28978. H.writeInt32BE(this._e | 0, 16)
  28979. return H
  28980. }
  28981. module.exports = Sha
  28982. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28983. /***/ },
  28984. /* 278 */
  28985. /***/ function(module, exports, __webpack_require__) {
  28986. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28987. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  28988. * in FIPS PUB 180-1
  28989. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  28990. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  28991. * Distributed under the BSD License
  28992. * See http://pajhome.org.uk/crypt/md5 for details.
  28993. */
  28994. var inherits = __webpack_require__(1)
  28995. var Hash = __webpack_require__(18)
  28996. var K = [
  28997. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  28998. ]
  28999. var W = new Array(80)
  29000. function Sha1 () {
  29001. this.init()
  29002. this._w = W
  29003. Hash.call(this, 64, 56)
  29004. }
  29005. inherits(Sha1, Hash)
  29006. Sha1.prototype.init = function () {
  29007. this._a = 0x67452301
  29008. this._b = 0xefcdab89
  29009. this._c = 0x98badcfe
  29010. this._d = 0x10325476
  29011. this._e = 0xc3d2e1f0
  29012. return this
  29013. }
  29014. function rotl1 (num) {
  29015. return (num << 1) | (num >>> 31)
  29016. }
  29017. function rotl5 (num) {
  29018. return (num << 5) | (num >>> 27)
  29019. }
  29020. function rotl30 (num) {
  29021. return (num << 30) | (num >>> 2)
  29022. }
  29023. function ft (s, b, c, d) {
  29024. if (s === 0) return (b & c) | ((~b) & d)
  29025. if (s === 2) return (b & c) | (b & d) | (c & d)
  29026. return b ^ c ^ d
  29027. }
  29028. Sha1.prototype._update = function (M) {
  29029. var W = this._w
  29030. var a = this._a | 0
  29031. var b = this._b | 0
  29032. var c = this._c | 0
  29033. var d = this._d | 0
  29034. var e = this._e | 0
  29035. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  29036. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  29037. for (var j = 0; j < 80; ++j) {
  29038. var s = ~~(j / 20)
  29039. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  29040. e = d
  29041. d = c
  29042. c = rotl30(b)
  29043. b = a
  29044. a = t
  29045. }
  29046. this._a = (a + this._a) | 0
  29047. this._b = (b + this._b) | 0
  29048. this._c = (c + this._c) | 0
  29049. this._d = (d + this._d) | 0
  29050. this._e = (e + this._e) | 0
  29051. }
  29052. Sha1.prototype._hash = function () {
  29053. var H = new Buffer(20)
  29054. H.writeInt32BE(this._a | 0, 0)
  29055. H.writeInt32BE(this._b | 0, 4)
  29056. H.writeInt32BE(this._c | 0, 8)
  29057. H.writeInt32BE(this._d | 0, 12)
  29058. H.writeInt32BE(this._e | 0, 16)
  29059. return H
  29060. }
  29061. module.exports = Sha1
  29062. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29063. /***/ },
  29064. /* 279 */
  29065. /***/ function(module, exports, __webpack_require__) {
  29066. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  29067. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  29068. * in FIPS 180-2
  29069. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  29070. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  29071. *
  29072. */
  29073. var inherits = __webpack_require__(1)
  29074. var Sha256 = __webpack_require__(116)
  29075. var Hash = __webpack_require__(18)
  29076. var W = new Array(64)
  29077. function Sha224 () {
  29078. this.init()
  29079. this._w = W // new Array(64)
  29080. Hash.call(this, 64, 56)
  29081. }
  29082. inherits(Sha224, Sha256)
  29083. Sha224.prototype.init = function () {
  29084. this._a = 0xc1059ed8
  29085. this._b = 0x367cd507
  29086. this._c = 0x3070dd17
  29087. this._d = 0xf70e5939
  29088. this._e = 0xffc00b31
  29089. this._f = 0x68581511
  29090. this._g = 0x64f98fa7
  29091. this._h = 0xbefa4fa4
  29092. return this
  29093. }
  29094. Sha224.prototype._hash = function () {
  29095. var H = new Buffer(28)
  29096. H.writeInt32BE(this._a, 0)
  29097. H.writeInt32BE(this._b, 4)
  29098. H.writeInt32BE(this._c, 8)
  29099. H.writeInt32BE(this._d, 12)
  29100. H.writeInt32BE(this._e, 16)
  29101. H.writeInt32BE(this._f, 20)
  29102. H.writeInt32BE(this._g, 24)
  29103. return H
  29104. }
  29105. module.exports = Sha224
  29106. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29107. /***/ },
  29108. /* 280 */
  29109. /***/ function(module, exports, __webpack_require__) {
  29110. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  29111. var SHA512 = __webpack_require__(117)
  29112. var Hash = __webpack_require__(18)
  29113. var W = new Array(160)
  29114. function Sha384 () {
  29115. this.init()
  29116. this._w = W
  29117. Hash.call(this, 128, 112)
  29118. }
  29119. inherits(Sha384, SHA512)
  29120. Sha384.prototype.init = function () {
  29121. this._ah = 0xcbbb9d5d
  29122. this._bh = 0x629a292a
  29123. this._ch = 0x9159015a
  29124. this._dh = 0x152fecd8
  29125. this._eh = 0x67332667
  29126. this._fh = 0x8eb44a87
  29127. this._gh = 0xdb0c2e0d
  29128. this._hh = 0x47b5481d
  29129. this._al = 0xc1059ed8
  29130. this._bl = 0x367cd507
  29131. this._cl = 0x3070dd17
  29132. this._dl = 0xf70e5939
  29133. this._el = 0xffc00b31
  29134. this._fl = 0x68581511
  29135. this._gl = 0x64f98fa7
  29136. this._hl = 0xbefa4fa4
  29137. return this
  29138. }
  29139. Sha384.prototype._hash = function () {
  29140. var H = new Buffer(48)
  29141. function writeInt64BE (h, l, offset) {
  29142. H.writeInt32BE(h, offset)
  29143. H.writeInt32BE(l, offset + 4)
  29144. }
  29145. writeInt64BE(this._ah, this._al, 0)
  29146. writeInt64BE(this._bh, this._bl, 8)
  29147. writeInt64BE(this._ch, this._cl, 16)
  29148. writeInt64BE(this._dh, this._dl, 24)
  29149. writeInt64BE(this._eh, this._el, 32)
  29150. writeInt64BE(this._fh, this._fl, 40)
  29151. return H
  29152. }
  29153. module.exports = Sha384
  29154. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29155. /***/ },
  29156. /* 281 */
  29157. /***/ function(module, exports) {
  29158. function E () {
  29159. // Keep this empty so it's easier to inherit from
  29160. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  29161. }
  29162. E.prototype = {
  29163. on: function (name, callback, ctx) {
  29164. var e = this.e || (this.e = {});
  29165. (e[name] || (e[name] = [])).push({
  29166. fn: callback,
  29167. ctx: ctx
  29168. });
  29169. return this;
  29170. },
  29171. once: function (name, callback, ctx) {
  29172. var self = this;
  29173. function listener () {
  29174. self.off(name, listener);
  29175. callback.apply(ctx, arguments);
  29176. };
  29177. listener._ = callback
  29178. return this.on(name, listener, ctx);
  29179. },
  29180. emit: function (name) {
  29181. var data = [].slice.call(arguments, 1);
  29182. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  29183. var i = 0;
  29184. var len = evtArr.length;
  29185. for (i; i < len; i++) {
  29186. evtArr[i].fn.apply(evtArr[i].ctx, data);
  29187. }
  29188. return this;
  29189. },
  29190. off: function (name, callback) {
  29191. var e = this.e || (this.e = {});
  29192. var evts = e[name];
  29193. var liveEvents = [];
  29194. if (evts && callback) {
  29195. for (var i = 0, len = evts.length; i < len; i++) {
  29196. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  29197. liveEvents.push(evts[i]);
  29198. }
  29199. }
  29200. // Remove event from queue to prevent memory leak
  29201. // Suggested by https://github.com/lazd
  29202. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  29203. (liveEvents.length)
  29204. ? e[name] = liveEvents
  29205. : delete e[name];
  29206. return this;
  29207. }
  29208. };
  29209. module.exports = E;
  29210. /***/ },
  29211. /* 282 */
  29212. /***/ function(module, exports, __webpack_require__) {
  29213. /* WEBPACK VAR INJECTION */(function(global) {
  29214. /**
  29215. * Module exports.
  29216. */
  29217. module.exports = deprecate;
  29218. /**
  29219. * Mark that a method should not be used.
  29220. * Returns a modified function which warns once by default.
  29221. *
  29222. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  29223. *
  29224. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  29225. * will throw an Error when invoked.
  29226. *
  29227. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  29228. * will invoke `console.trace()` instead of `console.error()`.
  29229. *
  29230. * @param {Function} fn - the function to deprecate
  29231. * @param {String} msg - the string to print to the console when `fn` is invoked
  29232. * @returns {Function} a new "deprecated" version of `fn`
  29233. * @api public
  29234. */
  29235. function deprecate (fn, msg) {
  29236. if (config('noDeprecation')) {
  29237. return fn;
  29238. }
  29239. var warned = false;
  29240. function deprecated() {
  29241. if (!warned) {
  29242. if (config('throwDeprecation')) {
  29243. throw new Error(msg);
  29244. } else if (config('traceDeprecation')) {
  29245. console.trace(msg);
  29246. } else {
  29247. console.warn(msg);
  29248. }
  29249. warned = true;
  29250. }
  29251. return fn.apply(this, arguments);
  29252. }
  29253. return deprecated;
  29254. }
  29255. /**
  29256. * Checks `localStorage` for boolean values for the given `name`.
  29257. *
  29258. * @param {String} name
  29259. * @returns {Boolean}
  29260. * @api private
  29261. */
  29262. function config (name) {
  29263. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  29264. try {
  29265. if (!global.localStorage) return false;
  29266. } catch (_) {
  29267. return false;
  29268. }
  29269. var val = global.localStorage[name];
  29270. if (null == val) return false;
  29271. return String(val).toLowerCase() === 'true';
  29272. }
  29273. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  29274. /***/ },
  29275. /* 283 */
  29276. /***/ function(module, exports, __webpack_require__) {
  29277. var indexOf = __webpack_require__(254);
  29278. var Object_keys = function (obj) {
  29279. if (Object.keys) return Object.keys(obj)
  29280. else {
  29281. var res = [];
  29282. for (var key in obj) res.push(key)
  29283. return res;
  29284. }
  29285. };
  29286. var forEach = function (xs, fn) {
  29287. if (xs.forEach) return xs.forEach(fn)
  29288. else for (var i = 0; i < xs.length; i++) {
  29289. fn(xs[i], i, xs);
  29290. }
  29291. };
  29292. var defineProp = (function() {
  29293. try {
  29294. Object.defineProperty({}, '_', {});
  29295. return function(obj, name, value) {
  29296. Object.defineProperty(obj, name, {
  29297. writable: true,
  29298. enumerable: false,
  29299. configurable: true,
  29300. value: value
  29301. })
  29302. };
  29303. } catch(e) {
  29304. return function(obj, name, value) {
  29305. obj[name] = value;
  29306. };
  29307. }
  29308. }());
  29309. var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
  29310. 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
  29311. 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
  29312. 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
  29313. 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
  29314. function Context() {}
  29315. Context.prototype = {};
  29316. var Script = exports.Script = function NodeScript (code) {
  29317. if (!(this instanceof Script)) return new Script(code);
  29318. this.code = code;
  29319. };
  29320. Script.prototype.runInContext = function (context) {
  29321. if (!(context instanceof Context)) {
  29322. throw new TypeError("needs a 'context' argument.");
  29323. }
  29324. var iframe = document.createElement('iframe');
  29325. if (!iframe.style) iframe.style = {};
  29326. iframe.style.display = 'none';
  29327. document.body.appendChild(iframe);
  29328. var win = iframe.contentWindow;
  29329. var wEval = win.eval, wExecScript = win.execScript;
  29330. if (!wEval && wExecScript) {
  29331. // win.eval() magically appears when this is called in IE:
  29332. wExecScript.call(win, 'null');
  29333. wEval = win.eval;
  29334. }
  29335. forEach(Object_keys(context), function (key) {
  29336. win[key] = context[key];
  29337. });
  29338. forEach(globals, function (key) {
  29339. if (context[key]) {
  29340. win[key] = context[key];
  29341. }
  29342. });
  29343. var winKeys = Object_keys(win);
  29344. var res = wEval.call(win, this.code);
  29345. forEach(Object_keys(win), function (key) {
  29346. // Avoid copying circular objects like `top` and `window` by only
  29347. // updating existing context properties or new properties in the `win`
  29348. // that was only introduced after the eval.
  29349. if (key in context || indexOf(winKeys, key) === -1) {
  29350. context[key] = win[key];
  29351. }
  29352. });
  29353. forEach(globals, function (key) {
  29354. if (!(key in context)) {
  29355. defineProp(context, key, win[key]);
  29356. }
  29357. });
  29358. document.body.removeChild(iframe);
  29359. return res;
  29360. };
  29361. Script.prototype.runInThisContext = function () {
  29362. return eval(this.code); // maybe...
  29363. };
  29364. Script.prototype.runInNewContext = function (context) {
  29365. var ctx = Script.createContext(context);
  29366. var res = this.runInContext(ctx);
  29367. forEach(Object_keys(ctx), function (key) {
  29368. context[key] = ctx[key];
  29369. });
  29370. return res;
  29371. };
  29372. forEach(Object_keys(Script.prototype), function (name) {
  29373. exports[name] = Script[name] = function (code) {
  29374. var s = Script(code);
  29375. return s[name].apply(s, [].slice.call(arguments, 1));
  29376. };
  29377. });
  29378. exports.createScript = function (code) {
  29379. return exports.Script(code);
  29380. };
  29381. exports.createContext = Script.createContext = function (context) {
  29382. var copy = new Context();
  29383. if(typeof context === 'object') {
  29384. forEach(Object_keys(context), function (key) {
  29385. copy[key] = context[key];
  29386. });
  29387. }
  29388. return copy;
  29389. };
  29390. /***/ },
  29391. /* 284 */
  29392. /***/ function(module, exports, __webpack_require__) {
  29393. var __vue_exports__, __vue_options__
  29394. /* styles */
  29395. __webpack_require__(308)
  29396. /* script */
  29397. __vue_exports__ = __webpack_require__(150)
  29398. /* template */
  29399. var __vue_template__ = __webpack_require__(300)
  29400. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29401. if (
  29402. typeof __vue_exports__.default === "object" ||
  29403. typeof __vue_exports__.default === "function"
  29404. ) {
  29405. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29406. }
  29407. if (typeof __vue_options__ === "function") {
  29408. __vue_options__ = __vue_options__.options
  29409. }
  29410. __vue_options__.render = __vue_template__.render
  29411. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29412. module.exports = __vue_exports__
  29413. /***/ },
  29414. /* 285 */
  29415. /***/ function(module, exports, __webpack_require__) {
  29416. var __vue_exports__, __vue_options__
  29417. /* styles */
  29418. __webpack_require__(304)
  29419. /* script */
  29420. __vue_exports__ = __webpack_require__(151)
  29421. /* template */
  29422. var __vue_template__ = __webpack_require__(295)
  29423. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29424. if (
  29425. typeof __vue_exports__.default === "object" ||
  29426. typeof __vue_exports__.default === "function"
  29427. ) {
  29428. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29429. }
  29430. if (typeof __vue_options__ === "function") {
  29431. __vue_options__ = __vue_options__.options
  29432. }
  29433. __vue_options__.render = __vue_template__.render
  29434. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29435. module.exports = __vue_exports__
  29436. /***/ },
  29437. /* 286 */
  29438. /***/ function(module, exports, __webpack_require__) {
  29439. var __vue_exports__, __vue_options__
  29440. /* styles */
  29441. __webpack_require__(309)
  29442. /* script */
  29443. __vue_exports__ = __webpack_require__(152)
  29444. /* template */
  29445. var __vue_template__ = __webpack_require__(302)
  29446. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29447. if (
  29448. typeof __vue_exports__.default === "object" ||
  29449. typeof __vue_exports__.default === "function"
  29450. ) {
  29451. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29452. }
  29453. if (typeof __vue_options__ === "function") {
  29454. __vue_options__ = __vue_options__.options
  29455. }
  29456. __vue_options__.render = __vue_template__.render
  29457. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29458. module.exports = __vue_exports__
  29459. /***/ },
  29460. /* 287 */
  29461. /***/ function(module, exports, __webpack_require__) {
  29462. var __vue_exports__, __vue_options__
  29463. /* template */
  29464. var __vue_template__ = __webpack_require__(293)
  29465. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29466. if (
  29467. typeof __vue_exports__.default === "object" ||
  29468. typeof __vue_exports__.default === "function"
  29469. ) {
  29470. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29471. }
  29472. if (typeof __vue_options__ === "function") {
  29473. __vue_options__ = __vue_options__.options
  29474. }
  29475. __vue_options__.render = __vue_template__.render
  29476. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29477. module.exports = __vue_exports__
  29478. /***/ },
  29479. /* 288 */
  29480. /***/ function(module, exports, __webpack_require__) {
  29481. var __vue_exports__, __vue_options__
  29482. /* script */
  29483. __vue_exports__ = __webpack_require__(153)
  29484. /* template */
  29485. var __vue_template__ = __webpack_require__(294)
  29486. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29487. if (
  29488. typeof __vue_exports__.default === "object" ||
  29489. typeof __vue_exports__.default === "function"
  29490. ) {
  29491. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29492. }
  29493. if (typeof __vue_options__ === "function") {
  29494. __vue_options__ = __vue_options__.options
  29495. }
  29496. __vue_options__.render = __vue_template__.render
  29497. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29498. module.exports = __vue_exports__
  29499. /***/ },
  29500. /* 289 */
  29501. /***/ function(module, exports, __webpack_require__) {
  29502. var __vue_exports__, __vue_options__
  29503. /* styles */
  29504. __webpack_require__(306)
  29505. /* script */
  29506. __vue_exports__ = __webpack_require__(154)
  29507. /* template */
  29508. var __vue_template__ = __webpack_require__(297)
  29509. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29510. if (
  29511. typeof __vue_exports__.default === "object" ||
  29512. typeof __vue_exports__.default === "function"
  29513. ) {
  29514. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29515. }
  29516. if (typeof __vue_options__ === "function") {
  29517. __vue_options__ = __vue_options__.options
  29518. }
  29519. __vue_options__.render = __vue_template__.render
  29520. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29521. module.exports = __vue_exports__
  29522. /***/ },
  29523. /* 290 */
  29524. /***/ function(module, exports, __webpack_require__) {
  29525. var __vue_exports__, __vue_options__
  29526. /* script */
  29527. __vue_exports__ = __webpack_require__(155)
  29528. /* template */
  29529. var __vue_template__ = __webpack_require__(299)
  29530. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29531. if (
  29532. typeof __vue_exports__.default === "object" ||
  29533. typeof __vue_exports__.default === "function"
  29534. ) {
  29535. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29536. }
  29537. if (typeof __vue_options__ === "function") {
  29538. __vue_options__ = __vue_options__.options
  29539. }
  29540. __vue_options__.render = __vue_template__.render
  29541. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29542. module.exports = __vue_exports__
  29543. /***/ },
  29544. /* 291 */
  29545. /***/ function(module, exports, __webpack_require__) {
  29546. var __vue_exports__, __vue_options__
  29547. /* script */
  29548. __vue_exports__ = __webpack_require__(156)
  29549. /* template */
  29550. var __vue_template__ = __webpack_require__(301)
  29551. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29552. if (
  29553. typeof __vue_exports__.default === "object" ||
  29554. typeof __vue_exports__.default === "function"
  29555. ) {
  29556. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29557. }
  29558. if (typeof __vue_options__ === "function") {
  29559. __vue_options__ = __vue_options__.options
  29560. }
  29561. __vue_options__.render = __vue_template__.render
  29562. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29563. module.exports = __vue_exports__
  29564. /***/ },
  29565. /* 292 */
  29566. /***/ function(module, exports, __webpack_require__) {
  29567. var __vue_exports__, __vue_options__
  29568. /* styles */
  29569. __webpack_require__(305)
  29570. /* script */
  29571. __vue_exports__ = __webpack_require__(157)
  29572. /* template */
  29573. var __vue_template__ = __webpack_require__(296)
  29574. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29575. if (
  29576. typeof __vue_exports__.default === "object" ||
  29577. typeof __vue_exports__.default === "function"
  29578. ) {
  29579. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29580. }
  29581. if (typeof __vue_options__ === "function") {
  29582. __vue_options__ = __vue_options__.options
  29583. }
  29584. __vue_options__.render = __vue_template__.render
  29585. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29586. module.exports = __vue_exports__
  29587. /***/ },
  29588. /* 293 */
  29589. /***/ function(module, exports) {
  29590. module.exports={render:function (){with(this) {
  29591. return _m(0)
  29592. }},staticRenderFns: [function (){with(this) {
  29593. return _h('div', {
  29594. attrs: {
  29595. "style": "display: none;"
  29596. }
  29597. }, [_h('label', {
  29598. attrs: {
  29599. "for": "username"
  29600. }
  29601. }, [_h('input', {
  29602. attrs: {
  29603. "type": "text",
  29604. "id": "username",
  29605. "name": "username",
  29606. "autocomplete": "username"
  29607. }
  29608. })]), " ", _h('label', {
  29609. attrs: {
  29610. "for": "password"
  29611. }
  29612. }, [_h('input', {
  29613. attrs: {
  29614. "type": "password",
  29615. "id": "password",
  29616. "name": "password",
  29617. "autocomplete": "current-password"
  29618. }
  29619. })])])
  29620. }}]}
  29621. /***/ },
  29622. /* 294 */
  29623. /***/ function(module, exports) {
  29624. module.exports={render:function (){with(this) {
  29625. return _h('form', [(showError) ? _h('div', {
  29626. staticClass: "form-group row"
  29627. }, [_h('div', {
  29628. staticClass: "col-xs-12 text-muted text-danger"
  29629. }, ["\n " + _s(errorMessage) + "\n "])]) : _e(), " ", _h('div', {
  29630. staticClass: "form-group row"
  29631. }, [_h('div', {
  29632. staticClass: "col-xs-12"
  29633. }, [_h('div', {
  29634. staticClass: "inner-addon left-addon"
  29635. }, [_m(0), " ", _h('input', {
  29636. directives: [{
  29637. name: "model",
  29638. rawName: "v-model",
  29639. value: (email),
  29640. expression: "email"
  29641. }],
  29642. staticClass: "form-control",
  29643. attrs: {
  29644. "id": "email",
  29645. "name": "login",
  29646. "type": "email",
  29647. "placeholder": "Email",
  29648. "required": ""
  29649. },
  29650. domProps: {
  29651. "value": _s(email)
  29652. },
  29653. on: {
  29654. "input": function($event) {
  29655. if ($event.target.composing) return;
  29656. email = $event.target.value
  29657. }
  29658. }
  29659. }), " ", _h('small', {
  29660. staticClass: "form-text text-muted text-danger"
  29661. }, [(errors.userNameAlreadyExist) ? _h('span', ["Someone already use that username. Do you want to sign in ?"]) : _e(), " ", (errors.emailRequired) ? _h('span', ["An email is required"]) : _e()])])])]), " ", _h('div', {
  29662. staticClass: "form-group row"
  29663. }, [_h('div', {
  29664. staticClass: "col-xs-12"
  29665. }, [_h('div', {
  29666. staticClass: "inner-addon left-addon"
  29667. }, [_m(1), " ", _h('input', {
  29668. directives: [{
  29669. name: "model",
  29670. rawName: "v-model",
  29671. value: (password),
  29672. expression: "password"
  29673. }],
  29674. staticClass: "form-control",
  29675. attrs: {
  29676. "id": "password",
  29677. "name": "password",
  29678. "type": "password",
  29679. "required": "",
  29680. "placeholder": "LessPass password"
  29681. },
  29682. domProps: {
  29683. "value": _s(password)
  29684. },
  29685. on: {
  29686. "input": function($event) {
  29687. if ($event.target.composing) return;
  29688. password = $event.target.value
  29689. }
  29690. }
  29691. }), " ", _h('small', {
  29692. staticClass: "form-text text-muted"
  29693. }, [(noErrors()) ? _h('span', {
  29694. staticClass: "text-warning"
  29695. }, ["Do not use your master password here"]) : _e(), " ", (errors.passwordRequired) ? _h('span', {
  29696. staticClass: "text-danger"
  29697. }, ["A password is required"]) : _e()])])])]), " ", _h('div', {
  29698. staticClass: "form-group row"
  29699. }, [_h('div', {
  29700. staticClass: "col-xs-12 hint--bottom",
  29701. attrs: {
  29702. "aria-label": "You can use your self hosted LessPass Database"
  29703. }
  29704. }, [_h('div', {
  29705. staticClass: "inner-addon left-addon"
  29706. }, [_m(2), " ", _h('input', {
  29707. directives: [{
  29708. name: "model",
  29709. rawName: "v-model",
  29710. value: (baseURL),
  29711. expression: "baseURL"
  29712. }],
  29713. staticClass: "form-control",
  29714. attrs: {
  29715. "id": "baseURL",
  29716. "type": "text",
  29717. "placeholder": "LessPass Database (https://...)"
  29718. },
  29719. domProps: {
  29720. "value": _s(baseURL)
  29721. },
  29722. on: {
  29723. "input": function($event) {
  29724. if ($event.target.composing) return;
  29725. baseURL = $event.target.value
  29726. }
  29727. }
  29728. }), " ", _h('small', {
  29729. staticClass: "form-text text-muted"
  29730. }, [(noErrors()) ? _h('span', ["You can use your self hosted LessPass Database"]) : _e(), " ", (errors.baseURLRequired) ? _h('span', {
  29731. staticClass: "text-danger"
  29732. }, ["\n A LessPass database url is required\n "]) : _e()])])])]), " ", _h('div', {
  29733. staticClass: "form-group row"
  29734. }, [_h('div', {
  29735. staticClass: "col-xs-12"
  29736. }, [_h('button', {
  29737. staticClass: "btn btn-primary",
  29738. attrs: {
  29739. "id": "signInButton",
  29740. "type": "button"
  29741. },
  29742. on: {
  29743. "click": signIn
  29744. }
  29745. }, [(loadingSignIn) ? _h('span', [_m(3)]) : _e(), "\n Sign In\n "]), " ", _h('button', {
  29746. staticClass: "btn btn-secondary",
  29747. attrs: {
  29748. "id": "registerButton",
  29749. "type": "button"
  29750. },
  29751. on: {
  29752. "click": register
  29753. }
  29754. }, [(loadingRegister) ? _h('span', [_m(4)]) : _e(), "\n Register\n "])])]), " ", _h('div', {
  29755. staticClass: "form-group row"
  29756. }, [_h('div', {
  29757. staticClass: "col-xs-12"
  29758. }, [_h('router-link', {
  29759. attrs: {
  29760. "to": {
  29761. name: 'passwordReset'
  29762. }
  29763. }
  29764. }, ["\n Forgot you password ?\n "])])])])
  29765. }},staticRenderFns: [function (){with(this) {
  29766. return _h('i', {
  29767. staticClass: "fa fa-user"
  29768. })
  29769. }},function (){with(this) {
  29770. return _h('i', {
  29771. staticClass: "fa fa-lock"
  29772. })
  29773. }},function (){with(this) {
  29774. return _h('i', {
  29775. staticClass: "fa fa-globe"
  29776. })
  29777. }},function (){with(this) {
  29778. return _h('i', {
  29779. staticClass: "fa fa-spinner fa-pulse fa-fw"
  29780. })
  29781. }},function (){with(this) {
  29782. return _h('i', {
  29783. staticClass: "fa fa-spinner fa-pulse fa-fw"
  29784. })
  29785. }}]}
  29786. /***/ },
  29787. /* 295 */
  29788. /***/ function(module, exports) {
  29789. module.exports={render:function (){with(this) {
  29790. return (fingerprint) ? _h('span', {
  29791. staticClass: "input-group-btn"
  29792. }, [_h('button', {
  29793. staticClass: "btn",
  29794. attrs: {
  29795. "id": "fingerprint",
  29796. "type": "button",
  29797. "tabindex": "-1"
  29798. }
  29799. }, [_h('small', {
  29800. staticClass: "hint--left",
  29801. attrs: {
  29802. "aria-label": "master password fingerprint"
  29803. }
  29804. }, [_h('i', {
  29805. staticClass: "fa fa-fw",
  29806. class: [icon1],
  29807. style: ({
  29808. color: color1
  29809. })
  29810. }), " ", _h('i', {
  29811. staticClass: "fa fa-fw",
  29812. class: [icon2],
  29813. style: ({
  29814. color: color2
  29815. })
  29816. }), " ", _h('i', {
  29817. staticClass: "fa fa-fw",
  29818. class: [icon3],
  29819. style: ({
  29820. color: color3
  29821. })
  29822. })])])]) : _e()
  29823. }},staticRenderFns: []}
  29824. /***/ },
  29825. /* 296 */
  29826. /***/ function(module, exports) {
  29827. module.exports={render:function (){with(this) {
  29828. return _h('div', [_h('form', [_h('div', {
  29829. staticClass: "form-group row"
  29830. }, [_h('div', {
  29831. staticClass: "col-sm-7"
  29832. }, [_h('div', {
  29833. staticClass: "inner-addon left-addon"
  29834. }, [_m(0), " ", _h('input', {
  29835. directives: [{
  29836. name: "model",
  29837. rawName: "v-model",
  29838. value: (searchQuery),
  29839. expression: "searchQuery"
  29840. }],
  29841. staticClass: "form-control",
  29842. attrs: {
  29843. "name": "search",
  29844. "placeholder": "Search"
  29845. },
  29846. domProps: {
  29847. "value": _s(searchQuery)
  29848. },
  29849. on: {
  29850. "input": function($event) {
  29851. if ($event.target.composing) return;
  29852. searchQuery = $event.target.value
  29853. }
  29854. }
  29855. })])])])]), " ", _h('div', {
  29856. staticClass: "row",
  29857. attrs: {
  29858. "id": "passwords"
  29859. }
  29860. }, [_h('div', {
  29861. staticClass: "col-xs-12"
  29862. }, [_h('table', {
  29863. staticClass: "table"
  29864. }, [_h('tbody', [(passwords.length === 0) ? _h('tr', [_h('td', ["\n You don't have any passwords saved in your database.\n ", _m(1), " ", _h('router-link', {
  29865. attrs: {
  29866. "to": {
  29867. name: 'home'
  29868. }
  29869. }
  29870. }, ["Would you like to create one ?"])])]) : _e(), " ", _l((filteredPasswords), function(password) {
  29871. return _h('tr', [_h('td', [_h('router-link', {
  29872. attrs: {
  29873. "to": {
  29874. name: 'password',
  29875. params: {
  29876. id: password.id
  29877. }
  29878. }
  29879. }
  29880. }, ["\n " + _s(password.site) + "\n "]), " ", _m(2, true), "\n " + _s(password.login) + "\n "]), " ", _h('td', {
  29881. staticClass: "text-xs-right"
  29882. }, [_h('delete-button', {
  29883. attrs: {
  29884. "action": deletePassword,
  29885. "object": password,
  29886. "text": "Are you sure you want to delete this password ?"
  29887. }
  29888. })])])
  29889. })])])])])])
  29890. }},staticRenderFns: [function (){with(this) {
  29891. return _h('i', {
  29892. staticClass: "fa fa-search"
  29893. })
  29894. }},function (){with(this) {
  29895. return _h('br')
  29896. }},function (){with(this) {
  29897. return _h('br')
  29898. }}]}
  29899. /***/ },
  29900. /* 297 */
  29901. /***/ function(module, exports) {
  29902. module.exports={render:function (){with(this) {
  29903. return _h('form', {
  29904. attrs: {
  29905. "id": "password-generator"
  29906. }
  29907. }, [_h('div', {
  29908. staticClass: "form-group row"
  29909. }, [_h('div', {
  29910. staticClass: "col-xs-12"
  29911. }, [_h('div', {
  29912. staticClass: "inner-addon left-addon"
  29913. }, [_m(0), " ", _h('input', {
  29914. directives: [{
  29915. name: "model",
  29916. rawName: "v-model",
  29917. value: (password.site),
  29918. expression: "password.site"
  29919. }],
  29920. ref: "site",
  29921. staticClass: "form-control",
  29922. attrs: {
  29923. "id": "site",
  29924. "name": "site",
  29925. "type": "text",
  29926. "placeholder": "Site",
  29927. "list": "savedSites",
  29928. "autocorrect": "off",
  29929. "autocapitalize": "none"
  29930. },
  29931. domProps: {
  29932. "value": _s(password.site)
  29933. },
  29934. on: {
  29935. "input": function($event) {
  29936. if ($event.target.composing) return;
  29937. password.site = $event.target.value
  29938. }
  29939. }
  29940. }), " ", _h('datalist', {
  29941. attrs: {
  29942. "id": "savedSites"
  29943. }
  29944. }, [_l((passwords), function(pwd) {
  29945. return _h('option', ["\n " + _s(pwd.site) + " | " + _s(pwd.login) + "\n "])
  29946. })])])])]), " ", _h('remove-auto-complete'), " ", _h('div', {
  29947. staticClass: "form-group row"
  29948. }, [_h('div', {
  29949. staticClass: "col-xs-12"
  29950. }, [_h('div', {
  29951. staticClass: "inner-addon left-addon"
  29952. }, [_m(1), " ", _m(2), " ", _h('input', {
  29953. directives: [{
  29954. name: "model",
  29955. rawName: "v-model",
  29956. value: (password.login),
  29957. expression: "password.login"
  29958. }],
  29959. staticClass: "form-control",
  29960. attrs: {
  29961. "id": "login",
  29962. "name": "login",
  29963. "type": "text",
  29964. "placeholder": "Login",
  29965. "autocomplete": "off",
  29966. "autocorrect": "off",
  29967. "autocapitalize": "none"
  29968. },
  29969. domProps: {
  29970. "value": _s(password.login)
  29971. },
  29972. on: {
  29973. "input": function($event) {
  29974. if ($event.target.composing) return;
  29975. password.login = $event.target.value
  29976. }
  29977. }
  29978. })])])]), " ", _h('div', {
  29979. staticClass: "form-group row"
  29980. }, [_h('div', {
  29981. staticClass: "col-xs-12"
  29982. }, [_h('div', {
  29983. staticClass: "inner-addon left-addon input-group"
  29984. }, [_m(3), " ", _m(4), " ", _h('input', {
  29985. directives: [{
  29986. name: "model",
  29987. rawName: "v-model",
  29988. value: (masterPassword),
  29989. expression: "masterPassword"
  29990. }],
  29991. ref: "masterPassword",
  29992. staticClass: "form-control",
  29993. attrs: {
  29994. "id": "masterPassword",
  29995. "name": "masterPassword",
  29996. "type": "password",
  29997. "placeholder": "Master password",
  29998. "autocomplete": "new-password",
  29999. "autocorrect": "off",
  30000. "autocapitalize": "none"
  30001. },
  30002. domProps: {
  30003. "value": _s(masterPassword)
  30004. },
  30005. on: {
  30006. "input": function($event) {
  30007. if ($event.target.composing) return;
  30008. masterPassword = $event.target.value
  30009. }
  30010. }
  30011. }), " ", _h('fingerprint', {
  30012. attrs: {
  30013. "fingerprint": masterPassword
  30014. },
  30015. nativeOn: {
  30016. "click": function($event) {
  30017. showMasterPassword($event)
  30018. }
  30019. }
  30020. })])])]), " ", _h('div', {
  30021. staticClass: "form-group row"
  30022. }, [_h('div', {
  30023. staticClass: "col-xs-12"
  30024. }, [_h('div', {
  30025. staticClass: "input-group"
  30026. }, [_m(5), " ", _h('input', {
  30027. directives: [{
  30028. name: "model",
  30029. rawName: "v-model",
  30030. value: (generatedPassword),
  30031. expression: "generatedPassword"
  30032. }],
  30033. staticClass: "form-control",
  30034. attrs: {
  30035. "id": "generatedPassword",
  30036. "name": "generatedPassword",
  30037. "type": "text",
  30038. "tabindex": "-1",
  30039. "readonly": ""
  30040. },
  30041. domProps: {
  30042. "value": _s(generatedPassword)
  30043. },
  30044. on: {
  30045. "input": function($event) {
  30046. if ($event.target.composing) return;
  30047. generatedPassword = $event.target.value
  30048. }
  30049. }
  30050. }), " ", _h('span', {
  30051. staticClass: "input-group-btn"
  30052. }, [_h('button', {
  30053. staticClass: "btn-copy btn btn-primary",
  30054. attrs: {
  30055. "id": "copyPasswordButton",
  30056. "disabled": !generatedPassword,
  30057. "type": "button",
  30058. "data-clipboard-target": "#generatedPassword"
  30059. },
  30060. on: {
  30061. "click": function($event) {
  30062. cleanFormInSeconds(10)
  30063. }
  30064. }
  30065. }, [_m(6), " Copy\n "])])])])]), " ", _m(7), " ", _h('div', {
  30066. staticClass: "form-group row"
  30067. }, [_h('div', {
  30068. staticClass: "col-xs-12"
  30069. }, [_h('label', {
  30070. staticClass: "form-check-inline"
  30071. }, [_h('input', {
  30072. directives: [{
  30073. name: "model",
  30074. rawName: "v-model",
  30075. value: (password.lowercase),
  30076. expression: "password.lowercase"
  30077. }],
  30078. staticClass: "form-check-input",
  30079. attrs: {
  30080. "type": "checkbox",
  30081. "id": "lowercase"
  30082. },
  30083. domProps: {
  30084. "checked": Array.isArray(password.lowercase) ? _i(password.lowercase, null) > -1 : _q(password.lowercase, true)
  30085. },
  30086. on: {
  30087. "change": function($event) {
  30088. var $$a = password.lowercase,
  30089. $$el = $event.target,
  30090. $$c = $$el.checked ? (true) : (false);
  30091. if (Array.isArray($$a)) {
  30092. var $$v = null,
  30093. $$i = _i($$a, $$v);
  30094. if ($$c) {
  30095. $$i < 0 && (password.lowercase = $$a.concat($$v))
  30096. } else {
  30097. $$i > -1 && (password.lowercase = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30098. }
  30099. } else {
  30100. password.lowercase = $$c
  30101. }
  30102. }
  30103. }
  30104. }), " abc\n "]), " ", _h('label', {
  30105. staticClass: "form-check-inline"
  30106. }, [_h('input', {
  30107. directives: [{
  30108. name: "model",
  30109. rawName: "v-model",
  30110. value: (password.uppercase),
  30111. expression: "password.uppercase"
  30112. }],
  30113. staticClass: "form-check-input",
  30114. attrs: {
  30115. "type": "checkbox",
  30116. "id": "uppercase"
  30117. },
  30118. domProps: {
  30119. "checked": Array.isArray(password.uppercase) ? _i(password.uppercase, null) > -1 : _q(password.uppercase, true)
  30120. },
  30121. on: {
  30122. "change": function($event) {
  30123. var $$a = password.uppercase,
  30124. $$el = $event.target,
  30125. $$c = $$el.checked ? (true) : (false);
  30126. if (Array.isArray($$a)) {
  30127. var $$v = null,
  30128. $$i = _i($$a, $$v);
  30129. if ($$c) {
  30130. $$i < 0 && (password.uppercase = $$a.concat($$v))
  30131. } else {
  30132. $$i > -1 && (password.uppercase = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30133. }
  30134. } else {
  30135. password.uppercase = $$c
  30136. }
  30137. }
  30138. }
  30139. }), " ABC\n "]), " ", _h('label', {
  30140. staticClass: "form-check-inline"
  30141. }, [_h('input', {
  30142. directives: [{
  30143. name: "model",
  30144. rawName: "v-model",
  30145. value: (password.numbers),
  30146. expression: "password.numbers"
  30147. }],
  30148. staticClass: "form-check-input",
  30149. attrs: {
  30150. "type": "checkbox",
  30151. "id": "numbers"
  30152. },
  30153. domProps: {
  30154. "checked": Array.isArray(password.numbers) ? _i(password.numbers, null) > -1 : _q(password.numbers, true)
  30155. },
  30156. on: {
  30157. "change": function($event) {
  30158. var $$a = password.numbers,
  30159. $$el = $event.target,
  30160. $$c = $$el.checked ? (true) : (false);
  30161. if (Array.isArray($$a)) {
  30162. var $$v = null,
  30163. $$i = _i($$a, $$v);
  30164. if ($$c) {
  30165. $$i < 0 && (password.numbers = $$a.concat($$v))
  30166. } else {
  30167. $$i > -1 && (password.numbers = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30168. }
  30169. } else {
  30170. password.numbers = $$c
  30171. }
  30172. }
  30173. }
  30174. }), "\n 123\n "]), " ", _h('label', {
  30175. staticClass: "form-check-inline"
  30176. }, [_h('input', {
  30177. directives: [{
  30178. name: "model",
  30179. rawName: "v-model",
  30180. value: (password.symbols),
  30181. expression: "password.symbols"
  30182. }],
  30183. staticClass: "form-check-input",
  30184. attrs: {
  30185. "type": "checkbox",
  30186. "id": "symbols"
  30187. },
  30188. domProps: {
  30189. "checked": Array.isArray(password.symbols) ? _i(password.symbols, null) > -1 : _q(password.symbols, true)
  30190. },
  30191. on: {
  30192. "change": function($event) {
  30193. var $$a = password.symbols,
  30194. $$el = $event.target,
  30195. $$c = $$el.checked ? (true) : (false);
  30196. if (Array.isArray($$a)) {
  30197. var $$v = null,
  30198. $$i = _i($$a, $$v);
  30199. if ($$c) {
  30200. $$i < 0 && (password.symbols = $$a.concat($$v))
  30201. } else {
  30202. $$i > -1 && (password.symbols = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30203. }
  30204. } else {
  30205. password.symbols = $$c
  30206. }
  30207. }
  30208. }
  30209. }), "\n %!@\n "])])]), " ", _h('div', {
  30210. staticClass: "form-group row"
  30211. }, [_m(8), " ", _h('div', {
  30212. staticClass: "col-xs-3 pl-0"
  30213. }, [_h('input', {
  30214. directives: [{
  30215. name: "model",
  30216. rawName: "v-model",
  30217. value: (password.length),
  30218. expression: "password.length"
  30219. }],
  30220. staticClass: "form-control",
  30221. attrs: {
  30222. "type": "number",
  30223. "id": "passwordLength",
  30224. "min": "6"
  30225. },
  30226. domProps: {
  30227. "value": _s(password.length)
  30228. },
  30229. on: {
  30230. "input": function($event) {
  30231. if ($event.target.composing) return;
  30232. password.length = _n($event.target.value)
  30233. }
  30234. }
  30235. })]), " ", _m(9), " ", _h('div', {
  30236. staticClass: "col-xs-3 pl-0"
  30237. }, [_h('input', {
  30238. directives: [{
  30239. name: "model",
  30240. rawName: "v-model",
  30241. value: (password.counter),
  30242. expression: "password.counter"
  30243. }],
  30244. staticClass: "form-control",
  30245. attrs: {
  30246. "type": "number",
  30247. "id": "passwordCounter",
  30248. "min": "1"
  30249. },
  30250. domProps: {
  30251. "value": _s(password.counter)
  30252. },
  30253. on: {
  30254. "input": function($event) {
  30255. if ($event.target.composing) return;
  30256. password.counter = _n($event.target.value)
  30257. }
  30258. }
  30259. })])])])
  30260. }},staticRenderFns: [function (){with(this) {
  30261. return _h('i', {
  30262. staticClass: "fa fa-globe"
  30263. })
  30264. }},function (){with(this) {
  30265. return _h('i', {
  30266. staticClass: "fa fa-user"
  30267. })
  30268. }},function (){with(this) {
  30269. return _h('label', {
  30270. staticClass: "sr-only",
  30271. attrs: {
  30272. "for": "login"
  30273. }
  30274. }, ["Login"])
  30275. }},function (){with(this) {
  30276. return _h('label', {
  30277. staticClass: "sr-only",
  30278. attrs: {
  30279. "for": "masterPassword"
  30280. }
  30281. }, ["Password"])
  30282. }},function (){with(this) {
  30283. return _h('i', {
  30284. staticClass: "fa fa-lock"
  30285. })
  30286. }},function (){with(this) {
  30287. return _h('label', {
  30288. staticClass: "sr-only",
  30289. attrs: {
  30290. "for": "generatedPassword"
  30291. }
  30292. }, ["Password Generated"])
  30293. }},function (){with(this) {
  30294. return _h('i', {
  30295. staticClass: "fa fa-clipboard white"
  30296. })
  30297. }},function (){with(this) {
  30298. return _h('div', {
  30299. staticClass: "form-group row"
  30300. }, [_h('div', {
  30301. staticClass: "col-xs-12"
  30302. }, ["\n Password options\n ", _h('hr', {
  30303. attrs: {
  30304. "style": "margin:0;"
  30305. }
  30306. })])])
  30307. }},function (){with(this) {
  30308. return _h('label', {
  30309. staticClass: "col-xs-3 col-form-label",
  30310. attrs: {
  30311. "for": "passwordLength"
  30312. }
  30313. }, ["Length"])
  30314. }},function (){with(this) {
  30315. return _h('label', {
  30316. staticClass: "col-xs-3 col-form-label",
  30317. attrs: {
  30318. "for": "passwordCounter"
  30319. }
  30320. }, ["Counter"])
  30321. }}]}
  30322. /***/ },
  30323. /* 298 */
  30324. /***/ function(module, exports) {
  30325. module.exports={render:function (){with(this) {
  30326. return _h('div', {
  30327. staticClass: "card",
  30328. attrs: {
  30329. "id": "lesspass",
  30330. "style": "border:none;"
  30331. }
  30332. }, [_h('lesspass-menu'), " ", _h('div', {
  30333. staticClass: "card-block",
  30334. attrs: {
  30335. "style": "min-height: 400px;"
  30336. }
  30337. }, [_h('router-view')])])
  30338. }},staticRenderFns: []}
  30339. /***/ },
  30340. /* 299 */
  30341. /***/ function(module, exports) {
  30342. module.exports={render:function (){with(this) {
  30343. return _h('form', {
  30344. on: {
  30345. "submit": function($event) {
  30346. $event.preventDefault();
  30347. resetPassword($event)
  30348. }
  30349. }
  30350. }, [(showError) ? _h('div', {
  30351. staticClass: "form-group row"
  30352. }, [_m(0)]) : _e(), " ", (successMessage) ? _h('div', {
  30353. staticClass: "form-group row"
  30354. }, [_m(1)]) : _e(), " ", _h('div', {
  30355. staticClass: "form-group row"
  30356. }, [_h('div', {
  30357. staticClass: "col-xs-12"
  30358. }, [_h('div', {
  30359. staticClass: "inner-addon left-addon"
  30360. }, [_m(2), " ", _h('input', {
  30361. directives: [{
  30362. name: "model",
  30363. rawName: "v-model",
  30364. value: (email),
  30365. expression: "email"
  30366. }],
  30367. staticClass: "form-control",
  30368. attrs: {
  30369. "id": "email",
  30370. "name": "email",
  30371. "type": "email",
  30372. "placeholder": "Email"
  30373. },
  30374. domProps: {
  30375. "value": _s(email)
  30376. },
  30377. on: {
  30378. "input": function($event) {
  30379. if ($event.target.composing) return;
  30380. email = $event.target.value
  30381. }
  30382. }
  30383. }), " ", _h('small', {
  30384. staticClass: "form-text text-muted text-danger"
  30385. }, [(emailRequired) ? _h('span', ["An email is required"]) : _e()])])])]), " ", _h('div', {
  30386. staticClass: "form-group row"
  30387. }, [_h('div', {
  30388. staticClass: "col-xs-12"
  30389. }, [_h('button', {
  30390. staticClass: "btn btn-primary",
  30391. attrs: {
  30392. "id": "loginButton",
  30393. "type": "submit"
  30394. }
  30395. }, [(loading) ? _h('span', [_m(3)]) : _e(), "\n Send me a reset link\n "])])])])
  30396. }},staticRenderFns: [function (){with(this) {
  30397. return _h('div', {
  30398. staticClass: "col-xs-12 text-muted text-danger"
  30399. }, ["\n Oops! Something went wrong. Retry in a few minutes.\n "])
  30400. }},function (){with(this) {
  30401. return _h('div', {
  30402. staticClass: "col-xs-12 text-muted text-success"
  30403. }, ["\n If a matching account was found an email was sent to allow you to reset your password.\n "])
  30404. }},function (){with(this) {
  30405. return _h('i', {
  30406. staticClass: "fa fa-user"
  30407. })
  30408. }},function (){with(this) {
  30409. return _h('i', {
  30410. staticClass: "fa fa-spinner fa-pulse fa-fw"
  30411. })
  30412. }}]}
  30413. /***/ },
  30414. /* 300 */
  30415. /***/ function(module, exports) {
  30416. module.exports={render:function (){with(this) {
  30417. return _h('div', {
  30418. attrs: {
  30419. "id": "delete-button"
  30420. }
  30421. }, [_h('button', {
  30422. staticClass: "btn btn-danger",
  30423. attrs: {
  30424. "type": "button"
  30425. },
  30426. on: {
  30427. "click": confirm
  30428. }
  30429. }, [_m(0)])])
  30430. }},staticRenderFns: [function (){with(this) {
  30431. return _h('i', {
  30432. staticClass: "fa-white fa fa-trash"
  30433. })
  30434. }}]}
  30435. /***/ },
  30436. /* 301 */
  30437. /***/ function(module, exports) {
  30438. module.exports={render:function (){with(this) {
  30439. return _h('form', {
  30440. on: {
  30441. "submit": function($event) {
  30442. $event.preventDefault();
  30443. resetPasswordConfirm($event)
  30444. }
  30445. }
  30446. }, [(showError) ? _h('div', {
  30447. staticClass: "form-group row"
  30448. }, [_h('div', {
  30449. staticClass: "col-xs-12 text-muted text-danger"
  30450. }, ["\n " + _s(errorMessage) + "\n "])]) : _e(), " ", (successMessage) ? _h('div', {
  30451. staticClass: "form-group row"
  30452. }, [_h('div', {
  30453. staticClass: "col-xs-12 text-muted text-success"
  30454. }, ["\n You're password was reset successfully.\n ", _h('router-link', {
  30455. attrs: {
  30456. "to": {
  30457. name: 'login'
  30458. }
  30459. }
  30460. }, ["Do you want to login ?"])])]) : _e(), " ", _h('div', {
  30461. staticClass: "form-group row"
  30462. }, [_h('div', {
  30463. staticClass: "col-xs-12"
  30464. }, [_h('div', {
  30465. staticClass: "inner-addon left-addon"
  30466. }, [_m(0), " ", _h('input', {
  30467. directives: [{
  30468. name: "model",
  30469. rawName: "v-model",
  30470. value: (new_password),
  30471. expression: "new_password"
  30472. }],
  30473. staticClass: "form-control",
  30474. attrs: {
  30475. "id": "new-password",
  30476. "name": "new-password",
  30477. "type": "password",
  30478. "autocomplete": "new-password",
  30479. "placeholder": "New Password"
  30480. },
  30481. domProps: {
  30482. "value": _s(new_password)
  30483. },
  30484. on: {
  30485. "input": function($event) {
  30486. if ($event.target.composing) return;
  30487. new_password = $event.target.value
  30488. }
  30489. }
  30490. }), " ", _h('small', {
  30491. staticClass: "form-text text-muted text-danger"
  30492. }, [(passwordRequired) ? _h('span', ["A password is required"]) : _e()])])])]), " ", _m(1)])
  30493. }},staticRenderFns: [function (){with(this) {
  30494. return _h('i', {
  30495. staticClass: "fa fa-lock"
  30496. })
  30497. }},function (){with(this) {
  30498. return _h('div', {
  30499. staticClass: "form-group row"
  30500. }, [_h('div', {
  30501. staticClass: "col-xs-12"
  30502. }, [_h('button', {
  30503. staticClass: "btn btn-primary",
  30504. attrs: {
  30505. "id": "loginButton",
  30506. "type": "submit"
  30507. }
  30508. }, ["\n Reset my password\n "])])])
  30509. }}]}
  30510. /***/ },
  30511. /* 302 */
  30512. /***/ function(module, exports) {
  30513. module.exports={render:function (){with(this) {
  30514. return _h('div', {
  30515. attrs: {
  30516. "id": "menu"
  30517. }
  30518. }, [_h('div', {
  30519. directives: [{
  30520. name: "show",
  30521. rawName: "v-show",
  30522. value: (isAuthenticated),
  30523. expression: "isAuthenticated"
  30524. }],
  30525. staticClass: "card-header"
  30526. }, [_h('div', {
  30527. staticClass: "row"
  30528. }, [_h('div', {
  30529. staticClass: "col-xs-6"
  30530. }, [_h('router-link', {
  30531. staticClass: "grey-link",
  30532. attrs: {
  30533. "to": {
  30534. name: 'home'
  30535. }
  30536. }
  30537. }, ["LessPass"]), " ", _h('span', {
  30538. staticClass: " hint--right",
  30539. attrs: {
  30540. "aria-label": "Save password"
  30541. },
  30542. on: {
  30543. "click": saveOrUpdatePassword
  30544. }
  30545. }, [(passwordStatus == 'DIRTY') ? _h('i', {
  30546. staticClass: "fa fa-save ml-1 fa-clickable"
  30547. }) : _e()]), " ", (passwordStatus == 'CREATED') ? _h('span', {
  30548. staticClass: "text-success"
  30549. }, [_m(0), " saved\n "]) : _e(), " ", (passwordStatus == 'UPDATED') ? _h('span', {
  30550. staticClass: "text-success"
  30551. }, [_m(1), " updated\n "]) : _e()]), " ", _h('div', {
  30552. staticClass: "col-xs-6 text-xs-right"
  30553. }, [_h('router-link', {
  30554. staticClass: "grey-link ml-1",
  30555. attrs: {
  30556. "to": {
  30557. name: 'passwords'
  30558. }
  30559. }
  30560. }, [_m(2)]), " ", _h('button', {
  30561. staticClass: "grey-link ml-1 btn btn-link p-0 m-0",
  30562. attrs: {
  30563. "type": "button"
  30564. },
  30565. on: {
  30566. "click": logout
  30567. }
  30568. }, [_m(3)])])])]), " ", _h('div', {
  30569. directives: [{
  30570. name: "show",
  30571. rawName: "v-show",
  30572. value: (isGuest),
  30573. expression: "isGuest"
  30574. }],
  30575. staticClass: "card-header card-header-dark"
  30576. }, [_h('div', {
  30577. staticClass: "row"
  30578. }, [_h('div', {
  30579. staticClass: "index-header"
  30580. }, [_h('div', {
  30581. staticClass: "col-xs-6"
  30582. }, [_h('router-link', {
  30583. staticClass: "white-link",
  30584. attrs: {
  30585. "to": {
  30586. name: 'home'
  30587. }
  30588. }
  30589. }, ["LessPass"])]), " ", _h('div', {
  30590. staticClass: "col-xs-6 text-xs-right"
  30591. }, [_h('router-link', {
  30592. staticClass: "white-link",
  30593. attrs: {
  30594. "to": {
  30595. name: 'login'
  30596. }
  30597. }
  30598. }, [_m(4)])])])])])])
  30599. }},staticRenderFns: [function (){with(this) {
  30600. return _h('i', {
  30601. staticClass: "fa fa-check ml-1 text-success"
  30602. })
  30603. }},function (){with(this) {
  30604. return _h('i', {
  30605. staticClass: "fa fa-check ml-1 text-success"
  30606. })
  30607. }},function (){with(this) {
  30608. return _h('i', {
  30609. staticClass: "fa fa-key",
  30610. attrs: {
  30611. "aria-hidden": "true"
  30612. }
  30613. })
  30614. }},function (){with(this) {
  30615. return _h('i', {
  30616. staticClass: "fa fa-sign-out",
  30617. attrs: {
  30618. "aria-hidden": "true"
  30619. }
  30620. })
  30621. }},function (){with(this) {
  30622. return _h('i', {
  30623. staticClass: "fa fa-user-secret white",
  30624. attrs: {
  30625. "aria-hidden": "true"
  30626. }
  30627. })
  30628. }}]}
  30629. /***/ },
  30630. /* 303 */
  30631. /***/ function(module, exports, __webpack_require__) {
  30632. /**
  30633. * vue-router v2.0.1
  30634. * (c) 2016 Evan You
  30635. * @license MIT
  30636. */
  30637. (function (global, factory) {
  30638. true ? module.exports = factory() :
  30639. typeof define === 'function' && define.amd ? define(factory) :
  30640. (global.VueRouter = factory());
  30641. }(this, (function () { 'use strict';
  30642. var View = {
  30643. name: 'router-view',
  30644. functional: true,
  30645. props: {
  30646. name: {
  30647. type: String,
  30648. default: 'default'
  30649. }
  30650. },
  30651. render: function render (h, ref) {
  30652. var props = ref.props;
  30653. var children = ref.children;
  30654. var parent = ref.parent;
  30655. var data = ref.data;
  30656. data.routerView = true
  30657. var route = parent.$route
  30658. var cache = parent._routerViewCache || (parent._routerViewCache = {})
  30659. var depth = 0
  30660. var inactive = false
  30661. while (parent) {
  30662. if (parent.$vnode && parent.$vnode.data.routerView) {
  30663. depth++
  30664. }
  30665. if (parent._inactive) {
  30666. inactive = true
  30667. }
  30668. parent = parent.$parent
  30669. }
  30670. data.routerViewDepth = depth
  30671. var matched = route.matched[depth]
  30672. if (!matched) {
  30673. return h()
  30674. }
  30675. var name = props.name
  30676. var component = inactive
  30677. ? cache[name]
  30678. : (cache[name] = matched.components[name])
  30679. if (!inactive) {
  30680. var hooks = data.hook || (data.hook = {})
  30681. hooks.init = function (vnode) {
  30682. matched.instances[name] = vnode.child
  30683. }
  30684. hooks.destroy = function (vnode) {
  30685. if (matched.instances[name] === vnode.child) {
  30686. matched.instances[name] = undefined
  30687. }
  30688. }
  30689. }
  30690. return h(component, data, children)
  30691. }
  30692. }
  30693. /* */
  30694. function resolvePath (
  30695. relative,
  30696. base,
  30697. append
  30698. ) {
  30699. if (relative.charAt(0) === '/') {
  30700. return relative
  30701. }
  30702. if (relative.charAt(0) === '?' || relative.charAt(0) === '#') {
  30703. return base + relative
  30704. }
  30705. var stack = base.split('/')
  30706. // remove trailing segment if:
  30707. // - not appending
  30708. // - appending to trailing slash (last segment is empty)
  30709. if (!append || !stack[stack.length - 1]) {
  30710. stack.pop()
  30711. }
  30712. // resolve relative path
  30713. var segments = relative.replace(/^\//, '').split('/')
  30714. for (var i = 0; i < segments.length; i++) {
  30715. var segment = segments[i]
  30716. if (segment === '.') {
  30717. continue
  30718. } else if (segment === '..') {
  30719. stack.pop()
  30720. } else {
  30721. stack.push(segment)
  30722. }
  30723. }
  30724. // ensure leading slash
  30725. if (stack[0] !== '') {
  30726. stack.unshift('')
  30727. }
  30728. return stack.join('/')
  30729. }
  30730. function parsePath (path) {
  30731. var hash = ''
  30732. var query = ''
  30733. var hashIndex = path.indexOf('#')
  30734. if (hashIndex >= 0) {
  30735. hash = path.slice(hashIndex)
  30736. path = path.slice(0, hashIndex)
  30737. }
  30738. var queryIndex = path.indexOf('?')
  30739. if (queryIndex >= 0) {
  30740. query = path.slice(queryIndex + 1)
  30741. path = path.slice(0, queryIndex)
  30742. }
  30743. return {
  30744. path: path,
  30745. query: query,
  30746. hash: hash
  30747. }
  30748. }
  30749. function cleanPath (path) {
  30750. return path.replace(/\/\//g, '/')
  30751. }
  30752. /* */
  30753. function assert (condition, message) {
  30754. if (!condition) {
  30755. throw new Error(("[vue-router] " + message))
  30756. }
  30757. }
  30758. function warn (condition, message) {
  30759. if (!condition) {
  30760. typeof console !== 'undefined' && console.warn(("[vue-router] " + message))
  30761. }
  30762. }
  30763. /* */
  30764. var encode = encodeURIComponent
  30765. var decode = decodeURIComponent
  30766. function resolveQuery (
  30767. query,
  30768. extraQuery
  30769. ) {
  30770. if ( extraQuery === void 0 ) extraQuery = {};
  30771. if (query) {
  30772. var parsedQuery
  30773. try {
  30774. parsedQuery = parseQuery(query)
  30775. } catch (e) {
  30776. warn(false, e.message)
  30777. parsedQuery = {}
  30778. }
  30779. for (var key in extraQuery) {
  30780. parsedQuery[key] = extraQuery[key]
  30781. }
  30782. return parsedQuery
  30783. } else {
  30784. return extraQuery
  30785. }
  30786. }
  30787. function parseQuery (query) {
  30788. var res = Object.create(null)
  30789. query = query.trim().replace(/^(\?|#|&)/, '')
  30790. if (!query) {
  30791. return res
  30792. }
  30793. query.split('&').forEach(function (param) {
  30794. var parts = param.replace(/\+/g, ' ').split('=')
  30795. var key = decode(parts.shift())
  30796. var val = parts.length > 0
  30797. ? decode(parts.join('='))
  30798. : null
  30799. if (res[key] === undefined) {
  30800. res[key] = val
  30801. } else if (Array.isArray(res[key])) {
  30802. res[key].push(val)
  30803. } else {
  30804. res[key] = [res[key], val]
  30805. }
  30806. })
  30807. return res
  30808. }
  30809. function stringifyQuery (obj) {
  30810. var res = obj ? Object.keys(obj).sort().map(function (key) {
  30811. var val = obj[key]
  30812. if (val === undefined) {
  30813. return ''
  30814. }
  30815. if (val === null) {
  30816. return encode(key)
  30817. }
  30818. if (Array.isArray(val)) {
  30819. var result = []
  30820. val.slice().forEach(function (val2) {
  30821. if (val2 === undefined) {
  30822. return
  30823. }
  30824. if (val2 === null) {
  30825. result.push(encode(key))
  30826. } else {
  30827. result.push(encode(key) + '=' + encode(val2))
  30828. }
  30829. })
  30830. return result.join('&')
  30831. }
  30832. return encode(key) + '=' + encode(val)
  30833. }).filter(function (x) { return x.length > 0; }).join('&') : null
  30834. return res ? ("?" + res) : ''
  30835. }
  30836. /* */
  30837. function createRoute (
  30838. record,
  30839. location,
  30840. redirectedFrom
  30841. ) {
  30842. var route = {
  30843. name: location.name || (record && record.name),
  30844. meta: (record && record.meta) || {},
  30845. path: location.path || '/',
  30846. hash: location.hash || '',
  30847. query: location.query || {},
  30848. params: location.params || {},
  30849. fullPath: getFullPath(location),
  30850. matched: record ? formatMatch(record) : []
  30851. }
  30852. if (redirectedFrom) {
  30853. route.redirectedFrom = getFullPath(redirectedFrom)
  30854. }
  30855. return Object.freeze(route)
  30856. }
  30857. // the starting route that represents the initial state
  30858. var START = createRoute(null, {
  30859. path: '/'
  30860. })
  30861. function formatMatch (record) {
  30862. var res = []
  30863. while (record) {
  30864. res.unshift(record)
  30865. record = record.parent
  30866. }
  30867. return res
  30868. }
  30869. function getFullPath (ref) {
  30870. var path = ref.path;
  30871. var query = ref.query; if ( query === void 0 ) query = {};
  30872. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  30873. return (path || '/') + stringifyQuery(query) + hash
  30874. }
  30875. var trailingSlashRE = /\/$/
  30876. function isSameRoute (a, b) {
  30877. if (b === START) {
  30878. return a === b
  30879. } else if (!b) {
  30880. return false
  30881. } else if (a.path && b.path) {
  30882. return (
  30883. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  30884. a.hash === b.hash &&
  30885. isObjectEqual(a.query, b.query)
  30886. )
  30887. } else if (a.name && b.name) {
  30888. return (
  30889. a.name === b.name &&
  30890. a.hash === b.hash &&
  30891. isObjectEqual(a.query, b.query) &&
  30892. isObjectEqual(a.params, b.params)
  30893. )
  30894. } else {
  30895. return false
  30896. }
  30897. }
  30898. function isObjectEqual (a, b) {
  30899. if ( a === void 0 ) a = {};
  30900. if ( b === void 0 ) b = {};
  30901. var aKeys = Object.keys(a)
  30902. var bKeys = Object.keys(b)
  30903. if (aKeys.length !== bKeys.length) {
  30904. return false
  30905. }
  30906. return aKeys.every(function (key) { return String(a[key]) === String(b[key]); })
  30907. }
  30908. function isIncludedRoute (current, target) {
  30909. return (
  30910. current.path.indexOf(target.path) === 0 &&
  30911. (!target.hash || current.hash === target.hash) &&
  30912. queryIncludes(current.query, target.query)
  30913. )
  30914. }
  30915. function queryIncludes (current, target) {
  30916. for (var key in target) {
  30917. if (!(key in current)) {
  30918. return false
  30919. }
  30920. }
  30921. return true
  30922. }
  30923. /* */
  30924. function normalizeLocation (
  30925. raw,
  30926. current,
  30927. append
  30928. ) {
  30929. var next = typeof raw === 'string' ? { path: raw } : raw
  30930. if (next.name || next._normalized) {
  30931. return next
  30932. }
  30933. var parsedPath = parsePath(next.path || '')
  30934. var basePath = (current && current.path) || '/'
  30935. var path = parsedPath.path
  30936. ? resolvePath(parsedPath.path, basePath, append)
  30937. : (current && current.path) || '/'
  30938. var query = resolveQuery(parsedPath.query, next.query)
  30939. var hash = next.hash || parsedPath.hash
  30940. if (hash && hash.charAt(0) !== '#') {
  30941. hash = "#" + hash
  30942. }
  30943. return {
  30944. _normalized: true,
  30945. path: path,
  30946. query: query,
  30947. hash: hash
  30948. }
  30949. }
  30950. /* */
  30951. // work around weird flow bug
  30952. var toTypes = [String, Object]
  30953. var Link = {
  30954. name: 'router-link',
  30955. props: {
  30956. to: {
  30957. type: toTypes,
  30958. required: true
  30959. },
  30960. tag: {
  30961. type: String,
  30962. default: 'a'
  30963. },
  30964. exact: Boolean,
  30965. append: Boolean,
  30966. replace: Boolean,
  30967. activeClass: String
  30968. },
  30969. render: function render (h) {
  30970. var this$1 = this;
  30971. var router = this.$router
  30972. var current = this.$route
  30973. var to = normalizeLocation(this.to, current, this.append)
  30974. var resolved = router.match(to)
  30975. var fullPath = resolved.redirectedFrom || resolved.fullPath
  30976. var base = router.history.base
  30977. var href = base ? cleanPath(base + fullPath) : fullPath
  30978. var classes = {}
  30979. var activeClass = this.activeClass || router.options.linkActiveClass || 'router-link-active'
  30980. var compareTarget = to.path ? createRoute(null, to) : resolved
  30981. classes[activeClass] = this.exact
  30982. ? isSameRoute(current, compareTarget)
  30983. : isIncludedRoute(current, compareTarget)
  30984. var on = {
  30985. click: function (e) {
  30986. // don't redirect with control keys
  30987. /* istanbul ignore if */
  30988. if (e.metaKey || e.ctrlKey || e.shiftKey) { return }
  30989. // don't redirect when preventDefault called
  30990. /* istanbul ignore if */
  30991. if (e.defaultPrevented) { return }
  30992. // don't redirect on right click
  30993. /* istanbul ignore if */
  30994. if (e.button !== 0) { return }
  30995. e.preventDefault()
  30996. if (this$1.replace) {
  30997. router.replace(to)
  30998. } else {
  30999. router.push(to)
  31000. }
  31001. }
  31002. }
  31003. var data = {
  31004. class: classes
  31005. }
  31006. if (this.tag === 'a') {
  31007. data.on = on
  31008. data.attrs = { href: href }
  31009. } else {
  31010. // find the first <a> child and apply listener and href
  31011. var a = findAnchor(this.$slots.default)
  31012. if (a) {
  31013. var aData = a.data || (a.data = {})
  31014. aData.on = on
  31015. var aAttrs = aData.attrs || (aData.attrs = {})
  31016. aAttrs.href = href
  31017. } else {
  31018. // doesn't have <a> child, apply listener to self
  31019. data.on = on
  31020. }
  31021. }
  31022. return h(this.tag, data, this.$slots.default)
  31023. }
  31024. }
  31025. function findAnchor (children) {
  31026. if (children) {
  31027. var child
  31028. for (var i = 0; i < children.length; i++) {
  31029. child = children[i]
  31030. if (child.tag === 'a') {
  31031. return child
  31032. }
  31033. if (child.children && (child = findAnchor(child.children))) {
  31034. return child
  31035. }
  31036. }
  31037. }
  31038. }
  31039. function install (Vue) {
  31040. if (install.installed) { return }
  31041. install.installed = true
  31042. Object.defineProperty(Vue.prototype, '$router', {
  31043. get: function get () { return this.$root._router }
  31044. })
  31045. Object.defineProperty(Vue.prototype, '$route', {
  31046. get: function get$1 () { return this.$root._route }
  31047. })
  31048. Vue.mixin({
  31049. beforeCreate: function beforeCreate () {
  31050. if (this.$options.router) {
  31051. this._router = this.$options.router
  31052. this._router.init(this)
  31053. Vue.util.defineReactive(this, '_route', this._router.history.current)
  31054. }
  31055. }
  31056. })
  31057. Vue.component('router-view', View)
  31058. Vue.component('router-link', Link)
  31059. }
  31060. var __moduleExports = Array.isArray || function (arr) {
  31061. return Object.prototype.toString.call(arr) == '[object Array]';
  31062. };
  31063. var isarray = __moduleExports
  31064. /**
  31065. * Expose `pathToRegexp`.
  31066. */
  31067. var index = pathToRegexp
  31068. var parse_1 = parse
  31069. var compile_1 = compile
  31070. var tokensToFunction_1 = tokensToFunction
  31071. var tokensToRegExp_1 = tokensToRegExp
  31072. /**
  31073. * The main path matching regexp utility.
  31074. *
  31075. * @type {RegExp}
  31076. */
  31077. var PATH_REGEXP = new RegExp([
  31078. // Match escaped characters that would otherwise appear in future matches.
  31079. // This allows the user to escape special characters that won't transform.
  31080. '(\\\\.)',
  31081. // Match Express-style parameters and un-named parameters with a prefix
  31082. // and optional suffixes. Matches appear as:
  31083. //
  31084. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  31085. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  31086. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  31087. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  31088. ].join('|'), 'g')
  31089. /**
  31090. * Parse a string for the raw tokens.
  31091. *
  31092. * @param {string} str
  31093. * @return {!Array}
  31094. */
  31095. function parse (str) {
  31096. var tokens = []
  31097. var key = 0
  31098. var index = 0
  31099. var path = ''
  31100. var res
  31101. while ((res = PATH_REGEXP.exec(str)) != null) {
  31102. var m = res[0]
  31103. var escaped = res[1]
  31104. var offset = res.index
  31105. path += str.slice(index, offset)
  31106. index = offset + m.length
  31107. // Ignore already escaped sequences.
  31108. if (escaped) {
  31109. path += escaped[1]
  31110. continue
  31111. }
  31112. var next = str[index]
  31113. var prefix = res[2]
  31114. var name = res[3]
  31115. var capture = res[4]
  31116. var group = res[5]
  31117. var modifier = res[6]
  31118. var asterisk = res[7]
  31119. // Push the current path onto the tokens.
  31120. if (path) {
  31121. tokens.push(path)
  31122. path = ''
  31123. }
  31124. var partial = prefix != null && next != null && next !== prefix
  31125. var repeat = modifier === '+' || modifier === '*'
  31126. var optional = modifier === '?' || modifier === '*'
  31127. var delimiter = res[2] || '/'
  31128. var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?')
  31129. tokens.push({
  31130. name: name || key++,
  31131. prefix: prefix || '',
  31132. delimiter: delimiter,
  31133. optional: optional,
  31134. repeat: repeat,
  31135. partial: partial,
  31136. asterisk: !!asterisk,
  31137. pattern: escapeGroup(pattern)
  31138. })
  31139. }
  31140. // Match any characters still remaining.
  31141. if (index < str.length) {
  31142. path += str.substr(index)
  31143. }
  31144. // If the path exists, push it onto the end.
  31145. if (path) {
  31146. tokens.push(path)
  31147. }
  31148. return tokens
  31149. }
  31150. /**
  31151. * Compile a string to a template function for the path.
  31152. *
  31153. * @param {string} str
  31154. * @return {!function(Object=, Object=)}
  31155. */
  31156. function compile (str) {
  31157. return tokensToFunction(parse(str))
  31158. }
  31159. /**
  31160. * Prettier encoding of URI path segments.
  31161. *
  31162. * @param {string}
  31163. * @return {string}
  31164. */
  31165. function encodeURIComponentPretty (str) {
  31166. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  31167. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  31168. })
  31169. }
  31170. /**
  31171. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  31172. *
  31173. * @param {string}
  31174. * @return {string}
  31175. */
  31176. function encodeAsterisk (str) {
  31177. return encodeURI(str).replace(/[?#]/g, function (c) {
  31178. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  31179. })
  31180. }
  31181. /**
  31182. * Expose a method for transforming tokens into the path function.
  31183. */
  31184. function tokensToFunction (tokens) {
  31185. // Compile all the tokens into regexps.
  31186. var matches = new Array(tokens.length)
  31187. // Compile all the patterns before compilation.
  31188. for (var i = 0; i < tokens.length; i++) {
  31189. if (typeof tokens[i] === 'object') {
  31190. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')
  31191. }
  31192. }
  31193. return function (obj, opts) {
  31194. var path = ''
  31195. var data = obj || {}
  31196. var options = opts || {}
  31197. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
  31198. for (var i = 0; i < tokens.length; i++) {
  31199. var token = tokens[i]
  31200. if (typeof token === 'string') {
  31201. path += token
  31202. continue
  31203. }
  31204. var value = data[token.name]
  31205. var segment
  31206. if (value == null) {
  31207. if (token.optional) {
  31208. // Prepend partial segment prefixes.
  31209. if (token.partial) {
  31210. path += token.prefix
  31211. }
  31212. continue
  31213. } else {
  31214. throw new TypeError('Expected "' + token.name + '" to be defined')
  31215. }
  31216. }
  31217. if (isarray(value)) {
  31218. if (!token.repeat) {
  31219. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  31220. }
  31221. if (value.length === 0) {
  31222. if (token.optional) {
  31223. continue
  31224. } else {
  31225. throw new TypeError('Expected "' + token.name + '" to not be empty')
  31226. }
  31227. }
  31228. for (var j = 0; j < value.length; j++) {
  31229. segment = encode(value[j])
  31230. if (!matches[i].test(segment)) {
  31231. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  31232. }
  31233. path += (j === 0 ? token.prefix : token.delimiter) + segment
  31234. }
  31235. continue
  31236. }
  31237. segment = token.asterisk ? encodeAsterisk(value) : encode(value)
  31238. if (!matches[i].test(segment)) {
  31239. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  31240. }
  31241. path += token.prefix + segment
  31242. }
  31243. return path
  31244. }
  31245. }
  31246. /**
  31247. * Escape a regular expression string.
  31248. *
  31249. * @param {string} str
  31250. * @return {string}
  31251. */
  31252. function escapeString (str) {
  31253. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  31254. }
  31255. /**
  31256. * Escape the capturing group by escaping special characters and meaning.
  31257. *
  31258. * @param {string} group
  31259. * @return {string}
  31260. */
  31261. function escapeGroup (group) {
  31262. return group.replace(/([=!:$\/()])/g, '\\$1')
  31263. }
  31264. /**
  31265. * Attach the keys as a property of the regexp.
  31266. *
  31267. * @param {!RegExp} re
  31268. * @param {Array} keys
  31269. * @return {!RegExp}
  31270. */
  31271. function attachKeys (re, keys) {
  31272. re.keys = keys
  31273. return re
  31274. }
  31275. /**
  31276. * Get the flags for a regexp from the options.
  31277. *
  31278. * @param {Object} options
  31279. * @return {string}
  31280. */
  31281. function flags (options) {
  31282. return options.sensitive ? '' : 'i'
  31283. }
  31284. /**
  31285. * Pull out keys from a regexp.
  31286. *
  31287. * @param {!RegExp} path
  31288. * @param {!Array} keys
  31289. * @return {!RegExp}
  31290. */
  31291. function regexpToRegexp (path, keys) {
  31292. // Use a negative lookahead to match only capturing groups.
  31293. var groups = path.source.match(/\((?!\?)/g)
  31294. if (groups) {
  31295. for (var i = 0; i < groups.length; i++) {
  31296. keys.push({
  31297. name: i,
  31298. prefix: null,
  31299. delimiter: null,
  31300. optional: false,
  31301. repeat: false,
  31302. partial: false,
  31303. asterisk: false,
  31304. pattern: null
  31305. })
  31306. }
  31307. }
  31308. return attachKeys(path, keys)
  31309. }
  31310. /**
  31311. * Transform an array into a regexp.
  31312. *
  31313. * @param {!Array} path
  31314. * @param {Array} keys
  31315. * @param {!Object} options
  31316. * @return {!RegExp}
  31317. */
  31318. function arrayToRegexp (path, keys, options) {
  31319. var parts = []
  31320. for (var i = 0; i < path.length; i++) {
  31321. parts.push(pathToRegexp(path[i], keys, options).source)
  31322. }
  31323. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
  31324. return attachKeys(regexp, keys)
  31325. }
  31326. /**
  31327. * Create a path regexp from string input.
  31328. *
  31329. * @param {string} path
  31330. * @param {!Array} keys
  31331. * @param {!Object} options
  31332. * @return {!RegExp}
  31333. */
  31334. function stringToRegexp (path, keys, options) {
  31335. var tokens = parse(path)
  31336. var re = tokensToRegExp(tokens, options)
  31337. // Attach keys back to the regexp.
  31338. for (var i = 0; i < tokens.length; i++) {
  31339. if (typeof tokens[i] !== 'string') {
  31340. keys.push(tokens[i])
  31341. }
  31342. }
  31343. return attachKeys(re, keys)
  31344. }
  31345. /**
  31346. * Expose a function for taking tokens and returning a RegExp.
  31347. *
  31348. * @param {!Array} tokens
  31349. * @param {Object=} options
  31350. * @return {!RegExp}
  31351. */
  31352. function tokensToRegExp (tokens, options) {
  31353. options = options || {}
  31354. var strict = options.strict
  31355. var end = options.end !== false
  31356. var route = ''
  31357. var lastToken = tokens[tokens.length - 1]
  31358. var endsWithSlash = typeof lastToken === 'string' && /\/$/.test(lastToken)
  31359. // Iterate over the tokens and create our regexp string.
  31360. for (var i = 0; i < tokens.length; i++) {
  31361. var token = tokens[i]
  31362. if (typeof token === 'string') {
  31363. route += escapeString(token)
  31364. } else {
  31365. var prefix = escapeString(token.prefix)
  31366. var capture = '(?:' + token.pattern + ')'
  31367. if (token.repeat) {
  31368. capture += '(?:' + prefix + capture + ')*'
  31369. }
  31370. if (token.optional) {
  31371. if (!token.partial) {
  31372. capture = '(?:' + prefix + '(' + capture + '))?'
  31373. } else {
  31374. capture = prefix + '(' + capture + ')?'
  31375. }
  31376. } else {
  31377. capture = prefix + '(' + capture + ')'
  31378. }
  31379. route += capture
  31380. }
  31381. }
  31382. // In non-strict mode we allow a slash at the end of match. If the path to
  31383. // match already ends with a slash, we remove it for consistency. The slash
  31384. // is valid at the end of a path match, not in the middle. This is important
  31385. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  31386. if (!strict) {
  31387. route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?'
  31388. }
  31389. if (end) {
  31390. route += '$'
  31391. } else {
  31392. // In non-ending mode, we need the capturing groups to match as much as
  31393. // possible by using a positive lookahead to the end or next path segment.
  31394. route += strict && endsWithSlash ? '' : '(?=\\/|$)'
  31395. }
  31396. return new RegExp('^' + route, flags(options))
  31397. }
  31398. /**
  31399. * Normalize the given path string, returning a regular expression.
  31400. *
  31401. * An empty array can be passed in for the keys, which will hold the
  31402. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  31403. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  31404. *
  31405. * @param {(string|RegExp|Array)} path
  31406. * @param {(Array|Object)=} keys
  31407. * @param {Object=} options
  31408. * @return {!RegExp}
  31409. */
  31410. function pathToRegexp (path, keys, options) {
  31411. keys = keys || []
  31412. if (!isarray(keys)) {
  31413. options = /** @type {!Object} */ (keys)
  31414. keys = []
  31415. } else if (!options) {
  31416. options = {}
  31417. }
  31418. if (path instanceof RegExp) {
  31419. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  31420. }
  31421. if (isarray(path)) {
  31422. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  31423. }
  31424. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  31425. }
  31426. index.parse = parse_1;
  31427. index.compile = compile_1;
  31428. index.tokensToFunction = tokensToFunction_1;
  31429. index.tokensToRegExp = tokensToRegExp_1;
  31430. /* */
  31431. function createRouteMap (routes) {
  31432. var pathMap = Object.create(null)
  31433. var nameMap = Object.create(null)
  31434. routes.forEach(function (route) {
  31435. addRouteRecord(pathMap, nameMap, route)
  31436. })
  31437. return {
  31438. pathMap: pathMap,
  31439. nameMap: nameMap
  31440. }
  31441. }
  31442. function addRouteRecord (
  31443. pathMap,
  31444. nameMap,
  31445. route,
  31446. parent,
  31447. matchAs
  31448. ) {
  31449. var path = route.path;
  31450. var name = route.name;
  31451. assert(path != null, "\"path\" is required in a route configuration.")
  31452. var record = {
  31453. path: normalizePath(path, parent),
  31454. components: route.components || { default: route.component },
  31455. instances: {},
  31456. name: name,
  31457. parent: parent,
  31458. matchAs: matchAs,
  31459. redirect: route.redirect,
  31460. beforeEnter: route.beforeEnter,
  31461. meta: route.meta || {}
  31462. }
  31463. if (route.children) {
  31464. // Warn if route is named and has a default child route.
  31465. // If users navigate to this route by name, the default child will
  31466. // not be rendered (GH Issue #629)
  31467. if (false) {}
  31468. route.children.forEach(function (child) {
  31469. addRouteRecord(pathMap, nameMap, child, record)
  31470. })
  31471. }
  31472. if (route.alias) {
  31473. if (Array.isArray(route.alias)) {
  31474. route.alias.forEach(function (alias) {
  31475. addRouteRecord(pathMap, nameMap, { path: alias }, parent, record.path)
  31476. })
  31477. } else {
  31478. addRouteRecord(pathMap, nameMap, { path: route.alias }, parent, record.path)
  31479. }
  31480. }
  31481. pathMap[record.path] = record
  31482. if (name) { nameMap[name] = record }
  31483. }
  31484. function normalizePath (path, parent) {
  31485. path = path.replace(/\/$/, '')
  31486. if (path[0] === '/') { return path }
  31487. if (parent == null) { return path }
  31488. return cleanPath(((parent.path) + "/" + path))
  31489. }
  31490. /* */
  31491. var regexpCache = Object.create(null)
  31492. var regexpCompileCache = Object.create(null)
  31493. function createMatcher (routes) {
  31494. var ref = createRouteMap(routes);
  31495. var pathMap = ref.pathMap;
  31496. var nameMap = ref.nameMap;
  31497. function match (
  31498. raw,
  31499. currentRoute,
  31500. redirectedFrom
  31501. ) {
  31502. var location = normalizeLocation(raw, currentRoute)
  31503. var name = location.name;
  31504. if (name) {
  31505. var record = nameMap[name]
  31506. if (record) {
  31507. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""))
  31508. return _createRoute(record, location, redirectedFrom)
  31509. }
  31510. } else if (location.path) {
  31511. location.params = {}
  31512. for (var path in pathMap) {
  31513. if (matchRoute(path, location.params, location.path)) {
  31514. return _createRoute(pathMap[path], location, redirectedFrom)
  31515. }
  31516. }
  31517. }
  31518. // no match
  31519. return _createRoute(null, location)
  31520. }
  31521. function redirect (
  31522. record,
  31523. location
  31524. ) {
  31525. var originalRedirect = record.redirect
  31526. var redirect = typeof originalRedirect === 'function'
  31527. ? originalRedirect(createRoute(record, location))
  31528. : originalRedirect
  31529. if (typeof redirect === 'string') {
  31530. redirect = { path: redirect }
  31531. }
  31532. if (!redirect || typeof redirect !== 'object') {
  31533. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))))
  31534. return _createRoute(null, location)
  31535. }
  31536. var re = redirect
  31537. var name = re.name;
  31538. var path = re.path;
  31539. var query = location.query;
  31540. var hash = location.hash;
  31541. var params = location.params;
  31542. query = re.hasOwnProperty('query') ? re.query : query
  31543. hash = re.hasOwnProperty('hash') ? re.hash : hash
  31544. params = re.hasOwnProperty('params') ? re.params : params
  31545. if (name) {
  31546. // resolved named direct
  31547. var targetRecord = nameMap[name]
  31548. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."))
  31549. return match({
  31550. _normalized: true,
  31551. name: name,
  31552. query: query,
  31553. hash: hash,
  31554. params: params
  31555. }, undefined, location)
  31556. } else if (path) {
  31557. // 1. resolve relative redirect
  31558. var rawPath = resolveRecordPath(path, record)
  31559. // 2. resolve params
  31560. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""))
  31561. // 3. rematch with existing query and hash
  31562. return match({
  31563. _normalized: true,
  31564. path: resolvedPath,
  31565. query: query,
  31566. hash: hash
  31567. }, undefined, location)
  31568. } else {
  31569. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))))
  31570. return _createRoute(null, location)
  31571. }
  31572. }
  31573. function alias (
  31574. record,
  31575. location,
  31576. matchAs
  31577. ) {
  31578. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""))
  31579. var aliasedMatch = match({
  31580. _normalized: true,
  31581. path: aliasedPath
  31582. })
  31583. if (aliasedMatch) {
  31584. var matched = aliasedMatch.matched
  31585. var aliasedRecord = matched[matched.length - 1]
  31586. location.params = aliasedMatch.params
  31587. return _createRoute(aliasedRecord, location)
  31588. }
  31589. return _createRoute(null, location)
  31590. }
  31591. function _createRoute (
  31592. record,
  31593. location,
  31594. redirectedFrom
  31595. ) {
  31596. if (record && record.redirect) {
  31597. return redirect(record, redirectedFrom || location)
  31598. }
  31599. if (record && record.matchAs) {
  31600. return alias(record, location, record.matchAs)
  31601. }
  31602. return createRoute(record, location, redirectedFrom)
  31603. }
  31604. return match
  31605. }
  31606. function matchRoute (
  31607. path,
  31608. params,
  31609. pathname
  31610. ) {
  31611. var keys, regexp
  31612. var hit = regexpCache[path]
  31613. if (hit) {
  31614. keys = hit.keys
  31615. regexp = hit.regexp
  31616. } else {
  31617. keys = []
  31618. regexp = index(path, keys)
  31619. regexpCache[path] = { keys: keys, regexp: regexp }
  31620. }
  31621. var m = pathname.match(regexp)
  31622. if (!m) {
  31623. return false
  31624. } else if (!params) {
  31625. return true
  31626. }
  31627. for (var i = 1, len = m.length; i < len; ++i) {
  31628. var key = keys[i - 1]
  31629. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i]
  31630. if (key) { params[key.name] = val }
  31631. }
  31632. return true
  31633. }
  31634. function fillParams (
  31635. path,
  31636. params,
  31637. routeMsg
  31638. ) {
  31639. try {
  31640. var filler =
  31641. regexpCompileCache[path] ||
  31642. (regexpCompileCache[path] = index.compile(path))
  31643. return filler(params || {}, { pretty: true })
  31644. } catch (e) {
  31645. assert(false, ("missing param for " + routeMsg + ": " + (e.message)))
  31646. return ''
  31647. }
  31648. }
  31649. function resolveRecordPath (path, record) {
  31650. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  31651. }
  31652. /* */
  31653. var inBrowser = typeof window !== 'undefined'
  31654. var supportsHistory = inBrowser && (function () {
  31655. var ua = window.navigator.userAgent
  31656. if (
  31657. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  31658. ua.indexOf('Mobile Safari') !== -1 &&
  31659. ua.indexOf('Chrome') === -1 &&
  31660. ua.indexOf('Windows Phone') === -1
  31661. ) {
  31662. return false
  31663. }
  31664. return window.history && 'pushState' in window.history
  31665. })()
  31666. /* */
  31667. function runQueue (queue, fn, cb) {
  31668. var step = function (index) {
  31669. if (index >= queue.length) {
  31670. cb()
  31671. } else {
  31672. if (queue[index]) {
  31673. fn(queue[index], function () {
  31674. step(index + 1)
  31675. })
  31676. } else {
  31677. step(index + 1)
  31678. }
  31679. }
  31680. }
  31681. step(0)
  31682. }
  31683. /* */
  31684. var History = function History (router, base) {
  31685. this.router = router
  31686. this.base = normalizeBase(base)
  31687. // start with a route object that stands for "nowhere"
  31688. this.current = START
  31689. this.pending = null
  31690. };
  31691. History.prototype.listen = function listen (cb) {
  31692. this.cb = cb
  31693. };
  31694. History.prototype.transitionTo = function transitionTo (location, cb) {
  31695. var this$1 = this;
  31696. var route = this.router.match(location, this.current)
  31697. this.confirmTransition(route, function () {
  31698. this$1.updateRoute(route)
  31699. cb && cb(route)
  31700. this$1.ensureURL()
  31701. })
  31702. };
  31703. History.prototype.confirmTransition = function confirmTransition (route, cb) {
  31704. var this$1 = this;
  31705. var current = this.current
  31706. if (isSameRoute(route, current)) {
  31707. this.ensureURL()
  31708. return
  31709. }
  31710. var ref = resolveQueue(this.current.matched, route.matched);
  31711. var deactivated = ref.deactivated;
  31712. var activated = ref.activated;
  31713. var queue = [].concat(
  31714. // in-component leave guards
  31715. extractLeaveGuards(deactivated),
  31716. // global before hooks
  31717. this.router.beforeHooks,
  31718. // enter guards
  31719. activated.map(function (m) { return m.beforeEnter; }),
  31720. // async components
  31721. resolveAsyncComponents(activated)
  31722. )
  31723. this.pending = route
  31724. var iterator = function (hook, next) {
  31725. if (this$1.pending !== route) { return }
  31726. hook(route, current, function (to) {
  31727. if (to === false) {
  31728. // next(false) -> abort navigation, ensure current URL
  31729. this$1.ensureURL()
  31730. } else if (typeof to === 'string' || typeof to === 'object') {
  31731. // next('/') or next({ path: '/' }) -> redirect
  31732. this$1.push(to)
  31733. } else {
  31734. // confirm transition and pass on the value
  31735. next(to)
  31736. }
  31737. })
  31738. }
  31739. runQueue(queue, iterator, function () {
  31740. var postEnterCbs = []
  31741. var enterGuards = extractEnterGuards(activated, postEnterCbs, function () {
  31742. return this$1.current === route
  31743. })
  31744. // wait until async components are resolved before
  31745. // extracting in-component enter guards
  31746. runQueue(enterGuards, iterator, function () {
  31747. if (this$1.pending === route) {
  31748. this$1.pending = null
  31749. cb(route)
  31750. this$1.router.app.$nextTick(function () {
  31751. postEnterCbs.forEach(function (cb) { return cb(); })
  31752. })
  31753. }
  31754. })
  31755. })
  31756. };
  31757. History.prototype.updateRoute = function updateRoute (route) {
  31758. var prev = this.current
  31759. this.current = route
  31760. this.cb && this.cb(route)
  31761. this.router.afterHooks.forEach(function (hook) {
  31762. hook && hook(route, prev)
  31763. })
  31764. };
  31765. function normalizeBase (base) {
  31766. if (!base) {
  31767. if (inBrowser) {
  31768. // respect <base> tag
  31769. var baseEl = document.querySelector('base')
  31770. base = baseEl ? baseEl.getAttribute('href') : '/'
  31771. } else {
  31772. base = '/'
  31773. }
  31774. }
  31775. // make sure there's the starting slash
  31776. if (base.charAt(0) !== '/') {
  31777. base = '/' + base
  31778. }
  31779. // remove trailing slash
  31780. return base.replace(/\/$/, '')
  31781. }
  31782. function resolveQueue (
  31783. current,
  31784. next
  31785. ) {
  31786. var i
  31787. var max = Math.max(current.length, next.length)
  31788. for (i = 0; i < max; i++) {
  31789. if (current[i] !== next[i]) {
  31790. break
  31791. }
  31792. }
  31793. return {
  31794. activated: next.slice(i),
  31795. deactivated: current.slice(i)
  31796. }
  31797. }
  31798. function extractLeaveGuards (matched) {
  31799. return flatMapComponents(matched, function (def, instance) {
  31800. var guard = def && def.beforeRouteLeave
  31801. if (guard) {
  31802. return function routeLeaveGuard () {
  31803. return guard.apply(instance, arguments)
  31804. }
  31805. }
  31806. }).reverse()
  31807. }
  31808. function extractEnterGuards (
  31809. matched,
  31810. cbs,
  31811. isValid
  31812. ) {
  31813. return flatMapComponents(matched, function (def, _, match, key) {
  31814. var guard = def && def.beforeRouteEnter
  31815. if (guard) {
  31816. return function routeEnterGuard (to, from, next) {
  31817. return guard(to, from, function (cb) {
  31818. next(cb)
  31819. if (typeof cb === 'function') {
  31820. cbs.push(function () {
  31821. // #750
  31822. // if a router-view is wrapped with an out-in transition,
  31823. // the instance may not have been registered at this time.
  31824. // we will need to poll for registration until current route
  31825. // is no longer valid.
  31826. poll(cb, match.instances, key, isValid)
  31827. })
  31828. }
  31829. })
  31830. }
  31831. }
  31832. })
  31833. }
  31834. function poll (cb, instances, key, isValid) {
  31835. if (instances[key]) {
  31836. cb(instances[key])
  31837. } else if (isValid()) {
  31838. setTimeout(function () {
  31839. poll(cb, instances, key, isValid)
  31840. }, 16)
  31841. }
  31842. }
  31843. function resolveAsyncComponents (matched) {
  31844. return flatMapComponents(matched, function (def, _, match, key) {
  31845. // if it's a function and doesn't have Vue options attached,
  31846. // assume it's an async component resolve function.
  31847. // we are not using Vue's default async resolving mechanism because
  31848. // we want to halt the navigation until the incoming component has been
  31849. // resolved.
  31850. if (typeof def === 'function' && !def.options) {
  31851. return function (to, from, next) {
  31852. var resolve = function (resolvedDef) {
  31853. match.components[key] = resolvedDef
  31854. next()
  31855. }
  31856. var reject = function (reason) {
  31857. warn(false, ("Failed to resolve async component " + key + ": " + reason))
  31858. next(false)
  31859. }
  31860. var res = def(resolve, reject)
  31861. if (res && typeof res.then === 'function') {
  31862. res.then(resolve, reject)
  31863. }
  31864. }
  31865. }
  31866. })
  31867. }
  31868. function flatMapComponents (
  31869. matched,
  31870. fn
  31871. ) {
  31872. return Array.prototype.concat.apply([], matched.map(function (m) {
  31873. return Object.keys(m.components).map(function (key) { return fn(
  31874. m.components[key],
  31875. m.instances[key],
  31876. m, key
  31877. ); })
  31878. }))
  31879. }
  31880. /* */
  31881. function saveScrollPosition (key) {
  31882. if (!key) { return }
  31883. window.sessionStorage.setItem(key, JSON.stringify({
  31884. x: window.pageXOffset,
  31885. y: window.pageYOffset
  31886. }))
  31887. }
  31888. function getScrollPosition (key) {
  31889. if (!key) { return }
  31890. return JSON.parse(window.sessionStorage.getItem(key))
  31891. }
  31892. function getElementPosition (el) {
  31893. var docRect = document.documentElement.getBoundingClientRect()
  31894. var elRect = el.getBoundingClientRect()
  31895. return {
  31896. x: elRect.left - docRect.left,
  31897. y: elRect.top - docRect.top
  31898. }
  31899. }
  31900. function isValidPosition (obj) {
  31901. return isNumber(obj.x) || isNumber(obj.y)
  31902. }
  31903. function normalizePosition (obj) {
  31904. return {
  31905. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  31906. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  31907. }
  31908. }
  31909. function isNumber (v) {
  31910. return typeof v === 'number'
  31911. }
  31912. /* */
  31913. var genKey = function () { return String(Date.now()); }
  31914. var _key = genKey()
  31915. var HTML5History = (function (History) {
  31916. function HTML5History (router, base) {
  31917. var this$1 = this;
  31918. History.call(this, router, base)
  31919. this.transitionTo(getLocation(this.base))
  31920. var expectScroll = router.options.scrollBehavior
  31921. window.addEventListener('popstate', function (e) {
  31922. _key = e.state && e.state.key
  31923. var current = this$1.current
  31924. this$1.transitionTo(getLocation(this$1.base), function (next) {
  31925. if (expectScroll) {
  31926. this$1.handleScroll(next, current, true)
  31927. }
  31928. })
  31929. })
  31930. if (expectScroll) {
  31931. window.addEventListener('scroll', function () {
  31932. saveScrollPosition(_key)
  31933. })
  31934. }
  31935. }
  31936. if ( History ) HTML5History.__proto__ = History;
  31937. HTML5History.prototype = Object.create( History && History.prototype );
  31938. HTML5History.prototype.constructor = HTML5History;
  31939. HTML5History.prototype.go = function go (n) {
  31940. window.history.go(n)
  31941. };
  31942. HTML5History.prototype.push = function push (location) {
  31943. var this$1 = this;
  31944. var current = this.current
  31945. this.transitionTo(location, function (route) {
  31946. pushState(cleanPath(this$1.base + route.fullPath))
  31947. this$1.handleScroll(route, current, false)
  31948. })
  31949. };
  31950. HTML5History.prototype.replace = function replace (location) {
  31951. var this$1 = this;
  31952. var current = this.current
  31953. this.transitionTo(location, function (route) {
  31954. replaceState(cleanPath(this$1.base + route.fullPath))
  31955. this$1.handleScroll(route, current, false)
  31956. })
  31957. };
  31958. HTML5History.prototype.ensureURL = function ensureURL () {
  31959. if (getLocation(this.base) !== this.current.fullPath) {
  31960. replaceState(cleanPath(this.base + this.current.fullPath))
  31961. }
  31962. };
  31963. HTML5History.prototype.handleScroll = function handleScroll (to, from, isPop) {
  31964. var router = this.router
  31965. if (!router.app) {
  31966. return
  31967. }
  31968. var behavior = router.options.scrollBehavior
  31969. if (!behavior) {
  31970. return
  31971. }
  31972. assert(typeof behavior === 'function', "scrollBehavior must be a function")
  31973. // wait until re-render finishes before scrolling
  31974. router.app.$nextTick(function () {
  31975. var position = getScrollPosition(_key)
  31976. var shouldScroll = behavior(to, from, isPop ? position : null)
  31977. if (!shouldScroll) {
  31978. return
  31979. }
  31980. var isObject = typeof shouldScroll === 'object'
  31981. if (isObject && typeof shouldScroll.selector === 'string') {
  31982. var el = document.querySelector(shouldScroll.selector)
  31983. if (el) {
  31984. position = getElementPosition(el)
  31985. } else if (isValidPosition(shouldScroll)) {
  31986. position = normalizePosition(shouldScroll)
  31987. }
  31988. } else if (isObject && isValidPosition(shouldScroll)) {
  31989. position = normalizePosition(shouldScroll)
  31990. }
  31991. if (position) {
  31992. window.scrollTo(position.x, position.y)
  31993. }
  31994. })
  31995. };
  31996. return HTML5History;
  31997. }(History));
  31998. function getLocation (base) {
  31999. var path = window.location.pathname
  32000. if (base && path.indexOf(base) === 0) {
  32001. path = path.slice(base.length)
  32002. }
  32003. return (path || '/') + window.location.search + window.location.hash
  32004. }
  32005. function pushState (url, replace) {
  32006. // try...catch the pushState call to get around Safari
  32007. // DOM Exception 18 where it limits to 100 pushState calls
  32008. var history = window.history
  32009. try {
  32010. if (replace) {
  32011. history.replaceState({ key: _key }, '', url)
  32012. } else {
  32013. _key = genKey()
  32014. history.pushState({ key: _key }, '', url)
  32015. }
  32016. saveScrollPosition(_key)
  32017. } catch (e) {
  32018. window.location[replace ? 'assign' : 'replace'](url)
  32019. }
  32020. }
  32021. function replaceState (url) {
  32022. pushState(url, true)
  32023. }
  32024. /* */
  32025. var HashHistory = (function (History) {
  32026. function HashHistory (router, base, fallback) {
  32027. var this$1 = this;
  32028. History.call(this, router, base)
  32029. // check history fallback deeplinking
  32030. if (fallback && this.checkFallback()) {
  32031. return
  32032. }
  32033. ensureSlash()
  32034. this.transitionTo(getHash(), function () {
  32035. window.addEventListener('hashchange', function () {
  32036. this$1.onHashChange()
  32037. })
  32038. })
  32039. }
  32040. if ( History ) HashHistory.__proto__ = History;
  32041. HashHistory.prototype = Object.create( History && History.prototype );
  32042. HashHistory.prototype.constructor = HashHistory;
  32043. HashHistory.prototype.checkFallback = function checkFallback () {
  32044. var location = getLocation(this.base)
  32045. if (!/^\/#/.test(location)) {
  32046. window.location.replace(
  32047. cleanPath(this.base + '/#' + location)
  32048. )
  32049. return true
  32050. }
  32051. };
  32052. HashHistory.prototype.onHashChange = function onHashChange () {
  32053. if (!ensureSlash()) {
  32054. return
  32055. }
  32056. this.transitionTo(getHash(), function (route) {
  32057. replaceHash(route.fullPath)
  32058. })
  32059. };
  32060. HashHistory.prototype.push = function push (location) {
  32061. this.transitionTo(location, function (route) {
  32062. pushHash(route.fullPath)
  32063. })
  32064. };
  32065. HashHistory.prototype.replace = function replace (location) {
  32066. this.transitionTo(location, function (route) {
  32067. replaceHash(route.fullPath)
  32068. })
  32069. };
  32070. HashHistory.prototype.go = function go (n) {
  32071. window.history.go(n)
  32072. };
  32073. HashHistory.prototype.ensureURL = function ensureURL () {
  32074. if (getHash() !== this.current.fullPath) {
  32075. replaceHash(this.current.fullPath)
  32076. }
  32077. };
  32078. return HashHistory;
  32079. }(History));
  32080. function ensureSlash () {
  32081. var path = getHash()
  32082. if (path.charAt(0) === '/') {
  32083. return true
  32084. }
  32085. replaceHash('/' + path)
  32086. return false
  32087. }
  32088. function getHash () {
  32089. // We can't use window.location.hash here because it's not
  32090. // consistent across browsers - Firefox will pre-decode it!
  32091. var href = window.location.href
  32092. var index = href.indexOf('#')
  32093. return index === -1 ? '' : href.slice(index + 1)
  32094. }
  32095. function pushHash (path) {
  32096. window.location.hash = path
  32097. }
  32098. function replaceHash (path) {
  32099. var i = window.location.href.indexOf('#')
  32100. window.location.replace(
  32101. window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path
  32102. )
  32103. }
  32104. /* */
  32105. var AbstractHistory = (function (History) {
  32106. function AbstractHistory (router) {
  32107. History.call(this, router)
  32108. this.stack = []
  32109. this.index = -1
  32110. }
  32111. if ( History ) AbstractHistory.__proto__ = History;
  32112. AbstractHistory.prototype = Object.create( History && History.prototype );
  32113. AbstractHistory.prototype.constructor = AbstractHistory;
  32114. AbstractHistory.prototype.push = function push (location) {
  32115. var this$1 = this;
  32116. this.transitionTo(location, function (route) {
  32117. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route)
  32118. this$1.index++
  32119. })
  32120. };
  32121. AbstractHistory.prototype.replace = function replace (location) {
  32122. var this$1 = this;
  32123. this.transitionTo(location, function (route) {
  32124. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route)
  32125. })
  32126. };
  32127. AbstractHistory.prototype.go = function go (n) {
  32128. var this$1 = this;
  32129. var targetIndex = this.index + n
  32130. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  32131. return
  32132. }
  32133. var route = this.stack[targetIndex]
  32134. this.confirmTransition(route, function () {
  32135. this$1.index = targetIndex
  32136. this$1.updateRoute(route)
  32137. })
  32138. };
  32139. AbstractHistory.prototype.ensureURL = function ensureURL () {
  32140. // noop
  32141. };
  32142. return AbstractHistory;
  32143. }(History));
  32144. /* */
  32145. var VueRouter = function VueRouter (options) {
  32146. if ( options === void 0 ) options = {};
  32147. this.app = null
  32148. this.options = options
  32149. this.beforeHooks = []
  32150. this.afterHooks = []
  32151. this.match = createMatcher(options.routes || [])
  32152. var mode = options.mode || 'hash'
  32153. this.fallback = mode === 'history' && !supportsHistory
  32154. if (this.fallback) {
  32155. mode = 'hash'
  32156. }
  32157. if (!inBrowser) {
  32158. mode = 'abstract'
  32159. }
  32160. this.mode = mode
  32161. };
  32162. var prototypeAccessors = { currentRoute: {} };
  32163. prototypeAccessors.currentRoute.get = function () {
  32164. return this.history && this.history.current
  32165. };
  32166. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  32167. var this$1 = this;
  32168. assert(
  32169. install.installed,
  32170. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  32171. "before creating root instance."
  32172. )
  32173. this.app = app
  32174. var ref = this;
  32175. var mode = ref.mode;
  32176. var options = ref.options;
  32177. var fallback = ref.fallback;
  32178. switch (mode) {
  32179. case 'history':
  32180. this.history = new HTML5History(this, options.base)
  32181. break
  32182. case 'hash':
  32183. this.history = new HashHistory(this, options.base, fallback)
  32184. break
  32185. case 'abstract':
  32186. this.history = new AbstractHistory(this)
  32187. break
  32188. default:
  32189. assert(false, ("invalid mode: " + mode))
  32190. }
  32191. this.history.listen(function (route) {
  32192. this$1.app._route = route
  32193. })
  32194. };
  32195. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  32196. this.beforeHooks.push(fn)
  32197. };
  32198. VueRouter.prototype.afterEach = function afterEach (fn) {
  32199. this.afterHooks.push(fn)
  32200. };
  32201. VueRouter.prototype.push = function push (location) {
  32202. this.history.push(location)
  32203. };
  32204. VueRouter.prototype.replace = function replace (location) {
  32205. this.history.replace(location)
  32206. };
  32207. VueRouter.prototype.go = function go (n) {
  32208. this.history.go(n)
  32209. };
  32210. VueRouter.prototype.back = function back () {
  32211. this.go(-1)
  32212. };
  32213. VueRouter.prototype.forward = function forward () {
  32214. this.go(1)
  32215. };
  32216. VueRouter.prototype.getMatchedComponents = function getMatchedComponents () {
  32217. if (!this.currentRoute) {
  32218. return []
  32219. }
  32220. return [].concat.apply([], this.currentRoute.matched.map(function (m) {
  32221. return Object.keys(m.components).map(function (key) {
  32222. return m.components[key]
  32223. })
  32224. }))
  32225. };
  32226. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  32227. VueRouter.install = install
  32228. if (inBrowser && window.Vue) {
  32229. window.Vue.use(VueRouter)
  32230. }
  32231. return VueRouter;
  32232. })));
  32233. /***/ },
  32234. /* 304 */
  32235. /***/ function(module, exports, __webpack_require__) {
  32236. // style-loader: Adds some css to the DOM by adding a <style> tag
  32237. // load the styles
  32238. var content = __webpack_require__(217);
  32239. if(typeof content === 'string') content = [[module.i, content, '']];
  32240. // add the styles to the DOM
  32241. var update = __webpack_require__(20)(content, {});
  32242. if(content.locals) module.exports = content.locals;
  32243. // Hot Module Replacement
  32244. if(false) {
  32245. // When the styles change, update the <style> tags
  32246. if(!content.locals) {
  32247. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-28c275d9!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Fingerprint.vue", function() {
  32248. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-28c275d9!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Fingerprint.vue");
  32249. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32250. update(newContent);
  32251. });
  32252. }
  32253. // When the module is disposed, remove the <style> tags
  32254. module.hot.dispose(function() { update(); });
  32255. }
  32256. /***/ },
  32257. /* 305 */
  32258. /***/ function(module, exports, __webpack_require__) {
  32259. // style-loader: Adds some css to the DOM by adding a <style> tag
  32260. // load the styles
  32261. var content = __webpack_require__(218);
  32262. if(typeof content === 'string') content = [[module.i, content, '']];
  32263. // add the styles to the DOM
  32264. var update = __webpack_require__(20)(content, {});
  32265. if(content.locals) module.exports = content.locals;
  32266. // Hot Module Replacement
  32267. if(false) {
  32268. // When the styles change, update the <style> tags
  32269. if(!content.locals) {
  32270. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-3e659d19!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Passwords.vue", function() {
  32271. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-3e659d19!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Passwords.vue");
  32272. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32273. update(newContent);
  32274. });
  32275. }
  32276. // When the module is disposed, remove the <style> tags
  32277. module.hot.dispose(function() { update(); });
  32278. }
  32279. /***/ },
  32280. /* 306 */
  32281. /***/ function(module, exports, __webpack_require__) {
  32282. // style-loader: Adds some css to the DOM by adding a <style> tag
  32283. // load the styles
  32284. var content = __webpack_require__(219);
  32285. if(typeof content === 'string') content = [[module.i, content, '']];
  32286. // add the styles to the DOM
  32287. var update = __webpack_require__(20)(content, {});
  32288. if(content.locals) module.exports = content.locals;
  32289. // Hot Module Replacement
  32290. if(false) {
  32291. // When the styles change, update the <style> tags
  32292. if(!content.locals) {
  32293. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-4e146d4e!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./PasswordGenerator.vue", function() {
  32294. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-4e146d4e!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./PasswordGenerator.vue");
  32295. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32296. update(newContent);
  32297. });
  32298. }
  32299. // When the module is disposed, remove the <style> tags
  32300. module.hot.dispose(function() { update(); });
  32301. }
  32302. /***/ },
  32303. /* 307 */
  32304. /***/ function(module, exports, __webpack_require__) {
  32305. // style-loader: Adds some css to the DOM by adding a <style> tag
  32306. // load the styles
  32307. var content = __webpack_require__(220);
  32308. if(typeof content === 'string') content = [[module.i, content, '']];
  32309. // add the styles to the DOM
  32310. var update = __webpack_require__(20)(content, {});
  32311. if(content.locals) module.exports = content.locals;
  32312. // Hot Module Replacement
  32313. if(false) {
  32314. // When the styles change, update the <style> tags
  32315. if(!content.locals) {
  32316. module.hot.accept("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7d2a5ef8!./../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./LessPass.vue", function() {
  32317. var newContent = require("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7d2a5ef8!./../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./LessPass.vue");
  32318. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32319. update(newContent);
  32320. });
  32321. }
  32322. // When the module is disposed, remove the <style> tags
  32323. module.hot.dispose(function() { update(); });
  32324. }
  32325. /***/ },
  32326. /* 308 */
  32327. /***/ function(module, exports, __webpack_require__) {
  32328. // style-loader: Adds some css to the DOM by adding a <style> tag
  32329. // load the styles
  32330. var content = __webpack_require__(221);
  32331. if(typeof content === 'string') content = [[module.i, content, '']];
  32332. // add the styles to the DOM
  32333. var update = __webpack_require__(20)(content, {});
  32334. if(content.locals) module.exports = content.locals;
  32335. // Hot Module Replacement
  32336. if(false) {
  32337. // When the styles change, update the <style> tags
  32338. if(!content.locals) {
  32339. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-e2e1cfd0!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./DeleteButton.vue", function() {
  32340. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-e2e1cfd0!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./DeleteButton.vue");
  32341. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32342. update(newContent);
  32343. });
  32344. }
  32345. // When the module is disposed, remove the <style> tags
  32346. module.hot.dispose(function() { update(); });
  32347. }
  32348. /***/ },
  32349. /* 309 */
  32350. /***/ function(module, exports, __webpack_require__) {
  32351. // style-loader: Adds some css to the DOM by adding a <style> tag
  32352. // load the styles
  32353. var content = __webpack_require__(222);
  32354. if(typeof content === 'string') content = [[module.i, content, '']];
  32355. // add the styles to the DOM
  32356. var update = __webpack_require__(20)(content, {});
  32357. if(content.locals) module.exports = content.locals;
  32358. // Hot Module Replacement
  32359. if(false) {
  32360. // When the styles change, update the <style> tags
  32361. if(!content.locals) {
  32362. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-eabada8c!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Menu.vue", function() {
  32363. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-eabada8c!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Menu.vue");
  32364. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32365. update(newContent);
  32366. });
  32367. }
  32368. // When the module is disposed, remove the <style> tags
  32369. module.hot.dispose(function() { update(); });
  32370. }
  32371. /***/ },
  32372. /* 310 */
  32373. /***/ function(module, exports) {
  32374. module.exports = function(module) {
  32375. if(!module.webpackPolyfill) {
  32376. module.deprecate = function() {};
  32377. module.paths = [];
  32378. // module.parent = undefined by default
  32379. if(!module.children) module.children = [];
  32380. Object.defineProperty(module, "loaded", {
  32381. enumerable: true,
  32382. configurable: false,
  32383. get: function() { return module.l; }
  32384. });
  32385. Object.defineProperty(module, "id", {
  32386. enumerable: true,
  32387. configurable: false,
  32388. get: function() { return module.i; }
  32389. });
  32390. module.webpackPolyfill = 1;
  32391. }
  32392. return module;
  32393. }
  32394. /***/ },
  32395. /* 311 */
  32396. /***/ function(module, exports) {
  32397. /* (ignored) */
  32398. /***/ },
  32399. /* 312 */
  32400. 311,
  32401. /* 313 */
  32402. /***/ function(module, exports, __webpack_require__) {
  32403. "use strict";
  32404. 'use strict';
  32405. var _vue = __webpack_require__(47);
  32406. var _vue2 = _interopRequireDefault(_vue);
  32407. __webpack_require__(120);
  32408. __webpack_require__(121);
  32409. __webpack_require__(122);
  32410. var _LessPass = __webpack_require__(123);
  32411. var _LessPass2 = _interopRequireDefault(_LessPass);
  32412. var _store = __webpack_require__(119);
  32413. var _store2 = _interopRequireDefault(_store);
  32414. var _router = __webpack_require__(118);
  32415. var _router2 = _interopRequireDefault(_router);
  32416. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  32417. new _vue2.default({
  32418. el: '#lesspass',
  32419. store: _store2.default,
  32420. router: _router2.default,
  32421. render: function render(h) {
  32422. return h(_LessPass2.default);
  32423. }
  32424. });
  32425. /***/ }
  32426. /******/ ])));