UNPKG

686 kBJavaScriptView Raw
1var vendor =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId])
11/******/ return installedModules[moduleId].exports;
12/******/
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // identity function for calling harmony imports with the correct context
38/******/ __webpack_require__.i = function(value) { return value; };
39/******/
40/******/ // define getter function for harmony exports
41/******/ __webpack_require__.d = function(exports, name, getter) {
42/******/ if(!__webpack_require__.o(exports, name)) {
43/******/ Object.defineProperty(exports, name, {
44/******/ configurable: false,
45/******/ enumerable: true,
46/******/ get: getter
47/******/ });
48/******/ }
49/******/ };
50/******/
51/******/ // getDefaultExport function for compatibility with non-harmony modules
52/******/ __webpack_require__.n = function(module) {
53/******/ var getter = module && module.__esModule ?
54/******/ function getDefault() { return module['default']; } :
55/******/ function getModuleExports() { return module; };
56/******/ __webpack_require__.d(getter, 'a', getter);
57/******/ return getter;
58/******/ };
59/******/
60/******/ // Object.prototype.hasOwnProperty.call
61/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
62/******/
63/******/ // __webpack_public_path__
64/******/ __webpack_require__.p = "";
65/******/
66/******/ // Load entry module and return exports
67/******/ return __webpack_require__(__webpack_require__.s = 352);
68/******/ })
69/************************************************************************/
70/******/ ([
71/* 0 */
72/***/ (function(module, exports, __webpack_require__) {
73
74var _curry1 = __webpack_require__(1);
75var _isPlaceholder = __webpack_require__(36);
76
77
78/**
79 * Optimized internal two-arity curry function.
80 *
81 * @private
82 * @category Function
83 * @param {Function} fn The function to curry.
84 * @return {Function} The curried function.
85 */
86module.exports = function _curry2(fn) {
87 return function f2(a, b) {
88 switch (arguments.length) {
89 case 0:
90 return f2;
91 case 1:
92 return _isPlaceholder(a) ? f2
93 : _curry1(function(_b) { return fn(a, _b); });
94 default:
95 return _isPlaceholder(a) && _isPlaceholder(b) ? f2
96 : _isPlaceholder(a) ? _curry1(function(_a) { return fn(_a, b); })
97 : _isPlaceholder(b) ? _curry1(function(_b) { return fn(a, _b); })
98 : fn(a, b);
99 }
100 };
101};
102
103
104/***/ }),
105/* 1 */
106/***/ (function(module, exports, __webpack_require__) {
107
108var _isPlaceholder = __webpack_require__(36);
109
110
111/**
112 * Optimized internal one-arity curry function.
113 *
114 * @private
115 * @category Function
116 * @param {Function} fn The function to curry.
117 * @return {Function} The curried function.
118 */
119module.exports = function _curry1(fn) {
120 return function f1(a) {
121 if (arguments.length === 0 || _isPlaceholder(a)) {
122 return f1;
123 } else {
124 return fn.apply(this, arguments);
125 }
126 };
127};
128
129
130/***/ }),
131/* 2 */
132/***/ (function(module, exports, __webpack_require__) {
133
134var _curry1 = __webpack_require__(1);
135var _curry2 = __webpack_require__(0);
136var _isPlaceholder = __webpack_require__(36);
137
138
139/**
140 * Optimized internal three-arity curry function.
141 *
142 * @private
143 * @category Function
144 * @param {Function} fn The function to curry.
145 * @return {Function} The curried function.
146 */
147module.exports = function _curry3(fn) {
148 return function f3(a, b, c) {
149 switch (arguments.length) {
150 case 0:
151 return f3;
152 case 1:
153 return _isPlaceholder(a) ? f3
154 : _curry2(function(_b, _c) { return fn(a, _b, _c); });
155 case 2:
156 return _isPlaceholder(a) && _isPlaceholder(b) ? f3
157 : _isPlaceholder(a) ? _curry2(function(_a, _c) { return fn(_a, b, _c); })
158 : _isPlaceholder(b) ? _curry2(function(_b, _c) { return fn(a, _b, _c); })
159 : _curry1(function(_c) { return fn(a, b, _c); });
160 default:
161 return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3
162 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function(_a, _b) { return fn(_a, _b, c); })
163 : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function(_a, _c) { return fn(_a, b, _c); })
164 : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function(_b, _c) { return fn(a, _b, _c); })
165 : _isPlaceholder(a) ? _curry1(function(_a) { return fn(_a, b, c); })
166 : _isPlaceholder(b) ? _curry1(function(_b) { return fn(a, _b, c); })
167 : _isPlaceholder(c) ? _curry1(function(_c) { return fn(a, b, _c); })
168 : fn(a, b, c);
169 }
170 };
171};
172
173
174/***/ }),
175/* 3 */
176/***/ (function(module, exports, __webpack_require__) {
177
178var _isArray = __webpack_require__(15);
179var _isTransformer = __webpack_require__(55);
180
181
182/**
183 * Returns a function that dispatches with different strategies based on the
184 * object in list position (last argument). If it is an array, executes [fn].
185 * Otherwise, if it has a function with one of the given method names, it will
186 * execute that function (functor case). Otherwise, if it is a transformer,
187 * uses transducer [xf] to return a new transformer (transducer case).
188 * Otherwise, it will default to executing [fn].
189 *
190 * @private
191 * @param {Array} methodNames properties to check for a custom implementation
192 * @param {Function} xf transducer to initialize if object is transformer
193 * @param {Function} fn default ramda implementation
194 * @return {Function} A function that dispatches on object in list position
195 */
196module.exports = function _dispatchable(methodNames, xf, fn) {
197 return function() {
198 if (arguments.length === 0) {
199 return fn();
200 }
201 var args = Array.prototype.slice.call(arguments, 0);
202 var obj = args.pop();
203 if (!_isArray(obj)) {
204 var idx = 0;
205 while (idx < methodNames.length) {
206 if (typeof obj[methodNames[idx]] === 'function') {
207 return obj[methodNames[idx]].apply(obj, args);
208 }
209 idx += 1;
210 }
211 if (_isTransformer(obj)) {
212 var transducer = xf.apply(null, args);
213 return transducer(obj);
214 }
215 }
216 return fn.apply(this, arguments);
217 };
218};
219
220
221/***/ }),
222/* 4 */
223/***/ (function(module, exports) {
224
225module.exports = {
226 init: function() {
227 return this.xf['@@transducer/init']();
228 },
229 result: function(result) {
230 return this.xf['@@transducer/result'](result);
231 }
232};
233
234
235/***/ }),
236/* 5 */
237/***/ (function(module, exports, __webpack_require__) {
238
239var _arity = __webpack_require__(12);
240var _curry1 = __webpack_require__(1);
241var _curry2 = __webpack_require__(0);
242var _curryN = __webpack_require__(34);
243
244
245/**
246 * Returns a curried equivalent of the provided function, with the specified
247 * arity. The curried function has two unusual capabilities. First, its
248 * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the
249 * following are equivalent:
250 *
251 * - `g(1)(2)(3)`
252 * - `g(1)(2, 3)`
253 * - `g(1, 2)(3)`
254 * - `g(1, 2, 3)`
255 *
256 * Secondly, the special placeholder value `R.__` may be used to specify
257 * "gaps", allowing partial application of any combination of arguments,
258 * regardless of their positions. If `g` is as above and `_` is `R.__`, the
259 * following are equivalent:
260 *
261 * - `g(1, 2, 3)`
262 * - `g(_, 2, 3)(1)`
263 * - `g(_, _, 3)(1)(2)`
264 * - `g(_, _, 3)(1, 2)`
265 * - `g(_, 2)(1)(3)`
266 * - `g(_, 2)(1, 3)`
267 * - `g(_, 2)(_, 3)(1)`
268 *
269 * @func
270 * @memberOf R
271 * @since v0.5.0
272 * @category Function
273 * @sig Number -> (* -> a) -> (* -> a)
274 * @param {Number} length The arity for the returned function.
275 * @param {Function} fn The function to curry.
276 * @return {Function} A new, curried function.
277 * @see R.curry
278 * @example
279 *
280 * var sumArgs = (...args) => R.sum(args);
281 *
282 * var curriedAddFourNumbers = R.curryN(4, sumArgs);
283 * var f = curriedAddFourNumbers(1, 2);
284 * var g = f(3);
285 * g(4); //=> 10
286 */
287module.exports = _curry2(function curryN(length, fn) {
288 if (length === 1) {
289 return _curry1(fn);
290 }
291 return _arity(length, _curryN(length, [], fn));
292});
293
294
295/***/ }),
296/* 6 */
297/***/ (function(module, exports) {
298
299module.exports = function _has(prop, obj) {
300 return Object.prototype.hasOwnProperty.call(obj, prop);
301};
302
303
304/***/ }),
305/* 7 */
306/***/ (function(module, exports, __webpack_require__) {
307
308var _curry2 = __webpack_require__(0);
309var _dispatchable = __webpack_require__(3);
310var _map = __webpack_require__(38);
311var _reduce = __webpack_require__(9);
312var _xmap = __webpack_require__(243);
313var curryN = __webpack_require__(5);
314var keys = __webpack_require__(13);
315
316
317/**
318 * Takes a function and
319 * a [functor](https://github.com/fantasyland/fantasy-land#functor),
320 * applies the function to each of the functor's values, and returns
321 * a functor of the same shape.
322 *
323 * Ramda provides suitable `map` implementations for `Array` and `Object`,
324 * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
325 *
326 * Dispatches to the `map` method of the second argument, if present.
327 *
328 * Acts as a transducer if a transformer is given in list position.
329 *
330 * Also treats functions as functors and will compose them together.
331 *
332 * @func
333 * @memberOf R
334 * @since v0.1.0
335 * @category List
336 * @sig Functor f => (a -> b) -> f a -> f b
337 * @param {Function} fn The function to be called on every element of the input `list`.
338 * @param {Array} list The list to be iterated over.
339 * @return {Array} The new list.
340 * @see R.transduce, R.addIndex
341 * @example
342 *
343 * var double = x => x * 2;
344 *
345 * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
346 *
347 * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
348 * @symb R.map(f, [a, b]) = [f(a), f(b)]
349 * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
350 * @symb R.map(f, functor_o) = functor_o.map(f)
351 */
352module.exports = _curry2(_dispatchable(['map'], _xmap, function map(fn, functor) {
353 switch (Object.prototype.toString.call(functor)) {
354 case '[object Function]':
355 return curryN(functor.length, function() {
356 return fn.call(this, functor.apply(this, arguments));
357 });
358 case '[object Object]':
359 return _reduce(function(acc, key) {
360 acc[key] = fn(functor[key]);
361 return acc;
362 }, {}, keys(functor));
363 default:
364 return _map(fn, functor);
365 }
366}));
367
368
369/***/ }),
370/* 8 */
371/***/ (function(module, exports, __webpack_require__) {
372
373"use strict";
374
375
376var bind = __webpack_require__(65);
377
378/*global toString:true*/
379
380// utils is a library of generic helper functions non-specific to axios
381
382var toString = Object.prototype.toString;
383
384/**
385 * Determine if a value is an Array
386 *
387 * @param {Object} val The value to test
388 * @returns {boolean} True if value is an Array, otherwise false
389 */
390function isArray(val) {
391 return toString.call(val) === '[object Array]';
392}
393
394/**
395 * Determine if a value is an ArrayBuffer
396 *
397 * @param {Object} val The value to test
398 * @returns {boolean} True if value is an ArrayBuffer, otherwise false
399 */
400function isArrayBuffer(val) {
401 return toString.call(val) === '[object ArrayBuffer]';
402}
403
404/**
405 * Determine if a value is a FormData
406 *
407 * @param {Object} val The value to test
408 * @returns {boolean} True if value is an FormData, otherwise false
409 */
410function isFormData(val) {
411 return (typeof FormData !== 'undefined') && (val instanceof FormData);
412}
413
414/**
415 * Determine if a value is a view on an ArrayBuffer
416 *
417 * @param {Object} val The value to test
418 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
419 */
420function isArrayBufferView(val) {
421 var result;
422 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
423 result = ArrayBuffer.isView(val);
424 } else {
425 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
426 }
427 return result;
428}
429
430/**
431 * Determine if a value is a String
432 *
433 * @param {Object} val The value to test
434 * @returns {boolean} True if value is a String, otherwise false
435 */
436function isString(val) {
437 return typeof val === 'string';
438}
439
440/**
441 * Determine if a value is a Number
442 *
443 * @param {Object} val The value to test
444 * @returns {boolean} True if value is a Number, otherwise false
445 */
446function isNumber(val) {
447 return typeof val === 'number';
448}
449
450/**
451 * Determine if a value is undefined
452 *
453 * @param {Object} val The value to test
454 * @returns {boolean} True if the value is undefined, otherwise false
455 */
456function isUndefined(val) {
457 return typeof val === 'undefined';
458}
459
460/**
461 * Determine if a value is an Object
462 *
463 * @param {Object} val The value to test
464 * @returns {boolean} True if value is an Object, otherwise false
465 */
466function isObject(val) {
467 return val !== null && typeof val === 'object';
468}
469
470/**
471 * Determine if a value is a Date
472 *
473 * @param {Object} val The value to test
474 * @returns {boolean} True if value is a Date, otherwise false
475 */
476function isDate(val) {
477 return toString.call(val) === '[object Date]';
478}
479
480/**
481 * Determine if a value is a File
482 *
483 * @param {Object} val The value to test
484 * @returns {boolean} True if value is a File, otherwise false
485 */
486function isFile(val) {
487 return toString.call(val) === '[object File]';
488}
489
490/**
491 * Determine if a value is a Blob
492 *
493 * @param {Object} val The value to test
494 * @returns {boolean} True if value is a Blob, otherwise false
495 */
496function isBlob(val) {
497 return toString.call(val) === '[object Blob]';
498}
499
500/**
501 * Determine if a value is a Function
502 *
503 * @param {Object} val The value to test
504 * @returns {boolean} True if value is a Function, otherwise false
505 */
506function isFunction(val) {
507 return toString.call(val) === '[object Function]';
508}
509
510/**
511 * Determine if a value is a Stream
512 *
513 * @param {Object} val The value to test
514 * @returns {boolean} True if value is a Stream, otherwise false
515 */
516function isStream(val) {
517 return isObject(val) && isFunction(val.pipe);
518}
519
520/**
521 * Determine if a value is a URLSearchParams object
522 *
523 * @param {Object} val The value to test
524 * @returns {boolean} True if value is a URLSearchParams object, otherwise false
525 */
526function isURLSearchParams(val) {
527 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
528}
529
530/**
531 * Trim excess whitespace off the beginning and end of a string
532 *
533 * @param {String} str The String to trim
534 * @returns {String} The String freed of excess whitespace
535 */
536function trim(str) {
537 return str.replace(/^\s*/, '').replace(/\s*$/, '');
538}
539
540/**
541 * Determine if we're running in a standard browser environment
542 *
543 * This allows axios to run in a web worker, and react-native.
544 * Both environments support XMLHttpRequest, but not fully standard globals.
545 *
546 * web workers:
547 * typeof window -> undefined
548 * typeof document -> undefined
549 *
550 * react-native:
551 * typeof document.createElement -> undefined
552 */
553function isStandardBrowserEnv() {
554 return (
555 typeof window !== 'undefined' &&
556 typeof document !== 'undefined' &&
557 typeof document.createElement === 'function'
558 );
559}
560
561/**
562 * Iterate over an Array or an Object invoking a function for each item.
563 *
564 * If `obj` is an Array callback will be called passing
565 * the value, index, and complete array for each item.
566 *
567 * If 'obj' is an Object callback will be called passing
568 * the value, key, and complete object for each property.
569 *
570 * @param {Object|Array} obj The object to iterate
571 * @param {Function} fn The callback to invoke for each item
572 */
573function forEach(obj, fn) {
574 // Don't bother if no value provided
575 if (obj === null || typeof obj === 'undefined') {
576 return;
577 }
578
579 // Force an array if not already something iterable
580 if (typeof obj !== 'object' && !isArray(obj)) {
581 /*eslint no-param-reassign:0*/
582 obj = [obj];
583 }
584
585 if (isArray(obj)) {
586 // Iterate over array values
587 for (var i = 0, l = obj.length; i < l; i++) {
588 fn.call(null, obj[i], i, obj);
589 }
590 } else {
591 // Iterate over object keys
592 for (var key in obj) {
593 if (Object.prototype.hasOwnProperty.call(obj, key)) {
594 fn.call(null, obj[key], key, obj);
595 }
596 }
597 }
598}
599
600/**
601 * Accepts varargs expecting each argument to be an object, then
602 * immutably merges the properties of each object and returns result.
603 *
604 * When multiple objects contain the same key the later object in
605 * the arguments list will take precedence.
606 *
607 * Example:
608 *
609 * ```js
610 * var result = merge({foo: 123}, {foo: 456});
611 * console.log(result.foo); // outputs 456
612 * ```
613 *
614 * @param {Object} obj1 Object to merge
615 * @returns {Object} Result of all merge properties
616 */
617function merge(/* obj1, obj2, obj3, ... */) {
618 var result = {};
619 function assignValue(val, key) {
620 if (typeof result[key] === 'object' && typeof val === 'object') {
621 result[key] = merge(result[key], val);
622 } else {
623 result[key] = val;
624 }
625 }
626
627 for (var i = 0, l = arguments.length; i < l; i++) {
628 forEach(arguments[i], assignValue);
629 }
630 return result;
631}
632
633/**
634 * Extends object a by mutably adding to it the properties of object b.
635 *
636 * @param {Object} a The object to be extended
637 * @param {Object} b The object to copy properties from
638 * @param {Object} thisArg The object to bind function to
639 * @return {Object} The resulting value of object a
640 */
641function extend(a, b, thisArg) {
642 forEach(b, function assignValue(val, key) {
643 if (thisArg && typeof val === 'function') {
644 a[key] = bind(val, thisArg);
645 } else {
646 a[key] = val;
647 }
648 });
649 return a;
650}
651
652module.exports = {
653 isArray: isArray,
654 isArrayBuffer: isArrayBuffer,
655 isFormData: isFormData,
656 isArrayBufferView: isArrayBufferView,
657 isString: isString,
658 isNumber: isNumber,
659 isObject: isObject,
660 isUndefined: isUndefined,
661 isDate: isDate,
662 isFile: isFile,
663 isBlob: isBlob,
664 isFunction: isFunction,
665 isStream: isStream,
666 isURLSearchParams: isURLSearchParams,
667 isStandardBrowserEnv: isStandardBrowserEnv,
668 forEach: forEach,
669 merge: merge,
670 extend: extend,
671 trim: trim
672};
673
674
675/***/ }),
676/* 9 */
677/***/ (function(module, exports, __webpack_require__) {
678
679var _xwrap = __webpack_require__(96);
680var bind = __webpack_require__(71);
681var isArrayLike = __webpack_require__(23);
682
683
684module.exports = (function() {
685 function _arrayReduce(xf, acc, list) {
686 var idx = 0;
687 var len = list.length;
688 while (idx < len) {
689 acc = xf['@@transducer/step'](acc, list[idx]);
690 if (acc && acc['@@transducer/reduced']) {
691 acc = acc['@@transducer/value'];
692 break;
693 }
694 idx += 1;
695 }
696 return xf['@@transducer/result'](acc);
697 }
698
699 function _iterableReduce(xf, acc, iter) {
700 var step = iter.next();
701 while (!step.done) {
702 acc = xf['@@transducer/step'](acc, step.value);
703 if (acc && acc['@@transducer/reduced']) {
704 acc = acc['@@transducer/value'];
705 break;
706 }
707 step = iter.next();
708 }
709 return xf['@@transducer/result'](acc);
710 }
711
712 function _methodReduce(xf, acc, obj) {
713 return xf['@@transducer/result'](obj.reduce(bind(xf['@@transducer/step'], xf), acc));
714 }
715
716 var symIterator = (typeof Symbol !== 'undefined') ? Symbol.iterator : '@@iterator';
717 return function _reduce(fn, acc, list) {
718 if (typeof fn === 'function') {
719 fn = _xwrap(fn);
720 }
721 if (isArrayLike(list)) {
722 return _arrayReduce(fn, acc, list);
723 }
724 if (typeof list.reduce === 'function') {
725 return _methodReduce(fn, acc, list);
726 }
727 if (list[symIterator] != null) {
728 return _iterableReduce(fn, acc, list[symIterator]());
729 }
730 if (typeof list.next === 'function') {
731 return _iterableReduce(fn, acc, list);
732 }
733 throw new TypeError('reduce: list must be array or iterable');
734 };
735}());
736
737
738/***/ }),
739/* 10 */
740/***/ (function(module, exports) {
741
742/**
743 * Private `concat` function to merge two array-like objects.
744 *
745 * @private
746 * @param {Array|Arguments} [set1=[]] An array-like object.
747 * @param {Array|Arguments} [set2=[]] An array-like object.
748 * @return {Array} A new, merged array.
749 * @example
750 *
751 * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
752 */
753module.exports = function _concat(set1, set2) {
754 set1 = set1 || [];
755 set2 = set2 || [];
756 var idx;
757 var len1 = set1.length;
758 var len2 = set2.length;
759 var result = [];
760
761 idx = 0;
762 while (idx < len1) {
763 result[result.length] = set1[idx];
764 idx += 1;
765 }
766 idx = 0;
767 while (idx < len2) {
768 result[result.length] = set2[idx];
769 idx += 1;
770 }
771 return result;
772};
773
774
775/***/ }),
776/* 11 */
777/***/ (function(module, exports, __webpack_require__) {
778
779var _curry2 = __webpack_require__(0);
780var _equals = __webpack_require__(218);
781
782
783/**
784 * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
785 * cyclical data structures.
786 *
787 * Dispatches symmetrically to the `equals` methods of both arguments, if
788 * present.
789 *
790 * @func
791 * @memberOf R
792 * @since v0.15.0
793 * @category Relation
794 * @sig a -> b -> Boolean
795 * @param {*} a
796 * @param {*} b
797 * @return {Boolean}
798 * @example
799 *
800 * R.equals(1, 1); //=> true
801 * R.equals(1, '1'); //=> false
802 * R.equals([1, 2, 3], [1, 2, 3]); //=> true
803 *
804 * var a = {}; a.v = a;
805 * var b = {}; b.v = b;
806 * R.equals(a, b); //=> true
807 */
808module.exports = _curry2(function equals(a, b) {
809 return _equals(a, b, [], []);
810});
811
812
813/***/ }),
814/* 12 */
815/***/ (function(module, exports) {
816
817module.exports = function _arity(n, fn) {
818 /* eslint-disable no-unused-vars */
819 switch (n) {
820 case 0: return function() { return fn.apply(this, arguments); };
821 case 1: return function(a0) { return fn.apply(this, arguments); };
822 case 2: return function(a0, a1) { return fn.apply(this, arguments); };
823 case 3: return function(a0, a1, a2) { return fn.apply(this, arguments); };
824 case 4: return function(a0, a1, a2, a3) { return fn.apply(this, arguments); };
825 case 5: return function(a0, a1, a2, a3, a4) { return fn.apply(this, arguments); };
826 case 6: return function(a0, a1, a2, a3, a4, a5) { return fn.apply(this, arguments); };
827 case 7: return function(a0, a1, a2, a3, a4, a5, a6) { return fn.apply(this, arguments); };
828 case 8: return function(a0, a1, a2, a3, a4, a5, a6, a7) { return fn.apply(this, arguments); };
829 case 9: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) { return fn.apply(this, arguments); };
830 case 10: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { return fn.apply(this, arguments); };
831 default: throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
832 }
833};
834
835
836/***/ }),
837/* 13 */
838/***/ (function(module, exports, __webpack_require__) {
839
840var _curry1 = __webpack_require__(1);
841var _has = __webpack_require__(6);
842var _isArguments = __webpack_require__(89);
843
844
845/**
846 * Returns a list containing the names of all the enumerable own properties of
847 * the supplied object.
848 * Note that the order of the output array is not guaranteed to be consistent
849 * across different JS platforms.
850 *
851 * @func
852 * @memberOf R
853 * @since v0.1.0
854 * @category Object
855 * @sig {k: v} -> [k]
856 * @param {Object} obj The object to extract properties from
857 * @return {Array} An array of the object's own properties.
858 * @example
859 *
860 * R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
861 */
862module.exports = (function() {
863 // cover IE < 9 keys issues
864 var hasEnumBug = !({toString: null}).propertyIsEnumerable('toString');
865 var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString',
866 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
867 // Safari bug
868 var hasArgsEnumBug = (function() {
869 'use strict';
870 return arguments.propertyIsEnumerable('length');
871 }());
872
873 var contains = function contains(list, item) {
874 var idx = 0;
875 while (idx < list.length) {
876 if (list[idx] === item) {
877 return true;
878 }
879 idx += 1;
880 }
881 return false;
882 };
883
884 return typeof Object.keys === 'function' && !hasArgsEnumBug ?
885 _curry1(function keys(obj) {
886 return Object(obj) !== obj ? [] : Object.keys(obj);
887 }) :
888 _curry1(function keys(obj) {
889 if (Object(obj) !== obj) {
890 return [];
891 }
892 var prop, nIdx;
893 var ks = [];
894 var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
895 for (prop in obj) {
896 if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
897 ks[ks.length] = prop;
898 }
899 }
900 if (hasEnumBug) {
901 nIdx = nonEnumerableProps.length - 1;
902 while (nIdx >= 0) {
903 prop = nonEnumerableProps[nIdx];
904 if (_has(prop, obj) && !contains(ks, prop)) {
905 ks[ks.length] = prop;
906 }
907 nIdx -= 1;
908 }
909 }
910 return ks;
911 });
912}());
913
914
915/***/ }),
916/* 14 */
917/***/ (function(module, exports, __webpack_require__) {
918
919var _curry3 = __webpack_require__(2);
920var _reduce = __webpack_require__(9);
921
922
923/**
924 * Returns a single item by iterating through the list, successively calling
925 * the iterator function and passing it an accumulator value and the current
926 * value from the array, and then passing the result to the next call.
927 *
928 * The iterator function receives two values: *(acc, value)*. It may use
929 * `R.reduced` to shortcut the iteration.
930 *
931 * The arguments' order of `reduceRight`'s iterator function is *(value, acc)*.
932 *
933 * Note: `R.reduce` does not skip deleted or unassigned indices (sparse
934 * arrays), unlike the native `Array.prototype.reduce` method. For more details
935 * on this behavior, see:
936 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description
937 *
938 * Dispatches to the `reduce` method of the third argument, if present.
939 *
940 * @func
941 * @memberOf R
942 * @since v0.1.0
943 * @category List
944 * @sig ((a, b) -> a) -> a -> [b] -> a
945 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
946 * current element from the array.
947 * @param {*} acc The accumulator value.
948 * @param {Array} list The list to iterate over.
949 * @return {*} The final, accumulated value.
950 * @see R.reduced, R.addIndex, R.reduceRight
951 * @example
952 *
953 * R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10
954 * - -10
955 * / \ / \
956 * - 4 -6 4
957 * / \ / \
958 * - 3 ==> -3 3
959 * / \ / \
960 * - 2 -1 2
961 * / \ / \
962 * 0 1 0 1
963 *
964 * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d)
965 */
966module.exports = _curry3(_reduce);
967
968
969/***/ }),
970/* 15 */
971/***/ (function(module, exports) {
972
973/**
974 * Tests whether or not an object is an array.
975 *
976 * @private
977 * @param {*} val The object to test.
978 * @return {Boolean} `true` if `val` is an array, `false` otherwise.
979 * @example
980 *
981 * _isArray([]); //=> true
982 * _isArray(null); //=> false
983 * _isArray({}); //=> false
984 */
985module.exports = Array.isArray || function _isArray(val) {
986 return (val != null &&
987 val.length >= 0 &&
988 Object.prototype.toString.call(val) === '[object Array]');
989};
990
991
992/***/ }),
993/* 16 */
994/***/ (function(module, exports) {
995
996module.exports = function _reduced(x) {
997 return x && x['@@transducer/reduced'] ? x :
998 {
999 '@@transducer/value': x,
1000 '@@transducer/reduced': true
1001 };
1002};
1003
1004
1005/***/ }),
1006/* 17 */
1007/***/ (function(module, exports, __webpack_require__) {
1008
1009var _indexOf = __webpack_require__(88);
1010
1011
1012module.exports = function _contains(a, list) {
1013 return _indexOf(list, a, 0) >= 0;
1014};
1015
1016
1017/***/ }),
1018/* 18 */
1019/***/ (function(module, exports, __webpack_require__) {
1020
1021var _checkForMethod = __webpack_require__(21);
1022var _curry3 = __webpack_require__(2);
1023
1024
1025/**
1026 * Returns the elements of the given list or string (or object with a `slice`
1027 * method) from `fromIndex` (inclusive) to `toIndex` (exclusive).
1028 *
1029 * Dispatches to the `slice` method of the third argument, if present.
1030 *
1031 * @func
1032 * @memberOf R
1033 * @since v0.1.4
1034 * @category List
1035 * @sig Number -> Number -> [a] -> [a]
1036 * @sig Number -> Number -> String -> String
1037 * @param {Number} fromIndex The start index (inclusive).
1038 * @param {Number} toIndex The end index (exclusive).
1039 * @param {*} list
1040 * @return {*}
1041 * @example
1042 *
1043 * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c']
1044 * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd']
1045 * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c']
1046 * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c']
1047 * R.slice(0, 3, 'ramda'); //=> 'ram'
1048 */
1049module.exports = _curry3(_checkForMethod('slice', function slice(fromIndex, toIndex, list) {
1050 return Array.prototype.slice.call(list, fromIndex, toIndex);
1051}));
1052
1053
1054/***/ }),
1055/* 19 */
1056/***/ (function(module, exports, __webpack_require__) {
1057
1058var _curry1 = __webpack_require__(1);
1059
1060
1061/**
1062 * Returns a function that always returns the given value. Note that for
1063 * non-primitives the value returned is a reference to the original value.
1064 *
1065 * This function is known as `const`, `constant`, or `K` (for K combinator) in
1066 * other languages and libraries.
1067 *
1068 * @func
1069 * @memberOf R
1070 * @since v0.1.0
1071 * @category Function
1072 * @sig a -> (* -> a)
1073 * @param {*} val The value to wrap in a function
1074 * @return {Function} A Function :: * -> val.
1075 * @example
1076 *
1077 * var t = R.always('Tee');
1078 * t(); //=> 'Tee'
1079 */
1080module.exports = _curry1(function always(val) {
1081 return function() {
1082 return val;
1083 };
1084});
1085
1086
1087/***/ }),
1088/* 20 */
1089/***/ (function(module, exports, __webpack_require__) {
1090
1091var _curry2 = __webpack_require__(0);
1092
1093
1094/**
1095 * Returns the larger of its two arguments.
1096 *
1097 * @func
1098 * @memberOf R
1099 * @since v0.1.0
1100 * @category Relation
1101 * @sig Ord a => a -> a -> a
1102 * @param {*} a
1103 * @param {*} b
1104 * @return {*}
1105 * @see R.maxBy, R.min
1106 * @example
1107 *
1108 * R.max(789, 123); //=> 789
1109 * R.max('a', 'b'); //=> 'b'
1110 */
1111module.exports = _curry2(function max(a, b) { return b > a ? b : a; });
1112
1113
1114/***/ }),
1115/* 21 */
1116/***/ (function(module, exports, __webpack_require__) {
1117
1118var _isArray = __webpack_require__(15);
1119
1120
1121/**
1122 * This checks whether a function has a [methodname] function. If it isn't an
1123 * array it will execute that function otherwise it will default to the ramda
1124 * implementation.
1125 *
1126 * @private
1127 * @param {Function} fn ramda implemtation
1128 * @param {String} methodname property to check for a custom implementation
1129 * @return {Object} Whatever the return value of the method is.
1130 */
1131module.exports = function _checkForMethod(methodname, fn) {
1132 return function() {
1133 var length = arguments.length;
1134 if (length === 0) {
1135 return fn();
1136 }
1137 var obj = arguments[length - 1];
1138 return (_isArray(obj) || typeof obj[methodname] !== 'function') ?
1139 fn.apply(this, arguments) :
1140 obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
1141 };
1142};
1143
1144
1145/***/ }),
1146/* 22 */
1147/***/ (function(module, exports, __webpack_require__) {
1148
1149var _curry2 = __webpack_require__(0);
1150var _isFunction = __webpack_require__(35);
1151var curryN = __webpack_require__(5);
1152var toString = __webpack_require__(27);
1153
1154
1155/**
1156 * Turns a named method with a specified arity into a function that can be
1157 * called directly supplied with arguments and a target object.
1158 *
1159 * The returned function is curried and accepts `arity + 1` parameters where
1160 * the final parameter is the target object.
1161 *
1162 * @func
1163 * @memberOf R
1164 * @since v0.1.0
1165 * @category Function
1166 * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *)
1167 * @param {Number} arity Number of arguments the returned function should take
1168 * before the target object.
1169 * @param {String} method Name of the method to call.
1170 * @return {Function} A new curried function.
1171 * @example
1172 *
1173 * var sliceFrom = R.invoker(1, 'slice');
1174 * sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm'
1175 * var sliceFrom6 = R.invoker(2, 'slice')(6);
1176 * sliceFrom6(8, 'abcdefghijklm'); //=> 'gh'
1177 * @symb R.invoker(0, 'method')(o) = o['method']()
1178 * @symb R.invoker(1, 'method')(a, o) = o['method'](a)
1179 * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b)
1180 */
1181module.exports = _curry2(function invoker(arity, method) {
1182 return curryN(arity + 1, function() {
1183 var target = arguments[arity];
1184 if (target != null && _isFunction(target[method])) {
1185 return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity));
1186 }
1187 throw new TypeError(toString(target) + ' does not have a method named "' + method + '"');
1188 });
1189});
1190
1191
1192/***/ }),
1193/* 23 */
1194/***/ (function(module, exports, __webpack_require__) {
1195
1196var _curry1 = __webpack_require__(1);
1197var _isArray = __webpack_require__(15);
1198var _isString = __webpack_require__(37);
1199
1200
1201/**
1202 * Tests whether or not an object is similar to an array.
1203 *
1204 * @func
1205 * @memberOf R
1206 * @since v0.5.0
1207 * @category Type
1208 * @category List
1209 * @sig * -> Boolean
1210 * @param {*} x The object to test.
1211 * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
1212 * @deprecated since v0.23.0
1213 * @example
1214 *
1215 * R.isArrayLike([]); //=> true
1216 * R.isArrayLike(true); //=> false
1217 * R.isArrayLike({}); //=> false
1218 * R.isArrayLike({length: 10}); //=> false
1219 * R.isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
1220 */
1221module.exports = _curry1(function isArrayLike(x) {
1222 if (_isArray(x)) { return true; }
1223 if (!x) { return false; }
1224 if (typeof x !== 'object') { return false; }
1225 if (_isString(x)) { return false; }
1226 if (x.nodeType === 1) { return !!x.length; }
1227 if (x.length === 0) { return true; }
1228 if (x.length > 0) {
1229 return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
1230 }
1231 return false;
1232});
1233
1234
1235/***/ }),
1236/* 24 */
1237/***/ (function(module, exports, __webpack_require__) {
1238
1239var _curry2 = __webpack_require__(0);
1240var _isString = __webpack_require__(37);
1241
1242
1243/**
1244 * Returns the nth element of the given list or string. If n is negative the
1245 * element at index length + n is returned.
1246 *
1247 * @func
1248 * @memberOf R
1249 * @since v0.1.0
1250 * @category List
1251 * @sig Number -> [a] -> a | Undefined
1252 * @sig Number -> String -> String
1253 * @param {Number} offset
1254 * @param {*} list
1255 * @return {*}
1256 * @example
1257 *
1258 * var list = ['foo', 'bar', 'baz', 'quux'];
1259 * R.nth(1, list); //=> 'bar'
1260 * R.nth(-1, list); //=> 'quux'
1261 * R.nth(-99, list); //=> undefined
1262 *
1263 * R.nth(2, 'abc'); //=> 'c'
1264 * R.nth(3, 'abc'); //=> ''
1265 * @symb R.nth(-1, [a, b, c]) = c
1266 * @symb R.nth(0, [a, b, c]) = a
1267 * @symb R.nth(1, [a, b, c]) = b
1268 */
1269module.exports = _curry2(function nth(offset, list) {
1270 var idx = offset < 0 ? list.length + offset : offset;
1271 return _isString(list) ? list.charAt(idx) : list[idx];
1272});
1273
1274
1275/***/ }),
1276/* 25 */
1277/***/ (function(module, exports, __webpack_require__) {
1278
1279var _curry2 = __webpack_require__(0);
1280
1281
1282/**
1283 * Retrieve the value at a given path.
1284 *
1285 * @func
1286 * @memberOf R
1287 * @since v0.2.0
1288 * @category Object
1289 * @typedefn Idx = String | Int
1290 * @sig [Idx] -> {a} -> a | Undefined
1291 * @param {Array} path The path to use.
1292 * @param {Object} obj The object to retrieve the nested property from.
1293 * @return {*} The data at `path`.
1294 * @see R.prop
1295 * @example
1296 *
1297 * R.path(['a', 'b'], {a: {b: 2}}); //=> 2
1298 * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
1299 */
1300module.exports = _curry2(function path(paths, obj) {
1301 var val = obj;
1302 var idx = 0;
1303 while (idx < paths.length) {
1304 if (val == null) {
1305 return;
1306 }
1307 val = val[paths[idx]];
1308 idx += 1;
1309 }
1310 return val;
1311});
1312
1313
1314/***/ }),
1315/* 26 */
1316/***/ (function(module, exports, __webpack_require__) {
1317
1318var _curry2 = __webpack_require__(0);
1319var map = __webpack_require__(7);
1320var prop = __webpack_require__(56);
1321
1322
1323/**
1324 * Returns a new list by plucking the same named property off all objects in
1325 * the list supplied.
1326 *
1327 * @func
1328 * @memberOf R
1329 * @since v0.1.0
1330 * @category List
1331 * @sig k -> [{k: v}] -> [v]
1332 * @param {Number|String} key The key name to pluck off of each object.
1333 * @param {Array} list The array to consider.
1334 * @return {Array} The list of values for the given key.
1335 * @see R.props
1336 * @example
1337 *
1338 * R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2]
1339 * R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3]
1340 * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
1341 * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
1342 */
1343module.exports = _curry2(function pluck(p, list) {
1344 return map(prop(p), list);
1345});
1346
1347
1348/***/ }),
1349/* 27 */
1350/***/ (function(module, exports, __webpack_require__) {
1351
1352var _curry1 = __webpack_require__(1);
1353var _toString = __webpack_require__(230);
1354
1355
1356/**
1357 * Returns the string representation of the given value. `eval`'ing the output
1358 * should result in a value equivalent to the input value. Many of the built-in
1359 * `toString` methods do not satisfy this requirement.
1360 *
1361 * If the given value is an `[object Object]` with a `toString` method other
1362 * than `Object.prototype.toString`, this method is invoked with no arguments
1363 * to produce the return value. This means user-defined constructor functions
1364 * can provide a suitable `toString` method. For example:
1365 *
1366 * function Point(x, y) {
1367 * this.x = x;
1368 * this.y = y;
1369 * }
1370 *
1371 * Point.prototype.toString = function() {
1372 * return 'new Point(' + this.x + ', ' + this.y + ')';
1373 * };
1374 *
1375 * R.toString(new Point(1, 2)); //=> 'new Point(1, 2)'
1376 *
1377 * @func
1378 * @memberOf R
1379 * @since v0.14.0
1380 * @category String
1381 * @sig * -> String
1382 * @param {*} val
1383 * @return {String}
1384 * @example
1385 *
1386 * R.toString(42); //=> '42'
1387 * R.toString('abc'); //=> '"abc"'
1388 * R.toString([1, 2, 3]); //=> '[1, 2, 3]'
1389 * R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}'
1390 * R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")'
1391 */
1392module.exports = _curry1(function toString(val) { return _toString(val, []); });
1393
1394
1395/***/ }),
1396/* 28 */
1397/***/ (function(module, exports, __webpack_require__) {
1398
1399"use strict";
1400
1401
1402
1403var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
1404 (typeof Uint16Array !== 'undefined') &&
1405 (typeof Int32Array !== 'undefined');
1406
1407
1408exports.assign = function (obj /*from1, from2, from3, ...*/) {
1409 var sources = Array.prototype.slice.call(arguments, 1);
1410 while (sources.length) {
1411 var source = sources.shift();
1412 if (!source) { continue; }
1413
1414 if (typeof source !== 'object') {
1415 throw new TypeError(source + 'must be non-object');
1416 }
1417
1418 for (var p in source) {
1419 if (source.hasOwnProperty(p)) {
1420 obj[p] = source[p];
1421 }
1422 }
1423 }
1424
1425 return obj;
1426};
1427
1428
1429// reduce buffer size, avoiding mem copy
1430exports.shrinkBuf = function (buf, size) {
1431 if (buf.length === size) { return buf; }
1432 if (buf.subarray) { return buf.subarray(0, size); }
1433 buf.length = size;
1434 return buf;
1435};
1436
1437
1438var fnTyped = {
1439 arraySet: function (dest, src, src_offs, len, dest_offs) {
1440 if (src.subarray && dest.subarray) {
1441 dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
1442 return;
1443 }
1444 // Fallback to ordinary array
1445 for (var i = 0; i < len; i++) {
1446 dest[dest_offs + i] = src[src_offs + i];
1447 }
1448 },
1449 // Join array of chunks to single array.
1450 flattenChunks: function (chunks) {
1451 var i, l, len, pos, chunk, result;
1452
1453 // calculate data length
1454 len = 0;
1455 for (i = 0, l = chunks.length; i < l; i++) {
1456 len += chunks[i].length;
1457 }
1458
1459 // join chunks
1460 result = new Uint8Array(len);
1461 pos = 0;
1462 for (i = 0, l = chunks.length; i < l; i++) {
1463 chunk = chunks[i];
1464 result.set(chunk, pos);
1465 pos += chunk.length;
1466 }
1467
1468 return result;
1469 }
1470};
1471
1472var fnUntyped = {
1473 arraySet: function (dest, src, src_offs, len, dest_offs) {
1474 for (var i = 0; i < len; i++) {
1475 dest[dest_offs + i] = src[src_offs + i];
1476 }
1477 },
1478 // Join array of chunks to single array.
1479 flattenChunks: function (chunks) {
1480 return [].concat.apply([], chunks);
1481 }
1482};
1483
1484
1485// Enable/Disable typed arrays use, for testing
1486//
1487exports.setTyped = function (on) {
1488 if (on) {
1489 exports.Buf8 = Uint8Array;
1490 exports.Buf16 = Uint16Array;
1491 exports.Buf32 = Int32Array;
1492 exports.assign(exports, fnTyped);
1493 } else {
1494 exports.Buf8 = Array;
1495 exports.Buf16 = Array;
1496 exports.Buf32 = Array;
1497 exports.assign(exports, fnUntyped);
1498 }
1499};
1500
1501exports.setTyped(TYPED_OK);
1502
1503
1504/***/ }),
1505/* 29 */
1506/***/ (function(module, exports) {
1507
1508// shim for using process in browser
1509var process = module.exports = {};
1510
1511// cached from whatever global is present so that test runners that stub it
1512// don't break things. But we need to wrap it in a try catch in case it is
1513// wrapped in strict mode code which doesn't define any globals. It's inside a
1514// function because try/catches deoptimize in certain engines.
1515
1516var cachedSetTimeout;
1517var cachedClearTimeout;
1518
1519function defaultSetTimout() {
1520 throw new Error('setTimeout has not been defined');
1521}
1522function defaultClearTimeout () {
1523 throw new Error('clearTimeout has not been defined');
1524}
1525(function () {
1526 try {
1527 if (typeof setTimeout === 'function') {
1528 cachedSetTimeout = setTimeout;
1529 } else {
1530 cachedSetTimeout = defaultSetTimout;
1531 }
1532 } catch (e) {
1533 cachedSetTimeout = defaultSetTimout;
1534 }
1535 try {
1536 if (typeof clearTimeout === 'function') {
1537 cachedClearTimeout = clearTimeout;
1538 } else {
1539 cachedClearTimeout = defaultClearTimeout;
1540 }
1541 } catch (e) {
1542 cachedClearTimeout = defaultClearTimeout;
1543 }
1544} ())
1545function runTimeout(fun) {
1546 if (cachedSetTimeout === setTimeout) {
1547 //normal enviroments in sane situations
1548 return setTimeout(fun, 0);
1549 }
1550 // if setTimeout wasn't available but was latter defined
1551 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1552 cachedSetTimeout = setTimeout;
1553 return setTimeout(fun, 0);
1554 }
1555 try {
1556 // when when somebody has screwed with setTimeout but no I.E. maddness
1557 return cachedSetTimeout(fun, 0);
1558 } catch(e){
1559 try {
1560 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1561 return cachedSetTimeout.call(null, fun, 0);
1562 } catch(e){
1563 // 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
1564 return cachedSetTimeout.call(this, fun, 0);
1565 }
1566 }
1567
1568
1569}
1570function runClearTimeout(marker) {
1571 if (cachedClearTimeout === clearTimeout) {
1572 //normal enviroments in sane situations
1573 return clearTimeout(marker);
1574 }
1575 // if clearTimeout wasn't available but was latter defined
1576 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1577 cachedClearTimeout = clearTimeout;
1578 return clearTimeout(marker);
1579 }
1580 try {
1581 // when when somebody has screwed with setTimeout but no I.E. maddness
1582 return cachedClearTimeout(marker);
1583 } catch (e){
1584 try {
1585 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1586 return cachedClearTimeout.call(null, marker);
1587 } catch (e){
1588 // 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.
1589 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1590 return cachedClearTimeout.call(this, marker);
1591 }
1592 }
1593
1594
1595
1596}
1597var queue = [];
1598var draining = false;
1599var currentQueue;
1600var queueIndex = -1;
1601
1602function cleanUpNextTick() {
1603 if (!draining || !currentQueue) {
1604 return;
1605 }
1606 draining = false;
1607 if (currentQueue.length) {
1608 queue = currentQueue.concat(queue);
1609 } else {
1610 queueIndex = -1;
1611 }
1612 if (queue.length) {
1613 drainQueue();
1614 }
1615}
1616
1617function drainQueue() {
1618 if (draining) {
1619 return;
1620 }
1621 var timeout = runTimeout(cleanUpNextTick);
1622 draining = true;
1623
1624 var len = queue.length;
1625 while(len) {
1626 currentQueue = queue;
1627 queue = [];
1628 while (++queueIndex < len) {
1629 if (currentQueue) {
1630 currentQueue[queueIndex].run();
1631 }
1632 }
1633 queueIndex = -1;
1634 len = queue.length;
1635 }
1636 currentQueue = null;
1637 draining = false;
1638 runClearTimeout(timeout);
1639}
1640
1641process.nextTick = function (fun) {
1642 var args = new Array(arguments.length - 1);
1643 if (arguments.length > 1) {
1644 for (var i = 1; i < arguments.length; i++) {
1645 args[i - 1] = arguments[i];
1646 }
1647 }
1648 queue.push(new Item(fun, args));
1649 if (queue.length === 1 && !draining) {
1650 runTimeout(drainQueue);
1651 }
1652};
1653
1654// v8 likes predictible objects
1655function Item(fun, array) {
1656 this.fun = fun;
1657 this.array = array;
1658}
1659Item.prototype.run = function () {
1660 this.fun.apply(null, this.array);
1661};
1662process.title = 'browser';
1663process.browser = true;
1664process.env = {};
1665process.argv = [];
1666process.version = ''; // empty string to avoid regexp issues
1667process.versions = {};
1668
1669function noop() {}
1670
1671process.on = noop;
1672process.addListener = noop;
1673process.once = noop;
1674process.off = noop;
1675process.removeListener = noop;
1676process.removeAllListeners = noop;
1677process.emit = noop;
1678
1679process.binding = function (name) {
1680 throw new Error('process.binding is not supported');
1681};
1682
1683process.cwd = function () { return '/' };
1684process.chdir = function (dir) {
1685 throw new Error('process.chdir is not supported');
1686};
1687process.umask = function() { return 0; };
1688
1689
1690/***/ }),
1691/* 30 */
1692/***/ (function(module, exports, __webpack_require__) {
1693
1694var _curry2 = __webpack_require__(0);
1695
1696
1697/**
1698 * Adds two values.
1699 *
1700 * @func
1701 * @memberOf R
1702 * @since v0.1.0
1703 * @category Math
1704 * @sig Number -> Number -> Number
1705 * @param {Number} a
1706 * @param {Number} b
1707 * @return {Number}
1708 * @see R.subtract
1709 * @example
1710 *
1711 * R.add(2, 3); //=> 5
1712 * R.add(7)(10); //=> 17
1713 */
1714module.exports = _curry2(function add(a, b) {
1715 return Number(a) + Number(b);
1716});
1717
1718
1719/***/ }),
1720/* 31 */
1721/***/ (function(module, exports, __webpack_require__) {
1722
1723var _curry3 = __webpack_require__(2);
1724
1725
1726/**
1727 * Makes a shallow clone of an object, setting or overriding the specified
1728 * property with the given value. Note that this copies and flattens prototype
1729 * properties onto the new object as well. All non-primitive properties are
1730 * copied by reference.
1731 *
1732 * @func
1733 * @memberOf R
1734 * @since v0.8.0
1735 * @category Object
1736 * @sig String -> a -> {k: v} -> {k: v}
1737 * @param {String} prop The property name to set
1738 * @param {*} val The new value
1739 * @param {Object} obj The object to clone
1740 * @return {Object} A new object equivalent to the original except for the changed property.
1741 * @see R.dissoc
1742 * @example
1743 *
1744 * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
1745 */
1746module.exports = _curry3(function assoc(prop, val, obj) {
1747 var result = {};
1748 for (var p in obj) {
1749 result[p] = obj[p];
1750 }
1751 result[prop] = val;
1752 return result;
1753});
1754
1755
1756/***/ }),
1757/* 32 */
1758/***/ (function(module, exports, __webpack_require__) {
1759
1760var _curry1 = __webpack_require__(1);
1761var curryN = __webpack_require__(5);
1762
1763
1764/**
1765 * Returns a curried equivalent of the provided function. The curried function
1766 * has two unusual capabilities. First, its arguments needn't be provided one
1767 * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the
1768 * following are equivalent:
1769 *
1770 * - `g(1)(2)(3)`
1771 * - `g(1)(2, 3)`
1772 * - `g(1, 2)(3)`
1773 * - `g(1, 2, 3)`
1774 *
1775 * Secondly, the special placeholder value `R.__` may be used to specify
1776 * "gaps", allowing partial application of any combination of arguments,
1777 * regardless of their positions. If `g` is as above and `_` is `R.__`, the
1778 * following are equivalent:
1779 *
1780 * - `g(1, 2, 3)`
1781 * - `g(_, 2, 3)(1)`
1782 * - `g(_, _, 3)(1)(2)`
1783 * - `g(_, _, 3)(1, 2)`
1784 * - `g(_, 2)(1)(3)`
1785 * - `g(_, 2)(1, 3)`
1786 * - `g(_, 2)(_, 3)(1)`
1787 *
1788 * @func
1789 * @memberOf R
1790 * @since v0.1.0
1791 * @category Function
1792 * @sig (* -> a) -> (* -> a)
1793 * @param {Function} fn The function to curry.
1794 * @return {Function} A new, curried function.
1795 * @see R.curryN
1796 * @example
1797 *
1798 * var addFourNumbers = (a, b, c, d) => a + b + c + d;
1799 *
1800 * var curriedAddFourNumbers = R.curry(addFourNumbers);
1801 * var f = curriedAddFourNumbers(1, 2);
1802 * var g = f(3);
1803 * g(4); //=> 10
1804 */
1805module.exports = _curry1(function curry(fn) {
1806 return curryN(fn.length, fn);
1807});
1808
1809
1810/***/ }),
1811/* 33 */
1812/***/ (function(module, exports, __webpack_require__) {
1813
1814var _curry1 = __webpack_require__(1);
1815var curry = __webpack_require__(32);
1816
1817
1818/**
1819 * Returns a new function much like the supplied one, except that the first two
1820 * arguments' order is reversed.
1821 *
1822 * @func
1823 * @memberOf R
1824 * @since v0.1.0
1825 * @category Function
1826 * @sig (a -> b -> c -> ... -> z) -> (b -> a -> c -> ... -> z)
1827 * @param {Function} fn The function to invoke with its first two parameters reversed.
1828 * @return {*} The result of invoking `fn` with its first two parameters' order reversed.
1829 * @example
1830 *
1831 * var mergeThree = (a, b, c) => [].concat(a, b, c);
1832 *
1833 * mergeThree(1, 2, 3); //=> [1, 2, 3]
1834 *
1835 * R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3]
1836 * @symb R.flip(f)(a, b, c) = f(b, a, c)
1837 */
1838module.exports = _curry1(function flip(fn) {
1839 return curry(function(a, b) {
1840 var args = Array.prototype.slice.call(arguments, 0);
1841 args[0] = b;
1842 args[1] = a;
1843 return fn.apply(this, args);
1844 });
1845});
1846
1847
1848/***/ }),
1849/* 34 */
1850/***/ (function(module, exports, __webpack_require__) {
1851
1852var _arity = __webpack_require__(12);
1853var _isPlaceholder = __webpack_require__(36);
1854
1855
1856/**
1857 * Internal curryN function.
1858 *
1859 * @private
1860 * @category Function
1861 * @param {Number} length The arity of the curried function.
1862 * @param {Array} received An array of arguments received thus far.
1863 * @param {Function} fn The function to curry.
1864 * @return {Function} The curried function.
1865 */
1866module.exports = function _curryN(length, received, fn) {
1867 return function() {
1868 var combined = [];
1869 var argsIdx = 0;
1870 var left = length;
1871 var combinedIdx = 0;
1872 while (combinedIdx < received.length || argsIdx < arguments.length) {
1873 var result;
1874 if (combinedIdx < received.length &&
1875 (!_isPlaceholder(received[combinedIdx]) ||
1876 argsIdx >= arguments.length)) {
1877 result = received[combinedIdx];
1878 } else {
1879 result = arguments[argsIdx];
1880 argsIdx += 1;
1881 }
1882 combined[combinedIdx] = result;
1883 if (!_isPlaceholder(result)) {
1884 left -= 1;
1885 }
1886 combinedIdx += 1;
1887 }
1888 return left <= 0 ? fn.apply(this, combined)
1889 : _arity(left, _curryN(length, combined, fn));
1890 };
1891};
1892
1893
1894/***/ }),
1895/* 35 */
1896/***/ (function(module, exports) {
1897
1898module.exports = function _isFunction(x) {
1899 return Object.prototype.toString.call(x) === '[object Function]';
1900};
1901
1902
1903/***/ }),
1904/* 36 */
1905/***/ (function(module, exports) {
1906
1907module.exports = function _isPlaceholder(a) {
1908 return a != null &&
1909 typeof a === 'object' &&
1910 a['@@functional/placeholder'] === true;
1911};
1912
1913
1914/***/ }),
1915/* 37 */
1916/***/ (function(module, exports) {
1917
1918module.exports = function _isString(x) {
1919 return Object.prototype.toString.call(x) === '[object String]';
1920};
1921
1922
1923/***/ }),
1924/* 38 */
1925/***/ (function(module, exports) {
1926
1927module.exports = function _map(fn, functor) {
1928 var idx = 0;
1929 var len = functor.length;
1930 var result = Array(len);
1931 while (idx < len) {
1932 result[idx] = fn(functor[idx]);
1933 idx += 1;
1934 }
1935 return result;
1936};
1937
1938
1939/***/ }),
1940/* 39 */
1941/***/ (function(module, exports, __webpack_require__) {
1942
1943var _curry2 = __webpack_require__(0);
1944var map = __webpack_require__(7);
1945
1946
1947/**
1948 * Returns a lens for the given getter and setter functions. The getter "gets"
1949 * the value of the focus; the setter "sets" the value of the focus. The setter
1950 * should not mutate the data structure.
1951 *
1952 * @func
1953 * @memberOf R
1954 * @since v0.8.0
1955 * @category Object
1956 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
1957 * @sig (s -> a) -> ((a, s) -> s) -> Lens s a
1958 * @param {Function} getter
1959 * @param {Function} setter
1960 * @return {Lens}
1961 * @see R.view, R.set, R.over, R.lensIndex, R.lensProp
1962 * @example
1963 *
1964 * var xLens = R.lens(R.prop('x'), R.assoc('x'));
1965 *
1966 * R.view(xLens, {x: 1, y: 2}); //=> 1
1967 * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
1968 * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2}
1969 */
1970module.exports = _curry2(function lens(getter, setter) {
1971 return function(toFunctorFn) {
1972 return function(target) {
1973 return map(
1974 function(focus) {
1975 return setter(focus, target);
1976 },
1977 toFunctorFn(getter(target))
1978 );
1979 };
1980 };
1981});
1982
1983
1984/***/ }),
1985/* 40 */
1986/***/ (function(module, exports, __webpack_require__) {
1987
1988var _curry1 = __webpack_require__(1);
1989var liftN = __webpack_require__(101);
1990
1991
1992/**
1993 * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other
1994 * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
1995 *
1996 * @func
1997 * @memberOf R
1998 * @since v0.7.0
1999 * @category Function
2000 * @sig (*... -> *) -> ([*]... -> [*])
2001 * @param {Function} fn The function to lift into higher context
2002 * @return {Function} The lifted function.
2003 * @see R.liftN
2004 * @example
2005 *
2006 * var madd3 = R.lift((a, b, c) => a + b + c);
2007 *
2008 * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
2009 *
2010 * var madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
2011 *
2012 * madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24]
2013 */
2014module.exports = _curry1(function lift(fn) {
2015 return liftN(fn.length, fn);
2016});
2017
2018
2019/***/ }),
2020/* 41 */
2021/***/ (function(module, exports, __webpack_require__) {
2022
2023var _curry2 = __webpack_require__(0);
2024
2025
2026/**
2027 * Wraps a function of any arity (including nullary) in a function that accepts
2028 * exactly `n` parameters. Any extraneous parameters will not be passed to the
2029 * supplied function.
2030 *
2031 * @func
2032 * @memberOf R
2033 * @since v0.1.0
2034 * @category Function
2035 * @sig Number -> (* -> a) -> (* -> a)
2036 * @param {Number} n The desired arity of the new function.
2037 * @param {Function} fn The function to wrap.
2038 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
2039 * arity `n`.
2040 * @example
2041 *
2042 * var takesTwoArgs = (a, b) => [a, b];
2043 *
2044 * takesTwoArgs.length; //=> 2
2045 * takesTwoArgs(1, 2); //=> [1, 2]
2046 *
2047 * var takesOneArg = R.nAry(1, takesTwoArgs);
2048 * takesOneArg.length; //=> 1
2049 * // Only `n` arguments are passed to the wrapped function
2050 * takesOneArg(1, 2); //=> [1, undefined]
2051 * @symb R.nAry(0, f)(a, b) = f()
2052 * @symb R.nAry(1, f)(a, b) = f(a)
2053 * @symb R.nAry(2, f)(a, b) = f(a, b)
2054 */
2055module.exports = _curry2(function nAry(n, fn) {
2056 switch (n) {
2057 case 0: return function() {return fn.call(this);};
2058 case 1: return function(a0) {return fn.call(this, a0);};
2059 case 2: return function(a0, a1) {return fn.call(this, a0, a1);};
2060 case 3: return function(a0, a1, a2) {return fn.call(this, a0, a1, a2);};
2061 case 4: return function(a0, a1, a2, a3) {return fn.call(this, a0, a1, a2, a3);};
2062 case 5: return function(a0, a1, a2, a3, a4) {return fn.call(this, a0, a1, a2, a3, a4);};
2063 case 6: return function(a0, a1, a2, a3, a4, a5) {return fn.call(this, a0, a1, a2, a3, a4, a5);};
2064 case 7: return function(a0, a1, a2, a3, a4, a5, a6) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6);};
2065 case 8: return function(a0, a1, a2, a3, a4, a5, a6, a7) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7);};
2066 case 9: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8);};
2067 case 10: return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);};
2068 default: throw new Error('First argument to nAry must be a non-negative integer no greater than ten');
2069 }
2070});
2071
2072
2073/***/ }),
2074/* 42 */
2075/***/ (function(module, exports, __webpack_require__) {
2076
2077var _curryN = __webpack_require__(34);
2078var _dispatchable = __webpack_require__(3);
2079var _has = __webpack_require__(6);
2080var _reduce = __webpack_require__(9);
2081var _xreduceBy = __webpack_require__(244);
2082
2083
2084/**
2085 * Groups the elements of the list according to the result of calling
2086 * the String-returning function `keyFn` on each element and reduces the elements
2087 * of each group to a single value via the reducer function `valueFn`.
2088 *
2089 * This function is basically a more general `groupBy` function.
2090 *
2091 * Acts as a transducer if a transformer is given in list position.
2092 *
2093 * @func
2094 * @memberOf R
2095 * @since v0.20.0
2096 * @category List
2097 * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a}
2098 * @param {Function} valueFn The function that reduces the elements of each group to a single
2099 * value. Receives two values, accumulator for a particular group and the current element.
2100 * @param {*} acc The (initial) accumulator value for each group.
2101 * @param {Function} keyFn The function that maps the list's element into a key.
2102 * @param {Array} list The array to group.
2103 * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of
2104 * `valueFn` for elements which produced that key when passed to `keyFn`.
2105 * @see R.groupBy, R.reduce
2106 * @example
2107 *
2108 * var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []);
2109 * var namesByGrade = reduceToNamesBy(function(student) {
2110 * var score = student.score;
2111 * return score < 65 ? 'F' :
2112 * score < 70 ? 'D' :
2113 * score < 80 ? 'C' :
2114 * score < 90 ? 'B' : 'A';
2115 * });
2116 * var students = [{name: 'Lucy', score: 92},
2117 * {name: 'Drew', score: 85},
2118 * // ...
2119 * {name: 'Bart', score: 62}];
2120 * namesByGrade(students);
2121 * // {
2122 * // 'A': ['Lucy'],
2123 * // 'B': ['Drew']
2124 * // // ...,
2125 * // 'F': ['Bart']
2126 * // }
2127 */
2128module.exports = _curryN(4, [], _dispatchable([], _xreduceBy,
2129 function reduceBy(valueFn, valueAcc, keyFn, list) {
2130 return _reduce(function(acc, elt) {
2131 var key = keyFn(elt);
2132 acc[key] = valueFn(_has(key, acc) ? acc[key] : valueAcc, elt);
2133 return acc;
2134 }, {}, list);
2135 }));
2136
2137
2138/***/ }),
2139/* 43 */
2140/***/ (function(module, exports, __webpack_require__) {
2141
2142var _complement = __webpack_require__(85);
2143var _curry2 = __webpack_require__(0);
2144var filter = __webpack_require__(50);
2145
2146
2147/**
2148 * The complement of `filter`.
2149 *
2150 * Acts as a transducer if a transformer is given in list position.
2151 *
2152 * @func
2153 * @memberOf R
2154 * @since v0.1.0
2155 * @category List
2156 * @sig Filterable f => (a -> Boolean) -> f a -> f a
2157 * @param {Function} pred
2158 * @param {Array} filterable
2159 * @return {Array}
2160 * @see R.filter, R.transduce, R.addIndex
2161 * @example
2162 *
2163 * var isOdd = (n) => n % 2 === 1;
2164 *
2165 * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
2166 *
2167 * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
2168 */
2169module.exports = _curry2(function reject(pred, filterable) {
2170 return filter(_complement(pred), filterable);
2171});
2172
2173
2174/***/ }),
2175/* 44 */
2176/***/ (function(module, exports, __webpack_require__) {
2177
2178var _curry1 = __webpack_require__(1);
2179var _isString = __webpack_require__(37);
2180
2181
2182/**
2183 * Returns a new list or string with the elements or characters in reverse
2184 * order.
2185 *
2186 * @func
2187 * @memberOf R
2188 * @since v0.1.0
2189 * @category List
2190 * @sig [a] -> [a]
2191 * @sig String -> String
2192 * @param {Array|String} list
2193 * @return {Array|String}
2194 * @example
2195 *
2196 * R.reverse([1, 2, 3]); //=> [3, 2, 1]
2197 * R.reverse([1, 2]); //=> [2, 1]
2198 * R.reverse([1]); //=> [1]
2199 * R.reverse([]); //=> []
2200 *
2201 * R.reverse('abc'); //=> 'cba'
2202 * R.reverse('ab'); //=> 'ba'
2203 * R.reverse('a'); //=> 'a'
2204 * R.reverse(''); //=> ''
2205 */
2206module.exports = _curry1(function reverse(list) {
2207 return _isString(list) ? list.split('').reverse().join('') :
2208 Array.prototype.slice.call(list, 0).reverse();
2209});
2210
2211
2212/***/ }),
2213/* 45 */
2214/***/ (function(module, exports, __webpack_require__) {
2215
2216"use strict";
2217/* WEBPACK VAR INJECTION */(function(process) {
2218
2219var utils = __webpack_require__(8);
2220var normalizeHeaderName = __webpack_require__(143);
2221
2222var PROTECTION_PREFIX = /^\)\]\}',?\n/;
2223var DEFAULT_CONTENT_TYPE = {
2224 'Content-Type': 'application/x-www-form-urlencoded'
2225};
2226
2227function setContentTypeIfUnset(headers, value) {
2228 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
2229 headers['Content-Type'] = value;
2230 }
2231}
2232
2233function getDefaultAdapter() {
2234 var adapter;
2235 if (typeof XMLHttpRequest !== 'undefined') {
2236 // For browsers use XHR adapter
2237 adapter = __webpack_require__(61);
2238 } else if (typeof process !== 'undefined') {
2239 // For node use HTTP adapter
2240 adapter = __webpack_require__(61);
2241 }
2242 return adapter;
2243}
2244
2245var defaults = {
2246 adapter: getDefaultAdapter(),
2247
2248 transformRequest: [function transformRequest(data, headers) {
2249 normalizeHeaderName(headers, 'Content-Type');
2250 if (utils.isFormData(data) ||
2251 utils.isArrayBuffer(data) ||
2252 utils.isStream(data) ||
2253 utils.isFile(data) ||
2254 utils.isBlob(data)
2255 ) {
2256 return data;
2257 }
2258 if (utils.isArrayBufferView(data)) {
2259 return data.buffer;
2260 }
2261 if (utils.isURLSearchParams(data)) {
2262 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
2263 return data.toString();
2264 }
2265 if (utils.isObject(data)) {
2266 setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
2267 return JSON.stringify(data);
2268 }
2269 return data;
2270 }],
2271
2272 transformResponse: [function transformResponse(data) {
2273 /*eslint no-param-reassign:0*/
2274 if (typeof data === 'string') {
2275 data = data.replace(PROTECTION_PREFIX, '');
2276 try {
2277 data = JSON.parse(data);
2278 } catch (e) { /* Ignore */ }
2279 }
2280 return data;
2281 }],
2282
2283 timeout: 0,
2284
2285 xsrfCookieName: 'XSRF-TOKEN',
2286 xsrfHeaderName: 'X-XSRF-TOKEN',
2287
2288 maxContentLength: -1,
2289
2290 validateStatus: function validateStatus(status) {
2291 return status >= 200 && status < 300;
2292 }
2293};
2294
2295defaults.headers = {
2296 common: {
2297 'Accept': 'application/json, text/plain, */*'
2298 }
2299};
2300
2301utils.forEach(['delete', 'get', 'head'], function forEachMehtodNoData(method) {
2302 defaults.headers[method] = {};
2303});
2304
2305utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2306 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
2307});
2308
2309module.exports = defaults;
2310
2311/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(29)))
2312
2313/***/ }),
2314/* 46 */
2315/***/ (function(module, exports, __webpack_require__) {
2316
2317var _concat = __webpack_require__(10);
2318var _curry2 = __webpack_require__(0);
2319var _reduce = __webpack_require__(9);
2320var map = __webpack_require__(7);
2321
2322
2323/**
2324 * ap applies a list of functions to a list of values.
2325 *
2326 * Dispatches to the `ap` method of the second argument, if present. Also
2327 * treats curried functions as applicatives.
2328 *
2329 * @func
2330 * @memberOf R
2331 * @since v0.3.0
2332 * @category Function
2333 * @sig [a -> b] -> [a] -> [b]
2334 * @sig Apply f => f (a -> b) -> f a -> f b
2335 * @param {Array} fns An array of functions
2336 * @param {Array} vs An array of values
2337 * @return {Array} An array of results of applying each of `fns` to all of `vs` in turn.
2338 * @example
2339 *
2340 * R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
2341 * R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"]
2342 * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)]
2343 */
2344module.exports = _curry2(function ap(applicative, fn) {
2345 return (
2346 typeof applicative.ap === 'function' ?
2347 applicative.ap(fn) :
2348 typeof applicative === 'function' ?
2349 function(x) { return applicative(x)(fn(x)); } :
2350 // else
2351 _reduce(function(acc, f) { return _concat(acc, map(f, fn)); }, [], applicative)
2352 );
2353});
2354
2355
2356/***/ }),
2357/* 47 */
2358/***/ (function(module, exports, __webpack_require__) {
2359
2360var _curry2 = __webpack_require__(0);
2361var _dispatchable = __webpack_require__(3);
2362var _makeFlat = __webpack_require__(93);
2363var _xchain = __webpack_require__(233);
2364var map = __webpack_require__(7);
2365
2366
2367/**
2368 * `chain` maps a function over a list and concatenates the results. `chain`
2369 * is also known as `flatMap` in some libraries
2370 *
2371 * Dispatches to the `chain` method of the second argument, if present,
2372 * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain).
2373 *
2374 * @func
2375 * @memberOf R
2376 * @since v0.3.0
2377 * @category List
2378 * @sig Chain m => (a -> m b) -> m a -> m b
2379 * @param {Function} fn The function to map with
2380 * @param {Array} list The list to map over
2381 * @return {Array} The result of flat-mapping `list` with `fn`
2382 * @example
2383 *
2384 * var duplicate = n => [n, n];
2385 * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]
2386 *
2387 * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1]
2388 */
2389module.exports = _curry2(_dispatchable(['chain'], _xchain, function chain(fn, monad) {
2390 if (typeof monad === 'function') {
2391 return function(x) { return fn(monad(x))(x); };
2392 }
2393 return _makeFlat(false)(map(fn, monad));
2394}));
2395
2396
2397/***/ }),
2398/* 48 */
2399/***/ (function(module, exports, __webpack_require__) {
2400
2401var pipe = __webpack_require__(110);
2402var reverse = __webpack_require__(44);
2403
2404
2405/**
2406 * Performs right-to-left function composition. The rightmost function may have
2407 * any arity; the remaining functions must be unary.
2408 *
2409 * **Note:** The result of compose is not automatically curried.
2410 *
2411 * @func
2412 * @memberOf R
2413 * @since v0.1.0
2414 * @category Function
2415 * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)
2416 * @param {...Function} ...functions The functions to compose
2417 * @return {Function}
2418 * @see R.pipe
2419 * @example
2420 *
2421 * var classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName
2422 * var yellGreeting = R.compose(R.toUpper, classyGreeting);
2423 * yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"
2424 *
2425 * R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7
2426 *
2427 * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b)))
2428 */
2429module.exports = function compose() {
2430 if (arguments.length === 0) {
2431 throw new Error('compose requires at least one argument');
2432 }
2433 return pipe.apply(this, reverse(arguments));
2434};
2435
2436
2437/***/ }),
2438/* 49 */
2439/***/ (function(module, exports, __webpack_require__) {
2440
2441var _curry2 = __webpack_require__(0);
2442var _isArray = __webpack_require__(15);
2443var _isFunction = __webpack_require__(35);
2444var toString = __webpack_require__(27);
2445
2446
2447/**
2448 * Returns the result of concatenating the given lists or strings.
2449 *
2450 * Note: `R.concat` expects both arguments to be of the same type,
2451 * unlike the native `Array.prototype.concat` method. It will throw
2452 * an error if you `concat` an Array with a non-Array value.
2453 *
2454 * Dispatches to the `concat` method of the first argument, if present.
2455 *
2456 * @func
2457 * @memberOf R
2458 * @since v0.1.0
2459 * @category List
2460 * @sig [a] -> [a] -> [a]
2461 * @sig String -> String -> String
2462 * @param {Array|String} firstList The first list
2463 * @param {Array|String} secondList The second list
2464 * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of
2465 * `secondList`.
2466 *
2467 * @example
2468 *
2469 * R.concat('ABC', 'DEF'); // 'ABCDEF'
2470 * R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
2471 * R.concat([], []); //=> []
2472 */
2473module.exports = _curry2(function concat(a, b) {
2474 if (a == null || !_isFunction(a.concat)) {
2475 throw new TypeError(toString(a) + ' does not have a method named "concat"');
2476 }
2477 if (_isArray(a) && !_isArray(b)) {
2478 throw new TypeError(toString(b) + ' is not an array');
2479 }
2480 return a.concat(b);
2481});
2482
2483
2484/***/ }),
2485/* 50 */
2486/***/ (function(module, exports, __webpack_require__) {
2487
2488var _curry2 = __webpack_require__(0);
2489var _dispatchable = __webpack_require__(3);
2490var _filter = __webpack_require__(87);
2491var _isObject = __webpack_require__(92);
2492var _reduce = __webpack_require__(9);
2493var _xfilter = __webpack_require__(238);
2494var keys = __webpack_require__(13);
2495
2496
2497/**
2498 * Takes a predicate and a "filterable", and returns a new filterable of the
2499 * same type containing the members of the given filterable which satisfy the
2500 * given predicate.
2501 *
2502 * Dispatches to the `filter` method of the second argument, if present.
2503 *
2504 * Acts as a transducer if a transformer is given in list position.
2505 *
2506 * @func
2507 * @memberOf R
2508 * @since v0.1.0
2509 * @category List
2510 * @sig Filterable f => (a -> Boolean) -> f a -> f a
2511 * @param {Function} pred
2512 * @param {Array} filterable
2513 * @return {Array}
2514 * @see R.reject, R.transduce, R.addIndex
2515 * @example
2516 *
2517 * var isEven = n => n % 2 === 0;
2518 *
2519 * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
2520 *
2521 * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
2522 */
2523module.exports = _curry2(_dispatchable(['filter'], _xfilter, function(pred, filterable) {
2524 return (
2525 _isObject(filterable) ?
2526 _reduce(function(acc, key) {
2527 if (pred(filterable[key])) {
2528 acc[key] = filterable[key];
2529 }
2530 return acc;
2531 }, {}, keys(filterable)) :
2532 // else
2533 _filter(pred, filterable)
2534 );
2535}));
2536
2537
2538/***/ }),
2539/* 51 */
2540/***/ (function(module, exports, __webpack_require__) {
2541
2542var _curry1 = __webpack_require__(1);
2543var _identity = __webpack_require__(54);
2544
2545
2546/**
2547 * A function that does nothing but return the parameter supplied to it. Good
2548 * as a default or placeholder function.
2549 *
2550 * @func
2551 * @memberOf R
2552 * @since v0.1.0
2553 * @category Function
2554 * @sig a -> a
2555 * @param {*} x The value to return.
2556 * @return {*} The input value, `x`.
2557 * @example
2558 *
2559 * R.identity(1); //=> 1
2560 *
2561 * var obj = {};
2562 * R.identity(obj) === obj; //=> true
2563 * @symb R.identity(a) = a
2564 */
2565module.exports = _curry1(_identity);
2566
2567
2568/***/ }),
2569/* 52 */
2570/***/ (function(module, exports, __webpack_require__) {
2571
2572var _objectAssign = __webpack_require__(223);
2573
2574module.exports =
2575 typeof Object.assign === 'function' ? Object.assign : _objectAssign;
2576
2577
2578/***/ }),
2579/* 53 */
2580/***/ (function(module, exports) {
2581
2582module.exports = function _containsWith(pred, x, list) {
2583 var idx = 0;
2584 var len = list.length;
2585
2586 while (idx < len) {
2587 if (pred(x, list[idx])) {
2588 return true;
2589 }
2590 idx += 1;
2591 }
2592 return false;
2593};
2594
2595
2596/***/ }),
2597/* 54 */
2598/***/ (function(module, exports) {
2599
2600module.exports = function _identity(x) { return x; };
2601
2602
2603/***/ }),
2604/* 55 */
2605/***/ (function(module, exports) {
2606
2607module.exports = function _isTransformer(obj) {
2608 return typeof obj['@@transducer/step'] === 'function';
2609};
2610
2611
2612/***/ }),
2613/* 56 */
2614/***/ (function(module, exports, __webpack_require__) {
2615
2616var _curry2 = __webpack_require__(0);
2617
2618
2619/**
2620 * Returns a function that when supplied an object returns the indicated
2621 * property of that object, if it exists.
2622 *
2623 * @func
2624 * @memberOf R
2625 * @since v0.1.0
2626 * @category Object
2627 * @sig s -> {s: a} -> a | Undefined
2628 * @param {String} p The property name
2629 * @param {Object} obj The object to query
2630 * @return {*} The value at `obj.p`.
2631 * @see R.path
2632 * @example
2633 *
2634 * R.prop('x', {x: 100}); //=> 100
2635 * R.prop('x', {}); //=> undefined
2636 */
2637module.exports = _curry2(function prop(p, obj) { return obj[p]; });
2638
2639
2640/***/ }),
2641/* 57 */
2642/***/ (function(module, exports, __webpack_require__) {
2643
2644var _checkForMethod = __webpack_require__(21);
2645var _curry1 = __webpack_require__(1);
2646var slice = __webpack_require__(18);
2647
2648
2649/**
2650 * Returns all but the first element of the given list or string (or object
2651 * with a `tail` method).
2652 *
2653 * Dispatches to the `slice` method of the first argument, if present.
2654 *
2655 * @func
2656 * @memberOf R
2657 * @since v0.1.0
2658 * @category List
2659 * @sig [a] -> [a]
2660 * @sig String -> String
2661 * @param {*} list
2662 * @return {*}
2663 * @see R.head, R.init, R.last
2664 * @example
2665 *
2666 * R.tail([1, 2, 3]); //=> [2, 3]
2667 * R.tail([1, 2]); //=> [2]
2668 * R.tail([1]); //=> []
2669 * R.tail([]); //=> []
2670 *
2671 * R.tail('abc'); //=> 'bc'
2672 * R.tail('ab'); //=> 'b'
2673 * R.tail('a'); //=> ''
2674 * R.tail(''); //=> ''
2675 */
2676module.exports = _curry1(_checkForMethod('tail', slice(1, Infinity)));
2677
2678
2679/***/ }),
2680/* 58 */
2681/***/ (function(module, exports, __webpack_require__) {
2682
2683var _curry1 = __webpack_require__(1);
2684
2685
2686/**
2687 * Gives a single-word string description of the (native) type of a value,
2688 * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
2689 * attempt to distinguish user Object types any further, reporting them all as
2690 * 'Object'.
2691 *
2692 * @func
2693 * @memberOf R
2694 * @since v0.8.0
2695 * @category Type
2696 * @sig (* -> {*}) -> String
2697 * @param {*} val The value to test
2698 * @return {String}
2699 * @example
2700 *
2701 * R.type({}); //=> "Object"
2702 * R.type(1); //=> "Number"
2703 * R.type(false); //=> "Boolean"
2704 * R.type('s'); //=> "String"
2705 * R.type(null); //=> "Null"
2706 * R.type([]); //=> "Array"
2707 * R.type(/[A-z]/); //=> "RegExp"
2708 */
2709module.exports = _curry1(function type(val) {
2710 return val === null ? 'Null' :
2711 val === undefined ? 'Undefined' :
2712 Object.prototype.toString.call(val).slice(8, -1);
2713});
2714
2715
2716/***/ }),
2717/* 59 */
2718/***/ (function(module, exports, __webpack_require__) {
2719
2720var identity = __webpack_require__(51);
2721var uniqBy = __webpack_require__(118);
2722
2723
2724/**
2725 * Returns a new list containing only one copy of each element in the original
2726 * list. `R.equals` is used to determine equality.
2727 *
2728 * @func
2729 * @memberOf R
2730 * @since v0.1.0
2731 * @category List
2732 * @sig [a] -> [a]
2733 * @param {Array} list The array to consider.
2734 * @return {Array} The list of unique items.
2735 * @example
2736 *
2737 * R.uniq([1, 1, 2, 1]); //=> [1, 2]
2738 * R.uniq([1, '1']); //=> [1, '1']
2739 * R.uniq([[42], [42]]); //=> [[42]]
2740 */
2741module.exports = uniqBy(identity);
2742
2743
2744/***/ }),
2745/* 60 */
2746/***/ (function(module, exports, __webpack_require__) {
2747
2748var _containsWith = __webpack_require__(53);
2749var _curry2 = __webpack_require__(0);
2750
2751
2752/**
2753 * Returns a new list containing only one copy of each element in the original
2754 * list, based upon the value returned by applying the supplied predicate to
2755 * two list elements. Prefers the first item if two items compare equal based
2756 * on the predicate.
2757 *
2758 * @func
2759 * @memberOf R
2760 * @since v0.2.0
2761 * @category List
2762 * @sig (a, a -> Boolean) -> [a] -> [a]
2763 * @param {Function} pred A predicate used to test whether two items are equal.
2764 * @param {Array} list The array to consider.
2765 * @return {Array} The list of unique items.
2766 * @example
2767 *
2768 * var strEq = R.eqBy(String);
2769 * R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2]
2770 * R.uniqWith(strEq)([{}, {}]); //=> [{}]
2771 * R.uniqWith(strEq)([1, '1', 1]); //=> [1]
2772 * R.uniqWith(strEq)(['1', 1, 1]); //=> ['1']
2773 */
2774module.exports = _curry2(function uniqWith(pred, list) {
2775 var idx = 0;
2776 var len = list.length;
2777 var result = [];
2778 var item;
2779 while (idx < len) {
2780 item = list[idx];
2781 if (!_containsWith(pred, item, result)) {
2782 result[result.length] = item;
2783 }
2784 idx += 1;
2785 }
2786 return result;
2787});
2788
2789
2790/***/ }),
2791/* 61 */
2792/***/ (function(module, exports, __webpack_require__) {
2793
2794"use strict";
2795/* WEBPACK VAR INJECTION */(function(process) {
2796
2797var utils = __webpack_require__(8);
2798var settle = __webpack_require__(135);
2799var buildURL = __webpack_require__(138);
2800var parseHeaders = __webpack_require__(144);
2801var isURLSameOrigin = __webpack_require__(142);
2802var createError = __webpack_require__(64);
2803var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(137);
2804
2805module.exports = function xhrAdapter(config) {
2806 return new Promise(function dispatchXhrRequest(resolve, reject) {
2807 var requestData = config.data;
2808 var requestHeaders = config.headers;
2809
2810 if (utils.isFormData(requestData)) {
2811 delete requestHeaders['Content-Type']; // Let the browser set it
2812 }
2813
2814 var request = new XMLHttpRequest();
2815 var loadEvent = 'onreadystatechange';
2816 var xDomain = false;
2817
2818 // For IE 8/9 CORS support
2819 // Only supports POST and GET calls and doesn't returns the response headers.
2820 // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
2821 if (process.env.NODE_ENV !== 'test' &&
2822 typeof window !== 'undefined' &&
2823 window.XDomainRequest && !('withCredentials' in request) &&
2824 !isURLSameOrigin(config.url)) {
2825 request = new window.XDomainRequest();
2826 loadEvent = 'onload';
2827 xDomain = true;
2828 request.onprogress = function handleProgress() {};
2829 request.ontimeout = function handleTimeout() {};
2830 }
2831
2832 // HTTP basic authentication
2833 if (config.auth) {
2834 var username = config.auth.username || '';
2835 var password = config.auth.password || '';
2836 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
2837 }
2838
2839 request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
2840
2841 // Set the request timeout in MS
2842 request.timeout = config.timeout;
2843
2844 // Listen for ready state
2845 request[loadEvent] = function handleLoad() {
2846 if (!request || (request.readyState !== 4 && !xDomain)) {
2847 return;
2848 }
2849
2850 // The request errored out and we didn't get a response, this will be
2851 // handled by onerror instead
2852 // With one exception: request that using file: protocol, most browsers
2853 // will return status as 0 even though it's a successful request
2854 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2855 return;
2856 }
2857
2858 // Prepare the response
2859 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
2860 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
2861 var response = {
2862 data: responseData,
2863 // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
2864 status: request.status === 1223 ? 204 : request.status,
2865 statusText: request.status === 1223 ? 'No Content' : request.statusText,
2866 headers: responseHeaders,
2867 config: config,
2868 request: request
2869 };
2870
2871 settle(resolve, reject, response);
2872
2873 // Clean up request
2874 request = null;
2875 };
2876
2877 // Handle low level network errors
2878 request.onerror = function handleError() {
2879 // Real errors are hidden from us by the browser
2880 // onerror should only fire if it's a network error
2881 reject(createError('Network Error', config));
2882
2883 // Clean up request
2884 request = null;
2885 };
2886
2887 // Handle timeout
2888 request.ontimeout = function handleTimeout() {
2889 reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
2890
2891 // Clean up request
2892 request = null;
2893 };
2894
2895 // Add xsrf header
2896 // This is only done if running in a standard browser environment.
2897 // Specifically not if we're in a web worker, or react-native.
2898 if (utils.isStandardBrowserEnv()) {
2899 var cookies = __webpack_require__(140);
2900
2901 // Add xsrf header
2902 var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
2903 cookies.read(config.xsrfCookieName) :
2904 undefined;
2905
2906 if (xsrfValue) {
2907 requestHeaders[config.xsrfHeaderName] = xsrfValue;
2908 }
2909 }
2910
2911 // Add headers to the request
2912 if ('setRequestHeader' in request) {
2913 utils.forEach(requestHeaders, function setRequestHeader(val, key) {
2914 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
2915 // Remove Content-Type if data is undefined
2916 delete requestHeaders[key];
2917 } else {
2918 // Otherwise add header to the request
2919 request.setRequestHeader(key, val);
2920 }
2921 });
2922 }
2923
2924 // Add withCredentials to request if needed
2925 if (config.withCredentials) {
2926 request.withCredentials = true;
2927 }
2928
2929 // Add responseType to request if needed
2930 if (config.responseType) {
2931 try {
2932 request.responseType = config.responseType;
2933 } catch (e) {
2934 if (request.responseType !== 'json') {
2935 throw e;
2936 }
2937 }
2938 }
2939
2940 // Handle progress if needed
2941 if (typeof config.onDownloadProgress === 'function') {
2942 request.addEventListener('progress', config.onDownloadProgress);
2943 }
2944
2945 // Not all browsers support upload events
2946 if (typeof config.onUploadProgress === 'function' && request.upload) {
2947 request.upload.addEventListener('progress', config.onUploadProgress);
2948 }
2949
2950 if (config.cancelToken) {
2951 // Handle cancellation
2952 config.cancelToken.promise.then(function onCanceled(cancel) {
2953 if (!request) {
2954 return;
2955 }
2956
2957 request.abort();
2958 reject(cancel);
2959 // Clean up request
2960 request = null;
2961 });
2962 }
2963
2964 if (requestData === undefined) {
2965 requestData = null;
2966 }
2967
2968 // Send the request
2969 request.send(requestData);
2970 });
2971};
2972
2973/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(29)))
2974
2975/***/ }),
2976/* 62 */
2977/***/ (function(module, exports, __webpack_require__) {
2978
2979"use strict";
2980
2981
2982/**
2983 * A `Cancel` is an object that is thrown when an operation is canceled.
2984 *
2985 * @class
2986 * @param {string=} message The message.
2987 */
2988function Cancel(message) {
2989 this.message = message;
2990}
2991
2992Cancel.prototype.toString = function toString() {
2993 return 'Cancel' + (this.message ? ': ' + this.message : '');
2994};
2995
2996Cancel.prototype.__CANCEL__ = true;
2997
2998module.exports = Cancel;
2999
3000
3001/***/ }),
3002/* 63 */
3003/***/ (function(module, exports, __webpack_require__) {
3004
3005"use strict";
3006
3007
3008module.exports = function isCancel(value) {
3009 return !!(value && value.__CANCEL__);
3010};
3011
3012
3013/***/ }),
3014/* 64 */
3015/***/ (function(module, exports, __webpack_require__) {
3016
3017"use strict";
3018
3019
3020var enhanceError = __webpack_require__(134);
3021
3022/**
3023 * Create an Error with the specified message, config, error code, and response.
3024 *
3025 * @param {string} message The error message.
3026 * @param {Object} config The config.
3027 * @param {string} [code] The error code (for example, 'ECONNABORTED').
3028 @ @param {Object} [response] The response.
3029 * @returns {Error} The created error.
3030 */
3031module.exports = function createError(message, config, code, response) {
3032 var error = new Error(message);
3033 return enhanceError(error, config, code, response);
3034};
3035
3036
3037/***/ }),
3038/* 65 */
3039/***/ (function(module, exports, __webpack_require__) {
3040
3041"use strict";
3042
3043
3044module.exports = function bind(fn, thisArg) {
3045 return function wrap() {
3046 var args = new Array(arguments.length);
3047 for (var i = 0; i < args.length; i++) {
3048 args[i] = arguments[i];
3049 }
3050 return fn.apply(thisArg, args);
3051 };
3052};
3053
3054
3055/***/ }),
3056/* 66 */
3057/***/ (function(module, exports, __webpack_require__) {
3058
3059var _concat = __webpack_require__(10);
3060var _curry3 = __webpack_require__(2);
3061
3062
3063/**
3064 * Applies a function to the value at the given index of an array, returning a
3065 * new copy of the array with the element at the given index replaced with the
3066 * result of the function application.
3067 *
3068 * @func
3069 * @memberOf R
3070 * @since v0.14.0
3071 * @category List
3072 * @sig (a -> a) -> Number -> [a] -> [a]
3073 * @param {Function} fn The function to apply.
3074 * @param {Number} idx The index.
3075 * @param {Array|Arguments} list An array-like object whose value
3076 * at the supplied index will be replaced.
3077 * @return {Array} A copy of the supplied array-like object with
3078 * the element at index `idx` replaced with the value
3079 * returned by applying `fn` to the existing element.
3080 * @see R.update
3081 * @example
3082 *
3083 * R.adjust(R.add(10), 1, [1, 2, 3]); //=> [1, 12, 3]
3084 * R.adjust(R.add(10))(1)([1, 2, 3]); //=> [1, 12, 3]
3085 * @symb R.adjust(f, -1, [a, b]) = [a, f(b)]
3086 * @symb R.adjust(f, 0, [a, b]) = [f(a), b]
3087 */
3088module.exports = _curry3(function adjust(fn, idx, list) {
3089 if (idx >= list.length || idx < -list.length) {
3090 return list;
3091 }
3092 var start = idx < 0 ? list.length : 0;
3093 var _idx = start + idx;
3094 var _list = _concat(list);
3095 _list[_idx] = fn(list[_idx]);
3096 return _list;
3097});
3098
3099
3100/***/ }),
3101/* 67 */
3102/***/ (function(module, exports, __webpack_require__) {
3103
3104var _curry2 = __webpack_require__(0);
3105
3106
3107/**
3108 * Returns `true` if both arguments are `true`; `false` otherwise.
3109 *
3110 * @func
3111 * @memberOf R
3112 * @since v0.1.0
3113 * @category Logic
3114 * @sig a -> b -> a | b
3115 * @param {Any} a
3116 * @param {Any} b
3117 * @return {Any} the first argument if it is falsy, otherwise the second argument.
3118 * @see R.both
3119 * @example
3120 *
3121 * R.and(true, true); //=> true
3122 * R.and(true, false); //=> false
3123 * R.and(false, true); //=> false
3124 * R.and(false, false); //=> false
3125 */
3126module.exports = _curry2(function and(a, b) {
3127 return a && b;
3128});
3129
3130
3131/***/ }),
3132/* 68 */
3133/***/ (function(module, exports, __webpack_require__) {
3134
3135var _curry2 = __webpack_require__(0);
3136var _dispatchable = __webpack_require__(3);
3137var _xany = __webpack_require__(94);
3138
3139
3140/**
3141 * Returns `true` if at least one of elements of the list match the predicate,
3142 * `false` otherwise.
3143 *
3144 * Dispatches to the `any` method of the second argument, if present.
3145 *
3146 * Acts as a transducer if a transformer is given in list position.
3147 *
3148 * @func
3149 * @memberOf R
3150 * @since v0.1.0
3151 * @category List
3152 * @sig (a -> Boolean) -> [a] -> Boolean
3153 * @param {Function} fn The predicate function.
3154 * @param {Array} list The array to consider.
3155 * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false`
3156 * otherwise.
3157 * @see R.all, R.none, R.transduce
3158 * @example
3159 *
3160 * var lessThan0 = R.flip(R.lt)(0);
3161 * var lessThan2 = R.flip(R.lt)(2);
3162 * R.any(lessThan0)([1, 2]); //=> false
3163 * R.any(lessThan2)([1, 2]); //=> true
3164 */
3165module.exports = _curry2(_dispatchable(['any'], _xany, function any(fn, list) {
3166 var idx = 0;
3167 while (idx < list.length) {
3168 if (fn(list[idx])) {
3169 return true;
3170 }
3171 idx += 1;
3172 }
3173 return false;
3174}));
3175
3176
3177/***/ }),
3178/* 69 */
3179/***/ (function(module, exports, __webpack_require__) {
3180
3181var _curry2 = __webpack_require__(0);
3182
3183
3184/**
3185 * Applies function `fn` to the argument list `args`. This is useful for
3186 * creating a fixed-arity function from a variadic function. `fn` should be a
3187 * bound function if context is significant.
3188 *
3189 * @func
3190 * @memberOf R
3191 * @since v0.7.0
3192 * @category Function
3193 * @sig (*... -> a) -> [*] -> a
3194 * @param {Function} fn The function which will be called with `args`
3195 * @param {Array} args The arguments to call `fn` with
3196 * @return {*} result The result, equivalent to `fn(...args)`
3197 * @see R.call, R.unapply
3198 * @example
3199 *
3200 * var nums = [1, 2, 3, -99, 42, 6, 7];
3201 * R.apply(Math.max, nums); //=> 42
3202 * @symb R.apply(f, [a, b, c]) = f(a, b, c)
3203 */
3204module.exports = _curry2(function apply(fn, args) {
3205 return fn.apply(this, args);
3206});
3207
3208
3209/***/ }),
3210/* 70 */
3211/***/ (function(module, exports, __webpack_require__) {
3212
3213var _curry3 = __webpack_require__(2);
3214var _has = __webpack_require__(6);
3215var _isArray = __webpack_require__(15);
3216var _isInteger = __webpack_require__(90);
3217var assoc = __webpack_require__(31);
3218
3219
3220/**
3221 * Makes a shallow clone of an object, setting or overriding the nodes required
3222 * to create the given path, and placing the specific value at the tail end of
3223 * that path. Note that this copies and flattens prototype properties onto the
3224 * new object as well. All non-primitive properties are copied by reference.
3225 *
3226 * @func
3227 * @memberOf R
3228 * @since v0.8.0
3229 * @category Object
3230 * @typedefn Idx = String | Int
3231 * @sig [Idx] -> a -> {a} -> {a}
3232 * @param {Array} path the path to set
3233 * @param {*} val The new value
3234 * @param {Object} obj The object to clone
3235 * @return {Object} A new object equivalent to the original except along the specified path.
3236 * @see R.dissocPath
3237 * @example
3238 *
3239 * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}
3240 *
3241 * // Any missing or non-object keys in path will be overridden
3242 * R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}}
3243 */
3244module.exports = _curry3(function assocPath(path, val, obj) {
3245 if (path.length === 0) {
3246 return val;
3247 }
3248 var idx = path[0];
3249 if (path.length > 1) {
3250 var nextObj = _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {};
3251 val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
3252 }
3253 if (_isInteger(idx) && _isArray(obj)) {
3254 var arr = [].concat(obj);
3255 arr[idx] = val;
3256 return arr;
3257 } else {
3258 return assoc(idx, val, obj);
3259 }
3260});
3261
3262
3263/***/ }),
3264/* 71 */
3265/***/ (function(module, exports, __webpack_require__) {
3266
3267var _arity = __webpack_require__(12);
3268var _curry2 = __webpack_require__(0);
3269
3270
3271/**
3272 * Creates a function that is bound to a context.
3273 * Note: `R.bind` does not provide the additional argument-binding capabilities of
3274 * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
3275 *
3276 * @func
3277 * @memberOf R
3278 * @since v0.6.0
3279 * @category Function
3280 * @category Object
3281 * @sig (* -> *) -> {*} -> (* -> *)
3282 * @param {Function} fn The function to bind to context
3283 * @param {Object} thisObj The context to bind `fn` to
3284 * @return {Function} A function that will execute in the context of `thisObj`.
3285 * @see R.partial
3286 * @example
3287 *
3288 * var log = R.bind(console.log, console);
3289 * R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
3290 * // logs {a: 2}
3291 * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
3292 */
3293module.exports = _curry2(function bind(fn, thisObj) {
3294 return _arity(fn.length, function() {
3295 return fn.apply(thisObj, arguments);
3296 });
3297});
3298
3299
3300/***/ }),
3301/* 72 */
3302/***/ (function(module, exports, __webpack_require__) {
3303
3304var chain = __webpack_require__(47);
3305var compose = __webpack_require__(48);
3306var map = __webpack_require__(7);
3307
3308
3309/**
3310 * Returns the right-to-left Kleisli composition of the provided functions,
3311 * each of which must return a value of a type supported by [`chain`](#chain).
3312 *
3313 * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), R.chain(f))`.
3314 *
3315 * @func
3316 * @memberOf R
3317 * @since v0.16.0
3318 * @category Function
3319 * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z)
3320 * @param {...Function} ...functions The functions to compose
3321 * @return {Function}
3322 * @see R.pipeK
3323 * @example
3324 *
3325 * // get :: String -> Object -> Maybe *
3326 * var get = R.curry((propName, obj) => Maybe(obj[propName]))
3327 *
3328 * // getStateCode :: Maybe String -> Maybe String
3329 * var getStateCode = R.composeK(
3330 * R.compose(Maybe.of, R.toUpper),
3331 * get('state'),
3332 * get('address'),
3333 * get('user'),
3334 * );
3335 * getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY")
3336 * getStateCode({}); //=> Maybe.Nothing()
3337 * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a)))
3338 */
3339module.exports = function composeK() {
3340 if (arguments.length === 0) {
3341 throw new Error('composeK requires at least one argument');
3342 }
3343 var init = Array.prototype.slice.call(arguments);
3344 var last = init.pop();
3345 return compose(compose.apply(this, map(chain, init)), last);
3346};
3347
3348
3349/***/ }),
3350/* 73 */
3351/***/ (function(module, exports, __webpack_require__) {
3352
3353var _curry2 = __webpack_require__(0);
3354var curry = __webpack_require__(32);
3355var nAry = __webpack_require__(41);
3356
3357
3358/**
3359 * Wraps a constructor function inside a curried function that can be called
3360 * with the same arguments and returns the same type. The arity of the function
3361 * returned is specified to allow using variadic constructor functions.
3362 *
3363 * @func
3364 * @memberOf R
3365 * @since v0.4.0
3366 * @category Function
3367 * @sig Number -> (* -> {*}) -> (* -> {*})
3368 * @param {Number} n The arity of the constructor function.
3369 * @param {Function} Fn The constructor function to wrap.
3370 * @return {Function} A wrapped, curried constructor function.
3371 * @example
3372 *
3373 * // Variadic Constructor function
3374 * function Salad() {
3375 * this.ingredients = arguments;
3376 * };
3377 * Salad.prototype.recipe = function() {
3378 * var instructions = R.map((ingredient) => (
3379 * 'Add a whollop of ' + ingredient, this.ingredients)
3380 * )
3381 * return R.join('\n', instructions)
3382 * }
3383 *
3384 * var ThreeLayerSalad = R.constructN(3, Salad)
3385 *
3386 * // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments.
3387 * var salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup')
3388 * console.log(salad.recipe());
3389 * // Add a whollop of Mayonnaise
3390 * // Add a whollop of Potato Chips
3391 * // Add a whollop of Potato Ketchup
3392 */
3393module.exports = _curry2(function constructN(n, Fn) {
3394 if (n > 10) {
3395 throw new Error('Constructor with greater than ten arguments');
3396 }
3397 if (n === 0) {
3398 return function() { return new Fn(); };
3399 }
3400 return curry(nAry(n, function($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
3401 switch (arguments.length) {
3402 case 1: return new Fn($0);
3403 case 2: return new Fn($0, $1);
3404 case 3: return new Fn($0, $1, $2);
3405 case 4: return new Fn($0, $1, $2, $3);
3406 case 5: return new Fn($0, $1, $2, $3, $4);
3407 case 6: return new Fn($0, $1, $2, $3, $4, $5);
3408 case 7: return new Fn($0, $1, $2, $3, $4, $5, $6);
3409 case 8: return new Fn($0, $1, $2, $3, $4, $5, $6, $7);
3410 case 9: return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8);
3411 case 10: return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9);
3412 }
3413 }));
3414});
3415
3416
3417/***/ }),
3418/* 74 */
3419/***/ (function(module, exports, __webpack_require__) {
3420
3421var _curry2 = __webpack_require__(0);
3422var _map = __webpack_require__(38);
3423var curryN = __webpack_require__(5);
3424var max = __webpack_require__(20);
3425var pluck = __webpack_require__(26);
3426var reduce = __webpack_require__(14);
3427
3428
3429/**
3430 * Accepts a converging function and a list of branching functions and returns
3431 * a new function. When invoked, this new function is applied to some
3432 * arguments, each branching function is applied to those same arguments. The
3433 * results of each branching function are passed as arguments to the converging
3434 * function to produce the return value.
3435 *
3436 * @func
3437 * @memberOf R
3438 * @since v0.4.2
3439 * @category Function
3440 * @sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z)
3441 * @param {Function} after A function. `after` will be invoked with the return values of
3442 * `fn1` and `fn2` as its arguments.
3443 * @param {Array} functions A list of functions.
3444 * @return {Function} A new function.
3445 * @see R.useWith
3446 * @example
3447 *
3448 * var average = R.converge(R.divide, [R.sum, R.length])
3449 * average([1, 2, 3, 4, 5, 6, 7]) //=> 4
3450 *
3451 * var strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower])
3452 * strangeConcat("Yodel") //=> "YODELyodel"
3453 *
3454 * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b))
3455 */
3456module.exports = _curry2(function converge(after, fns) {
3457 return curryN(reduce(max, 0, pluck('length', fns)), function() {
3458 var args = arguments;
3459 var context = this;
3460 return after.apply(context, _map(function(fn) {
3461 return fn.apply(context, args);
3462 }, fns));
3463 });
3464});
3465
3466
3467/***/ }),
3468/* 75 */
3469/***/ (function(module, exports, __webpack_require__) {
3470
3471var _curry2 = __webpack_require__(0);
3472
3473
3474/**
3475 * Returns the second argument if it is not `null`, `undefined` or `NaN`
3476 * otherwise the first argument is returned.
3477 *
3478 * @func
3479 * @memberOf R
3480 * @since v0.10.0
3481 * @category Logic
3482 * @sig a -> b -> a | b
3483 * @param {a} default The default value.
3484 * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`.
3485 * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value
3486 * @example
3487 *
3488 * var defaultTo42 = R.defaultTo(42);
3489 *
3490 * defaultTo42(null); //=> 42
3491 * defaultTo42(undefined); //=> 42
3492 * defaultTo42('Ramda'); //=> 'Ramda'
3493 * // parseInt('string') results in NaN
3494 * defaultTo42(parseInt('string')); //=> 42
3495 */
3496module.exports = _curry2(function defaultTo(d, v) {
3497 return v == null || v !== v ? d : v;
3498});
3499
3500
3501/***/ }),
3502/* 76 */
3503/***/ (function(module, exports, __webpack_require__) {
3504
3505var _contains = __webpack_require__(17);
3506var _curry2 = __webpack_require__(0);
3507
3508
3509/**
3510 * Finds the set (i.e. no duplicates) of all elements in the first list not
3511 * contained in the second list. Objects and Arrays are compared are compared
3512 * in terms of value equality, not reference equality.
3513 *
3514 * @func
3515 * @memberOf R
3516 * @since v0.1.0
3517 * @category Relation
3518 * @sig [*] -> [*] -> [*]
3519 * @param {Array} list1 The first list.
3520 * @param {Array} list2 The second list.
3521 * @return {Array} The elements in `list1` that are not in `list2`.
3522 * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith
3523 * @example
3524 *
3525 * R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
3526 * R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
3527 * R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}]
3528 */
3529module.exports = _curry2(function difference(first, second) {
3530 var out = [];
3531 var idx = 0;
3532 var firstLen = first.length;
3533 while (idx < firstLen) {
3534 if (!_contains(first[idx], second) && !_contains(first[idx], out)) {
3535 out[out.length] = first[idx];
3536 }
3537 idx += 1;
3538 }
3539 return out;
3540});
3541
3542
3543/***/ }),
3544/* 77 */
3545/***/ (function(module, exports, __webpack_require__) {
3546
3547var _containsWith = __webpack_require__(53);
3548var _curry3 = __webpack_require__(2);
3549
3550
3551/**
3552 * Finds the set (i.e. no duplicates) of all elements in the first list not
3553 * contained in the second list. Duplication is determined according to the
3554 * value returned by applying the supplied predicate to two list elements.
3555 *
3556 * @func
3557 * @memberOf R
3558 * @since v0.1.0
3559 * @category Relation
3560 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
3561 * @param {Function} pred A predicate used to test whether two items are equal.
3562 * @param {Array} list1 The first list.
3563 * @param {Array} list2 The second list.
3564 * @return {Array} The elements in `list1` that are not in `list2`.
3565 * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith
3566 * @example
3567 *
3568 * var cmp = (x, y) => x.a === y.a;
3569 * var l1 = [{a: 1}, {a: 2}, {a: 3}];
3570 * var l2 = [{a: 3}, {a: 4}];
3571 * R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}]
3572 */
3573module.exports = _curry3(function differenceWith(pred, first, second) {
3574 var out = [];
3575 var idx = 0;
3576 var firstLen = first.length;
3577 while (idx < firstLen) {
3578 if (!_containsWith(pred, first[idx], second) &&
3579 !_containsWith(pred, first[idx], out)) {
3580 out.push(first[idx]);
3581 }
3582 idx += 1;
3583 }
3584 return out;
3585});
3586
3587
3588/***/ }),
3589/* 78 */
3590/***/ (function(module, exports, __webpack_require__) {
3591
3592var _curry2 = __webpack_require__(0);
3593
3594
3595/**
3596 * Returns a new object that does not contain a `prop` property.
3597 *
3598 * @func
3599 * @memberOf R
3600 * @since v0.10.0
3601 * @category Object
3602 * @sig String -> {k: v} -> {k: v}
3603 * @param {String} prop The name of the property to dissociate
3604 * @param {Object} obj The object to clone
3605 * @return {Object} A new object equivalent to the original but without the specified property
3606 * @see R.assoc
3607 * @example
3608 *
3609 * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}
3610 */
3611module.exports = _curry2(function dissoc(prop, obj) {
3612 var result = {};
3613 for (var p in obj) {
3614 result[p] = obj[p];
3615 }
3616 delete result[prop];
3617 return result;
3618});
3619
3620
3621/***/ }),
3622/* 79 */
3623/***/ (function(module, exports, __webpack_require__) {
3624
3625var _curry2 = __webpack_require__(0);
3626var _dispatchable = __webpack_require__(3);
3627var _xdrop = __webpack_require__(234);
3628var slice = __webpack_require__(18);
3629
3630
3631/**
3632 * Returns all but the first `n` elements of the given list, string, or
3633 * transducer/transformer (or object with a `drop` method).
3634 *
3635 * Dispatches to the `drop` method of the second argument, if present.
3636 *
3637 * @func
3638 * @memberOf R
3639 * @since v0.1.0
3640 * @category List
3641 * @sig Number -> [a] -> [a]
3642 * @sig Number -> String -> String
3643 * @param {Number} n
3644 * @param {[a]} list
3645 * @return {[a]} A copy of list without the first `n` elements
3646 * @see R.take, R.transduce, R.dropLast, R.dropWhile
3647 * @example
3648 *
3649 * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
3650 * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']
3651 * R.drop(3, ['foo', 'bar', 'baz']); //=> []
3652 * R.drop(4, ['foo', 'bar', 'baz']); //=> []
3653 * R.drop(3, 'ramda'); //=> 'da'
3654 */
3655module.exports = _curry2(_dispatchable(['drop'], _xdrop, function drop(n, xs) {
3656 return slice(Math.max(0, n), Infinity, xs);
3657}));
3658
3659
3660/***/ }),
3661/* 80 */
3662/***/ (function(module, exports, __webpack_require__) {
3663
3664var _curry2 = __webpack_require__(0);
3665var _dispatchable = __webpack_require__(3);
3666var _xdropRepeatsWith = __webpack_require__(95);
3667var last = __webpack_require__(99);
3668
3669
3670/**
3671 * Returns a new list without any consecutively repeating elements. Equality is
3672 * determined by applying the supplied predicate to each pair of consecutive elements. The
3673 * first element in a series of equal elements will be preserved.
3674 *
3675 * Acts as a transducer if a transformer is given in list position.
3676 *
3677 * @func
3678 * @memberOf R
3679 * @since v0.14.0
3680 * @category List
3681 * @sig (a, a -> Boolean) -> [a] -> [a]
3682 * @param {Function} pred A predicate used to test whether two items are equal.
3683 * @param {Array} list The array to consider.
3684 * @return {Array} `list` without repeating elements.
3685 * @see R.transduce
3686 * @example
3687 *
3688 * var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3];
3689 * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3]
3690 */
3691module.exports = _curry2(_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) {
3692 var result = [];
3693 var idx = 1;
3694 var len = list.length;
3695 if (len !== 0) {
3696 result[0] = list[0];
3697 while (idx < len) {
3698 if (!pred(last(result), list[idx])) {
3699 result[result.length] = list[idx];
3700 }
3701 idx += 1;
3702 }
3703 }
3704 return result;
3705}));
3706
3707
3708
3709/***/ }),
3710/* 81 */
3711/***/ (function(module, exports, __webpack_require__) {
3712
3713var _curry1 = __webpack_require__(1);
3714var _isArguments = __webpack_require__(89);
3715var _isArray = __webpack_require__(15);
3716var _isObject = __webpack_require__(92);
3717var _isString = __webpack_require__(37);
3718
3719
3720/**
3721 * Returns the empty value of its argument's type. Ramda defines the empty
3722 * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other
3723 * types are supported if they define `<Type>.empty` and/or
3724 * `<Type>.prototype.empty`.
3725 *
3726 * Dispatches to the `empty` method of the first argument, if present.
3727 *
3728 * @func
3729 * @memberOf R
3730 * @since v0.3.0
3731 * @category Function
3732 * @sig a -> a
3733 * @param {*} x
3734 * @return {*}
3735 * @example
3736 *
3737 * R.empty(Just(42)); //=> Nothing()
3738 * R.empty([1, 2, 3]); //=> []
3739 * R.empty('unicorns'); //=> ''
3740 * R.empty({x: 1, y: 2}); //=> {}
3741 */
3742module.exports = _curry1(function empty(x) {
3743 return (
3744 (x != null && typeof x.empty === 'function') ?
3745 x.empty() :
3746 (x != null && x.constructor != null && typeof x.constructor.empty === 'function') ?
3747 x.constructor.empty() :
3748 _isArray(x) ?
3749 [] :
3750 _isString(x) ?
3751 '' :
3752 _isObject(x) ?
3753 {} :
3754 _isArguments(x) ?
3755 (function() { return arguments; }()) :
3756 // else
3757 void 0
3758 );
3759});
3760
3761
3762/***/ }),
3763/* 82 */
3764/***/ (function(module, exports, __webpack_require__) {
3765
3766var _curry2 = __webpack_require__(0);
3767
3768
3769/**
3770 * Returns true if its arguments are identical, false otherwise. Values are
3771 * identical if they reference the same memory. `NaN` is identical to `NaN`;
3772 * `0` and `-0` are not identical.
3773 *
3774 * @func
3775 * @memberOf R
3776 * @since v0.15.0
3777 * @category Relation
3778 * @sig a -> a -> Boolean
3779 * @param {*} a
3780 * @param {*} b
3781 * @return {Boolean}
3782 * @example
3783 *
3784 * var o = {};
3785 * R.identical(o, o); //=> true
3786 * R.identical(1, 1); //=> true
3787 * R.identical(1, '1'); //=> false
3788 * R.identical([], []); //=> false
3789 * R.identical(0, -0); //=> false
3790 * R.identical(NaN, NaN); //=> true
3791 */
3792module.exports = _curry2(function identical(a, b) {
3793 // SameValue algorithm
3794 if (a === b) { // Steps 1-5, 7-10
3795 // Steps 6.b-6.e: +0 != -0
3796 return a !== 0 || 1 / a === 1 / b;
3797 } else {
3798 // Step 6.a: NaN == NaN
3799 return a !== a && b !== b;
3800 }
3801});
3802
3803
3804/***/ }),
3805/* 83 */
3806/***/ (function(module, exports, __webpack_require__) {
3807
3808var _cloneRegExp = __webpack_require__(84);
3809var type = __webpack_require__(58);
3810
3811
3812/**
3813 * Copies an object.
3814 *
3815 * @private
3816 * @param {*} value The value to be copied
3817 * @param {Array} refFrom Array containing the source references
3818 * @param {Array} refTo Array containing the copied source references
3819 * @param {Boolean} deep Whether or not to perform deep cloning.
3820 * @return {*} The copied value.
3821 */
3822module.exports = function _clone(value, refFrom, refTo, deep) {
3823 var copy = function copy(copiedValue) {
3824 var len = refFrom.length;
3825 var idx = 0;
3826 while (idx < len) {
3827 if (value === refFrom[idx]) {
3828 return refTo[idx];
3829 }
3830 idx += 1;
3831 }
3832 refFrom[idx + 1] = value;
3833 refTo[idx + 1] = copiedValue;
3834 for (var key in value) {
3835 copiedValue[key] = deep ?
3836 _clone(value[key], refFrom, refTo, true) : value[key];
3837 }
3838 return copiedValue;
3839 };
3840 switch (type(value)) {
3841 case 'Object': return copy({});
3842 case 'Array': return copy([]);
3843 case 'Date': return new Date(value.valueOf());
3844 case 'RegExp': return _cloneRegExp(value);
3845 default: return value;
3846 }
3847};
3848
3849
3850/***/ }),
3851/* 84 */
3852/***/ (function(module, exports) {
3853
3854module.exports = function _cloneRegExp(pattern) {
3855 return new RegExp(pattern.source, (pattern.global ? 'g' : '') +
3856 (pattern.ignoreCase ? 'i' : '') +
3857 (pattern.multiline ? 'm' : '') +
3858 (pattern.sticky ? 'y' : '') +
3859 (pattern.unicode ? 'u' : ''));
3860};
3861
3862
3863/***/ }),
3864/* 85 */
3865/***/ (function(module, exports) {
3866
3867module.exports = function _complement(f) {
3868 return function() {
3869 return !f.apply(this, arguments);
3870 };
3871};
3872
3873
3874/***/ }),
3875/* 86 */
3876/***/ (function(module, exports, __webpack_require__) {
3877
3878var _arity = __webpack_require__(12);
3879var _curry2 = __webpack_require__(0);
3880
3881
3882module.exports = function _createPartialApplicator(concat) {
3883 return _curry2(function(fn, args) {
3884 return _arity(Math.max(0, fn.length - args.length), function() {
3885 return fn.apply(this, concat(args, arguments));
3886 });
3887 });
3888};
3889
3890
3891/***/ }),
3892/* 87 */
3893/***/ (function(module, exports) {
3894
3895module.exports = function _filter(fn, list) {
3896 var idx = 0;
3897 var len = list.length;
3898 var result = [];
3899
3900 while (idx < len) {
3901 if (fn(list[idx])) {
3902 result[result.length] = list[idx];
3903 }
3904 idx += 1;
3905 }
3906 return result;
3907};
3908
3909
3910/***/ }),
3911/* 88 */
3912/***/ (function(module, exports, __webpack_require__) {
3913
3914var equals = __webpack_require__(11);
3915
3916
3917module.exports = function _indexOf(list, a, idx) {
3918 var inf, item;
3919 // Array.prototype.indexOf doesn't exist below IE9
3920 if (typeof list.indexOf === 'function') {
3921 switch (typeof a) {
3922 case 'number':
3923 if (a === 0) {
3924 // manually crawl the list to distinguish between +0 and -0
3925 inf = 1 / a;
3926 while (idx < list.length) {
3927 item = list[idx];
3928 if (item === 0 && 1 / item === inf) {
3929 return idx;
3930 }
3931 idx += 1;
3932 }
3933 return -1;
3934 } else if (a !== a) {
3935 // NaN
3936 while (idx < list.length) {
3937 item = list[idx];
3938 if (typeof item === 'number' && item !== item) {
3939 return idx;
3940 }
3941 idx += 1;
3942 }
3943 return -1;
3944 }
3945 // non-zero numbers can utilise Set
3946 return list.indexOf(a, idx);
3947
3948 // all these types can utilise Set
3949 case 'string':
3950 case 'boolean':
3951 case 'function':
3952 case 'undefined':
3953 return list.indexOf(a, idx);
3954
3955 case 'object':
3956 if (a === null) {
3957 // null can utilise Set
3958 return list.indexOf(a, idx);
3959 }
3960 }
3961 }
3962 // anything else not covered above, defer to R.equals
3963 while (idx < list.length) {
3964 if (equals(list[idx], a)) {
3965 return idx;
3966 }
3967 idx += 1;
3968 }
3969 return -1;
3970};
3971
3972
3973/***/ }),
3974/* 89 */
3975/***/ (function(module, exports, __webpack_require__) {
3976
3977var _has = __webpack_require__(6);
3978
3979
3980module.exports = (function() {
3981 var toString = Object.prototype.toString;
3982 return toString.call(arguments) === '[object Arguments]' ?
3983 function _isArguments(x) { return toString.call(x) === '[object Arguments]'; } :
3984 function _isArguments(x) { return _has('callee', x); };
3985}());
3986
3987
3988/***/ }),
3989/* 90 */
3990/***/ (function(module, exports) {
3991
3992/**
3993 * Determine if the passed argument is an integer.
3994 *
3995 * @private
3996 * @param {*} n
3997 * @category Type
3998 * @return {Boolean}
3999 */
4000module.exports = Number.isInteger || function _isInteger(n) {
4001 return (n << 0) === n;
4002};
4003
4004
4005/***/ }),
4006/* 91 */
4007/***/ (function(module, exports) {
4008
4009module.exports = function _isNumber(x) {
4010 return Object.prototype.toString.call(x) === '[object Number]';
4011};
4012
4013
4014/***/ }),
4015/* 92 */
4016/***/ (function(module, exports) {
4017
4018module.exports = function _isObject(x) {
4019 return Object.prototype.toString.call(x) === '[object Object]';
4020};
4021
4022
4023/***/ }),
4024/* 93 */
4025/***/ (function(module, exports, __webpack_require__) {
4026
4027var isArrayLike = __webpack_require__(23);
4028
4029
4030/**
4031 * `_makeFlat` is a helper function that returns a one-level or fully recursive
4032 * function based on the flag passed in.
4033 *
4034 * @private
4035 */
4036module.exports = function _makeFlat(recursive) {
4037 return function flatt(list) {
4038 var value, jlen, j;
4039 var result = [];
4040 var idx = 0;
4041 var ilen = list.length;
4042
4043 while (idx < ilen) {
4044 if (isArrayLike(list[idx])) {
4045 value = recursive ? flatt(list[idx]) : list[idx];
4046 j = 0;
4047 jlen = value.length;
4048 while (j < jlen) {
4049 result[result.length] = value[j];
4050 j += 1;
4051 }
4052 } else {
4053 result[result.length] = list[idx];
4054 }
4055 idx += 1;
4056 }
4057 return result;
4058 };
4059};
4060
4061
4062/***/ }),
4063/* 94 */
4064/***/ (function(module, exports, __webpack_require__) {
4065
4066var _curry2 = __webpack_require__(0);
4067var _reduced = __webpack_require__(16);
4068var _xfBase = __webpack_require__(4);
4069
4070
4071module.exports = (function() {
4072 function XAny(f, xf) {
4073 this.xf = xf;
4074 this.f = f;
4075 this.any = false;
4076 }
4077 XAny.prototype['@@transducer/init'] = _xfBase.init;
4078 XAny.prototype['@@transducer/result'] = function(result) {
4079 if (!this.any) {
4080 result = this.xf['@@transducer/step'](result, false);
4081 }
4082 return this.xf['@@transducer/result'](result);
4083 };
4084 XAny.prototype['@@transducer/step'] = function(result, input) {
4085 if (this.f(input)) {
4086 this.any = true;
4087 result = _reduced(this.xf['@@transducer/step'](result, true));
4088 }
4089 return result;
4090 };
4091
4092 return _curry2(function _xany(f, xf) { return new XAny(f, xf); });
4093}());
4094
4095
4096/***/ }),
4097/* 95 */
4098/***/ (function(module, exports, __webpack_require__) {
4099
4100var _curry2 = __webpack_require__(0);
4101var _xfBase = __webpack_require__(4);
4102
4103
4104module.exports = (function() {
4105 function XDropRepeatsWith(pred, xf) {
4106 this.xf = xf;
4107 this.pred = pred;
4108 this.lastValue = undefined;
4109 this.seenFirstValue = false;
4110 }
4111
4112 XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init;
4113 XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result;
4114 XDropRepeatsWith.prototype['@@transducer/step'] = function(result, input) {
4115 var sameAsLast = false;
4116 if (!this.seenFirstValue) {
4117 this.seenFirstValue = true;
4118 } else if (this.pred(this.lastValue, input)) {
4119 sameAsLast = true;
4120 }
4121 this.lastValue = input;
4122 return sameAsLast ? result : this.xf['@@transducer/step'](result, input);
4123 };
4124
4125 return _curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); });
4126}());
4127
4128
4129/***/ }),
4130/* 96 */
4131/***/ (function(module, exports) {
4132
4133module.exports = (function() {
4134 function XWrap(fn) {
4135 this.f = fn;
4136 }
4137 XWrap.prototype['@@transducer/init'] = function() {
4138 throw new Error('init not implemented on XWrap');
4139 };
4140 XWrap.prototype['@@transducer/result'] = function(acc) { return acc; };
4141 XWrap.prototype['@@transducer/step'] = function(acc, x) {
4142 return this.f(acc, x);
4143 };
4144
4145 return function _xwrap(fn) { return new XWrap(fn); };
4146}());
4147
4148
4149/***/ }),
4150/* 97 */
4151/***/ (function(module, exports, __webpack_require__) {
4152
4153var _curry2 = __webpack_require__(0);
4154
4155
4156/**
4157 * See if an object (`val`) is an instance of the supplied constructor. This
4158 * function will check up the inheritance chain, if any.
4159 *
4160 * @func
4161 * @memberOf R
4162 * @since v0.3.0
4163 * @category Type
4164 * @sig (* -> {*}) -> a -> Boolean
4165 * @param {Object} ctor A constructor
4166 * @param {*} val The value to test
4167 * @return {Boolean}
4168 * @example
4169 *
4170 * R.is(Object, {}); //=> true
4171 * R.is(Number, 1); //=> true
4172 * R.is(Object, 1); //=> false
4173 * R.is(String, 's'); //=> true
4174 * R.is(String, new String('')); //=> true
4175 * R.is(Object, new String('')); //=> true
4176 * R.is(Object, 's'); //=> false
4177 * R.is(Number, {}); //=> false
4178 */
4179module.exports = _curry2(function is(Ctor, val) {
4180 return val != null && val.constructor === Ctor || val instanceof Ctor;
4181});
4182
4183
4184/***/ }),
4185/* 98 */
4186/***/ (function(module, exports, __webpack_require__) {
4187
4188var _curry1 = __webpack_require__(1);
4189var converge = __webpack_require__(74);
4190
4191
4192/**
4193 * juxt applies a list of functions to a list of values.
4194 *
4195 * @func
4196 * @memberOf R
4197 * @since v0.19.0
4198 * @category Function
4199 * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n])
4200 * @param {Array} fns An array of functions
4201 * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters.
4202 * @see R.applySpec
4203 * @example
4204 *
4205 * var getRange = R.juxt([Math.min, Math.max]);
4206 * getRange(3, 4, 9, -3); //=> [-3, 9]
4207 * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)]
4208 */
4209module.exports = _curry1(function juxt(fns) {
4210 return converge(function() { return Array.prototype.slice.call(arguments, 0); }, fns);
4211});
4212
4213
4214/***/ }),
4215/* 99 */
4216/***/ (function(module, exports, __webpack_require__) {
4217
4218var nth = __webpack_require__(24);
4219
4220
4221/**
4222 * Returns the last element of the given list or string.
4223 *
4224 * @func
4225 * @memberOf R
4226 * @since v0.1.4
4227 * @category List
4228 * @sig [a] -> a | Undefined
4229 * @sig String -> String
4230 * @param {*} list
4231 * @return {*}
4232 * @see R.init, R.head, R.tail
4233 * @example
4234 *
4235 * R.last(['fi', 'fo', 'fum']); //=> 'fum'
4236 * R.last([]); //=> undefined
4237 *
4238 * R.last('abc'); //=> 'c'
4239 * R.last(''); //=> ''
4240 */
4241module.exports = nth(-1);
4242
4243
4244/***/ }),
4245/* 100 */
4246/***/ (function(module, exports, __webpack_require__) {
4247
4248var _curry1 = __webpack_require__(1);
4249var _isNumber = __webpack_require__(91);
4250
4251
4252/**
4253 * Returns the number of elements in the array by returning `list.length`.
4254 *
4255 * @func
4256 * @memberOf R
4257 * @since v0.3.0
4258 * @category List
4259 * @sig [a] -> Number
4260 * @param {Array} list The array to inspect.
4261 * @return {Number} The length of the array.
4262 * @example
4263 *
4264 * R.length([]); //=> 0
4265 * R.length([1, 2, 3]); //=> 3
4266 */
4267module.exports = _curry1(function length(list) {
4268 return list != null && _isNumber(list.length) ? list.length : NaN;
4269});
4270
4271
4272/***/ }),
4273/* 101 */
4274/***/ (function(module, exports, __webpack_require__) {
4275
4276var _curry2 = __webpack_require__(0);
4277var _reduce = __webpack_require__(9);
4278var ap = __webpack_require__(46);
4279var curryN = __webpack_require__(5);
4280var map = __webpack_require__(7);
4281
4282
4283/**
4284 * "lifts" a function to be the specified arity, so that it may "map over" that
4285 * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
4286 *
4287 * @func
4288 * @memberOf R
4289 * @since v0.7.0
4290 * @category Function
4291 * @sig Number -> (*... -> *) -> ([*]... -> [*])
4292 * @param {Function} fn The function to lift into higher context
4293 * @return {Function} The lifted function.
4294 * @see R.lift, R.ap
4295 * @example
4296 *
4297 * var madd3 = R.liftN(3, (...args) => R.sum(args));
4298 * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
4299 */
4300module.exports = _curry2(function liftN(arity, fn) {
4301 var lifted = curryN(arity, fn);
4302 return curryN(arity, function() {
4303 return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
4304 });
4305});
4306
4307
4308/***/ }),
4309/* 102 */
4310/***/ (function(module, exports, __webpack_require__) {
4311
4312var _curry1 = __webpack_require__(1);
4313var sum = __webpack_require__(115);
4314
4315
4316/**
4317 * Returns the mean of the given list of numbers.
4318 *
4319 * @func
4320 * @memberOf R
4321 * @since v0.14.0
4322 * @category Math
4323 * @sig [Number] -> Number
4324 * @param {Array} list
4325 * @return {Number}
4326 * @example
4327 *
4328 * R.mean([2, 7, 9]); //=> 6
4329 * R.mean([]); //=> NaN
4330 */
4331module.exports = _curry1(function mean(list) {
4332 return sum(list) / list.length;
4333});
4334
4335
4336/***/ }),
4337/* 103 */
4338/***/ (function(module, exports, __webpack_require__) {
4339
4340var _curry3 = __webpack_require__(2);
4341var _has = __webpack_require__(6);
4342
4343
4344/**
4345 * Creates a new object with the own properties of the two provided objects. If
4346 * a key exists in both objects, the provided function is applied to the key
4347 * and the values associated with the key in each object, with the result being
4348 * used as the value associated with the key in the returned object. The key
4349 * will be excluded from the returned object if the resulting value is
4350 * `undefined`.
4351 *
4352 * @func
4353 * @memberOf R
4354 * @since v0.19.0
4355 * @category Object
4356 * @sig (String -> a -> a -> a) -> {a} -> {a} -> {a}
4357 * @param {Function} fn
4358 * @param {Object} l
4359 * @param {Object} r
4360 * @return {Object}
4361 * @see R.merge, R.mergeWith
4362 * @example
4363 *
4364 * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
4365 * R.mergeWithKey(concatValues,
4366 * { a: true, thing: 'foo', values: [10, 20] },
4367 * { b: true, thing: 'bar', values: [15, 35] });
4368 * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }
4369 * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }
4370 */
4371module.exports = _curry3(function mergeWithKey(fn, l, r) {
4372 var result = {};
4373 var k;
4374
4375 for (k in l) {
4376 if (_has(k, l)) {
4377 result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];
4378 }
4379 }
4380
4381 for (k in r) {
4382 if (_has(k, r) && !(_has(k, result))) {
4383 result[k] = r[k];
4384 }
4385 }
4386
4387 return result;
4388});
4389
4390
4391/***/ }),
4392/* 104 */
4393/***/ (function(module, exports, __webpack_require__) {
4394
4395var _curry2 = __webpack_require__(0);
4396
4397
4398/**
4399 * Multiplies two numbers. Equivalent to `a * b` but curried.
4400 *
4401 * @func
4402 * @memberOf R
4403 * @since v0.1.0
4404 * @category Math
4405 * @sig Number -> Number -> Number
4406 * @param {Number} a The first value.
4407 * @param {Number} b The second value.
4408 * @return {Number} The result of `a * b`.
4409 * @see R.divide
4410 * @example
4411 *
4412 * var double = R.multiply(2);
4413 * var triple = R.multiply(3);
4414 * double(3); //=> 6
4415 * triple(4); //=> 12
4416 * R.multiply(2, 5); //=> 10
4417 */
4418module.exports = _curry2(function multiply(a, b) { return a * b; });
4419
4420
4421/***/ }),
4422/* 105 */
4423/***/ (function(module, exports, __webpack_require__) {
4424
4425var _curry1 = __webpack_require__(1);
4426
4427
4428/**
4429 * A function that returns the `!` of its argument. It will return `true` when
4430 * passed false-y value, and `false` when passed a truth-y one.
4431 *
4432 * @func
4433 * @memberOf R
4434 * @since v0.1.0
4435 * @category Logic
4436 * @sig * -> Boolean
4437 * @param {*} a any value
4438 * @return {Boolean} the logical inverse of passed argument.
4439 * @see R.complement
4440 * @example
4441 *
4442 * R.not(true); //=> false
4443 * R.not(false); //=> true
4444 * R.not(0); //=> true
4445 * R.not(1); //=> false
4446 */
4447module.exports = _curry1(function not(a) {
4448 return !a;
4449});
4450
4451
4452/***/ }),
4453/* 106 */
4454/***/ (function(module, exports, __webpack_require__) {
4455
4456var _curry2 = __webpack_require__(0);
4457
4458
4459/**
4460 * Creates an object containing a single key:value pair.
4461 *
4462 * @func
4463 * @memberOf R
4464 * @since v0.18.0
4465 * @category Object
4466 * @sig String -> a -> {String:a}
4467 * @param {String} key
4468 * @param {*} val
4469 * @return {Object}
4470 * @see R.pair
4471 * @example
4472 *
4473 * var matchPhrases = R.compose(
4474 * R.objOf('must'),
4475 * R.map(R.objOf('match_phrase'))
4476 * );
4477 * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}
4478 */
4479module.exports = _curry2(function objOf(key, val) {
4480 var obj = {};
4481 obj[key] = val;
4482 return obj;
4483});
4484
4485
4486/***/ }),
4487/* 107 */
4488/***/ (function(module, exports, __webpack_require__) {
4489
4490var _curry2 = __webpack_require__(0);
4491
4492
4493/**
4494 * Returns `true` if one or both of its arguments are `true`. Returns `false`
4495 * if both arguments are `false`.
4496 *
4497 * @func
4498 * @memberOf R
4499 * @since v0.1.0
4500 * @category Logic
4501 * @sig a -> b -> a | b
4502 * @param {Any} a
4503 * @param {Any} b
4504 * @return {Any} the first argument if truthy, otherwise the second argument.
4505 * @see R.either
4506 * @example
4507 *
4508 * R.or(true, true); //=> true
4509 * R.or(true, false); //=> true
4510 * R.or(false, true); //=> true
4511 * R.or(false, false); //=> false
4512 */
4513module.exports = _curry2(function or(a, b) {
4514 return a || b;
4515});
4516
4517
4518/***/ }),
4519/* 108 */
4520/***/ (function(module, exports, __webpack_require__) {
4521
4522var _curry3 = __webpack_require__(2);
4523
4524
4525/**
4526 * Returns the result of "setting" the portion of the given data structure
4527 * focused by the given lens to the result of applying the given function to
4528 * the focused value.
4529 *
4530 * @func
4531 * @memberOf R
4532 * @since v0.16.0
4533 * @category Object
4534 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
4535 * @sig Lens s a -> (a -> a) -> s -> s
4536 * @param {Lens} lens
4537 * @param {*} v
4538 * @param {*} x
4539 * @return {*}
4540 * @see R.prop, R.lensIndex, R.lensProp
4541 * @example
4542 *
4543 * var headLens = R.lensIndex(0);
4544 *
4545 * R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz']
4546 */
4547module.exports = (function() {
4548 // `Identity` is a functor that holds a single value, where `map` simply
4549 // transforms the held value with the provided function.
4550 var Identity = function(x) {
4551 return {value: x, map: function(f) { return Identity(f(x)); }};
4552 };
4553
4554 return _curry3(function over(lens, f, x) {
4555 // The value returned by the getter function is first transformed with `f`,
4556 // then set as the value of an `Identity`. This is then mapped over with the
4557 // setter function of the lens.
4558 return lens(function(y) { return Identity(f(y)); })(x).value;
4559 });
4560}());
4561
4562
4563/***/ }),
4564/* 109 */
4565/***/ (function(module, exports, __webpack_require__) {
4566
4567var _curry2 = __webpack_require__(0);
4568
4569
4570/**
4571 * Similar to `pick` except that this one includes a `key: undefined` pair for
4572 * properties that don't exist.
4573 *
4574 * @func
4575 * @memberOf R
4576 * @since v0.1.0
4577 * @category Object
4578 * @sig [k] -> {k: v} -> {k: v}
4579 * @param {Array} names an array of String property names to copy onto a new object
4580 * @param {Object} obj The object to copy from
4581 * @return {Object} A new object with only properties from `names` on it.
4582 * @see R.pick
4583 * @example
4584 *
4585 * R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
4586 * R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined}
4587 */
4588module.exports = _curry2(function pickAll(names, obj) {
4589 var result = {};
4590 var idx = 0;
4591 var len = names.length;
4592 while (idx < len) {
4593 var name = names[idx];
4594 result[name] = obj[name];
4595 idx += 1;
4596 }
4597 return result;
4598});
4599
4600
4601/***/ }),
4602/* 110 */
4603/***/ (function(module, exports, __webpack_require__) {
4604
4605var _arity = __webpack_require__(12);
4606var _pipe = __webpack_require__(225);
4607var reduce = __webpack_require__(14);
4608var tail = __webpack_require__(57);
4609
4610
4611/**
4612 * Performs left-to-right function composition. The leftmost function may have
4613 * any arity; the remaining functions must be unary.
4614 *
4615 * In some libraries this function is named `sequence`.
4616 *
4617 * **Note:** The result of pipe is not automatically curried.
4618 *
4619 * @func
4620 * @memberOf R
4621 * @since v0.1.0
4622 * @category Function
4623 * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z)
4624 * @param {...Function} functions
4625 * @return {Function}
4626 * @see R.compose
4627 * @example
4628 *
4629 * var f = R.pipe(Math.pow, R.negate, R.inc);
4630 *
4631 * f(3, 4); // -(3^4) + 1
4632 * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b)))
4633 */
4634module.exports = function pipe() {
4635 if (arguments.length === 0) {
4636 throw new Error('pipe requires at least one argument');
4637 }
4638 return _arity(arguments[0].length,
4639 reduce(_pipe, arguments[0], tail(arguments)));
4640};
4641
4642
4643/***/ }),
4644/* 111 */
4645/***/ (function(module, exports, __webpack_require__) {
4646
4647var _arity = __webpack_require__(12);
4648var _pipeP = __webpack_require__(226);
4649var reduce = __webpack_require__(14);
4650var tail = __webpack_require__(57);
4651
4652
4653/**
4654 * Performs left-to-right composition of one or more Promise-returning
4655 * functions. The leftmost function may have any arity; the remaining functions
4656 * must be unary.
4657 *
4658 * @func
4659 * @memberOf R
4660 * @since v0.10.0
4661 * @category Function
4662 * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z)
4663 * @param {...Function} functions
4664 * @return {Function}
4665 * @see R.composeP
4666 * @example
4667 *
4668 * // followersForUser :: String -> Promise [User]
4669 * var followersForUser = R.pipeP(db.getUserById, db.getFollowers);
4670 */
4671module.exports = function pipeP() {
4672 if (arguments.length === 0) {
4673 throw new Error('pipeP requires at least one argument');
4674 }
4675 return _arity(arguments[0].length,
4676 reduce(_pipeP, arguments[0], tail(arguments)));
4677};
4678
4679
4680/***/ }),
4681/* 112 */
4682/***/ (function(module, exports, __webpack_require__) {
4683
4684var _concat = __webpack_require__(10);
4685var _curry2 = __webpack_require__(0);
4686
4687
4688/**
4689 * Returns a new list with the given element at the front, followed by the
4690 * contents of the list.
4691 *
4692 * @func
4693 * @memberOf R
4694 * @since v0.1.0
4695 * @category List
4696 * @sig a -> [a] -> [a]
4697 * @param {*} el The item to add to the head of the output list.
4698 * @param {Array} list The array to add to the tail of the output list.
4699 * @return {Array} A new array.
4700 * @see R.append
4701 * @example
4702 *
4703 * R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum']
4704 */
4705module.exports = _curry2(function prepend(el, list) {
4706 return _concat([el], list);
4707});
4708
4709
4710/***/ }),
4711/* 113 */
4712/***/ (function(module, exports, __webpack_require__) {
4713
4714var _curry3 = __webpack_require__(2);
4715
4716
4717/**
4718 * Returns a single item by iterating through the list, successively calling
4719 * the iterator function and passing it an accumulator value and the current
4720 * value from the array, and then passing the result to the next call.
4721 *
4722 * Similar to `reduce`, except moves through the input list from the right to
4723 * the left.
4724 *
4725 * The iterator function receives two values: *(value, acc)*, while the arguments'
4726 * order of `reduce`'s iterator function is *(acc, value)*.
4727 *
4728 * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse
4729 * arrays), unlike the native `Array.prototype.reduce` method. For more details
4730 * on this behavior, see:
4731 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description
4732 *
4733 * @func
4734 * @memberOf R
4735 * @since v0.1.0
4736 * @category List
4737 * @sig (a, b -> b) -> b -> [a] -> b
4738 * @param {Function} fn The iterator function. Receives two values, the current element from the array
4739 * and the accumulator.
4740 * @param {*} acc The accumulator value.
4741 * @param {Array} list The list to iterate over.
4742 * @return {*} The final, accumulated value.
4743 * @see R.reduce, R.addIndex
4744 * @example
4745 *
4746 * R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2
4747 * - -2
4748 * / \ / \
4749 * 1 - 1 3
4750 * / \ / \
4751 * 2 - ==> 2 -1
4752 * / \ / \
4753 * 3 - 3 4
4754 * / \ / \
4755 * 4 0 4 0
4756 *
4757 * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a)))
4758 */
4759module.exports = _curry3(function reduceRight(fn, acc, list) {
4760 var idx = list.length - 1;
4761 while (idx >= 0) {
4762 acc = fn(list[idx], acc);
4763 idx -= 1;
4764 }
4765 return acc;
4766});
4767
4768
4769/***/ }),
4770/* 114 */
4771/***/ (function(module, exports, __webpack_require__) {
4772
4773var _curry2 = __webpack_require__(0);
4774var ap = __webpack_require__(46);
4775var map = __webpack_require__(7);
4776var prepend = __webpack_require__(112);
4777var reduceRight = __webpack_require__(113);
4778
4779
4780/**
4781 * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable)
4782 * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an
4783 * Applicative of Traversable.
4784 *
4785 * Dispatches to the `sequence` method of the second argument, if present.
4786 *
4787 * @func
4788 * @memberOf R
4789 * @since v0.19.0
4790 * @category List
4791 * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a)
4792 * @param {Function} of
4793 * @param {*} traversable
4794 * @return {*}
4795 * @see R.traverse
4796 * @example
4797 *
4798 * R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]); //=> Just([1, 2, 3])
4799 * R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing()
4800 *
4801 * R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)]
4802 * R.sequence(R.of, Nothing()); //=> [Nothing()]
4803 */
4804module.exports = _curry2(function sequence(of, traversable) {
4805 return typeof traversable.sequence === 'function' ?
4806 traversable.sequence(of) :
4807 reduceRight(function(x, acc) { return ap(map(prepend, x), acc); },
4808 of([]),
4809 traversable);
4810});
4811
4812
4813/***/ }),
4814/* 115 */
4815/***/ (function(module, exports, __webpack_require__) {
4816
4817var add = __webpack_require__(30);
4818var reduce = __webpack_require__(14);
4819
4820
4821/**
4822 * Adds together all the elements of a list.
4823 *
4824 * @func
4825 * @memberOf R
4826 * @since v0.1.0
4827 * @category Math
4828 * @sig [Number] -> Number
4829 * @param {Array} list An array of numbers
4830 * @return {Number} The sum of all the numbers in the list.
4831 * @see R.reduce
4832 * @example
4833 *
4834 * R.sum([2,4,6,8,100,1]); //=> 121
4835 */
4836module.exports = reduce(add, 0);
4837
4838
4839/***/ }),
4840/* 116 */
4841/***/ (function(module, exports, __webpack_require__) {
4842
4843var _curry2 = __webpack_require__(0);
4844var _dispatchable = __webpack_require__(3);
4845var _xtake = __webpack_require__(245);
4846var slice = __webpack_require__(18);
4847
4848
4849/**
4850 * Returns the first `n` elements of the given list, string, or
4851 * transducer/transformer (or object with a `take` method).
4852 *
4853 * Dispatches to the `take` method of the second argument, if present.
4854 *
4855 * @func
4856 * @memberOf R
4857 * @since v0.1.0
4858 * @category List
4859 * @sig Number -> [a] -> [a]
4860 * @sig Number -> String -> String
4861 * @param {Number} n
4862 * @param {*} list
4863 * @return {*}
4864 * @see R.drop
4865 * @example
4866 *
4867 * R.take(1, ['foo', 'bar', 'baz']); //=> ['foo']
4868 * R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
4869 * R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
4870 * R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
4871 * R.take(3, 'ramda'); //=> 'ram'
4872 *
4873 * var personnel = [
4874 * 'Dave Brubeck',
4875 * 'Paul Desmond',
4876 * 'Eugene Wright',
4877 * 'Joe Morello',
4878 * 'Gerry Mulligan',
4879 * 'Bob Bates',
4880 * 'Joe Dodge',
4881 * 'Ron Crotty'
4882 * ];
4883 *
4884 * var takeFive = R.take(5);
4885 * takeFive(personnel);
4886 * //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan']
4887 * @symb R.take(-1, [a, b]) = [a, b]
4888 * @symb R.take(0, [a, b]) = []
4889 * @symb R.take(1, [a, b]) = [a]
4890 * @symb R.take(2, [a, b]) = [a, b]
4891 */
4892module.exports = _curry2(_dispatchable(['take'], _xtake, function take(n, xs) {
4893 return slice(0, n < 0 ? Infinity : n, xs);
4894}));
4895
4896
4897/***/ }),
4898/* 117 */
4899/***/ (function(module, exports, __webpack_require__) {
4900
4901var _curry2 = __webpack_require__(0);
4902
4903
4904/**
4905 * Calls an input function `n` times, returning an array containing the results
4906 * of those function calls.
4907 *
4908 * `fn` is passed one argument: The current value of `n`, which begins at `0`
4909 * and is gradually incremented to `n - 1`.
4910 *
4911 * @func
4912 * @memberOf R
4913 * @since v0.2.3
4914 * @category List
4915 * @sig (Number -> a) -> Number -> [a]
4916 * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
4917 * @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
4918 * @return {Array} An array containing the return values of all calls to `fn`.
4919 * @example
4920 *
4921 * R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
4922 * @symb R.times(f, 0) = []
4923 * @symb R.times(f, 1) = [f(0)]
4924 * @symb R.times(f, 2) = [f(0), f(1)]
4925 */
4926module.exports = _curry2(function times(fn, n) {
4927 var len = Number(n);
4928 var idx = 0;
4929 var list;
4930
4931 if (len < 0 || isNaN(len)) {
4932 throw new RangeError('n must be a non-negative number');
4933 }
4934 list = new Array(len);
4935 while (idx < len) {
4936 list[idx] = fn(idx);
4937 idx += 1;
4938 }
4939 return list;
4940});
4941
4942
4943/***/ }),
4944/* 118 */
4945/***/ (function(module, exports, __webpack_require__) {
4946
4947var _Set = __webpack_require__(213);
4948var _curry2 = __webpack_require__(0);
4949
4950
4951/**
4952 * Returns a new list containing only one copy of each element in the original
4953 * list, based upon the value returned by applying the supplied function to
4954 * each list element. Prefers the first item if the supplied function produces
4955 * the same value on two items. `R.equals` is used for comparison.
4956 *
4957 * @func
4958 * @memberOf R
4959 * @since v0.16.0
4960 * @category List
4961 * @sig (a -> b) -> [a] -> [a]
4962 * @param {Function} fn A function used to produce a value to use during comparisons.
4963 * @param {Array} list The array to consider.
4964 * @return {Array} The list of unique items.
4965 * @example
4966 *
4967 * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10]
4968 */
4969module.exports = _curry2(function uniqBy(fn, list) {
4970 var set = new _Set();
4971 var result = [];
4972 var idx = 0;
4973 var appliedItem, item;
4974
4975 while (idx < list.length) {
4976 item = list[idx];
4977 appliedItem = fn(item);
4978 if (set.add(appliedItem)) {
4979 result.push(item);
4980 }
4981 idx += 1;
4982 }
4983 return result;
4984});
4985
4986
4987/***/ }),
4988/* 119 */
4989/***/ (function(module, exports, __webpack_require__) {
4990
4991var _curry3 = __webpack_require__(2);
4992var adjust = __webpack_require__(66);
4993var always = __webpack_require__(19);
4994
4995
4996/**
4997 * Returns a new copy of the array with the element at the provided index
4998 * replaced with the given value.
4999 *
5000 * @func
5001 * @memberOf R
5002 * @since v0.14.0
5003 * @category List
5004 * @sig Number -> a -> [a] -> [a]
5005 * @param {Number} idx The index to update.
5006 * @param {*} x The value to exist at the given index of the returned array.
5007 * @param {Array|Arguments} list The source array-like object to be updated.
5008 * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`.
5009 * @see R.adjust
5010 * @example
5011 *
5012 * R.update(1, 11, [0, 1, 2]); //=> [0, 11, 2]
5013 * R.update(1)(11)([0, 1, 2]); //=> [0, 11, 2]
5014 * @symb R.update(-1, a, [b, c]) = [b, a]
5015 * @symb R.update(0, a, [b, c]) = [a, c]
5016 * @symb R.update(1, a, [b, c]) = [b, a]
5017 */
5018module.exports = _curry3(function update(idx, x, list) {
5019 return adjust(always(x), idx, list);
5020});
5021
5022
5023/***/ }),
5024/* 120 */
5025/***/ (function(module, exports, __webpack_require__) {
5026
5027var _curry2 = __webpack_require__(0);
5028var curryN = __webpack_require__(5);
5029
5030
5031/**
5032 * Accepts a function `fn` and a list of transformer functions and returns a
5033 * new curried function. When the new function is invoked, it calls the
5034 * function `fn` with parameters consisting of the result of calling each
5035 * supplied handler on successive arguments to the new function.
5036 *
5037 * If more arguments are passed to the returned function than transformer
5038 * functions, those arguments are passed directly to `fn` as additional
5039 * parameters. If you expect additional arguments that don't need to be
5040 * transformed, although you can ignore them, it's best to pass an identity
5041 * function so that the new function reports the correct arity.
5042 *
5043 * @func
5044 * @memberOf R
5045 * @since v0.1.0
5046 * @category Function
5047 * @sig (x1 -> x2 -> ... -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z)
5048 * @param {Function} fn The function to wrap.
5049 * @param {Array} transformers A list of transformer functions
5050 * @return {Function} The wrapped function.
5051 * @see R.converge
5052 * @example
5053 *
5054 * R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81
5055 * R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81
5056 * R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32
5057 * R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32
5058 * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b))
5059 */
5060module.exports = _curry2(function useWith(fn, transformers) {
5061 return curryN(transformers.length, function() {
5062 var args = [];
5063 var idx = 0;
5064 while (idx < transformers.length) {
5065 args.push(transformers[idx].call(this, arguments[idx]));
5066 idx += 1;
5067 }
5068 return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length)));
5069 });
5070});
5071
5072
5073/***/ }),
5074/* 121 */
5075/***/ (function(module, exports, __webpack_require__) {
5076
5077var _curry1 = __webpack_require__(1);
5078var keys = __webpack_require__(13);
5079
5080
5081/**
5082 * Returns a list of all the enumerable own properties of the supplied object.
5083 * Note that the order of the output array is not guaranteed across different
5084 * JS platforms.
5085 *
5086 * @func
5087 * @memberOf R
5088 * @since v0.1.0
5089 * @category Object
5090 * @sig {k: v} -> [v]
5091 * @param {Object} obj The object to extract values from
5092 * @return {Array} An array of the values of the object's own properties.
5093 * @example
5094 *
5095 * R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]
5096 */
5097module.exports = _curry1(function values(obj) {
5098 var props = keys(obj);
5099 var len = props.length;
5100 var vals = [];
5101 var idx = 0;
5102 while (idx < len) {
5103 vals[idx] = obj[props[idx]];
5104 idx += 1;
5105 }
5106 return vals;
5107});
5108
5109
5110/***/ }),
5111/* 122 */
5112/***/ (function(module, exports, __webpack_require__) {
5113
5114var _curry2 = __webpack_require__(0);
5115var _has = __webpack_require__(6);
5116
5117
5118/**
5119 * Takes a spec object and a test object; returns true if the test satisfies
5120 * the spec. Each of the spec's own properties must be a predicate function.
5121 * Each predicate is applied to the value of the corresponding property of the
5122 * test object. `where` returns true if all the predicates return true, false
5123 * otherwise.
5124 *
5125 * `where` is well suited to declaratively expressing constraints for other
5126 * functions such as `filter` and `find`.
5127 *
5128 * @func
5129 * @memberOf R
5130 * @since v0.1.1
5131 * @category Object
5132 * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean
5133 * @param {Object} spec
5134 * @param {Object} testObj
5135 * @return {Boolean}
5136 * @example
5137 *
5138 * // pred :: Object -> Boolean
5139 * var pred = R.where({
5140 * a: R.equals('foo'),
5141 * b: R.complement(R.equals('bar')),
5142 * x: R.gt(__, 10),
5143 * y: R.lt(__, 20)
5144 * });
5145 *
5146 * pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true
5147 * pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false
5148 * pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false
5149 * pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false
5150 * pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false
5151 */
5152module.exports = _curry2(function where(spec, testObj) {
5153 for (var prop in spec) {
5154 if (_has(prop, spec) && !spec[prop](testObj[prop])) {
5155 return false;
5156 }
5157 }
5158 return true;
5159});
5160
5161
5162/***/ }),
5163/* 123 */
5164/***/ (function(module, exports) {
5165
5166var g;
5167
5168// This works in non-strict mode
5169g = (function() {
5170 return this;
5171})();
5172
5173try {
5174 // This works if eval is allowed (see CSP)
5175 g = g || Function("return this")() || (1,eval)("this");
5176} catch(e) {
5177 // This works if the window reference is available
5178 if(typeof window === "object")
5179 g = window;
5180}
5181
5182// g can still be undefined, but nothing to do about it...
5183// We return undefined, instead of nothing here, so it's
5184// easier to handle this case. if(!global) { ...}
5185
5186module.exports = g;
5187
5188
5189/***/ }),
5190/* 124 */
5191/***/ (function(module, exports, __webpack_require__) {
5192
5193module.exports = __webpack_require__(129);
5194
5195/***/ }),
5196/* 125 */
5197/***/ (function(module, exports, __webpack_require__) {
5198
5199/* WEBPACK VAR INJECTION */(function(process, global, setImmediate) {/* @preserve
5200 * The MIT License (MIT)
5201 *
5202 * Copyright (c) 2013-2015 Petka Antonov
5203 *
5204 * Permission is hereby granted, free of charge, to any person obtaining a copy
5205 * of this software and associated documentation files (the "Software"), to deal
5206 * in the Software without restriction, including without limitation the rights
5207 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5208 * copies of the Software, and to permit persons to whom the Software is
5209 * furnished to do so, subject to the following conditions:
5210 *
5211 * The above copyright notice and this permission notice shall be included in
5212 * all copies or substantial portions of the Software.
5213 *
5214 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5215 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5216 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5217 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5218 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5219 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5220 * THE SOFTWARE.
5221 *
5222 */
5223/**
5224 * bluebird build version 3.4.7
5225 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
5226*/
5227!function(e){if(true)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5228"use strict";
5229module.exports = function(Promise) {
5230var SomePromiseArray = Promise._SomePromiseArray;
5231function any(promises) {
5232 var ret = new SomePromiseArray(promises);
5233 var promise = ret.promise();
5234 ret.setHowMany(1);
5235 ret.setUnwrap();
5236 ret.init();
5237 return promise;
5238}
5239
5240Promise.any = function (promises) {
5241 return any(promises);
5242};
5243
5244Promise.prototype.any = function () {
5245 return any(this);
5246};
5247
5248};
5249
5250},{}],2:[function(_dereq_,module,exports){
5251"use strict";
5252var firstLineError;
5253try {throw new Error(); } catch (e) {firstLineError = e;}
5254var schedule = _dereq_("./schedule");
5255var Queue = _dereq_("./queue");
5256var util = _dereq_("./util");
5257
5258function Async() {
5259 this._customScheduler = false;
5260 this._isTickUsed = false;
5261 this._lateQueue = new Queue(16);
5262 this._normalQueue = new Queue(16);
5263 this._haveDrainedQueues = false;
5264 this._trampolineEnabled = true;
5265 var self = this;
5266 this.drainQueues = function () {
5267 self._drainQueues();
5268 };
5269 this._schedule = schedule;
5270}
5271
5272Async.prototype.setScheduler = function(fn) {
5273 var prev = this._schedule;
5274 this._schedule = fn;
5275 this._customScheduler = true;
5276 return prev;
5277};
5278
5279Async.prototype.hasCustomScheduler = function() {
5280 return this._customScheduler;
5281};
5282
5283Async.prototype.enableTrampoline = function() {
5284 this._trampolineEnabled = true;
5285};
5286
5287Async.prototype.disableTrampolineIfNecessary = function() {
5288 if (util.hasDevTools) {
5289 this._trampolineEnabled = false;
5290 }
5291};
5292
5293Async.prototype.haveItemsQueued = function () {
5294 return this._isTickUsed || this._haveDrainedQueues;
5295};
5296
5297
5298Async.prototype.fatalError = function(e, isNode) {
5299 if (isNode) {
5300 process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
5301 "\n");
5302 process.exit(2);
5303 } else {
5304 this.throwLater(e);
5305 }
5306};
5307
5308Async.prototype.throwLater = function(fn, arg) {
5309 if (arguments.length === 1) {
5310 arg = fn;
5311 fn = function () { throw arg; };
5312 }
5313 if (typeof setTimeout !== "undefined") {
5314 setTimeout(function() {
5315 fn(arg);
5316 }, 0);
5317 } else try {
5318 this._schedule(function() {
5319 fn(arg);
5320 });
5321 } catch (e) {
5322 throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
5323 }
5324};
5325
5326function AsyncInvokeLater(fn, receiver, arg) {
5327 this._lateQueue.push(fn, receiver, arg);
5328 this._queueTick();
5329}
5330
5331function AsyncInvoke(fn, receiver, arg) {
5332 this._normalQueue.push(fn, receiver, arg);
5333 this._queueTick();
5334}
5335
5336function AsyncSettlePromises(promise) {
5337 this._normalQueue._pushOne(promise);
5338 this._queueTick();
5339}
5340
5341if (!util.hasDevTools) {
5342 Async.prototype.invokeLater = AsyncInvokeLater;
5343 Async.prototype.invoke = AsyncInvoke;
5344 Async.prototype.settlePromises = AsyncSettlePromises;
5345} else {
5346 Async.prototype.invokeLater = function (fn, receiver, arg) {
5347 if (this._trampolineEnabled) {
5348 AsyncInvokeLater.call(this, fn, receiver, arg);
5349 } else {
5350 this._schedule(function() {
5351 setTimeout(function() {
5352 fn.call(receiver, arg);
5353 }, 100);
5354 });
5355 }
5356 };
5357
5358 Async.prototype.invoke = function (fn, receiver, arg) {
5359 if (this._trampolineEnabled) {
5360 AsyncInvoke.call(this, fn, receiver, arg);
5361 } else {
5362 this._schedule(function() {
5363 fn.call(receiver, arg);
5364 });
5365 }
5366 };
5367
5368 Async.prototype.settlePromises = function(promise) {
5369 if (this._trampolineEnabled) {
5370 AsyncSettlePromises.call(this, promise);
5371 } else {
5372 this._schedule(function() {
5373 promise._settlePromises();
5374 });
5375 }
5376 };
5377}
5378
5379Async.prototype._drainQueue = function(queue) {
5380 while (queue.length() > 0) {
5381 var fn = queue.shift();
5382 if (typeof fn !== "function") {
5383 fn._settlePromises();
5384 continue;
5385 }
5386 var receiver = queue.shift();
5387 var arg = queue.shift();
5388 fn.call(receiver, arg);
5389 }
5390};
5391
5392Async.prototype._drainQueues = function () {
5393 this._drainQueue(this._normalQueue);
5394 this._reset();
5395 this._haveDrainedQueues = true;
5396 this._drainQueue(this._lateQueue);
5397};
5398
5399Async.prototype._queueTick = function () {
5400 if (!this._isTickUsed) {
5401 this._isTickUsed = true;
5402 this._schedule(this.drainQueues);
5403 }
5404};
5405
5406Async.prototype._reset = function () {
5407 this._isTickUsed = false;
5408};
5409
5410module.exports = Async;
5411module.exports.firstLineError = firstLineError;
5412
5413},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){
5414"use strict";
5415module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
5416var calledBind = false;
5417var rejectThis = function(_, e) {
5418 this._reject(e);
5419};
5420
5421var targetRejected = function(e, context) {
5422 context.promiseRejectionQueued = true;
5423 context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
5424};
5425
5426var bindingResolved = function(thisArg, context) {
5427 if (((this._bitField & 50397184) === 0)) {
5428 this._resolveCallback(context.target);
5429 }
5430};
5431
5432var bindingRejected = function(e, context) {
5433 if (!context.promiseRejectionQueued) this._reject(e);
5434};
5435
5436Promise.prototype.bind = function (thisArg) {
5437 if (!calledBind) {
5438 calledBind = true;
5439 Promise.prototype._propagateFrom = debug.propagateFromFunction();
5440 Promise.prototype._boundValue = debug.boundValueFunction();
5441 }
5442 var maybePromise = tryConvertToPromise(thisArg);
5443 var ret = new Promise(INTERNAL);
5444 ret._propagateFrom(this, 1);
5445 var target = this._target();
5446 ret._setBoundTo(maybePromise);
5447 if (maybePromise instanceof Promise) {
5448 var context = {
5449 promiseRejectionQueued: false,
5450 promise: ret,
5451 target: target,
5452 bindingPromise: maybePromise
5453 };
5454 target._then(INTERNAL, targetRejected, undefined, ret, context);
5455 maybePromise._then(
5456 bindingResolved, bindingRejected, undefined, ret, context);
5457 ret._setOnCancel(maybePromise);
5458 } else {
5459 ret._resolveCallback(target);
5460 }
5461 return ret;
5462};
5463
5464Promise.prototype._setBoundTo = function (obj) {
5465 if (obj !== undefined) {
5466 this._bitField = this._bitField | 2097152;
5467 this._boundTo = obj;
5468 } else {
5469 this._bitField = this._bitField & (~2097152);
5470 }
5471};
5472
5473Promise.prototype._isBound = function () {
5474 return (this._bitField & 2097152) === 2097152;
5475};
5476
5477Promise.bind = function (thisArg, value) {
5478 return Promise.resolve(value).bind(thisArg);
5479};
5480};
5481
5482},{}],4:[function(_dereq_,module,exports){
5483"use strict";
5484var old;
5485if (typeof Promise !== "undefined") old = Promise;
5486function noConflict() {
5487 try { if (Promise === bluebird) Promise = old; }
5488 catch (e) {}
5489 return bluebird;
5490}
5491var bluebird = _dereq_("./promise")();
5492bluebird.noConflict = noConflict;
5493module.exports = bluebird;
5494
5495},{"./promise":22}],5:[function(_dereq_,module,exports){
5496"use strict";
5497var cr = Object.create;
5498if (cr) {
5499 var callerCache = cr(null);
5500 var getterCache = cr(null);
5501 callerCache[" size"] = getterCache[" size"] = 0;
5502}
5503
5504module.exports = function(Promise) {
5505var util = _dereq_("./util");
5506var canEvaluate = util.canEvaluate;
5507var isIdentifier = util.isIdentifier;
5508
5509var getMethodCaller;
5510var getGetter;
5511if (false) {
5512var makeMethodCaller = function (methodName) {
5513 return new Function("ensureMethod", " \n\
5514 return function(obj) { \n\
5515 'use strict' \n\
5516 var len = this.length; \n\
5517 ensureMethod(obj, 'methodName'); \n\
5518 switch(len) { \n\
5519 case 1: return obj.methodName(this[0]); \n\
5520 case 2: return obj.methodName(this[0], this[1]); \n\
5521 case 3: return obj.methodName(this[0], this[1], this[2]); \n\
5522 case 0: return obj.methodName(); \n\
5523 default: \n\
5524 return obj.methodName.apply(obj, this); \n\
5525 } \n\
5526 }; \n\
5527 ".replace(/methodName/g, methodName))(ensureMethod);
5528};
5529
5530var makeGetter = function (propertyName) {
5531 return new Function("obj", " \n\
5532 'use strict'; \n\
5533 return obj.propertyName; \n\
5534 ".replace("propertyName", propertyName));
5535};
5536
5537var getCompiled = function(name, compiler, cache) {
5538 var ret = cache[name];
5539 if (typeof ret !== "function") {
5540 if (!isIdentifier(name)) {
5541 return null;
5542 }
5543 ret = compiler(name);
5544 cache[name] = ret;
5545 cache[" size"]++;
5546 if (cache[" size"] > 512) {
5547 var keys = Object.keys(cache);
5548 for (var i = 0; i < 256; ++i) delete cache[keys[i]];
5549 cache[" size"] = keys.length - 256;
5550 }
5551 }
5552 return ret;
5553};
5554
5555getMethodCaller = function(name) {
5556 return getCompiled(name, makeMethodCaller, callerCache);
5557};
5558
5559getGetter = function(name) {
5560 return getCompiled(name, makeGetter, getterCache);
5561};
5562}
5563
5564function ensureMethod(obj, methodName) {
5565 var fn;
5566 if (obj != null) fn = obj[methodName];
5567 if (typeof fn !== "function") {
5568 var message = "Object " + util.classString(obj) + " has no method '" +
5569 util.toString(methodName) + "'";
5570 throw new Promise.TypeError(message);
5571 }
5572 return fn;
5573}
5574
5575function caller(obj) {
5576 var methodName = this.pop();
5577 var fn = ensureMethod(obj, methodName);
5578 return fn.apply(obj, this);
5579}
5580Promise.prototype.call = function (methodName) {
5581 var args = [].slice.call(arguments, 1);;
5582 if (false) {
5583 if (canEvaluate) {
5584 var maybeCaller = getMethodCaller(methodName);
5585 if (maybeCaller !== null) {
5586 return this._then(
5587 maybeCaller, undefined, undefined, args, undefined);
5588 }
5589 }
5590 }
5591 args.push(methodName);
5592 return this._then(caller, undefined, undefined, args, undefined);
5593};
5594
5595function namedGetter(obj) {
5596 return obj[this];
5597}
5598function indexedGetter(obj) {
5599 var index = +this;
5600 if (index < 0) index = Math.max(0, index + obj.length);
5601 return obj[index];
5602}
5603Promise.prototype.get = function (propertyName) {
5604 var isIndex = (typeof propertyName === "number");
5605 var getter;
5606 if (!isIndex) {
5607 if (canEvaluate) {
5608 var maybeGetter = getGetter(propertyName);
5609 getter = maybeGetter !== null ? maybeGetter : namedGetter;
5610 } else {
5611 getter = namedGetter;
5612 }
5613 } else {
5614 getter = indexedGetter;
5615 }
5616 return this._then(getter, undefined, undefined, propertyName, undefined);
5617};
5618};
5619
5620},{"./util":36}],6:[function(_dereq_,module,exports){
5621"use strict";
5622module.exports = function(Promise, PromiseArray, apiRejection, debug) {
5623var util = _dereq_("./util");
5624var tryCatch = util.tryCatch;
5625var errorObj = util.errorObj;
5626var async = Promise._async;
5627
5628Promise.prototype["break"] = Promise.prototype.cancel = function() {
5629 if (!debug.cancellation()) return this._warn("cancellation is disabled");
5630
5631 var promise = this;
5632 var child = promise;
5633 while (promise._isCancellable()) {
5634 if (!promise._cancelBy(child)) {
5635 if (child._isFollowing()) {
5636 child._followee().cancel();
5637 } else {
5638 child._cancelBranched();
5639 }
5640 break;
5641 }
5642
5643 var parent = promise._cancellationParent;
5644 if (parent == null || !parent._isCancellable()) {
5645 if (promise._isFollowing()) {
5646 promise._followee().cancel();
5647 } else {
5648 promise._cancelBranched();
5649 }
5650 break;
5651 } else {
5652 if (promise._isFollowing()) promise._followee().cancel();
5653 promise._setWillBeCancelled();
5654 child = promise;
5655 promise = parent;
5656 }
5657 }
5658};
5659
5660Promise.prototype._branchHasCancelled = function() {
5661 this._branchesRemainingToCancel--;
5662};
5663
5664Promise.prototype._enoughBranchesHaveCancelled = function() {
5665 return this._branchesRemainingToCancel === undefined ||
5666 this._branchesRemainingToCancel <= 0;
5667};
5668
5669Promise.prototype._cancelBy = function(canceller) {
5670 if (canceller === this) {
5671 this._branchesRemainingToCancel = 0;
5672 this._invokeOnCancel();
5673 return true;
5674 } else {
5675 this._branchHasCancelled();
5676 if (this._enoughBranchesHaveCancelled()) {
5677 this._invokeOnCancel();
5678 return true;
5679 }
5680 }
5681 return false;
5682};
5683
5684Promise.prototype._cancelBranched = function() {
5685 if (this._enoughBranchesHaveCancelled()) {
5686 this._cancel();
5687 }
5688};
5689
5690Promise.prototype._cancel = function() {
5691 if (!this._isCancellable()) return;
5692 this._setCancelled();
5693 async.invoke(this._cancelPromises, this, undefined);
5694};
5695
5696Promise.prototype._cancelPromises = function() {
5697 if (this._length() > 0) this._settlePromises();
5698};
5699
5700Promise.prototype._unsetOnCancel = function() {
5701 this._onCancelField = undefined;
5702};
5703
5704Promise.prototype._isCancellable = function() {
5705 return this.isPending() && !this._isCancelled();
5706};
5707
5708Promise.prototype.isCancellable = function() {
5709 return this.isPending() && !this.isCancelled();
5710};
5711
5712Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
5713 if (util.isArray(onCancelCallback)) {
5714 for (var i = 0; i < onCancelCallback.length; ++i) {
5715 this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
5716 }
5717 } else if (onCancelCallback !== undefined) {
5718 if (typeof onCancelCallback === "function") {
5719 if (!internalOnly) {
5720 var e = tryCatch(onCancelCallback).call(this._boundValue());
5721 if (e === errorObj) {
5722 this._attachExtraTrace(e.e);
5723 async.throwLater(e.e);
5724 }
5725 }
5726 } else {
5727 onCancelCallback._resultCancelled(this);
5728 }
5729 }
5730};
5731
5732Promise.prototype._invokeOnCancel = function() {
5733 var onCancelCallback = this._onCancel();
5734 this._unsetOnCancel();
5735 async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
5736};
5737
5738Promise.prototype._invokeInternalOnCancel = function() {
5739 if (this._isCancellable()) {
5740 this._doInvokeOnCancel(this._onCancel(), true);
5741 this._unsetOnCancel();
5742 }
5743};
5744
5745Promise.prototype._resultCancelled = function() {
5746 this.cancel();
5747};
5748
5749};
5750
5751},{"./util":36}],7:[function(_dereq_,module,exports){
5752"use strict";
5753module.exports = function(NEXT_FILTER) {
5754var util = _dereq_("./util");
5755var getKeys = _dereq_("./es5").keys;
5756var tryCatch = util.tryCatch;
5757var errorObj = util.errorObj;
5758
5759function catchFilter(instances, cb, promise) {
5760 return function(e) {
5761 var boundTo = promise._boundValue();
5762 predicateLoop: for (var i = 0; i < instances.length; ++i) {
5763 var item = instances[i];
5764
5765 if (item === Error ||
5766 (item != null && item.prototype instanceof Error)) {
5767 if (e instanceof item) {
5768 return tryCatch(cb).call(boundTo, e);
5769 }
5770 } else if (typeof item === "function") {
5771 var matchesPredicate = tryCatch(item).call(boundTo, e);
5772 if (matchesPredicate === errorObj) {
5773 return matchesPredicate;
5774 } else if (matchesPredicate) {
5775 return tryCatch(cb).call(boundTo, e);
5776 }
5777 } else if (util.isObject(e)) {
5778 var keys = getKeys(item);
5779 for (var j = 0; j < keys.length; ++j) {
5780 var key = keys[j];
5781 if (item[key] != e[key]) {
5782 continue predicateLoop;
5783 }
5784 }
5785 return tryCatch(cb).call(boundTo, e);
5786 }
5787 }
5788 return NEXT_FILTER;
5789 };
5790}
5791
5792return catchFilter;
5793};
5794
5795},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){
5796"use strict";
5797module.exports = function(Promise) {
5798var longStackTraces = false;
5799var contextStack = [];
5800
5801Promise.prototype._promiseCreated = function() {};
5802Promise.prototype._pushContext = function() {};
5803Promise.prototype._popContext = function() {return null;};
5804Promise._peekContext = Promise.prototype._peekContext = function() {};
5805
5806function Context() {
5807 this._trace = new Context.CapturedTrace(peekContext());
5808}
5809Context.prototype._pushContext = function () {
5810 if (this._trace !== undefined) {
5811 this._trace._promiseCreated = null;
5812 contextStack.push(this._trace);
5813 }
5814};
5815
5816Context.prototype._popContext = function () {
5817 if (this._trace !== undefined) {
5818 var trace = contextStack.pop();
5819 var ret = trace._promiseCreated;
5820 trace._promiseCreated = null;
5821 return ret;
5822 }
5823 return null;
5824};
5825
5826function createContext() {
5827 if (longStackTraces) return new Context();
5828}
5829
5830function peekContext() {
5831 var lastIndex = contextStack.length - 1;
5832 if (lastIndex >= 0) {
5833 return contextStack[lastIndex];
5834 }
5835 return undefined;
5836}
5837Context.CapturedTrace = null;
5838Context.create = createContext;
5839Context.deactivateLongStackTraces = function() {};
5840Context.activateLongStackTraces = function() {
5841 var Promise_pushContext = Promise.prototype._pushContext;
5842 var Promise_popContext = Promise.prototype._popContext;
5843 var Promise_PeekContext = Promise._peekContext;
5844 var Promise_peekContext = Promise.prototype._peekContext;
5845 var Promise_promiseCreated = Promise.prototype._promiseCreated;
5846 Context.deactivateLongStackTraces = function() {
5847 Promise.prototype._pushContext = Promise_pushContext;
5848 Promise.prototype._popContext = Promise_popContext;
5849 Promise._peekContext = Promise_PeekContext;
5850 Promise.prototype._peekContext = Promise_peekContext;
5851 Promise.prototype._promiseCreated = Promise_promiseCreated;
5852 longStackTraces = false;
5853 };
5854 longStackTraces = true;
5855 Promise.prototype._pushContext = Context.prototype._pushContext;
5856 Promise.prototype._popContext = Context.prototype._popContext;
5857 Promise._peekContext = Promise.prototype._peekContext = peekContext;
5858 Promise.prototype._promiseCreated = function() {
5859 var ctx = this._peekContext();
5860 if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
5861 };
5862};
5863return Context;
5864};
5865
5866},{}],9:[function(_dereq_,module,exports){
5867"use strict";
5868module.exports = function(Promise, Context) {
5869var getDomain = Promise._getDomain;
5870var async = Promise._async;
5871var Warning = _dereq_("./errors").Warning;
5872var util = _dereq_("./util");
5873var canAttachTrace = util.canAttachTrace;
5874var unhandledRejectionHandled;
5875var possiblyUnhandledRejection;
5876var bluebirdFramePattern =
5877 /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
5878var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
5879var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
5880var stackFramePattern = null;
5881var formatStack = null;
5882var indentStackFrames = false;
5883var printWarning;
5884var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
5885 (true ||
5886 util.env("BLUEBIRD_DEBUG") ||
5887 util.env("NODE_ENV") === "development"));
5888
5889var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
5890 (debugging || util.env("BLUEBIRD_WARNINGS")));
5891
5892var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
5893 (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
5894
5895var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
5896 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
5897
5898Promise.prototype.suppressUnhandledRejections = function() {
5899 var target = this._target();
5900 target._bitField = ((target._bitField & (~1048576)) |
5901 524288);
5902};
5903
5904Promise.prototype._ensurePossibleRejectionHandled = function () {
5905 if ((this._bitField & 524288) !== 0) return;
5906 this._setRejectionIsUnhandled();
5907 async.invokeLater(this._notifyUnhandledRejection, this, undefined);
5908};
5909
5910Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
5911 fireRejectionEvent("rejectionHandled",
5912 unhandledRejectionHandled, undefined, this);
5913};
5914
5915Promise.prototype._setReturnedNonUndefined = function() {
5916 this._bitField = this._bitField | 268435456;
5917};
5918
5919Promise.prototype._returnedNonUndefined = function() {
5920 return (this._bitField & 268435456) !== 0;
5921};
5922
5923Promise.prototype._notifyUnhandledRejection = function () {
5924 if (this._isRejectionUnhandled()) {
5925 var reason = this._settledValue();
5926 this._setUnhandledRejectionIsNotified();
5927 fireRejectionEvent("unhandledRejection",
5928 possiblyUnhandledRejection, reason, this);
5929 }
5930};
5931
5932Promise.prototype._setUnhandledRejectionIsNotified = function () {
5933 this._bitField = this._bitField | 262144;
5934};
5935
5936Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
5937 this._bitField = this._bitField & (~262144);
5938};
5939
5940Promise.prototype._isUnhandledRejectionNotified = function () {
5941 return (this._bitField & 262144) > 0;
5942};
5943
5944Promise.prototype._setRejectionIsUnhandled = function () {
5945 this._bitField = this._bitField | 1048576;
5946};
5947
5948Promise.prototype._unsetRejectionIsUnhandled = function () {
5949 this._bitField = this._bitField & (~1048576);
5950 if (this._isUnhandledRejectionNotified()) {
5951 this._unsetUnhandledRejectionIsNotified();
5952 this._notifyUnhandledRejectionIsHandled();
5953 }
5954};
5955
5956Promise.prototype._isRejectionUnhandled = function () {
5957 return (this._bitField & 1048576) > 0;
5958};
5959
5960Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
5961 return warn(message, shouldUseOwnTrace, promise || this);
5962};
5963
5964Promise.onPossiblyUnhandledRejection = function (fn) {
5965 var domain = getDomain();
5966 possiblyUnhandledRejection =
5967 typeof fn === "function" ? (domain === null ?
5968 fn : util.domainBind(domain, fn))
5969 : undefined;
5970};
5971
5972Promise.onUnhandledRejectionHandled = function (fn) {
5973 var domain = getDomain();
5974 unhandledRejectionHandled =
5975 typeof fn === "function" ? (domain === null ?
5976 fn : util.domainBind(domain, fn))
5977 : undefined;
5978};
5979
5980var disableLongStackTraces = function() {};
5981Promise.longStackTraces = function () {
5982 if (async.haveItemsQueued() && !config.longStackTraces) {
5983 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
5984 }
5985 if (!config.longStackTraces && longStackTracesIsSupported()) {
5986 var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
5987 var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
5988 config.longStackTraces = true;
5989 disableLongStackTraces = function() {
5990 if (async.haveItemsQueued() && !config.longStackTraces) {
5991 throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
5992 }
5993 Promise.prototype._captureStackTrace = Promise_captureStackTrace;
5994 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
5995 Context.deactivateLongStackTraces();
5996 async.enableTrampoline();
5997 config.longStackTraces = false;
5998 };
5999 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
6000 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
6001 Context.activateLongStackTraces();
6002 async.disableTrampolineIfNecessary();
6003 }
6004};
6005
6006Promise.hasLongStackTraces = function () {
6007 return config.longStackTraces && longStackTracesIsSupported();
6008};
6009
6010var fireDomEvent = (function() {
6011 try {
6012 if (typeof CustomEvent === "function") {
6013 var event = new CustomEvent("CustomEvent");
6014 util.global.dispatchEvent(event);
6015 return function(name, event) {
6016 var domEvent = new CustomEvent(name.toLowerCase(), {
6017 detail: event,
6018 cancelable: true
6019 });
6020 return !util.global.dispatchEvent(domEvent);
6021 };
6022 } else if (typeof Event === "function") {
6023 var event = new Event("CustomEvent");
6024 util.global.dispatchEvent(event);
6025 return function(name, event) {
6026 var domEvent = new Event(name.toLowerCase(), {
6027 cancelable: true
6028 });
6029 domEvent.detail = event;
6030 return !util.global.dispatchEvent(domEvent);
6031 };
6032 } else {
6033 var event = document.createEvent("CustomEvent");
6034 event.initCustomEvent("testingtheevent", false, true, {});
6035 util.global.dispatchEvent(event);
6036 return function(name, event) {
6037 var domEvent = document.createEvent("CustomEvent");
6038 domEvent.initCustomEvent(name.toLowerCase(), false, true,
6039 event);
6040 return !util.global.dispatchEvent(domEvent);
6041 };
6042 }
6043 } catch (e) {}
6044 return function() {
6045 return false;
6046 };
6047})();
6048
6049var fireGlobalEvent = (function() {
6050 if (util.isNode) {
6051 return function() {
6052 return process.emit.apply(process, arguments);
6053 };
6054 } else {
6055 if (!util.global) {
6056 return function() {
6057 return false;
6058 };
6059 }
6060 return function(name) {
6061 var methodName = "on" + name.toLowerCase();
6062 var method = util.global[methodName];
6063 if (!method) return false;
6064 method.apply(util.global, [].slice.call(arguments, 1));
6065 return true;
6066 };
6067 }
6068})();
6069
6070function generatePromiseLifecycleEventObject(name, promise) {
6071 return {promise: promise};
6072}
6073
6074var eventToObjectGenerator = {
6075 promiseCreated: generatePromiseLifecycleEventObject,
6076 promiseFulfilled: generatePromiseLifecycleEventObject,
6077 promiseRejected: generatePromiseLifecycleEventObject,
6078 promiseResolved: generatePromiseLifecycleEventObject,
6079 promiseCancelled: generatePromiseLifecycleEventObject,
6080 promiseChained: function(name, promise, child) {
6081 return {promise: promise, child: child};
6082 },
6083 warning: function(name, warning) {
6084 return {warning: warning};
6085 },
6086 unhandledRejection: function (name, reason, promise) {
6087 return {reason: reason, promise: promise};
6088 },
6089 rejectionHandled: generatePromiseLifecycleEventObject
6090};
6091
6092var activeFireEvent = function (name) {
6093 var globalEventFired = false;
6094 try {
6095 globalEventFired = fireGlobalEvent.apply(null, arguments);
6096 } catch (e) {
6097 async.throwLater(e);
6098 globalEventFired = true;
6099 }
6100
6101 var domEventFired = false;
6102 try {
6103 domEventFired = fireDomEvent(name,
6104 eventToObjectGenerator[name].apply(null, arguments));
6105 } catch (e) {
6106 async.throwLater(e);
6107 domEventFired = true;
6108 }
6109
6110 return domEventFired || globalEventFired;
6111};
6112
6113Promise.config = function(opts) {
6114 opts = Object(opts);
6115 if ("longStackTraces" in opts) {
6116 if (opts.longStackTraces) {
6117 Promise.longStackTraces();
6118 } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
6119 disableLongStackTraces();
6120 }
6121 }
6122 if ("warnings" in opts) {
6123 var warningsOption = opts.warnings;
6124 config.warnings = !!warningsOption;
6125 wForgottenReturn = config.warnings;
6126
6127 if (util.isObject(warningsOption)) {
6128 if ("wForgottenReturn" in warningsOption) {
6129 wForgottenReturn = !!warningsOption.wForgottenReturn;
6130 }
6131 }
6132 }
6133 if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
6134 if (async.haveItemsQueued()) {
6135 throw new Error(
6136 "cannot enable cancellation after promises are in use");
6137 }
6138 Promise.prototype._clearCancellationData =
6139 cancellationClearCancellationData;
6140 Promise.prototype._propagateFrom = cancellationPropagateFrom;
6141 Promise.prototype._onCancel = cancellationOnCancel;
6142 Promise.prototype._setOnCancel = cancellationSetOnCancel;
6143 Promise.prototype._attachCancellationCallback =
6144 cancellationAttachCancellationCallback;
6145 Promise.prototype._execute = cancellationExecute;
6146 propagateFromFunction = cancellationPropagateFrom;
6147 config.cancellation = true;
6148 }
6149 if ("monitoring" in opts) {
6150 if (opts.monitoring && !config.monitoring) {
6151 config.monitoring = true;
6152 Promise.prototype._fireEvent = activeFireEvent;
6153 } else if (!opts.monitoring && config.monitoring) {
6154 config.monitoring = false;
6155 Promise.prototype._fireEvent = defaultFireEvent;
6156 }
6157 }
6158 return Promise;
6159};
6160
6161function defaultFireEvent() { return false; }
6162
6163Promise.prototype._fireEvent = defaultFireEvent;
6164Promise.prototype._execute = function(executor, resolve, reject) {
6165 try {
6166 executor(resolve, reject);
6167 } catch (e) {
6168 return e;
6169 }
6170};
6171Promise.prototype._onCancel = function () {};
6172Promise.prototype._setOnCancel = function (handler) { ; };
6173Promise.prototype._attachCancellationCallback = function(onCancel) {
6174 ;
6175};
6176Promise.prototype._captureStackTrace = function () {};
6177Promise.prototype._attachExtraTrace = function () {};
6178Promise.prototype._clearCancellationData = function() {};
6179Promise.prototype._propagateFrom = function (parent, flags) {
6180 ;
6181 ;
6182};
6183
6184function cancellationExecute(executor, resolve, reject) {
6185 var promise = this;
6186 try {
6187 executor(resolve, reject, function(onCancel) {
6188 if (typeof onCancel !== "function") {
6189 throw new TypeError("onCancel must be a function, got: " +
6190 util.toString(onCancel));
6191 }
6192 promise._attachCancellationCallback(onCancel);
6193 });
6194 } catch (e) {
6195 return e;
6196 }
6197}
6198
6199function cancellationAttachCancellationCallback(onCancel) {
6200 if (!this._isCancellable()) return this;
6201
6202 var previousOnCancel = this._onCancel();
6203 if (previousOnCancel !== undefined) {
6204 if (util.isArray(previousOnCancel)) {
6205 previousOnCancel.push(onCancel);
6206 } else {
6207 this._setOnCancel([previousOnCancel, onCancel]);
6208 }
6209 } else {
6210 this._setOnCancel(onCancel);
6211 }
6212}
6213
6214function cancellationOnCancel() {
6215 return this._onCancelField;
6216}
6217
6218function cancellationSetOnCancel(onCancel) {
6219 this._onCancelField = onCancel;
6220}
6221
6222function cancellationClearCancellationData() {
6223 this._cancellationParent = undefined;
6224 this._onCancelField = undefined;
6225}
6226
6227function cancellationPropagateFrom(parent, flags) {
6228 if ((flags & 1) !== 0) {
6229 this._cancellationParent = parent;
6230 var branchesRemainingToCancel = parent._branchesRemainingToCancel;
6231 if (branchesRemainingToCancel === undefined) {
6232 branchesRemainingToCancel = 0;
6233 }
6234 parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
6235 }
6236 if ((flags & 2) !== 0 && parent._isBound()) {
6237 this._setBoundTo(parent._boundTo);
6238 }
6239}
6240
6241function bindingPropagateFrom(parent, flags) {
6242 if ((flags & 2) !== 0 && parent._isBound()) {
6243 this._setBoundTo(parent._boundTo);
6244 }
6245}
6246var propagateFromFunction = bindingPropagateFrom;
6247
6248function boundValueFunction() {
6249 var ret = this._boundTo;
6250 if (ret !== undefined) {
6251 if (ret instanceof Promise) {
6252 if (ret.isFulfilled()) {
6253 return ret.value();
6254 } else {
6255 return undefined;
6256 }
6257 }
6258 }
6259 return ret;
6260}
6261
6262function longStackTracesCaptureStackTrace() {
6263 this._trace = new CapturedTrace(this._peekContext());
6264}
6265
6266function longStackTracesAttachExtraTrace(error, ignoreSelf) {
6267 if (canAttachTrace(error)) {
6268 var trace = this._trace;
6269 if (trace !== undefined) {
6270 if (ignoreSelf) trace = trace._parent;
6271 }
6272 if (trace !== undefined) {
6273 trace.attachExtraTrace(error);
6274 } else if (!error.__stackCleaned__) {
6275 var parsed = parseStackAndMessage(error);
6276 util.notEnumerableProp(error, "stack",
6277 parsed.message + "\n" + parsed.stack.join("\n"));
6278 util.notEnumerableProp(error, "__stackCleaned__", true);
6279 }
6280 }
6281}
6282
6283function checkForgottenReturns(returnValue, promiseCreated, name, promise,
6284 parent) {
6285 if (returnValue === undefined && promiseCreated !== null &&
6286 wForgottenReturn) {
6287 if (parent !== undefined && parent._returnedNonUndefined()) return;
6288 if ((promise._bitField & 65535) === 0) return;
6289
6290 if (name) name = name + " ";
6291 var handlerLine = "";
6292 var creatorLine = "";
6293 if (promiseCreated._trace) {
6294 var traceLines = promiseCreated._trace.stack.split("\n");
6295 var stack = cleanStack(traceLines);
6296 for (var i = stack.length - 1; i >= 0; --i) {
6297 var line = stack[i];
6298 if (!nodeFramePattern.test(line)) {
6299 var lineMatches = line.match(parseLinePattern);
6300 if (lineMatches) {
6301 handlerLine = "at " + lineMatches[1] +
6302 ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
6303 }
6304 break;
6305 }
6306 }
6307
6308 if (stack.length > 0) {
6309 var firstUserLine = stack[0];
6310 for (var i = 0; i < traceLines.length; ++i) {
6311
6312 if (traceLines[i] === firstUserLine) {
6313 if (i > 0) {
6314 creatorLine = "\n" + traceLines[i - 1];
6315 }
6316 break;
6317 }
6318 }
6319
6320 }
6321 }
6322 var msg = "a promise was created in a " + name +
6323 "handler " + handlerLine + "but was not returned from it, " +
6324 "see http://goo.gl/rRqMUw" +
6325 creatorLine;
6326 promise._warn(msg, true, promiseCreated);
6327 }
6328}
6329
6330function deprecated(name, replacement) {
6331 var message = name +
6332 " is deprecated and will be removed in a future version.";
6333 if (replacement) message += " Use " + replacement + " instead.";
6334 return warn(message);
6335}
6336
6337function warn(message, shouldUseOwnTrace, promise) {
6338 if (!config.warnings) return;
6339 var warning = new Warning(message);
6340 var ctx;
6341 if (shouldUseOwnTrace) {
6342 promise._attachExtraTrace(warning);
6343 } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
6344 ctx.attachExtraTrace(warning);
6345 } else {
6346 var parsed = parseStackAndMessage(warning);
6347 warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
6348 }
6349
6350 if (!activeFireEvent("warning", warning)) {
6351 formatAndLogError(warning, "", true);
6352 }
6353}
6354
6355function reconstructStack(message, stacks) {
6356 for (var i = 0; i < stacks.length - 1; ++i) {
6357 stacks[i].push("From previous event:");
6358 stacks[i] = stacks[i].join("\n");
6359 }
6360 if (i < stacks.length) {
6361 stacks[i] = stacks[i].join("\n");
6362 }
6363 return message + "\n" + stacks.join("\n");
6364}
6365
6366function removeDuplicateOrEmptyJumps(stacks) {
6367 for (var i = 0; i < stacks.length; ++i) {
6368 if (stacks[i].length === 0 ||
6369 ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
6370 stacks.splice(i, 1);
6371 i--;
6372 }
6373 }
6374}
6375
6376function removeCommonRoots(stacks) {
6377 var current = stacks[0];
6378 for (var i = 1; i < stacks.length; ++i) {
6379 var prev = stacks[i];
6380 var currentLastIndex = current.length - 1;
6381 var currentLastLine = current[currentLastIndex];
6382 var commonRootMeetPoint = -1;
6383
6384 for (var j = prev.length - 1; j >= 0; --j) {
6385 if (prev[j] === currentLastLine) {
6386 commonRootMeetPoint = j;
6387 break;
6388 }
6389 }
6390
6391 for (var j = commonRootMeetPoint; j >= 0; --j) {
6392 var line = prev[j];
6393 if (current[currentLastIndex] === line) {
6394 current.pop();
6395 currentLastIndex--;
6396 } else {
6397 break;
6398 }
6399 }
6400 current = prev;
6401 }
6402}
6403
6404function cleanStack(stack) {
6405 var ret = [];
6406 for (var i = 0; i < stack.length; ++i) {
6407 var line = stack[i];
6408 var isTraceLine = " (No stack trace)" === line ||
6409 stackFramePattern.test(line);
6410 var isInternalFrame = isTraceLine && shouldIgnore(line);
6411 if (isTraceLine && !isInternalFrame) {
6412 if (indentStackFrames && line.charAt(0) !== " ") {
6413 line = " " + line;
6414 }
6415 ret.push(line);
6416 }
6417 }
6418 return ret;
6419}
6420
6421function stackFramesAsArray(error) {
6422 var stack = error.stack.replace(/\s+$/g, "").split("\n");
6423 for (var i = 0; i < stack.length; ++i) {
6424 var line = stack[i];
6425 if (" (No stack trace)" === line || stackFramePattern.test(line)) {
6426 break;
6427 }
6428 }
6429 if (i > 0 && error.name != "SyntaxError") {
6430 stack = stack.slice(i);
6431 }
6432 return stack;
6433}
6434
6435function parseStackAndMessage(error) {
6436 var stack = error.stack;
6437 var message = error.toString();
6438 stack = typeof stack === "string" && stack.length > 0
6439 ? stackFramesAsArray(error) : [" (No stack trace)"];
6440 return {
6441 message: message,
6442 stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
6443 };
6444}
6445
6446function formatAndLogError(error, title, isSoft) {
6447 if (typeof console !== "undefined") {
6448 var message;
6449 if (util.isObject(error)) {
6450 var stack = error.stack;
6451 message = title + formatStack(stack, error);
6452 } else {
6453 message = title + String(error);
6454 }
6455 if (typeof printWarning === "function") {
6456 printWarning(message, isSoft);
6457 } else if (typeof console.log === "function" ||
6458 typeof console.log === "object") {
6459 console.log(message);
6460 }
6461 }
6462}
6463
6464function fireRejectionEvent(name, localHandler, reason, promise) {
6465 var localEventFired = false;
6466 try {
6467 if (typeof localHandler === "function") {
6468 localEventFired = true;
6469 if (name === "rejectionHandled") {
6470 localHandler(promise);
6471 } else {
6472 localHandler(reason, promise);
6473 }
6474 }
6475 } catch (e) {
6476 async.throwLater(e);
6477 }
6478
6479 if (name === "unhandledRejection") {
6480 if (!activeFireEvent(name, reason, promise) && !localEventFired) {
6481 formatAndLogError(reason, "Unhandled rejection ");
6482 }
6483 } else {
6484 activeFireEvent(name, promise);
6485 }
6486}
6487
6488function formatNonError(obj) {
6489 var str;
6490 if (typeof obj === "function") {
6491 str = "[function " +
6492 (obj.name || "anonymous") +
6493 "]";
6494 } else {
6495 str = obj && typeof obj.toString === "function"
6496 ? obj.toString() : util.toString(obj);
6497 var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
6498 if (ruselessToString.test(str)) {
6499 try {
6500 var newStr = JSON.stringify(obj);
6501 str = newStr;
6502 }
6503 catch(e) {
6504
6505 }
6506 }
6507 if (str.length === 0) {
6508 str = "(empty array)";
6509 }
6510 }
6511 return ("(<" + snip(str) + ">, no stack trace)");
6512}
6513
6514function snip(str) {
6515 var maxChars = 41;
6516 if (str.length < maxChars) {
6517 return str;
6518 }
6519 return str.substr(0, maxChars - 3) + "...";
6520}
6521
6522function longStackTracesIsSupported() {
6523 return typeof captureStackTrace === "function";
6524}
6525
6526var shouldIgnore = function() { return false; };
6527var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
6528function parseLineInfo(line) {
6529 var matches = line.match(parseLineInfoRegex);
6530 if (matches) {
6531 return {
6532 fileName: matches[1],
6533 line: parseInt(matches[2], 10)
6534 };
6535 }
6536}
6537
6538function setBounds(firstLineError, lastLineError) {
6539 if (!longStackTracesIsSupported()) return;
6540 var firstStackLines = firstLineError.stack.split("\n");
6541 var lastStackLines = lastLineError.stack.split("\n");
6542 var firstIndex = -1;
6543 var lastIndex = -1;
6544 var firstFileName;
6545 var lastFileName;
6546 for (var i = 0; i < firstStackLines.length; ++i) {
6547 var result = parseLineInfo(firstStackLines[i]);
6548 if (result) {
6549 firstFileName = result.fileName;
6550 firstIndex = result.line;
6551 break;
6552 }
6553 }
6554 for (var i = 0; i < lastStackLines.length; ++i) {
6555 var result = parseLineInfo(lastStackLines[i]);
6556 if (result) {
6557 lastFileName = result.fileName;
6558 lastIndex = result.line;
6559 break;
6560 }
6561 }
6562 if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
6563 firstFileName !== lastFileName || firstIndex >= lastIndex) {
6564 return;
6565 }
6566
6567 shouldIgnore = function(line) {
6568 if (bluebirdFramePattern.test(line)) return true;
6569 var info = parseLineInfo(line);
6570 if (info) {
6571 if (info.fileName === firstFileName &&
6572 (firstIndex <= info.line && info.line <= lastIndex)) {
6573 return true;
6574 }
6575 }
6576 return false;
6577 };
6578}
6579
6580function CapturedTrace(parent) {
6581 this._parent = parent;
6582 this._promisesCreated = 0;
6583 var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
6584 captureStackTrace(this, CapturedTrace);
6585 if (length > 32) this.uncycle();
6586}
6587util.inherits(CapturedTrace, Error);
6588Context.CapturedTrace = CapturedTrace;
6589
6590CapturedTrace.prototype.uncycle = function() {
6591 var length = this._length;
6592 if (length < 2) return;
6593 var nodes = [];
6594 var stackToIndex = {};
6595
6596 for (var i = 0, node = this; node !== undefined; ++i) {
6597 nodes.push(node);
6598 node = node._parent;
6599 }
6600 length = this._length = i;
6601 for (var i = length - 1; i >= 0; --i) {
6602 var stack = nodes[i].stack;
6603 if (stackToIndex[stack] === undefined) {
6604 stackToIndex[stack] = i;
6605 }
6606 }
6607 for (var i = 0; i < length; ++i) {
6608 var currentStack = nodes[i].stack;
6609 var index = stackToIndex[currentStack];
6610 if (index !== undefined && index !== i) {
6611 if (index > 0) {
6612 nodes[index - 1]._parent = undefined;
6613 nodes[index - 1]._length = 1;
6614 }
6615 nodes[i]._parent = undefined;
6616 nodes[i]._length = 1;
6617 var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
6618
6619 if (index < length - 1) {
6620 cycleEdgeNode._parent = nodes[index + 1];
6621 cycleEdgeNode._parent.uncycle();
6622 cycleEdgeNode._length =
6623 cycleEdgeNode._parent._length + 1;
6624 } else {
6625 cycleEdgeNode._parent = undefined;
6626 cycleEdgeNode._length = 1;
6627 }
6628 var currentChildLength = cycleEdgeNode._length + 1;
6629 for (var j = i - 2; j >= 0; --j) {
6630 nodes[j]._length = currentChildLength;
6631 currentChildLength++;
6632 }
6633 return;
6634 }
6635 }
6636};
6637
6638CapturedTrace.prototype.attachExtraTrace = function(error) {
6639 if (error.__stackCleaned__) return;
6640 this.uncycle();
6641 var parsed = parseStackAndMessage(error);
6642 var message = parsed.message;
6643 var stacks = [parsed.stack];
6644
6645 var trace = this;
6646 while (trace !== undefined) {
6647 stacks.push(cleanStack(trace.stack.split("\n")));
6648 trace = trace._parent;
6649 }
6650 removeCommonRoots(stacks);
6651 removeDuplicateOrEmptyJumps(stacks);
6652 util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
6653 util.notEnumerableProp(error, "__stackCleaned__", true);
6654};
6655
6656var captureStackTrace = (function stackDetection() {
6657 var v8stackFramePattern = /^\s*at\s*/;
6658 var v8stackFormatter = function(stack, error) {
6659 if (typeof stack === "string") return stack;
6660
6661 if (error.name !== undefined &&
6662 error.message !== undefined) {
6663 return error.toString();
6664 }
6665 return formatNonError(error);
6666 };
6667
6668 if (typeof Error.stackTraceLimit === "number" &&
6669 typeof Error.captureStackTrace === "function") {
6670 Error.stackTraceLimit += 6;
6671 stackFramePattern = v8stackFramePattern;
6672 formatStack = v8stackFormatter;
6673 var captureStackTrace = Error.captureStackTrace;
6674
6675 shouldIgnore = function(line) {
6676 return bluebirdFramePattern.test(line);
6677 };
6678 return function(receiver, ignoreUntil) {
6679 Error.stackTraceLimit += 6;
6680 captureStackTrace(receiver, ignoreUntil);
6681 Error.stackTraceLimit -= 6;
6682 };
6683 }
6684 var err = new Error();
6685
6686 if (typeof err.stack === "string" &&
6687 err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
6688 stackFramePattern = /@/;
6689 formatStack = v8stackFormatter;
6690 indentStackFrames = true;
6691 return function captureStackTrace(o) {
6692 o.stack = new Error().stack;
6693 };
6694 }
6695
6696 var hasStackAfterThrow;
6697 try { throw new Error(); }
6698 catch(e) {
6699 hasStackAfterThrow = ("stack" in e);
6700 }
6701 if (!("stack" in err) && hasStackAfterThrow &&
6702 typeof Error.stackTraceLimit === "number") {
6703 stackFramePattern = v8stackFramePattern;
6704 formatStack = v8stackFormatter;
6705 return function captureStackTrace(o) {
6706 Error.stackTraceLimit += 6;
6707 try { throw new Error(); }
6708 catch(e) { o.stack = e.stack; }
6709 Error.stackTraceLimit -= 6;
6710 };
6711 }
6712
6713 formatStack = function(stack, error) {
6714 if (typeof stack === "string") return stack;
6715
6716 if ((typeof error === "object" ||
6717 typeof error === "function") &&
6718 error.name !== undefined &&
6719 error.message !== undefined) {
6720 return error.toString();
6721 }
6722 return formatNonError(error);
6723 };
6724
6725 return null;
6726
6727})([]);
6728
6729if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
6730 printWarning = function (message) {
6731 console.warn(message);
6732 };
6733 if (util.isNode && process.stderr.isTTY) {
6734 printWarning = function(message, isSoft) {
6735 var color = isSoft ? "\u001b[33m" : "\u001b[31m";
6736 console.warn(color + message + "\u001b[0m\n");
6737 };
6738 } else if (!util.isNode && typeof (new Error().stack) === "string") {
6739 printWarning = function(message, isSoft) {
6740 console.warn("%c" + message,
6741 isSoft ? "color: darkorange" : "color: red");
6742 };
6743 }
6744}
6745
6746var config = {
6747 warnings: warnings,
6748 longStackTraces: false,
6749 cancellation: false,
6750 monitoring: false
6751};
6752
6753if (longStackTraces) Promise.longStackTraces();
6754
6755return {
6756 longStackTraces: function() {
6757 return config.longStackTraces;
6758 },
6759 warnings: function() {
6760 return config.warnings;
6761 },
6762 cancellation: function() {
6763 return config.cancellation;
6764 },
6765 monitoring: function() {
6766 return config.monitoring;
6767 },
6768 propagateFromFunction: function() {
6769 return propagateFromFunction;
6770 },
6771 boundValueFunction: function() {
6772 return boundValueFunction;
6773 },
6774 checkForgottenReturns: checkForgottenReturns,
6775 setBounds: setBounds,
6776 warn: warn,
6777 deprecated: deprecated,
6778 CapturedTrace: CapturedTrace,
6779 fireDomEvent: fireDomEvent,
6780 fireGlobalEvent: fireGlobalEvent
6781};
6782};
6783
6784},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){
6785"use strict";
6786module.exports = function(Promise) {
6787function returner() {
6788 return this.value;
6789}
6790function thrower() {
6791 throw this.reason;
6792}
6793
6794Promise.prototype["return"] =
6795Promise.prototype.thenReturn = function (value) {
6796 if (value instanceof Promise) value.suppressUnhandledRejections();
6797 return this._then(
6798 returner, undefined, undefined, {value: value}, undefined);
6799};
6800
6801Promise.prototype["throw"] =
6802Promise.prototype.thenThrow = function (reason) {
6803 return this._then(
6804 thrower, undefined, undefined, {reason: reason}, undefined);
6805};
6806
6807Promise.prototype.catchThrow = function (reason) {
6808 if (arguments.length <= 1) {
6809 return this._then(
6810 undefined, thrower, undefined, {reason: reason}, undefined);
6811 } else {
6812 var _reason = arguments[1];
6813 var handler = function() {throw _reason;};
6814 return this.caught(reason, handler);
6815 }
6816};
6817
6818Promise.prototype.catchReturn = function (value) {
6819 if (arguments.length <= 1) {
6820 if (value instanceof Promise) value.suppressUnhandledRejections();
6821 return this._then(
6822 undefined, returner, undefined, {value: value}, undefined);
6823 } else {
6824 var _value = arguments[1];
6825 if (_value instanceof Promise) _value.suppressUnhandledRejections();
6826 var handler = function() {return _value;};
6827 return this.caught(value, handler);
6828 }
6829};
6830};
6831
6832},{}],11:[function(_dereq_,module,exports){
6833"use strict";
6834module.exports = function(Promise, INTERNAL) {
6835var PromiseReduce = Promise.reduce;
6836var PromiseAll = Promise.all;
6837
6838function promiseAllThis() {
6839 return PromiseAll(this);
6840}
6841
6842function PromiseMapSeries(promises, fn) {
6843 return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
6844}
6845
6846Promise.prototype.each = function (fn) {
6847 return PromiseReduce(this, fn, INTERNAL, 0)
6848 ._then(promiseAllThis, undefined, undefined, this, undefined);
6849};
6850
6851Promise.prototype.mapSeries = function (fn) {
6852 return PromiseReduce(this, fn, INTERNAL, INTERNAL);
6853};
6854
6855Promise.each = function (promises, fn) {
6856 return PromiseReduce(promises, fn, INTERNAL, 0)
6857 ._then(promiseAllThis, undefined, undefined, promises, undefined);
6858};
6859
6860Promise.mapSeries = PromiseMapSeries;
6861};
6862
6863
6864},{}],12:[function(_dereq_,module,exports){
6865"use strict";
6866var es5 = _dereq_("./es5");
6867var Objectfreeze = es5.freeze;
6868var util = _dereq_("./util");
6869var inherits = util.inherits;
6870var notEnumerableProp = util.notEnumerableProp;
6871
6872function subError(nameProperty, defaultMessage) {
6873 function SubError(message) {
6874 if (!(this instanceof SubError)) return new SubError(message);
6875 notEnumerableProp(this, "message",
6876 typeof message === "string" ? message : defaultMessage);
6877 notEnumerableProp(this, "name", nameProperty);
6878 if (Error.captureStackTrace) {
6879 Error.captureStackTrace(this, this.constructor);
6880 } else {
6881 Error.call(this);
6882 }
6883 }
6884 inherits(SubError, Error);
6885 return SubError;
6886}
6887
6888var _TypeError, _RangeError;
6889var Warning = subError("Warning", "warning");
6890var CancellationError = subError("CancellationError", "cancellation error");
6891var TimeoutError = subError("TimeoutError", "timeout error");
6892var AggregateError = subError("AggregateError", "aggregate error");
6893try {
6894 _TypeError = TypeError;
6895 _RangeError = RangeError;
6896} catch(e) {
6897 _TypeError = subError("TypeError", "type error");
6898 _RangeError = subError("RangeError", "range error");
6899}
6900
6901var methods = ("join pop push shift unshift slice filter forEach some " +
6902 "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
6903
6904for (var i = 0; i < methods.length; ++i) {
6905 if (typeof Array.prototype[methods[i]] === "function") {
6906 AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
6907 }
6908}
6909
6910es5.defineProperty(AggregateError.prototype, "length", {
6911 value: 0,
6912 configurable: false,
6913 writable: true,
6914 enumerable: true
6915});
6916AggregateError.prototype["isOperational"] = true;
6917var level = 0;
6918AggregateError.prototype.toString = function() {
6919 var indent = Array(level * 4 + 1).join(" ");
6920 var ret = "\n" + indent + "AggregateError of:" + "\n";
6921 level++;
6922 indent = Array(level * 4 + 1).join(" ");
6923 for (var i = 0; i < this.length; ++i) {
6924 var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
6925 var lines = str.split("\n");
6926 for (var j = 0; j < lines.length; ++j) {
6927 lines[j] = indent + lines[j];
6928 }
6929 str = lines.join("\n");
6930 ret += str + "\n";
6931 }
6932 level--;
6933 return ret;
6934};
6935
6936function OperationalError(message) {
6937 if (!(this instanceof OperationalError))
6938 return new OperationalError(message);
6939 notEnumerableProp(this, "name", "OperationalError");
6940 notEnumerableProp(this, "message", message);
6941 this.cause = message;
6942 this["isOperational"] = true;
6943
6944 if (message instanceof Error) {
6945 notEnumerableProp(this, "message", message.message);
6946 notEnumerableProp(this, "stack", message.stack);
6947 } else if (Error.captureStackTrace) {
6948 Error.captureStackTrace(this, this.constructor);
6949 }
6950
6951}
6952inherits(OperationalError, Error);
6953
6954var errorTypes = Error["__BluebirdErrorTypes__"];
6955if (!errorTypes) {
6956 errorTypes = Objectfreeze({
6957 CancellationError: CancellationError,
6958 TimeoutError: TimeoutError,
6959 OperationalError: OperationalError,
6960 RejectionError: OperationalError,
6961 AggregateError: AggregateError
6962 });
6963 es5.defineProperty(Error, "__BluebirdErrorTypes__", {
6964 value: errorTypes,
6965 writable: false,
6966 enumerable: false,
6967 configurable: false
6968 });
6969}
6970
6971module.exports = {
6972 Error: Error,
6973 TypeError: _TypeError,
6974 RangeError: _RangeError,
6975 CancellationError: errorTypes.CancellationError,
6976 OperationalError: errorTypes.OperationalError,
6977 TimeoutError: errorTypes.TimeoutError,
6978 AggregateError: errorTypes.AggregateError,
6979 Warning: Warning
6980};
6981
6982},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){
6983var isES5 = (function(){
6984 "use strict";
6985 return this === undefined;
6986})();
6987
6988if (isES5) {
6989 module.exports = {
6990 freeze: Object.freeze,
6991 defineProperty: Object.defineProperty,
6992 getDescriptor: Object.getOwnPropertyDescriptor,
6993 keys: Object.keys,
6994 names: Object.getOwnPropertyNames,
6995 getPrototypeOf: Object.getPrototypeOf,
6996 isArray: Array.isArray,
6997 isES5: isES5,
6998 propertyIsWritable: function(obj, prop) {
6999 var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
7000 return !!(!descriptor || descriptor.writable || descriptor.set);
7001 }
7002 };
7003} else {
7004 var has = {}.hasOwnProperty;
7005 var str = {}.toString;
7006 var proto = {}.constructor.prototype;
7007
7008 var ObjectKeys = function (o) {
7009 var ret = [];
7010 for (var key in o) {
7011 if (has.call(o, key)) {
7012 ret.push(key);
7013 }
7014 }
7015 return ret;
7016 };
7017
7018 var ObjectGetDescriptor = function(o, key) {
7019 return {value: o[key]};
7020 };
7021
7022 var ObjectDefineProperty = function (o, key, desc) {
7023 o[key] = desc.value;
7024 return o;
7025 };
7026
7027 var ObjectFreeze = function (obj) {
7028 return obj;
7029 };
7030
7031 var ObjectGetPrototypeOf = function (obj) {
7032 try {
7033 return Object(obj).constructor.prototype;
7034 }
7035 catch (e) {
7036 return proto;
7037 }
7038 };
7039
7040 var ArrayIsArray = function (obj) {
7041 try {
7042 return str.call(obj) === "[object Array]";
7043 }
7044 catch(e) {
7045 return false;
7046 }
7047 };
7048
7049 module.exports = {
7050 isArray: ArrayIsArray,
7051 keys: ObjectKeys,
7052 names: ObjectKeys,
7053 defineProperty: ObjectDefineProperty,
7054 getDescriptor: ObjectGetDescriptor,
7055 freeze: ObjectFreeze,
7056 getPrototypeOf: ObjectGetPrototypeOf,
7057 isES5: isES5,
7058 propertyIsWritable: function() {
7059 return true;
7060 }
7061 };
7062}
7063
7064},{}],14:[function(_dereq_,module,exports){
7065"use strict";
7066module.exports = function(Promise, INTERNAL) {
7067var PromiseMap = Promise.map;
7068
7069Promise.prototype.filter = function (fn, options) {
7070 return PromiseMap(this, fn, options, INTERNAL);
7071};
7072
7073Promise.filter = function (promises, fn, options) {
7074 return PromiseMap(promises, fn, options, INTERNAL);
7075};
7076};
7077
7078},{}],15:[function(_dereq_,module,exports){
7079"use strict";
7080module.exports = function(Promise, tryConvertToPromise) {
7081var util = _dereq_("./util");
7082var CancellationError = Promise.CancellationError;
7083var errorObj = util.errorObj;
7084
7085function PassThroughHandlerContext(promise, type, handler) {
7086 this.promise = promise;
7087 this.type = type;
7088 this.handler = handler;
7089 this.called = false;
7090 this.cancelPromise = null;
7091}
7092
7093PassThroughHandlerContext.prototype.isFinallyHandler = function() {
7094 return this.type === 0;
7095};
7096
7097function FinallyHandlerCancelReaction(finallyHandler) {
7098 this.finallyHandler = finallyHandler;
7099}
7100
7101FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
7102 checkCancel(this.finallyHandler);
7103};
7104
7105function checkCancel(ctx, reason) {
7106 if (ctx.cancelPromise != null) {
7107 if (arguments.length > 1) {
7108 ctx.cancelPromise._reject(reason);
7109 } else {
7110 ctx.cancelPromise._cancel();
7111 }
7112 ctx.cancelPromise = null;
7113 return true;
7114 }
7115 return false;
7116}
7117
7118function succeed() {
7119 return finallyHandler.call(this, this.promise._target()._settledValue());
7120}
7121function fail(reason) {
7122 if (checkCancel(this, reason)) return;
7123 errorObj.e = reason;
7124 return errorObj;
7125}
7126function finallyHandler(reasonOrValue) {
7127 var promise = this.promise;
7128 var handler = this.handler;
7129
7130 if (!this.called) {
7131 this.called = true;
7132 var ret = this.isFinallyHandler()
7133 ? handler.call(promise._boundValue())
7134 : handler.call(promise._boundValue(), reasonOrValue);
7135 if (ret !== undefined) {
7136 promise._setReturnedNonUndefined();
7137 var maybePromise = tryConvertToPromise(ret, promise);
7138 if (maybePromise instanceof Promise) {
7139 if (this.cancelPromise != null) {
7140 if (maybePromise._isCancelled()) {
7141 var reason =
7142 new CancellationError("late cancellation observer");
7143 promise._attachExtraTrace(reason);
7144 errorObj.e = reason;
7145 return errorObj;
7146 } else if (maybePromise.isPending()) {
7147 maybePromise._attachCancellationCallback(
7148 new FinallyHandlerCancelReaction(this));
7149 }
7150 }
7151 return maybePromise._then(
7152 succeed, fail, undefined, this, undefined);
7153 }
7154 }
7155 }
7156
7157 if (promise.isRejected()) {
7158 checkCancel(this);
7159 errorObj.e = reasonOrValue;
7160 return errorObj;
7161 } else {
7162 checkCancel(this);
7163 return reasonOrValue;
7164 }
7165}
7166
7167Promise.prototype._passThrough = function(handler, type, success, fail) {
7168 if (typeof handler !== "function") return this.then();
7169 return this._then(success,
7170 fail,
7171 undefined,
7172 new PassThroughHandlerContext(this, type, handler),
7173 undefined);
7174};
7175
7176Promise.prototype.lastly =
7177Promise.prototype["finally"] = function (handler) {
7178 return this._passThrough(handler,
7179 0,
7180 finallyHandler,
7181 finallyHandler);
7182};
7183
7184Promise.prototype.tap = function (handler) {
7185 return this._passThrough(handler, 1, finallyHandler);
7186};
7187
7188return PassThroughHandlerContext;
7189};
7190
7191},{"./util":36}],16:[function(_dereq_,module,exports){
7192"use strict";
7193module.exports = function(Promise,
7194 apiRejection,
7195 INTERNAL,
7196 tryConvertToPromise,
7197 Proxyable,
7198 debug) {
7199var errors = _dereq_("./errors");
7200var TypeError = errors.TypeError;
7201var util = _dereq_("./util");
7202var errorObj = util.errorObj;
7203var tryCatch = util.tryCatch;
7204var yieldHandlers = [];
7205
7206function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
7207 for (var i = 0; i < yieldHandlers.length; ++i) {
7208 traceParent._pushContext();
7209 var result = tryCatch(yieldHandlers[i])(value);
7210 traceParent._popContext();
7211 if (result === errorObj) {
7212 traceParent._pushContext();
7213 var ret = Promise.reject(errorObj.e);
7214 traceParent._popContext();
7215 return ret;
7216 }
7217 var maybePromise = tryConvertToPromise(result, traceParent);
7218 if (maybePromise instanceof Promise) return maybePromise;
7219 }
7220 return null;
7221}
7222
7223function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
7224 if (debug.cancellation()) {
7225 var internal = new Promise(INTERNAL);
7226 var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
7227 this._promise = internal.lastly(function() {
7228 return _finallyPromise;
7229 });
7230 internal._captureStackTrace();
7231 internal._setOnCancel(this);
7232 } else {
7233 var promise = this._promise = new Promise(INTERNAL);
7234 promise._captureStackTrace();
7235 }
7236 this._stack = stack;
7237 this._generatorFunction = generatorFunction;
7238 this._receiver = receiver;
7239 this._generator = undefined;
7240 this._yieldHandlers = typeof yieldHandler === "function"
7241 ? [yieldHandler].concat(yieldHandlers)
7242 : yieldHandlers;
7243 this._yieldedPromise = null;
7244 this._cancellationPhase = false;
7245}
7246util.inherits(PromiseSpawn, Proxyable);
7247
7248PromiseSpawn.prototype._isResolved = function() {
7249 return this._promise === null;
7250};
7251
7252PromiseSpawn.prototype._cleanup = function() {
7253 this._promise = this._generator = null;
7254 if (debug.cancellation() && this._finallyPromise !== null) {
7255 this._finallyPromise._fulfill();
7256 this._finallyPromise = null;
7257 }
7258};
7259
7260PromiseSpawn.prototype._promiseCancelled = function() {
7261 if (this._isResolved()) return;
7262 var implementsReturn = typeof this._generator["return"] !== "undefined";
7263
7264 var result;
7265 if (!implementsReturn) {
7266 var reason = new Promise.CancellationError(
7267 "generator .return() sentinel");
7268 Promise.coroutine.returnSentinel = reason;
7269 this._promise._attachExtraTrace(reason);
7270 this._promise._pushContext();
7271 result = tryCatch(this._generator["throw"]).call(this._generator,
7272 reason);
7273 this._promise._popContext();
7274 } else {
7275 this._promise._pushContext();
7276 result = tryCatch(this._generator["return"]).call(this._generator,
7277 undefined);
7278 this._promise._popContext();
7279 }
7280 this._cancellationPhase = true;
7281 this._yieldedPromise = null;
7282 this._continue(result);
7283};
7284
7285PromiseSpawn.prototype._promiseFulfilled = function(value) {
7286 this._yieldedPromise = null;
7287 this._promise._pushContext();
7288 var result = tryCatch(this._generator.next).call(this._generator, value);
7289 this._promise._popContext();
7290 this._continue(result);
7291};
7292
7293PromiseSpawn.prototype._promiseRejected = function(reason) {
7294 this._yieldedPromise = null;
7295 this._promise._attachExtraTrace(reason);
7296 this._promise._pushContext();
7297 var result = tryCatch(this._generator["throw"])
7298 .call(this._generator, reason);
7299 this._promise._popContext();
7300 this._continue(result);
7301};
7302
7303PromiseSpawn.prototype._resultCancelled = function() {
7304 if (this._yieldedPromise instanceof Promise) {
7305 var promise = this._yieldedPromise;
7306 this._yieldedPromise = null;
7307 promise.cancel();
7308 }
7309};
7310
7311PromiseSpawn.prototype.promise = function () {
7312 return this._promise;
7313};
7314
7315PromiseSpawn.prototype._run = function () {
7316 this._generator = this._generatorFunction.call(this._receiver);
7317 this._receiver =
7318 this._generatorFunction = undefined;
7319 this._promiseFulfilled(undefined);
7320};
7321
7322PromiseSpawn.prototype._continue = function (result) {
7323 var promise = this._promise;
7324 if (result === errorObj) {
7325 this._cleanup();
7326 if (this._cancellationPhase) {
7327 return promise.cancel();
7328 } else {
7329 return promise._rejectCallback(result.e, false);
7330 }
7331 }
7332
7333 var value = result.value;
7334 if (result.done === true) {
7335 this._cleanup();
7336 if (this._cancellationPhase) {
7337 return promise.cancel();
7338 } else {
7339 return promise._resolveCallback(value);
7340 }
7341 } else {
7342 var maybePromise = tryConvertToPromise(value, this._promise);
7343 if (!(maybePromise instanceof Promise)) {
7344 maybePromise =
7345 promiseFromYieldHandler(maybePromise,
7346 this._yieldHandlers,
7347 this._promise);
7348 if (maybePromise === null) {
7349 this._promiseRejected(
7350 new TypeError(
7351 "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", value) +
7352 "From coroutine:\u000a" +
7353 this._stack.split("\n").slice(1, -7).join("\n")
7354 )
7355 );
7356 return;
7357 }
7358 }
7359 maybePromise = maybePromise._target();
7360 var bitField = maybePromise._bitField;
7361 ;
7362 if (((bitField & 50397184) === 0)) {
7363 this._yieldedPromise = maybePromise;
7364 maybePromise._proxy(this, null);
7365 } else if (((bitField & 33554432) !== 0)) {
7366 Promise._async.invoke(
7367 this._promiseFulfilled, this, maybePromise._value()
7368 );
7369 } else if (((bitField & 16777216) !== 0)) {
7370 Promise._async.invoke(
7371 this._promiseRejected, this, maybePromise._reason()
7372 );
7373 } else {
7374 this._promiseCancelled();
7375 }
7376 }
7377};
7378
7379Promise.coroutine = function (generatorFunction, options) {
7380 if (typeof generatorFunction !== "function") {
7381 throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
7382 }
7383 var yieldHandler = Object(options).yieldHandler;
7384 var PromiseSpawn$ = PromiseSpawn;
7385 var stack = new Error().stack;
7386 return function () {
7387 var generator = generatorFunction.apply(this, arguments);
7388 var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
7389 stack);
7390 var ret = spawn.promise();
7391 spawn._generator = generator;
7392 spawn._promiseFulfilled(undefined);
7393 return ret;
7394 };
7395};
7396
7397Promise.coroutine.addYieldHandler = function(fn) {
7398 if (typeof fn !== "function") {
7399 throw new TypeError("expecting a function but got " + util.classString(fn));
7400 }
7401 yieldHandlers.push(fn);
7402};
7403
7404Promise.spawn = function (generatorFunction) {
7405 debug.deprecated("Promise.spawn()", "Promise.coroutine()");
7406 if (typeof generatorFunction !== "function") {
7407 return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
7408 }
7409 var spawn = new PromiseSpawn(generatorFunction, this);
7410 var ret = spawn.promise();
7411 spawn._run(Promise.spawn);
7412 return ret;
7413};
7414};
7415
7416},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){
7417"use strict";
7418module.exports =
7419function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
7420 getDomain) {
7421var util = _dereq_("./util");
7422var canEvaluate = util.canEvaluate;
7423var tryCatch = util.tryCatch;
7424var errorObj = util.errorObj;
7425var reject;
7426
7427if (false) {
7428if (canEvaluate) {
7429 var thenCallback = function(i) {
7430 return new Function("value", "holder", " \n\
7431 'use strict'; \n\
7432 holder.pIndex = value; \n\
7433 holder.checkFulfillment(this); \n\
7434 ".replace(/Index/g, i));
7435 };
7436
7437 var promiseSetter = function(i) {
7438 return new Function("promise", "holder", " \n\
7439 'use strict'; \n\
7440 holder.pIndex = promise; \n\
7441 ".replace(/Index/g, i));
7442 };
7443
7444 var generateHolderClass = function(total) {
7445 var props = new Array(total);
7446 for (var i = 0; i < props.length; ++i) {
7447 props[i] = "this.p" + (i+1);
7448 }
7449 var assignment = props.join(" = ") + " = null;";
7450 var cancellationCode= "var promise;\n" + props.map(function(prop) {
7451 return " \n\
7452 promise = " + prop + "; \n\
7453 if (promise instanceof Promise) { \n\
7454 promise.cancel(); \n\
7455 } \n\
7456 ";
7457 }).join("\n");
7458 var passedArguments = props.join(", ");
7459 var name = "Holder$" + total;
7460
7461
7462 var code = "return function(tryCatch, errorObj, Promise, async) { \n\
7463 'use strict'; \n\
7464 function [TheName](fn) { \n\
7465 [TheProperties] \n\
7466 this.fn = fn; \n\
7467 this.asyncNeeded = true; \n\
7468 this.now = 0; \n\
7469 } \n\
7470 \n\
7471 [TheName].prototype._callFunction = function(promise) { \n\
7472 promise._pushContext(); \n\
7473 var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
7474 promise._popContext(); \n\
7475 if (ret === errorObj) { \n\
7476 promise._rejectCallback(ret.e, false); \n\
7477 } else { \n\
7478 promise._resolveCallback(ret); \n\
7479 } \n\
7480 }; \n\
7481 \n\
7482 [TheName].prototype.checkFulfillment = function(promise) { \n\
7483 var now = ++this.now; \n\
7484 if (now === [TheTotal]) { \n\
7485 if (this.asyncNeeded) { \n\
7486 async.invoke(this._callFunction, this, promise); \n\
7487 } else { \n\
7488 this._callFunction(promise); \n\
7489 } \n\
7490 \n\
7491 } \n\
7492 }; \n\
7493 \n\
7494 [TheName].prototype._resultCancelled = function() { \n\
7495 [CancellationCode] \n\
7496 }; \n\
7497 \n\
7498 return [TheName]; \n\
7499 }(tryCatch, errorObj, Promise, async); \n\
7500 ";
7501
7502 code = code.replace(/\[TheName\]/g, name)
7503 .replace(/\[TheTotal\]/g, total)
7504 .replace(/\[ThePassedArguments\]/g, passedArguments)
7505 .replace(/\[TheProperties\]/g, assignment)
7506 .replace(/\[CancellationCode\]/g, cancellationCode);
7507
7508 return new Function("tryCatch", "errorObj", "Promise", "async", code)
7509 (tryCatch, errorObj, Promise, async);
7510 };
7511
7512 var holderClasses = [];
7513 var thenCallbacks = [];
7514 var promiseSetters = [];
7515
7516 for (var i = 0; i < 8; ++i) {
7517 holderClasses.push(generateHolderClass(i + 1));
7518 thenCallbacks.push(thenCallback(i + 1));
7519 promiseSetters.push(promiseSetter(i + 1));
7520 }
7521
7522 reject = function (reason) {
7523 this._reject(reason);
7524 };
7525}}
7526
7527Promise.join = function () {
7528 var last = arguments.length - 1;
7529 var fn;
7530 if (last > 0 && typeof arguments[last] === "function") {
7531 fn = arguments[last];
7532 if (false) {
7533 if (last <= 8 && canEvaluate) {
7534 var ret = new Promise(INTERNAL);
7535 ret._captureStackTrace();
7536 var HolderClass = holderClasses[last - 1];
7537 var holder = new HolderClass(fn);
7538 var callbacks = thenCallbacks;
7539
7540 for (var i = 0; i < last; ++i) {
7541 var maybePromise = tryConvertToPromise(arguments[i], ret);
7542 if (maybePromise instanceof Promise) {
7543 maybePromise = maybePromise._target();
7544 var bitField = maybePromise._bitField;
7545 ;
7546 if (((bitField & 50397184) === 0)) {
7547 maybePromise._then(callbacks[i], reject,
7548 undefined, ret, holder);
7549 promiseSetters[i](maybePromise, holder);
7550 holder.asyncNeeded = false;
7551 } else if (((bitField & 33554432) !== 0)) {
7552 callbacks[i].call(ret,
7553 maybePromise._value(), holder);
7554 } else if (((bitField & 16777216) !== 0)) {
7555 ret._reject(maybePromise._reason());
7556 } else {
7557 ret._cancel();
7558 }
7559 } else {
7560 callbacks[i].call(ret, maybePromise, holder);
7561 }
7562 }
7563
7564 if (!ret._isFateSealed()) {
7565 if (holder.asyncNeeded) {
7566 var domain = getDomain();
7567 if (domain !== null) {
7568 holder.fn = util.domainBind(domain, holder.fn);
7569 }
7570 }
7571 ret._setAsyncGuaranteed();
7572 ret._setOnCancel(holder);
7573 }
7574 return ret;
7575 }
7576 }
7577 }
7578 var args = [].slice.call(arguments);;
7579 if (fn) args.pop();
7580 var ret = new PromiseArray(args).promise();
7581 return fn !== undefined ? ret.spread(fn) : ret;
7582};
7583
7584};
7585
7586},{"./util":36}],18:[function(_dereq_,module,exports){
7587"use strict";
7588module.exports = function(Promise,
7589 PromiseArray,
7590 apiRejection,
7591 tryConvertToPromise,
7592 INTERNAL,
7593 debug) {
7594var getDomain = Promise._getDomain;
7595var util = _dereq_("./util");
7596var tryCatch = util.tryCatch;
7597var errorObj = util.errorObj;
7598var async = Promise._async;
7599
7600function MappingPromiseArray(promises, fn, limit, _filter) {
7601 this.constructor$(promises);
7602 this._promise._captureStackTrace();
7603 var domain = getDomain();
7604 this._callback = domain === null ? fn : util.domainBind(domain, fn);
7605 this._preservedValues = _filter === INTERNAL
7606 ? new Array(this.length())
7607 : null;
7608 this._limit = limit;
7609 this._inFlight = 0;
7610 this._queue = [];
7611 async.invoke(this._asyncInit, this, undefined);
7612}
7613util.inherits(MappingPromiseArray, PromiseArray);
7614
7615MappingPromiseArray.prototype._asyncInit = function() {
7616 this._init$(undefined, -2);
7617};
7618
7619MappingPromiseArray.prototype._init = function () {};
7620
7621MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
7622 var values = this._values;
7623 var length = this.length();
7624 var preservedValues = this._preservedValues;
7625 var limit = this._limit;
7626
7627 if (index < 0) {
7628 index = (index * -1) - 1;
7629 values[index] = value;
7630 if (limit >= 1) {
7631 this._inFlight--;
7632 this._drainQueue();
7633 if (this._isResolved()) return true;
7634 }
7635 } else {
7636 if (limit >= 1 && this._inFlight >= limit) {
7637 values[index] = value;
7638 this._queue.push(index);
7639 return false;
7640 }
7641 if (preservedValues !== null) preservedValues[index] = value;
7642
7643 var promise = this._promise;
7644 var callback = this._callback;
7645 var receiver = promise._boundValue();
7646 promise._pushContext();
7647 var ret = tryCatch(callback).call(receiver, value, index, length);
7648 var promiseCreated = promise._popContext();
7649 debug.checkForgottenReturns(
7650 ret,
7651 promiseCreated,
7652 preservedValues !== null ? "Promise.filter" : "Promise.map",
7653 promise
7654 );
7655 if (ret === errorObj) {
7656 this._reject(ret.e);
7657 return true;
7658 }
7659
7660 var maybePromise = tryConvertToPromise(ret, this._promise);
7661 if (maybePromise instanceof Promise) {
7662 maybePromise = maybePromise._target();
7663 var bitField = maybePromise._bitField;
7664 ;
7665 if (((bitField & 50397184) === 0)) {
7666 if (limit >= 1) this._inFlight++;
7667 values[index] = maybePromise;
7668 maybePromise._proxy(this, (index + 1) * -1);
7669 return false;
7670 } else if (((bitField & 33554432) !== 0)) {
7671 ret = maybePromise._value();
7672 } else if (((bitField & 16777216) !== 0)) {
7673 this._reject(maybePromise._reason());
7674 return true;
7675 } else {
7676 this._cancel();
7677 return true;
7678 }
7679 }
7680 values[index] = ret;
7681 }
7682 var totalResolved = ++this._totalResolved;
7683 if (totalResolved >= length) {
7684 if (preservedValues !== null) {
7685 this._filter(values, preservedValues);
7686 } else {
7687 this._resolve(values);
7688 }
7689 return true;
7690 }
7691 return false;
7692};
7693
7694MappingPromiseArray.prototype._drainQueue = function () {
7695 var queue = this._queue;
7696 var limit = this._limit;
7697 var values = this._values;
7698 while (queue.length > 0 && this._inFlight < limit) {
7699 if (this._isResolved()) return;
7700 var index = queue.pop();
7701 this._promiseFulfilled(values[index], index);
7702 }
7703};
7704
7705MappingPromiseArray.prototype._filter = function (booleans, values) {
7706 var len = values.length;
7707 var ret = new Array(len);
7708 var j = 0;
7709 for (var i = 0; i < len; ++i) {
7710 if (booleans[i]) ret[j++] = values[i];
7711 }
7712 ret.length = j;
7713 this._resolve(ret);
7714};
7715
7716MappingPromiseArray.prototype.preservedValues = function () {
7717 return this._preservedValues;
7718};
7719
7720function map(promises, fn, options, _filter) {
7721 if (typeof fn !== "function") {
7722 return apiRejection("expecting a function but got " + util.classString(fn));
7723 }
7724
7725 var limit = 0;
7726 if (options !== undefined) {
7727 if (typeof options === "object" && options !== null) {
7728 if (typeof options.concurrency !== "number") {
7729 return Promise.reject(
7730 new TypeError("'concurrency' must be a number but it is " +
7731 util.classString(options.concurrency)));
7732 }
7733 limit = options.concurrency;
7734 } else {
7735 return Promise.reject(new TypeError(
7736 "options argument must be an object but it is " +
7737 util.classString(options)));
7738 }
7739 }
7740 limit = typeof limit === "number" &&
7741 isFinite(limit) && limit >= 1 ? limit : 0;
7742 return new MappingPromiseArray(promises, fn, limit, _filter).promise();
7743}
7744
7745Promise.prototype.map = function (fn, options) {
7746 return map(this, fn, options, null);
7747};
7748
7749Promise.map = function (promises, fn, options, _filter) {
7750 return map(promises, fn, options, _filter);
7751};
7752
7753
7754};
7755
7756},{"./util":36}],19:[function(_dereq_,module,exports){
7757"use strict";
7758module.exports =
7759function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
7760var util = _dereq_("./util");
7761var tryCatch = util.tryCatch;
7762
7763Promise.method = function (fn) {
7764 if (typeof fn !== "function") {
7765 throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
7766 }
7767 return function () {
7768 var ret = new Promise(INTERNAL);
7769 ret._captureStackTrace();
7770 ret._pushContext();
7771 var value = tryCatch(fn).apply(this, arguments);
7772 var promiseCreated = ret._popContext();
7773 debug.checkForgottenReturns(
7774 value, promiseCreated, "Promise.method", ret);
7775 ret._resolveFromSyncValue(value);
7776 return ret;
7777 };
7778};
7779
7780Promise.attempt = Promise["try"] = function (fn) {
7781 if (typeof fn !== "function") {
7782 return apiRejection("expecting a function but got " + util.classString(fn));
7783 }
7784 var ret = new Promise(INTERNAL);
7785 ret._captureStackTrace();
7786 ret._pushContext();
7787 var value;
7788 if (arguments.length > 1) {
7789 debug.deprecated("calling Promise.try with more than 1 argument");
7790 var arg = arguments[1];
7791 var ctx = arguments[2];
7792 value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
7793 : tryCatch(fn).call(ctx, arg);
7794 } else {
7795 value = tryCatch(fn)();
7796 }
7797 var promiseCreated = ret._popContext();
7798 debug.checkForgottenReturns(
7799 value, promiseCreated, "Promise.try", ret);
7800 ret._resolveFromSyncValue(value);
7801 return ret;
7802};
7803
7804Promise.prototype._resolveFromSyncValue = function (value) {
7805 if (value === util.errorObj) {
7806 this._rejectCallback(value.e, false);
7807 } else {
7808 this._resolveCallback(value, true);
7809 }
7810};
7811};
7812
7813},{"./util":36}],20:[function(_dereq_,module,exports){
7814"use strict";
7815var util = _dereq_("./util");
7816var maybeWrapAsError = util.maybeWrapAsError;
7817var errors = _dereq_("./errors");
7818var OperationalError = errors.OperationalError;
7819var es5 = _dereq_("./es5");
7820
7821function isUntypedError(obj) {
7822 return obj instanceof Error &&
7823 es5.getPrototypeOf(obj) === Error.prototype;
7824}
7825
7826var rErrorKey = /^(?:name|message|stack|cause)$/;
7827function wrapAsOperationalError(obj) {
7828 var ret;
7829 if (isUntypedError(obj)) {
7830 ret = new OperationalError(obj);
7831 ret.name = obj.name;
7832 ret.message = obj.message;
7833 ret.stack = obj.stack;
7834 var keys = es5.keys(obj);
7835 for (var i = 0; i < keys.length; ++i) {
7836 var key = keys[i];
7837 if (!rErrorKey.test(key)) {
7838 ret[key] = obj[key];
7839 }
7840 }
7841 return ret;
7842 }
7843 util.markAsOriginatingFromRejection(obj);
7844 return obj;
7845}
7846
7847function nodebackForPromise(promise, multiArgs) {
7848 return function(err, value) {
7849 if (promise === null) return;
7850 if (err) {
7851 var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
7852 promise._attachExtraTrace(wrapped);
7853 promise._reject(wrapped);
7854 } else if (!multiArgs) {
7855 promise._fulfill(value);
7856 } else {
7857 var args = [].slice.call(arguments, 1);;
7858 promise._fulfill(args);
7859 }
7860 promise = null;
7861 };
7862}
7863
7864module.exports = nodebackForPromise;
7865
7866},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){
7867"use strict";
7868module.exports = function(Promise) {
7869var util = _dereq_("./util");
7870var async = Promise._async;
7871var tryCatch = util.tryCatch;
7872var errorObj = util.errorObj;
7873
7874function spreadAdapter(val, nodeback) {
7875 var promise = this;
7876 if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
7877 var ret =
7878 tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
7879 if (ret === errorObj) {
7880 async.throwLater(ret.e);
7881 }
7882}
7883
7884function successAdapter(val, nodeback) {
7885 var promise = this;
7886 var receiver = promise._boundValue();
7887 var ret = val === undefined
7888 ? tryCatch(nodeback).call(receiver, null)
7889 : tryCatch(nodeback).call(receiver, null, val);
7890 if (ret === errorObj) {
7891 async.throwLater(ret.e);
7892 }
7893}
7894function errorAdapter(reason, nodeback) {
7895 var promise = this;
7896 if (!reason) {
7897 var newReason = new Error(reason + "");
7898 newReason.cause = reason;
7899 reason = newReason;
7900 }
7901 var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
7902 if (ret === errorObj) {
7903 async.throwLater(ret.e);
7904 }
7905}
7906
7907Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
7908 options) {
7909 if (typeof nodeback == "function") {
7910 var adapter = successAdapter;
7911 if (options !== undefined && Object(options).spread) {
7912 adapter = spreadAdapter;
7913 }
7914 this._then(
7915 adapter,
7916 errorAdapter,
7917 undefined,
7918 this,
7919 nodeback
7920 );
7921 }
7922 return this;
7923};
7924};
7925
7926},{"./util":36}],22:[function(_dereq_,module,exports){
7927"use strict";
7928module.exports = function() {
7929var makeSelfResolutionError = function () {
7930 return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
7931};
7932var reflectHandler = function() {
7933 return new Promise.PromiseInspection(this._target());
7934};
7935var apiRejection = function(msg) {
7936 return Promise.reject(new TypeError(msg));
7937};
7938function Proxyable() {}
7939var UNDEFINED_BINDING = {};
7940var util = _dereq_("./util");
7941
7942var getDomain;
7943if (util.isNode) {
7944 getDomain = function() {
7945 var ret = process.domain;
7946 if (ret === undefined) ret = null;
7947 return ret;
7948 };
7949} else {
7950 getDomain = function() {
7951 return null;
7952 };
7953}
7954util.notEnumerableProp(Promise, "_getDomain", getDomain);
7955
7956var es5 = _dereq_("./es5");
7957var Async = _dereq_("./async");
7958var async = new Async();
7959es5.defineProperty(Promise, "_async", {value: async});
7960var errors = _dereq_("./errors");
7961var TypeError = Promise.TypeError = errors.TypeError;
7962Promise.RangeError = errors.RangeError;
7963var CancellationError = Promise.CancellationError = errors.CancellationError;
7964Promise.TimeoutError = errors.TimeoutError;
7965Promise.OperationalError = errors.OperationalError;
7966Promise.RejectionError = errors.OperationalError;
7967Promise.AggregateError = errors.AggregateError;
7968var INTERNAL = function(){};
7969var APPLY = {};
7970var NEXT_FILTER = {};
7971var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL);
7972var PromiseArray =
7973 _dereq_("./promise_array")(Promise, INTERNAL,
7974 tryConvertToPromise, apiRejection, Proxyable);
7975var Context = _dereq_("./context")(Promise);
7976 /*jshint unused:false*/
7977var createContext = Context.create;
7978var debug = _dereq_("./debuggability")(Promise, Context);
7979var CapturedTrace = debug.CapturedTrace;
7980var PassThroughHandlerContext =
7981 _dereq_("./finally")(Promise, tryConvertToPromise);
7982var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
7983var nodebackForPromise = _dereq_("./nodeback");
7984var errorObj = util.errorObj;
7985var tryCatch = util.tryCatch;
7986function check(self, executor) {
7987 if (typeof executor !== "function") {
7988 throw new TypeError("expecting a function but got " + util.classString(executor));
7989 }
7990 if (self.constructor !== Promise) {
7991 throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
7992 }
7993}
7994
7995function Promise(executor) {
7996 this._bitField = 0;
7997 this._fulfillmentHandler0 = undefined;
7998 this._rejectionHandler0 = undefined;
7999 this._promise0 = undefined;
8000 this._receiver0 = undefined;
8001 if (executor !== INTERNAL) {
8002 check(this, executor);
8003 this._resolveFromExecutor(executor);
8004 }
8005 this._promiseCreated();
8006 this._fireEvent("promiseCreated", this);
8007}
8008
8009Promise.prototype.toString = function () {
8010 return "[object Promise]";
8011};
8012
8013Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
8014 var len = arguments.length;
8015 if (len > 1) {
8016 var catchInstances = new Array(len - 1),
8017 j = 0, i;
8018 for (i = 0; i < len - 1; ++i) {
8019 var item = arguments[i];
8020 if (util.isObject(item)) {
8021 catchInstances[j++] = item;
8022 } else {
8023 return apiRejection("expecting an object but got " +
8024 "A catch statement predicate " + util.classString(item));
8025 }
8026 }
8027 catchInstances.length = j;
8028 fn = arguments[i];
8029 return this.then(undefined, catchFilter(catchInstances, fn, this));
8030 }
8031 return this.then(undefined, fn);
8032};
8033
8034Promise.prototype.reflect = function () {
8035 return this._then(reflectHandler,
8036 reflectHandler, undefined, this, undefined);
8037};
8038
8039Promise.prototype.then = function (didFulfill, didReject) {
8040 if (debug.warnings() && arguments.length > 0 &&
8041 typeof didFulfill !== "function" &&
8042 typeof didReject !== "function") {
8043 var msg = ".then() only accepts functions but was passed: " +
8044 util.classString(didFulfill);
8045 if (arguments.length > 1) {
8046 msg += ", " + util.classString(didReject);
8047 }
8048 this._warn(msg);
8049 }
8050 return this._then(didFulfill, didReject, undefined, undefined, undefined);
8051};
8052
8053Promise.prototype.done = function (didFulfill, didReject) {
8054 var promise =
8055 this._then(didFulfill, didReject, undefined, undefined, undefined);
8056 promise._setIsFinal();
8057};
8058
8059Promise.prototype.spread = function (fn) {
8060 if (typeof fn !== "function") {
8061 return apiRejection("expecting a function but got " + util.classString(fn));
8062 }
8063 return this.all()._then(fn, undefined, undefined, APPLY, undefined);
8064};
8065
8066Promise.prototype.toJSON = function () {
8067 var ret = {
8068 isFulfilled: false,
8069 isRejected: false,
8070 fulfillmentValue: undefined,
8071 rejectionReason: undefined
8072 };
8073 if (this.isFulfilled()) {
8074 ret.fulfillmentValue = this.value();
8075 ret.isFulfilled = true;
8076 } else if (this.isRejected()) {
8077 ret.rejectionReason = this.reason();
8078 ret.isRejected = true;
8079 }
8080 return ret;
8081};
8082
8083Promise.prototype.all = function () {
8084 if (arguments.length > 0) {
8085 this._warn(".all() was passed arguments but it does not take any");
8086 }
8087 return new PromiseArray(this).promise();
8088};
8089
8090Promise.prototype.error = function (fn) {
8091 return this.caught(util.originatesFromRejection, fn);
8092};
8093
8094Promise.getNewLibraryCopy = module.exports;
8095
8096Promise.is = function (val) {
8097 return val instanceof Promise;
8098};
8099
8100Promise.fromNode = Promise.fromCallback = function(fn) {
8101 var ret = new Promise(INTERNAL);
8102 ret._captureStackTrace();
8103 var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
8104 : false;
8105 var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
8106 if (result === errorObj) {
8107 ret._rejectCallback(result.e, true);
8108 }
8109 if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
8110 return ret;
8111};
8112
8113Promise.all = function (promises) {
8114 return new PromiseArray(promises).promise();
8115};
8116
8117Promise.cast = function (obj) {
8118 var ret = tryConvertToPromise(obj);
8119 if (!(ret instanceof Promise)) {
8120 ret = new Promise(INTERNAL);
8121 ret._captureStackTrace();
8122 ret._setFulfilled();
8123 ret._rejectionHandler0 = obj;
8124 }
8125 return ret;
8126};
8127
8128Promise.resolve = Promise.fulfilled = Promise.cast;
8129
8130Promise.reject = Promise.rejected = function (reason) {
8131 var ret = new Promise(INTERNAL);
8132 ret._captureStackTrace();
8133 ret._rejectCallback(reason, true);
8134 return ret;
8135};
8136
8137Promise.setScheduler = function(fn) {
8138 if (typeof fn !== "function") {
8139 throw new TypeError("expecting a function but got " + util.classString(fn));
8140 }
8141 return async.setScheduler(fn);
8142};
8143
8144Promise.prototype._then = function (
8145 didFulfill,
8146 didReject,
8147 _, receiver,
8148 internalData
8149) {
8150 var haveInternalData = internalData !== undefined;
8151 var promise = haveInternalData ? internalData : new Promise(INTERNAL);
8152 var target = this._target();
8153 var bitField = target._bitField;
8154
8155 if (!haveInternalData) {
8156 promise._propagateFrom(this, 3);
8157 promise._captureStackTrace();
8158 if (receiver === undefined &&
8159 ((this._bitField & 2097152) !== 0)) {
8160 if (!((bitField & 50397184) === 0)) {
8161 receiver = this._boundValue();
8162 } else {
8163 receiver = target === this ? undefined : this._boundTo;
8164 }
8165 }
8166 this._fireEvent("promiseChained", this, promise);
8167 }
8168
8169 var domain = getDomain();
8170 if (!((bitField & 50397184) === 0)) {
8171 var handler, value, settler = target._settlePromiseCtx;
8172 if (((bitField & 33554432) !== 0)) {
8173 value = target._rejectionHandler0;
8174 handler = didFulfill;
8175 } else if (((bitField & 16777216) !== 0)) {
8176 value = target._fulfillmentHandler0;
8177 handler = didReject;
8178 target._unsetRejectionIsUnhandled();
8179 } else {
8180 settler = target._settlePromiseLateCancellationObserver;
8181 value = new CancellationError("late cancellation observer");
8182 target._attachExtraTrace(value);
8183 handler = didReject;
8184 }
8185
8186 async.invoke(settler, target, {
8187 handler: domain === null ? handler
8188 : (typeof handler === "function" &&
8189 util.domainBind(domain, handler)),
8190 promise: promise,
8191 receiver: receiver,
8192 value: value
8193 });
8194 } else {
8195 target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
8196 }
8197
8198 return promise;
8199};
8200
8201Promise.prototype._length = function () {
8202 return this._bitField & 65535;
8203};
8204
8205Promise.prototype._isFateSealed = function () {
8206 return (this._bitField & 117506048) !== 0;
8207};
8208
8209Promise.prototype._isFollowing = function () {
8210 return (this._bitField & 67108864) === 67108864;
8211};
8212
8213Promise.prototype._setLength = function (len) {
8214 this._bitField = (this._bitField & -65536) |
8215 (len & 65535);
8216};
8217
8218Promise.prototype._setFulfilled = function () {
8219 this._bitField = this._bitField | 33554432;
8220 this._fireEvent("promiseFulfilled", this);
8221};
8222
8223Promise.prototype._setRejected = function () {
8224 this._bitField = this._bitField | 16777216;
8225 this._fireEvent("promiseRejected", this);
8226};
8227
8228Promise.prototype._setFollowing = function () {
8229 this._bitField = this._bitField | 67108864;
8230 this._fireEvent("promiseResolved", this);
8231};
8232
8233Promise.prototype._setIsFinal = function () {
8234 this._bitField = this._bitField | 4194304;
8235};
8236
8237Promise.prototype._isFinal = function () {
8238 return (this._bitField & 4194304) > 0;
8239};
8240
8241Promise.prototype._unsetCancelled = function() {
8242 this._bitField = this._bitField & (~65536);
8243};
8244
8245Promise.prototype._setCancelled = function() {
8246 this._bitField = this._bitField | 65536;
8247 this._fireEvent("promiseCancelled", this);
8248};
8249
8250Promise.prototype._setWillBeCancelled = function() {
8251 this._bitField = this._bitField | 8388608;
8252};
8253
8254Promise.prototype._setAsyncGuaranteed = function() {
8255 if (async.hasCustomScheduler()) return;
8256 this._bitField = this._bitField | 134217728;
8257};
8258
8259Promise.prototype._receiverAt = function (index) {
8260 var ret = index === 0 ? this._receiver0 : this[
8261 index * 4 - 4 + 3];
8262 if (ret === UNDEFINED_BINDING) {
8263 return undefined;
8264 } else if (ret === undefined && this._isBound()) {
8265 return this._boundValue();
8266 }
8267 return ret;
8268};
8269
8270Promise.prototype._promiseAt = function (index) {
8271 return this[
8272 index * 4 - 4 + 2];
8273};
8274
8275Promise.prototype._fulfillmentHandlerAt = function (index) {
8276 return this[
8277 index * 4 - 4 + 0];
8278};
8279
8280Promise.prototype._rejectionHandlerAt = function (index) {
8281 return this[
8282 index * 4 - 4 + 1];
8283};
8284
8285Promise.prototype._boundValue = function() {};
8286
8287Promise.prototype._migrateCallback0 = function (follower) {
8288 var bitField = follower._bitField;
8289 var fulfill = follower._fulfillmentHandler0;
8290 var reject = follower._rejectionHandler0;
8291 var promise = follower._promise0;
8292 var receiver = follower._receiverAt(0);
8293 if (receiver === undefined) receiver = UNDEFINED_BINDING;
8294 this._addCallbacks(fulfill, reject, promise, receiver, null);
8295};
8296
8297Promise.prototype._migrateCallbackAt = function (follower, index) {
8298 var fulfill = follower._fulfillmentHandlerAt(index);
8299 var reject = follower._rejectionHandlerAt(index);
8300 var promise = follower._promiseAt(index);
8301 var receiver = follower._receiverAt(index);
8302 if (receiver === undefined) receiver = UNDEFINED_BINDING;
8303 this._addCallbacks(fulfill, reject, promise, receiver, null);
8304};
8305
8306Promise.prototype._addCallbacks = function (
8307 fulfill,
8308 reject,
8309 promise,
8310 receiver,
8311 domain
8312) {
8313 var index = this._length();
8314
8315 if (index >= 65535 - 4) {
8316 index = 0;
8317 this._setLength(0);
8318 }
8319
8320 if (index === 0) {
8321 this._promise0 = promise;
8322 this._receiver0 = receiver;
8323 if (typeof fulfill === "function") {
8324 this._fulfillmentHandler0 =
8325 domain === null ? fulfill : util.domainBind(domain, fulfill);
8326 }
8327 if (typeof reject === "function") {
8328 this._rejectionHandler0 =
8329 domain === null ? reject : util.domainBind(domain, reject);
8330 }
8331 } else {
8332 var base = index * 4 - 4;
8333 this[base + 2] = promise;
8334 this[base + 3] = receiver;
8335 if (typeof fulfill === "function") {
8336 this[base + 0] =
8337 domain === null ? fulfill : util.domainBind(domain, fulfill);
8338 }
8339 if (typeof reject === "function") {
8340 this[base + 1] =
8341 domain === null ? reject : util.domainBind(domain, reject);
8342 }
8343 }
8344 this._setLength(index + 1);
8345 return index;
8346};
8347
8348Promise.prototype._proxy = function (proxyable, arg) {
8349 this._addCallbacks(undefined, undefined, arg, proxyable, null);
8350};
8351
8352Promise.prototype._resolveCallback = function(value, shouldBind) {
8353 if (((this._bitField & 117506048) !== 0)) return;
8354 if (value === this)
8355 return this._rejectCallback(makeSelfResolutionError(), false);
8356 var maybePromise = tryConvertToPromise(value, this);
8357 if (!(maybePromise instanceof Promise)) return this._fulfill(value);
8358
8359 if (shouldBind) this._propagateFrom(maybePromise, 2);
8360
8361 var promise = maybePromise._target();
8362
8363 if (promise === this) {
8364 this._reject(makeSelfResolutionError());
8365 return;
8366 }
8367
8368 var bitField = promise._bitField;
8369 if (((bitField & 50397184) === 0)) {
8370 var len = this._length();
8371 if (len > 0) promise._migrateCallback0(this);
8372 for (var i = 1; i < len; ++i) {
8373 promise._migrateCallbackAt(this, i);
8374 }
8375 this._setFollowing();
8376 this._setLength(0);
8377 this._setFollowee(promise);
8378 } else if (((bitField & 33554432) !== 0)) {
8379 this._fulfill(promise._value());
8380 } else if (((bitField & 16777216) !== 0)) {
8381 this._reject(promise._reason());
8382 } else {
8383 var reason = new CancellationError("late cancellation observer");
8384 promise._attachExtraTrace(reason);
8385 this._reject(reason);
8386 }
8387};
8388
8389Promise.prototype._rejectCallback =
8390function(reason, synchronous, ignoreNonErrorWarnings) {
8391 var trace = util.ensureErrorObject(reason);
8392 var hasStack = trace === reason;
8393 if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
8394 var message = "a promise was rejected with a non-error: " +
8395 util.classString(reason);
8396 this._warn(message, true);
8397 }
8398 this._attachExtraTrace(trace, synchronous ? hasStack : false);
8399 this._reject(reason);
8400};
8401
8402Promise.prototype._resolveFromExecutor = function (executor) {
8403 var promise = this;
8404 this._captureStackTrace();
8405 this._pushContext();
8406 var synchronous = true;
8407 var r = this._execute(executor, function(value) {
8408 promise._resolveCallback(value);
8409 }, function (reason) {
8410 promise._rejectCallback(reason, synchronous);
8411 });
8412 synchronous = false;
8413 this._popContext();
8414
8415 if (r !== undefined) {
8416 promise._rejectCallback(r, true);
8417 }
8418};
8419
8420Promise.prototype._settlePromiseFromHandler = function (
8421 handler, receiver, value, promise
8422) {
8423 var bitField = promise._bitField;
8424 if (((bitField & 65536) !== 0)) return;
8425 promise._pushContext();
8426 var x;
8427 if (receiver === APPLY) {
8428 if (!value || typeof value.length !== "number") {
8429 x = errorObj;
8430 x.e = new TypeError("cannot .spread() a non-array: " +
8431 util.classString(value));
8432 } else {
8433 x = tryCatch(handler).apply(this._boundValue(), value);
8434 }
8435 } else {
8436 x = tryCatch(handler).call(receiver, value);
8437 }
8438 var promiseCreated = promise._popContext();
8439 bitField = promise._bitField;
8440 if (((bitField & 65536) !== 0)) return;
8441
8442 if (x === NEXT_FILTER) {
8443 promise._reject(value);
8444 } else if (x === errorObj) {
8445 promise._rejectCallback(x.e, false);
8446 } else {
8447 debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
8448 promise._resolveCallback(x);
8449 }
8450};
8451
8452Promise.prototype._target = function() {
8453 var ret = this;
8454 while (ret._isFollowing()) ret = ret._followee();
8455 return ret;
8456};
8457
8458Promise.prototype._followee = function() {
8459 return this._rejectionHandler0;
8460};
8461
8462Promise.prototype._setFollowee = function(promise) {
8463 this._rejectionHandler0 = promise;
8464};
8465
8466Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
8467 var isPromise = promise instanceof Promise;
8468 var bitField = this._bitField;
8469 var asyncGuaranteed = ((bitField & 134217728) !== 0);
8470 if (((bitField & 65536) !== 0)) {
8471 if (isPromise) promise._invokeInternalOnCancel();
8472
8473 if (receiver instanceof PassThroughHandlerContext &&
8474 receiver.isFinallyHandler()) {
8475 receiver.cancelPromise = promise;
8476 if (tryCatch(handler).call(receiver, value) === errorObj) {
8477 promise._reject(errorObj.e);
8478 }
8479 } else if (handler === reflectHandler) {
8480 promise._fulfill(reflectHandler.call(receiver));
8481 } else if (receiver instanceof Proxyable) {
8482 receiver._promiseCancelled(promise);
8483 } else if (isPromise || promise instanceof PromiseArray) {
8484 promise._cancel();
8485 } else {
8486 receiver.cancel();
8487 }
8488 } else if (typeof handler === "function") {
8489 if (!isPromise) {
8490 handler.call(receiver, value, promise);
8491 } else {
8492 if (asyncGuaranteed) promise._setAsyncGuaranteed();
8493 this._settlePromiseFromHandler(handler, receiver, value, promise);
8494 }
8495 } else if (receiver instanceof Proxyable) {
8496 if (!receiver._isResolved()) {
8497 if (((bitField & 33554432) !== 0)) {
8498 receiver._promiseFulfilled(value, promise);
8499 } else {
8500 receiver._promiseRejected(value, promise);
8501 }
8502 }
8503 } else if (isPromise) {
8504 if (asyncGuaranteed) promise._setAsyncGuaranteed();
8505 if (((bitField & 33554432) !== 0)) {
8506 promise._fulfill(value);
8507 } else {
8508 promise._reject(value);
8509 }
8510 }
8511};
8512
8513Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
8514 var handler = ctx.handler;
8515 var promise = ctx.promise;
8516 var receiver = ctx.receiver;
8517 var value = ctx.value;
8518 if (typeof handler === "function") {
8519 if (!(promise instanceof Promise)) {
8520 handler.call(receiver, value, promise);
8521 } else {
8522 this._settlePromiseFromHandler(handler, receiver, value, promise);
8523 }
8524 } else if (promise instanceof Promise) {
8525 promise._reject(value);
8526 }
8527};
8528
8529Promise.prototype._settlePromiseCtx = function(ctx) {
8530 this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
8531};
8532
8533Promise.prototype._settlePromise0 = function(handler, value, bitField) {
8534 var promise = this._promise0;
8535 var receiver = this._receiverAt(0);
8536 this._promise0 = undefined;
8537 this._receiver0 = undefined;
8538 this._settlePromise(promise, handler, receiver, value);
8539};
8540
8541Promise.prototype._clearCallbackDataAtIndex = function(index) {
8542 var base = index * 4 - 4;
8543 this[base + 2] =
8544 this[base + 3] =
8545 this[base + 0] =
8546 this[base + 1] = undefined;
8547};
8548
8549Promise.prototype._fulfill = function (value) {
8550 var bitField = this._bitField;
8551 if (((bitField & 117506048) >>> 16)) return;
8552 if (value === this) {
8553 var err = makeSelfResolutionError();
8554 this._attachExtraTrace(err);
8555 return this._reject(err);
8556 }
8557 this._setFulfilled();
8558 this._rejectionHandler0 = value;
8559
8560 if ((bitField & 65535) > 0) {
8561 if (((bitField & 134217728) !== 0)) {
8562 this._settlePromises();
8563 } else {
8564 async.settlePromises(this);
8565 }
8566 }
8567};
8568
8569Promise.prototype._reject = function (reason) {
8570 var bitField = this._bitField;
8571 if (((bitField & 117506048) >>> 16)) return;
8572 this._setRejected();
8573 this._fulfillmentHandler0 = reason;
8574
8575 if (this._isFinal()) {
8576 return async.fatalError(reason, util.isNode);
8577 }
8578
8579 if ((bitField & 65535) > 0) {
8580 async.settlePromises(this);
8581 } else {
8582 this._ensurePossibleRejectionHandled();
8583 }
8584};
8585
8586Promise.prototype._fulfillPromises = function (len, value) {
8587 for (var i = 1; i < len; i++) {
8588 var handler = this._fulfillmentHandlerAt(i);
8589 var promise = this._promiseAt(i);
8590 var receiver = this._receiverAt(i);
8591 this._clearCallbackDataAtIndex(i);
8592 this._settlePromise(promise, handler, receiver, value);
8593 }
8594};
8595
8596Promise.prototype._rejectPromises = function (len, reason) {
8597 for (var i = 1; i < len; i++) {
8598 var handler = this._rejectionHandlerAt(i);
8599 var promise = this._promiseAt(i);
8600 var receiver = this._receiverAt(i);
8601 this._clearCallbackDataAtIndex(i);
8602 this._settlePromise(promise, handler, receiver, reason);
8603 }
8604};
8605
8606Promise.prototype._settlePromises = function () {
8607 var bitField = this._bitField;
8608 var len = (bitField & 65535);
8609
8610 if (len > 0) {
8611 if (((bitField & 16842752) !== 0)) {
8612 var reason = this._fulfillmentHandler0;
8613 this._settlePromise0(this._rejectionHandler0, reason, bitField);
8614 this._rejectPromises(len, reason);
8615 } else {
8616 var value = this._rejectionHandler0;
8617 this._settlePromise0(this._fulfillmentHandler0, value, bitField);
8618 this._fulfillPromises(len, value);
8619 }
8620 this._setLength(0);
8621 }
8622 this._clearCancellationData();
8623};
8624
8625Promise.prototype._settledValue = function() {
8626 var bitField = this._bitField;
8627 if (((bitField & 33554432) !== 0)) {
8628 return this._rejectionHandler0;
8629 } else if (((bitField & 16777216) !== 0)) {
8630 return this._fulfillmentHandler0;
8631 }
8632};
8633
8634function deferResolve(v) {this.promise._resolveCallback(v);}
8635function deferReject(v) {this.promise._rejectCallback(v, false);}
8636
8637Promise.defer = Promise.pending = function() {
8638 debug.deprecated("Promise.defer", "new Promise");
8639 var promise = new Promise(INTERNAL);
8640 return {
8641 promise: promise,
8642 resolve: deferResolve,
8643 reject: deferReject
8644 };
8645};
8646
8647util.notEnumerableProp(Promise,
8648 "_makeSelfResolutionError",
8649 makeSelfResolutionError);
8650
8651_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
8652 debug);
8653_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
8654_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
8655_dereq_("./direct_resolve")(Promise);
8656_dereq_("./synchronous_inspection")(Promise);
8657_dereq_("./join")(
8658 Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
8659Promise.Promise = Promise;
8660Promise.version = "3.4.7";
8661_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
8662_dereq_('./call_get.js')(Promise);
8663_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
8664_dereq_('./timers.js')(Promise, INTERNAL, debug);
8665_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
8666_dereq_('./nodeify.js')(Promise);
8667_dereq_('./promisify.js')(Promise, INTERNAL);
8668_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
8669_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
8670_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
8671_dereq_('./settle.js')(Promise, PromiseArray, debug);
8672_dereq_('./some.js')(Promise, PromiseArray, apiRejection);
8673_dereq_('./filter.js')(Promise, INTERNAL);
8674_dereq_('./each.js')(Promise, INTERNAL);
8675_dereq_('./any.js')(Promise);
8676
8677 util.toFastProperties(Promise);
8678 util.toFastProperties(Promise.prototype);
8679 function fillTypes(value) {
8680 var p = new Promise(INTERNAL);
8681 p._fulfillmentHandler0 = value;
8682 p._rejectionHandler0 = value;
8683 p._promise0 = value;
8684 p._receiver0 = value;
8685 }
8686 // Complete slack tracking, opt out of field-type tracking and
8687 // stabilize map
8688 fillTypes({a: 1});
8689 fillTypes({b: 2});
8690 fillTypes({c: 3});
8691 fillTypes(1);
8692 fillTypes(function(){});
8693 fillTypes(undefined);
8694 fillTypes(false);
8695 fillTypes(new Promise(INTERNAL));
8696 debug.setBounds(Async.firstLineError, util.lastLineError);
8697 return Promise;
8698
8699};
8700
8701},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){
8702"use strict";
8703module.exports = function(Promise, INTERNAL, tryConvertToPromise,
8704 apiRejection, Proxyable) {
8705var util = _dereq_("./util");
8706var isArray = util.isArray;
8707
8708function toResolutionValue(val) {
8709 switch(val) {
8710 case -2: return [];
8711 case -3: return {};
8712 }
8713}
8714
8715function PromiseArray(values) {
8716 var promise = this._promise = new Promise(INTERNAL);
8717 if (values instanceof Promise) {
8718 promise._propagateFrom(values, 3);
8719 }
8720 promise._setOnCancel(this);
8721 this._values = values;
8722 this._length = 0;
8723 this._totalResolved = 0;
8724 this._init(undefined, -2);
8725}
8726util.inherits(PromiseArray, Proxyable);
8727
8728PromiseArray.prototype.length = function () {
8729 return this._length;
8730};
8731
8732PromiseArray.prototype.promise = function () {
8733 return this._promise;
8734};
8735
8736PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
8737 var values = tryConvertToPromise(this._values, this._promise);
8738 if (values instanceof Promise) {
8739 values = values._target();
8740 var bitField = values._bitField;
8741 ;
8742 this._values = values;
8743
8744 if (((bitField & 50397184) === 0)) {
8745 this._promise._setAsyncGuaranteed();
8746 return values._then(
8747 init,
8748 this._reject,
8749 undefined,
8750 this,
8751 resolveValueIfEmpty
8752 );
8753 } else if (((bitField & 33554432) !== 0)) {
8754 values = values._value();
8755 } else if (((bitField & 16777216) !== 0)) {
8756 return this._reject(values._reason());
8757 } else {
8758 return this._cancel();
8759 }
8760 }
8761 values = util.asArray(values);
8762 if (values === null) {
8763 var err = apiRejection(
8764 "expecting an array or an iterable object but got " + util.classString(values)).reason();
8765 this._promise._rejectCallback(err, false);
8766 return;
8767 }
8768
8769 if (values.length === 0) {
8770 if (resolveValueIfEmpty === -5) {
8771 this._resolveEmptyArray();
8772 }
8773 else {
8774 this._resolve(toResolutionValue(resolveValueIfEmpty));
8775 }
8776 return;
8777 }
8778 this._iterate(values);
8779};
8780
8781PromiseArray.prototype._iterate = function(values) {
8782 var len = this.getActualLength(values.length);
8783 this._length = len;
8784 this._values = this.shouldCopyValues() ? new Array(len) : this._values;
8785 var result = this._promise;
8786 var isResolved = false;
8787 var bitField = null;
8788 for (var i = 0; i < len; ++i) {
8789 var maybePromise = tryConvertToPromise(values[i], result);
8790
8791 if (maybePromise instanceof Promise) {
8792 maybePromise = maybePromise._target();
8793 bitField = maybePromise._bitField;
8794 } else {
8795 bitField = null;
8796 }
8797
8798 if (isResolved) {
8799 if (bitField !== null) {
8800 maybePromise.suppressUnhandledRejections();
8801 }
8802 } else if (bitField !== null) {
8803 if (((bitField & 50397184) === 0)) {
8804 maybePromise._proxy(this, i);
8805 this._values[i] = maybePromise;
8806 } else if (((bitField & 33554432) !== 0)) {
8807 isResolved = this._promiseFulfilled(maybePromise._value(), i);
8808 } else if (((bitField & 16777216) !== 0)) {
8809 isResolved = this._promiseRejected(maybePromise._reason(), i);
8810 } else {
8811 isResolved = this._promiseCancelled(i);
8812 }
8813 } else {
8814 isResolved = this._promiseFulfilled(maybePromise, i);
8815 }
8816 }
8817 if (!isResolved) result._setAsyncGuaranteed();
8818};
8819
8820PromiseArray.prototype._isResolved = function () {
8821 return this._values === null;
8822};
8823
8824PromiseArray.prototype._resolve = function (value) {
8825 this._values = null;
8826 this._promise._fulfill(value);
8827};
8828
8829PromiseArray.prototype._cancel = function() {
8830 if (this._isResolved() || !this._promise._isCancellable()) return;
8831 this._values = null;
8832 this._promise._cancel();
8833};
8834
8835PromiseArray.prototype._reject = function (reason) {
8836 this._values = null;
8837 this._promise._rejectCallback(reason, false);
8838};
8839
8840PromiseArray.prototype._promiseFulfilled = function (value, index) {
8841 this._values[index] = value;
8842 var totalResolved = ++this._totalResolved;
8843 if (totalResolved >= this._length) {
8844 this._resolve(this._values);
8845 return true;
8846 }
8847 return false;
8848};
8849
8850PromiseArray.prototype._promiseCancelled = function() {
8851 this._cancel();
8852 return true;
8853};
8854
8855PromiseArray.prototype._promiseRejected = function (reason) {
8856 this._totalResolved++;
8857 this._reject(reason);
8858 return true;
8859};
8860
8861PromiseArray.prototype._resultCancelled = function() {
8862 if (this._isResolved()) return;
8863 var values = this._values;
8864 this._cancel();
8865 if (values instanceof Promise) {
8866 values.cancel();
8867 } else {
8868 for (var i = 0; i < values.length; ++i) {
8869 if (values[i] instanceof Promise) {
8870 values[i].cancel();
8871 }
8872 }
8873 }
8874};
8875
8876PromiseArray.prototype.shouldCopyValues = function () {
8877 return true;
8878};
8879
8880PromiseArray.prototype.getActualLength = function (len) {
8881 return len;
8882};
8883
8884return PromiseArray;
8885};
8886
8887},{"./util":36}],24:[function(_dereq_,module,exports){
8888"use strict";
8889module.exports = function(Promise, INTERNAL) {
8890var THIS = {};
8891var util = _dereq_("./util");
8892var nodebackForPromise = _dereq_("./nodeback");
8893var withAppended = util.withAppended;
8894var maybeWrapAsError = util.maybeWrapAsError;
8895var canEvaluate = util.canEvaluate;
8896var TypeError = _dereq_("./errors").TypeError;
8897var defaultSuffix = "Async";
8898var defaultPromisified = {__isPromisified__: true};
8899var noCopyProps = [
8900 "arity", "length",
8901 "name",
8902 "arguments",
8903 "caller",
8904 "callee",
8905 "prototype",
8906 "__isPromisified__"
8907];
8908var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
8909
8910var defaultFilter = function(name) {
8911 return util.isIdentifier(name) &&
8912 name.charAt(0) !== "_" &&
8913 name !== "constructor";
8914};
8915
8916function propsFilter(key) {
8917 return !noCopyPropsPattern.test(key);
8918}
8919
8920function isPromisified(fn) {
8921 try {
8922 return fn.__isPromisified__ === true;
8923 }
8924 catch (e) {
8925 return false;
8926 }
8927}
8928
8929function hasPromisified(obj, key, suffix) {
8930 var val = util.getDataPropertyOrDefault(obj, key + suffix,
8931 defaultPromisified);
8932 return val ? isPromisified(val) : false;
8933}
8934function checkValid(ret, suffix, suffixRegexp) {
8935 for (var i = 0; i < ret.length; i += 2) {
8936 var key = ret[i];
8937 if (suffixRegexp.test(key)) {
8938 var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
8939 for (var j = 0; j < ret.length; j += 2) {
8940 if (ret[j] === keyWithoutAsyncSuffix) {
8941 throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
8942 .replace("%s", suffix));
8943 }
8944 }
8945 }
8946 }
8947}
8948
8949function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
8950 var keys = util.inheritedDataKeys(obj);
8951 var ret = [];
8952 for (var i = 0; i < keys.length; ++i) {
8953 var key = keys[i];
8954 var value = obj[key];
8955 var passesDefaultFilter = filter === defaultFilter
8956 ? true : defaultFilter(key, value, obj);
8957 if (typeof value === "function" &&
8958 !isPromisified(value) &&
8959 !hasPromisified(obj, key, suffix) &&
8960 filter(key, value, obj, passesDefaultFilter)) {
8961 ret.push(key, value);
8962 }
8963 }
8964 checkValid(ret, suffix, suffixRegexp);
8965 return ret;
8966}
8967
8968var escapeIdentRegex = function(str) {
8969 return str.replace(/([$])/, "\\$");
8970};
8971
8972var makeNodePromisifiedEval;
8973if (false) {
8974var switchCaseArgumentOrder = function(likelyArgumentCount) {
8975 var ret = [likelyArgumentCount];
8976 var min = Math.max(0, likelyArgumentCount - 1 - 3);
8977 for(var i = likelyArgumentCount - 1; i >= min; --i) {
8978 ret.push(i);
8979 }
8980 for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
8981 ret.push(i);
8982 }
8983 return ret;
8984};
8985
8986var argumentSequence = function(argumentCount) {
8987 return util.filledRange(argumentCount, "_arg", "");
8988};
8989
8990var parameterDeclaration = function(parameterCount) {
8991 return util.filledRange(
8992 Math.max(parameterCount, 3), "_arg", "");
8993};
8994
8995var parameterCount = function(fn) {
8996 if (typeof fn.length === "number") {
8997 return Math.max(Math.min(fn.length, 1023 + 1), 0);
8998 }
8999 return 0;
9000};
9001
9002makeNodePromisifiedEval =
9003function(callback, receiver, originalName, fn, _, multiArgs) {
9004 var newParameterCount = Math.max(0, parameterCount(fn) - 1);
9005 var argumentOrder = switchCaseArgumentOrder(newParameterCount);
9006 var shouldProxyThis = typeof callback === "string" || receiver === THIS;
9007
9008 function generateCallForArgumentCount(count) {
9009 var args = argumentSequence(count).join(", ");
9010 var comma = count > 0 ? ", " : "";
9011 var ret;
9012 if (shouldProxyThis) {
9013 ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
9014 } else {
9015 ret = receiver === undefined
9016 ? "ret = callback({{args}}, nodeback); break;\n"
9017 : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
9018 }
9019 return ret.replace("{{args}}", args).replace(", ", comma);
9020 }
9021
9022 function generateArgumentSwitchCase() {
9023 var ret = "";
9024 for (var i = 0; i < argumentOrder.length; ++i) {
9025 ret += "case " + argumentOrder[i] +":" +
9026 generateCallForArgumentCount(argumentOrder[i]);
9027 }
9028
9029 ret += " \n\
9030 default: \n\
9031 var args = new Array(len + 1); \n\
9032 var i = 0; \n\
9033 for (var i = 0; i < len; ++i) { \n\
9034 args[i] = arguments[i]; \n\
9035 } \n\
9036 args[i] = nodeback; \n\
9037 [CodeForCall] \n\
9038 break; \n\
9039 ".replace("[CodeForCall]", (shouldProxyThis
9040 ? "ret = callback.apply(this, args);\n"
9041 : "ret = callback.apply(receiver, args);\n"));
9042 return ret;
9043 }
9044
9045 var getFunctionCode = typeof callback === "string"
9046 ? ("this != null ? this['"+callback+"'] : fn")
9047 : "fn";
9048 var body = "'use strict'; \n\
9049 var ret = function (Parameters) { \n\
9050 'use strict'; \n\
9051 var len = arguments.length; \n\
9052 var promise = new Promise(INTERNAL); \n\
9053 promise._captureStackTrace(); \n\
9054 var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
9055 var ret; \n\
9056 var callback = tryCatch([GetFunctionCode]); \n\
9057 switch(len) { \n\
9058 [CodeForSwitchCase] \n\
9059 } \n\
9060 if (ret === errorObj) { \n\
9061 promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
9062 } \n\
9063 if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
9064 return promise; \n\
9065 }; \n\
9066 notEnumerableProp(ret, '__isPromisified__', true); \n\
9067 return ret; \n\
9068 ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
9069 .replace("[GetFunctionCode]", getFunctionCode);
9070 body = body.replace("Parameters", parameterDeclaration(newParameterCount));
9071 return new Function("Promise",
9072 "fn",
9073 "receiver",
9074 "withAppended",
9075 "maybeWrapAsError",
9076 "nodebackForPromise",
9077 "tryCatch",
9078 "errorObj",
9079 "notEnumerableProp",
9080 "INTERNAL",
9081 body)(
9082 Promise,
9083 fn,
9084 receiver,
9085 withAppended,
9086 maybeWrapAsError,
9087 nodebackForPromise,
9088 util.tryCatch,
9089 util.errorObj,
9090 util.notEnumerableProp,
9091 INTERNAL);
9092};
9093}
9094
9095function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
9096 var defaultThis = (function() {return this;})();
9097 var method = callback;
9098 if (typeof method === "string") {
9099 callback = fn;
9100 }
9101 function promisified() {
9102 var _receiver = receiver;
9103 if (receiver === THIS) _receiver = this;
9104 var promise = new Promise(INTERNAL);
9105 promise._captureStackTrace();
9106 var cb = typeof method === "string" && this !== defaultThis
9107 ? this[method] : callback;
9108 var fn = nodebackForPromise(promise, multiArgs);
9109 try {
9110 cb.apply(_receiver, withAppended(arguments, fn));
9111 } catch(e) {
9112 promise._rejectCallback(maybeWrapAsError(e), true, true);
9113 }
9114 if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
9115 return promise;
9116 }
9117 util.notEnumerableProp(promisified, "__isPromisified__", true);
9118 return promisified;
9119}
9120
9121var makeNodePromisified = canEvaluate
9122 ? makeNodePromisifiedEval
9123 : makeNodePromisifiedClosure;
9124
9125function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
9126 var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
9127 var methods =
9128 promisifiableMethods(obj, suffix, suffixRegexp, filter);
9129
9130 for (var i = 0, len = methods.length; i < len; i+= 2) {
9131 var key = methods[i];
9132 var fn = methods[i+1];
9133 var promisifiedKey = key + suffix;
9134 if (promisifier === makeNodePromisified) {
9135 obj[promisifiedKey] =
9136 makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
9137 } else {
9138 var promisified = promisifier(fn, function() {
9139 return makeNodePromisified(key, THIS, key,
9140 fn, suffix, multiArgs);
9141 });
9142 util.notEnumerableProp(promisified, "__isPromisified__", true);
9143 obj[promisifiedKey] = promisified;
9144 }
9145 }
9146 util.toFastProperties(obj);
9147 return obj;
9148}
9149
9150function promisify(callback, receiver, multiArgs) {
9151 return makeNodePromisified(callback, receiver, undefined,
9152 callback, null, multiArgs);
9153}
9154
9155Promise.promisify = function (fn, options) {
9156 if (typeof fn !== "function") {
9157 throw new TypeError("expecting a function but got " + util.classString(fn));
9158 }
9159 if (isPromisified(fn)) {
9160 return fn;
9161 }
9162 options = Object(options);
9163 var receiver = options.context === undefined ? THIS : options.context;
9164 var multiArgs = !!options.multiArgs;
9165 var ret = promisify(fn, receiver, multiArgs);
9166 util.copyDescriptors(fn, ret, propsFilter);
9167 return ret;
9168};
9169
9170Promise.promisifyAll = function (target, options) {
9171 if (typeof target !== "function" && typeof target !== "object") {
9172 throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9173 }
9174 options = Object(options);
9175 var multiArgs = !!options.multiArgs;
9176 var suffix = options.suffix;
9177 if (typeof suffix !== "string") suffix = defaultSuffix;
9178 var filter = options.filter;
9179 if (typeof filter !== "function") filter = defaultFilter;
9180 var promisifier = options.promisifier;
9181 if (typeof promisifier !== "function") promisifier = makeNodePromisified;
9182
9183 if (!util.isIdentifier(suffix)) {
9184 throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9185 }
9186
9187 var keys = util.inheritedDataKeys(target);
9188 for (var i = 0; i < keys.length; ++i) {
9189 var value = target[keys[i]];
9190 if (keys[i] !== "constructor" &&
9191 util.isClass(value)) {
9192 promisifyAll(value.prototype, suffix, filter, promisifier,
9193 multiArgs);
9194 promisifyAll(value, suffix, filter, promisifier, multiArgs);
9195 }
9196 }
9197
9198 return promisifyAll(target, suffix, filter, promisifier, multiArgs);
9199};
9200};
9201
9202
9203},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){
9204"use strict";
9205module.exports = function(
9206 Promise, PromiseArray, tryConvertToPromise, apiRejection) {
9207var util = _dereq_("./util");
9208var isObject = util.isObject;
9209var es5 = _dereq_("./es5");
9210var Es6Map;
9211if (typeof Map === "function") Es6Map = Map;
9212
9213var mapToEntries = (function() {
9214 var index = 0;
9215 var size = 0;
9216
9217 function extractEntry(value, key) {
9218 this[index] = value;
9219 this[index + size] = key;
9220 index++;
9221 }
9222
9223 return function mapToEntries(map) {
9224 size = map.size;
9225 index = 0;
9226 var ret = new Array(map.size * 2);
9227 map.forEach(extractEntry, ret);
9228 return ret;
9229 };
9230})();
9231
9232var entriesToMap = function(entries) {
9233 var ret = new Es6Map();
9234 var length = entries.length / 2 | 0;
9235 for (var i = 0; i < length; ++i) {
9236 var key = entries[length + i];
9237 var value = entries[i];
9238 ret.set(key, value);
9239 }
9240 return ret;
9241};
9242
9243function PropertiesPromiseArray(obj) {
9244 var isMap = false;
9245 var entries;
9246 if (Es6Map !== undefined && obj instanceof Es6Map) {
9247 entries = mapToEntries(obj);
9248 isMap = true;
9249 } else {
9250 var keys = es5.keys(obj);
9251 var len = keys.length;
9252 entries = new Array(len * 2);
9253 for (var i = 0; i < len; ++i) {
9254 var key = keys[i];
9255 entries[i] = obj[key];
9256 entries[i + len] = key;
9257 }
9258 }
9259 this.constructor$(entries);
9260 this._isMap = isMap;
9261 this._init$(undefined, -3);
9262}
9263util.inherits(PropertiesPromiseArray, PromiseArray);
9264
9265PropertiesPromiseArray.prototype._init = function () {};
9266
9267PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
9268 this._values[index] = value;
9269 var totalResolved = ++this._totalResolved;
9270 if (totalResolved >= this._length) {
9271 var val;
9272 if (this._isMap) {
9273 val = entriesToMap(this._values);
9274 } else {
9275 val = {};
9276 var keyOffset = this.length();
9277 for (var i = 0, len = this.length(); i < len; ++i) {
9278 val[this._values[i + keyOffset]] = this._values[i];
9279 }
9280 }
9281 this._resolve(val);
9282 return true;
9283 }
9284 return false;
9285};
9286
9287PropertiesPromiseArray.prototype.shouldCopyValues = function () {
9288 return false;
9289};
9290
9291PropertiesPromiseArray.prototype.getActualLength = function (len) {
9292 return len >> 1;
9293};
9294
9295function props(promises) {
9296 var ret;
9297 var castValue = tryConvertToPromise(promises);
9298
9299 if (!isObject(castValue)) {
9300 return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9301 } else if (castValue instanceof Promise) {
9302 ret = castValue._then(
9303 Promise.props, undefined, undefined, undefined, undefined);
9304 } else {
9305 ret = new PropertiesPromiseArray(castValue).promise();
9306 }
9307
9308 if (castValue instanceof Promise) {
9309 ret._propagateFrom(castValue, 2);
9310 }
9311 return ret;
9312}
9313
9314Promise.prototype.props = function () {
9315 return props(this);
9316};
9317
9318Promise.props = function (promises) {
9319 return props(promises);
9320};
9321};
9322
9323},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){
9324"use strict";
9325function arrayMove(src, srcIndex, dst, dstIndex, len) {
9326 for (var j = 0; j < len; ++j) {
9327 dst[j + dstIndex] = src[j + srcIndex];
9328 src[j + srcIndex] = void 0;
9329 }
9330}
9331
9332function Queue(capacity) {
9333 this._capacity = capacity;
9334 this._length = 0;
9335 this._front = 0;
9336}
9337
9338Queue.prototype._willBeOverCapacity = function (size) {
9339 return this._capacity < size;
9340};
9341
9342Queue.prototype._pushOne = function (arg) {
9343 var length = this.length();
9344 this._checkCapacity(length + 1);
9345 var i = (this._front + length) & (this._capacity - 1);
9346 this[i] = arg;
9347 this._length = length + 1;
9348};
9349
9350Queue.prototype.push = function (fn, receiver, arg) {
9351 var length = this.length() + 3;
9352 if (this._willBeOverCapacity(length)) {
9353 this._pushOne(fn);
9354 this._pushOne(receiver);
9355 this._pushOne(arg);
9356 return;
9357 }
9358 var j = this._front + length - 3;
9359 this._checkCapacity(length);
9360 var wrapMask = this._capacity - 1;
9361 this[(j + 0) & wrapMask] = fn;
9362 this[(j + 1) & wrapMask] = receiver;
9363 this[(j + 2) & wrapMask] = arg;
9364 this._length = length;
9365};
9366
9367Queue.prototype.shift = function () {
9368 var front = this._front,
9369 ret = this[front];
9370
9371 this[front] = undefined;
9372 this._front = (front + 1) & (this._capacity - 1);
9373 this._length--;
9374 return ret;
9375};
9376
9377Queue.prototype.length = function () {
9378 return this._length;
9379};
9380
9381Queue.prototype._checkCapacity = function (size) {
9382 if (this._capacity < size) {
9383 this._resizeTo(this._capacity << 1);
9384 }
9385};
9386
9387Queue.prototype._resizeTo = function (capacity) {
9388 var oldCapacity = this._capacity;
9389 this._capacity = capacity;
9390 var front = this._front;
9391 var length = this._length;
9392 var moveItemsCount = (front + length) & (oldCapacity - 1);
9393 arrayMove(this, 0, this, oldCapacity, moveItemsCount);
9394};
9395
9396module.exports = Queue;
9397
9398},{}],27:[function(_dereq_,module,exports){
9399"use strict";
9400module.exports = function(
9401 Promise, INTERNAL, tryConvertToPromise, apiRejection) {
9402var util = _dereq_("./util");
9403
9404var raceLater = function (promise) {
9405 return promise.then(function(array) {
9406 return race(array, promise);
9407 });
9408};
9409
9410function race(promises, parent) {
9411 var maybePromise = tryConvertToPromise(promises);
9412
9413 if (maybePromise instanceof Promise) {
9414 return raceLater(maybePromise);
9415 } else {
9416 promises = util.asArray(promises);
9417 if (promises === null)
9418 return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
9419 }
9420
9421 var ret = new Promise(INTERNAL);
9422 if (parent !== undefined) {
9423 ret._propagateFrom(parent, 3);
9424 }
9425 var fulfill = ret._fulfill;
9426 var reject = ret._reject;
9427 for (var i = 0, len = promises.length; i < len; ++i) {
9428 var val = promises[i];
9429
9430 if (val === undefined && !(i in promises)) {
9431 continue;
9432 }
9433
9434 Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
9435 }
9436 return ret;
9437}
9438
9439Promise.race = function (promises) {
9440 return race(promises, undefined);
9441};
9442
9443Promise.prototype.race = function () {
9444 return race(this, undefined);
9445};
9446
9447};
9448
9449},{"./util":36}],28:[function(_dereq_,module,exports){
9450"use strict";
9451module.exports = function(Promise,
9452 PromiseArray,
9453 apiRejection,
9454 tryConvertToPromise,
9455 INTERNAL,
9456 debug) {
9457var getDomain = Promise._getDomain;
9458var util = _dereq_("./util");
9459var tryCatch = util.tryCatch;
9460
9461function ReductionPromiseArray(promises, fn, initialValue, _each) {
9462 this.constructor$(promises);
9463 var domain = getDomain();
9464 this._fn = domain === null ? fn : util.domainBind(domain, fn);
9465 if (initialValue !== undefined) {
9466 initialValue = Promise.resolve(initialValue);
9467 initialValue._attachCancellationCallback(this);
9468 }
9469 this._initialValue = initialValue;
9470 this._currentCancellable = null;
9471 if(_each === INTERNAL) {
9472 this._eachValues = Array(this._length);
9473 } else if (_each === 0) {
9474 this._eachValues = null;
9475 } else {
9476 this._eachValues = undefined;
9477 }
9478 this._promise._captureStackTrace();
9479 this._init$(undefined, -5);
9480}
9481util.inherits(ReductionPromiseArray, PromiseArray);
9482
9483ReductionPromiseArray.prototype._gotAccum = function(accum) {
9484 if (this._eachValues !== undefined &&
9485 this._eachValues !== null &&
9486 accum !== INTERNAL) {
9487 this._eachValues.push(accum);
9488 }
9489};
9490
9491ReductionPromiseArray.prototype._eachComplete = function(value) {
9492 if (this._eachValues !== null) {
9493 this._eachValues.push(value);
9494 }
9495 return this._eachValues;
9496};
9497
9498ReductionPromiseArray.prototype._init = function() {};
9499
9500ReductionPromiseArray.prototype._resolveEmptyArray = function() {
9501 this._resolve(this._eachValues !== undefined ? this._eachValues
9502 : this._initialValue);
9503};
9504
9505ReductionPromiseArray.prototype.shouldCopyValues = function () {
9506 return false;
9507};
9508
9509ReductionPromiseArray.prototype._resolve = function(value) {
9510 this._promise._resolveCallback(value);
9511 this._values = null;
9512};
9513
9514ReductionPromiseArray.prototype._resultCancelled = function(sender) {
9515 if (sender === this._initialValue) return this._cancel();
9516 if (this._isResolved()) return;
9517 this._resultCancelled$();
9518 if (this._currentCancellable instanceof Promise) {
9519 this._currentCancellable.cancel();
9520 }
9521 if (this._initialValue instanceof Promise) {
9522 this._initialValue.cancel();
9523 }
9524};
9525
9526ReductionPromiseArray.prototype._iterate = function (values) {
9527 this._values = values;
9528 var value;
9529 var i;
9530 var length = values.length;
9531 if (this._initialValue !== undefined) {
9532 value = this._initialValue;
9533 i = 0;
9534 } else {
9535 value = Promise.resolve(values[0]);
9536 i = 1;
9537 }
9538
9539 this._currentCancellable = value;
9540
9541 if (!value.isRejected()) {
9542 for (; i < length; ++i) {
9543 var ctx = {
9544 accum: null,
9545 value: values[i],
9546 index: i,
9547 length: length,
9548 array: this
9549 };
9550 value = value._then(gotAccum, undefined, undefined, ctx, undefined);
9551 }
9552 }
9553
9554 if (this._eachValues !== undefined) {
9555 value = value
9556 ._then(this._eachComplete, undefined, undefined, this, undefined);
9557 }
9558 value._then(completed, completed, undefined, value, this);
9559};
9560
9561Promise.prototype.reduce = function (fn, initialValue) {
9562 return reduce(this, fn, initialValue, null);
9563};
9564
9565Promise.reduce = function (promises, fn, initialValue, _each) {
9566 return reduce(promises, fn, initialValue, _each);
9567};
9568
9569function completed(valueOrReason, array) {
9570 if (this.isFulfilled()) {
9571 array._resolve(valueOrReason);
9572 } else {
9573 array._reject(valueOrReason);
9574 }
9575}
9576
9577function reduce(promises, fn, initialValue, _each) {
9578 if (typeof fn !== "function") {
9579 return apiRejection("expecting a function but got " + util.classString(fn));
9580 }
9581 var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
9582 return array.promise();
9583}
9584
9585function gotAccum(accum) {
9586 this.accum = accum;
9587 this.array._gotAccum(accum);
9588 var value = tryConvertToPromise(this.value, this.array._promise);
9589 if (value instanceof Promise) {
9590 this.array._currentCancellable = value;
9591 return value._then(gotValue, undefined, undefined, this, undefined);
9592 } else {
9593 return gotValue.call(this, value);
9594 }
9595}
9596
9597function gotValue(value) {
9598 var array = this.array;
9599 var promise = array._promise;
9600 var fn = tryCatch(array._fn);
9601 promise._pushContext();
9602 var ret;
9603 if (array._eachValues !== undefined) {
9604 ret = fn.call(promise._boundValue(), value, this.index, this.length);
9605 } else {
9606 ret = fn.call(promise._boundValue(),
9607 this.accum, value, this.index, this.length);
9608 }
9609 if (ret instanceof Promise) {
9610 array._currentCancellable = ret;
9611 }
9612 var promiseCreated = promise._popContext();
9613 debug.checkForgottenReturns(
9614 ret,
9615 promiseCreated,
9616 array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
9617 promise
9618 );
9619 return ret;
9620}
9621};
9622
9623},{"./util":36}],29:[function(_dereq_,module,exports){
9624"use strict";
9625var util = _dereq_("./util");
9626var schedule;
9627var noAsyncScheduler = function() {
9628 throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9629};
9630var NativePromise = util.getNativePromise();
9631if (util.isNode && typeof MutationObserver === "undefined") {
9632 var GlobalSetImmediate = global.setImmediate;
9633 var ProcessNextTick = process.nextTick;
9634 schedule = util.isRecentNode
9635 ? function(fn) { GlobalSetImmediate.call(global, fn); }
9636 : function(fn) { ProcessNextTick.call(process, fn); };
9637} else if (typeof NativePromise === "function" &&
9638 typeof NativePromise.resolve === "function") {
9639 var nativePromise = NativePromise.resolve();
9640 schedule = function(fn) {
9641 nativePromise.then(fn);
9642 };
9643} else if ((typeof MutationObserver !== "undefined") &&
9644 !(typeof window !== "undefined" &&
9645 window.navigator &&
9646 (window.navigator.standalone || window.cordova))) {
9647 schedule = (function() {
9648 var div = document.createElement("div");
9649 var opts = {attributes: true};
9650 var toggleScheduled = false;
9651 var div2 = document.createElement("div");
9652 var o2 = new MutationObserver(function() {
9653 div.classList.toggle("foo");
9654 toggleScheduled = false;
9655 });
9656 o2.observe(div2, opts);
9657
9658 var scheduleToggle = function() {
9659 if (toggleScheduled) return;
9660 toggleScheduled = true;
9661 div2.classList.toggle("foo");
9662 };
9663
9664 return function schedule(fn) {
9665 var o = new MutationObserver(function() {
9666 o.disconnect();
9667 fn();
9668 });
9669 o.observe(div, opts);
9670 scheduleToggle();
9671 };
9672 })();
9673} else if (typeof setImmediate !== "undefined") {
9674 schedule = function (fn) {
9675 setImmediate(fn);
9676 };
9677} else if (typeof setTimeout !== "undefined") {
9678 schedule = function (fn) {
9679 setTimeout(fn, 0);
9680 };
9681} else {
9682 schedule = noAsyncScheduler;
9683}
9684module.exports = schedule;
9685
9686},{"./util":36}],30:[function(_dereq_,module,exports){
9687"use strict";
9688module.exports =
9689 function(Promise, PromiseArray, debug) {
9690var PromiseInspection = Promise.PromiseInspection;
9691var util = _dereq_("./util");
9692
9693function SettledPromiseArray(values) {
9694 this.constructor$(values);
9695}
9696util.inherits(SettledPromiseArray, PromiseArray);
9697
9698SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
9699 this._values[index] = inspection;
9700 var totalResolved = ++this._totalResolved;
9701 if (totalResolved >= this._length) {
9702 this._resolve(this._values);
9703 return true;
9704 }
9705 return false;
9706};
9707
9708SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
9709 var ret = new PromiseInspection();
9710 ret._bitField = 33554432;
9711 ret._settledValueField = value;
9712 return this._promiseResolved(index, ret);
9713};
9714SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
9715 var ret = new PromiseInspection();
9716 ret._bitField = 16777216;
9717 ret._settledValueField = reason;
9718 return this._promiseResolved(index, ret);
9719};
9720
9721Promise.settle = function (promises) {
9722 debug.deprecated(".settle()", ".reflect()");
9723 return new SettledPromiseArray(promises).promise();
9724};
9725
9726Promise.prototype.settle = function () {
9727 return Promise.settle(this);
9728};
9729};
9730
9731},{"./util":36}],31:[function(_dereq_,module,exports){
9732"use strict";
9733module.exports =
9734function(Promise, PromiseArray, apiRejection) {
9735var util = _dereq_("./util");
9736var RangeError = _dereq_("./errors").RangeError;
9737var AggregateError = _dereq_("./errors").AggregateError;
9738var isArray = util.isArray;
9739var CANCELLATION = {};
9740
9741
9742function SomePromiseArray(values) {
9743 this.constructor$(values);
9744 this._howMany = 0;
9745 this._unwrap = false;
9746 this._initialized = false;
9747}
9748util.inherits(SomePromiseArray, PromiseArray);
9749
9750SomePromiseArray.prototype._init = function () {
9751 if (!this._initialized) {
9752 return;
9753 }
9754 if (this._howMany === 0) {
9755 this._resolve([]);
9756 return;
9757 }
9758 this._init$(undefined, -5);
9759 var isArrayResolved = isArray(this._values);
9760 if (!this._isResolved() &&
9761 isArrayResolved &&
9762 this._howMany > this._canPossiblyFulfill()) {
9763 this._reject(this._getRangeError(this.length()));
9764 }
9765};
9766
9767SomePromiseArray.prototype.init = function () {
9768 this._initialized = true;
9769 this._init();
9770};
9771
9772SomePromiseArray.prototype.setUnwrap = function () {
9773 this._unwrap = true;
9774};
9775
9776SomePromiseArray.prototype.howMany = function () {
9777 return this._howMany;
9778};
9779
9780SomePromiseArray.prototype.setHowMany = function (count) {
9781 this._howMany = count;
9782};
9783
9784SomePromiseArray.prototype._promiseFulfilled = function (value) {
9785 this._addFulfilled(value);
9786 if (this._fulfilled() === this.howMany()) {
9787 this._values.length = this.howMany();
9788 if (this.howMany() === 1 && this._unwrap) {
9789 this._resolve(this._values[0]);
9790 } else {
9791 this._resolve(this._values);
9792 }
9793 return true;
9794 }
9795 return false;
9796
9797};
9798SomePromiseArray.prototype._promiseRejected = function (reason) {
9799 this._addRejected(reason);
9800 return this._checkOutcome();
9801};
9802
9803SomePromiseArray.prototype._promiseCancelled = function () {
9804 if (this._values instanceof Promise || this._values == null) {
9805 return this._cancel();
9806 }
9807 this._addRejected(CANCELLATION);
9808 return this._checkOutcome();
9809};
9810
9811SomePromiseArray.prototype._checkOutcome = function() {
9812 if (this.howMany() > this._canPossiblyFulfill()) {
9813 var e = new AggregateError();
9814 for (var i = this.length(); i < this._values.length; ++i) {
9815 if (this._values[i] !== CANCELLATION) {
9816 e.push(this._values[i]);
9817 }
9818 }
9819 if (e.length > 0) {
9820 this._reject(e);
9821 } else {
9822 this._cancel();
9823 }
9824 return true;
9825 }
9826 return false;
9827};
9828
9829SomePromiseArray.prototype._fulfilled = function () {
9830 return this._totalResolved;
9831};
9832
9833SomePromiseArray.prototype._rejected = function () {
9834 return this._values.length - this.length();
9835};
9836
9837SomePromiseArray.prototype._addRejected = function (reason) {
9838 this._values.push(reason);
9839};
9840
9841SomePromiseArray.prototype._addFulfilled = function (value) {
9842 this._values[this._totalResolved++] = value;
9843};
9844
9845SomePromiseArray.prototype._canPossiblyFulfill = function () {
9846 return this.length() - this._rejected();
9847};
9848
9849SomePromiseArray.prototype._getRangeError = function (count) {
9850 var message = "Input array must contain at least " +
9851 this._howMany + " items but contains only " + count + " items";
9852 return new RangeError(message);
9853};
9854
9855SomePromiseArray.prototype._resolveEmptyArray = function () {
9856 this._reject(this._getRangeError(0));
9857};
9858
9859function some(promises, howMany) {
9860 if ((howMany | 0) !== howMany || howMany < 0) {
9861 return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9862 }
9863 var ret = new SomePromiseArray(promises);
9864 var promise = ret.promise();
9865 ret.setHowMany(howMany);
9866 ret.init();
9867 return promise;
9868}
9869
9870Promise.some = function (promises, howMany) {
9871 return some(promises, howMany);
9872};
9873
9874Promise.prototype.some = function (howMany) {
9875 return some(this, howMany);
9876};
9877
9878Promise._SomePromiseArray = SomePromiseArray;
9879};
9880
9881},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){
9882"use strict";
9883module.exports = function(Promise) {
9884function PromiseInspection(promise) {
9885 if (promise !== undefined) {
9886 promise = promise._target();
9887 this._bitField = promise._bitField;
9888 this._settledValueField = promise._isFateSealed()
9889 ? promise._settledValue() : undefined;
9890 }
9891 else {
9892 this._bitField = 0;
9893 this._settledValueField = undefined;
9894 }
9895}
9896
9897PromiseInspection.prototype._settledValue = function() {
9898 return this._settledValueField;
9899};
9900
9901var value = PromiseInspection.prototype.value = function () {
9902 if (!this.isFulfilled()) {
9903 throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9904 }
9905 return this._settledValue();
9906};
9907
9908var reason = PromiseInspection.prototype.error =
9909PromiseInspection.prototype.reason = function () {
9910 if (!this.isRejected()) {
9911 throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
9912 }
9913 return this._settledValue();
9914};
9915
9916var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
9917 return (this._bitField & 33554432) !== 0;
9918};
9919
9920var isRejected = PromiseInspection.prototype.isRejected = function () {
9921 return (this._bitField & 16777216) !== 0;
9922};
9923
9924var isPending = PromiseInspection.prototype.isPending = function () {
9925 return (this._bitField & 50397184) === 0;
9926};
9927
9928var isResolved = PromiseInspection.prototype.isResolved = function () {
9929 return (this._bitField & 50331648) !== 0;
9930};
9931
9932PromiseInspection.prototype.isCancelled = function() {
9933 return (this._bitField & 8454144) !== 0;
9934};
9935
9936Promise.prototype.__isCancelled = function() {
9937 return (this._bitField & 65536) === 65536;
9938};
9939
9940Promise.prototype._isCancelled = function() {
9941 return this._target().__isCancelled();
9942};
9943
9944Promise.prototype.isCancelled = function() {
9945 return (this._target()._bitField & 8454144) !== 0;
9946};
9947
9948Promise.prototype.isPending = function() {
9949 return isPending.call(this._target());
9950};
9951
9952Promise.prototype.isRejected = function() {
9953 return isRejected.call(this._target());
9954};
9955
9956Promise.prototype.isFulfilled = function() {
9957 return isFulfilled.call(this._target());
9958};
9959
9960Promise.prototype.isResolved = function() {
9961 return isResolved.call(this._target());
9962};
9963
9964Promise.prototype.value = function() {
9965 return value.call(this._target());
9966};
9967
9968Promise.prototype.reason = function() {
9969 var target = this._target();
9970 target._unsetRejectionIsUnhandled();
9971 return reason.call(target);
9972};
9973
9974Promise.prototype._value = function() {
9975 return this._settledValue();
9976};
9977
9978Promise.prototype._reason = function() {
9979 this._unsetRejectionIsUnhandled();
9980 return this._settledValue();
9981};
9982
9983Promise.PromiseInspection = PromiseInspection;
9984};
9985
9986},{}],33:[function(_dereq_,module,exports){
9987"use strict";
9988module.exports = function(Promise, INTERNAL) {
9989var util = _dereq_("./util");
9990var errorObj = util.errorObj;
9991var isObject = util.isObject;
9992
9993function tryConvertToPromise(obj, context) {
9994 if (isObject(obj)) {
9995 if (obj instanceof Promise) return obj;
9996 var then = getThen(obj);
9997 if (then === errorObj) {
9998 if (context) context._pushContext();
9999 var ret = Promise.reject(then.e);
10000 if (context) context._popContext();
10001 return ret;
10002 } else if (typeof then === "function") {
10003 if (isAnyBluebirdPromise(obj)) {
10004 var ret = new Promise(INTERNAL);
10005 obj._then(
10006 ret._fulfill,
10007 ret._reject,
10008 undefined,
10009 ret,
10010 null
10011 );
10012 return ret;
10013 }
10014 return doThenable(obj, then, context);
10015 }
10016 }
10017 return obj;
10018}
10019
10020function doGetThen(obj) {
10021 return obj.then;
10022}
10023
10024function getThen(obj) {
10025 try {
10026 return doGetThen(obj);
10027 } catch (e) {
10028 errorObj.e = e;
10029 return errorObj;
10030 }
10031}
10032
10033var hasProp = {}.hasOwnProperty;
10034function isAnyBluebirdPromise(obj) {
10035 try {
10036 return hasProp.call(obj, "_promise0");
10037 } catch (e) {
10038 return false;
10039 }
10040}
10041
10042function doThenable(x, then, context) {
10043 var promise = new Promise(INTERNAL);
10044 var ret = promise;
10045 if (context) context._pushContext();
10046 promise._captureStackTrace();
10047 if (context) context._popContext();
10048 var synchronous = true;
10049 var result = util.tryCatch(then).call(x, resolve, reject);
10050 synchronous = false;
10051
10052 if (promise && result === errorObj) {
10053 promise._rejectCallback(result.e, true, true);
10054 promise = null;
10055 }
10056
10057 function resolve(value) {
10058 if (!promise) return;
10059 promise._resolveCallback(value);
10060 promise = null;
10061 }
10062
10063 function reject(reason) {
10064 if (!promise) return;
10065 promise._rejectCallback(reason, synchronous, true);
10066 promise = null;
10067 }
10068 return ret;
10069}
10070
10071return tryConvertToPromise;
10072};
10073
10074},{"./util":36}],34:[function(_dereq_,module,exports){
10075"use strict";
10076module.exports = function(Promise, INTERNAL, debug) {
10077var util = _dereq_("./util");
10078var TimeoutError = Promise.TimeoutError;
10079
10080function HandleWrapper(handle) {
10081 this.handle = handle;
10082}
10083
10084HandleWrapper.prototype._resultCancelled = function() {
10085 clearTimeout(this.handle);
10086};
10087
10088var afterValue = function(value) { return delay(+this).thenReturn(value); };
10089var delay = Promise.delay = function (ms, value) {
10090 var ret;
10091 var handle;
10092 if (value !== undefined) {
10093 ret = Promise.resolve(value)
10094 ._then(afterValue, null, null, ms, undefined);
10095 if (debug.cancellation() && value instanceof Promise) {
10096 ret._setOnCancel(value);
10097 }
10098 } else {
10099 ret = new Promise(INTERNAL);
10100 handle = setTimeout(function() { ret._fulfill(); }, +ms);
10101 if (debug.cancellation()) {
10102 ret._setOnCancel(new HandleWrapper(handle));
10103 }
10104 ret._captureStackTrace();
10105 }
10106 ret._setAsyncGuaranteed();
10107 return ret;
10108};
10109
10110Promise.prototype.delay = function (ms) {
10111 return delay(ms, this);
10112};
10113
10114var afterTimeout = function (promise, message, parent) {
10115 var err;
10116 if (typeof message !== "string") {
10117 if (message instanceof Error) {
10118 err = message;
10119 } else {
10120 err = new TimeoutError("operation timed out");
10121 }
10122 } else {
10123 err = new TimeoutError(message);
10124 }
10125 util.markAsOriginatingFromRejection(err);
10126 promise._attachExtraTrace(err);
10127 promise._reject(err);
10128
10129 if (parent != null) {
10130 parent.cancel();
10131 }
10132};
10133
10134function successClear(value) {
10135 clearTimeout(this.handle);
10136 return value;
10137}
10138
10139function failureClear(reason) {
10140 clearTimeout(this.handle);
10141 throw reason;
10142}
10143
10144Promise.prototype.timeout = function (ms, message) {
10145 ms = +ms;
10146 var ret, parent;
10147
10148 var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
10149 if (ret.isPending()) {
10150 afterTimeout(ret, message, parent);
10151 }
10152 }, ms));
10153
10154 if (debug.cancellation()) {
10155 parent = this.then();
10156 ret = parent._then(successClear, failureClear,
10157 undefined, handleWrapper, undefined);
10158 ret._setOnCancel(handleWrapper);
10159 } else {
10160 ret = this._then(successClear, failureClear,
10161 undefined, handleWrapper, undefined);
10162 }
10163
10164 return ret;
10165};
10166
10167};
10168
10169},{"./util":36}],35:[function(_dereq_,module,exports){
10170"use strict";
10171module.exports = function (Promise, apiRejection, tryConvertToPromise,
10172 createContext, INTERNAL, debug) {
10173 var util = _dereq_("./util");
10174 var TypeError = _dereq_("./errors").TypeError;
10175 var inherits = _dereq_("./util").inherits;
10176 var errorObj = util.errorObj;
10177 var tryCatch = util.tryCatch;
10178 var NULL = {};
10179
10180 function thrower(e) {
10181 setTimeout(function(){throw e;}, 0);
10182 }
10183
10184 function castPreservingDisposable(thenable) {
10185 var maybePromise = tryConvertToPromise(thenable);
10186 if (maybePromise !== thenable &&
10187 typeof thenable._isDisposable === "function" &&
10188 typeof thenable._getDisposer === "function" &&
10189 thenable._isDisposable()) {
10190 maybePromise._setDisposable(thenable._getDisposer());
10191 }
10192 return maybePromise;
10193 }
10194 function dispose(resources, inspection) {
10195 var i = 0;
10196 var len = resources.length;
10197 var ret = new Promise(INTERNAL);
10198 function iterator() {
10199 if (i >= len) return ret._fulfill();
10200 var maybePromise = castPreservingDisposable(resources[i++]);
10201 if (maybePromise instanceof Promise &&
10202 maybePromise._isDisposable()) {
10203 try {
10204 maybePromise = tryConvertToPromise(
10205 maybePromise._getDisposer().tryDispose(inspection),
10206 resources.promise);
10207 } catch (e) {
10208 return thrower(e);
10209 }
10210 if (maybePromise instanceof Promise) {
10211 return maybePromise._then(iterator, thrower,
10212 null, null, null);
10213 }
10214 }
10215 iterator();
10216 }
10217 iterator();
10218 return ret;
10219 }
10220
10221 function Disposer(data, promise, context) {
10222 this._data = data;
10223 this._promise = promise;
10224 this._context = context;
10225 }
10226
10227 Disposer.prototype.data = function () {
10228 return this._data;
10229 };
10230
10231 Disposer.prototype.promise = function () {
10232 return this._promise;
10233 };
10234
10235 Disposer.prototype.resource = function () {
10236 if (this.promise().isFulfilled()) {
10237 return this.promise().value();
10238 }
10239 return NULL;
10240 };
10241
10242 Disposer.prototype.tryDispose = function(inspection) {
10243 var resource = this.resource();
10244 var context = this._context;
10245 if (context !== undefined) context._pushContext();
10246 var ret = resource !== NULL
10247 ? this.doDispose(resource, inspection) : null;
10248 if (context !== undefined) context._popContext();
10249 this._promise._unsetDisposable();
10250 this._data = null;
10251 return ret;
10252 };
10253
10254 Disposer.isDisposer = function (d) {
10255 return (d != null &&
10256 typeof d.resource === "function" &&
10257 typeof d.tryDispose === "function");
10258 };
10259
10260 function FunctionDisposer(fn, promise, context) {
10261 this.constructor$(fn, promise, context);
10262 }
10263 inherits(FunctionDisposer, Disposer);
10264
10265 FunctionDisposer.prototype.doDispose = function (resource, inspection) {
10266 var fn = this.data();
10267 return fn.call(resource, resource, inspection);
10268 };
10269
10270 function maybeUnwrapDisposer(value) {
10271 if (Disposer.isDisposer(value)) {
10272 this.resources[this.index]._setDisposable(value);
10273 return value.promise();
10274 }
10275 return value;
10276 }
10277
10278 function ResourceList(length) {
10279 this.length = length;
10280 this.promise = null;
10281 this[length-1] = null;
10282 }
10283
10284 ResourceList.prototype._resultCancelled = function() {
10285 var len = this.length;
10286 for (var i = 0; i < len; ++i) {
10287 var item = this[i];
10288 if (item instanceof Promise) {
10289 item.cancel();
10290 }
10291 }
10292 };
10293
10294 Promise.using = function () {
10295 var len = arguments.length;
10296 if (len < 2) return apiRejection(
10297 "you must pass at least 2 arguments to Promise.using");
10298 var fn = arguments[len - 1];
10299 if (typeof fn !== "function") {
10300 return apiRejection("expecting a function but got " + util.classString(fn));
10301 }
10302 var input;
10303 var spreadArgs = true;
10304 if (len === 2 && Array.isArray(arguments[0])) {
10305 input = arguments[0];
10306 len = input.length;
10307 spreadArgs = false;
10308 } else {
10309 input = arguments;
10310 len--;
10311 }
10312 var resources = new ResourceList(len);
10313 for (var i = 0; i < len; ++i) {
10314 var resource = input[i];
10315 if (Disposer.isDisposer(resource)) {
10316 var disposer = resource;
10317 resource = resource.promise();
10318 resource._setDisposable(disposer);
10319 } else {
10320 var maybePromise = tryConvertToPromise(resource);
10321 if (maybePromise instanceof Promise) {
10322 resource =
10323 maybePromise._then(maybeUnwrapDisposer, null, null, {
10324 resources: resources,
10325 index: i
10326 }, undefined);
10327 }
10328 }
10329 resources[i] = resource;
10330 }
10331
10332 var reflectedResources = new Array(resources.length);
10333 for (var i = 0; i < reflectedResources.length; ++i) {
10334 reflectedResources[i] = Promise.resolve(resources[i]).reflect();
10335 }
10336
10337 var resultPromise = Promise.all(reflectedResources)
10338 .then(function(inspections) {
10339 for (var i = 0; i < inspections.length; ++i) {
10340 var inspection = inspections[i];
10341 if (inspection.isRejected()) {
10342 errorObj.e = inspection.error();
10343 return errorObj;
10344 } else if (!inspection.isFulfilled()) {
10345 resultPromise.cancel();
10346 return;
10347 }
10348 inspections[i] = inspection.value();
10349 }
10350 promise._pushContext();
10351
10352 fn = tryCatch(fn);
10353 var ret = spreadArgs
10354 ? fn.apply(undefined, inspections) : fn(inspections);
10355 var promiseCreated = promise._popContext();
10356 debug.checkForgottenReturns(
10357 ret, promiseCreated, "Promise.using", promise);
10358 return ret;
10359 });
10360
10361 var promise = resultPromise.lastly(function() {
10362 var inspection = new Promise.PromiseInspection(resultPromise);
10363 return dispose(resources, inspection);
10364 });
10365 resources.promise = promise;
10366 promise._setOnCancel(resources);
10367 return promise;
10368 };
10369
10370 Promise.prototype._setDisposable = function (disposer) {
10371 this._bitField = this._bitField | 131072;
10372 this._disposer = disposer;
10373 };
10374
10375 Promise.prototype._isDisposable = function () {
10376 return (this._bitField & 131072) > 0;
10377 };
10378
10379 Promise.prototype._getDisposer = function () {
10380 return this._disposer;
10381 };
10382
10383 Promise.prototype._unsetDisposable = function () {
10384 this._bitField = this._bitField & (~131072);
10385 this._disposer = undefined;
10386 };
10387
10388 Promise.prototype.disposer = function (fn) {
10389 if (typeof fn === "function") {
10390 return new FunctionDisposer(fn, this, createContext());
10391 }
10392 throw new TypeError();
10393 };
10394
10395};
10396
10397},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){
10398"use strict";
10399var es5 = _dereq_("./es5");
10400var canEvaluate = typeof navigator == "undefined";
10401
10402var errorObj = {e: {}};
10403var tryCatchTarget;
10404var globalObject = typeof self !== "undefined" ? self :
10405 typeof window !== "undefined" ? window :
10406 typeof global !== "undefined" ? global :
10407 this !== undefined ? this : null;
10408
10409function tryCatcher() {
10410 try {
10411 var target = tryCatchTarget;
10412 tryCatchTarget = null;
10413 return target.apply(this, arguments);
10414 } catch (e) {
10415 errorObj.e = e;
10416 return errorObj;
10417 }
10418}
10419function tryCatch(fn) {
10420 tryCatchTarget = fn;
10421 return tryCatcher;
10422}
10423
10424var inherits = function(Child, Parent) {
10425 var hasProp = {}.hasOwnProperty;
10426
10427 function T() {
10428 this.constructor = Child;
10429 this.constructor$ = Parent;
10430 for (var propertyName in Parent.prototype) {
10431 if (hasProp.call(Parent.prototype, propertyName) &&
10432 propertyName.charAt(propertyName.length-1) !== "$"
10433 ) {
10434 this[propertyName + "$"] = Parent.prototype[propertyName];
10435 }
10436 }
10437 }
10438 T.prototype = Parent.prototype;
10439 Child.prototype = new T();
10440 return Child.prototype;
10441};
10442
10443
10444function isPrimitive(val) {
10445 return val == null || val === true || val === false ||
10446 typeof val === "string" || typeof val === "number";
10447
10448}
10449
10450function isObject(value) {
10451 return typeof value === "function" ||
10452 typeof value === "object" && value !== null;
10453}
10454
10455function maybeWrapAsError(maybeError) {
10456 if (!isPrimitive(maybeError)) return maybeError;
10457
10458 return new Error(safeToString(maybeError));
10459}
10460
10461function withAppended(target, appendee) {
10462 var len = target.length;
10463 var ret = new Array(len + 1);
10464 var i;
10465 for (i = 0; i < len; ++i) {
10466 ret[i] = target[i];
10467 }
10468 ret[i] = appendee;
10469 return ret;
10470}
10471
10472function getDataPropertyOrDefault(obj, key, defaultValue) {
10473 if (es5.isES5) {
10474 var desc = Object.getOwnPropertyDescriptor(obj, key);
10475
10476 if (desc != null) {
10477 return desc.get == null && desc.set == null
10478 ? desc.value
10479 : defaultValue;
10480 }
10481 } else {
10482 return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
10483 }
10484}
10485
10486function notEnumerableProp(obj, name, value) {
10487 if (isPrimitive(obj)) return obj;
10488 var descriptor = {
10489 value: value,
10490 configurable: true,
10491 enumerable: false,
10492 writable: true
10493 };
10494 es5.defineProperty(obj, name, descriptor);
10495 return obj;
10496}
10497
10498function thrower(r) {
10499 throw r;
10500}
10501
10502var inheritedDataKeys = (function() {
10503 var excludedPrototypes = [
10504 Array.prototype,
10505 Object.prototype,
10506 Function.prototype
10507 ];
10508
10509 var isExcludedProto = function(val) {
10510 for (var i = 0; i < excludedPrototypes.length; ++i) {
10511 if (excludedPrototypes[i] === val) {
10512 return true;
10513 }
10514 }
10515 return false;
10516 };
10517
10518 if (es5.isES5) {
10519 var getKeys = Object.getOwnPropertyNames;
10520 return function(obj) {
10521 var ret = [];
10522 var visitedKeys = Object.create(null);
10523 while (obj != null && !isExcludedProto(obj)) {
10524 var keys;
10525 try {
10526 keys = getKeys(obj);
10527 } catch (e) {
10528 return ret;
10529 }
10530 for (var i = 0; i < keys.length; ++i) {
10531 var key = keys[i];
10532 if (visitedKeys[key]) continue;
10533 visitedKeys[key] = true;
10534 var desc = Object.getOwnPropertyDescriptor(obj, key);
10535 if (desc != null && desc.get == null && desc.set == null) {
10536 ret.push(key);
10537 }
10538 }
10539 obj = es5.getPrototypeOf(obj);
10540 }
10541 return ret;
10542 };
10543 } else {
10544 var hasProp = {}.hasOwnProperty;
10545 return function(obj) {
10546 if (isExcludedProto(obj)) return [];
10547 var ret = [];
10548
10549 /*jshint forin:false */
10550 enumeration: for (var key in obj) {
10551 if (hasProp.call(obj, key)) {
10552 ret.push(key);
10553 } else {
10554 for (var i = 0; i < excludedPrototypes.length; ++i) {
10555 if (hasProp.call(excludedPrototypes[i], key)) {
10556 continue enumeration;
10557 }
10558 }
10559 ret.push(key);
10560 }
10561 }
10562 return ret;
10563 };
10564 }
10565
10566})();
10567
10568var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
10569function isClass(fn) {
10570 try {
10571 if (typeof fn === "function") {
10572 var keys = es5.names(fn.prototype);
10573
10574 var hasMethods = es5.isES5 && keys.length > 1;
10575 var hasMethodsOtherThanConstructor = keys.length > 0 &&
10576 !(keys.length === 1 && keys[0] === "constructor");
10577 var hasThisAssignmentAndStaticMethods =
10578 thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
10579
10580 if (hasMethods || hasMethodsOtherThanConstructor ||
10581 hasThisAssignmentAndStaticMethods) {
10582 return true;
10583 }
10584 }
10585 return false;
10586 } catch (e) {
10587 return false;
10588 }
10589}
10590
10591function toFastProperties(obj) {
10592 /*jshint -W027,-W055,-W031*/
10593 function FakeConstructor() {}
10594 FakeConstructor.prototype = obj;
10595 var l = 8;
10596 while (l--) new FakeConstructor();
10597 return obj;
10598 eval(obj);
10599}
10600
10601var rident = /^[a-z$_][a-z$_0-9]*$/i;
10602function isIdentifier(str) {
10603 return rident.test(str);
10604}
10605
10606function filledRange(count, prefix, suffix) {
10607 var ret = new Array(count);
10608 for(var i = 0; i < count; ++i) {
10609 ret[i] = prefix + i + suffix;
10610 }
10611 return ret;
10612}
10613
10614function safeToString(obj) {
10615 try {
10616 return obj + "";
10617 } catch (e) {
10618 return "[no string representation]";
10619 }
10620}
10621
10622function isError(obj) {
10623 return obj !== null &&
10624 typeof obj === "object" &&
10625 typeof obj.message === "string" &&
10626 typeof obj.name === "string";
10627}
10628
10629function markAsOriginatingFromRejection(e) {
10630 try {
10631 notEnumerableProp(e, "isOperational", true);
10632 }
10633 catch(ignore) {}
10634}
10635
10636function originatesFromRejection(e) {
10637 if (e == null) return false;
10638 return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
10639 e["isOperational"] === true);
10640}
10641
10642function canAttachTrace(obj) {
10643 return isError(obj) && es5.propertyIsWritable(obj, "stack");
10644}
10645
10646var ensureErrorObject = (function() {
10647 if (!("stack" in new Error())) {
10648 return function(value) {
10649 if (canAttachTrace(value)) return value;
10650 try {throw new Error(safeToString(value));}
10651 catch(err) {return err;}
10652 };
10653 } else {
10654 return function(value) {
10655 if (canAttachTrace(value)) return value;
10656 return new Error(safeToString(value));
10657 };
10658 }
10659})();
10660
10661function classString(obj) {
10662 return {}.toString.call(obj);
10663}
10664
10665function copyDescriptors(from, to, filter) {
10666 var keys = es5.names(from);
10667 for (var i = 0; i < keys.length; ++i) {
10668 var key = keys[i];
10669 if (filter(key)) {
10670 try {
10671 es5.defineProperty(to, key, es5.getDescriptor(from, key));
10672 } catch (ignore) {}
10673 }
10674 }
10675}
10676
10677var asArray = function(v) {
10678 if (es5.isArray(v)) {
10679 return v;
10680 }
10681 return null;
10682};
10683
10684if (typeof Symbol !== "undefined" && Symbol.iterator) {
10685 var ArrayFrom = typeof Array.from === "function" ? function(v) {
10686 return Array.from(v);
10687 } : function(v) {
10688 var ret = [];
10689 var it = v[Symbol.iterator]();
10690 var itResult;
10691 while (!((itResult = it.next()).done)) {
10692 ret.push(itResult.value);
10693 }
10694 return ret;
10695 };
10696
10697 asArray = function(v) {
10698 if (es5.isArray(v)) {
10699 return v;
10700 } else if (v != null && typeof v[Symbol.iterator] === "function") {
10701 return ArrayFrom(v);
10702 }
10703 return null;
10704 };
10705}
10706
10707var isNode = typeof process !== "undefined" &&
10708 classString(process).toLowerCase() === "[object process]";
10709
10710var hasEnvVariables = typeof process !== "undefined" &&
10711 typeof process.env !== "undefined";
10712
10713function env(key) {
10714 return hasEnvVariables ? process.env[key] : undefined;
10715}
10716
10717function getNativePromise() {
10718 if (typeof Promise === "function") {
10719 try {
10720 var promise = new Promise(function(){});
10721 if ({}.toString.call(promise) === "[object Promise]") {
10722 return Promise;
10723 }
10724 } catch (e) {}
10725 }
10726}
10727
10728function domainBind(self, cb) {
10729 return self.bind(cb);
10730}
10731
10732var ret = {
10733 isClass: isClass,
10734 isIdentifier: isIdentifier,
10735 inheritedDataKeys: inheritedDataKeys,
10736 getDataPropertyOrDefault: getDataPropertyOrDefault,
10737 thrower: thrower,
10738 isArray: es5.isArray,
10739 asArray: asArray,
10740 notEnumerableProp: notEnumerableProp,
10741 isPrimitive: isPrimitive,
10742 isObject: isObject,
10743 isError: isError,
10744 canEvaluate: canEvaluate,
10745 errorObj: errorObj,
10746 tryCatch: tryCatch,
10747 inherits: inherits,
10748 withAppended: withAppended,
10749 maybeWrapAsError: maybeWrapAsError,
10750 toFastProperties: toFastProperties,
10751 filledRange: filledRange,
10752 toString: safeToString,
10753 canAttachTrace: canAttachTrace,
10754 ensureErrorObject: ensureErrorObject,
10755 originatesFromRejection: originatesFromRejection,
10756 markAsOriginatingFromRejection: markAsOriginatingFromRejection,
10757 classString: classString,
10758 copyDescriptors: copyDescriptors,
10759 hasDevTools: typeof chrome !== "undefined" && chrome &&
10760 typeof chrome.loadTimes === "function",
10761 isNode: isNode,
10762 hasEnvVariables: hasEnvVariables,
10763 env: env,
10764 global: globalObject,
10765 getNativePromise: getNativePromise,
10766 domainBind: domainBind
10767};
10768ret.isRecentNode = ret.isNode && (function() {
10769 var version = process.versions.node.split(".").map(Number);
10770 return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
10771})();
10772
10773if (ret.isNode) ret.toFastProperties(process);
10774
10775try {throw new Error(); } catch (e) {ret.lastLineError = e;}
10776module.exports = ret;
10777
10778},{"./es5":13}]},{},[4])(4)
10779}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
10780/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(29), __webpack_require__(123), __webpack_require__(351).setImmediate))
10781
10782/***/ }),
10783/* 126 */
10784/***/ (function(module, exports, __webpack_require__) {
10785
10786(function(){
10787
10788 // Copyright (c) 2005 Tom Wu
10789 // All Rights Reserved.
10790 // See "LICENSE" for details.
10791
10792 // Basic JavaScript BN library - subset useful for RSA encryption.
10793
10794 // Bits per digit
10795 var dbits;
10796
10797 // JavaScript engine analysis
10798 var canary = 0xdeadbeefcafe;
10799 var j_lm = ((canary&0xffffff)==0xefcafe);
10800
10801 // (public) Constructor
10802 function BigInteger(a,b,c) {
10803 if(a != null)
10804 if("number" == typeof a) this.fromNumber(a,b,c);
10805 else if(b == null && "string" != typeof a) this.fromString(a,256);
10806 else this.fromString(a,b);
10807 }
10808
10809 // return new, unset BigInteger
10810 function nbi() { return new BigInteger(null); }
10811
10812 // am: Compute w_j += (x*this_i), propagate carries,
10813 // c is initial carry, returns final carry.
10814 // c < 3*dvalue, x < 2*dvalue, this_i < dvalue
10815 // We need to select the fastest one that works in this environment.
10816
10817 // am1: use a single mult and divide to get the high bits,
10818 // max digit bits should be 26 because
10819 // max internal value = 2*dvalue^2-2*dvalue (< 2^53)
10820 function am1(i,x,w,j,c,n) {
10821 while(--n >= 0) {
10822 var v = x*this[i++]+w[j]+c;
10823 c = Math.floor(v/0x4000000);
10824 w[j++] = v&0x3ffffff;
10825 }
10826 return c;
10827 }
10828 // am2 avoids a big mult-and-extract completely.
10829 // Max digit bits should be <= 30 because we do bitwise ops
10830 // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
10831 function am2(i,x,w,j,c,n) {
10832 var xl = x&0x7fff, xh = x>>15;
10833 while(--n >= 0) {
10834 var l = this[i]&0x7fff;
10835 var h = this[i++]>>15;
10836 var m = xh*l+h*xl;
10837 l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
10838 c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
10839 w[j++] = l&0x3fffffff;
10840 }
10841 return c;
10842 }
10843 // Alternately, set max digit bits to 28 since some
10844 // browsers slow down when dealing with 32-bit numbers.
10845 function am3(i,x,w,j,c,n) {
10846 var xl = x&0x3fff, xh = x>>14;
10847 while(--n >= 0) {
10848 var l = this[i]&0x3fff;
10849 var h = this[i++]>>14;
10850 var m = xh*l+h*xl;
10851 l = xl*l+((m&0x3fff)<<14)+w[j]+c;
10852 c = (l>>28)+(m>>14)+xh*h;
10853 w[j++] = l&0xfffffff;
10854 }
10855 return c;
10856 }
10857 var inBrowser = typeof navigator !== "undefined";
10858 if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
10859 BigInteger.prototype.am = am2;
10860 dbits = 30;
10861 }
10862 else if(inBrowser && j_lm && (navigator.appName != "Netscape")) {
10863 BigInteger.prototype.am = am1;
10864 dbits = 26;
10865 }
10866 else { // Mozilla/Netscape seems to prefer am3
10867 BigInteger.prototype.am = am3;
10868 dbits = 28;
10869 }
10870
10871 BigInteger.prototype.DB = dbits;
10872 BigInteger.prototype.DM = ((1<<dbits)-1);
10873 BigInteger.prototype.DV = (1<<dbits);
10874
10875 var BI_FP = 52;
10876 BigInteger.prototype.FV = Math.pow(2,BI_FP);
10877 BigInteger.prototype.F1 = BI_FP-dbits;
10878 BigInteger.prototype.F2 = 2*dbits-BI_FP;
10879
10880 // Digit conversions
10881 var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
10882 var BI_RC = new Array();
10883 var rr,vv;
10884 rr = "0".charCodeAt(0);
10885 for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
10886 rr = "a".charCodeAt(0);
10887 for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
10888 rr = "A".charCodeAt(0);
10889 for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
10890
10891 function int2char(n) { return BI_RM.charAt(n); }
10892 function intAt(s,i) {
10893 var c = BI_RC[s.charCodeAt(i)];
10894 return (c==null)?-1:c;
10895 }
10896
10897 // (protected) copy this to r
10898 function bnpCopyTo(r) {
10899 for(var i = this.t-1; i >= 0; --i) r[i] = this[i];
10900 r.t = this.t;
10901 r.s = this.s;
10902 }
10903
10904 // (protected) set from integer value x, -DV <= x < DV
10905 function bnpFromInt(x) {
10906 this.t = 1;
10907 this.s = (x<0)?-1:0;
10908 if(x > 0) this[0] = x;
10909 else if(x < -1) this[0] = x+this.DV;
10910 else this.t = 0;
10911 }
10912
10913 // return bigint initialized to value
10914 function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
10915
10916 // (protected) set from string and radix
10917 function bnpFromString(s,b) {
10918 var k;
10919 if(b == 16) k = 4;
10920 else if(b == 8) k = 3;
10921 else if(b == 256) k = 8; // byte array
10922 else if(b == 2) k = 1;
10923 else if(b == 32) k = 5;
10924 else if(b == 4) k = 2;
10925 else { this.fromRadix(s,b); return; }
10926 this.t = 0;
10927 this.s = 0;
10928 var i = s.length, mi = false, sh = 0;
10929 while(--i >= 0) {
10930 var x = (k==8)?s[i]&0xff:intAt(s,i);
10931 if(x < 0) {
10932 if(s.charAt(i) == "-") mi = true;
10933 continue;
10934 }
10935 mi = false;
10936 if(sh == 0)
10937 this[this.t++] = x;
10938 else if(sh+k > this.DB) {
10939 this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
10940 this[this.t++] = (x>>(this.DB-sh));
10941 }
10942 else
10943 this[this.t-1] |= x<<sh;
10944 sh += k;
10945 if(sh >= this.DB) sh -= this.DB;
10946 }
10947 if(k == 8 && (s[0]&0x80) != 0) {
10948 this.s = -1;
10949 if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
10950 }
10951 this.clamp();
10952 if(mi) BigInteger.ZERO.subTo(this,this);
10953 }
10954
10955 // (protected) clamp off excess high words
10956 function bnpClamp() {
10957 var c = this.s&this.DM;
10958 while(this.t > 0 && this[this.t-1] == c) --this.t;
10959 }
10960
10961 // (public) return string representation in given radix
10962 function bnToString(b) {
10963 if(this.s < 0) return "-"+this.negate().toString(b);
10964 var k;
10965 if(b == 16) k = 4;
10966 else if(b == 8) k = 3;
10967 else if(b == 2) k = 1;
10968 else if(b == 32) k = 5;
10969 else if(b == 4) k = 2;
10970 else return this.toRadix(b);
10971 var km = (1<<k)-1, d, m = false, r = "", i = this.t;
10972 var p = this.DB-(i*this.DB)%k;
10973 if(i-- > 0) {
10974 if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
10975 while(i >= 0) {
10976 if(p < k) {
10977 d = (this[i]&((1<<p)-1))<<(k-p);
10978 d |= this[--i]>>(p+=this.DB-k);
10979 }
10980 else {
10981 d = (this[i]>>(p-=k))&km;
10982 if(p <= 0) { p += this.DB; --i; }
10983 }
10984 if(d > 0) m = true;
10985 if(m) r += int2char(d);
10986 }
10987 }
10988 return m?r:"0";
10989 }
10990
10991 // (public) -this
10992 function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
10993
10994 // (public) |this|
10995 function bnAbs() { return (this.s<0)?this.negate():this; }
10996
10997 // (public) return + if this > a, - if this < a, 0 if equal
10998 function bnCompareTo(a) {
10999 var r = this.s-a.s;
11000 if(r != 0) return r;
11001 var i = this.t;
11002 r = i-a.t;
11003 if(r != 0) return (this.s<0)?-r:r;
11004 while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
11005 return 0;
11006 }
11007
11008 // returns bit length of the integer x
11009 function nbits(x) {
11010 var r = 1, t;
11011 if((t=x>>>16) != 0) { x = t; r += 16; }
11012 if((t=x>>8) != 0) { x = t; r += 8; }
11013 if((t=x>>4) != 0) { x = t; r += 4; }
11014 if((t=x>>2) != 0) { x = t; r += 2; }
11015 if((t=x>>1) != 0) { x = t; r += 1; }
11016 return r;
11017 }
11018
11019 // (public) return the number of bits in "this"
11020 function bnBitLength() {
11021 if(this.t <= 0) return 0;
11022 return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
11023 }
11024
11025 // (protected) r = this << n*DB
11026 function bnpDLShiftTo(n,r) {
11027 var i;
11028 for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
11029 for(i = n-1; i >= 0; --i) r[i] = 0;
11030 r.t = this.t+n;
11031 r.s = this.s;
11032 }
11033
11034 // (protected) r = this >> n*DB
11035 function bnpDRShiftTo(n,r) {
11036 for(var i = n; i < this.t; ++i) r[i-n] = this[i];
11037 r.t = Math.max(this.t-n,0);
11038 r.s = this.s;
11039 }
11040
11041 // (protected) r = this << n
11042 function bnpLShiftTo(n,r) {
11043 var bs = n%this.DB;
11044 var cbs = this.DB-bs;
11045 var bm = (1<<cbs)-1;
11046 var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
11047 for(i = this.t-1; i >= 0; --i) {
11048 r[i+ds+1] = (this[i]>>cbs)|c;
11049 c = (this[i]&bm)<<bs;
11050 }
11051 for(i = ds-1; i >= 0; --i) r[i] = 0;
11052 r[ds] = c;
11053 r.t = this.t+ds+1;
11054 r.s = this.s;
11055 r.clamp();
11056 }
11057
11058 // (protected) r = this >> n
11059 function bnpRShiftTo(n,r) {
11060 r.s = this.s;
11061 var ds = Math.floor(n/this.DB);
11062 if(ds >= this.t) { r.t = 0; return; }
11063 var bs = n%this.DB;
11064 var cbs = this.DB-bs;
11065 var bm = (1<<bs)-1;
11066 r[0] = this[ds]>>bs;
11067 for(var i = ds+1; i < this.t; ++i) {
11068 r[i-ds-1] |= (this[i]&bm)<<cbs;
11069 r[i-ds] = this[i]>>bs;
11070 }
11071 if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs;
11072 r.t = this.t-ds;
11073 r.clamp();
11074 }
11075
11076 // (protected) r = this - a
11077 function bnpSubTo(a,r) {
11078 var i = 0, c = 0, m = Math.min(a.t,this.t);
11079 while(i < m) {
11080 c += this[i]-a[i];
11081 r[i++] = c&this.DM;
11082 c >>= this.DB;
11083 }
11084 if(a.t < this.t) {
11085 c -= a.s;
11086 while(i < this.t) {
11087 c += this[i];
11088 r[i++] = c&this.DM;
11089 c >>= this.DB;
11090 }
11091 c += this.s;
11092 }
11093 else {
11094 c += this.s;
11095 while(i < a.t) {
11096 c -= a[i];
11097 r[i++] = c&this.DM;
11098 c >>= this.DB;
11099 }
11100 c -= a.s;
11101 }
11102 r.s = (c<0)?-1:0;
11103 if(c < -1) r[i++] = this.DV+c;
11104 else if(c > 0) r[i++] = c;
11105 r.t = i;
11106 r.clamp();
11107 }
11108
11109 // (protected) r = this * a, r != this,a (HAC 14.12)
11110 // "this" should be the larger one if appropriate.
11111 function bnpMultiplyTo(a,r) {
11112 var x = this.abs(), y = a.abs();
11113 var i = x.t;
11114 r.t = i+y.t;
11115 while(--i >= 0) r[i] = 0;
11116 for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
11117 r.s = 0;
11118 r.clamp();
11119 if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
11120 }
11121
11122 // (protected) r = this^2, r != this (HAC 14.16)
11123 function bnpSquareTo(r) {
11124 var x = this.abs();
11125 var i = r.t = 2*x.t;
11126 while(--i >= 0) r[i] = 0;
11127 for(i = 0; i < x.t-1; ++i) {
11128 var c = x.am(i,x[i],r,2*i,0,1);
11129 if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
11130 r[i+x.t] -= x.DV;
11131 r[i+x.t+1] = 1;
11132 }
11133 }
11134 if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
11135 r.s = 0;
11136 r.clamp();
11137 }
11138
11139 // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
11140 // r != q, this != m. q or r may be null.
11141 function bnpDivRemTo(m,q,r) {
11142 var pm = m.abs();
11143 if(pm.t <= 0) return;
11144 var pt = this.abs();
11145 if(pt.t < pm.t) {
11146 if(q != null) q.fromInt(0);
11147 if(r != null) this.copyTo(r);
11148 return;
11149 }
11150 if(r == null) r = nbi();
11151 var y = nbi(), ts = this.s, ms = m.s;
11152 var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
11153 if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
11154 else { pm.copyTo(y); pt.copyTo(r); }
11155 var ys = y.t;
11156 var y0 = y[ys-1];
11157 if(y0 == 0) return;
11158 var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0);
11159 var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
11160 var i = r.t, j = i-ys, t = (q==null)?nbi():q;
11161 y.dlShiftTo(j,t);
11162 if(r.compareTo(t) >= 0) {
11163 r[r.t++] = 1;
11164 r.subTo(t,r);
11165 }
11166 BigInteger.ONE.dlShiftTo(ys,t);
11167 t.subTo(y,y); // "negative" y so we can replace sub with am later
11168 while(y.t < ys) y[y.t++] = 0;
11169 while(--j >= 0) {
11170 // Estimate quotient digit
11171 var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
11172 if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
11173 y.dlShiftTo(j,t);
11174 r.subTo(t,r);
11175 while(r[i] < --qd) r.subTo(t,r);
11176 }
11177 }
11178 if(q != null) {
11179 r.drShiftTo(ys,q);
11180 if(ts != ms) BigInteger.ZERO.subTo(q,q);
11181 }
11182 r.t = ys;
11183 r.clamp();
11184 if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
11185 if(ts < 0) BigInteger.ZERO.subTo(r,r);
11186 }
11187
11188 // (public) this mod a
11189 function bnMod(a) {
11190 var r = nbi();
11191 this.abs().divRemTo(a,null,r);
11192 if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
11193 return r;
11194 }
11195
11196 // Modular reduction using "classic" algorithm
11197 function Classic(m) { this.m = m; }
11198 function cConvert(x) {
11199 if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
11200 else return x;
11201 }
11202 function cRevert(x) { return x; }
11203 function cReduce(x) { x.divRemTo(this.m,null,x); }
11204 function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
11205 function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
11206
11207 Classic.prototype.convert = cConvert;
11208 Classic.prototype.revert = cRevert;
11209 Classic.prototype.reduce = cReduce;
11210 Classic.prototype.mulTo = cMulTo;
11211 Classic.prototype.sqrTo = cSqrTo;
11212
11213 // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
11214 // justification:
11215 // xy == 1 (mod m)
11216 // xy = 1+km
11217 // xy(2-xy) = (1+km)(1-km)
11218 // x[y(2-xy)] = 1-k^2m^2
11219 // x[y(2-xy)] == 1 (mod m^2)
11220 // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
11221 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
11222 // JS multiply "overflows" differently from C/C++, so care is needed here.
11223 function bnpInvDigit() {
11224 if(this.t < 1) return 0;
11225 var x = this[0];
11226 if((x&1) == 0) return 0;
11227 var y = x&3; // y == 1/x mod 2^2
11228 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
11229 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
11230 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
11231 // last step - calculate inverse mod DV directly;
11232 // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
11233 y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
11234 // we really want the negative inverse, and -DV < y < DV
11235 return (y>0)?this.DV-y:-y;
11236 }
11237
11238 // Montgomery reduction
11239 function Montgomery(m) {
11240 this.m = m;
11241 this.mp = m.invDigit();
11242 this.mpl = this.mp&0x7fff;
11243 this.mph = this.mp>>15;
11244 this.um = (1<<(m.DB-15))-1;
11245 this.mt2 = 2*m.t;
11246 }
11247
11248 // xR mod m
11249 function montConvert(x) {
11250 var r = nbi();
11251 x.abs().dlShiftTo(this.m.t,r);
11252 r.divRemTo(this.m,null,r);
11253 if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
11254 return r;
11255 }
11256
11257 // x/R mod m
11258 function montRevert(x) {
11259 var r = nbi();
11260 x.copyTo(r);
11261 this.reduce(r);
11262 return r;
11263 }
11264
11265 // x = x/R mod m (HAC 14.32)
11266 function montReduce(x) {
11267 while(x.t <= this.mt2) // pad x so am has enough room later
11268 x[x.t++] = 0;
11269 for(var i = 0; i < this.m.t; ++i) {
11270 // faster way of calculating u0 = x[i]*mp mod DV
11271 var j = x[i]&0x7fff;
11272 var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
11273 // use am to combine the multiply-shift-add into one call
11274 j = i+this.m.t;
11275 x[j] += this.m.am(0,u0,x,i,0,this.m.t);
11276 // propagate carry
11277 while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
11278 }
11279 x.clamp();
11280 x.drShiftTo(this.m.t,x);
11281 if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
11282 }
11283
11284 // r = "x^2/R mod m"; x != r
11285 function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
11286
11287 // r = "xy/R mod m"; x,y != r
11288 function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
11289
11290 Montgomery.prototype.convert = montConvert;
11291 Montgomery.prototype.revert = montRevert;
11292 Montgomery.prototype.reduce = montReduce;
11293 Montgomery.prototype.mulTo = montMulTo;
11294 Montgomery.prototype.sqrTo = montSqrTo;
11295
11296 // (protected) true iff this is even
11297 function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
11298
11299 // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
11300 function bnpExp(e,z) {
11301 if(e > 0xffffffff || e < 1) return BigInteger.ONE;
11302 var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
11303 g.copyTo(r);
11304 while(--i >= 0) {
11305 z.sqrTo(r,r2);
11306 if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
11307 else { var t = r; r = r2; r2 = t; }
11308 }
11309 return z.revert(r);
11310 }
11311
11312 // (public) this^e % m, 0 <= e < 2^32
11313 function bnModPowInt(e,m) {
11314 var z;
11315 if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
11316 return this.exp(e,z);
11317 }
11318
11319 // protected
11320 BigInteger.prototype.copyTo = bnpCopyTo;
11321 BigInteger.prototype.fromInt = bnpFromInt;
11322 BigInteger.prototype.fromString = bnpFromString;
11323 BigInteger.prototype.clamp = bnpClamp;
11324 BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
11325 BigInteger.prototype.drShiftTo = bnpDRShiftTo;
11326 BigInteger.prototype.lShiftTo = bnpLShiftTo;
11327 BigInteger.prototype.rShiftTo = bnpRShiftTo;
11328 BigInteger.prototype.subTo = bnpSubTo;
11329 BigInteger.prototype.multiplyTo = bnpMultiplyTo;
11330 BigInteger.prototype.squareTo = bnpSquareTo;
11331 BigInteger.prototype.divRemTo = bnpDivRemTo;
11332 BigInteger.prototype.invDigit = bnpInvDigit;
11333 BigInteger.prototype.isEven = bnpIsEven;
11334 BigInteger.prototype.exp = bnpExp;
11335
11336 // public
11337 BigInteger.prototype.toString = bnToString;
11338 BigInteger.prototype.negate = bnNegate;
11339 BigInteger.prototype.abs = bnAbs;
11340 BigInteger.prototype.compareTo = bnCompareTo;
11341 BigInteger.prototype.bitLength = bnBitLength;
11342 BigInteger.prototype.mod = bnMod;
11343 BigInteger.prototype.modPowInt = bnModPowInt;
11344
11345 // "constants"
11346 BigInteger.ZERO = nbv(0);
11347 BigInteger.ONE = nbv(1);
11348
11349 // Copyright (c) 2005-2009 Tom Wu
11350 // All Rights Reserved.
11351 // See "LICENSE" for details.
11352
11353 // Extended JavaScript BN functions, required for RSA private ops.
11354
11355 // Version 1.1: new BigInteger("0", 10) returns "proper" zero
11356 // Version 1.2: square() API, isProbablePrime fix
11357
11358 // (public)
11359 function bnClone() { var r = nbi(); this.copyTo(r); return r; }
11360
11361 // (public) return value as integer
11362 function bnIntValue() {
11363 if(this.s < 0) {
11364 if(this.t == 1) return this[0]-this.DV;
11365 else if(this.t == 0) return -1;
11366 }
11367 else if(this.t == 1) return this[0];
11368 else if(this.t == 0) return 0;
11369 // assumes 16 < DB < 32
11370 return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0];
11371 }
11372
11373 // (public) return value as byte
11374 function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; }
11375
11376 // (public) return value as short (assumes DB>=16)
11377 function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
11378
11379 // (protected) return x s.t. r^x < DV
11380 function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
11381
11382 // (public) 0 if this == 0, 1 if this > 0
11383 function bnSigNum() {
11384 if(this.s < 0) return -1;
11385 else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
11386 else return 1;
11387 }
11388
11389 // (protected) convert to radix string
11390 function bnpToRadix(b) {
11391 if(b == null) b = 10;
11392 if(this.signum() == 0 || b < 2 || b > 36) return "0";
11393 var cs = this.chunkSize(b);
11394 var a = Math.pow(b,cs);
11395 var d = nbv(a), y = nbi(), z = nbi(), r = "";
11396 this.divRemTo(d,y,z);
11397 while(y.signum() > 0) {
11398 r = (a+z.intValue()).toString(b).substr(1) + r;
11399 y.divRemTo(d,y,z);
11400 }
11401 return z.intValue().toString(b) + r;
11402 }
11403
11404 // (protected) convert from radix string
11405 function bnpFromRadix(s,b) {
11406 this.fromInt(0);
11407 if(b == null) b = 10;
11408 var cs = this.chunkSize(b);
11409 var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
11410 for(var i = 0; i < s.length; ++i) {
11411 var x = intAt(s,i);
11412 if(x < 0) {
11413 if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
11414 continue;
11415 }
11416 w = b*w+x;
11417 if(++j >= cs) {
11418 this.dMultiply(d);
11419 this.dAddOffset(w,0);
11420 j = 0;
11421 w = 0;
11422 }
11423 }
11424 if(j > 0) {
11425 this.dMultiply(Math.pow(b,j));
11426 this.dAddOffset(w,0);
11427 }
11428 if(mi) BigInteger.ZERO.subTo(this,this);
11429 }
11430
11431 // (protected) alternate constructor
11432 function bnpFromNumber(a,b,c) {
11433 if("number" == typeof b) {
11434 // new BigInteger(int,int,RNG)
11435 if(a < 2) this.fromInt(1);
11436 else {
11437 this.fromNumber(a,c);
11438 if(!this.testBit(a-1)) // force MSB set
11439 this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
11440 if(this.isEven()) this.dAddOffset(1,0); // force odd
11441 while(!this.isProbablePrime(b)) {
11442 this.dAddOffset(2,0);
11443 if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
11444 }
11445 }
11446 }
11447 else {
11448 // new BigInteger(int,RNG)
11449 var x = new Array(), t = a&7;
11450 x.length = (a>>3)+1;
11451 b.nextBytes(x);
11452 if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
11453 this.fromString(x,256);
11454 }
11455 }
11456
11457 // (public) convert to bigendian byte array
11458 function bnToByteArray() {
11459 var i = this.t, r = new Array();
11460 r[0] = this.s;
11461 var p = this.DB-(i*this.DB)%8, d, k = 0;
11462 if(i-- > 0) {
11463 if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)
11464 r[k++] = d|(this.s<<(this.DB-p));
11465 while(i >= 0) {
11466 if(p < 8) {
11467 d = (this[i]&((1<<p)-1))<<(8-p);
11468 d |= this[--i]>>(p+=this.DB-8);
11469 }
11470 else {
11471 d = (this[i]>>(p-=8))&0xff;
11472 if(p <= 0) { p += this.DB; --i; }
11473 }
11474 if((d&0x80) != 0) d |= -256;
11475 if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
11476 if(k > 0 || d != this.s) r[k++] = d;
11477 }
11478 }
11479 return r;
11480 }
11481
11482 function bnEquals(a) { return(this.compareTo(a)==0); }
11483 function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
11484 function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
11485
11486 // (protected) r = this op a (bitwise)
11487 function bnpBitwiseTo(a,op,r) {
11488 var i, f, m = Math.min(a.t,this.t);
11489 for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);
11490 if(a.t < this.t) {
11491 f = a.s&this.DM;
11492 for(i = m; i < this.t; ++i) r[i] = op(this[i],f);
11493 r.t = this.t;
11494 }
11495 else {
11496 f = this.s&this.DM;
11497 for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);
11498 r.t = a.t;
11499 }
11500 r.s = op(this.s,a.s);
11501 r.clamp();
11502 }
11503
11504 // (public) this & a
11505 function op_and(x,y) { return x&y; }
11506 function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
11507
11508 // (public) this | a
11509 function op_or(x,y) { return x|y; }
11510 function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
11511
11512 // (public) this ^ a
11513 function op_xor(x,y) { return x^y; }
11514 function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
11515
11516 // (public) this & ~a
11517 function op_andnot(x,y) { return x&~y; }
11518 function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
11519
11520 // (public) ~this
11521 function bnNot() {
11522 var r = nbi();
11523 for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
11524 r.t = this.t;
11525 r.s = ~this.s;
11526 return r;
11527 }
11528
11529 // (public) this << n
11530 function bnShiftLeft(n) {
11531 var r = nbi();
11532 if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
11533 return r;
11534 }
11535
11536 // (public) this >> n
11537 function bnShiftRight(n) {
11538 var r = nbi();
11539 if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
11540 return r;
11541 }
11542
11543 // return index of lowest 1-bit in x, x < 2^31
11544 function lbit(x) {
11545 if(x == 0) return -1;
11546 var r = 0;
11547 if((x&0xffff) == 0) { x >>= 16; r += 16; }
11548 if((x&0xff) == 0) { x >>= 8; r += 8; }
11549 if((x&0xf) == 0) { x >>= 4; r += 4; }
11550 if((x&3) == 0) { x >>= 2; r += 2; }
11551 if((x&1) == 0) ++r;
11552 return r;
11553 }
11554
11555 // (public) returns index of lowest 1-bit (or -1 if none)
11556 function bnGetLowestSetBit() {
11557 for(var i = 0; i < this.t; ++i)
11558 if(this[i] != 0) return i*this.DB+lbit(this[i]);
11559 if(this.s < 0) return this.t*this.DB;
11560 return -1;
11561 }
11562
11563 // return number of 1 bits in x
11564 function cbit(x) {
11565 var r = 0;
11566 while(x != 0) { x &= x-1; ++r; }
11567 return r;
11568 }
11569
11570 // (public) return number of set bits
11571 function bnBitCount() {
11572 var r = 0, x = this.s&this.DM;
11573 for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
11574 return r;
11575 }
11576
11577 // (public) true iff nth bit is set
11578 function bnTestBit(n) {
11579 var j = Math.floor(n/this.DB);
11580 if(j >= this.t) return(this.s!=0);
11581 return((this[j]&(1<<(n%this.DB)))!=0);
11582 }
11583
11584 // (protected) this op (1<<n)
11585 function bnpChangeBit(n,op) {
11586 var r = BigInteger.ONE.shiftLeft(n);
11587 this.bitwiseTo(r,op,r);
11588 return r;
11589 }
11590
11591 // (public) this | (1<<n)
11592 function bnSetBit(n) { return this.changeBit(n,op_or); }
11593
11594 // (public) this & ~(1<<n)
11595 function bnClearBit(n) { return this.changeBit(n,op_andnot); }
11596
11597 // (public) this ^ (1<<n)
11598 function bnFlipBit(n) { return this.changeBit(n,op_xor); }
11599
11600 // (protected) r = this + a
11601 function bnpAddTo(a,r) {
11602 var i = 0, c = 0, m = Math.min(a.t,this.t);
11603 while(i < m) {
11604 c += this[i]+a[i];
11605 r[i++] = c&this.DM;
11606 c >>= this.DB;
11607 }
11608 if(a.t < this.t) {
11609 c += a.s;
11610 while(i < this.t) {
11611 c += this[i];
11612 r[i++] = c&this.DM;
11613 c >>= this.DB;
11614 }
11615 c += this.s;
11616 }
11617 else {
11618 c += this.s;
11619 while(i < a.t) {
11620 c += a[i];
11621 r[i++] = c&this.DM;
11622 c >>= this.DB;
11623 }
11624 c += a.s;
11625 }
11626 r.s = (c<0)?-1:0;
11627 if(c > 0) r[i++] = c;
11628 else if(c < -1) r[i++] = this.DV+c;
11629 r.t = i;
11630 r.clamp();
11631 }
11632
11633 // (public) this + a
11634 function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
11635
11636 // (public) this - a
11637 function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
11638
11639 // (public) this * a
11640 function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
11641
11642 // (public) this^2
11643 function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
11644
11645 // (public) this / a
11646 function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
11647
11648 // (public) this % a
11649 function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
11650
11651 // (public) [this/a,this%a]
11652 function bnDivideAndRemainder(a) {
11653 var q = nbi(), r = nbi();
11654 this.divRemTo(a,q,r);
11655 return new Array(q,r);
11656 }
11657
11658 // (protected) this *= n, this >= 0, 1 < n < DV
11659 function bnpDMultiply(n) {
11660 this[this.t] = this.am(0,n-1,this,0,0,this.t);
11661 ++this.t;
11662 this.clamp();
11663 }
11664
11665 // (protected) this += n << w words, this >= 0
11666 function bnpDAddOffset(n,w) {
11667 if(n == 0) return;
11668 while(this.t <= w) this[this.t++] = 0;
11669 this[w] += n;
11670 while(this[w] >= this.DV) {
11671 this[w] -= this.DV;
11672 if(++w >= this.t) this[this.t++] = 0;
11673 ++this[w];
11674 }
11675 }
11676
11677 // A "null" reducer
11678 function NullExp() {}
11679 function nNop(x) { return x; }
11680 function nMulTo(x,y,r) { x.multiplyTo(y,r); }
11681 function nSqrTo(x,r) { x.squareTo(r); }
11682
11683 NullExp.prototype.convert = nNop;
11684 NullExp.prototype.revert = nNop;
11685 NullExp.prototype.mulTo = nMulTo;
11686 NullExp.prototype.sqrTo = nSqrTo;
11687
11688 // (public) this^e
11689 function bnPow(e) { return this.exp(e,new NullExp()); }
11690
11691 // (protected) r = lower n words of "this * a", a.t <= n
11692 // "this" should be the larger one if appropriate.
11693 function bnpMultiplyLowerTo(a,n,r) {
11694 var i = Math.min(this.t+a.t,n);
11695 r.s = 0; // assumes a,this >= 0
11696 r.t = i;
11697 while(i > 0) r[--i] = 0;
11698 var j;
11699 for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
11700 for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
11701 r.clamp();
11702 }
11703
11704 // (protected) r = "this * a" without lower n words, n > 0
11705 // "this" should be the larger one if appropriate.
11706 function bnpMultiplyUpperTo(a,n,r) {
11707 --n;
11708 var i = r.t = this.t+a.t-n;
11709 r.s = 0; // assumes a,this >= 0
11710 while(--i >= 0) r[i] = 0;
11711 for(i = Math.max(n-this.t,0); i < a.t; ++i)
11712 r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
11713 r.clamp();
11714 r.drShiftTo(1,r);
11715 }
11716
11717 // Barrett modular reduction
11718 function Barrett(m) {
11719 // setup Barrett
11720 this.r2 = nbi();
11721 this.q3 = nbi();
11722 BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
11723 this.mu = this.r2.divide(m);
11724 this.m = m;
11725 }
11726
11727 function barrettConvert(x) {
11728 if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
11729 else if(x.compareTo(this.m) < 0) return x;
11730 else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
11731 }
11732
11733 function barrettRevert(x) { return x; }
11734
11735 // x = x mod m (HAC 14.42)
11736 function barrettReduce(x) {
11737 x.drShiftTo(this.m.t-1,this.r2);
11738 if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
11739 this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
11740 this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
11741 while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
11742 x.subTo(this.r2,x);
11743 while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
11744 }
11745
11746 // r = x^2 mod m; x != r
11747 function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
11748
11749 // r = x*y mod m; x,y != r
11750 function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
11751
11752 Barrett.prototype.convert = barrettConvert;
11753 Barrett.prototype.revert = barrettRevert;
11754 Barrett.prototype.reduce = barrettReduce;
11755 Barrett.prototype.mulTo = barrettMulTo;
11756 Barrett.prototype.sqrTo = barrettSqrTo;
11757
11758 // (public) this^e % m (HAC 14.85)
11759 function bnModPow(e,m) {
11760 var i = e.bitLength(), k, r = nbv(1), z;
11761 if(i <= 0) return r;
11762 else if(i < 18) k = 1;
11763 else if(i < 48) k = 3;
11764 else if(i < 144) k = 4;
11765 else if(i < 768) k = 5;
11766 else k = 6;
11767 if(i < 8)
11768 z = new Classic(m);
11769 else if(m.isEven())
11770 z = new Barrett(m);
11771 else
11772 z = new Montgomery(m);
11773
11774 // precomputation
11775 var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
11776 g[1] = z.convert(this);
11777 if(k > 1) {
11778 var g2 = nbi();
11779 z.sqrTo(g[1],g2);
11780 while(n <= km) {
11781 g[n] = nbi();
11782 z.mulTo(g2,g[n-2],g[n]);
11783 n += 2;
11784 }
11785 }
11786
11787 var j = e.t-1, w, is1 = true, r2 = nbi(), t;
11788 i = nbits(e[j])-1;
11789 while(j >= 0) {
11790 if(i >= k1) w = (e[j]>>(i-k1))&km;
11791 else {
11792 w = (e[j]&((1<<(i+1))-1))<<(k1-i);
11793 if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
11794 }
11795
11796 n = k;
11797 while((w&1) == 0) { w >>= 1; --n; }
11798 if((i -= n) < 0) { i += this.DB; --j; }
11799 if(is1) { // ret == 1, don't bother squaring or multiplying it
11800 g[w].copyTo(r);
11801 is1 = false;
11802 }
11803 else {
11804 while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
11805 if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
11806 z.mulTo(r2,g[w],r);
11807 }
11808
11809 while(j >= 0 && (e[j]&(1<<i)) == 0) {
11810 z.sqrTo(r,r2); t = r; r = r2; r2 = t;
11811 if(--i < 0) { i = this.DB-1; --j; }
11812 }
11813 }
11814 return z.revert(r);
11815 }
11816
11817 // (public) gcd(this,a) (HAC 14.54)
11818 function bnGCD(a) {
11819 var x = (this.s<0)?this.negate():this.clone();
11820 var y = (a.s<0)?a.negate():a.clone();
11821 if(x.compareTo(y) < 0) { var t = x; x = y; y = t; }
11822 var i = x.getLowestSetBit(), g = y.getLowestSetBit();
11823 if(g < 0) return x;
11824 if(i < g) g = i;
11825 if(g > 0) {
11826 x.rShiftTo(g,x);
11827 y.rShiftTo(g,y);
11828 }
11829 while(x.signum() > 0) {
11830 if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
11831 if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
11832 if(x.compareTo(y) >= 0) {
11833 x.subTo(y,x);
11834 x.rShiftTo(1,x);
11835 }
11836 else {
11837 y.subTo(x,y);
11838 y.rShiftTo(1,y);
11839 }
11840 }
11841 if(g > 0) y.lShiftTo(g,y);
11842 return y;
11843 }
11844
11845 // (protected) this % n, n < 2^26
11846 function bnpModInt(n) {
11847 if(n <= 0) return 0;
11848 var d = this.DV%n, r = (this.s<0)?n-1:0;
11849 if(this.t > 0)
11850 if(d == 0) r = this[0]%n;
11851 else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
11852 return r;
11853 }
11854
11855 // (public) 1/this % m (HAC 14.61)
11856 function bnModInverse(m) {
11857 var ac = m.isEven();
11858 if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
11859 var u = m.clone(), v = this.clone();
11860 var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
11861 while(u.signum() != 0) {
11862 while(u.isEven()) {
11863 u.rShiftTo(1,u);
11864 if(ac) {
11865 if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
11866 a.rShiftTo(1,a);
11867 }
11868 else if(!b.isEven()) b.subTo(m,b);
11869 b.rShiftTo(1,b);
11870 }
11871 while(v.isEven()) {
11872 v.rShiftTo(1,v);
11873 if(ac) {
11874 if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
11875 c.rShiftTo(1,c);
11876 }
11877 else if(!d.isEven()) d.subTo(m,d);
11878 d.rShiftTo(1,d);
11879 }
11880 if(u.compareTo(v) >= 0) {
11881 u.subTo(v,u);
11882 if(ac) a.subTo(c,a);
11883 b.subTo(d,b);
11884 }
11885 else {
11886 v.subTo(u,v);
11887 if(ac) c.subTo(a,c);
11888 d.subTo(b,d);
11889 }
11890 }
11891 if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
11892 if(d.compareTo(m) >= 0) return d.subtract(m);
11893 if(d.signum() < 0) d.addTo(m,d); else return d;
11894 if(d.signum() < 0) return d.add(m); else return d;
11895 }
11896
11897 var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];
11898 var lplim = (1<<26)/lowprimes[lowprimes.length-1];
11899
11900 // (public) test primality with certainty >= 1-.5^t
11901 function bnIsProbablePrime(t) {
11902 var i, x = this.abs();
11903 if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) {
11904 for(i = 0; i < lowprimes.length; ++i)
11905 if(x[0] == lowprimes[i]) return true;
11906 return false;
11907 }
11908 if(x.isEven()) return false;
11909 i = 1;
11910 while(i < lowprimes.length) {
11911 var m = lowprimes[i], j = i+1;
11912 while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
11913 m = x.modInt(m);
11914 while(i < j) if(m%lowprimes[i++] == 0) return false;
11915 }
11916 return x.millerRabin(t);
11917 }
11918
11919 // (protected) true if probably prime (HAC 4.24, Miller-Rabin)
11920 function bnpMillerRabin(t) {
11921 var n1 = this.subtract(BigInteger.ONE);
11922 var k = n1.getLowestSetBit();
11923 if(k <= 0) return false;
11924 var r = n1.shiftRight(k);
11925 t = (t+1)>>1;
11926 if(t > lowprimes.length) t = lowprimes.length;
11927 var a = nbi();
11928 for(var i = 0; i < t; ++i) {
11929 //Pick bases at random, instead of starting at 2
11930 a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);
11931 var y = a.modPow(r,this);
11932 if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
11933 var j = 1;
11934 while(j++ < k && y.compareTo(n1) != 0) {
11935 y = y.modPowInt(2,this);
11936 if(y.compareTo(BigInteger.ONE) == 0) return false;
11937 }
11938 if(y.compareTo(n1) != 0) return false;
11939 }
11940 }
11941 return true;
11942 }
11943
11944 // protected
11945 BigInteger.prototype.chunkSize = bnpChunkSize;
11946 BigInteger.prototype.toRadix = bnpToRadix;
11947 BigInteger.prototype.fromRadix = bnpFromRadix;
11948 BigInteger.prototype.fromNumber = bnpFromNumber;
11949 BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
11950 BigInteger.prototype.changeBit = bnpChangeBit;
11951 BigInteger.prototype.addTo = bnpAddTo;
11952 BigInteger.prototype.dMultiply = bnpDMultiply;
11953 BigInteger.prototype.dAddOffset = bnpDAddOffset;
11954 BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
11955 BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
11956 BigInteger.prototype.modInt = bnpModInt;
11957 BigInteger.prototype.millerRabin = bnpMillerRabin;
11958
11959 // public
11960 BigInteger.prototype.clone = bnClone;
11961 BigInteger.prototype.intValue = bnIntValue;
11962 BigInteger.prototype.byteValue = bnByteValue;
11963 BigInteger.prototype.shortValue = bnShortValue;
11964 BigInteger.prototype.signum = bnSigNum;
11965 BigInteger.prototype.toByteArray = bnToByteArray;
11966 BigInteger.prototype.equals = bnEquals;
11967 BigInteger.prototype.min = bnMin;
11968 BigInteger.prototype.max = bnMax;
11969 BigInteger.prototype.and = bnAnd;
11970 BigInteger.prototype.or = bnOr;
11971 BigInteger.prototype.xor = bnXor;
11972 BigInteger.prototype.andNot = bnAndNot;
11973 BigInteger.prototype.not = bnNot;
11974 BigInteger.prototype.shiftLeft = bnShiftLeft;
11975 BigInteger.prototype.shiftRight = bnShiftRight;
11976 BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
11977 BigInteger.prototype.bitCount = bnBitCount;
11978 BigInteger.prototype.testBit = bnTestBit;
11979 BigInteger.prototype.setBit = bnSetBit;
11980 BigInteger.prototype.clearBit = bnClearBit;
11981 BigInteger.prototype.flipBit = bnFlipBit;
11982 BigInteger.prototype.add = bnAdd;
11983 BigInteger.prototype.subtract = bnSubtract;
11984 BigInteger.prototype.multiply = bnMultiply;
11985 BigInteger.prototype.divide = bnDivide;
11986 BigInteger.prototype.remainder = bnRemainder;
11987 BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
11988 BigInteger.prototype.modPow = bnModPow;
11989 BigInteger.prototype.modInverse = bnModInverse;
11990 BigInteger.prototype.pow = bnPow;
11991 BigInteger.prototype.gcd = bnGCD;
11992 BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
11993
11994 // JSBN-specific extension
11995 BigInteger.prototype.square = bnSquare;
11996
11997 // Expose the Barrett function
11998 BigInteger.prototype.Barrett = Barrett
11999
12000 // BigInteger interfaces not implemented in jsbn:
12001
12002 // BigInteger(int signum, byte[] magnitude)
12003 // double doubleValue()
12004 // float floatValue()
12005 // int hashCode()
12006 // long longValue()
12007 // static BigInteger valueOf(long val)
12008
12009 // Random number generator - requires a PRNG backend, e.g. prng4.js
12010
12011 // For best results, put code like
12012 // <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
12013 // in your main HTML document.
12014
12015 var rng_state;
12016 var rng_pool;
12017 var rng_pptr;
12018
12019 // Mix in a 32-bit integer into the pool
12020 function rng_seed_int(x) {
12021 rng_pool[rng_pptr++] ^= x & 255;
12022 rng_pool[rng_pptr++] ^= (x >> 8) & 255;
12023 rng_pool[rng_pptr++] ^= (x >> 16) & 255;
12024 rng_pool[rng_pptr++] ^= (x >> 24) & 255;
12025 if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
12026 }
12027
12028 // Mix in the current time (w/milliseconds) into the pool
12029 function rng_seed_time() {
12030 rng_seed_int(new Date().getTime());
12031 }
12032
12033 // Initialize the pool with junk if needed.
12034 if(rng_pool == null) {
12035 rng_pool = new Array();
12036 rng_pptr = 0;
12037 var t;
12038 if(typeof window !== "undefined" && window.crypto) {
12039 if (window.crypto.getRandomValues) {
12040 // Use webcrypto if available
12041 var ua = new Uint8Array(32);
12042 window.crypto.getRandomValues(ua);
12043 for(t = 0; t < 32; ++t)
12044 rng_pool[rng_pptr++] = ua[t];
12045 }
12046 else if(navigator.appName == "Netscape" && navigator.appVersion < "5") {
12047 // Extract entropy (256 bits) from NS4 RNG if available
12048 var z = window.crypto.random(32);
12049 for(t = 0; t < z.length; ++t)
12050 rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
12051 }
12052 }
12053 while(rng_pptr < rng_psize) { // extract some randomness from Math.random()
12054 t = Math.floor(65536 * Math.random());
12055 rng_pool[rng_pptr++] = t >>> 8;
12056 rng_pool[rng_pptr++] = t & 255;
12057 }
12058 rng_pptr = 0;
12059 rng_seed_time();
12060 //rng_seed_int(window.screenX);
12061 //rng_seed_int(window.screenY);
12062 }
12063
12064 function rng_get_byte() {
12065 if(rng_state == null) {
12066 rng_seed_time();
12067 rng_state = prng_newstate();
12068 rng_state.init(rng_pool);
12069 for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
12070 rng_pool[rng_pptr] = 0;
12071 rng_pptr = 0;
12072 //rng_pool = null;
12073 }
12074 // TODO: allow reseeding after first request
12075 return rng_state.next();
12076 }
12077
12078 function rng_get_bytes(ba) {
12079 var i;
12080 for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
12081 }
12082
12083 function SecureRandom() {}
12084
12085 SecureRandom.prototype.nextBytes = rng_get_bytes;
12086
12087 // prng4.js - uses Arcfour as a PRNG
12088
12089 function Arcfour() {
12090 this.i = 0;
12091 this.j = 0;
12092 this.S = new Array();
12093 }
12094
12095 // Initialize arcfour context from key, an array of ints, each from [0..255]
12096 function ARC4init(key) {
12097 var i, j, t;
12098 for(i = 0; i < 256; ++i)
12099 this.S[i] = i;
12100 j = 0;
12101 for(i = 0; i < 256; ++i) {
12102 j = (j + this.S[i] + key[i % key.length]) & 255;
12103 t = this.S[i];
12104 this.S[i] = this.S[j];
12105 this.S[j] = t;
12106 }
12107 this.i = 0;
12108 this.j = 0;
12109 }
12110
12111 function ARC4next() {
12112 var t;
12113 this.i = (this.i + 1) & 255;
12114 this.j = (this.j + this.S[this.i]) & 255;
12115 t = this.S[this.i];
12116 this.S[this.i] = this.S[this.j];
12117 this.S[this.j] = t;
12118 return this.S[(t + this.S[this.i]) & 255];
12119 }
12120
12121 Arcfour.prototype.init = ARC4init;
12122 Arcfour.prototype.next = ARC4next;
12123
12124 // Plug in your RNG constructor here
12125 function prng_newstate() {
12126 return new Arcfour();
12127 }
12128
12129 // Pool size must be a multiple of 4 and greater than 32.
12130 // An array of bytes the size of the pool will be passed to init()
12131 var rng_psize = 256;
12132
12133 if (true) {
12134 exports = module.exports = {
12135 default: BigInteger,
12136 BigInteger: BigInteger,
12137 SecureRandom: SecureRandom,
12138 };
12139 } else {
12140 this.jsbn = {
12141 BigInteger: BigInteger,
12142 SecureRandom: SecureRandom
12143 };
12144 }
12145
12146}).call(this);
12147
12148
12149/***/ }),
12150/* 127 */
12151/***/ (function(module, exports, __webpack_require__) {
12152
12153"use strict";
12154
12155
12156
12157var zlib_inflate = __webpack_require__(152);
12158var utils = __webpack_require__(28);
12159var strings = __webpack_require__(146);
12160var c = __webpack_require__(148);
12161var msg = __webpack_require__(154);
12162var ZStream = __webpack_require__(155);
12163var GZheader = __webpack_require__(150);
12164
12165var toString = Object.prototype.toString;
12166
12167/**
12168 * class Inflate
12169 *
12170 * Generic JS-style wrapper for zlib calls. If you don't need
12171 * streaming behaviour - use more simple functions: [[inflate]]
12172 * and [[inflateRaw]].
12173 **/
12174
12175/* internal
12176 * inflate.chunks -> Array
12177 *
12178 * Chunks of output data, if [[Inflate#onData]] not overriden.
12179 **/
12180
12181/**
12182 * Inflate.result -> Uint8Array|Array|String
12183 *
12184 * Uncompressed result, generated by default [[Inflate#onData]]
12185 * and [[Inflate#onEnd]] handlers. Filled after you push last chunk
12186 * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
12187 * push a chunk with explicit flush (call [[Inflate#push]] with
12188 * `Z_SYNC_FLUSH` param).
12189 **/
12190
12191/**
12192 * Inflate.err -> Number
12193 *
12194 * Error code after inflate finished. 0 (Z_OK) on success.
12195 * Should be checked if broken data possible.
12196 **/
12197
12198/**
12199 * Inflate.msg -> String
12200 *
12201 * Error message, if [[Inflate.err]] != 0
12202 **/
12203
12204
12205/**
12206 * new Inflate(options)
12207 * - options (Object): zlib inflate options.
12208 *
12209 * Creates new inflator instance with specified params. Throws exception
12210 * on bad params. Supported options:
12211 *
12212 * - `windowBits`
12213 * - `dictionary`
12214 *
12215 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
12216 * for more information on these.
12217 *
12218 * Additional options, for internal needs:
12219 *
12220 * - `chunkSize` - size of generated data chunks (16K by default)
12221 * - `raw` (Boolean) - do raw inflate
12222 * - `to` (String) - if equal to 'string', then result will be converted
12223 * from utf8 to utf16 (javascript) string. When string output requested,
12224 * chunk length can differ from `chunkSize`, depending on content.
12225 *
12226 * By default, when no options set, autodetect deflate/gzip data format via
12227 * wrapper header.
12228 *
12229 * ##### Example:
12230 *
12231 * ```javascript
12232 * var pako = require('pako')
12233 * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])
12234 * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);
12235 *
12236 * var inflate = new pako.Inflate({ level: 3});
12237 *
12238 * inflate.push(chunk1, false);
12239 * inflate.push(chunk2, true); // true -> last chunk
12240 *
12241 * if (inflate.err) { throw new Error(inflate.err); }
12242 *
12243 * console.log(inflate.result);
12244 * ```
12245 **/
12246function Inflate(options) {
12247 if (!(this instanceof Inflate)) return new Inflate(options);
12248
12249 this.options = utils.assign({
12250 chunkSize: 16384,
12251 windowBits: 0,
12252 to: ''
12253 }, options || {});
12254
12255 var opt = this.options;
12256
12257 // Force window size for `raw` data, if not set directly,
12258 // because we have no header for autodetect.
12259 if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
12260 opt.windowBits = -opt.windowBits;
12261 if (opt.windowBits === 0) { opt.windowBits = -15; }
12262 }
12263
12264 // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
12265 if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
12266 !(options && options.windowBits)) {
12267 opt.windowBits += 32;
12268 }
12269
12270 // Gzip header has no info about windows size, we can do autodetect only
12271 // for deflate. So, if window size not set, force it to max when gzip possible
12272 if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
12273 // bit 3 (16) -> gzipped data
12274 // bit 4 (32) -> autodetect gzip/deflate
12275 if ((opt.windowBits & 15) === 0) {
12276 opt.windowBits |= 15;
12277 }
12278 }
12279
12280 this.err = 0; // error code, if happens (0 = Z_OK)
12281 this.msg = ''; // error message
12282 this.ended = false; // used to avoid multiple onEnd() calls
12283 this.chunks = []; // chunks of compressed data
12284
12285 this.strm = new ZStream();
12286 this.strm.avail_out = 0;
12287
12288 var status = zlib_inflate.inflateInit2(
12289 this.strm,
12290 opt.windowBits
12291 );
12292
12293 if (status !== c.Z_OK) {
12294 throw new Error(msg[status]);
12295 }
12296
12297 this.header = new GZheader();
12298
12299 zlib_inflate.inflateGetHeader(this.strm, this.header);
12300}
12301
12302/**
12303 * Inflate#push(data[, mode]) -> Boolean
12304 * - data (Uint8Array|Array|ArrayBuffer|String): input data
12305 * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
12306 * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH.
12307 *
12308 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
12309 * new output chunks. Returns `true` on success. The last data block must have
12310 * mode Z_FINISH (or `true`). That will flush internal pending buffers and call
12311 * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
12312 * can use mode Z_SYNC_FLUSH, keeping the decompression context.
12313 *
12314 * On fail call [[Inflate#onEnd]] with error code and return false.
12315 *
12316 * We strongly recommend to use `Uint8Array` on input for best speed (output
12317 * format is detected automatically). Also, don't skip last param and always
12318 * use the same type in your code (boolean or number). That will improve JS speed.
12319 *
12320 * For regular `Array`-s make sure all elements are [0..255].
12321 *
12322 * ##### Example
12323 *
12324 * ```javascript
12325 * push(chunk, false); // push one of data chunks
12326 * ...
12327 * push(chunk, true); // push last chunk
12328 * ```
12329 **/
12330Inflate.prototype.push = function (data, mode) {
12331 var strm = this.strm;
12332 var chunkSize = this.options.chunkSize;
12333 var dictionary = this.options.dictionary;
12334 var status, _mode;
12335 var next_out_utf8, tail, utf8str;
12336 var dict;
12337
12338 // Flag to properly process Z_BUF_ERROR on testing inflate call
12339 // when we check that all output data was flushed.
12340 var allowBufError = false;
12341
12342 if (this.ended) { return false; }
12343 _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
12344
12345 // Convert data if needed
12346 if (typeof data === 'string') {
12347 // Only binary strings can be decompressed on practice
12348 strm.input = strings.binstring2buf(data);
12349 } else if (toString.call(data) === '[object ArrayBuffer]') {
12350 strm.input = new Uint8Array(data);
12351 } else {
12352 strm.input = data;
12353 }
12354
12355 strm.next_in = 0;
12356 strm.avail_in = strm.input.length;
12357
12358 do {
12359 if (strm.avail_out === 0) {
12360 strm.output = new utils.Buf8(chunkSize);
12361 strm.next_out = 0;
12362 strm.avail_out = chunkSize;
12363 }
12364
12365 status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
12366
12367 if (status === c.Z_NEED_DICT && dictionary) {
12368 // Convert data if needed
12369 if (typeof dictionary === 'string') {
12370 dict = strings.string2buf(dictionary);
12371 } else if (toString.call(dictionary) === '[object ArrayBuffer]') {
12372 dict = new Uint8Array(dictionary);
12373 } else {
12374 dict = dictionary;
12375 }
12376
12377 status = zlib_inflate.inflateSetDictionary(this.strm, dict);
12378
12379 }
12380
12381 if (status === c.Z_BUF_ERROR && allowBufError === true) {
12382 status = c.Z_OK;
12383 allowBufError = false;
12384 }
12385
12386 if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
12387 this.onEnd(status);
12388 this.ended = true;
12389 return false;
12390 }
12391
12392 if (strm.next_out) {
12393 if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
12394
12395 if (this.options.to === 'string') {
12396
12397 next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
12398
12399 tail = strm.next_out - next_out_utf8;
12400 utf8str = strings.buf2string(strm.output, next_out_utf8);
12401
12402 // move tail
12403 strm.next_out = tail;
12404 strm.avail_out = chunkSize - tail;
12405 if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }
12406
12407 this.onData(utf8str);
12408
12409 } else {
12410 this.onData(utils.shrinkBuf(strm.output, strm.next_out));
12411 }
12412 }
12413 }
12414
12415 // When no more input data, we should check that internal inflate buffers
12416 // are flushed. The only way to do it when avail_out = 0 - run one more
12417 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
12418 // Here we set flag to process this error properly.
12419 //
12420 // NOTE. Deflate does not return error in this case and does not needs such
12421 // logic.
12422 if (strm.avail_in === 0 && strm.avail_out === 0) {
12423 allowBufError = true;
12424 }
12425
12426 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
12427
12428 if (status === c.Z_STREAM_END) {
12429 _mode = c.Z_FINISH;
12430 }
12431
12432 // Finalize on the last chunk.
12433 if (_mode === c.Z_FINISH) {
12434 status = zlib_inflate.inflateEnd(this.strm);
12435 this.onEnd(status);
12436 this.ended = true;
12437 return status === c.Z_OK;
12438 }
12439
12440 // callback interim results if Z_SYNC_FLUSH.
12441 if (_mode === c.Z_SYNC_FLUSH) {
12442 this.onEnd(c.Z_OK);
12443 strm.avail_out = 0;
12444 return true;
12445 }
12446
12447 return true;
12448};
12449
12450
12451/**
12452 * Inflate#onData(chunk) -> Void
12453 * - chunk (Uint8Array|Array|String): ouput data. Type of array depends
12454 * on js engine support. When string output requested, each chunk
12455 * will be string.
12456 *
12457 * By default, stores data blocks in `chunks[]` property and glue
12458 * those in `onEnd`. Override this handler, if you need another behaviour.
12459 **/
12460Inflate.prototype.onData = function (chunk) {
12461 this.chunks.push(chunk);
12462};
12463
12464
12465/**
12466 * Inflate#onEnd(status) -> Void
12467 * - status (Number): inflate status. 0 (Z_OK) on success,
12468 * other if not.
12469 *
12470 * Called either after you tell inflate that the input stream is
12471 * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
12472 * or if an error happened. By default - join collected chunks,
12473 * free memory and fill `results` / `err` properties.
12474 **/
12475Inflate.prototype.onEnd = function (status) {
12476 // On success - join
12477 if (status === c.Z_OK) {
12478 if (this.options.to === 'string') {
12479 // Glue & convert here, until we teach pako to send
12480 // utf8 alligned strings to onData
12481 this.result = this.chunks.join('');
12482 } else {
12483 this.result = utils.flattenChunks(this.chunks);
12484 }
12485 }
12486 this.chunks = [];
12487 this.err = status;
12488 this.msg = this.strm.msg;
12489};
12490
12491
12492/**
12493 * inflate(data[, options]) -> Uint8Array|Array|String
12494 * - data (Uint8Array|Array|String): input data to decompress.
12495 * - options (Object): zlib inflate options.
12496 *
12497 * Decompress `data` with inflate/ungzip and `options`. Autodetect
12498 * format via wrapper header by default. That's why we don't provide
12499 * separate `ungzip` method.
12500 *
12501 * Supported options are:
12502 *
12503 * - windowBits
12504 *
12505 * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
12506 * for more information.
12507 *
12508 * Sugar (options):
12509 *
12510 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
12511 * negative windowBits implicitly.
12512 * - `to` (String) - if equal to 'string', then result will be converted
12513 * from utf8 to utf16 (javascript) string. When string output requested,
12514 * chunk length can differ from `chunkSize`, depending on content.
12515 *
12516 *
12517 * ##### Example:
12518 *
12519 * ```javascript
12520 * var pako = require('pako')
12521 * , input = pako.deflate([1,2,3,4,5,6,7,8,9])
12522 * , output;
12523 *
12524 * try {
12525 * output = pako.inflate(input);
12526 * } catch (err)
12527 * console.log(err);
12528 * }
12529 * ```
12530 **/
12531function inflate(input, options) {
12532 var inflator = new Inflate(options);
12533
12534 inflator.push(input, true);
12535
12536 // That will never happens, if you don't cheat with options :)
12537 if (inflator.err) { throw inflator.msg || msg[inflator.err]; }
12538
12539 return inflator.result;
12540}
12541
12542
12543/**
12544 * inflateRaw(data[, options]) -> Uint8Array|Array|String
12545 * - data (Uint8Array|Array|String): input data to decompress.
12546 * - options (Object): zlib inflate options.
12547 *
12548 * The same as [[inflate]], but creates raw data, without wrapper
12549 * (header and adler32 crc).
12550 **/
12551function inflateRaw(input, options) {
12552 options = options || {};
12553 options.raw = true;
12554 return inflate(input, options);
12555}
12556
12557
12558/**
12559 * ungzip(data[, options]) -> Uint8Array|Array|String
12560 * - data (Uint8Array|Array|String): input data to decompress.
12561 * - options (Object): zlib inflate options.
12562 *
12563 * Just shortcut to [[inflate]], because it autodetects format
12564 * by header.content. Done for convenience.
12565 **/
12566
12567
12568exports.Inflate = Inflate;
12569exports.inflate = inflate;
12570exports.inflateRaw = inflateRaw;
12571exports.ungzip = inflate;
12572
12573
12574/***/ }),
12575/* 128 */
12576/***/ (function(module, exports, __webpack_require__) {
12577
12578module.exports = {
12579 F: __webpack_require__(156),
12580 T: __webpack_require__(157),
12581 __: __webpack_require__(158),
12582 add: __webpack_require__(30),
12583 addIndex: __webpack_require__(159),
12584 adjust: __webpack_require__(66),
12585 all: __webpack_require__(160),
12586 allPass: __webpack_require__(161),
12587 always: __webpack_require__(19),
12588 and: __webpack_require__(67),
12589 any: __webpack_require__(68),
12590 anyPass: __webpack_require__(162),
12591 ap: __webpack_require__(46),
12592 aperture: __webpack_require__(163),
12593 append: __webpack_require__(164),
12594 apply: __webpack_require__(69),
12595 applySpec: __webpack_require__(165),
12596 ascend: __webpack_require__(166),
12597 assoc: __webpack_require__(31),
12598 assocPath: __webpack_require__(70),
12599 binary: __webpack_require__(167),
12600 bind: __webpack_require__(71),
12601 both: __webpack_require__(168),
12602 call: __webpack_require__(169),
12603 chain: __webpack_require__(47),
12604 clamp: __webpack_require__(170),
12605 clone: __webpack_require__(171),
12606 comparator: __webpack_require__(172),
12607 complement: __webpack_require__(173),
12608 compose: __webpack_require__(48),
12609 composeK: __webpack_require__(72),
12610 composeP: __webpack_require__(174),
12611 concat: __webpack_require__(49),
12612 cond: __webpack_require__(175),
12613 construct: __webpack_require__(176),
12614 constructN: __webpack_require__(73),
12615 contains: __webpack_require__(177),
12616 converge: __webpack_require__(74),
12617 countBy: __webpack_require__(178),
12618 curry: __webpack_require__(32),
12619 curryN: __webpack_require__(5),
12620 dec: __webpack_require__(179),
12621 descend: __webpack_require__(180),
12622 defaultTo: __webpack_require__(75),
12623 difference: __webpack_require__(76),
12624 differenceWith: __webpack_require__(77),
12625 dissoc: __webpack_require__(78),
12626 dissocPath: __webpack_require__(181),
12627 divide: __webpack_require__(182),
12628 drop: __webpack_require__(79),
12629 dropLast: __webpack_require__(183),
12630 dropLastWhile: __webpack_require__(184),
12631 dropRepeats: __webpack_require__(185),
12632 dropRepeatsWith: __webpack_require__(80),
12633 dropWhile: __webpack_require__(186),
12634 either: __webpack_require__(187),
12635 empty: __webpack_require__(81),
12636 eqBy: __webpack_require__(188),
12637 eqProps: __webpack_require__(189),
12638 equals: __webpack_require__(11),
12639 evolve: __webpack_require__(190),
12640 filter: __webpack_require__(50),
12641 find: __webpack_require__(191),
12642 findIndex: __webpack_require__(192),
12643 findLast: __webpack_require__(193),
12644 findLastIndex: __webpack_require__(194),
12645 flatten: __webpack_require__(195),
12646 flip: __webpack_require__(33),
12647 forEach: __webpack_require__(196),
12648 forEachObjIndexed: __webpack_require__(197),
12649 fromPairs: __webpack_require__(198),
12650 groupBy: __webpack_require__(199),
12651 groupWith: __webpack_require__(200),
12652 gt: __webpack_require__(201),
12653 gte: __webpack_require__(202),
12654 has: __webpack_require__(203),
12655 hasIn: __webpack_require__(204),
12656 head: __webpack_require__(205),
12657 identical: __webpack_require__(82),
12658 identity: __webpack_require__(51),
12659 ifElse: __webpack_require__(206),
12660 inc: __webpack_require__(207),
12661 indexBy: __webpack_require__(208),
12662 indexOf: __webpack_require__(209),
12663 init: __webpack_require__(210),
12664 insert: __webpack_require__(211),
12665 insertAll: __webpack_require__(212),
12666 intersection: __webpack_require__(247),
12667 intersectionWith: __webpack_require__(248),
12668 intersperse: __webpack_require__(249),
12669 into: __webpack_require__(250),
12670 invert: __webpack_require__(251),
12671 invertObj: __webpack_require__(252),
12672 invoker: __webpack_require__(22),
12673 is: __webpack_require__(97),
12674 isArrayLike: __webpack_require__(23),
12675 isEmpty: __webpack_require__(253),
12676 isNil: __webpack_require__(254),
12677 join: __webpack_require__(255),
12678 juxt: __webpack_require__(98),
12679 keys: __webpack_require__(13),
12680 keysIn: __webpack_require__(256),
12681 last: __webpack_require__(99),
12682 lastIndexOf: __webpack_require__(257),
12683 length: __webpack_require__(100),
12684 lens: __webpack_require__(39),
12685 lensIndex: __webpack_require__(258),
12686 lensPath: __webpack_require__(259),
12687 lensProp: __webpack_require__(260),
12688 lift: __webpack_require__(40),
12689 liftN: __webpack_require__(101),
12690 lt: __webpack_require__(261),
12691 lte: __webpack_require__(262),
12692 map: __webpack_require__(7),
12693 mapAccum: __webpack_require__(263),
12694 mapAccumRight: __webpack_require__(264),
12695 mapObjIndexed: __webpack_require__(265),
12696 match: __webpack_require__(266),
12697 mathMod: __webpack_require__(267),
12698 max: __webpack_require__(20),
12699 maxBy: __webpack_require__(268),
12700 mean: __webpack_require__(102),
12701 median: __webpack_require__(269),
12702 memoize: __webpack_require__(270),
12703 merge: __webpack_require__(271),
12704 mergeAll: __webpack_require__(272),
12705 mergeWith: __webpack_require__(273),
12706 mergeWithKey: __webpack_require__(103),
12707 min: __webpack_require__(274),
12708 minBy: __webpack_require__(275),
12709 modulo: __webpack_require__(276),
12710 multiply: __webpack_require__(104),
12711 nAry: __webpack_require__(41),
12712 negate: __webpack_require__(277),
12713 none: __webpack_require__(278),
12714 not: __webpack_require__(105),
12715 nth: __webpack_require__(24),
12716 nthArg: __webpack_require__(279),
12717 objOf: __webpack_require__(106),
12718 of: __webpack_require__(280),
12719 omit: __webpack_require__(281),
12720 once: __webpack_require__(282),
12721 or: __webpack_require__(107),
12722 over: __webpack_require__(108),
12723 pair: __webpack_require__(283),
12724 partial: __webpack_require__(284),
12725 partialRight: __webpack_require__(285),
12726 partition: __webpack_require__(286),
12727 path: __webpack_require__(25),
12728 pathEq: __webpack_require__(287),
12729 pathOr: __webpack_require__(288),
12730 pathSatisfies: __webpack_require__(289),
12731 pick: __webpack_require__(290),
12732 pickAll: __webpack_require__(109),
12733 pickBy: __webpack_require__(291),
12734 pipe: __webpack_require__(110),
12735 pipeK: __webpack_require__(292),
12736 pipeP: __webpack_require__(111),
12737 pluck: __webpack_require__(26),
12738 prepend: __webpack_require__(112),
12739 product: __webpack_require__(293),
12740 project: __webpack_require__(294),
12741 prop: __webpack_require__(56),
12742 propEq: __webpack_require__(295),
12743 propIs: __webpack_require__(296),
12744 propOr: __webpack_require__(297),
12745 propSatisfies: __webpack_require__(298),
12746 props: __webpack_require__(299),
12747 range: __webpack_require__(300),
12748 reduce: __webpack_require__(14),
12749 reduceBy: __webpack_require__(42),
12750 reduceRight: __webpack_require__(113),
12751 reduceWhile: __webpack_require__(301),
12752 reduced: __webpack_require__(302),
12753 reject: __webpack_require__(43),
12754 remove: __webpack_require__(303),
12755 repeat: __webpack_require__(304),
12756 replace: __webpack_require__(305),
12757 reverse: __webpack_require__(44),
12758 scan: __webpack_require__(306),
12759 sequence: __webpack_require__(114),
12760 set: __webpack_require__(307),
12761 slice: __webpack_require__(18),
12762 sort: __webpack_require__(308),
12763 sortBy: __webpack_require__(309),
12764 sortWith: __webpack_require__(310),
12765 split: __webpack_require__(311),
12766 splitAt: __webpack_require__(312),
12767 splitEvery: __webpack_require__(313),
12768 splitWhen: __webpack_require__(314),
12769 subtract: __webpack_require__(315),
12770 sum: __webpack_require__(115),
12771 symmetricDifference: __webpack_require__(316),
12772 symmetricDifferenceWith: __webpack_require__(317),
12773 tail: __webpack_require__(57),
12774 take: __webpack_require__(116),
12775 takeLast: __webpack_require__(318),
12776 takeLastWhile: __webpack_require__(319),
12777 takeWhile: __webpack_require__(320),
12778 tap: __webpack_require__(321),
12779 test: __webpack_require__(322),
12780 times: __webpack_require__(117),
12781 toLower: __webpack_require__(323),
12782 toPairs: __webpack_require__(324),
12783 toPairsIn: __webpack_require__(325),
12784 toString: __webpack_require__(27),
12785 toUpper: __webpack_require__(326),
12786 transduce: __webpack_require__(327),
12787 transpose: __webpack_require__(328),
12788 traverse: __webpack_require__(329),
12789 trim: __webpack_require__(330),
12790 tryCatch: __webpack_require__(331),
12791 type: __webpack_require__(58),
12792 unapply: __webpack_require__(332),
12793 unary: __webpack_require__(333),
12794 uncurryN: __webpack_require__(334),
12795 unfold: __webpack_require__(335),
12796 union: __webpack_require__(336),
12797 unionWith: __webpack_require__(337),
12798 uniq: __webpack_require__(59),
12799 uniqBy: __webpack_require__(118),
12800 uniqWith: __webpack_require__(60),
12801 unless: __webpack_require__(338),
12802 unnest: __webpack_require__(339),
12803 until: __webpack_require__(340),
12804 update: __webpack_require__(119),
12805 useWith: __webpack_require__(120),
12806 values: __webpack_require__(121),
12807 valuesIn: __webpack_require__(341),
12808 view: __webpack_require__(342),
12809 when: __webpack_require__(343),
12810 where: __webpack_require__(122),
12811 whereEq: __webpack_require__(344),
12812 without: __webpack_require__(345),
12813 xprod: __webpack_require__(346),
12814 zip: __webpack_require__(347),
12815 zipObj: __webpack_require__(348),
12816 zipWith: __webpack_require__(349)
12817};
12818
12819
12820/***/ }),
12821/* 129 */
12822/***/ (function(module, exports, __webpack_require__) {
12823
12824"use strict";
12825
12826
12827var utils = __webpack_require__(8);
12828var bind = __webpack_require__(65);
12829var Axios = __webpack_require__(131);
12830var defaults = __webpack_require__(45);
12831
12832/**
12833 * Create an instance of Axios
12834 *
12835 * @param {Object} defaultConfig The default config for the instance
12836 * @return {Axios} A new instance of Axios
12837 */
12838function createInstance(defaultConfig) {
12839 var context = new Axios(defaultConfig);
12840 var instance = bind(Axios.prototype.request, context);
12841
12842 // Copy axios.prototype to instance
12843 utils.extend(instance, Axios.prototype, context);
12844
12845 // Copy context to instance
12846 utils.extend(instance, context);
12847
12848 return instance;
12849}
12850
12851// Create the default instance to be exported
12852var axios = createInstance(defaults);
12853
12854// Expose Axios class to allow class inheritance
12855axios.Axios = Axios;
12856
12857// Factory for creating new instances
12858axios.create = function create(instanceConfig) {
12859 return createInstance(utils.merge(defaults, instanceConfig));
12860};
12861
12862// Expose Cancel & CancelToken
12863axios.Cancel = __webpack_require__(62);
12864axios.CancelToken = __webpack_require__(130);
12865axios.isCancel = __webpack_require__(63);
12866
12867// Expose all/spread
12868axios.all = function all(promises) {
12869 return Promise.all(promises);
12870};
12871axios.spread = __webpack_require__(145);
12872
12873module.exports = axios;
12874
12875// Allow use of default import syntax in TypeScript
12876module.exports.default = axios;
12877
12878
12879/***/ }),
12880/* 130 */
12881/***/ (function(module, exports, __webpack_require__) {
12882
12883"use strict";
12884
12885
12886var Cancel = __webpack_require__(62);
12887
12888/**
12889 * A `CancelToken` is an object that can be used to request cancellation of an operation.
12890 *
12891 * @class
12892 * @param {Function} executor The executor function.
12893 */
12894function CancelToken(executor) {
12895 if (typeof executor !== 'function') {
12896 throw new TypeError('executor must be a function.');
12897 }
12898
12899 var resolvePromise;
12900 this.promise = new Promise(function promiseExecutor(resolve) {
12901 resolvePromise = resolve;
12902 });
12903
12904 var token = this;
12905 executor(function cancel(message) {
12906 if (token.reason) {
12907 // Cancellation has already been requested
12908 return;
12909 }
12910
12911 token.reason = new Cancel(message);
12912 resolvePromise(token.reason);
12913 });
12914}
12915
12916/**
12917 * Throws a `Cancel` if cancellation has been requested.
12918 */
12919CancelToken.prototype.throwIfRequested = function throwIfRequested() {
12920 if (this.reason) {
12921 throw this.reason;
12922 }
12923};
12924
12925/**
12926 * Returns an object that contains a new `CancelToken` and a function that, when called,
12927 * cancels the `CancelToken`.
12928 */
12929CancelToken.source = function source() {
12930 var cancel;
12931 var token = new CancelToken(function executor(c) {
12932 cancel = c;
12933 });
12934 return {
12935 token: token,
12936 cancel: cancel
12937 };
12938};
12939
12940module.exports = CancelToken;
12941
12942
12943/***/ }),
12944/* 131 */
12945/***/ (function(module, exports, __webpack_require__) {
12946
12947"use strict";
12948
12949
12950var defaults = __webpack_require__(45);
12951var utils = __webpack_require__(8);
12952var InterceptorManager = __webpack_require__(132);
12953var dispatchRequest = __webpack_require__(133);
12954var isAbsoluteURL = __webpack_require__(141);
12955var combineURLs = __webpack_require__(139);
12956
12957/**
12958 * Create a new instance of Axios
12959 *
12960 * @param {Object} instanceConfig The default config for the instance
12961 */
12962function Axios(instanceConfig) {
12963 this.defaults = instanceConfig;
12964 this.interceptors = {
12965 request: new InterceptorManager(),
12966 response: new InterceptorManager()
12967 };
12968}
12969
12970/**
12971 * Dispatch a request
12972 *
12973 * @param {Object} config The config specific for this request (merged with this.defaults)
12974 */
12975Axios.prototype.request = function request(config) {
12976 /*eslint no-param-reassign:0*/
12977 // Allow for axios('example/url'[, config]) a la fetch API
12978 if (typeof config === 'string') {
12979 config = utils.merge({
12980 url: arguments[0]
12981 }, arguments[1]);
12982 }
12983
12984 config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
12985
12986 // Support baseURL config
12987 if (config.baseURL && !isAbsoluteURL(config.url)) {
12988 config.url = combineURLs(config.baseURL, config.url);
12989 }
12990
12991 // Hook up interceptors middleware
12992 var chain = [dispatchRequest, undefined];
12993 var promise = Promise.resolve(config);
12994
12995 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
12996 chain.unshift(interceptor.fulfilled, interceptor.rejected);
12997 });
12998
12999 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
13000 chain.push(interceptor.fulfilled, interceptor.rejected);
13001 });
13002
13003 while (chain.length) {
13004 promise = promise.then(chain.shift(), chain.shift());
13005 }
13006
13007 return promise;
13008};
13009
13010// Provide aliases for supported request methods
13011utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
13012 /*eslint func-names:0*/
13013 Axios.prototype[method] = function(url, config) {
13014 return this.request(utils.merge(config || {}, {
13015 method: method,
13016 url: url
13017 }));
13018 };
13019});
13020
13021utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
13022 /*eslint func-names:0*/
13023 Axios.prototype[method] = function(url, data, config) {
13024 return this.request(utils.merge(config || {}, {
13025 method: method,
13026 url: url,
13027 data: data
13028 }));
13029 };
13030});
13031
13032module.exports = Axios;
13033
13034
13035/***/ }),
13036/* 132 */
13037/***/ (function(module, exports, __webpack_require__) {
13038
13039"use strict";
13040
13041
13042var utils = __webpack_require__(8);
13043
13044function InterceptorManager() {
13045 this.handlers = [];
13046}
13047
13048/**
13049 * Add a new interceptor to the stack
13050 *
13051 * @param {Function} fulfilled The function to handle `then` for a `Promise`
13052 * @param {Function} rejected The function to handle `reject` for a `Promise`
13053 *
13054 * @return {Number} An ID used to remove interceptor later
13055 */
13056InterceptorManager.prototype.use = function use(fulfilled, rejected) {
13057 this.handlers.push({
13058 fulfilled: fulfilled,
13059 rejected: rejected
13060 });
13061 return this.handlers.length - 1;
13062};
13063
13064/**
13065 * Remove an interceptor from the stack
13066 *
13067 * @param {Number} id The ID that was returned by `use`
13068 */
13069InterceptorManager.prototype.eject = function eject(id) {
13070 if (this.handlers[id]) {
13071 this.handlers[id] = null;
13072 }
13073};
13074
13075/**
13076 * Iterate over all the registered interceptors
13077 *
13078 * This method is particularly useful for skipping over any
13079 * interceptors that may have become `null` calling `eject`.
13080 *
13081 * @param {Function} fn The function to call for each interceptor
13082 */
13083InterceptorManager.prototype.forEach = function forEach(fn) {
13084 utils.forEach(this.handlers, function forEachHandler(h) {
13085 if (h !== null) {
13086 fn(h);
13087 }
13088 });
13089};
13090
13091module.exports = InterceptorManager;
13092
13093
13094/***/ }),
13095/* 133 */
13096/***/ (function(module, exports, __webpack_require__) {
13097
13098"use strict";
13099
13100
13101var utils = __webpack_require__(8);
13102var transformData = __webpack_require__(136);
13103var isCancel = __webpack_require__(63);
13104var defaults = __webpack_require__(45);
13105
13106/**
13107 * Throws a `Cancel` if cancellation has been requested.
13108 */
13109function throwIfCancellationRequested(config) {
13110 if (config.cancelToken) {
13111 config.cancelToken.throwIfRequested();
13112 }
13113}
13114
13115/**
13116 * Dispatch a request to the server using the configured adapter.
13117 *
13118 * @param {object} config The config that is to be used for the request
13119 * @returns {Promise} The Promise to be fulfilled
13120 */
13121module.exports = function dispatchRequest(config) {
13122 throwIfCancellationRequested(config);
13123
13124 // Ensure headers exist
13125 config.headers = config.headers || {};
13126
13127 // Transform request data
13128 config.data = transformData(
13129 config.data,
13130 config.headers,
13131 config.transformRequest
13132 );
13133
13134 // Flatten headers
13135 config.headers = utils.merge(
13136 config.headers.common || {},
13137 config.headers[config.method] || {},
13138 config.headers || {}
13139 );
13140
13141 utils.forEach(
13142 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
13143 function cleanHeaderConfig(method) {
13144 delete config.headers[method];
13145 }
13146 );
13147
13148 var adapter = config.adapter || defaults.adapter;
13149
13150 return adapter(config).then(function onAdapterResolution(response) {
13151 throwIfCancellationRequested(config);
13152
13153 // Transform response data
13154 response.data = transformData(
13155 response.data,
13156 response.headers,
13157 config.transformResponse
13158 );
13159
13160 return response;
13161 }, function onAdapterRejection(reason) {
13162 if (!isCancel(reason)) {
13163 throwIfCancellationRequested(config);
13164
13165 // Transform response data
13166 if (reason && reason.response) {
13167 reason.response.data = transformData(
13168 reason.response.data,
13169 reason.response.headers,
13170 config.transformResponse
13171 );
13172 }
13173 }
13174
13175 return Promise.reject(reason);
13176 });
13177};
13178
13179
13180/***/ }),
13181/* 134 */
13182/***/ (function(module, exports, __webpack_require__) {
13183
13184"use strict";
13185
13186
13187/**
13188 * Update an Error with the specified config, error code, and response.
13189 *
13190 * @param {Error} error The error to update.
13191 * @param {Object} config The config.
13192 * @param {string} [code] The error code (for example, 'ECONNABORTED').
13193 @ @param {Object} [response] The response.
13194 * @returns {Error} The error.
13195 */
13196module.exports = function enhanceError(error, config, code, response) {
13197 error.config = config;
13198 if (code) {
13199 error.code = code;
13200 }
13201 error.response = response;
13202 return error;
13203};
13204
13205
13206/***/ }),
13207/* 135 */
13208/***/ (function(module, exports, __webpack_require__) {
13209
13210"use strict";
13211
13212
13213var createError = __webpack_require__(64);
13214
13215/**
13216 * Resolve or reject a Promise based on response status.
13217 *
13218 * @param {Function} resolve A function that resolves the promise.
13219 * @param {Function} reject A function that rejects the promise.
13220 * @param {object} response The response.
13221 */
13222module.exports = function settle(resolve, reject, response) {
13223 var validateStatus = response.config.validateStatus;
13224 // Note: status is not exposed by XDomainRequest
13225 if (!response.status || !validateStatus || validateStatus(response.status)) {
13226 resolve(response);
13227 } else {
13228 reject(createError(
13229 'Request failed with status code ' + response.status,
13230 response.config,
13231 null,
13232 response
13233 ));
13234 }
13235};
13236
13237
13238/***/ }),
13239/* 136 */
13240/***/ (function(module, exports, __webpack_require__) {
13241
13242"use strict";
13243
13244
13245var utils = __webpack_require__(8);
13246
13247/**
13248 * Transform the data for a request or a response
13249 *
13250 * @param {Object|String} data The data to be transformed
13251 * @param {Array} headers The headers for the request or response
13252 * @param {Array|Function} fns A single function or Array of functions
13253 * @returns {*} The resulting transformed data
13254 */
13255module.exports = function transformData(data, headers, fns) {
13256 /*eslint no-param-reassign:0*/
13257 utils.forEach(fns, function transform(fn) {
13258 data = fn(data, headers);
13259 });
13260
13261 return data;
13262};
13263
13264
13265/***/ }),
13266/* 137 */
13267/***/ (function(module, exports, __webpack_require__) {
13268
13269"use strict";
13270
13271
13272// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
13273
13274var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
13275
13276function E() {
13277 this.message = 'String contains an invalid character';
13278}
13279E.prototype = new Error;
13280E.prototype.code = 5;
13281E.prototype.name = 'InvalidCharacterError';
13282
13283function btoa(input) {
13284 var str = String(input);
13285 var output = '';
13286 for (
13287 // initialize result and counter
13288 var block, charCode, idx = 0, map = chars;
13289 // if the next str index does not exist:
13290 // change the mapping table to "="
13291 // check if d has no fractional digits
13292 str.charAt(idx | 0) || (map = '=', idx % 1);
13293 // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
13294 output += map.charAt(63 & block >> 8 - idx % 1 * 8)
13295 ) {
13296 charCode = str.charCodeAt(idx += 3 / 4);
13297 if (charCode > 0xFF) {
13298 throw new E();
13299 }
13300 block = block << 8 | charCode;
13301 }
13302 return output;
13303}
13304
13305module.exports = btoa;
13306
13307
13308/***/ }),
13309/* 138 */
13310/***/ (function(module, exports, __webpack_require__) {
13311
13312"use strict";
13313
13314
13315var utils = __webpack_require__(8);
13316
13317function encode(val) {
13318 return encodeURIComponent(val).
13319 replace(/%40/gi, '@').
13320 replace(/%3A/gi, ':').
13321 replace(/%24/g, '$').
13322 replace(/%2C/gi, ',').
13323 replace(/%20/g, '+').
13324 replace(/%5B/gi, '[').
13325 replace(/%5D/gi, ']');
13326}
13327
13328/**
13329 * Build a URL by appending params to the end
13330 *
13331 * @param {string} url The base of the url (e.g., http://www.google.com)
13332 * @param {object} [params] The params to be appended
13333 * @returns {string} The formatted url
13334 */
13335module.exports = function buildURL(url, params, paramsSerializer) {
13336 /*eslint no-param-reassign:0*/
13337 if (!params) {
13338 return url;
13339 }
13340
13341 var serializedParams;
13342 if (paramsSerializer) {
13343 serializedParams = paramsSerializer(params);
13344 } else if (utils.isURLSearchParams(params)) {
13345 serializedParams = params.toString();
13346 } else {
13347 var parts = [];
13348
13349 utils.forEach(params, function serialize(val, key) {
13350 if (val === null || typeof val === 'undefined') {
13351 return;
13352 }
13353
13354 if (utils.isArray(val)) {
13355 key = key + '[]';
13356 }
13357
13358 if (!utils.isArray(val)) {
13359 val = [val];
13360 }
13361
13362 utils.forEach(val, function parseValue(v) {
13363 if (utils.isDate(v)) {
13364 v = v.toISOString();
13365 } else if (utils.isObject(v)) {
13366 v = JSON.stringify(v);
13367 }
13368 parts.push(encode(key) + '=' + encode(v));
13369 });
13370 });
13371
13372 serializedParams = parts.join('&');
13373 }
13374
13375 if (serializedParams) {
13376 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
13377 }
13378
13379 return url;
13380};
13381
13382
13383/***/ }),
13384/* 139 */
13385/***/ (function(module, exports, __webpack_require__) {
13386
13387"use strict";
13388
13389
13390/**
13391 * Creates a new URL by combining the specified URLs
13392 *
13393 * @param {string} baseURL The base URL
13394 * @param {string} relativeURL The relative URL
13395 * @returns {string} The combined URL
13396 */
13397module.exports = function combineURLs(baseURL, relativeURL) {
13398 return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
13399};
13400
13401
13402/***/ }),
13403/* 140 */
13404/***/ (function(module, exports, __webpack_require__) {
13405
13406"use strict";
13407
13408
13409var utils = __webpack_require__(8);
13410
13411module.exports = (
13412 utils.isStandardBrowserEnv() ?
13413
13414 // Standard browser envs support document.cookie
13415 (function standardBrowserEnv() {
13416 return {
13417 write: function write(name, value, expires, path, domain, secure) {
13418 var cookie = [];
13419 cookie.push(name + '=' + encodeURIComponent(value));
13420
13421 if (utils.isNumber(expires)) {
13422 cookie.push('expires=' + new Date(expires).toGMTString());
13423 }
13424
13425 if (utils.isString(path)) {
13426 cookie.push('path=' + path);
13427 }
13428
13429 if (utils.isString(domain)) {
13430 cookie.push('domain=' + domain);
13431 }
13432
13433 if (secure === true) {
13434 cookie.push('secure');
13435 }
13436
13437 document.cookie = cookie.join('; ');
13438 },
13439
13440 read: function read(name) {
13441 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
13442 return (match ? decodeURIComponent(match[3]) : null);
13443 },
13444
13445 remove: function remove(name) {
13446 this.write(name, '', Date.now() - 86400000);
13447 }
13448 };
13449 })() :
13450
13451 // Non standard browser env (web workers, react-native) lack needed support.
13452 (function nonStandardBrowserEnv() {
13453 return {
13454 write: function write() {},
13455 read: function read() { return null; },
13456 remove: function remove() {}
13457 };
13458 })()
13459);
13460
13461
13462/***/ }),
13463/* 141 */
13464/***/ (function(module, exports, __webpack_require__) {
13465
13466"use strict";
13467
13468
13469/**
13470 * Determines whether the specified URL is absolute
13471 *
13472 * @param {string} url The URL to test
13473 * @returns {boolean} True if the specified URL is absolute, otherwise false
13474 */
13475module.exports = function isAbsoluteURL(url) {
13476 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
13477 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
13478 // by any combination of letters, digits, plus, period, or hyphen.
13479 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
13480};
13481
13482
13483/***/ }),
13484/* 142 */
13485/***/ (function(module, exports, __webpack_require__) {
13486
13487"use strict";
13488
13489
13490var utils = __webpack_require__(8);
13491
13492module.exports = (
13493 utils.isStandardBrowserEnv() ?
13494
13495 // Standard browser envs have full support of the APIs needed to test
13496 // whether the request URL is of the same origin as current location.
13497 (function standardBrowserEnv() {
13498 var msie = /(msie|trident)/i.test(navigator.userAgent);
13499 var urlParsingNode = document.createElement('a');
13500 var originURL;
13501
13502 /**
13503 * Parse a URL to discover it's components
13504 *
13505 * @param {String} url The URL to be parsed
13506 * @returns {Object}
13507 */
13508 function resolveURL(url) {
13509 var href = url;
13510
13511 if (msie) {
13512 // IE needs attribute set twice to normalize properties
13513 urlParsingNode.setAttribute('href', href);
13514 href = urlParsingNode.href;
13515 }
13516
13517 urlParsingNode.setAttribute('href', href);
13518
13519 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
13520 return {
13521 href: urlParsingNode.href,
13522 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
13523 host: urlParsingNode.host,
13524 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
13525 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
13526 hostname: urlParsingNode.hostname,
13527 port: urlParsingNode.port,
13528 pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
13529 urlParsingNode.pathname :
13530 '/' + urlParsingNode.pathname
13531 };
13532 }
13533
13534 originURL = resolveURL(window.location.href);
13535
13536 /**
13537 * Determine if a URL shares the same origin as the current location
13538 *
13539 * @param {String} requestURL The URL to test
13540 * @returns {boolean} True if URL shares the same origin, otherwise false
13541 */
13542 return function isURLSameOrigin(requestURL) {
13543 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
13544 return (parsed.protocol === originURL.protocol &&
13545 parsed.host === originURL.host);
13546 };
13547 })() :
13548
13549 // Non standard browser envs (web workers, react-native) lack needed support.
13550 (function nonStandardBrowserEnv() {
13551 return function isURLSameOrigin() {
13552 return true;
13553 };
13554 })()
13555);
13556
13557
13558/***/ }),
13559/* 143 */
13560/***/ (function(module, exports, __webpack_require__) {
13561
13562"use strict";
13563
13564
13565var utils = __webpack_require__(8);
13566
13567module.exports = function normalizeHeaderName(headers, normalizedName) {
13568 utils.forEach(headers, function processHeader(value, name) {
13569 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
13570 headers[normalizedName] = value;
13571 delete headers[name];
13572 }
13573 });
13574};
13575
13576
13577/***/ }),
13578/* 144 */
13579/***/ (function(module, exports, __webpack_require__) {
13580
13581"use strict";
13582
13583
13584var utils = __webpack_require__(8);
13585
13586/**
13587 * Parse headers into an object
13588 *
13589 * ```
13590 * Date: Wed, 27 Aug 2014 08:58:49 GMT
13591 * Content-Type: application/json
13592 * Connection: keep-alive
13593 * Transfer-Encoding: chunked
13594 * ```
13595 *
13596 * @param {String} headers Headers needing to be parsed
13597 * @returns {Object} Headers parsed into an object
13598 */
13599module.exports = function parseHeaders(headers) {
13600 var parsed = {};
13601 var key;
13602 var val;
13603 var i;
13604
13605 if (!headers) { return parsed; }
13606
13607 utils.forEach(headers.split('\n'), function parser(line) {
13608 i = line.indexOf(':');
13609 key = utils.trim(line.substr(0, i)).toLowerCase();
13610 val = utils.trim(line.substr(i + 1));
13611
13612 if (key) {
13613 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
13614 }
13615 });
13616
13617 return parsed;
13618};
13619
13620
13621/***/ }),
13622/* 145 */
13623/***/ (function(module, exports, __webpack_require__) {
13624
13625"use strict";
13626
13627
13628/**
13629 * Syntactic sugar for invoking a function and expanding an array for arguments.
13630 *
13631 * Common use case would be to use `Function.prototype.apply`.
13632 *
13633 * ```js
13634 * function f(x, y, z) {}
13635 * var args = [1, 2, 3];
13636 * f.apply(null, args);
13637 * ```
13638 *
13639 * With `spread` this example can be re-written.
13640 *
13641 * ```js
13642 * spread(function(x, y, z) {})([1, 2, 3]);
13643 * ```
13644 *
13645 * @param {Function} callback
13646 * @returns {Function}
13647 */
13648module.exports = function spread(callback) {
13649 return function wrap(arr) {
13650 return callback.apply(null, arr);
13651 };
13652};
13653
13654
13655/***/ }),
13656/* 146 */
13657/***/ (function(module, exports, __webpack_require__) {
13658
13659"use strict";
13660// String encode/decode helpers
13661
13662
13663
13664var utils = __webpack_require__(28);
13665
13666
13667// Quick check if we can use fast array to bin string conversion
13668//
13669// - apply(Array) can fail on Android 2.2
13670// - apply(Uint8Array) can fail on iOS 5.1 Safary
13671//
13672var STR_APPLY_OK = true;
13673var STR_APPLY_UIA_OK = true;
13674
13675try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }
13676try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
13677
13678
13679// Table with utf8 lengths (calculated by first byte of sequence)
13680// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
13681// because max possible codepoint is 0x10ffff
13682var _utf8len = new utils.Buf8(256);
13683for (var q = 0; q < 256; q++) {
13684 _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
13685}
13686_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
13687
13688
13689// convert string to array (typed, when possible)
13690exports.string2buf = function (str) {
13691 var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
13692
13693 // count binary size
13694 for (m_pos = 0; m_pos < str_len; m_pos++) {
13695 c = str.charCodeAt(m_pos);
13696 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
13697 c2 = str.charCodeAt(m_pos + 1);
13698 if ((c2 & 0xfc00) === 0xdc00) {
13699 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
13700 m_pos++;
13701 }
13702 }
13703 buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
13704 }
13705
13706 // allocate buffer
13707 buf = new utils.Buf8(buf_len);
13708
13709 // convert
13710 for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
13711 c = str.charCodeAt(m_pos);
13712 if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
13713 c2 = str.charCodeAt(m_pos + 1);
13714 if ((c2 & 0xfc00) === 0xdc00) {
13715 c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
13716 m_pos++;
13717 }
13718 }
13719 if (c < 0x80) {
13720 /* one byte */
13721 buf[i++] = c;
13722 } else if (c < 0x800) {
13723 /* two bytes */
13724 buf[i++] = 0xC0 | (c >>> 6);
13725 buf[i++] = 0x80 | (c & 0x3f);
13726 } else if (c < 0x10000) {
13727 /* three bytes */
13728 buf[i++] = 0xE0 | (c >>> 12);
13729 buf[i++] = 0x80 | (c >>> 6 & 0x3f);
13730 buf[i++] = 0x80 | (c & 0x3f);
13731 } else {
13732 /* four bytes */
13733 buf[i++] = 0xf0 | (c >>> 18);
13734 buf[i++] = 0x80 | (c >>> 12 & 0x3f);
13735 buf[i++] = 0x80 | (c >>> 6 & 0x3f);
13736 buf[i++] = 0x80 | (c & 0x3f);
13737 }
13738 }
13739
13740 return buf;
13741};
13742
13743// Helper (used in 2 places)
13744function buf2binstring(buf, len) {
13745 // use fallback for big arrays to avoid stack overflow
13746 if (len < 65537) {
13747 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
13748 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
13749 }
13750 }
13751
13752 var result = '';
13753 for (var i = 0; i < len; i++) {
13754 result += String.fromCharCode(buf[i]);
13755 }
13756 return result;
13757}
13758
13759
13760// Convert byte array to binary string
13761exports.buf2binstring = function (buf) {
13762 return buf2binstring(buf, buf.length);
13763};
13764
13765
13766// Convert binary string (typed, when possible)
13767exports.binstring2buf = function (str) {
13768 var buf = new utils.Buf8(str.length);
13769 for (var i = 0, len = buf.length; i < len; i++) {
13770 buf[i] = str.charCodeAt(i);
13771 }
13772 return buf;
13773};
13774
13775
13776// convert array to string
13777exports.buf2string = function (buf, max) {
13778 var i, out, c, c_len;
13779 var len = max || buf.length;
13780
13781 // Reserve max possible length (2 words per char)
13782 // NB: by unknown reasons, Array is significantly faster for
13783 // String.fromCharCode.apply than Uint16Array.
13784 var utf16buf = new Array(len * 2);
13785
13786 for (out = 0, i = 0; i < len;) {
13787 c = buf[i++];
13788 // quick process ascii
13789 if (c < 0x80) { utf16buf[out++] = c; continue; }
13790
13791 c_len = _utf8len[c];
13792 // skip 5 & 6 byte codes
13793 if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
13794
13795 // apply mask on first byte
13796 c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
13797 // join the rest
13798 while (c_len > 1 && i < len) {
13799 c = (c << 6) | (buf[i++] & 0x3f);
13800 c_len--;
13801 }
13802
13803 // terminated by end of string?
13804 if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
13805
13806 if (c < 0x10000) {
13807 utf16buf[out++] = c;
13808 } else {
13809 c -= 0x10000;
13810 utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
13811 utf16buf[out++] = 0xdc00 | (c & 0x3ff);
13812 }
13813 }
13814
13815 return buf2binstring(utf16buf, out);
13816};
13817
13818
13819// Calculate max possible position in utf8 buffer,
13820// that will not break sequence. If that's not possible
13821// - (very small limits) return max size as is.
13822//
13823// buf[] - utf8 bytes array
13824// max - length limit (mandatory);
13825exports.utf8border = function (buf, max) {
13826 var pos;
13827
13828 max = max || buf.length;
13829 if (max > buf.length) { max = buf.length; }
13830
13831 // go back from last position, until start of sequence found
13832 pos = max - 1;
13833 while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
13834
13835 // Fuckup - very small and broken sequence,
13836 // return max, because we should return something anyway.
13837 if (pos < 0) { return max; }
13838
13839 // If we came to start of buffer - that means vuffer is too small,
13840 // return max too.
13841 if (pos === 0) { return max; }
13842
13843 return (pos + _utf8len[buf[pos]] > max) ? pos : max;
13844};
13845
13846
13847/***/ }),
13848/* 147 */
13849/***/ (function(module, exports, __webpack_require__) {
13850
13851"use strict";
13852
13853
13854// Note: adler32 takes 12% for level 0 and 2% for level 6.
13855// It doesn't worth to make additional optimizationa as in original.
13856// Small size is preferable.
13857
13858function adler32(adler, buf, len, pos) {
13859 var s1 = (adler & 0xffff) |0,
13860 s2 = ((adler >>> 16) & 0xffff) |0,
13861 n = 0;
13862
13863 while (len !== 0) {
13864 // Set limit ~ twice less than 5552, to keep
13865 // s2 in 31-bits, because we force signed ints.
13866 // in other case %= will fail.
13867 n = len > 2000 ? 2000 : len;
13868 len -= n;
13869
13870 do {
13871 s1 = (s1 + buf[pos++]) |0;
13872 s2 = (s2 + s1) |0;
13873 } while (--n);
13874
13875 s1 %= 65521;
13876 s2 %= 65521;
13877 }
13878
13879 return (s1 | (s2 << 16)) |0;
13880}
13881
13882
13883module.exports = adler32;
13884
13885
13886/***/ }),
13887/* 148 */
13888/***/ (function(module, exports, __webpack_require__) {
13889
13890"use strict";
13891
13892
13893
13894module.exports = {
13895
13896 /* Allowed flush values; see deflate() and inflate() below for details */
13897 Z_NO_FLUSH: 0,
13898 Z_PARTIAL_FLUSH: 1,
13899 Z_SYNC_FLUSH: 2,
13900 Z_FULL_FLUSH: 3,
13901 Z_FINISH: 4,
13902 Z_BLOCK: 5,
13903 Z_TREES: 6,
13904
13905 /* Return codes for the compression/decompression functions. Negative values
13906 * are errors, positive values are used for special but normal events.
13907 */
13908 Z_OK: 0,
13909 Z_STREAM_END: 1,
13910 Z_NEED_DICT: 2,
13911 Z_ERRNO: -1,
13912 Z_STREAM_ERROR: -2,
13913 Z_DATA_ERROR: -3,
13914 //Z_MEM_ERROR: -4,
13915 Z_BUF_ERROR: -5,
13916 //Z_VERSION_ERROR: -6,
13917
13918 /* compression levels */
13919 Z_NO_COMPRESSION: 0,
13920 Z_BEST_SPEED: 1,
13921 Z_BEST_COMPRESSION: 9,
13922 Z_DEFAULT_COMPRESSION: -1,
13923
13924
13925 Z_FILTERED: 1,
13926 Z_HUFFMAN_ONLY: 2,
13927 Z_RLE: 3,
13928 Z_FIXED: 4,
13929 Z_DEFAULT_STRATEGY: 0,
13930
13931 /* Possible values of the data_type field (though see inflate()) */
13932 Z_BINARY: 0,
13933 Z_TEXT: 1,
13934 //Z_ASCII: 1, // = Z_TEXT (deprecated)
13935 Z_UNKNOWN: 2,
13936
13937 /* The deflate compression method */
13938 Z_DEFLATED: 8
13939 //Z_NULL: null // Use -1 or null inline, depending on var type
13940};
13941
13942
13943/***/ }),
13944/* 149 */
13945/***/ (function(module, exports, __webpack_require__) {
13946
13947"use strict";
13948
13949
13950// Note: we can't get significant speed boost here.
13951// So write code to minimize size - no pregenerated tables
13952// and array tools dependencies.
13953
13954
13955// Use ordinary array, since untyped makes no boost here
13956function makeTable() {
13957 var c, table = [];
13958
13959 for (var n = 0; n < 256; n++) {
13960 c = n;
13961 for (var k = 0; k < 8; k++) {
13962 c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
13963 }
13964 table[n] = c;
13965 }
13966
13967 return table;
13968}
13969
13970// Create table on load. Just 255 signed longs. Not a problem.
13971var crcTable = makeTable();
13972
13973
13974function crc32(crc, buf, len, pos) {
13975 var t = crcTable,
13976 end = pos + len;
13977
13978 crc ^= -1;
13979
13980 for (var i = pos; i < end; i++) {
13981 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
13982 }
13983
13984 return (crc ^ (-1)); // >>> 0;
13985}
13986
13987
13988module.exports = crc32;
13989
13990
13991/***/ }),
13992/* 150 */
13993/***/ (function(module, exports, __webpack_require__) {
13994
13995"use strict";
13996
13997
13998
13999function GZheader() {
14000 /* true if compressed data believed to be text */
14001 this.text = 0;
14002 /* modification time */
14003 this.time = 0;
14004 /* extra flags (not used when writing a gzip file) */
14005 this.xflags = 0;
14006 /* operating system */
14007 this.os = 0;
14008 /* pointer to extra field or Z_NULL if none */
14009 this.extra = null;
14010 /* extra field length (valid if extra != Z_NULL) */
14011 this.extra_len = 0; // Actually, we don't need it in JS,
14012 // but leave for few code modifications
14013
14014 //
14015 // Setup limits is not necessary because in js we should not preallocate memory
14016 // for inflate use constant limit in 65536 bytes
14017 //
14018
14019 /* space at extra (only when reading header) */
14020 // this.extra_max = 0;
14021 /* pointer to zero-terminated file name or Z_NULL */
14022 this.name = '';
14023 /* space at name (only when reading header) */
14024 // this.name_max = 0;
14025 /* pointer to zero-terminated comment or Z_NULL */
14026 this.comment = '';
14027 /* space at comment (only when reading header) */
14028 // this.comm_max = 0;
14029 /* true if there was or will be a header crc */
14030 this.hcrc = 0;
14031 /* true when done reading gzip header (not used when writing a gzip file) */
14032 this.done = false;
14033}
14034
14035module.exports = GZheader;
14036
14037
14038/***/ }),
14039/* 151 */
14040/***/ (function(module, exports, __webpack_require__) {
14041
14042"use strict";
14043
14044
14045// See state defs from inflate.js
14046var BAD = 30; /* got a data error -- remain here until reset */
14047var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
14048
14049/*
14050 Decode literal, length, and distance codes and write out the resulting
14051 literal and match bytes until either not enough input or output is
14052 available, an end-of-block is encountered, or a data error is encountered.
14053 When large enough input and output buffers are supplied to inflate(), for
14054 example, a 16K input buffer and a 64K output buffer, more than 95% of the
14055 inflate execution time is spent in this routine.
14056
14057 Entry assumptions:
14058
14059 state.mode === LEN
14060 strm.avail_in >= 6
14061 strm.avail_out >= 258
14062 start >= strm.avail_out
14063 state.bits < 8
14064
14065 On return, state.mode is one of:
14066
14067 LEN -- ran out of enough output space or enough available input
14068 TYPE -- reached end of block code, inflate() to interpret next block
14069 BAD -- error in block data
14070
14071 Notes:
14072
14073 - The maximum input bits used by a length/distance pair is 15 bits for the
14074 length code, 5 bits for the length extra, 15 bits for the distance code,
14075 and 13 bits for the distance extra. This totals 48 bits, or six bytes.
14076 Therefore if strm.avail_in >= 6, then there is enough input to avoid
14077 checking for available input while decoding.
14078
14079 - The maximum bytes that a single length/distance pair can output is 258
14080 bytes, which is the maximum length that can be coded. inflate_fast()
14081 requires strm.avail_out >= 258 for each loop to avoid checking for
14082 output space.
14083 */
14084module.exports = function inflate_fast(strm, start) {
14085 var state;
14086 var _in; /* local strm.input */
14087 var last; /* have enough input while in < last */
14088 var _out; /* local strm.output */
14089 var beg; /* inflate()'s initial strm.output */
14090 var end; /* while out < end, enough space available */
14091//#ifdef INFLATE_STRICT
14092 var dmax; /* maximum distance from zlib header */
14093//#endif
14094 var wsize; /* window size or zero if not using window */
14095 var whave; /* valid bytes in the window */
14096 var wnext; /* window write index */
14097 // Use `s_window` instead `window`, avoid conflict with instrumentation tools
14098 var s_window; /* allocated sliding window, if wsize != 0 */
14099 var hold; /* local strm.hold */
14100 var bits; /* local strm.bits */
14101 var lcode; /* local strm.lencode */
14102 var dcode; /* local strm.distcode */
14103 var lmask; /* mask for first level of length codes */
14104 var dmask; /* mask for first level of distance codes */
14105 var here; /* retrieved table entry */
14106 var op; /* code bits, operation, extra bits, or */
14107 /* window position, window bytes to copy */
14108 var len; /* match length, unused bytes */
14109 var dist; /* match distance */
14110 var from; /* where to copy match from */
14111 var from_source;
14112
14113
14114 var input, output; // JS specific, because we have no pointers
14115
14116 /* copy state to local variables */
14117 state = strm.state;
14118 //here = state.here;
14119 _in = strm.next_in;
14120 input = strm.input;
14121 last = _in + (strm.avail_in - 5);
14122 _out = strm.next_out;
14123 output = strm.output;
14124 beg = _out - (start - strm.avail_out);
14125 end = _out + (strm.avail_out - 257);
14126//#ifdef INFLATE_STRICT
14127 dmax = state.dmax;
14128//#endif
14129 wsize = state.wsize;
14130 whave = state.whave;
14131 wnext = state.wnext;
14132 s_window = state.window;
14133 hold = state.hold;
14134 bits = state.bits;
14135 lcode = state.lencode;
14136 dcode = state.distcode;
14137 lmask = (1 << state.lenbits) - 1;
14138 dmask = (1 << state.distbits) - 1;
14139
14140
14141 /* decode literals and length/distances until end-of-block or not enough
14142 input data or output space */
14143
14144 top:
14145 do {
14146 if (bits < 15) {
14147 hold += input[_in++] << bits;
14148 bits += 8;
14149 hold += input[_in++] << bits;
14150 bits += 8;
14151 }
14152
14153 here = lcode[hold & lmask];
14154
14155 dolen:
14156 for (;;) { // Goto emulation
14157 op = here >>> 24/*here.bits*/;
14158 hold >>>= op;
14159 bits -= op;
14160 op = (here >>> 16) & 0xff/*here.op*/;
14161 if (op === 0) { /* literal */
14162 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
14163 // "inflate: literal '%c'\n" :
14164 // "inflate: literal 0x%02x\n", here.val));
14165 output[_out++] = here & 0xffff/*here.val*/;
14166 }
14167 else if (op & 16) { /* length base */
14168 len = here & 0xffff/*here.val*/;
14169 op &= 15; /* number of extra bits */
14170 if (op) {
14171 if (bits < op) {
14172 hold += input[_in++] << bits;
14173 bits += 8;
14174 }
14175 len += hold & ((1 << op) - 1);
14176 hold >>>= op;
14177 bits -= op;
14178 }
14179 //Tracevv((stderr, "inflate: length %u\n", len));
14180 if (bits < 15) {
14181 hold += input[_in++] << bits;
14182 bits += 8;
14183 hold += input[_in++] << bits;
14184 bits += 8;
14185 }
14186 here = dcode[hold & dmask];
14187
14188 dodist:
14189 for (;;) { // goto emulation
14190 op = here >>> 24/*here.bits*/;
14191 hold >>>= op;
14192 bits -= op;
14193 op = (here >>> 16) & 0xff/*here.op*/;
14194
14195 if (op & 16) { /* distance base */
14196 dist = here & 0xffff/*here.val*/;
14197 op &= 15; /* number of extra bits */
14198 if (bits < op) {
14199 hold += input[_in++] << bits;
14200 bits += 8;
14201 if (bits < op) {
14202 hold += input[_in++] << bits;
14203 bits += 8;
14204 }
14205 }
14206 dist += hold & ((1 << op) - 1);
14207//#ifdef INFLATE_STRICT
14208 if (dist > dmax) {
14209 strm.msg = 'invalid distance too far back';
14210 state.mode = BAD;
14211 break top;
14212 }
14213//#endif
14214 hold >>>= op;
14215 bits -= op;
14216 //Tracevv((stderr, "inflate: distance %u\n", dist));
14217 op = _out - beg; /* max distance in output */
14218 if (dist > op) { /* see if copy from window */
14219 op = dist - op; /* distance back in window */
14220 if (op > whave) {
14221 if (state.sane) {
14222 strm.msg = 'invalid distance too far back';
14223 state.mode = BAD;
14224 break top;
14225 }
14226
14227// (!) This block is disabled in zlib defailts,
14228// don't enable it for binary compatibility
14229//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
14230// if (len <= op - whave) {
14231// do {
14232// output[_out++] = 0;
14233// } while (--len);
14234// continue top;
14235// }
14236// len -= op - whave;
14237// do {
14238// output[_out++] = 0;
14239// } while (--op > whave);
14240// if (op === 0) {
14241// from = _out - dist;
14242// do {
14243// output[_out++] = output[from++];
14244// } while (--len);
14245// continue top;
14246// }
14247//#endif
14248 }
14249 from = 0; // window index
14250 from_source = s_window;
14251 if (wnext === 0) { /* very common case */
14252 from += wsize - op;
14253 if (op < len) { /* some from window */
14254 len -= op;
14255 do {
14256 output[_out++] = s_window[from++];
14257 } while (--op);
14258 from = _out - dist; /* rest from output */
14259 from_source = output;
14260 }
14261 }
14262 else if (wnext < op) { /* wrap around window */
14263 from += wsize + wnext - op;
14264 op -= wnext;
14265 if (op < len) { /* some from end of window */
14266 len -= op;
14267 do {
14268 output[_out++] = s_window[from++];
14269 } while (--op);
14270 from = 0;
14271 if (wnext < len) { /* some from start of window */
14272 op = wnext;
14273 len -= op;
14274 do {
14275 output[_out++] = s_window[from++];
14276 } while (--op);
14277 from = _out - dist; /* rest from output */
14278 from_source = output;
14279 }
14280 }
14281 }
14282 else { /* contiguous in window */
14283 from += wnext - op;
14284 if (op < len) { /* some from window */
14285 len -= op;
14286 do {
14287 output[_out++] = s_window[from++];
14288 } while (--op);
14289 from = _out - dist; /* rest from output */
14290 from_source = output;
14291 }
14292 }
14293 while (len > 2) {
14294 output[_out++] = from_source[from++];
14295 output[_out++] = from_source[from++];
14296 output[_out++] = from_source[from++];
14297 len -= 3;
14298 }
14299 if (len) {
14300 output[_out++] = from_source[from++];
14301 if (len > 1) {
14302 output[_out++] = from_source[from++];
14303 }
14304 }
14305 }
14306 else {
14307 from = _out - dist; /* copy direct from output */
14308 do { /* minimum length is three */
14309 output[_out++] = output[from++];
14310 output[_out++] = output[from++];
14311 output[_out++] = output[from++];
14312 len -= 3;
14313 } while (len > 2);
14314 if (len) {
14315 output[_out++] = output[from++];
14316 if (len > 1) {
14317 output[_out++] = output[from++];
14318 }
14319 }
14320 }
14321 }
14322 else if ((op & 64) === 0) { /* 2nd level distance code */
14323 here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
14324 continue dodist;
14325 }
14326 else {
14327 strm.msg = 'invalid distance code';
14328 state.mode = BAD;
14329 break top;
14330 }
14331
14332 break; // need to emulate goto via "continue"
14333 }
14334 }
14335 else if ((op & 64) === 0) { /* 2nd level length code */
14336 here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
14337 continue dolen;
14338 }
14339 else if (op & 32) { /* end-of-block */
14340 //Tracevv((stderr, "inflate: end of block\n"));
14341 state.mode = TYPE;
14342 break top;
14343 }
14344 else {
14345 strm.msg = 'invalid literal/length code';
14346 state.mode = BAD;
14347 break top;
14348 }
14349
14350 break; // need to emulate goto via "continue"
14351 }
14352 } while (_in < last && _out < end);
14353
14354 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
14355 len = bits >> 3;
14356 _in -= len;
14357 bits -= len << 3;
14358 hold &= (1 << bits) - 1;
14359
14360 /* update state and return */
14361 strm.next_in = _in;
14362 strm.next_out = _out;
14363 strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
14364 strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
14365 state.hold = hold;
14366 state.bits = bits;
14367 return;
14368};
14369
14370
14371/***/ }),
14372/* 152 */
14373/***/ (function(module, exports, __webpack_require__) {
14374
14375"use strict";
14376
14377
14378
14379var utils = __webpack_require__(28);
14380var adler32 = __webpack_require__(147);
14381var crc32 = __webpack_require__(149);
14382var inflate_fast = __webpack_require__(151);
14383var inflate_table = __webpack_require__(153);
14384
14385var CODES = 0;
14386var LENS = 1;
14387var DISTS = 2;
14388
14389/* Public constants ==========================================================*/
14390/* ===========================================================================*/
14391
14392
14393/* Allowed flush values; see deflate() and inflate() below for details */
14394//var Z_NO_FLUSH = 0;
14395//var Z_PARTIAL_FLUSH = 1;
14396//var Z_SYNC_FLUSH = 2;
14397//var Z_FULL_FLUSH = 3;
14398var Z_FINISH = 4;
14399var Z_BLOCK = 5;
14400var Z_TREES = 6;
14401
14402
14403/* Return codes for the compression/decompression functions. Negative values
14404 * are errors, positive values are used for special but normal events.
14405 */
14406var Z_OK = 0;
14407var Z_STREAM_END = 1;
14408var Z_NEED_DICT = 2;
14409//var Z_ERRNO = -1;
14410var Z_STREAM_ERROR = -2;
14411var Z_DATA_ERROR = -3;
14412var Z_MEM_ERROR = -4;
14413var Z_BUF_ERROR = -5;
14414//var Z_VERSION_ERROR = -6;
14415
14416/* The deflate compression method */
14417var Z_DEFLATED = 8;
14418
14419
14420/* STATES ====================================================================*/
14421/* ===========================================================================*/
14422
14423
14424var HEAD = 1; /* i: waiting for magic header */
14425var FLAGS = 2; /* i: waiting for method and flags (gzip) */
14426var TIME = 3; /* i: waiting for modification time (gzip) */
14427var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
14428var EXLEN = 5; /* i: waiting for extra length (gzip) */
14429var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
14430var NAME = 7; /* i: waiting for end of file name (gzip) */
14431var COMMENT = 8; /* i: waiting for end of comment (gzip) */
14432var HCRC = 9; /* i: waiting for header crc (gzip) */
14433var DICTID = 10; /* i: waiting for dictionary check value */
14434var DICT = 11; /* waiting for inflateSetDictionary() call */
14435var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
14436var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
14437var STORED = 14; /* i: waiting for stored size (length and complement) */
14438var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
14439var COPY = 16; /* i/o: waiting for input or output to copy stored block */
14440var TABLE = 17; /* i: waiting for dynamic block table lengths */
14441var LENLENS = 18; /* i: waiting for code length code lengths */
14442var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
14443var LEN_ = 20; /* i: same as LEN below, but only first time in */
14444var LEN = 21; /* i: waiting for length/lit/eob code */
14445var LENEXT = 22; /* i: waiting for length extra bits */
14446var DIST = 23; /* i: waiting for distance code */
14447var DISTEXT = 24; /* i: waiting for distance extra bits */
14448var MATCH = 25; /* o: waiting for output space to copy string */
14449var LIT = 26; /* o: waiting for output space to write literal */
14450var CHECK = 27; /* i: waiting for 32-bit check value */
14451var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
14452var DONE = 29; /* finished check, done -- remain here until reset */
14453var BAD = 30; /* got a data error -- remain here until reset */
14454var MEM = 31; /* got an inflate() memory error -- remain here until reset */
14455var SYNC = 32; /* looking for synchronization bytes to restart inflate() */
14456
14457/* ===========================================================================*/
14458
14459
14460
14461var ENOUGH_LENS = 852;
14462var ENOUGH_DISTS = 592;
14463//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
14464
14465var MAX_WBITS = 15;
14466/* 32K LZ77 window */
14467var DEF_WBITS = MAX_WBITS;
14468
14469
14470function zswap32(q) {
14471 return (((q >>> 24) & 0xff) +
14472 ((q >>> 8) & 0xff00) +
14473 ((q & 0xff00) << 8) +
14474 ((q & 0xff) << 24));
14475}
14476
14477
14478function InflateState() {
14479 this.mode = 0; /* current inflate mode */
14480 this.last = false; /* true if processing last block */
14481 this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
14482 this.havedict = false; /* true if dictionary provided */
14483 this.flags = 0; /* gzip header method and flags (0 if zlib) */
14484 this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
14485 this.check = 0; /* protected copy of check value */
14486 this.total = 0; /* protected copy of output count */
14487 // TODO: may be {}
14488 this.head = null; /* where to save gzip header information */
14489
14490 /* sliding window */
14491 this.wbits = 0; /* log base 2 of requested window size */
14492 this.wsize = 0; /* window size or zero if not using window */
14493 this.whave = 0; /* valid bytes in the window */
14494 this.wnext = 0; /* window write index */
14495 this.window = null; /* allocated sliding window, if needed */
14496
14497 /* bit accumulator */
14498 this.hold = 0; /* input bit accumulator */
14499 this.bits = 0; /* number of bits in "in" */
14500
14501 /* for string and stored block copying */
14502 this.length = 0; /* literal or length of data to copy */
14503 this.offset = 0; /* distance back to copy string from */
14504
14505 /* for table and code decoding */
14506 this.extra = 0; /* extra bits needed */
14507
14508 /* fixed and dynamic code tables */
14509 this.lencode = null; /* starting table for length/literal codes */
14510 this.distcode = null; /* starting table for distance codes */
14511 this.lenbits = 0; /* index bits for lencode */
14512 this.distbits = 0; /* index bits for distcode */
14513
14514 /* dynamic table building */
14515 this.ncode = 0; /* number of code length code lengths */
14516 this.nlen = 0; /* number of length code lengths */
14517 this.ndist = 0; /* number of distance code lengths */
14518 this.have = 0; /* number of code lengths in lens[] */
14519 this.next = null; /* next available space in codes[] */
14520
14521 this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
14522 this.work = new utils.Buf16(288); /* work area for code table building */
14523
14524 /*
14525 because we don't have pointers in js, we use lencode and distcode directly
14526 as buffers so we don't need codes
14527 */
14528 //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
14529 this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
14530 this.distdyn = null; /* dynamic table for distance codes (JS specific) */
14531 this.sane = 0; /* if false, allow invalid distance too far */
14532 this.back = 0; /* bits back of last unprocessed length/lit */
14533 this.was = 0; /* initial length of match */
14534}
14535
14536function inflateResetKeep(strm) {
14537 var state;
14538
14539 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
14540 state = strm.state;
14541 strm.total_in = strm.total_out = state.total = 0;
14542 strm.msg = ''; /*Z_NULL*/
14543 if (state.wrap) { /* to support ill-conceived Java test suite */
14544 strm.adler = state.wrap & 1;
14545 }
14546 state.mode = HEAD;
14547 state.last = 0;
14548 state.havedict = 0;
14549 state.dmax = 32768;
14550 state.head = null/*Z_NULL*/;
14551 state.hold = 0;
14552 state.bits = 0;
14553 //state.lencode = state.distcode = state.next = state.codes;
14554 state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
14555 state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
14556
14557 state.sane = 1;
14558 state.back = -1;
14559 //Tracev((stderr, "inflate: reset\n"));
14560 return Z_OK;
14561}
14562
14563function inflateReset(strm) {
14564 var state;
14565
14566 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
14567 state = strm.state;
14568 state.wsize = 0;
14569 state.whave = 0;
14570 state.wnext = 0;
14571 return inflateResetKeep(strm);
14572
14573}
14574
14575function inflateReset2(strm, windowBits) {
14576 var wrap;
14577 var state;
14578
14579 /* get the state */
14580 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
14581 state = strm.state;
14582
14583 /* extract wrap request from windowBits parameter */
14584 if (windowBits < 0) {
14585 wrap = 0;
14586 windowBits = -windowBits;
14587 }
14588 else {
14589 wrap = (windowBits >> 4) + 1;
14590 if (windowBits < 48) {
14591 windowBits &= 15;
14592 }
14593 }
14594
14595 /* set number of window bits, free window if different */
14596 if (windowBits && (windowBits < 8 || windowBits > 15)) {
14597 return Z_STREAM_ERROR;
14598 }
14599 if (state.window !== null && state.wbits !== windowBits) {
14600 state.window = null;
14601 }
14602
14603 /* update state and reset the rest of it */
14604 state.wrap = wrap;
14605 state.wbits = windowBits;
14606 return inflateReset(strm);
14607}
14608
14609function inflateInit2(strm, windowBits) {
14610 var ret;
14611 var state;
14612
14613 if (!strm) { return Z_STREAM_ERROR; }
14614 //strm.msg = Z_NULL; /* in case we return an error */
14615
14616 state = new InflateState();
14617
14618 //if (state === Z_NULL) return Z_MEM_ERROR;
14619 //Tracev((stderr, "inflate: allocated\n"));
14620 strm.state = state;
14621 state.window = null/*Z_NULL*/;
14622 ret = inflateReset2(strm, windowBits);
14623 if (ret !== Z_OK) {
14624 strm.state = null/*Z_NULL*/;
14625 }
14626 return ret;
14627}
14628
14629function inflateInit(strm) {
14630 return inflateInit2(strm, DEF_WBITS);
14631}
14632
14633
14634/*
14635 Return state with length and distance decoding tables and index sizes set to
14636 fixed code decoding. Normally this returns fixed tables from inffixed.h.
14637 If BUILDFIXED is defined, then instead this routine builds the tables the
14638 first time it's called, and returns those tables the first time and
14639 thereafter. This reduces the size of the code by about 2K bytes, in
14640 exchange for a little execution time. However, BUILDFIXED should not be
14641 used for threaded applications, since the rewriting of the tables and virgin
14642 may not be thread-safe.
14643 */
14644var virgin = true;
14645
14646var lenfix, distfix; // We have no pointers in JS, so keep tables separate
14647
14648function fixedtables(state) {
14649 /* build fixed huffman tables if first call (may not be thread safe) */
14650 if (virgin) {
14651 var sym;
14652
14653 lenfix = new utils.Buf32(512);
14654 distfix = new utils.Buf32(32);
14655
14656 /* literal/length table */
14657 sym = 0;
14658 while (sym < 144) { state.lens[sym++] = 8; }
14659 while (sym < 256) { state.lens[sym++] = 9; }
14660 while (sym < 280) { state.lens[sym++] = 7; }
14661 while (sym < 288) { state.lens[sym++] = 8; }
14662
14663 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
14664
14665 /* distance table */
14666 sym = 0;
14667 while (sym < 32) { state.lens[sym++] = 5; }
14668
14669 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
14670
14671 /* do this just once */
14672 virgin = false;
14673 }
14674
14675 state.lencode = lenfix;
14676 state.lenbits = 9;
14677 state.distcode = distfix;
14678 state.distbits = 5;
14679}
14680
14681
14682/*
14683 Update the window with the last wsize (normally 32K) bytes written before
14684 returning. If window does not exist yet, create it. This is only called
14685 when a window is already in use, or when output has been written during this
14686 inflate call, but the end of the deflate stream has not been reached yet.
14687 It is also called to create a window for dictionary data when a dictionary
14688 is loaded.
14689
14690 Providing output buffers larger than 32K to inflate() should provide a speed
14691 advantage, since only the last 32K of output is copied to the sliding window
14692 upon return from inflate(), and since all distances after the first 32K of
14693 output will fall in the output data, making match copies simpler and faster.
14694 The advantage may be dependent on the size of the processor's data caches.
14695 */
14696function updatewindow(strm, src, end, copy) {
14697 var dist;
14698 var state = strm.state;
14699
14700 /* if it hasn't been done already, allocate space for the window */
14701 if (state.window === null) {
14702 state.wsize = 1 << state.wbits;
14703 state.wnext = 0;
14704 state.whave = 0;
14705
14706 state.window = new utils.Buf8(state.wsize);
14707 }
14708
14709 /* copy state->wsize or less output bytes into the circular window */
14710 if (copy >= state.wsize) {
14711 utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
14712 state.wnext = 0;
14713 state.whave = state.wsize;
14714 }
14715 else {
14716 dist = state.wsize - state.wnext;
14717 if (dist > copy) {
14718 dist = copy;
14719 }
14720 //zmemcpy(state->window + state->wnext, end - copy, dist);
14721 utils.arraySet(state.window, src, end - copy, dist, state.wnext);
14722 copy -= dist;
14723 if (copy) {
14724 //zmemcpy(state->window, end - copy, copy);
14725 utils.arraySet(state.window, src, end - copy, copy, 0);
14726 state.wnext = copy;
14727 state.whave = state.wsize;
14728 }
14729 else {
14730 state.wnext += dist;
14731 if (state.wnext === state.wsize) { state.wnext = 0; }
14732 if (state.whave < state.wsize) { state.whave += dist; }
14733 }
14734 }
14735 return 0;
14736}
14737
14738function inflate(strm, flush) {
14739 var state;
14740 var input, output; // input/output buffers
14741 var next; /* next input INDEX */
14742 var put; /* next output INDEX */
14743 var have, left; /* available input and output */
14744 var hold; /* bit buffer */
14745 var bits; /* bits in bit buffer */
14746 var _in, _out; /* save starting available input and output */
14747 var copy; /* number of stored or match bytes to copy */
14748 var from; /* where to copy match bytes from */
14749 var from_source;
14750 var here = 0; /* current decoding table entry */
14751 var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
14752 //var last; /* parent table entry */
14753 var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
14754 var len; /* length to copy for repeats, bits to drop */
14755 var ret; /* return code */
14756 var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
14757 var opts;
14758
14759 var n; // temporary var for NEED_BITS
14760
14761 var order = /* permutation of code lengths */
14762 [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
14763
14764
14765 if (!strm || !strm.state || !strm.output ||
14766 (!strm.input && strm.avail_in !== 0)) {
14767 return Z_STREAM_ERROR;
14768 }
14769
14770 state = strm.state;
14771 if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */
14772
14773
14774 //--- LOAD() ---
14775 put = strm.next_out;
14776 output = strm.output;
14777 left = strm.avail_out;
14778 next = strm.next_in;
14779 input = strm.input;
14780 have = strm.avail_in;
14781 hold = state.hold;
14782 bits = state.bits;
14783 //---
14784
14785 _in = have;
14786 _out = left;
14787 ret = Z_OK;
14788
14789 inf_leave: // goto emulation
14790 for (;;) {
14791 switch (state.mode) {
14792 case HEAD:
14793 if (state.wrap === 0) {
14794 state.mode = TYPEDO;
14795 break;
14796 }
14797 //=== NEEDBITS(16);
14798 while (bits < 16) {
14799 if (have === 0) { break inf_leave; }
14800 have--;
14801 hold += input[next++] << bits;
14802 bits += 8;
14803 }
14804 //===//
14805 if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
14806 state.check = 0/*crc32(0L, Z_NULL, 0)*/;
14807 //=== CRC2(state.check, hold);
14808 hbuf[0] = hold & 0xff;
14809 hbuf[1] = (hold >>> 8) & 0xff;
14810 state.check = crc32(state.check, hbuf, 2, 0);
14811 //===//
14812
14813 //=== INITBITS();
14814 hold = 0;
14815 bits = 0;
14816 //===//
14817 state.mode = FLAGS;
14818 break;
14819 }
14820 state.flags = 0; /* expect zlib header */
14821 if (state.head) {
14822 state.head.done = false;
14823 }
14824 if (!(state.wrap & 1) || /* check if zlib header allowed */
14825 (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
14826 strm.msg = 'incorrect header check';
14827 state.mode = BAD;
14828 break;
14829 }
14830 if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
14831 strm.msg = 'unknown compression method';
14832 state.mode = BAD;
14833 break;
14834 }
14835 //--- DROPBITS(4) ---//
14836 hold >>>= 4;
14837 bits -= 4;
14838 //---//
14839 len = (hold & 0x0f)/*BITS(4)*/ + 8;
14840 if (state.wbits === 0) {
14841 state.wbits = len;
14842 }
14843 else if (len > state.wbits) {
14844 strm.msg = 'invalid window size';
14845 state.mode = BAD;
14846 break;
14847 }
14848 state.dmax = 1 << len;
14849 //Tracev((stderr, "inflate: zlib header ok\n"));
14850 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
14851 state.mode = hold & 0x200 ? DICTID : TYPE;
14852 //=== INITBITS();
14853 hold = 0;
14854 bits = 0;
14855 //===//
14856 break;
14857 case FLAGS:
14858 //=== NEEDBITS(16); */
14859 while (bits < 16) {
14860 if (have === 0) { break inf_leave; }
14861 have--;
14862 hold += input[next++] << bits;
14863 bits += 8;
14864 }
14865 //===//
14866 state.flags = hold;
14867 if ((state.flags & 0xff) !== Z_DEFLATED) {
14868 strm.msg = 'unknown compression method';
14869 state.mode = BAD;
14870 break;
14871 }
14872 if (state.flags & 0xe000) {
14873 strm.msg = 'unknown header flags set';
14874 state.mode = BAD;
14875 break;
14876 }
14877 if (state.head) {
14878 state.head.text = ((hold >> 8) & 1);
14879 }
14880 if (state.flags & 0x0200) {
14881 //=== CRC2(state.check, hold);
14882 hbuf[0] = hold & 0xff;
14883 hbuf[1] = (hold >>> 8) & 0xff;
14884 state.check = crc32(state.check, hbuf, 2, 0);
14885 //===//
14886 }
14887 //=== INITBITS();
14888 hold = 0;
14889 bits = 0;
14890 //===//
14891 state.mode = TIME;
14892 /* falls through */
14893 case TIME:
14894 //=== NEEDBITS(32); */
14895 while (bits < 32) {
14896 if (have === 0) { break inf_leave; }
14897 have--;
14898 hold += input[next++] << bits;
14899 bits += 8;
14900 }
14901 //===//
14902 if (state.head) {
14903 state.head.time = hold;
14904 }
14905 if (state.flags & 0x0200) {
14906 //=== CRC4(state.check, hold)
14907 hbuf[0] = hold & 0xff;
14908 hbuf[1] = (hold >>> 8) & 0xff;
14909 hbuf[2] = (hold >>> 16) & 0xff;
14910 hbuf[3] = (hold >>> 24) & 0xff;
14911 state.check = crc32(state.check, hbuf, 4, 0);
14912 //===
14913 }
14914 //=== INITBITS();
14915 hold = 0;
14916 bits = 0;
14917 //===//
14918 state.mode = OS;
14919 /* falls through */
14920 case OS:
14921 //=== NEEDBITS(16); */
14922 while (bits < 16) {
14923 if (have === 0) { break inf_leave; }
14924 have--;
14925 hold += input[next++] << bits;
14926 bits += 8;
14927 }
14928 //===//
14929 if (state.head) {
14930 state.head.xflags = (hold & 0xff);
14931 state.head.os = (hold >> 8);
14932 }
14933 if (state.flags & 0x0200) {
14934 //=== CRC2(state.check, hold);
14935 hbuf[0] = hold & 0xff;
14936 hbuf[1] = (hold >>> 8) & 0xff;
14937 state.check = crc32(state.check, hbuf, 2, 0);
14938 //===//
14939 }
14940 //=== INITBITS();
14941 hold = 0;
14942 bits = 0;
14943 //===//
14944 state.mode = EXLEN;
14945 /* falls through */
14946 case EXLEN:
14947 if (state.flags & 0x0400) {
14948 //=== NEEDBITS(16); */
14949 while (bits < 16) {
14950 if (have === 0) { break inf_leave; }
14951 have--;
14952 hold += input[next++] << bits;
14953 bits += 8;
14954 }
14955 //===//
14956 state.length = hold;
14957 if (state.head) {
14958 state.head.extra_len = hold;
14959 }
14960 if (state.flags & 0x0200) {
14961 //=== CRC2(state.check, hold);
14962 hbuf[0] = hold & 0xff;
14963 hbuf[1] = (hold >>> 8) & 0xff;
14964 state.check = crc32(state.check, hbuf, 2, 0);
14965 //===//
14966 }
14967 //=== INITBITS();
14968 hold = 0;
14969 bits = 0;
14970 //===//
14971 }
14972 else if (state.head) {
14973 state.head.extra = null/*Z_NULL*/;
14974 }
14975 state.mode = EXTRA;
14976 /* falls through */
14977 case EXTRA:
14978 if (state.flags & 0x0400) {
14979 copy = state.length;
14980 if (copy > have) { copy = have; }
14981 if (copy) {
14982 if (state.head) {
14983 len = state.head.extra_len - state.length;
14984 if (!state.head.extra) {
14985 // Use untyped array for more conveniend processing later
14986 state.head.extra = new Array(state.head.extra_len);
14987 }
14988 utils.arraySet(
14989 state.head.extra,
14990 input,
14991 next,
14992 // extra field is limited to 65536 bytes
14993 // - no need for additional size check
14994 copy,
14995 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
14996 len
14997 );
14998 //zmemcpy(state.head.extra + len, next,
14999 // len + copy > state.head.extra_max ?
15000 // state.head.extra_max - len : copy);
15001 }
15002 if (state.flags & 0x0200) {
15003 state.check = crc32(state.check, input, copy, next);
15004 }
15005 have -= copy;
15006 next += copy;
15007 state.length -= copy;
15008 }
15009 if (state.length) { break inf_leave; }
15010 }
15011 state.length = 0;
15012 state.mode = NAME;
15013 /* falls through */
15014 case NAME:
15015 if (state.flags & 0x0800) {
15016 if (have === 0) { break inf_leave; }
15017 copy = 0;
15018 do {
15019 // TODO: 2 or 1 bytes?
15020 len = input[next + copy++];
15021 /* use constant limit because in js we should not preallocate memory */
15022 if (state.head && len &&
15023 (state.length < 65536 /*state.head.name_max*/)) {
15024 state.head.name += String.fromCharCode(len);
15025 }
15026 } while (len && copy < have);
15027
15028 if (state.flags & 0x0200) {
15029 state.check = crc32(state.check, input, copy, next);
15030 }
15031 have -= copy;
15032 next += copy;
15033 if (len) { break inf_leave; }
15034 }
15035 else if (state.head) {
15036 state.head.name = null;
15037 }
15038 state.length = 0;
15039 state.mode = COMMENT;
15040 /* falls through */
15041 case COMMENT:
15042 if (state.flags & 0x1000) {
15043 if (have === 0) { break inf_leave; }
15044 copy = 0;
15045 do {
15046 len = input[next + copy++];
15047 /* use constant limit because in js we should not preallocate memory */
15048 if (state.head && len &&
15049 (state.length < 65536 /*state.head.comm_max*/)) {
15050 state.head.comment += String.fromCharCode(len);
15051 }
15052 } while (len && copy < have);
15053 if (state.flags & 0x0200) {
15054 state.check = crc32(state.check, input, copy, next);
15055 }
15056 have -= copy;
15057 next += copy;
15058 if (len) { break inf_leave; }
15059 }
15060 else if (state.head) {
15061 state.head.comment = null;
15062 }
15063 state.mode = HCRC;
15064 /* falls through */
15065 case HCRC:
15066 if (state.flags & 0x0200) {
15067 //=== NEEDBITS(16); */
15068 while (bits < 16) {
15069 if (have === 0) { break inf_leave; }
15070 have--;
15071 hold += input[next++] << bits;
15072 bits += 8;
15073 }
15074 //===//
15075 if (hold !== (state.check & 0xffff)) {
15076 strm.msg = 'header crc mismatch';
15077 state.mode = BAD;
15078 break;
15079 }
15080 //=== INITBITS();
15081 hold = 0;
15082 bits = 0;
15083 //===//
15084 }
15085 if (state.head) {
15086 state.head.hcrc = ((state.flags >> 9) & 1);
15087 state.head.done = true;
15088 }
15089 strm.adler = state.check = 0;
15090 state.mode = TYPE;
15091 break;
15092 case DICTID:
15093 //=== NEEDBITS(32); */
15094 while (bits < 32) {
15095 if (have === 0) { break inf_leave; }
15096 have--;
15097 hold += input[next++] << bits;
15098 bits += 8;
15099 }
15100 //===//
15101 strm.adler = state.check = zswap32(hold);
15102 //=== INITBITS();
15103 hold = 0;
15104 bits = 0;
15105 //===//
15106 state.mode = DICT;
15107 /* falls through */
15108 case DICT:
15109 if (state.havedict === 0) {
15110 //--- RESTORE() ---
15111 strm.next_out = put;
15112 strm.avail_out = left;
15113 strm.next_in = next;
15114 strm.avail_in = have;
15115 state.hold = hold;
15116 state.bits = bits;
15117 //---
15118 return Z_NEED_DICT;
15119 }
15120 strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
15121 state.mode = TYPE;
15122 /* falls through */
15123 case TYPE:
15124 if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
15125 /* falls through */
15126 case TYPEDO:
15127 if (state.last) {
15128 //--- BYTEBITS() ---//
15129 hold >>>= bits & 7;
15130 bits -= bits & 7;
15131 //---//
15132 state.mode = CHECK;
15133 break;
15134 }
15135 //=== NEEDBITS(3); */
15136 while (bits < 3) {
15137 if (have === 0) { break inf_leave; }
15138 have--;
15139 hold += input[next++] << bits;
15140 bits += 8;
15141 }
15142 //===//
15143 state.last = (hold & 0x01)/*BITS(1)*/;
15144 //--- DROPBITS(1) ---//
15145 hold >>>= 1;
15146 bits -= 1;
15147 //---//
15148
15149 switch ((hold & 0x03)/*BITS(2)*/) {
15150 case 0: /* stored block */
15151 //Tracev((stderr, "inflate: stored block%s\n",
15152 // state.last ? " (last)" : ""));
15153 state.mode = STORED;
15154 break;
15155 case 1: /* fixed block */
15156 fixedtables(state);
15157 //Tracev((stderr, "inflate: fixed codes block%s\n",
15158 // state.last ? " (last)" : ""));
15159 state.mode = LEN_; /* decode codes */
15160 if (flush === Z_TREES) {
15161 //--- DROPBITS(2) ---//
15162 hold >>>= 2;
15163 bits -= 2;
15164 //---//
15165 break inf_leave;
15166 }
15167 break;
15168 case 2: /* dynamic block */
15169 //Tracev((stderr, "inflate: dynamic codes block%s\n",
15170 // state.last ? " (last)" : ""));
15171 state.mode = TABLE;
15172 break;
15173 case 3:
15174 strm.msg = 'invalid block type';
15175 state.mode = BAD;
15176 }
15177 //--- DROPBITS(2) ---//
15178 hold >>>= 2;
15179 bits -= 2;
15180 //---//
15181 break;
15182 case STORED:
15183 //--- BYTEBITS() ---// /* go to byte boundary */
15184 hold >>>= bits & 7;
15185 bits -= bits & 7;
15186 //---//
15187 //=== NEEDBITS(32); */
15188 while (bits < 32) {
15189 if (have === 0) { break inf_leave; }
15190 have--;
15191 hold += input[next++] << bits;
15192 bits += 8;
15193 }
15194 //===//
15195 if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
15196 strm.msg = 'invalid stored block lengths';
15197 state.mode = BAD;
15198 break;
15199 }
15200 state.length = hold & 0xffff;
15201 //Tracev((stderr, "inflate: stored length %u\n",
15202 // state.length));
15203 //=== INITBITS();
15204 hold = 0;
15205 bits = 0;
15206 //===//
15207 state.mode = COPY_;
15208 if (flush === Z_TREES) { break inf_leave; }
15209 /* falls through */
15210 case COPY_:
15211 state.mode = COPY;
15212 /* falls through */
15213 case COPY:
15214 copy = state.length;
15215 if (copy) {
15216 if (copy > have) { copy = have; }
15217 if (copy > left) { copy = left; }
15218 if (copy === 0) { break inf_leave; }
15219 //--- zmemcpy(put, next, copy); ---
15220 utils.arraySet(output, input, next, copy, put);
15221 //---//
15222 have -= copy;
15223 next += copy;
15224 left -= copy;
15225 put += copy;
15226 state.length -= copy;
15227 break;
15228 }
15229 //Tracev((stderr, "inflate: stored end\n"));
15230 state.mode = TYPE;
15231 break;
15232 case TABLE:
15233 //=== NEEDBITS(14); */
15234 while (bits < 14) {
15235 if (have === 0) { break inf_leave; }
15236 have--;
15237 hold += input[next++] << bits;
15238 bits += 8;
15239 }
15240 //===//
15241 state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
15242 //--- DROPBITS(5) ---//
15243 hold >>>= 5;
15244 bits -= 5;
15245 //---//
15246 state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
15247 //--- DROPBITS(5) ---//
15248 hold >>>= 5;
15249 bits -= 5;
15250 //---//
15251 state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
15252 //--- DROPBITS(4) ---//
15253 hold >>>= 4;
15254 bits -= 4;
15255 //---//
15256//#ifndef PKZIP_BUG_WORKAROUND
15257 if (state.nlen > 286 || state.ndist > 30) {
15258 strm.msg = 'too many length or distance symbols';
15259 state.mode = BAD;
15260 break;
15261 }
15262//#endif
15263 //Tracev((stderr, "inflate: table sizes ok\n"));
15264 state.have = 0;
15265 state.mode = LENLENS;
15266 /* falls through */
15267 case LENLENS:
15268 while (state.have < state.ncode) {
15269 //=== NEEDBITS(3);
15270 while (bits < 3) {
15271 if (have === 0) { break inf_leave; }
15272 have--;
15273 hold += input[next++] << bits;
15274 bits += 8;
15275 }
15276 //===//
15277 state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
15278 //--- DROPBITS(3) ---//
15279 hold >>>= 3;
15280 bits -= 3;
15281 //---//
15282 }
15283 while (state.have < 19) {
15284 state.lens[order[state.have++]] = 0;
15285 }
15286 // We have separate tables & no pointers. 2 commented lines below not needed.
15287 //state.next = state.codes;
15288 //state.lencode = state.next;
15289 // Switch to use dynamic table
15290 state.lencode = state.lendyn;
15291 state.lenbits = 7;
15292
15293 opts = { bits: state.lenbits };
15294 ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
15295 state.lenbits = opts.bits;
15296
15297 if (ret) {
15298 strm.msg = 'invalid code lengths set';
15299 state.mode = BAD;
15300 break;
15301 }
15302 //Tracev((stderr, "inflate: code lengths ok\n"));
15303 state.have = 0;
15304 state.mode = CODELENS;
15305 /* falls through */
15306 case CODELENS:
15307 while (state.have < state.nlen + state.ndist) {
15308 for (;;) {
15309 here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
15310 here_bits = here >>> 24;
15311 here_op = (here >>> 16) & 0xff;
15312 here_val = here & 0xffff;
15313
15314 if ((here_bits) <= bits) { break; }
15315 //--- PULLBYTE() ---//
15316 if (have === 0) { break inf_leave; }
15317 have--;
15318 hold += input[next++] << bits;
15319 bits += 8;
15320 //---//
15321 }
15322 if (here_val < 16) {
15323 //--- DROPBITS(here.bits) ---//
15324 hold >>>= here_bits;
15325 bits -= here_bits;
15326 //---//
15327 state.lens[state.have++] = here_val;
15328 }
15329 else {
15330 if (here_val === 16) {
15331 //=== NEEDBITS(here.bits + 2);
15332 n = here_bits + 2;
15333 while (bits < n) {
15334 if (have === 0) { break inf_leave; }
15335 have--;
15336 hold += input[next++] << bits;
15337 bits += 8;
15338 }
15339 //===//
15340 //--- DROPBITS(here.bits) ---//
15341 hold >>>= here_bits;
15342 bits -= here_bits;
15343 //---//
15344 if (state.have === 0) {
15345 strm.msg = 'invalid bit length repeat';
15346 state.mode = BAD;
15347 break;
15348 }
15349 len = state.lens[state.have - 1];
15350 copy = 3 + (hold & 0x03);//BITS(2);
15351 //--- DROPBITS(2) ---//
15352 hold >>>= 2;
15353 bits -= 2;
15354 //---//
15355 }
15356 else if (here_val === 17) {
15357 //=== NEEDBITS(here.bits + 3);
15358 n = here_bits + 3;
15359 while (bits < n) {
15360 if (have === 0) { break inf_leave; }
15361 have--;
15362 hold += input[next++] << bits;
15363 bits += 8;
15364 }
15365 //===//
15366 //--- DROPBITS(here.bits) ---//
15367 hold >>>= here_bits;
15368 bits -= here_bits;
15369 //---//
15370 len = 0;
15371 copy = 3 + (hold & 0x07);//BITS(3);
15372 //--- DROPBITS(3) ---//
15373 hold >>>= 3;
15374 bits -= 3;
15375 //---//
15376 }
15377 else {
15378 //=== NEEDBITS(here.bits + 7);
15379 n = here_bits + 7;
15380 while (bits < n) {
15381 if (have === 0) { break inf_leave; }
15382 have--;
15383 hold += input[next++] << bits;
15384 bits += 8;
15385 }
15386 //===//
15387 //--- DROPBITS(here.bits) ---//
15388 hold >>>= here_bits;
15389 bits -= here_bits;
15390 //---//
15391 len = 0;
15392 copy = 11 + (hold & 0x7f);//BITS(7);
15393 //--- DROPBITS(7) ---//
15394 hold >>>= 7;
15395 bits -= 7;
15396 //---//
15397 }
15398 if (state.have + copy > state.nlen + state.ndist) {
15399 strm.msg = 'invalid bit length repeat';
15400 state.mode = BAD;
15401 break;
15402 }
15403 while (copy--) {
15404 state.lens[state.have++] = len;
15405 }
15406 }
15407 }
15408
15409 /* handle error breaks in while */
15410 if (state.mode === BAD) { break; }
15411
15412 /* check for end-of-block code (better have one) */
15413 if (state.lens[256] === 0) {
15414 strm.msg = 'invalid code -- missing end-of-block';
15415 state.mode = BAD;
15416 break;
15417 }
15418
15419 /* build code tables -- note: do not change the lenbits or distbits
15420 values here (9 and 6) without reading the comments in inftrees.h
15421 concerning the ENOUGH constants, which depend on those values */
15422 state.lenbits = 9;
15423
15424 opts = { bits: state.lenbits };
15425 ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
15426 // We have separate tables & no pointers. 2 commented lines below not needed.
15427 // state.next_index = opts.table_index;
15428 state.lenbits = opts.bits;
15429 // state.lencode = state.next;
15430
15431 if (ret) {
15432 strm.msg = 'invalid literal/lengths set';
15433 state.mode = BAD;
15434 break;
15435 }
15436
15437 state.distbits = 6;
15438 //state.distcode.copy(state.codes);
15439 // Switch to use dynamic table
15440 state.distcode = state.distdyn;
15441 opts = { bits: state.distbits };
15442 ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
15443 // We have separate tables & no pointers. 2 commented lines below not needed.
15444 // state.next_index = opts.table_index;
15445 state.distbits = opts.bits;
15446 // state.distcode = state.next;
15447
15448 if (ret) {
15449 strm.msg = 'invalid distances set';
15450 state.mode = BAD;
15451 break;
15452 }
15453 //Tracev((stderr, 'inflate: codes ok\n'));
15454 state.mode = LEN_;
15455 if (flush === Z_TREES) { break inf_leave; }
15456 /* falls through */
15457 case LEN_:
15458 state.mode = LEN;
15459 /* falls through */
15460 case LEN:
15461 if (have >= 6 && left >= 258) {
15462 //--- RESTORE() ---
15463 strm.next_out = put;
15464 strm.avail_out = left;
15465 strm.next_in = next;
15466 strm.avail_in = have;
15467 state.hold = hold;
15468 state.bits = bits;
15469 //---
15470 inflate_fast(strm, _out);
15471 //--- LOAD() ---
15472 put = strm.next_out;
15473 output = strm.output;
15474 left = strm.avail_out;
15475 next = strm.next_in;
15476 input = strm.input;
15477 have = strm.avail_in;
15478 hold = state.hold;
15479 bits = state.bits;
15480 //---
15481
15482 if (state.mode === TYPE) {
15483 state.back = -1;
15484 }
15485 break;
15486 }
15487 state.back = 0;
15488 for (;;) {
15489 here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/
15490 here_bits = here >>> 24;
15491 here_op = (here >>> 16) & 0xff;
15492 here_val = here & 0xffff;
15493
15494 if (here_bits <= bits) { break; }
15495 //--- PULLBYTE() ---//
15496 if (have === 0) { break inf_leave; }
15497 have--;
15498 hold += input[next++] << bits;
15499 bits += 8;
15500 //---//
15501 }
15502 if (here_op && (here_op & 0xf0) === 0) {
15503 last_bits = here_bits;
15504 last_op = here_op;
15505 last_val = here_val;
15506 for (;;) {
15507 here = state.lencode[last_val +
15508 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
15509 here_bits = here >>> 24;
15510 here_op = (here >>> 16) & 0xff;
15511 here_val = here & 0xffff;
15512
15513 if ((last_bits + here_bits) <= bits) { break; }
15514 //--- PULLBYTE() ---//
15515 if (have === 0) { break inf_leave; }
15516 have--;
15517 hold += input[next++] << bits;
15518 bits += 8;
15519 //---//
15520 }
15521 //--- DROPBITS(last.bits) ---//
15522 hold >>>= last_bits;
15523 bits -= last_bits;
15524 //---//
15525 state.back += last_bits;
15526 }
15527 //--- DROPBITS(here.bits) ---//
15528 hold >>>= here_bits;
15529 bits -= here_bits;
15530 //---//
15531 state.back += here_bits;
15532 state.length = here_val;
15533 if (here_op === 0) {
15534 //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
15535 // "inflate: literal '%c'\n" :
15536 // "inflate: literal 0x%02x\n", here.val));
15537 state.mode = LIT;
15538 break;
15539 }
15540 if (here_op & 32) {
15541 //Tracevv((stderr, "inflate: end of block\n"));
15542 state.back = -1;
15543 state.mode = TYPE;
15544 break;
15545 }
15546 if (here_op & 64) {
15547 strm.msg = 'invalid literal/length code';
15548 state.mode = BAD;
15549 break;
15550 }
15551 state.extra = here_op & 15;
15552 state.mode = LENEXT;
15553 /* falls through */
15554 case LENEXT:
15555 if (state.extra) {
15556 //=== NEEDBITS(state.extra);
15557 n = state.extra;
15558 while (bits < n) {
15559 if (have === 0) { break inf_leave; }
15560 have--;
15561 hold += input[next++] << bits;
15562 bits += 8;
15563 }
15564 //===//
15565 state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
15566 //--- DROPBITS(state.extra) ---//
15567 hold >>>= state.extra;
15568 bits -= state.extra;
15569 //---//
15570 state.back += state.extra;
15571 }
15572 //Tracevv((stderr, "inflate: length %u\n", state.length));
15573 state.was = state.length;
15574 state.mode = DIST;
15575 /* falls through */
15576 case DIST:
15577 for (;;) {
15578 here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
15579 here_bits = here >>> 24;
15580 here_op = (here >>> 16) & 0xff;
15581 here_val = here & 0xffff;
15582
15583 if ((here_bits) <= bits) { break; }
15584 //--- PULLBYTE() ---//
15585 if (have === 0) { break inf_leave; }
15586 have--;
15587 hold += input[next++] << bits;
15588 bits += 8;
15589 //---//
15590 }
15591 if ((here_op & 0xf0) === 0) {
15592 last_bits = here_bits;
15593 last_op = here_op;
15594 last_val = here_val;
15595 for (;;) {
15596 here = state.distcode[last_val +
15597 ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
15598 here_bits = here >>> 24;
15599 here_op = (here >>> 16) & 0xff;
15600 here_val = here & 0xffff;
15601
15602 if ((last_bits + here_bits) <= bits) { break; }
15603 //--- PULLBYTE() ---//
15604 if (have === 0) { break inf_leave; }
15605 have--;
15606 hold += input[next++] << bits;
15607 bits += 8;
15608 //---//
15609 }
15610 //--- DROPBITS(last.bits) ---//
15611 hold >>>= last_bits;
15612 bits -= last_bits;
15613 //---//
15614 state.back += last_bits;
15615 }
15616 //--- DROPBITS(here.bits) ---//
15617 hold >>>= here_bits;
15618 bits -= here_bits;
15619 //---//
15620 state.back += here_bits;
15621 if (here_op & 64) {
15622 strm.msg = 'invalid distance code';
15623 state.mode = BAD;
15624 break;
15625 }
15626 state.offset = here_val;
15627 state.extra = (here_op) & 15;
15628 state.mode = DISTEXT;
15629 /* falls through */
15630 case DISTEXT:
15631 if (state.extra) {
15632 //=== NEEDBITS(state.extra);
15633 n = state.extra;
15634 while (bits < n) {
15635 if (have === 0) { break inf_leave; }
15636 have--;
15637 hold += input[next++] << bits;
15638 bits += 8;
15639 }
15640 //===//
15641 state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
15642 //--- DROPBITS(state.extra) ---//
15643 hold >>>= state.extra;
15644 bits -= state.extra;
15645 //---//
15646 state.back += state.extra;
15647 }
15648//#ifdef INFLATE_STRICT
15649 if (state.offset > state.dmax) {
15650 strm.msg = 'invalid distance too far back';
15651 state.mode = BAD;
15652 break;
15653 }
15654//#endif
15655 //Tracevv((stderr, "inflate: distance %u\n", state.offset));
15656 state.mode = MATCH;
15657 /* falls through */
15658 case MATCH:
15659 if (left === 0) { break inf_leave; }
15660 copy = _out - left;
15661 if (state.offset > copy) { /* copy from window */
15662 copy = state.offset - copy;
15663 if (copy > state.whave) {
15664 if (state.sane) {
15665 strm.msg = 'invalid distance too far back';
15666 state.mode = BAD;
15667 break;
15668 }
15669// (!) This block is disabled in zlib defailts,
15670// don't enable it for binary compatibility
15671//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
15672// Trace((stderr, "inflate.c too far\n"));
15673// copy -= state.whave;
15674// if (copy > state.length) { copy = state.length; }
15675// if (copy > left) { copy = left; }
15676// left -= copy;
15677// state.length -= copy;
15678// do {
15679// output[put++] = 0;
15680// } while (--copy);
15681// if (state.length === 0) { state.mode = LEN; }
15682// break;
15683//#endif
15684 }
15685 if (copy > state.wnext) {
15686 copy -= state.wnext;
15687 from = state.wsize - copy;
15688 }
15689 else {
15690 from = state.wnext - copy;
15691 }
15692 if (copy > state.length) { copy = state.length; }
15693 from_source = state.window;
15694 }
15695 else { /* copy from output */
15696 from_source = output;
15697 from = put - state.offset;
15698 copy = state.length;
15699 }
15700 if (copy > left) { copy = left; }
15701 left -= copy;
15702 state.length -= copy;
15703 do {
15704 output[put++] = from_source[from++];
15705 } while (--copy);
15706 if (state.length === 0) { state.mode = LEN; }
15707 break;
15708 case LIT:
15709 if (left === 0) { break inf_leave; }
15710 output[put++] = state.length;
15711 left--;
15712 state.mode = LEN;
15713 break;
15714 case CHECK:
15715 if (state.wrap) {
15716 //=== NEEDBITS(32);
15717 while (bits < 32) {
15718 if (have === 0) { break inf_leave; }
15719 have--;
15720 // Use '|' insdead of '+' to make sure that result is signed
15721 hold |= input[next++] << bits;
15722 bits += 8;
15723 }
15724 //===//
15725 _out -= left;
15726 strm.total_out += _out;
15727 state.total += _out;
15728 if (_out) {
15729 strm.adler = state.check =
15730 /*UPDATE(state.check, put - _out, _out);*/
15731 (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
15732
15733 }
15734 _out = left;
15735 // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
15736 if ((state.flags ? hold : zswap32(hold)) !== state.check) {
15737 strm.msg = 'incorrect data check';
15738 state.mode = BAD;
15739 break;
15740 }
15741 //=== INITBITS();
15742 hold = 0;
15743 bits = 0;
15744 //===//
15745 //Tracev((stderr, "inflate: check matches trailer\n"));
15746 }
15747 state.mode = LENGTH;
15748 /* falls through */
15749 case LENGTH:
15750 if (state.wrap && state.flags) {
15751 //=== NEEDBITS(32);
15752 while (bits < 32) {
15753 if (have === 0) { break inf_leave; }
15754 have--;
15755 hold += input[next++] << bits;
15756 bits += 8;
15757 }
15758 //===//
15759 if (hold !== (state.total & 0xffffffff)) {
15760 strm.msg = 'incorrect length check';
15761 state.mode = BAD;
15762 break;
15763 }
15764 //=== INITBITS();
15765 hold = 0;
15766 bits = 0;
15767 //===//
15768 //Tracev((stderr, "inflate: length matches trailer\n"));
15769 }
15770 state.mode = DONE;
15771 /* falls through */
15772 case DONE:
15773 ret = Z_STREAM_END;
15774 break inf_leave;
15775 case BAD:
15776 ret = Z_DATA_ERROR;
15777 break inf_leave;
15778 case MEM:
15779 return Z_MEM_ERROR;
15780 case SYNC:
15781 /* falls through */
15782 default:
15783 return Z_STREAM_ERROR;
15784 }
15785 }
15786
15787 // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
15788
15789 /*
15790 Return from inflate(), updating the total counts and the check value.
15791 If there was no progress during the inflate() call, return a buffer
15792 error. Call updatewindow() to create and/or update the window state.
15793 Note: a memory error from inflate() is non-recoverable.
15794 */
15795
15796 //--- RESTORE() ---
15797 strm.next_out = put;
15798 strm.avail_out = left;
15799 strm.next_in = next;
15800 strm.avail_in = have;
15801 state.hold = hold;
15802 state.bits = bits;
15803 //---
15804
15805 if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
15806 (state.mode < CHECK || flush !== Z_FINISH))) {
15807 if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
15808 state.mode = MEM;
15809 return Z_MEM_ERROR;
15810 }
15811 }
15812 _in -= strm.avail_in;
15813 _out -= strm.avail_out;
15814 strm.total_in += _in;
15815 strm.total_out += _out;
15816 state.total += _out;
15817 if (state.wrap && _out) {
15818 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
15819 (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
15820 }
15821 strm.data_type = state.bits + (state.last ? 64 : 0) +
15822 (state.mode === TYPE ? 128 : 0) +
15823 (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
15824 if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
15825 ret = Z_BUF_ERROR;
15826 }
15827 return ret;
15828}
15829
15830function inflateEnd(strm) {
15831
15832 if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
15833 return Z_STREAM_ERROR;
15834 }
15835
15836 var state = strm.state;
15837 if (state.window) {
15838 state.window = null;
15839 }
15840 strm.state = null;
15841 return Z_OK;
15842}
15843
15844function inflateGetHeader(strm, head) {
15845 var state;
15846
15847 /* check state */
15848 if (!strm || !strm.state) { return Z_STREAM_ERROR; }
15849 state = strm.state;
15850 if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
15851
15852 /* save header structure */
15853 state.head = head;
15854 head.done = false;
15855 return Z_OK;
15856}
15857
15858function inflateSetDictionary(strm, dictionary) {
15859 var dictLength = dictionary.length;
15860
15861 var state;
15862 var dictid;
15863 var ret;
15864
15865 /* check state */
15866 if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
15867 state = strm.state;
15868
15869 if (state.wrap !== 0 && state.mode !== DICT) {
15870 return Z_STREAM_ERROR;
15871 }
15872
15873 /* check for correct dictionary identifier */
15874 if (state.mode === DICT) {
15875 dictid = 1; /* adler32(0, null, 0)*/
15876 /* dictid = adler32(dictid, dictionary, dictLength); */
15877 dictid = adler32(dictid, dictionary, dictLength, 0);
15878 if (dictid !== state.check) {
15879 return Z_DATA_ERROR;
15880 }
15881 }
15882 /* copy dictionary to window using updatewindow(), which will amend the
15883 existing dictionary if appropriate */
15884 ret = updatewindow(strm, dictionary, dictLength, dictLength);
15885 if (ret) {
15886 state.mode = MEM;
15887 return Z_MEM_ERROR;
15888 }
15889 state.havedict = 1;
15890 // Tracev((stderr, "inflate: dictionary set\n"));
15891 return Z_OK;
15892}
15893
15894exports.inflateReset = inflateReset;
15895exports.inflateReset2 = inflateReset2;
15896exports.inflateResetKeep = inflateResetKeep;
15897exports.inflateInit = inflateInit;
15898exports.inflateInit2 = inflateInit2;
15899exports.inflate = inflate;
15900exports.inflateEnd = inflateEnd;
15901exports.inflateGetHeader = inflateGetHeader;
15902exports.inflateSetDictionary = inflateSetDictionary;
15903exports.inflateInfo = 'pako inflate (from Nodeca project)';
15904
15905/* Not implemented
15906exports.inflateCopy = inflateCopy;
15907exports.inflateGetDictionary = inflateGetDictionary;
15908exports.inflateMark = inflateMark;
15909exports.inflatePrime = inflatePrime;
15910exports.inflateSync = inflateSync;
15911exports.inflateSyncPoint = inflateSyncPoint;
15912exports.inflateUndermine = inflateUndermine;
15913*/
15914
15915
15916/***/ }),
15917/* 153 */
15918/***/ (function(module, exports, __webpack_require__) {
15919
15920"use strict";
15921
15922
15923
15924var utils = __webpack_require__(28);
15925
15926var MAXBITS = 15;
15927var ENOUGH_LENS = 852;
15928var ENOUGH_DISTS = 592;
15929//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
15930
15931var CODES = 0;
15932var LENS = 1;
15933var DISTS = 2;
15934
15935var lbase = [ /* Length codes 257..285 base */
15936 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
15937 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
15938];
15939
15940var lext = [ /* Length codes 257..285 extra */
15941 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
15942 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
15943];
15944
15945var dbase = [ /* Distance codes 0..29 base */
15946 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
15947 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
15948 8193, 12289, 16385, 24577, 0, 0
15949];
15950
15951var dext = [ /* Distance codes 0..29 extra */
15952 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
15953 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
15954 28, 28, 29, 29, 64, 64
15955];
15956
15957module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
15958{
15959 var bits = opts.bits;
15960 //here = opts.here; /* table entry for duplication */
15961
15962 var len = 0; /* a code's length in bits */
15963 var sym = 0; /* index of code symbols */
15964 var min = 0, max = 0; /* minimum and maximum code lengths */
15965 var root = 0; /* number of index bits for root table */
15966 var curr = 0; /* number of index bits for current table */
15967 var drop = 0; /* code bits to drop for sub-table */
15968 var left = 0; /* number of prefix codes available */
15969 var used = 0; /* code entries in table used */
15970 var huff = 0; /* Huffman code */
15971 var incr; /* for incrementing code, index */
15972 var fill; /* index for replicating entries */
15973 var low; /* low bits for current root entry */
15974 var mask; /* mask for low root bits */
15975 var next; /* next available space in table */
15976 var base = null; /* base value table to use */
15977 var base_index = 0;
15978// var shoextra; /* extra bits table to use */
15979 var end; /* use base and extra for symbol > end */
15980 var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
15981 var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
15982 var extra = null;
15983 var extra_index = 0;
15984
15985 var here_bits, here_op, here_val;
15986
15987 /*
15988 Process a set of code lengths to create a canonical Huffman code. The
15989 code lengths are lens[0..codes-1]. Each length corresponds to the
15990 symbols 0..codes-1. The Huffman code is generated by first sorting the
15991 symbols by length from short to long, and retaining the symbol order
15992 for codes with equal lengths. Then the code starts with all zero bits
15993 for the first code of the shortest length, and the codes are integer
15994 increments for the same length, and zeros are appended as the length
15995 increases. For the deflate format, these bits are stored backwards
15996 from their more natural integer increment ordering, and so when the
15997 decoding tables are built in the large loop below, the integer codes
15998 are incremented backwards.
15999
16000 This routine assumes, but does not check, that all of the entries in
16001 lens[] are in the range 0..MAXBITS. The caller must assure this.
16002 1..MAXBITS is interpreted as that code length. zero means that that
16003 symbol does not occur in this code.
16004
16005 The codes are sorted by computing a count of codes for each length,
16006 creating from that a table of starting indices for each length in the
16007 sorted table, and then entering the symbols in order in the sorted
16008 table. The sorted table is work[], with that space being provided by
16009 the caller.
16010
16011 The length counts are used for other purposes as well, i.e. finding
16012 the minimum and maximum length codes, determining if there are any
16013 codes at all, checking for a valid set of lengths, and looking ahead
16014 at length counts to determine sub-table sizes when building the
16015 decoding tables.
16016 */
16017
16018 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
16019 for (len = 0; len <= MAXBITS; len++) {
16020 count[len] = 0;
16021 }
16022 for (sym = 0; sym < codes; sym++) {
16023 count[lens[lens_index + sym]]++;
16024 }
16025
16026 /* bound code lengths, force root to be within code lengths */
16027 root = bits;
16028 for (max = MAXBITS; max >= 1; max--) {
16029 if (count[max] !== 0) { break; }
16030 }
16031 if (root > max) {
16032 root = max;
16033 }
16034 if (max === 0) { /* no symbols to code at all */
16035 //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
16036 //table.bits[opts.table_index] = 1; //here.bits = (var char)1;
16037 //table.val[opts.table_index++] = 0; //here.val = (var short)0;
16038 table[table_index++] = (1 << 24) | (64 << 16) | 0;
16039
16040
16041 //table.op[opts.table_index] = 64;
16042 //table.bits[opts.table_index] = 1;
16043 //table.val[opts.table_index++] = 0;
16044 table[table_index++] = (1 << 24) | (64 << 16) | 0;
16045
16046 opts.bits = 1;
16047 return 0; /* no symbols, but wait for decoding to report error */
16048 }
16049 for (min = 1; min < max; min++) {
16050 if (count[min] !== 0) { break; }
16051 }
16052 if (root < min) {
16053 root = min;
16054 }
16055
16056 /* check for an over-subscribed or incomplete set of lengths */
16057 left = 1;
16058 for (len = 1; len <= MAXBITS; len++) {
16059 left <<= 1;
16060 left -= count[len];
16061 if (left < 0) {
16062 return -1;
16063 } /* over-subscribed */
16064 }
16065 if (left > 0 && (type === CODES || max !== 1)) {
16066 return -1; /* incomplete set */
16067 }
16068
16069 /* generate offsets into symbol table for each length for sorting */
16070 offs[1] = 0;
16071 for (len = 1; len < MAXBITS; len++) {
16072 offs[len + 1] = offs[len] + count[len];
16073 }
16074
16075 /* sort symbols by length, by symbol order within each length */
16076 for (sym = 0; sym < codes; sym++) {
16077 if (lens[lens_index + sym] !== 0) {
16078 work[offs[lens[lens_index + sym]]++] = sym;
16079 }
16080 }
16081
16082 /*
16083 Create and fill in decoding tables. In this loop, the table being
16084 filled is at next and has curr index bits. The code being used is huff
16085 with length len. That code is converted to an index by dropping drop
16086 bits off of the bottom. For codes where len is less than drop + curr,
16087 those top drop + curr - len bits are incremented through all values to
16088 fill the table with replicated entries.
16089
16090 root is the number of index bits for the root table. When len exceeds
16091 root, sub-tables are created pointed to by the root entry with an index
16092 of the low root bits of huff. This is saved in low to check for when a
16093 new sub-table should be started. drop is zero when the root table is
16094 being filled, and drop is root when sub-tables are being filled.
16095
16096 When a new sub-table is needed, it is necessary to look ahead in the
16097 code lengths to determine what size sub-table is needed. The length
16098 counts are used for this, and so count[] is decremented as codes are
16099 entered in the tables.
16100
16101 used keeps track of how many table entries have been allocated from the
16102 provided *table space. It is checked for LENS and DIST tables against
16103 the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
16104 the initial root table size constants. See the comments in inftrees.h
16105 for more information.
16106
16107 sym increments through all symbols, and the loop terminates when
16108 all codes of length max, i.e. all codes, have been processed. This
16109 routine permits incomplete codes, so another loop after this one fills
16110 in the rest of the decoding tables with invalid code markers.
16111 */
16112
16113 /* set up for code type */
16114 // poor man optimization - use if-else instead of switch,
16115 // to avoid deopts in old v8
16116 if (type === CODES) {
16117 base = extra = work; /* dummy value--not used */
16118 end = 19;
16119
16120 } else if (type === LENS) {
16121 base = lbase;
16122 base_index -= 257;
16123 extra = lext;
16124 extra_index -= 257;
16125 end = 256;
16126
16127 } else { /* DISTS */
16128 base = dbase;
16129 extra = dext;
16130 end = -1;
16131 }
16132
16133 /* initialize opts for loop */
16134 huff = 0; /* starting code */
16135 sym = 0; /* starting code symbol */
16136 len = min; /* starting code length */
16137 next = table_index; /* current table to fill in */
16138 curr = root; /* current table index bits */
16139 drop = 0; /* current bits to drop from code for index */
16140 low = -1; /* trigger new sub-table when len > root */
16141 used = 1 << root; /* use root table entries */
16142 mask = used - 1; /* mask for comparing low */
16143
16144 /* check available table space */
16145 if ((type === LENS && used > ENOUGH_LENS) ||
16146 (type === DISTS && used > ENOUGH_DISTS)) {
16147 return 1;
16148 }
16149
16150 /* process all codes and make table entries */
16151 for (;;) {
16152 /* create table entry */
16153 here_bits = len - drop;
16154 if (work[sym] < end) {
16155 here_op = 0;
16156 here_val = work[sym];
16157 }
16158 else if (work[sym] > end) {
16159 here_op = extra[extra_index + work[sym]];
16160 here_val = base[base_index + work[sym]];
16161 }
16162 else {
16163 here_op = 32 + 64; /* end of block */
16164 here_val = 0;
16165 }
16166
16167 /* replicate for those indices with low len bits equal to huff */
16168 incr = 1 << (len - drop);
16169 fill = 1 << curr;
16170 min = fill; /* save offset to next table */
16171 do {
16172 fill -= incr;
16173 table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
16174 } while (fill !== 0);
16175
16176 /* backwards increment the len-bit code huff */
16177 incr = 1 << (len - 1);
16178 while (huff & incr) {
16179 incr >>= 1;
16180 }
16181 if (incr !== 0) {
16182 huff &= incr - 1;
16183 huff += incr;
16184 } else {
16185 huff = 0;
16186 }
16187
16188 /* go to next symbol, update count, len */
16189 sym++;
16190 if (--count[len] === 0) {
16191 if (len === max) { break; }
16192 len = lens[lens_index + work[sym]];
16193 }
16194
16195 /* create new sub-table if needed */
16196 if (len > root && (huff & mask) !== low) {
16197 /* if first time, transition to sub-tables */
16198 if (drop === 0) {
16199 drop = root;
16200 }
16201
16202 /* increment past last table */
16203 next += min; /* here min is 1 << curr */
16204
16205 /* determine length of next table */
16206 curr = len - drop;
16207 left = 1 << curr;
16208 while (curr + drop < max) {
16209 left -= count[curr + drop];
16210 if (left <= 0) { break; }
16211 curr++;
16212 left <<= 1;
16213 }
16214
16215 /* check for enough space */
16216 used += 1 << curr;
16217 if ((type === LENS && used > ENOUGH_LENS) ||
16218 (type === DISTS && used > ENOUGH_DISTS)) {
16219 return 1;
16220 }
16221
16222 /* point entry in root table to sub-table */
16223 low = huff & mask;
16224 /*table.op[low] = curr;
16225 table.bits[low] = root;
16226 table.val[low] = next - opts.table_index;*/
16227 table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
16228 }
16229 }
16230
16231 /* fill in remaining table entry if code is incomplete (guaranteed to have
16232 at most one remaining entry, since if the code is incomplete, the
16233 maximum code length that was allowed to get this far is one bit) */
16234 if (huff !== 0) {
16235 //table.op[next + huff] = 64; /* invalid code marker */
16236 //table.bits[next + huff] = len - drop;
16237 //table.val[next + huff] = 0;
16238 table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
16239 }
16240
16241 /* set return parameters */
16242 //opts.table_index += used;
16243 opts.bits = root;
16244 return 0;
16245};
16246
16247
16248/***/ }),
16249/* 154 */
16250/***/ (function(module, exports, __webpack_require__) {
16251
16252"use strict";
16253
16254
16255module.exports = {
16256 2: 'need dictionary', /* Z_NEED_DICT 2 */
16257 1: 'stream end', /* Z_STREAM_END 1 */
16258 0: '', /* Z_OK 0 */
16259 '-1': 'file error', /* Z_ERRNO (-1) */
16260 '-2': 'stream error', /* Z_STREAM_ERROR (-2) */
16261 '-3': 'data error', /* Z_DATA_ERROR (-3) */
16262 '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
16263 '-5': 'buffer error', /* Z_BUF_ERROR (-5) */
16264 '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
16265};
16266
16267
16268/***/ }),
16269/* 155 */
16270/***/ (function(module, exports, __webpack_require__) {
16271
16272"use strict";
16273
16274
16275
16276function ZStream() {
16277 /* next input byte */
16278 this.input = null; // JS specific, because we have no pointers
16279 this.next_in = 0;
16280 /* number of bytes available at input */
16281 this.avail_in = 0;
16282 /* total number of input bytes read so far */
16283 this.total_in = 0;
16284 /* next output byte should be put there */
16285 this.output = null; // JS specific, because we have no pointers
16286 this.next_out = 0;
16287 /* remaining free space at output */
16288 this.avail_out = 0;
16289 /* total number of bytes output so far */
16290 this.total_out = 0;
16291 /* last error message, NULL if no error */
16292 this.msg = ''/*Z_NULL*/;
16293 /* not visible by applications */
16294 this.state = null;
16295 /* best guess about the data type: binary or text */
16296 this.data_type = 2/*Z_UNKNOWN*/;
16297 /* adler32 value of the uncompressed data */
16298 this.adler = 0;
16299}
16300
16301module.exports = ZStream;
16302
16303
16304/***/ }),
16305/* 156 */
16306/***/ (function(module, exports, __webpack_require__) {
16307
16308var always = __webpack_require__(19);
16309
16310
16311/**
16312 * A function that always returns `false`. Any passed in parameters are ignored.
16313 *
16314 * @func
16315 * @memberOf R
16316 * @since v0.9.0
16317 * @category Function
16318 * @sig * -> Boolean
16319 * @param {*}
16320 * @return {Boolean}
16321 * @see R.always, R.T
16322 * @example
16323 *
16324 * R.F(); //=> false
16325 */
16326module.exports = always(false);
16327
16328
16329/***/ }),
16330/* 157 */
16331/***/ (function(module, exports, __webpack_require__) {
16332
16333var always = __webpack_require__(19);
16334
16335
16336/**
16337 * A function that always returns `true`. Any passed in parameters are ignored.
16338 *
16339 * @func
16340 * @memberOf R
16341 * @since v0.9.0
16342 * @category Function
16343 * @sig * -> Boolean
16344 * @param {*}
16345 * @return {Boolean}
16346 * @see R.always, R.F
16347 * @example
16348 *
16349 * R.T(); //=> true
16350 */
16351module.exports = always(true);
16352
16353
16354/***/ }),
16355/* 158 */
16356/***/ (function(module, exports) {
16357
16358/**
16359 * A special placeholder value used to specify "gaps" within curried functions,
16360 * allowing partial application of any combination of arguments, regardless of
16361 * their positions.
16362 *
16363 * If `g` is a curried ternary function and `_` is `R.__`, the following are
16364 * equivalent:
16365 *
16366 * - `g(1, 2, 3)`
16367 * - `g(_, 2, 3)(1)`
16368 * - `g(_, _, 3)(1)(2)`
16369 * - `g(_, _, 3)(1, 2)`
16370 * - `g(_, 2, _)(1, 3)`
16371 * - `g(_, 2)(1)(3)`
16372 * - `g(_, 2)(1, 3)`
16373 * - `g(_, 2)(_, 3)(1)`
16374 *
16375 * @constant
16376 * @memberOf R
16377 * @since v0.6.0
16378 * @category Function
16379 * @example
16380 *
16381 * var greet = R.replace('{name}', R.__, 'Hello, {name}!');
16382 * greet('Alice'); //=> 'Hello, Alice!'
16383 */
16384module.exports = {'@@functional/placeholder': true};
16385
16386
16387/***/ }),
16388/* 159 */
16389/***/ (function(module, exports, __webpack_require__) {
16390
16391var _concat = __webpack_require__(10);
16392var _curry1 = __webpack_require__(1);
16393var curryN = __webpack_require__(5);
16394
16395
16396/**
16397 * Creates a new list iteration function from an existing one by adding two new
16398 * parameters to its callback function: the current index, and the entire list.
16399 *
16400 * This would turn, for instance, Ramda's simple `map` function into one that
16401 * more closely resembles `Array.prototype.map`. Note that this will only work
16402 * for functions in which the iteration callback function is the first
16403 * parameter, and where the list is the last parameter. (This latter might be
16404 * unimportant if the list parameter is not used.)
16405 *
16406 * @func
16407 * @memberOf R
16408 * @since v0.15.0
16409 * @category Function
16410 * @category List
16411 * @sig ((a ... -> b) ... -> [a] -> *) -> (a ..., Int, [a] -> b) ... -> [a] -> *)
16412 * @param {Function} fn A list iteration function that does not pass index or list to its callback
16413 * @return {Function} An altered list iteration function that passes (item, index, list) to its callback
16414 * @example
16415 *
16416 * var mapIndexed = R.addIndex(R.map);
16417 * mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);
16418 * //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']
16419 */
16420module.exports = _curry1(function addIndex(fn) {
16421 return curryN(fn.length, function() {
16422 var idx = 0;
16423 var origFn = arguments[0];
16424 var list = arguments[arguments.length - 1];
16425 var args = Array.prototype.slice.call(arguments, 0);
16426 args[0] = function() {
16427 var result = origFn.apply(this, _concat(arguments, [idx, list]));
16428 idx += 1;
16429 return result;
16430 };
16431 return fn.apply(this, args);
16432 });
16433});
16434
16435
16436/***/ }),
16437/* 160 */
16438/***/ (function(module, exports, __webpack_require__) {
16439
16440var _curry2 = __webpack_require__(0);
16441var _dispatchable = __webpack_require__(3);
16442var _xall = __webpack_require__(231);
16443
16444
16445/**
16446 * Returns `true` if all elements of the list match the predicate, `false` if
16447 * there are any that don't.
16448 *
16449 * Dispatches to the `all` method of the second argument, if present.
16450 *
16451 * Acts as a transducer if a transformer is given in list position.
16452 *
16453 * @func
16454 * @memberOf R
16455 * @since v0.1.0
16456 * @category List
16457 * @sig (a -> Boolean) -> [a] -> Boolean
16458 * @param {Function} fn The predicate function.
16459 * @param {Array} list The array to consider.
16460 * @return {Boolean} `true` if the predicate is satisfied by every element, `false`
16461 * otherwise.
16462 * @see R.any, R.none, R.transduce
16463 * @example
16464 *
16465 * var equals3 = R.equals(3);
16466 * R.all(equals3)([3, 3, 3, 3]); //=> true
16467 * R.all(equals3)([3, 3, 1, 3]); //=> false
16468 */
16469module.exports = _curry2(_dispatchable(['all'], _xall, function all(fn, list) {
16470 var idx = 0;
16471 while (idx < list.length) {
16472 if (!fn(list[idx])) {
16473 return false;
16474 }
16475 idx += 1;
16476 }
16477 return true;
16478}));
16479
16480
16481/***/ }),
16482/* 161 */
16483/***/ (function(module, exports, __webpack_require__) {
16484
16485var _curry1 = __webpack_require__(1);
16486var curryN = __webpack_require__(5);
16487var max = __webpack_require__(20);
16488var pluck = __webpack_require__(26);
16489var reduce = __webpack_require__(14);
16490
16491
16492/**
16493 * Takes a list of predicates and returns a predicate that returns true for a
16494 * given list of arguments if every one of the provided predicates is satisfied
16495 * by those arguments.
16496 *
16497 * The function returned is a curried function whose arity matches that of the
16498 * highest-arity predicate.
16499 *
16500 * @func
16501 * @memberOf R
16502 * @since v0.9.0
16503 * @category Logic
16504 * @sig [(*... -> Boolean)] -> (*... -> Boolean)
16505 * @param {Array} predicates An array of predicates to check
16506 * @return {Function} The combined predicate
16507 * @see R.anyPass
16508 * @example
16509 *
16510 * var isQueen = R.propEq('rank', 'Q');
16511 * var isSpade = R.propEq('suit', '♠︎');
16512 * var isQueenOfSpades = R.allPass([isQueen, isSpade]);
16513 *
16514 * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false
16515 * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true
16516 */
16517module.exports = _curry1(function allPass(preds) {
16518 return curryN(reduce(max, 0, pluck('length', preds)), function() {
16519 var idx = 0;
16520 var len = preds.length;
16521 while (idx < len) {
16522 if (!preds[idx].apply(this, arguments)) {
16523 return false;
16524 }
16525 idx += 1;
16526 }
16527 return true;
16528 });
16529});
16530
16531
16532/***/ }),
16533/* 162 */
16534/***/ (function(module, exports, __webpack_require__) {
16535
16536var _curry1 = __webpack_require__(1);
16537var curryN = __webpack_require__(5);
16538var max = __webpack_require__(20);
16539var pluck = __webpack_require__(26);
16540var reduce = __webpack_require__(14);
16541
16542
16543/**
16544 * Takes a list of predicates and returns a predicate that returns true for a
16545 * given list of arguments if at least one of the provided predicates is
16546 * satisfied by those arguments.
16547 *
16548 * The function returned is a curried function whose arity matches that of the
16549 * highest-arity predicate.
16550 *
16551 * @func
16552 * @memberOf R
16553 * @since v0.9.0
16554 * @category Logic
16555 * @sig [(*... -> Boolean)] -> (*... -> Boolean)
16556 * @param {Array} predicates An array of predicates to check
16557 * @return {Function} The combined predicate
16558 * @see R.allPass
16559 * @example
16560 *
16561 * var isClub = R.propEq('suit', '♣');
16562 * var isSpade = R.propEq('suit', '♠');
16563 * var isBlackCard = R.anyPass([isClub, isSpade]);
16564 *
16565 * isBlackCard({rank: '10', suit: '♣'}); //=> true
16566 * isBlackCard({rank: 'Q', suit: '♠'}); //=> true
16567 * isBlackCard({rank: 'Q', suit: '♦'}); //=> false
16568 */
16569module.exports = _curry1(function anyPass(preds) {
16570 return curryN(reduce(max, 0, pluck('length', preds)), function() {
16571 var idx = 0;
16572 var len = preds.length;
16573 while (idx < len) {
16574 if (preds[idx].apply(this, arguments)) {
16575 return true;
16576 }
16577 idx += 1;
16578 }
16579 return false;
16580 });
16581});
16582
16583
16584/***/ }),
16585/* 163 */
16586/***/ (function(module, exports, __webpack_require__) {
16587
16588var _aperture = __webpack_require__(214);
16589var _curry2 = __webpack_require__(0);
16590var _dispatchable = __webpack_require__(3);
16591var _xaperture = __webpack_require__(232);
16592
16593
16594/**
16595 * Returns a new list, composed of n-tuples of consecutive elements If `n` is
16596 * greater than the length of the list, an empty list is returned.
16597 *
16598 * Acts as a transducer if a transformer is given in list position.
16599 *
16600 * @func
16601 * @memberOf R
16602 * @since v0.12.0
16603 * @category List
16604 * @sig Number -> [a] -> [[a]]
16605 * @param {Number} n The size of the tuples to create
16606 * @param {Array} list The list to split into `n`-length tuples
16607 * @return {Array} The resulting list of `n`-length tuples
16608 * @see R.transduce
16609 * @example
16610 *
16611 * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
16612 * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
16613 * R.aperture(7, [1, 2, 3, 4, 5]); //=> []
16614 */
16615module.exports = _curry2(_dispatchable([], _xaperture, _aperture));
16616
16617
16618/***/ }),
16619/* 164 */
16620/***/ (function(module, exports, __webpack_require__) {
16621
16622var _concat = __webpack_require__(10);
16623var _curry2 = __webpack_require__(0);
16624
16625
16626/**
16627 * Returns a new list containing the contents of the given list, followed by
16628 * the given element.
16629 *
16630 * @func
16631 * @memberOf R
16632 * @since v0.1.0
16633 * @category List
16634 * @sig a -> [a] -> [a]
16635 * @param {*} el The element to add to the end of the new list.
16636 * @param {Array} list The list of elements to add a new item to.
16637 * list.
16638 * @return {Array} A new list containing the elements of the old list followed by `el`.
16639 * @see R.prepend
16640 * @example
16641 *
16642 * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']
16643 * R.append('tests', []); //=> ['tests']
16644 * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
16645 */
16646module.exports = _curry2(function append(el, list) {
16647 return _concat(list, [el]);
16648});
16649
16650
16651/***/ }),
16652/* 165 */
16653/***/ (function(module, exports, __webpack_require__) {
16654
16655var _curry1 = __webpack_require__(1);
16656var apply = __webpack_require__(69);
16657var curryN = __webpack_require__(5);
16658var map = __webpack_require__(7);
16659var max = __webpack_require__(20);
16660var pluck = __webpack_require__(26);
16661var reduce = __webpack_require__(14);
16662var values = __webpack_require__(121);
16663
16664
16665/**
16666 * Given a spec object recursively mapping properties to functions, creates a
16667 * function producing an object of the same structure, by mapping each property
16668 * to the result of calling its associated function with the supplied arguments.
16669 *
16670 * @func
16671 * @memberOf R
16672 * @since v0.20.0
16673 * @category Function
16674 * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v})
16675 * @param {Object} spec an object recursively mapping properties to functions for
16676 * producing the values for these properties.
16677 * @return {Function} A function that returns an object of the same structure
16678 * as `spec', with each property set to the value returned by calling its
16679 * associated function with the supplied arguments.
16680 * @see R.converge, R.juxt
16681 * @example
16682 *
16683 * var getMetrics = R.applySpec({
16684 * sum: R.add,
16685 * nested: { mul: R.multiply }
16686 * });
16687 * getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }
16688 * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } }
16689 */
16690module.exports = _curry1(function applySpec(spec) {
16691 spec = map(function(v) { return typeof v == 'function' ? v : applySpec(v); },
16692 spec);
16693 return curryN(reduce(max, 0, pluck('length', values(spec))),
16694 function() {
16695 var args = arguments;
16696 return map(function(f) { return apply(f, args); }, spec);
16697 });
16698});
16699
16700
16701/***/ }),
16702/* 166 */
16703/***/ (function(module, exports, __webpack_require__) {
16704
16705var _curry3 = __webpack_require__(2);
16706
16707
16708/**
16709 * Makes an ascending comparator function out of a function that returns a value
16710 * that can be compared with `<` and `>`.
16711 *
16712 * @func
16713 * @memberOf R
16714 * @since v0.23.0
16715 * @category Function
16716 * @sig Ord b => (a -> b) -> a -> a -> Number
16717 * @param {Function} fn A function of arity one that returns a value that can be compared
16718 * @param {*} a The first item to be compared.
16719 * @param {*} b The second item to be compared.
16720 * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0`
16721 * @example
16722 *
16723 * var byAge = R.ascend(R.prop('age'));
16724 * var people = [
16725 * // ...
16726 * ];
16727 * var peopleByYoungestFirst = R.sort(byAge, people);
16728 */
16729module.exports = _curry3(function ascend(fn, a, b) {
16730 var aa = fn(a);
16731 var bb = fn(b);
16732 return aa < bb ? -1 : aa > bb ? 1 : 0;
16733});
16734
16735
16736/***/ }),
16737/* 167 */
16738/***/ (function(module, exports, __webpack_require__) {
16739
16740var _curry1 = __webpack_require__(1);
16741var nAry = __webpack_require__(41);
16742
16743
16744/**
16745 * Wraps a function of any arity (including nullary) in a function that accepts
16746 * exactly 2 parameters. Any extraneous parameters will not be passed to the
16747 * supplied function.
16748 *
16749 * @func
16750 * @memberOf R
16751 * @since v0.2.0
16752 * @category Function
16753 * @sig (* -> c) -> (a, b -> c)
16754 * @param {Function} fn The function to wrap.
16755 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
16756 * arity 2.
16757 * @example
16758 *
16759 * var takesThreeArgs = function(a, b, c) {
16760 * return [a, b, c];
16761 * };
16762 * takesThreeArgs.length; //=> 3
16763 * takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
16764 *
16765 * var takesTwoArgs = R.binary(takesThreeArgs);
16766 * takesTwoArgs.length; //=> 2
16767 * // Only 2 arguments are passed to the wrapped function
16768 * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
16769 * @symb R.binary(f)(a, b, c) = f(a, b)
16770 */
16771module.exports = _curry1(function binary(fn) {
16772 return nAry(2, fn);
16773});
16774
16775
16776/***/ }),
16777/* 168 */
16778/***/ (function(module, exports, __webpack_require__) {
16779
16780var _curry2 = __webpack_require__(0);
16781var _isFunction = __webpack_require__(35);
16782var and = __webpack_require__(67);
16783var lift = __webpack_require__(40);
16784
16785
16786/**
16787 * A function which calls the two provided functions and returns the `&&`
16788 * of the results.
16789 * It returns the result of the first function if it is false-y and the result
16790 * of the second function otherwise. Note that this is short-circuited,
16791 * meaning that the second function will not be invoked if the first returns a
16792 * false-y value.
16793 *
16794 * In addition to functions, `R.both` also accepts any fantasy-land compatible
16795 * applicative functor.
16796 *
16797 * @func
16798 * @memberOf R
16799 * @since v0.12.0
16800 * @category Logic
16801 * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
16802 * @param {Function} f A predicate
16803 * @param {Function} g Another predicate
16804 * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together.
16805 * @see R.and
16806 * @example
16807 *
16808 * var gt10 = R.gt(R.__, 10)
16809 * var lt20 = R.lt(R.__, 20)
16810 * var f = R.both(gt10, lt20);
16811 * f(15); //=> true
16812 * f(30); //=> false
16813 */
16814module.exports = _curry2(function both(f, g) {
16815 return _isFunction(f) ?
16816 function _both() {
16817 return f.apply(this, arguments) && g.apply(this, arguments);
16818 } :
16819 lift(and)(f, g);
16820});
16821
16822
16823/***/ }),
16824/* 169 */
16825/***/ (function(module, exports, __webpack_require__) {
16826
16827var curry = __webpack_require__(32);
16828
16829
16830/**
16831 * Returns the result of calling its first argument with the remaining
16832 * arguments. This is occasionally useful as a converging function for
16833 * `R.converge`: the left branch can produce a function while the right branch
16834 * produces a value to be passed to that function as an argument.
16835 *
16836 * @func
16837 * @memberOf R
16838 * @since v0.9.0
16839 * @category Function
16840 * @sig (*... -> a),*... -> a
16841 * @param {Function} fn The function to apply to the remaining arguments.
16842 * @param {...*} args Any number of positional arguments.
16843 * @return {*}
16844 * @see R.apply
16845 * @example
16846 *
16847 * R.call(R.add, 1, 2); //=> 3
16848 *
16849 * var indentN = R.pipe(R.times(R.always(' ')),
16850 * R.join(''),
16851 * R.replace(/^(?!$)/gm));
16852 *
16853 * var format = R.converge(R.call, [
16854 * R.pipe(R.prop('indent'), indentN),
16855 * R.prop('value')
16856 * ]);
16857 *
16858 * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n'
16859 * @symb R.call(f, a, b) = f(a, b)
16860 */
16861module.exports = curry(function call(fn) {
16862 return fn.apply(this, Array.prototype.slice.call(arguments, 1));
16863});
16864
16865
16866/***/ }),
16867/* 170 */
16868/***/ (function(module, exports, __webpack_require__) {
16869
16870var _curry3 = __webpack_require__(2);
16871
16872/**
16873 * Restricts a number to be within a range.
16874 *
16875 * Also works for other ordered types such as Strings and Dates.
16876 *
16877 * @func
16878 * @memberOf R
16879 * @since v0.20.0
16880 * @category Relation
16881 * @sig Ord a => a -> a -> a -> a
16882 * @param {Number} minimum The lower limit of the clamp (inclusive)
16883 * @param {Number} maximum The upper limit of the clamp (inclusive)
16884 * @param {Number} value Value to be clamped
16885 * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise
16886 * @example
16887 *
16888 * R.clamp(1, 10, -5) // => 1
16889 * R.clamp(1, 10, 15) // => 10
16890 * R.clamp(1, 10, 4) // => 4
16891 */
16892module.exports = _curry3(function clamp(min, max, value) {
16893 if (min > max) {
16894 throw new Error('min must not be greater than max in clamp(min, max, value)');
16895 }
16896 return value < min ? min :
16897 value > max ? max :
16898 value;
16899});
16900
16901
16902/***/ }),
16903/* 171 */
16904/***/ (function(module, exports, __webpack_require__) {
16905
16906var _clone = __webpack_require__(83);
16907var _curry1 = __webpack_require__(1);
16908
16909
16910/**
16911 * Creates a deep copy of the value which may contain (nested) `Array`s and
16912 * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are
16913 * assigned by reference rather than copied
16914 *
16915 * Dispatches to a `clone` method if present.
16916 *
16917 * @func
16918 * @memberOf R
16919 * @since v0.1.0
16920 * @category Object
16921 * @sig {*} -> {*}
16922 * @param {*} value The object or array to clone
16923 * @return {*} A deeply cloned copy of `val`
16924 * @example
16925 *
16926 * var objects = [{}, {}, {}];
16927 * var objectsClone = R.clone(objects);
16928 * objects === objectsClone; //=> false
16929 * objects[0] === objectsClone[0]; //=> false
16930 */
16931module.exports = _curry1(function clone(value) {
16932 return value != null && typeof value.clone === 'function' ?
16933 value.clone() :
16934 _clone(value, [], [], true);
16935});
16936
16937
16938/***/ }),
16939/* 172 */
16940/***/ (function(module, exports, __webpack_require__) {
16941
16942var _curry1 = __webpack_require__(1);
16943
16944
16945/**
16946 * Makes a comparator function out of a function that reports whether the first
16947 * element is less than the second.
16948 *
16949 * @func
16950 * @memberOf R
16951 * @since v0.1.0
16952 * @category Function
16953 * @sig (a, b -> Boolean) -> (a, b -> Number)
16954 * @param {Function} pred A predicate function of arity two which will return `true` if the first argument
16955 * is less than the second, `false` otherwise
16956 * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`
16957 * @example
16958 *
16959 * var byAge = R.comparator((a, b) => a.age < b.age);
16960 * var people = [
16961 * // ...
16962 * ];
16963 * var peopleByIncreasingAge = R.sort(byAge, people);
16964 */
16965module.exports = _curry1(function comparator(pred) {
16966 return function(a, b) {
16967 return pred(a, b) ? -1 : pred(b, a) ? 1 : 0;
16968 };
16969});
16970
16971
16972/***/ }),
16973/* 173 */
16974/***/ (function(module, exports, __webpack_require__) {
16975
16976var lift = __webpack_require__(40);
16977var not = __webpack_require__(105);
16978
16979
16980/**
16981 * Takes a function `f` and returns a function `g` such that if called with the same arguments
16982 * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`.
16983 *
16984 * `R.complement` may be applied to any functor
16985 *
16986 * @func
16987 * @memberOf R
16988 * @since v0.12.0
16989 * @category Logic
16990 * @sig (*... -> *) -> (*... -> Boolean)
16991 * @param {Function} f
16992 * @return {Function}
16993 * @see R.not
16994 * @example
16995 *
16996 * var isNotNil = R.complement(R.isNil);
16997 * isNil(null); //=> true
16998 * isNotNil(null); //=> false
16999 * isNil(7); //=> false
17000 * isNotNil(7); //=> true
17001 */
17002module.exports = lift(not);
17003
17004
17005/***/ }),
17006/* 174 */
17007/***/ (function(module, exports, __webpack_require__) {
17008
17009var pipeP = __webpack_require__(111);
17010var reverse = __webpack_require__(44);
17011
17012
17013/**
17014 * Performs right-to-left composition of one or more Promise-returning
17015 * functions. The rightmost function may have any arity; the remaining
17016 * functions must be unary.
17017 *
17018 * @func
17019 * @memberOf R
17020 * @since v0.10.0
17021 * @category Function
17022 * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z)
17023 * @param {...Function} functions The functions to compose
17024 * @return {Function}
17025 * @see R.pipeP
17026 * @example
17027 *
17028 * var db = {
17029 * users: {
17030 * JOE: {
17031 * name: 'Joe',
17032 * followers: ['STEVE', 'SUZY']
17033 * }
17034 * }
17035 * }
17036 *
17037 * // We'll pretend to do a db lookup which returns a promise
17038 * var lookupUser = (userId) => Promise.resolve(db.users[userId])
17039 * var lookupFollowers = (user) => Promise.resolve(user.followers)
17040 * lookupUser('JOE').then(lookupFollowers)
17041 *
17042 * // followersForUser :: String -> Promise [UserId]
17043 * var followersForUser = R.composeP(lookupFollowers, lookupUser);
17044 * followersForUser('JOE').then(followers => console.log('Followers:', followers))
17045 * // Followers: ["STEVE","SUZY"]
17046 */
17047module.exports = function composeP() {
17048 if (arguments.length === 0) {
17049 throw new Error('composeP requires at least one argument');
17050 }
17051 return pipeP.apply(this, reverse(arguments));
17052};
17053
17054
17055/***/ }),
17056/* 175 */
17057/***/ (function(module, exports, __webpack_require__) {
17058
17059var _arity = __webpack_require__(12);
17060var _curry1 = __webpack_require__(1);
17061var map = __webpack_require__(7);
17062var max = __webpack_require__(20);
17063var reduce = __webpack_require__(14);
17064
17065
17066/**
17067 * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
17068 * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments
17069 * to `fn` are applied to each of the predicates in turn until one returns a
17070 * "truthy" value, at which point `fn` returns the result of applying its
17071 * arguments to the corresponding transformer. If none of the predicates
17072 * matches, `fn` returns undefined.
17073 *
17074 * @func
17075 * @memberOf R
17076 * @since v0.6.0
17077 * @category Logic
17078 * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *)
17079 * @param {Array} pairs A list of [predicate, transformer]
17080 * @return {Function}
17081 * @example
17082 *
17083 * var fn = R.cond([
17084 * [R.equals(0), R.always('water freezes at 0°C')],
17085 * [R.equals(100), R.always('water boils at 100°C')],
17086 * [R.T, temp => 'nothing special happens at ' + temp + '°C']
17087 * ]);
17088 * fn(0); //=> 'water freezes at 0°C'
17089 * fn(50); //=> 'nothing special happens at 50°C'
17090 * fn(100); //=> 'water boils at 100°C'
17091 */
17092module.exports = _curry1(function cond(pairs) {
17093 var arity = reduce(max,
17094 0,
17095 map(function(pair) { return pair[0].length; }, pairs));
17096 return _arity(arity, function() {
17097 var idx = 0;
17098 while (idx < pairs.length) {
17099 if (pairs[idx][0].apply(this, arguments)) {
17100 return pairs[idx][1].apply(this, arguments);
17101 }
17102 idx += 1;
17103 }
17104 });
17105});
17106
17107
17108/***/ }),
17109/* 176 */
17110/***/ (function(module, exports, __webpack_require__) {
17111
17112var _curry1 = __webpack_require__(1);
17113var constructN = __webpack_require__(73);
17114
17115
17116/**
17117 * Wraps a constructor function inside a curried function that can be called
17118 * with the same arguments and returns the same type.
17119 *
17120 * @func
17121 * @memberOf R
17122 * @since v0.1.0
17123 * @category Function
17124 * @sig (* -> {*}) -> (* -> {*})
17125 * @param {Function} fn The constructor function to wrap.
17126 * @return {Function} A wrapped, curried constructor function.
17127 * @example
17128 *
17129 * // Constructor function
17130 * function Animal(kind) {
17131 * this.kind = kind;
17132 * };
17133 * Animal.prototype.sighting = function() {
17134 * return "It's a " + this.kind + "!";
17135 * }
17136 *
17137 * var AnimalConstructor = R.construct(Animal)
17138 *
17139 * // Notice we no longer need the 'new' keyword:
17140 * AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}};
17141 *
17142 * var animalTypes = ["Lion", "Tiger", "Bear"];
17143 * var animalSighting = R.invoker(0, 'sighting');
17144 * var sightNewAnimal = R.compose(animalSighting, AnimalConstructor);
17145 * R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"]
17146 */
17147module.exports = _curry1(function construct(Fn) {
17148 return constructN(Fn.length, Fn);
17149});
17150
17151
17152/***/ }),
17153/* 177 */
17154/***/ (function(module, exports, __webpack_require__) {
17155
17156var _contains = __webpack_require__(17);
17157var _curry2 = __webpack_require__(0);
17158
17159
17160/**
17161 * Returns `true` if the specified value is equal, in `R.equals` terms, to at
17162 * least one element of the given list; `false` otherwise.
17163 *
17164 * @func
17165 * @memberOf R
17166 * @since v0.1.0
17167 * @category List
17168 * @sig a -> [a] -> Boolean
17169 * @param {Object} a The item to compare against.
17170 * @param {Array} list The array to consider.
17171 * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise.
17172 * @see R.any
17173 * @example
17174 *
17175 * R.contains(3, [1, 2, 3]); //=> true
17176 * R.contains(4, [1, 2, 3]); //=> false
17177 * R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true
17178 * R.contains([42], [[42]]); //=> true
17179 */
17180module.exports = _curry2(_contains);
17181
17182
17183/***/ }),
17184/* 178 */
17185/***/ (function(module, exports, __webpack_require__) {
17186
17187var reduceBy = __webpack_require__(42);
17188
17189
17190/**
17191 * Counts the elements of a list according to how many match each value of a
17192 * key generated by the supplied function. Returns an object mapping the keys
17193 * produced by `fn` to the number of occurrences in the list. Note that all
17194 * keys are coerced to strings because of how JavaScript objects work.
17195 *
17196 * Acts as a transducer if a transformer is given in list position.
17197 *
17198 * @func
17199 * @memberOf R
17200 * @since v0.1.0
17201 * @category Relation
17202 * @sig (a -> String) -> [a] -> {*}
17203 * @param {Function} fn The function used to map values to keys.
17204 * @param {Array} list The list to count elements from.
17205 * @return {Object} An object mapping keys to number of occurrences in the list.
17206 * @example
17207 *
17208 * var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2];
17209 * R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1}
17210 *
17211 * var letters = ['a', 'b', 'A', 'a', 'B', 'c'];
17212 * R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1}
17213 */
17214module.exports = reduceBy(function(acc, elem) { return acc + 1; }, 0);
17215
17216
17217/***/ }),
17218/* 179 */
17219/***/ (function(module, exports, __webpack_require__) {
17220
17221var add = __webpack_require__(30);
17222
17223
17224/**
17225 * Decrements its argument.
17226 *
17227 * @func
17228 * @memberOf R
17229 * @since v0.9.0
17230 * @category Math
17231 * @sig Number -> Number
17232 * @param {Number} n
17233 * @return {Number} n - 1
17234 * @see R.inc
17235 * @example
17236 *
17237 * R.dec(42); //=> 41
17238 */
17239module.exports = add(-1);
17240
17241
17242/***/ }),
17243/* 180 */
17244/***/ (function(module, exports, __webpack_require__) {
17245
17246var _curry3 = __webpack_require__(2);
17247
17248
17249/**
17250 * Makes a descending comparator function out of a function that returns a value
17251 * that can be compared with `<` and `>`.
17252 *
17253 * @func
17254 * @memberOf R
17255 * @since v0.23.0
17256 * @category Function
17257 * @sig Ord b => (a -> b) -> a -> a -> Number
17258 * @param {Function} fn A function of arity one that returns a value that can be compared
17259 * @param {*} a The first item to be compared.
17260 * @param {*} b The second item to be compared.
17261 * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0`
17262 * @example
17263 *
17264 * var byAge = R.descend(R.prop('age'));
17265 * var people = [
17266 * // ...
17267 * ];
17268 * var peopleByOldestFirst = R.sort(byAge, people);
17269 */
17270module.exports = _curry3(function descend(fn, a, b) {
17271 var aa = fn(a);
17272 var bb = fn(b);
17273 return aa > bb ? -1 : aa < bb ? 1 : 0;
17274});
17275
17276
17277/***/ }),
17278/* 181 */
17279/***/ (function(module, exports, __webpack_require__) {
17280
17281var _curry2 = __webpack_require__(0);
17282var assoc = __webpack_require__(31);
17283var dissoc = __webpack_require__(78);
17284
17285
17286/**
17287 * Makes a shallow clone of an object, omitting the property at the given path.
17288 * Note that this copies and flattens prototype properties onto the new object
17289 * as well. All non-primitive properties are copied by reference.
17290 *
17291 * @func
17292 * @memberOf R
17293 * @since v0.11.0
17294 * @category Object
17295 * @sig [String] -> {k: v} -> {k: v}
17296 * @param {Array} path The path to the value to omit
17297 * @param {Object} obj The object to clone
17298 * @return {Object} A new object without the property at path
17299 * @see R.assocPath
17300 * @example
17301 *
17302 * R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}}
17303 */
17304module.exports = _curry2(function dissocPath(path, obj) {
17305 switch (path.length) {
17306 case 0:
17307 return obj;
17308 case 1:
17309 return dissoc(path[0], obj);
17310 default:
17311 var head = path[0];
17312 var tail = Array.prototype.slice.call(path, 1);
17313 return obj[head] == null ? obj : assoc(head, dissocPath(tail, obj[head]), obj);
17314 }
17315});
17316
17317
17318/***/ }),
17319/* 182 */
17320/***/ (function(module, exports, __webpack_require__) {
17321
17322var _curry2 = __webpack_require__(0);
17323
17324
17325/**
17326 * Divides two numbers. Equivalent to `a / b`.
17327 *
17328 * @func
17329 * @memberOf R
17330 * @since v0.1.0
17331 * @category Math
17332 * @sig Number -> Number -> Number
17333 * @param {Number} a The first value.
17334 * @param {Number} b The second value.
17335 * @return {Number} The result of `a / b`.
17336 * @see R.multiply
17337 * @example
17338 *
17339 * R.divide(71, 100); //=> 0.71
17340 *
17341 * var half = R.divide(R.__, 2);
17342 * half(42); //=> 21
17343 *
17344 * var reciprocal = R.divide(1);
17345 * reciprocal(4); //=> 0.25
17346 */
17347module.exports = _curry2(function divide(a, b) { return a / b; });
17348
17349
17350/***/ }),
17351/* 183 */
17352/***/ (function(module, exports, __webpack_require__) {
17353
17354var _curry2 = __webpack_require__(0);
17355var _dispatchable = __webpack_require__(3);
17356var _dropLast = __webpack_require__(216);
17357var _xdropLast = __webpack_require__(235);
17358
17359
17360/**
17361 * Returns a list containing all but the last `n` elements of the given `list`.
17362 *
17363 * @func
17364 * @memberOf R
17365 * @since v0.16.0
17366 * @category List
17367 * @sig Number -> [a] -> [a]
17368 * @sig Number -> String -> String
17369 * @param {Number} n The number of elements of `list` to skip.
17370 * @param {Array} list The list of elements to consider.
17371 * @return {Array} A copy of the list with only the first `list.length - n` elements
17372 * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile
17373 * @example
17374 *
17375 * R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
17376 * R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
17377 * R.dropLast(3, ['foo', 'bar', 'baz']); //=> []
17378 * R.dropLast(4, ['foo', 'bar', 'baz']); //=> []
17379 * R.dropLast(3, 'ramda'); //=> 'ra'
17380 */
17381module.exports = _curry2(_dispatchable([], _xdropLast, _dropLast));
17382
17383
17384/***/ }),
17385/* 184 */
17386/***/ (function(module, exports, __webpack_require__) {
17387
17388var _curry2 = __webpack_require__(0);
17389var _dispatchable = __webpack_require__(3);
17390var _dropLastWhile = __webpack_require__(217);
17391var _xdropLastWhile = __webpack_require__(236);
17392
17393
17394/**
17395 * Returns a new list excluding all the tailing elements of a given list which
17396 * satisfy the supplied predicate function. It passes each value from the right
17397 * to the supplied predicate function, skipping elements until the predicate
17398 * function returns a `falsy` value. The predicate function is applied to one argument:
17399 * *(value)*.
17400 *
17401 * @func
17402 * @memberOf R
17403 * @since v0.16.0
17404 * @category List
17405 * @sig (a -> Boolean) -> [a] -> [a]
17406 * @param {Function} predicate The function to be called on each element
17407 * @param {Array} list The collection to iterate over.
17408 * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`.
17409 * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile
17410 * @example
17411 *
17412 * var lteThree = x => x <= 3;
17413 *
17414 * R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
17415 */
17416module.exports = _curry2(_dispatchable([], _xdropLastWhile, _dropLastWhile));
17417
17418
17419/***/ }),
17420/* 185 */
17421/***/ (function(module, exports, __webpack_require__) {
17422
17423var _curry1 = __webpack_require__(1);
17424var _dispatchable = __webpack_require__(3);
17425var _xdropRepeatsWith = __webpack_require__(95);
17426var dropRepeatsWith = __webpack_require__(80);
17427var equals = __webpack_require__(11);
17428
17429
17430/**
17431 * Returns a new list without any consecutively repeating elements. `R.equals`
17432 * is used to determine equality.
17433 *
17434 * Acts as a transducer if a transformer is given in list position.
17435 *
17436 * @func
17437 * @memberOf R
17438 * @since v0.14.0
17439 * @category List
17440 * @sig [a] -> [a]
17441 * @param {Array} list The array to consider.
17442 * @return {Array} `list` without repeating elements.
17443 * @see R.transduce
17444 * @example
17445 *
17446 * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]
17447 */
17448module.exports = _curry1(_dispatchable([], _xdropRepeatsWith(equals), dropRepeatsWith(equals)));
17449
17450
17451/***/ }),
17452/* 186 */
17453/***/ (function(module, exports, __webpack_require__) {
17454
17455var _curry2 = __webpack_require__(0);
17456var _dispatchable = __webpack_require__(3);
17457var _xdropWhile = __webpack_require__(237);
17458
17459
17460/**
17461 * Returns a new list excluding the leading elements of a given list which
17462 * satisfy the supplied predicate function. It passes each value to the supplied
17463 * predicate function, skipping elements while the predicate function returns
17464 * `true`. The predicate function is applied to one argument: *(value)*.
17465 *
17466 * Dispatches to the `dropWhile` method of the second argument, if present.
17467 *
17468 * Acts as a transducer if a transformer is given in list position.
17469 *
17470 * @func
17471 * @memberOf R
17472 * @since v0.9.0
17473 * @category List
17474 * @sig (a -> Boolean) -> [a] -> [a]
17475 * @param {Function} fn The function called per iteration.
17476 * @param {Array} list The collection to iterate over.
17477 * @return {Array} A new array.
17478 * @see R.takeWhile, R.transduce, R.addIndex
17479 * @example
17480 *
17481 * var lteTwo = x => x <= 2;
17482 *
17483 * R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1]
17484 */
17485module.exports = _curry2(_dispatchable(['dropWhile'], _xdropWhile, function dropWhile(pred, list) {
17486 var idx = 0;
17487 var len = list.length;
17488 while (idx < len && pred(list[idx])) {
17489 idx += 1;
17490 }
17491 return Array.prototype.slice.call(list, idx);
17492}));
17493
17494
17495/***/ }),
17496/* 187 */
17497/***/ (function(module, exports, __webpack_require__) {
17498
17499var _curry2 = __webpack_require__(0);
17500var _isFunction = __webpack_require__(35);
17501var lift = __webpack_require__(40);
17502var or = __webpack_require__(107);
17503
17504
17505/**
17506 * A function wrapping calls to the two functions in an `||` operation,
17507 * returning the result of the first function if it is truth-y and the result
17508 * of the second function otherwise. Note that this is short-circuited,
17509 * meaning that the second function will not be invoked if the first returns a
17510 * truth-y value.
17511 *
17512 * In addition to functions, `R.either` also accepts any fantasy-land compatible
17513 * applicative functor.
17514 *
17515 * @func
17516 * @memberOf R
17517 * @since v0.12.0
17518 * @category Logic
17519 * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
17520 * @param {Function} f a predicate
17521 * @param {Function} g another predicate
17522 * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.
17523 * @see R.or
17524 * @example
17525 *
17526 * var gt10 = x => x > 10;
17527 * var even = x => x % 2 === 0;
17528 * var f = R.either(gt10, even);
17529 * f(101); //=> true
17530 * f(8); //=> true
17531 */
17532module.exports = _curry2(function either(f, g) {
17533 return _isFunction(f) ?
17534 function _either() {
17535 return f.apply(this, arguments) || g.apply(this, arguments);
17536 } :
17537 lift(or)(f, g);
17538});
17539
17540
17541/***/ }),
17542/* 188 */
17543/***/ (function(module, exports, __webpack_require__) {
17544
17545var _curry3 = __webpack_require__(2);
17546var equals = __webpack_require__(11);
17547
17548
17549/**
17550 * Takes a function and two values in its domain and returns `true` if the
17551 * values map to the same value in the codomain; `false` otherwise.
17552 *
17553 * @func
17554 * @memberOf R
17555 * @since v0.18.0
17556 * @category Relation
17557 * @sig (a -> b) -> a -> a -> Boolean
17558 * @param {Function} f
17559 * @param {*} x
17560 * @param {*} y
17561 * @return {Boolean}
17562 * @example
17563 *
17564 * R.eqBy(Math.abs, 5, -5); //=> true
17565 */
17566module.exports = _curry3(function eqBy(f, x, y) {
17567 return equals(f(x), f(y));
17568});
17569
17570
17571/***/ }),
17572/* 189 */
17573/***/ (function(module, exports, __webpack_require__) {
17574
17575var _curry3 = __webpack_require__(2);
17576var equals = __webpack_require__(11);
17577
17578
17579/**
17580 * Reports whether two objects have the same value, in `R.equals` terms, for
17581 * the specified property. Useful as a curried predicate.
17582 *
17583 * @func
17584 * @memberOf R
17585 * @since v0.1.0
17586 * @category Object
17587 * @sig k -> {k: v} -> {k: v} -> Boolean
17588 * @param {String} prop The name of the property to compare
17589 * @param {Object} obj1
17590 * @param {Object} obj2
17591 * @return {Boolean}
17592 *
17593 * @example
17594 *
17595 * var o1 = { a: 1, b: 2, c: 3, d: 4 };
17596 * var o2 = { a: 10, b: 20, c: 3, d: 40 };
17597 * R.eqProps('a', o1, o2); //=> false
17598 * R.eqProps('c', o1, o2); //=> true
17599 */
17600module.exports = _curry3(function eqProps(prop, obj1, obj2) {
17601 return equals(obj1[prop], obj2[prop]);
17602});
17603
17604
17605/***/ }),
17606/* 190 */
17607/***/ (function(module, exports, __webpack_require__) {
17608
17609var _curry2 = __webpack_require__(0);
17610
17611
17612/**
17613 * Creates a new object by recursively evolving a shallow copy of `object`,
17614 * according to the `transformation` functions. All non-primitive properties
17615 * are copied by reference.
17616 *
17617 * A `transformation` function will not be invoked if its corresponding key
17618 * does not exist in the evolved object.
17619 *
17620 * @func
17621 * @memberOf R
17622 * @since v0.9.0
17623 * @category Object
17624 * @sig {k: (v -> v)} -> {k: v} -> {k: v}
17625 * @param {Object} transformations The object specifying transformation functions to apply
17626 * to the object.
17627 * @param {Object} object The object to be transformed.
17628 * @return {Object} The transformed object.
17629 * @example
17630 *
17631 * var tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123};
17632 * var transformations = {
17633 * firstName: R.trim,
17634 * lastName: R.trim, // Will not get invoked.
17635 * data: {elapsed: R.add(1), remaining: R.add(-1)}
17636 * };
17637 * R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}
17638 */
17639module.exports = _curry2(function evolve(transformations, object) {
17640 var result = {};
17641 var transformation, key, type;
17642 for (key in object) {
17643 transformation = transformations[key];
17644 type = typeof transformation;
17645 result[key] = type === 'function' ? transformation(object[key])
17646 : transformation && type === 'object' ? evolve(transformation, object[key])
17647 : object[key];
17648 }
17649 return result;
17650});
17651
17652
17653/***/ }),
17654/* 191 */
17655/***/ (function(module, exports, __webpack_require__) {
17656
17657var _curry2 = __webpack_require__(0);
17658var _dispatchable = __webpack_require__(3);
17659var _xfind = __webpack_require__(239);
17660
17661
17662/**
17663 * Returns the first element of the list which matches the predicate, or
17664 * `undefined` if no element matches.
17665 *
17666 * Dispatches to the `find` method of the second argument, if present.
17667 *
17668 * Acts as a transducer if a transformer is given in list position.
17669 *
17670 * @func
17671 * @memberOf R
17672 * @since v0.1.0
17673 * @category List
17674 * @sig (a -> Boolean) -> [a] -> a | undefined
17675 * @param {Function} fn The predicate function used to determine if the element is the
17676 * desired one.
17677 * @param {Array} list The array to consider.
17678 * @return {Object} The element found, or `undefined`.
17679 * @see R.transduce
17680 * @example
17681 *
17682 * var xs = [{a: 1}, {a: 2}, {a: 3}];
17683 * R.find(R.propEq('a', 2))(xs); //=> {a: 2}
17684 * R.find(R.propEq('a', 4))(xs); //=> undefined
17685 */
17686module.exports = _curry2(_dispatchable(['find'], _xfind, function find(fn, list) {
17687 var idx = 0;
17688 var len = list.length;
17689 while (idx < len) {
17690 if (fn(list[idx])) {
17691 return list[idx];
17692 }
17693 idx += 1;
17694 }
17695}));
17696
17697
17698/***/ }),
17699/* 192 */
17700/***/ (function(module, exports, __webpack_require__) {
17701
17702var _curry2 = __webpack_require__(0);
17703var _dispatchable = __webpack_require__(3);
17704var _xfindIndex = __webpack_require__(240);
17705
17706
17707/**
17708 * Returns the index of the first element of the list which matches the
17709 * predicate, or `-1` if no element matches.
17710 *
17711 * Acts as a transducer if a transformer is given in list position.
17712 *
17713 * @func
17714 * @memberOf R
17715 * @since v0.1.1
17716 * @category List
17717 * @sig (a -> Boolean) -> [a] -> Number
17718 * @param {Function} fn The predicate function used to determine if the element is the
17719 * desired one.
17720 * @param {Array} list The array to consider.
17721 * @return {Number} The index of the element found, or `-1`.
17722 * @see R.transduce
17723 * @example
17724 *
17725 * var xs = [{a: 1}, {a: 2}, {a: 3}];
17726 * R.findIndex(R.propEq('a', 2))(xs); //=> 1
17727 * R.findIndex(R.propEq('a', 4))(xs); //=> -1
17728 */
17729module.exports = _curry2(_dispatchable([], _xfindIndex, function findIndex(fn, list) {
17730 var idx = 0;
17731 var len = list.length;
17732 while (idx < len) {
17733 if (fn(list[idx])) {
17734 return idx;
17735 }
17736 idx += 1;
17737 }
17738 return -1;
17739}));
17740
17741
17742/***/ }),
17743/* 193 */
17744/***/ (function(module, exports, __webpack_require__) {
17745
17746var _curry2 = __webpack_require__(0);
17747var _dispatchable = __webpack_require__(3);
17748var _xfindLast = __webpack_require__(241);
17749
17750
17751/**
17752 * Returns the last element of the list which matches the predicate, or
17753 * `undefined` if no element matches.
17754 *
17755 * Acts as a transducer if a transformer is given in list position.
17756 *
17757 * @func
17758 * @memberOf R
17759 * @since v0.1.1
17760 * @category List
17761 * @sig (a -> Boolean) -> [a] -> a | undefined
17762 * @param {Function} fn The predicate function used to determine if the element is the
17763 * desired one.
17764 * @param {Array} list The array to consider.
17765 * @return {Object} The element found, or `undefined`.
17766 * @see R.transduce
17767 * @example
17768 *
17769 * var xs = [{a: 1, b: 0}, {a:1, b: 1}];
17770 * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}
17771 * R.findLast(R.propEq('a', 4))(xs); //=> undefined
17772 */
17773module.exports = _curry2(_dispatchable([], _xfindLast, function findLast(fn, list) {
17774 var idx = list.length - 1;
17775 while (idx >= 0) {
17776 if (fn(list[idx])) {
17777 return list[idx];
17778 }
17779 idx -= 1;
17780 }
17781}));
17782
17783
17784/***/ }),
17785/* 194 */
17786/***/ (function(module, exports, __webpack_require__) {
17787
17788var _curry2 = __webpack_require__(0);
17789var _dispatchable = __webpack_require__(3);
17790var _xfindLastIndex = __webpack_require__(242);
17791
17792
17793/**
17794 * Returns the index of the last element of the list which matches the
17795 * predicate, or `-1` if no element matches.
17796 *
17797 * Acts as a transducer if a transformer is given in list position.
17798 *
17799 * @func
17800 * @memberOf R
17801 * @since v0.1.1
17802 * @category List
17803 * @sig (a -> Boolean) -> [a] -> Number
17804 * @param {Function} fn The predicate function used to determine if the element is the
17805 * desired one.
17806 * @param {Array} list The array to consider.
17807 * @return {Number} The index of the element found, or `-1`.
17808 * @see R.transduce
17809 * @example
17810 *
17811 * var xs = [{a: 1, b: 0}, {a:1, b: 1}];
17812 * R.findLastIndex(R.propEq('a', 1))(xs); //=> 1
17813 * R.findLastIndex(R.propEq('a', 4))(xs); //=> -1
17814 */
17815module.exports = _curry2(_dispatchable([], _xfindLastIndex, function findLastIndex(fn, list) {
17816 var idx = list.length - 1;
17817 while (idx >= 0) {
17818 if (fn(list[idx])) {
17819 return idx;
17820 }
17821 idx -= 1;
17822 }
17823 return -1;
17824}));
17825
17826
17827/***/ }),
17828/* 195 */
17829/***/ (function(module, exports, __webpack_require__) {
17830
17831var _curry1 = __webpack_require__(1);
17832var _makeFlat = __webpack_require__(93);
17833
17834
17835/**
17836 * Returns a new list by pulling every item out of it (and all its sub-arrays)
17837 * and putting them in a new array, depth-first.
17838 *
17839 * @func
17840 * @memberOf R
17841 * @since v0.1.0
17842 * @category List
17843 * @sig [a] -> [b]
17844 * @param {Array} list The array to consider.
17845 * @return {Array} The flattened list.
17846 * @see R.unnest
17847 * @example
17848 *
17849 * R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
17850 * //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
17851 */
17852module.exports = _curry1(_makeFlat(true));
17853
17854
17855/***/ }),
17856/* 196 */
17857/***/ (function(module, exports, __webpack_require__) {
17858
17859var _checkForMethod = __webpack_require__(21);
17860var _curry2 = __webpack_require__(0);
17861
17862
17863/**
17864 * Iterate over an input `list`, calling a provided function `fn` for each
17865 * element in the list.
17866 *
17867 * `fn` receives one argument: *(value)*.
17868 *
17869 * Note: `R.forEach` does not skip deleted or unassigned indices (sparse
17870 * arrays), unlike the native `Array.prototype.forEach` method. For more
17871 * details on this behavior, see:
17872 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description
17873 *
17874 * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns
17875 * the original array. In some libraries this function is named `each`.
17876 *
17877 * Dispatches to the `forEach` method of the second argument, if present.
17878 *
17879 * @func
17880 * @memberOf R
17881 * @since v0.1.1
17882 * @category List
17883 * @sig (a -> *) -> [a] -> [a]
17884 * @param {Function} fn The function to invoke. Receives one argument, `value`.
17885 * @param {Array} list The list to iterate over.
17886 * @return {Array} The original list.
17887 * @see R.addIndex
17888 * @example
17889 *
17890 * var printXPlusFive = x => console.log(x + 5);
17891 * R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3]
17892 * // logs 6
17893 * // logs 7
17894 * // logs 8
17895 * @symb R.forEach(f, [a, b, c]) = [a, b, c]
17896 */
17897module.exports = _curry2(_checkForMethod('forEach', function forEach(fn, list) {
17898 var len = list.length;
17899 var idx = 0;
17900 while (idx < len) {
17901 fn(list[idx]);
17902 idx += 1;
17903 }
17904 return list;
17905}));
17906
17907
17908/***/ }),
17909/* 197 */
17910/***/ (function(module, exports, __webpack_require__) {
17911
17912var _curry2 = __webpack_require__(0);
17913var keys = __webpack_require__(13);
17914
17915
17916/**
17917 * Iterate over an input `object`, calling a provided function `fn` for each
17918 * key and value in the object.
17919 *
17920 * `fn` receives three argument: *(value, key, obj)*.
17921 *
17922 * @func
17923 * @memberOf R
17924 * @since v0.23.0
17925 * @category Object
17926 * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a
17927 * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`.
17928 * @param {Object} obj The object to iterate over.
17929 * @return {Object} The original object.
17930 * @example
17931 *
17932 * var printKeyConcatValue = (value, key) => console.log(key + ':' + value);
17933 * R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2}
17934 * // logs x:1
17935 * // logs y:2
17936 * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b}
17937 */
17938module.exports = _curry2(function forEachObjIndexed(fn, obj) {
17939 var keyList = keys(obj);
17940 var idx = 0;
17941 while (idx < keyList.length) {
17942 var key = keyList[idx];
17943 fn(obj[key], key, obj);
17944 idx += 1;
17945 }
17946 return obj;
17947});
17948
17949
17950/***/ }),
17951/* 198 */
17952/***/ (function(module, exports, __webpack_require__) {
17953
17954var _curry1 = __webpack_require__(1);
17955
17956
17957/**
17958 * Creates a new object from a list key-value pairs. If a key appears in
17959 * multiple pairs, the rightmost pair is included in the object.
17960 *
17961 * @func
17962 * @memberOf R
17963 * @since v0.3.0
17964 * @category List
17965 * @sig [[k,v]] -> {k: v}
17966 * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.
17967 * @return {Object} The object made by pairing up `keys` and `values`.
17968 * @see R.toPairs, R.pair
17969 * @example
17970 *
17971 * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
17972 */
17973module.exports = _curry1(function fromPairs(pairs) {
17974 var result = {};
17975 var idx = 0;
17976 while (idx < pairs.length) {
17977 result[pairs[idx][0]] = pairs[idx][1];
17978 idx += 1;
17979 }
17980 return result;
17981});
17982
17983
17984/***/ }),
17985/* 199 */
17986/***/ (function(module, exports, __webpack_require__) {
17987
17988var _checkForMethod = __webpack_require__(21);
17989var _curry2 = __webpack_require__(0);
17990var reduceBy = __webpack_require__(42);
17991
17992/**
17993 * Splits a list into sub-lists stored in an object, based on the result of
17994 * calling a String-returning function on each element, and grouping the
17995 * results according to values returned.
17996 *
17997 * Dispatches to the `groupBy` method of the second argument, if present.
17998 *
17999 * Acts as a transducer if a transformer is given in list position.
18000 *
18001 * @func
18002 * @memberOf R
18003 * @since v0.1.0
18004 * @category List
18005 * @sig (a -> String) -> [a] -> {String: [a]}
18006 * @param {Function} fn Function :: a -> String
18007 * @param {Array} list The array to group
18008 * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements
18009 * that produced that key when passed to `fn`.
18010 * @see R.transduce
18011 * @example
18012 *
18013 * var byGrade = R.groupBy(function(student) {
18014 * var score = student.score;
18015 * return score < 65 ? 'F' :
18016 * score < 70 ? 'D' :
18017 * score < 80 ? 'C' :
18018 * score < 90 ? 'B' : 'A';
18019 * });
18020 * var students = [{name: 'Abby', score: 84},
18021 * {name: 'Eddy', score: 58},
18022 * // ...
18023 * {name: 'Jack', score: 69}];
18024 * byGrade(students);
18025 * // {
18026 * // 'A': [{name: 'Dianne', score: 99}],
18027 * // 'B': [{name: 'Abby', score: 84}]
18028 * // // ...,
18029 * // 'F': [{name: 'Eddy', score: 58}]
18030 * // }
18031 */
18032module.exports = _curry2(_checkForMethod('groupBy', reduceBy(function(acc, item) {
18033 if (acc == null) {
18034 acc = [];
18035 }
18036 acc.push(item);
18037 return acc;
18038}, null)));
18039
18040
18041/***/ }),
18042/* 200 */
18043/***/ (function(module, exports, __webpack_require__) {
18044
18045var _curry2 = __webpack_require__(0);
18046
18047/**
18048 * Takes a list and returns a list of lists where each sublist's elements are
18049 * all "equal" according to the provided equality function.
18050 *
18051 * @func
18052 * @memberOf R
18053 * @since v0.21.0
18054 * @category List
18055 * @sig ((a, a) → Boolean) → [a] → [[a]]
18056 * @param {Function} fn Function for determining whether two given (adjacent)
18057 * elements should be in the same group
18058 * @param {Array} list The array to group. Also accepts a string, which will be
18059 * treated as a list of characters.
18060 * @return {List} A list that contains sublists of equal elements,
18061 * whose concatenations are equal to the original list.
18062 * @example
18063 *
18064 * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
18065 * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]]
18066 *
18067 * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
18068 * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
18069 *
18070 * R.groupWith(R.eqBy(isVowel), 'aestiou')
18071 * //=> ['ae', 'st', 'iou']
18072 */
18073module.exports = _curry2(function(fn, list) {
18074 var res = [];
18075 var idx = 0;
18076 var len = list.length;
18077 while (idx < len) {
18078 var nextidx = idx + 1;
18079 while (nextidx < len && fn(list[idx], list[nextidx])) {
18080 nextidx += 1;
18081 }
18082 res.push(list.slice(idx, nextidx));
18083 idx = nextidx;
18084 }
18085 return res;
18086});
18087
18088
18089/***/ }),
18090/* 201 */
18091/***/ (function(module, exports, __webpack_require__) {
18092
18093var _curry2 = __webpack_require__(0);
18094
18095
18096/**
18097 * Returns `true` if the first argument is greater than the second; `false`
18098 * otherwise.
18099 *
18100 * @func
18101 * @memberOf R
18102 * @since v0.1.0
18103 * @category Relation
18104 * @sig Ord a => a -> a -> Boolean
18105 * @param {*} a
18106 * @param {*} b
18107 * @return {Boolean}
18108 * @see R.lt
18109 * @example
18110 *
18111 * R.gt(2, 1); //=> true
18112 * R.gt(2, 2); //=> false
18113 * R.gt(2, 3); //=> false
18114 * R.gt('a', 'z'); //=> false
18115 * R.gt('z', 'a'); //=> true
18116 */
18117module.exports = _curry2(function gt(a, b) { return a > b; });
18118
18119
18120/***/ }),
18121/* 202 */
18122/***/ (function(module, exports, __webpack_require__) {
18123
18124var _curry2 = __webpack_require__(0);
18125
18126
18127/**
18128 * Returns `true` if the first argument is greater than or equal to the second;
18129 * `false` otherwise.
18130 *
18131 * @func
18132 * @memberOf R
18133 * @since v0.1.0
18134 * @category Relation
18135 * @sig Ord a => a -> a -> Boolean
18136 * @param {Number} a
18137 * @param {Number} b
18138 * @return {Boolean}
18139 * @see R.lte
18140 * @example
18141 *
18142 * R.gte(2, 1); //=> true
18143 * R.gte(2, 2); //=> true
18144 * R.gte(2, 3); //=> false
18145 * R.gte('a', 'z'); //=> false
18146 * R.gte('z', 'a'); //=> true
18147 */
18148module.exports = _curry2(function gte(a, b) { return a >= b; });
18149
18150
18151/***/ }),
18152/* 203 */
18153/***/ (function(module, exports, __webpack_require__) {
18154
18155var _curry2 = __webpack_require__(0);
18156var _has = __webpack_require__(6);
18157
18158
18159/**
18160 * Returns whether or not an object has an own property with the specified name
18161 *
18162 * @func
18163 * @memberOf R
18164 * @since v0.7.0
18165 * @category Object
18166 * @sig s -> {s: x} -> Boolean
18167 * @param {String} prop The name of the property to check for.
18168 * @param {Object} obj The object to query.
18169 * @return {Boolean} Whether the property exists.
18170 * @example
18171 *
18172 * var hasName = R.has('name');
18173 * hasName({name: 'alice'}); //=> true
18174 * hasName({name: 'bob'}); //=> true
18175 * hasName({}); //=> false
18176 *
18177 * var point = {x: 0, y: 0};
18178 * var pointHas = R.has(R.__, point);
18179 * pointHas('x'); //=> true
18180 * pointHas('y'); //=> true
18181 * pointHas('z'); //=> false
18182 */
18183module.exports = _curry2(_has);
18184
18185
18186/***/ }),
18187/* 204 */
18188/***/ (function(module, exports, __webpack_require__) {
18189
18190var _curry2 = __webpack_require__(0);
18191
18192
18193/**
18194 * Returns whether or not an object or its prototype chain has a property with
18195 * the specified name
18196 *
18197 * @func
18198 * @memberOf R
18199 * @since v0.7.0
18200 * @category Object
18201 * @sig s -> {s: x} -> Boolean
18202 * @param {String} prop The name of the property to check for.
18203 * @param {Object} obj The object to query.
18204 * @return {Boolean} Whether the property exists.
18205 * @example
18206 *
18207 * function Rectangle(width, height) {
18208 * this.width = width;
18209 * this.height = height;
18210 * }
18211 * Rectangle.prototype.area = function() {
18212 * return this.width * this.height;
18213 * };
18214 *
18215 * var square = new Rectangle(2, 2);
18216 * R.hasIn('width', square); //=> true
18217 * R.hasIn('area', square); //=> true
18218 */
18219module.exports = _curry2(function hasIn(prop, obj) {
18220 return prop in obj;
18221});
18222
18223
18224/***/ }),
18225/* 205 */
18226/***/ (function(module, exports, __webpack_require__) {
18227
18228var nth = __webpack_require__(24);
18229
18230
18231/**
18232 * Returns the first element of the given list or string. In some libraries
18233 * this function is named `first`.
18234 *
18235 * @func
18236 * @memberOf R
18237 * @since v0.1.0
18238 * @category List
18239 * @sig [a] -> a | Undefined
18240 * @sig String -> String
18241 * @param {Array|String} list
18242 * @return {*}
18243 * @see R.tail, R.init, R.last
18244 * @example
18245 *
18246 * R.head(['fi', 'fo', 'fum']); //=> 'fi'
18247 * R.head([]); //=> undefined
18248 *
18249 * R.head('abc'); //=> 'a'
18250 * R.head(''); //=> ''
18251 */
18252module.exports = nth(0);
18253
18254
18255/***/ }),
18256/* 206 */
18257/***/ (function(module, exports, __webpack_require__) {
18258
18259var _curry3 = __webpack_require__(2);
18260var curryN = __webpack_require__(5);
18261
18262
18263/**
18264 * Creates a function that will process either the `onTrue` or the `onFalse`
18265 * function depending upon the result of the `condition` predicate.
18266 *
18267 * @func
18268 * @memberOf R
18269 * @since v0.8.0
18270 * @category Logic
18271 * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *)
18272 * @param {Function} condition A predicate function
18273 * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value.
18274 * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value.
18275 * @return {Function} A new unary function that will process either the `onTrue` or the `onFalse`
18276 * function depending upon the result of the `condition` predicate.
18277 * @see R.unless, R.when
18278 * @example
18279 *
18280 * var incCount = R.ifElse(
18281 * R.has('count'),
18282 * R.over(R.lensProp('count'), R.inc),
18283 * R.assoc('count', 1)
18284 * );
18285 * incCount({}); //=> { count: 1 }
18286 * incCount({ count: 1 }); //=> { count: 2 }
18287 */
18288module.exports = _curry3(function ifElse(condition, onTrue, onFalse) {
18289 return curryN(Math.max(condition.length, onTrue.length, onFalse.length),
18290 function _ifElse() {
18291 return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);
18292 }
18293 );
18294});
18295
18296
18297/***/ }),
18298/* 207 */
18299/***/ (function(module, exports, __webpack_require__) {
18300
18301var add = __webpack_require__(30);
18302
18303
18304/**
18305 * Increments its argument.
18306 *
18307 * @func
18308 * @memberOf R
18309 * @since v0.9.0
18310 * @category Math
18311 * @sig Number -> Number
18312 * @param {Number} n
18313 * @return {Number} n + 1
18314 * @see R.dec
18315 * @example
18316 *
18317 * R.inc(42); //=> 43
18318 */
18319module.exports = add(1);
18320
18321
18322/***/ }),
18323/* 208 */
18324/***/ (function(module, exports, __webpack_require__) {
18325
18326var reduceBy = __webpack_require__(42);
18327
18328
18329/**
18330 * Given a function that generates a key, turns a list of objects into an
18331 * object indexing the objects by the given key. Note that if multiple
18332 * objects generate the same value for the indexing key only the last value
18333 * will be included in the generated object.
18334 *
18335 * Acts as a transducer if a transformer is given in list position.
18336 *
18337 * @func
18338 * @memberOf R
18339 * @since v0.19.0
18340 * @category List
18341 * @sig (a -> String) -> [{k: v}] -> {k: {k: v}}
18342 * @param {Function} fn Function :: a -> String
18343 * @param {Array} array The array of objects to index
18344 * @return {Object} An object indexing each array element by the given property.
18345 * @example
18346 *
18347 * var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}];
18348 * R.indexBy(R.prop('id'), list);
18349 * //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}
18350 */
18351module.exports = reduceBy(function(acc, elem) { return elem; }, null);
18352
18353
18354/***/ }),
18355/* 209 */
18356/***/ (function(module, exports, __webpack_require__) {
18357
18358var _curry2 = __webpack_require__(0);
18359var _indexOf = __webpack_require__(88);
18360var _isArray = __webpack_require__(15);
18361
18362
18363/**
18364 * Returns the position of the first occurrence of an item in an array, or -1
18365 * if the item is not included in the array. `R.equals` is used to determine
18366 * equality.
18367 *
18368 * @func
18369 * @memberOf R
18370 * @since v0.1.0
18371 * @category List
18372 * @sig a -> [a] -> Number
18373 * @param {*} target The item to find.
18374 * @param {Array} xs The array to search in.
18375 * @return {Number} the index of the target, or -1 if the target is not found.
18376 * @see R.lastIndexOf
18377 * @example
18378 *
18379 * R.indexOf(3, [1,2,3,4]); //=> 2
18380 * R.indexOf(10, [1,2,3,4]); //=> -1
18381 */
18382module.exports = _curry2(function indexOf(target, xs) {
18383 return typeof xs.indexOf === 'function' && !_isArray(xs) ?
18384 xs.indexOf(target) :
18385 _indexOf(xs, target, 0);
18386});
18387
18388
18389/***/ }),
18390/* 210 */
18391/***/ (function(module, exports, __webpack_require__) {
18392
18393var slice = __webpack_require__(18);
18394
18395
18396/**
18397 * Returns all but the last element of the given list or string.
18398 *
18399 * @func
18400 * @memberOf R
18401 * @since v0.9.0
18402 * @category List
18403 * @sig [a] -> [a]
18404 * @sig String -> String
18405 * @param {*} list
18406 * @return {*}
18407 * @see R.last, R.head, R.tail
18408 * @example
18409 *
18410 * R.init([1, 2, 3]); //=> [1, 2]
18411 * R.init([1, 2]); //=> [1]
18412 * R.init([1]); //=> []
18413 * R.init([]); //=> []
18414 *
18415 * R.init('abc'); //=> 'ab'
18416 * R.init('ab'); //=> 'a'
18417 * R.init('a'); //=> ''
18418 * R.init(''); //=> ''
18419 */
18420module.exports = slice(0, -1);
18421
18422
18423/***/ }),
18424/* 211 */
18425/***/ (function(module, exports, __webpack_require__) {
18426
18427var _curry3 = __webpack_require__(2);
18428
18429
18430/**
18431 * Inserts the supplied element into the list, at index `index`. _Note that
18432 * this is not destructive_: it returns a copy of the list with the changes.
18433 * <small>No lists have been harmed in the application of this function.</small>
18434 *
18435 * @func
18436 * @memberOf R
18437 * @since v0.2.2
18438 * @category List
18439 * @sig Number -> a -> [a] -> [a]
18440 * @param {Number} index The position to insert the element
18441 * @param {*} elt The element to insert into the Array
18442 * @param {Array} list The list to insert into
18443 * @return {Array} A new Array with `elt` inserted at `index`.
18444 * @example
18445 *
18446 * R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4]
18447 */
18448module.exports = _curry3(function insert(idx, elt, list) {
18449 idx = idx < list.length && idx >= 0 ? idx : list.length;
18450 var result = Array.prototype.slice.call(list, 0);
18451 result.splice(idx, 0, elt);
18452 return result;
18453});
18454
18455
18456/***/ }),
18457/* 212 */
18458/***/ (function(module, exports, __webpack_require__) {
18459
18460var _curry3 = __webpack_require__(2);
18461
18462
18463/**
18464 * Inserts the sub-list into the list, at index `index`. _Note that this is not
18465 * destructive_: it returns a copy of the list with the changes.
18466 * <small>No lists have been harmed in the application of this function.</small>
18467 *
18468 * @func
18469 * @memberOf R
18470 * @since v0.9.0
18471 * @category List
18472 * @sig Number -> [a] -> [a] -> [a]
18473 * @param {Number} index The position to insert the sub-list
18474 * @param {Array} elts The sub-list to insert into the Array
18475 * @param {Array} list The list to insert the sub-list into
18476 * @return {Array} A new Array with `elts` inserted starting at `index`.
18477 * @example
18478 *
18479 * R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4]
18480 */
18481module.exports = _curry3(function insertAll(idx, elts, list) {
18482 idx = idx < list.length && idx >= 0 ? idx : list.length;
18483 return [].concat(Array.prototype.slice.call(list, 0, idx),
18484 elts,
18485 Array.prototype.slice.call(list, idx));
18486});
18487
18488
18489/***/ }),
18490/* 213 */
18491/***/ (function(module, exports, __webpack_require__) {
18492
18493var _contains = __webpack_require__(17);
18494
18495
18496// A simple Set type that honours R.equals semantics
18497module.exports = (function() {
18498 function _Set() {
18499 /* globals Set */
18500 this._nativeSet = typeof Set === 'function' ? new Set() : null;
18501 this._items = {};
18502 }
18503
18504 // until we figure out why jsdoc chokes on this
18505 // @param item The item to add to the Set
18506 // @returns {boolean} true if the item did not exist prior, otherwise false
18507 //
18508 _Set.prototype.add = function(item) {
18509 return !hasOrAdd(item, true, this);
18510 };
18511
18512 //
18513 // @param item The item to check for existence in the Set
18514 // @returns {boolean} true if the item exists in the Set, otherwise false
18515 //
18516 _Set.prototype.has = function(item) {
18517 return hasOrAdd(item, false, this);
18518 };
18519
18520 //
18521 // Combines the logic for checking whether an item is a member of the set and
18522 // for adding a new item to the set.
18523 //
18524 // @param item The item to check or add to the Set instance.
18525 // @param shouldAdd If true, the item will be added to the set if it doesn't
18526 // already exist.
18527 // @param set The set instance to check or add to.
18528 // @return {boolean} true if the item already existed, otherwise false.
18529 //
18530 function hasOrAdd(item, shouldAdd, set) {
18531 var type = typeof item;
18532 var prevSize, newSize;
18533 switch (type) {
18534 case 'string':
18535 case 'number':
18536 // distinguish between +0 and -0
18537 if (item === 0 && 1 / item === -Infinity) {
18538 if (set._items['-0']) {
18539 return true;
18540 } else {
18541 if (shouldAdd) {
18542 set._items['-0'] = true;
18543 }
18544 return false;
18545 }
18546 }
18547 // these types can all utilise the native Set
18548 if (set._nativeSet !== null) {
18549 if (shouldAdd) {
18550 prevSize = set._nativeSet.size;
18551 set._nativeSet.add(item);
18552 newSize = set._nativeSet.size;
18553 return newSize === prevSize;
18554 } else {
18555 return set._nativeSet.has(item);
18556 }
18557 } else {
18558 if (!(type in set._items)) {
18559 if (shouldAdd) {
18560 set._items[type] = {};
18561 set._items[type][item] = true;
18562 }
18563 return false;
18564 } else if (item in set._items[type]) {
18565 return true;
18566 } else {
18567 if (shouldAdd) {
18568 set._items[type][item] = true;
18569 }
18570 return false;
18571 }
18572 }
18573
18574 case 'boolean':
18575 // set._items['boolean'] holds a two element array
18576 // representing [ falseExists, trueExists ]
18577 if (type in set._items) {
18578 var bIdx = item ? 1 : 0;
18579 if (set._items[type][bIdx]) {
18580 return true;
18581 } else {
18582 if (shouldAdd) {
18583 set._items[type][bIdx] = true;
18584 }
18585 return false;
18586 }
18587 } else {
18588 if (shouldAdd) {
18589 set._items[type] = item ? [false, true] : [true, false];
18590 }
18591 return false;
18592 }
18593
18594 case 'function':
18595 // compare functions for reference equality
18596 if (set._nativeSet !== null) {
18597 if (shouldAdd) {
18598 prevSize = set._nativeSet.size;
18599 set._nativeSet.add(item);
18600 newSize = set._nativeSet.size;
18601 return newSize === prevSize;
18602 } else {
18603 return set._nativeSet.has(item);
18604 }
18605 } else {
18606 if (!(type in set._items)) {
18607 if (shouldAdd) {
18608 set._items[type] = [item];
18609 }
18610 return false;
18611 }
18612 if (!_contains(item, set._items[type])) {
18613 if (shouldAdd) {
18614 set._items[type].push(item);
18615 }
18616 return false;
18617 }
18618 return true;
18619 }
18620
18621 case 'undefined':
18622 if (set._items[type]) {
18623 return true;
18624 } else {
18625 if (shouldAdd) {
18626 set._items[type] = true;
18627 }
18628 return false;
18629 }
18630
18631 case 'object':
18632 if (item === null) {
18633 if (!set._items['null']) {
18634 if (shouldAdd) {
18635 set._items['null'] = true;
18636 }
18637 return false;
18638 }
18639 return true;
18640 }
18641 /* falls through */
18642 default:
18643 // reduce the search size of heterogeneous sets by creating buckets
18644 // for each type.
18645 type = Object.prototype.toString.call(item);
18646 if (!(type in set._items)) {
18647 if (shouldAdd) {
18648 set._items[type] = [item];
18649 }
18650 return false;
18651 }
18652 // scan through all previously applied items
18653 if (!_contains(item, set._items[type])) {
18654 if (shouldAdd) {
18655 set._items[type].push(item);
18656 }
18657 return false;
18658 }
18659 return true;
18660 }
18661 }
18662 return _Set;
18663}());
18664
18665
18666/***/ }),
18667/* 214 */
18668/***/ (function(module, exports) {
18669
18670module.exports = function _aperture(n, list) {
18671 var idx = 0;
18672 var limit = list.length - (n - 1);
18673 var acc = new Array(limit >= 0 ? limit : 0);
18674 while (idx < limit) {
18675 acc[idx] = Array.prototype.slice.call(list, idx, idx + n);
18676 idx += 1;
18677 }
18678 return acc;
18679};
18680
18681
18682/***/ }),
18683/* 215 */
18684/***/ (function(module, exports) {
18685
18686module.exports = function _arrayFromIterator(iter) {
18687 var list = [];
18688 var next;
18689 while (!(next = iter.next()).done) {
18690 list.push(next.value);
18691 }
18692 return list;
18693};
18694
18695
18696/***/ }),
18697/* 216 */
18698/***/ (function(module, exports, __webpack_require__) {
18699
18700var take = __webpack_require__(116);
18701
18702module.exports = function dropLast(n, xs) {
18703 return take(n < xs.length ? xs.length - n : 0, xs);
18704};
18705
18706
18707/***/ }),
18708/* 217 */
18709/***/ (function(module, exports) {
18710
18711module.exports = function dropLastWhile(pred, list) {
18712 var idx = list.length - 1;
18713 while (idx >= 0 && pred(list[idx])) {
18714 idx -= 1;
18715 }
18716 return Array.prototype.slice.call(list, 0, idx + 1);
18717};
18718
18719
18720/***/ }),
18721/* 218 */
18722/***/ (function(module, exports, __webpack_require__) {
18723
18724var _arrayFromIterator = __webpack_require__(215);
18725var _functionName = __webpack_require__(221);
18726var _has = __webpack_require__(6);
18727var identical = __webpack_require__(82);
18728var keys = __webpack_require__(13);
18729var type = __webpack_require__(58);
18730
18731
18732module.exports = function _equals(a, b, stackA, stackB) {
18733 if (identical(a, b)) {
18734 return true;
18735 }
18736
18737 if (type(a) !== type(b)) {
18738 return false;
18739 }
18740
18741 if (a == null || b == null) {
18742 return false;
18743 }
18744
18745 if (typeof a.equals === 'function' || typeof b.equals === 'function') {
18746 return typeof a.equals === 'function' && a.equals(b) &&
18747 typeof b.equals === 'function' && b.equals(a);
18748 }
18749
18750 switch (type(a)) {
18751 case 'Arguments':
18752 case 'Array':
18753 case 'Object':
18754 if (typeof a.constructor === 'function' &&
18755 _functionName(a.constructor) === 'Promise') {
18756 return a === b;
18757 }
18758 break;
18759 case 'Boolean':
18760 case 'Number':
18761 case 'String':
18762 if (!(typeof a === typeof b && identical(a.valueOf(), b.valueOf()))) {
18763 return false;
18764 }
18765 break;
18766 case 'Date':
18767 if (!identical(a.valueOf(), b.valueOf())) {
18768 return false;
18769 }
18770 break;
18771 case 'Error':
18772 return a.name === b.name && a.message === b.message;
18773 case 'RegExp':
18774 if (!(a.source === b.source &&
18775 a.global === b.global &&
18776 a.ignoreCase === b.ignoreCase &&
18777 a.multiline === b.multiline &&
18778 a.sticky === b.sticky &&
18779 a.unicode === b.unicode)) {
18780 return false;
18781 }
18782 break;
18783 case 'Map':
18784 case 'Set':
18785 if (!_equals(_arrayFromIterator(a.entries()), _arrayFromIterator(b.entries()), stackA, stackB)) {
18786 return false;
18787 }
18788 break;
18789 case 'Int8Array':
18790 case 'Uint8Array':
18791 case 'Uint8ClampedArray':
18792 case 'Int16Array':
18793 case 'Uint16Array':
18794 case 'Int32Array':
18795 case 'Uint32Array':
18796 case 'Float32Array':
18797 case 'Float64Array':
18798 break;
18799 case 'ArrayBuffer':
18800 break;
18801 default:
18802 // Values of other types are only equal if identical.
18803 return false;
18804 }
18805
18806 var keysA = keys(a);
18807 if (keysA.length !== keys(b).length) {
18808 return false;
18809 }
18810
18811 var idx = stackA.length - 1;
18812 while (idx >= 0) {
18813 if (stackA[idx] === a) {
18814 return stackB[idx] === b;
18815 }
18816 idx -= 1;
18817 }
18818
18819 stackA.push(a);
18820 stackB.push(b);
18821 idx = keysA.length - 1;
18822 while (idx >= 0) {
18823 var key = keysA[idx];
18824 if (!(_has(key, b) && _equals(b[key], a[key], stackA, stackB))) {
18825 return false;
18826 }
18827 idx -= 1;
18828 }
18829 stackA.pop();
18830 stackB.pop();
18831 return true;
18832};
18833
18834
18835/***/ }),
18836/* 219 */
18837/***/ (function(module, exports, __webpack_require__) {
18838
18839var _forceReduced = __webpack_require__(220);
18840var _reduce = __webpack_require__(9);
18841var _xfBase = __webpack_require__(4);
18842var isArrayLike = __webpack_require__(23);
18843
18844module.exports = (function() {
18845 var preservingReduced = function(xf) {
18846 return {
18847 '@@transducer/init': _xfBase.init,
18848 '@@transducer/result': function(result) {
18849 return xf['@@transducer/result'](result);
18850 },
18851 '@@transducer/step': function(result, input) {
18852 var ret = xf['@@transducer/step'](result, input);
18853 return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
18854 }
18855 };
18856 };
18857
18858 return function _xcat(xf) {
18859 var rxf = preservingReduced(xf);
18860 return {
18861 '@@transducer/init': _xfBase.init,
18862 '@@transducer/result': function(result) {
18863 return rxf['@@transducer/result'](result);
18864 },
18865 '@@transducer/step': function(result, input) {
18866 return !isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input);
18867 }
18868 };
18869 };
18870}());
18871
18872
18873/***/ }),
18874/* 220 */
18875/***/ (function(module, exports) {
18876
18877module.exports = function _forceReduced(x) {
18878 return {
18879 '@@transducer/value': x,
18880 '@@transducer/reduced': true
18881 };
18882};
18883
18884
18885/***/ }),
18886/* 221 */
18887/***/ (function(module, exports) {
18888
18889module.exports = function _functionName(f) {
18890 // String(x => x) evaluates to "x => x", so the pattern may not match.
18891 var match = String(f).match(/^function (\w*)/);
18892 return match == null ? '' : match[1];
18893};
18894
18895
18896/***/ }),
18897/* 222 */
18898/***/ (function(module, exports) {
18899
18900module.exports = function _isRegExp(x) {
18901 return Object.prototype.toString.call(x) === '[object RegExp]';
18902};
18903
18904
18905/***/ }),
18906/* 223 */
18907/***/ (function(module, exports, __webpack_require__) {
18908
18909var _has = __webpack_require__(6);
18910
18911// Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
18912module.exports = function _objectAssign(target) {
18913 if (target == null) {
18914 throw new TypeError('Cannot convert undefined or null to object');
18915 }
18916
18917 var output = Object(target);
18918 var idx = 1;
18919 var length = arguments.length;
18920 while (idx < length) {
18921 var source = arguments[idx];
18922 if (source != null) {
18923 for (var nextKey in source) {
18924 if (_has(nextKey, source)) {
18925 output[nextKey] = source[nextKey];
18926 }
18927 }
18928 }
18929 idx += 1;
18930 }
18931 return output;
18932};
18933
18934
18935/***/ }),
18936/* 224 */
18937/***/ (function(module, exports) {
18938
18939module.exports = function _of(x) { return [x]; };
18940
18941
18942/***/ }),
18943/* 225 */
18944/***/ (function(module, exports) {
18945
18946module.exports = function _pipe(f, g) {
18947 return function() {
18948 return g.call(this, f.apply(this, arguments));
18949 };
18950};
18951
18952
18953/***/ }),
18954/* 226 */
18955/***/ (function(module, exports) {
18956
18957module.exports = function _pipeP(f, g) {
18958 return function() {
18959 var ctx = this;
18960 return f.apply(ctx, arguments).then(function(x) {
18961 return g.call(ctx, x);
18962 });
18963 };
18964};
18965
18966
18967/***/ }),
18968/* 227 */
18969/***/ (function(module, exports) {
18970
18971module.exports = function _quote(s) {
18972 var escaped = s
18973 .replace(/\\/g, '\\\\')
18974 .replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace
18975 .replace(/\f/g, '\\f')
18976 .replace(/\n/g, '\\n')
18977 .replace(/\r/g, '\\r')
18978 .replace(/\t/g, '\\t')
18979 .replace(/\v/g, '\\v')
18980 .replace(/\0/g, '\\0');
18981
18982 return '"' + escaped.replace(/"/g, '\\"') + '"';
18983};
18984
18985
18986/***/ }),
18987/* 228 */
18988/***/ (function(module, exports, __webpack_require__) {
18989
18990var _assign = __webpack_require__(52);
18991var _identity = __webpack_require__(54);
18992var _isTransformer = __webpack_require__(55);
18993var isArrayLike = __webpack_require__(23);
18994var objOf = __webpack_require__(106);
18995
18996
18997module.exports = (function() {
18998 var _stepCatArray = {
18999 '@@transducer/init': Array,
19000 '@@transducer/step': function(xs, x) {
19001 xs.push(x);
19002 return xs;
19003 },
19004 '@@transducer/result': _identity
19005 };
19006 var _stepCatString = {
19007 '@@transducer/init': String,
19008 '@@transducer/step': function(a, b) { return a + b; },
19009 '@@transducer/result': _identity
19010 };
19011 var _stepCatObject = {
19012 '@@transducer/init': Object,
19013 '@@transducer/step': function(result, input) {
19014 return _assign(
19015 result,
19016 isArrayLike(input) ? objOf(input[0], input[1]) : input
19017 );
19018 },
19019 '@@transducer/result': _identity
19020 };
19021
19022 return function _stepCat(obj) {
19023 if (_isTransformer(obj)) {
19024 return obj;
19025 }
19026 if (isArrayLike(obj)) {
19027 return _stepCatArray;
19028 }
19029 if (typeof obj === 'string') {
19030 return _stepCatString;
19031 }
19032 if (typeof obj === 'object') {
19033 return _stepCatObject;
19034 }
19035 throw new Error('Cannot create transformer for ' + obj);
19036 };
19037}());
19038
19039
19040/***/ }),
19041/* 229 */
19042/***/ (function(module, exports) {
19043
19044/**
19045 * Polyfill from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString>.
19046 */
19047module.exports = (function() {
19048 var pad = function pad(n) { return (n < 10 ? '0' : '') + n; };
19049
19050 return typeof Date.prototype.toISOString === 'function' ?
19051 function _toISOString(d) {
19052 return d.toISOString();
19053 } :
19054 function _toISOString(d) {
19055 return (
19056 d.getUTCFullYear() + '-' +
19057 pad(d.getUTCMonth() + 1) + '-' +
19058 pad(d.getUTCDate()) + 'T' +
19059 pad(d.getUTCHours()) + ':' +
19060 pad(d.getUTCMinutes()) + ':' +
19061 pad(d.getUTCSeconds()) + '.' +
19062 (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'
19063 );
19064 };
19065}());
19066
19067
19068/***/ }),
19069/* 230 */
19070/***/ (function(module, exports, __webpack_require__) {
19071
19072var _contains = __webpack_require__(17);
19073var _map = __webpack_require__(38);
19074var _quote = __webpack_require__(227);
19075var _toISOString = __webpack_require__(229);
19076var keys = __webpack_require__(13);
19077var reject = __webpack_require__(43);
19078
19079
19080module.exports = function _toString(x, seen) {
19081 var recur = function recur(y) {
19082 var xs = seen.concat([x]);
19083 return _contains(y, xs) ? '<Circular>' : _toString(y, xs);
19084 };
19085
19086 // mapPairs :: (Object, [String]) -> [String]
19087 var mapPairs = function(obj, keys) {
19088 return _map(function(k) { return _quote(k) + ': ' + recur(obj[k]); }, keys.slice().sort());
19089 };
19090
19091 switch (Object.prototype.toString.call(x)) {
19092 case '[object Arguments]':
19093 return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';
19094 case '[object Array]':
19095 return '[' + _map(recur, x).concat(mapPairs(x, reject(function(k) { return /^\d+$/.test(k); }, keys(x)))).join(', ') + ']';
19096 case '[object Boolean]':
19097 return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();
19098 case '[object Date]':
19099 return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';
19100 case '[object Null]':
19101 return 'null';
19102 case '[object Number]':
19103 return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10);
19104 case '[object String]':
19105 return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x);
19106 case '[object Undefined]':
19107 return 'undefined';
19108 default:
19109 if (typeof x.toString === 'function') {
19110 var repr = x.toString();
19111 if (repr !== '[object Object]') {
19112 return repr;
19113 }
19114 }
19115 return '{' + mapPairs(x, keys(x)).join(', ') + '}';
19116 }
19117};
19118
19119
19120/***/ }),
19121/* 231 */
19122/***/ (function(module, exports, __webpack_require__) {
19123
19124var _curry2 = __webpack_require__(0);
19125var _reduced = __webpack_require__(16);
19126var _xfBase = __webpack_require__(4);
19127
19128
19129module.exports = (function() {
19130 function XAll(f, xf) {
19131 this.xf = xf;
19132 this.f = f;
19133 this.all = true;
19134 }
19135 XAll.prototype['@@transducer/init'] = _xfBase.init;
19136 XAll.prototype['@@transducer/result'] = function(result) {
19137 if (this.all) {
19138 result = this.xf['@@transducer/step'](result, true);
19139 }
19140 return this.xf['@@transducer/result'](result);
19141 };
19142 XAll.prototype['@@transducer/step'] = function(result, input) {
19143 if (!this.f(input)) {
19144 this.all = false;
19145 result = _reduced(this.xf['@@transducer/step'](result, false));
19146 }
19147 return result;
19148 };
19149
19150 return _curry2(function _xall(f, xf) { return new XAll(f, xf); });
19151}());
19152
19153
19154/***/ }),
19155/* 232 */
19156/***/ (function(module, exports, __webpack_require__) {
19157
19158var _concat = __webpack_require__(10);
19159var _curry2 = __webpack_require__(0);
19160var _xfBase = __webpack_require__(4);
19161
19162
19163module.exports = (function() {
19164 function XAperture(n, xf) {
19165 this.xf = xf;
19166 this.pos = 0;
19167 this.full = false;
19168 this.acc = new Array(n);
19169 }
19170 XAperture.prototype['@@transducer/init'] = _xfBase.init;
19171 XAperture.prototype['@@transducer/result'] = function(result) {
19172 this.acc = null;
19173 return this.xf['@@transducer/result'](result);
19174 };
19175 XAperture.prototype['@@transducer/step'] = function(result, input) {
19176 this.store(input);
19177 return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result;
19178 };
19179 XAperture.prototype.store = function(input) {
19180 this.acc[this.pos] = input;
19181 this.pos += 1;
19182 if (this.pos === this.acc.length) {
19183 this.pos = 0;
19184 this.full = true;
19185 }
19186 };
19187 XAperture.prototype.getCopy = function() {
19188 return _concat(Array.prototype.slice.call(this.acc, this.pos),
19189 Array.prototype.slice.call(this.acc, 0, this.pos));
19190 };
19191
19192 return _curry2(function _xaperture(n, xf) { return new XAperture(n, xf); });
19193}());
19194
19195
19196/***/ }),
19197/* 233 */
19198/***/ (function(module, exports, __webpack_require__) {
19199
19200var _curry2 = __webpack_require__(0);
19201var _flatCat = __webpack_require__(219);
19202var map = __webpack_require__(7);
19203
19204
19205module.exports = _curry2(function _xchain(f, xf) {
19206 return map(f, _flatCat(xf));
19207});
19208
19209
19210/***/ }),
19211/* 234 */
19212/***/ (function(module, exports, __webpack_require__) {
19213
19214var _curry2 = __webpack_require__(0);
19215var _xfBase = __webpack_require__(4);
19216
19217
19218module.exports = (function() {
19219 function XDrop(n, xf) {
19220 this.xf = xf;
19221 this.n = n;
19222 }
19223 XDrop.prototype['@@transducer/init'] = _xfBase.init;
19224 XDrop.prototype['@@transducer/result'] = _xfBase.result;
19225 XDrop.prototype['@@transducer/step'] = function(result, input) {
19226 if (this.n > 0) {
19227 this.n -= 1;
19228 return result;
19229 }
19230 return this.xf['@@transducer/step'](result, input);
19231 };
19232
19233 return _curry2(function _xdrop(n, xf) { return new XDrop(n, xf); });
19234}());
19235
19236
19237/***/ }),
19238/* 235 */
19239/***/ (function(module, exports, __webpack_require__) {
19240
19241var _curry2 = __webpack_require__(0);
19242var _xfBase = __webpack_require__(4);
19243
19244
19245module.exports = (function() {
19246 function XDropLast(n, xf) {
19247 this.xf = xf;
19248 this.pos = 0;
19249 this.full = false;
19250 this.acc = new Array(n);
19251 }
19252 XDropLast.prototype['@@transducer/init'] = _xfBase.init;
19253 XDropLast.prototype['@@transducer/result'] = function(result) {
19254 this.acc = null;
19255 return this.xf['@@transducer/result'](result);
19256 };
19257 XDropLast.prototype['@@transducer/step'] = function(result, input) {
19258 if (this.full) {
19259 result = this.xf['@@transducer/step'](result, this.acc[this.pos]);
19260 }
19261 this.store(input);
19262 return result;
19263 };
19264 XDropLast.prototype.store = function(input) {
19265 this.acc[this.pos] = input;
19266 this.pos += 1;
19267 if (this.pos === this.acc.length) {
19268 this.pos = 0;
19269 this.full = true;
19270 }
19271 };
19272
19273 return _curry2(function _xdropLast(n, xf) { return new XDropLast(n, xf); });
19274}());
19275
19276
19277/***/ }),
19278/* 236 */
19279/***/ (function(module, exports, __webpack_require__) {
19280
19281var _curry2 = __webpack_require__(0);
19282var _reduce = __webpack_require__(9);
19283var _xfBase = __webpack_require__(4);
19284
19285module.exports = (function() {
19286 function XDropLastWhile(fn, xf) {
19287 this.f = fn;
19288 this.retained = [];
19289 this.xf = xf;
19290 }
19291 XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init;
19292 XDropLastWhile.prototype['@@transducer/result'] = function(result) {
19293 this.retained = null;
19294 return this.xf['@@transducer/result'](result);
19295 };
19296 XDropLastWhile.prototype['@@transducer/step'] = function(result, input) {
19297 return this.f(input) ? this.retain(result, input)
19298 : this.flush(result, input);
19299 };
19300 XDropLastWhile.prototype.flush = function(result, input) {
19301 result = _reduce(
19302 this.xf['@@transducer/step'],
19303 result,
19304 this.retained
19305 );
19306 this.retained = [];
19307 return this.xf['@@transducer/step'](result, input);
19308 };
19309 XDropLastWhile.prototype.retain = function(result, input) {
19310 this.retained.push(input);
19311 return result;
19312 };
19313
19314 return _curry2(function _xdropLastWhile(fn, xf) { return new XDropLastWhile(fn, xf); });
19315}());
19316
19317
19318/***/ }),
19319/* 237 */
19320/***/ (function(module, exports, __webpack_require__) {
19321
19322var _curry2 = __webpack_require__(0);
19323var _xfBase = __webpack_require__(4);
19324
19325
19326module.exports = (function() {
19327 function XDropWhile(f, xf) {
19328 this.xf = xf;
19329 this.f = f;
19330 }
19331 XDropWhile.prototype['@@transducer/init'] = _xfBase.init;
19332 XDropWhile.prototype['@@transducer/result'] = _xfBase.result;
19333 XDropWhile.prototype['@@transducer/step'] = function(result, input) {
19334 if (this.f) {
19335 if (this.f(input)) {
19336 return result;
19337 }
19338 this.f = null;
19339 }
19340 return this.xf['@@transducer/step'](result, input);
19341 };
19342
19343 return _curry2(function _xdropWhile(f, xf) { return new XDropWhile(f, xf); });
19344}());
19345
19346
19347/***/ }),
19348/* 238 */
19349/***/ (function(module, exports, __webpack_require__) {
19350
19351var _curry2 = __webpack_require__(0);
19352var _xfBase = __webpack_require__(4);
19353
19354
19355module.exports = (function() {
19356 function XFilter(f, xf) {
19357 this.xf = xf;
19358 this.f = f;
19359 }
19360 XFilter.prototype['@@transducer/init'] = _xfBase.init;
19361 XFilter.prototype['@@transducer/result'] = _xfBase.result;
19362 XFilter.prototype['@@transducer/step'] = function(result, input) {
19363 return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;
19364 };
19365
19366 return _curry2(function _xfilter(f, xf) { return new XFilter(f, xf); });
19367}());
19368
19369
19370/***/ }),
19371/* 239 */
19372/***/ (function(module, exports, __webpack_require__) {
19373
19374var _curry2 = __webpack_require__(0);
19375var _reduced = __webpack_require__(16);
19376var _xfBase = __webpack_require__(4);
19377
19378
19379module.exports = (function() {
19380 function XFind(f, xf) {
19381 this.xf = xf;
19382 this.f = f;
19383 this.found = false;
19384 }
19385 XFind.prototype['@@transducer/init'] = _xfBase.init;
19386 XFind.prototype['@@transducer/result'] = function(result) {
19387 if (!this.found) {
19388 result = this.xf['@@transducer/step'](result, void 0);
19389 }
19390 return this.xf['@@transducer/result'](result);
19391 };
19392 XFind.prototype['@@transducer/step'] = function(result, input) {
19393 if (this.f(input)) {
19394 this.found = true;
19395 result = _reduced(this.xf['@@transducer/step'](result, input));
19396 }
19397 return result;
19398 };
19399
19400 return _curry2(function _xfind(f, xf) { return new XFind(f, xf); });
19401}());
19402
19403
19404/***/ }),
19405/* 240 */
19406/***/ (function(module, exports, __webpack_require__) {
19407
19408var _curry2 = __webpack_require__(0);
19409var _reduced = __webpack_require__(16);
19410var _xfBase = __webpack_require__(4);
19411
19412
19413module.exports = (function() {
19414 function XFindIndex(f, xf) {
19415 this.xf = xf;
19416 this.f = f;
19417 this.idx = -1;
19418 this.found = false;
19419 }
19420 XFindIndex.prototype['@@transducer/init'] = _xfBase.init;
19421 XFindIndex.prototype['@@transducer/result'] = function(result) {
19422 if (!this.found) {
19423 result = this.xf['@@transducer/step'](result, -1);
19424 }
19425 return this.xf['@@transducer/result'](result);
19426 };
19427 XFindIndex.prototype['@@transducer/step'] = function(result, input) {
19428 this.idx += 1;
19429 if (this.f(input)) {
19430 this.found = true;
19431 result = _reduced(this.xf['@@transducer/step'](result, this.idx));
19432 }
19433 return result;
19434 };
19435
19436 return _curry2(function _xfindIndex(f, xf) { return new XFindIndex(f, xf); });
19437}());
19438
19439
19440/***/ }),
19441/* 241 */
19442/***/ (function(module, exports, __webpack_require__) {
19443
19444var _curry2 = __webpack_require__(0);
19445var _xfBase = __webpack_require__(4);
19446
19447
19448module.exports = (function() {
19449 function XFindLast(f, xf) {
19450 this.xf = xf;
19451 this.f = f;
19452 }
19453 XFindLast.prototype['@@transducer/init'] = _xfBase.init;
19454 XFindLast.prototype['@@transducer/result'] = function(result) {
19455 return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));
19456 };
19457 XFindLast.prototype['@@transducer/step'] = function(result, input) {
19458 if (this.f(input)) {
19459 this.last = input;
19460 }
19461 return result;
19462 };
19463
19464 return _curry2(function _xfindLast(f, xf) { return new XFindLast(f, xf); });
19465}());
19466
19467
19468/***/ }),
19469/* 242 */
19470/***/ (function(module, exports, __webpack_require__) {
19471
19472var _curry2 = __webpack_require__(0);
19473var _xfBase = __webpack_require__(4);
19474
19475
19476module.exports = (function() {
19477 function XFindLastIndex(f, xf) {
19478 this.xf = xf;
19479 this.f = f;
19480 this.idx = -1;
19481 this.lastIdx = -1;
19482 }
19483 XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;
19484 XFindLastIndex.prototype['@@transducer/result'] = function(result) {
19485 return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));
19486 };
19487 XFindLastIndex.prototype['@@transducer/step'] = function(result, input) {
19488 this.idx += 1;
19489 if (this.f(input)) {
19490 this.lastIdx = this.idx;
19491 }
19492 return result;
19493 };
19494
19495 return _curry2(function _xfindLastIndex(f, xf) { return new XFindLastIndex(f, xf); });
19496}());
19497
19498
19499/***/ }),
19500/* 243 */
19501/***/ (function(module, exports, __webpack_require__) {
19502
19503var _curry2 = __webpack_require__(0);
19504var _xfBase = __webpack_require__(4);
19505
19506
19507module.exports = (function() {
19508 function XMap(f, xf) {
19509 this.xf = xf;
19510 this.f = f;
19511 }
19512 XMap.prototype['@@transducer/init'] = _xfBase.init;
19513 XMap.prototype['@@transducer/result'] = _xfBase.result;
19514 XMap.prototype['@@transducer/step'] = function(result, input) {
19515 return this.xf['@@transducer/step'](result, this.f(input));
19516 };
19517
19518 return _curry2(function _xmap(f, xf) { return new XMap(f, xf); });
19519}());
19520
19521
19522/***/ }),
19523/* 244 */
19524/***/ (function(module, exports, __webpack_require__) {
19525
19526var _curryN = __webpack_require__(34);
19527var _has = __webpack_require__(6);
19528var _xfBase = __webpack_require__(4);
19529
19530
19531module.exports = (function() {
19532 function XReduceBy(valueFn, valueAcc, keyFn, xf) {
19533 this.valueFn = valueFn;
19534 this.valueAcc = valueAcc;
19535 this.keyFn = keyFn;
19536 this.xf = xf;
19537 this.inputs = {};
19538 }
19539 XReduceBy.prototype['@@transducer/init'] = _xfBase.init;
19540 XReduceBy.prototype['@@transducer/result'] = function(result) {
19541 var key;
19542 for (key in this.inputs) {
19543 if (_has(key, this.inputs)) {
19544 result = this.xf['@@transducer/step'](result, this.inputs[key]);
19545 if (result['@@transducer/reduced']) {
19546 result = result['@@transducer/value'];
19547 break;
19548 }
19549 }
19550 }
19551 this.inputs = null;
19552 return this.xf['@@transducer/result'](result);
19553 };
19554 XReduceBy.prototype['@@transducer/step'] = function(result, input) {
19555 var key = this.keyFn(input);
19556 this.inputs[key] = this.inputs[key] || [key, this.valueAcc];
19557 this.inputs[key][1] = this.valueFn(this.inputs[key][1], input);
19558 return result;
19559 };
19560
19561 return _curryN(4, [],
19562 function _xreduceBy(valueFn, valueAcc, keyFn, xf) {
19563 return new XReduceBy(valueFn, valueAcc, keyFn, xf);
19564 });
19565}());
19566
19567
19568/***/ }),
19569/* 245 */
19570/***/ (function(module, exports, __webpack_require__) {
19571
19572var _curry2 = __webpack_require__(0);
19573var _reduced = __webpack_require__(16);
19574var _xfBase = __webpack_require__(4);
19575
19576module.exports = (function() {
19577 function XTake(n, xf) {
19578 this.xf = xf;
19579 this.n = n;
19580 this.i = 0;
19581 }
19582 XTake.prototype['@@transducer/init'] = _xfBase.init;
19583 XTake.prototype['@@transducer/result'] = _xfBase.result;
19584 XTake.prototype['@@transducer/step'] = function(result, input) {
19585 this.i += 1;
19586 var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input);
19587 return this.i >= this.n ? _reduced(ret) : ret;
19588 };
19589
19590 return _curry2(function _xtake(n, xf) { return new XTake(n, xf); });
19591}());
19592
19593
19594/***/ }),
19595/* 246 */
19596/***/ (function(module, exports, __webpack_require__) {
19597
19598var _curry2 = __webpack_require__(0);
19599var _reduced = __webpack_require__(16);
19600var _xfBase = __webpack_require__(4);
19601
19602
19603module.exports = (function() {
19604 function XTakeWhile(f, xf) {
19605 this.xf = xf;
19606 this.f = f;
19607 }
19608 XTakeWhile.prototype['@@transducer/init'] = _xfBase.init;
19609 XTakeWhile.prototype['@@transducer/result'] = _xfBase.result;
19610 XTakeWhile.prototype['@@transducer/step'] = function(result, input) {
19611 return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result);
19612 };
19613
19614 return _curry2(function _xtakeWhile(f, xf) { return new XTakeWhile(f, xf); });
19615}());
19616
19617
19618/***/ }),
19619/* 247 */
19620/***/ (function(module, exports, __webpack_require__) {
19621
19622var _contains = __webpack_require__(17);
19623var _curry2 = __webpack_require__(0);
19624var _filter = __webpack_require__(87);
19625var flip = __webpack_require__(33);
19626var uniq = __webpack_require__(59);
19627
19628
19629/**
19630 * Combines two lists into a set (i.e. no duplicates) composed of those
19631 * elements common to both lists.
19632 *
19633 * @func
19634 * @memberOf R
19635 * @since v0.1.0
19636 * @category Relation
19637 * @sig [*] -> [*] -> [*]
19638 * @param {Array} list1 The first list.
19639 * @param {Array} list2 The second list.
19640 * @return {Array} The list of elements found in both `list1` and `list2`.
19641 * @see R.intersectionWith
19642 * @example
19643 *
19644 * R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3]
19645 */
19646module.exports = _curry2(function intersection(list1, list2) {
19647 var lookupList, filteredList;
19648 if (list1.length > list2.length) {
19649 lookupList = list1;
19650 filteredList = list2;
19651 } else {
19652 lookupList = list2;
19653 filteredList = list1;
19654 }
19655 return uniq(_filter(flip(_contains)(lookupList), filteredList));
19656});
19657
19658
19659/***/ }),
19660/* 248 */
19661/***/ (function(module, exports, __webpack_require__) {
19662
19663var _containsWith = __webpack_require__(53);
19664var _curry3 = __webpack_require__(2);
19665var uniqWith = __webpack_require__(60);
19666
19667
19668/**
19669 * Combines two lists into a set (i.e. no duplicates) composed of those
19670 * elements common to both lists. Duplication is determined according to the
19671 * value returned by applying the supplied predicate to two list elements.
19672 *
19673 * @func
19674 * @memberOf R
19675 * @since v0.1.0
19676 * @category Relation
19677 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
19678 * @param {Function} pred A predicate function that determines whether
19679 * the two supplied elements are equal.
19680 * @param {Array} list1 One list of items to compare
19681 * @param {Array} list2 A second list of items to compare
19682 * @return {Array} A new list containing those elements common to both lists.
19683 * @see R.intersection
19684 * @example
19685 *
19686 * var buffaloSpringfield = [
19687 * {id: 824, name: 'Richie Furay'},
19688 * {id: 956, name: 'Dewey Martin'},
19689 * {id: 313, name: 'Bruce Palmer'},
19690 * {id: 456, name: 'Stephen Stills'},
19691 * {id: 177, name: 'Neil Young'}
19692 * ];
19693 * var csny = [
19694 * {id: 204, name: 'David Crosby'},
19695 * {id: 456, name: 'Stephen Stills'},
19696 * {id: 539, name: 'Graham Nash'},
19697 * {id: 177, name: 'Neil Young'}
19698 * ];
19699 *
19700 * R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny);
19701 * //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]
19702 */
19703module.exports = _curry3(function intersectionWith(pred, list1, list2) {
19704 var lookupList, filteredList;
19705 if (list1.length > list2.length) {
19706 lookupList = list1;
19707 filteredList = list2;
19708 } else {
19709 lookupList = list2;
19710 filteredList = list1;
19711 }
19712 var results = [];
19713 var idx = 0;
19714 while (idx < filteredList.length) {
19715 if (_containsWith(pred, filteredList[idx], lookupList)) {
19716 results[results.length] = filteredList[idx];
19717 }
19718 idx += 1;
19719 }
19720 return uniqWith(pred, results);
19721});
19722
19723
19724/***/ }),
19725/* 249 */
19726/***/ (function(module, exports, __webpack_require__) {
19727
19728var _checkForMethod = __webpack_require__(21);
19729var _curry2 = __webpack_require__(0);
19730
19731
19732/**
19733 * Creates a new list with the separator interposed between elements.
19734 *
19735 * Dispatches to the `intersperse` method of the second argument, if present.
19736 *
19737 * @func
19738 * @memberOf R
19739 * @since v0.14.0
19740 * @category List
19741 * @sig a -> [a] -> [a]
19742 * @param {*} separator The element to add to the list.
19743 * @param {Array} list The list to be interposed.
19744 * @return {Array} The new list.
19745 * @example
19746 *
19747 * R.intersperse('n', ['ba', 'a', 'a']); //=> ['ba', 'n', 'a', 'n', 'a']
19748 */
19749module.exports = _curry2(_checkForMethod('intersperse', function intersperse(separator, list) {
19750 var out = [];
19751 var idx = 0;
19752 var length = list.length;
19753 while (idx < length) {
19754 if (idx === length - 1) {
19755 out.push(list[idx]);
19756 } else {
19757 out.push(list[idx], separator);
19758 }
19759 idx += 1;
19760 }
19761 return out;
19762}));
19763
19764
19765/***/ }),
19766/* 250 */
19767/***/ (function(module, exports, __webpack_require__) {
19768
19769var _clone = __webpack_require__(83);
19770var _curry3 = __webpack_require__(2);
19771var _isTransformer = __webpack_require__(55);
19772var _reduce = __webpack_require__(9);
19773var _stepCat = __webpack_require__(228);
19774
19775
19776/**
19777 * Transforms the items of the list with the transducer and appends the
19778 * transformed items to the accumulator using an appropriate iterator function
19779 * based on the accumulator type.
19780 *
19781 * The accumulator can be an array, string, object or a transformer. Iterated
19782 * items will be appended to arrays and concatenated to strings. Objects will
19783 * be merged directly or 2-item arrays will be merged as key, value pairs.
19784 *
19785 * The accumulator can also be a transformer object that provides a 2-arity
19786 * reducing iterator function, step, 0-arity initial value function, init, and
19787 * 1-arity result extraction function result. The step function is used as the
19788 * iterator function in reduce. The result function is used to convert the
19789 * final accumulator into the return type and in most cases is R.identity. The
19790 * init function is used to provide the initial accumulator.
19791 *
19792 * The iteration is performed with R.reduce after initializing the transducer.
19793 *
19794 * @func
19795 * @memberOf R
19796 * @since v0.12.0
19797 * @category List
19798 * @sig a -> (b -> b) -> [c] -> a
19799 * @param {*} acc The initial accumulator value.
19800 * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
19801 * @param {Array} list The list to iterate over.
19802 * @return {*} The final, accumulated value.
19803 * @example
19804 *
19805 * var numbers = [1, 2, 3, 4];
19806 * var transducer = R.compose(R.map(R.add(1)), R.take(2));
19807 *
19808 * R.into([], transducer, numbers); //=> [2, 3]
19809 *
19810 * var intoArray = R.into([]);
19811 * intoArray(transducer, numbers); //=> [2, 3]
19812 */
19813module.exports = _curry3(function into(acc, xf, list) {
19814 return _isTransformer(acc) ?
19815 _reduce(xf(acc), acc['@@transducer/init'](), list) :
19816 _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list);
19817});
19818
19819
19820/***/ }),
19821/* 251 */
19822/***/ (function(module, exports, __webpack_require__) {
19823
19824var _curry1 = __webpack_require__(1);
19825var _has = __webpack_require__(6);
19826var keys = __webpack_require__(13);
19827
19828
19829/**
19830 * Same as R.invertObj, however this accounts for objects with duplicate values
19831 * by putting the values into an array.
19832 *
19833 * @func
19834 * @memberOf R
19835 * @since v0.9.0
19836 * @category Object
19837 * @sig {s: x} -> {x: [ s, ... ]}
19838 * @param {Object} obj The object or array to invert
19839 * @return {Object} out A new object with keys
19840 * in an array.
19841 * @example
19842 *
19843 * var raceResultsByFirstName = {
19844 * first: 'alice',
19845 * second: 'jake',
19846 * third: 'alice',
19847 * };
19848 * R.invert(raceResultsByFirstName);
19849 * //=> { 'alice': ['first', 'third'], 'jake':['second'] }
19850 */
19851module.exports = _curry1(function invert(obj) {
19852 var props = keys(obj);
19853 var len = props.length;
19854 var idx = 0;
19855 var out = {};
19856
19857 while (idx < len) {
19858 var key = props[idx];
19859 var val = obj[key];
19860 var list = _has(val, out) ? out[val] : (out[val] = []);
19861 list[list.length] = key;
19862 idx += 1;
19863 }
19864 return out;
19865});
19866
19867
19868/***/ }),
19869/* 252 */
19870/***/ (function(module, exports, __webpack_require__) {
19871
19872var _curry1 = __webpack_require__(1);
19873var keys = __webpack_require__(13);
19874
19875
19876/**
19877 * Returns a new object with the keys of the given object as values, and the
19878 * values of the given object, which are coerced to strings, as keys. Note
19879 * that the last key found is preferred when handling the same value.
19880 *
19881 * @func
19882 * @memberOf R
19883 * @since v0.9.0
19884 * @category Object
19885 * @sig {s: x} -> {x: s}
19886 * @param {Object} obj The object or array to invert
19887 * @return {Object} out A new object
19888 * @example
19889 *
19890 * var raceResults = {
19891 * first: 'alice',
19892 * second: 'jake'
19893 * };
19894 * R.invertObj(raceResults);
19895 * //=> { 'alice': 'first', 'jake':'second' }
19896 *
19897 * // Alternatively:
19898 * var raceResults = ['alice', 'jake'];
19899 * R.invertObj(raceResults);
19900 * //=> { 'alice': '0', 'jake':'1' }
19901 */
19902module.exports = _curry1(function invertObj(obj) {
19903 var props = keys(obj);
19904 var len = props.length;
19905 var idx = 0;
19906 var out = {};
19907
19908 while (idx < len) {
19909 var key = props[idx];
19910 out[obj[key]] = key;
19911 idx += 1;
19912 }
19913 return out;
19914});
19915
19916
19917/***/ }),
19918/* 253 */
19919/***/ (function(module, exports, __webpack_require__) {
19920
19921var _curry1 = __webpack_require__(1);
19922var empty = __webpack_require__(81);
19923var equals = __webpack_require__(11);
19924
19925
19926/**
19927 * Returns `true` if the given value is its type's empty value; `false`
19928 * otherwise.
19929 *
19930 * @func
19931 * @memberOf R
19932 * @since v0.1.0
19933 * @category Logic
19934 * @sig a -> Boolean
19935 * @param {*} x
19936 * @return {Boolean}
19937 * @see R.empty
19938 * @example
19939 *
19940 * R.isEmpty([1, 2, 3]); //=> false
19941 * R.isEmpty([]); //=> true
19942 * R.isEmpty(''); //=> true
19943 * R.isEmpty(null); //=> false
19944 * R.isEmpty({}); //=> true
19945 * R.isEmpty({length: 0}); //=> false
19946 */
19947module.exports = _curry1(function isEmpty(x) {
19948 return x != null && equals(x, empty(x));
19949});
19950
19951
19952/***/ }),
19953/* 254 */
19954/***/ (function(module, exports, __webpack_require__) {
19955
19956var _curry1 = __webpack_require__(1);
19957
19958
19959/**
19960 * Checks if the input value is `null` or `undefined`.
19961 *
19962 * @func
19963 * @memberOf R
19964 * @since v0.9.0
19965 * @category Type
19966 * @sig * -> Boolean
19967 * @param {*} x The value to test.
19968 * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.
19969 * @example
19970 *
19971 * R.isNil(null); //=> true
19972 * R.isNil(undefined); //=> true
19973 * R.isNil(0); //=> false
19974 * R.isNil([]); //=> false
19975 */
19976module.exports = _curry1(function isNil(x) { return x == null; });
19977
19978
19979/***/ }),
19980/* 255 */
19981/***/ (function(module, exports, __webpack_require__) {
19982
19983var invoker = __webpack_require__(22);
19984
19985
19986/**
19987 * Returns a string made by inserting the `separator` between each element and
19988 * concatenating all the elements into a single string.
19989 *
19990 * @func
19991 * @memberOf R
19992 * @since v0.1.0
19993 * @category List
19994 * @sig String -> [a] -> String
19995 * @param {Number|String} separator The string used to separate the elements.
19996 * @param {Array} xs The elements to join into a string.
19997 * @return {String} str The string made by concatenating `xs` with `separator`.
19998 * @see R.split
19999 * @example
20000 *
20001 * var spacer = R.join(' ');
20002 * spacer(['a', 2, 3.4]); //=> 'a 2 3.4'
20003 * R.join('|', [1, 2, 3]); //=> '1|2|3'
20004 */
20005module.exports = invoker(1, 'join');
20006
20007
20008/***/ }),
20009/* 256 */
20010/***/ (function(module, exports, __webpack_require__) {
20011
20012var _curry1 = __webpack_require__(1);
20013
20014
20015/**
20016 * Returns a list containing the names of all the properties of the supplied
20017 * object, including prototype properties.
20018 * Note that the order of the output array is not guaranteed to be consistent
20019 * across different JS platforms.
20020 *
20021 * @func
20022 * @memberOf R
20023 * @since v0.2.0
20024 * @category Object
20025 * @sig {k: v} -> [k]
20026 * @param {Object} obj The object to extract properties from
20027 * @return {Array} An array of the object's own and prototype properties.
20028 * @example
20029 *
20030 * var F = function() { this.x = 'X'; };
20031 * F.prototype.y = 'Y';
20032 * var f = new F();
20033 * R.keysIn(f); //=> ['x', 'y']
20034 */
20035module.exports = _curry1(function keysIn(obj) {
20036 var prop;
20037 var ks = [];
20038 for (prop in obj) {
20039 ks[ks.length] = prop;
20040 }
20041 return ks;
20042});
20043
20044
20045/***/ }),
20046/* 257 */
20047/***/ (function(module, exports, __webpack_require__) {
20048
20049var _curry2 = __webpack_require__(0);
20050var _isArray = __webpack_require__(15);
20051var equals = __webpack_require__(11);
20052
20053
20054/**
20055 * Returns the position of the last occurrence of an item in an array, or -1 if
20056 * the item is not included in the array. `R.equals` is used to determine
20057 * equality.
20058 *
20059 * @func
20060 * @memberOf R
20061 * @since v0.1.0
20062 * @category List
20063 * @sig a -> [a] -> Number
20064 * @param {*} target The item to find.
20065 * @param {Array} xs The array to search in.
20066 * @return {Number} the index of the target, or -1 if the target is not found.
20067 * @see R.indexOf
20068 * @example
20069 *
20070 * R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6
20071 * R.lastIndexOf(10, [1,2,3,4]); //=> -1
20072 */
20073module.exports = _curry2(function lastIndexOf(target, xs) {
20074 if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) {
20075 return xs.lastIndexOf(target);
20076 } else {
20077 var idx = xs.length - 1;
20078 while (idx >= 0) {
20079 if (equals(xs[idx], target)) {
20080 return idx;
20081 }
20082 idx -= 1;
20083 }
20084 return -1;
20085 }
20086});
20087
20088
20089/***/ }),
20090/* 258 */
20091/***/ (function(module, exports, __webpack_require__) {
20092
20093var _curry1 = __webpack_require__(1);
20094var lens = __webpack_require__(39);
20095var nth = __webpack_require__(24);
20096var update = __webpack_require__(119);
20097
20098
20099/**
20100 * Returns a lens whose focus is the specified index.
20101 *
20102 * @func
20103 * @memberOf R
20104 * @since v0.14.0
20105 * @category Object
20106 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
20107 * @sig Number -> Lens s a
20108 * @param {Number} n
20109 * @return {Lens}
20110 * @see R.view, R.set, R.over
20111 * @example
20112 *
20113 * var headLens = R.lensIndex(0);
20114 *
20115 * R.view(headLens, ['a', 'b', 'c']); //=> 'a'
20116 * R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c']
20117 * R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c']
20118 */
20119module.exports = _curry1(function lensIndex(n) {
20120 return lens(nth(n), update(n));
20121});
20122
20123
20124/***/ }),
20125/* 259 */
20126/***/ (function(module, exports, __webpack_require__) {
20127
20128var _curry1 = __webpack_require__(1);
20129var assocPath = __webpack_require__(70);
20130var lens = __webpack_require__(39);
20131var path = __webpack_require__(25);
20132
20133
20134/**
20135 * Returns a lens whose focus is the specified path.
20136 *
20137 * @func
20138 * @memberOf R
20139 * @since v0.19.0
20140 * @category Object
20141 * @typedefn Idx = String | Int
20142 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
20143 * @sig [Idx] -> Lens s a
20144 * @param {Array} path The path to use.
20145 * @return {Lens}
20146 * @see R.view, R.set, R.over
20147 * @example
20148 *
20149 * var xHeadYLens = R.lensPath(['x', 0, 'y']);
20150 *
20151 * R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
20152 * //=> 2
20153 * R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
20154 * //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]}
20155 * R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
20156 * //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]}
20157 */
20158module.exports = _curry1(function lensPath(p) {
20159 return lens(path(p), assocPath(p));
20160});
20161
20162
20163/***/ }),
20164/* 260 */
20165/***/ (function(module, exports, __webpack_require__) {
20166
20167var _curry1 = __webpack_require__(1);
20168var assoc = __webpack_require__(31);
20169var lens = __webpack_require__(39);
20170var prop = __webpack_require__(56);
20171
20172
20173/**
20174 * Returns a lens whose focus is the specified property.
20175 *
20176 * @func
20177 * @memberOf R
20178 * @since v0.14.0
20179 * @category Object
20180 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
20181 * @sig String -> Lens s a
20182 * @param {String} k
20183 * @return {Lens}
20184 * @see R.view, R.set, R.over
20185 * @example
20186 *
20187 * var xLens = R.lensProp('x');
20188 *
20189 * R.view(xLens, {x: 1, y: 2}); //=> 1
20190 * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
20191 * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2}
20192 */
20193module.exports = _curry1(function lensProp(k) {
20194 return lens(prop(k), assoc(k));
20195});
20196
20197
20198/***/ }),
20199/* 261 */
20200/***/ (function(module, exports, __webpack_require__) {
20201
20202var _curry2 = __webpack_require__(0);
20203
20204
20205/**
20206 * Returns `true` if the first argument is less than the second; `false`
20207 * otherwise.
20208 *
20209 * @func
20210 * @memberOf R
20211 * @since v0.1.0
20212 * @category Relation
20213 * @sig Ord a => a -> a -> Boolean
20214 * @param {*} a
20215 * @param {*} b
20216 * @return {Boolean}
20217 * @see R.gt
20218 * @example
20219 *
20220 * R.lt(2, 1); //=> false
20221 * R.lt(2, 2); //=> false
20222 * R.lt(2, 3); //=> true
20223 * R.lt('a', 'z'); //=> true
20224 * R.lt('z', 'a'); //=> false
20225 */
20226module.exports = _curry2(function lt(a, b) { return a < b; });
20227
20228
20229/***/ }),
20230/* 262 */
20231/***/ (function(module, exports, __webpack_require__) {
20232
20233var _curry2 = __webpack_require__(0);
20234
20235
20236/**
20237 * Returns `true` if the first argument is less than or equal to the second;
20238 * `false` otherwise.
20239 *
20240 * @func
20241 * @memberOf R
20242 * @since v0.1.0
20243 * @category Relation
20244 * @sig Ord a => a -> a -> Boolean
20245 * @param {Number} a
20246 * @param {Number} b
20247 * @return {Boolean}
20248 * @see R.gte
20249 * @example
20250 *
20251 * R.lte(2, 1); //=> false
20252 * R.lte(2, 2); //=> true
20253 * R.lte(2, 3); //=> true
20254 * R.lte('a', 'z'); //=> true
20255 * R.lte('z', 'a'); //=> false
20256 */
20257module.exports = _curry2(function lte(a, b) { return a <= b; });
20258
20259
20260/***/ }),
20261/* 263 */
20262/***/ (function(module, exports, __webpack_require__) {
20263
20264var _curry3 = __webpack_require__(2);
20265
20266
20267/**
20268 * The mapAccum function behaves like a combination of map and reduce; it
20269 * applies a function to each element of a list, passing an accumulating
20270 * parameter from left to right, and returning a final value of this
20271 * accumulator together with the new list.
20272 *
20273 * The iterator function receives two arguments, *acc* and *value*, and should
20274 * return a tuple *[acc, value]*.
20275 *
20276 * @func
20277 * @memberOf R
20278 * @since v0.10.0
20279 * @category List
20280 * @sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])
20281 * @param {Function} fn The function to be called on every element of the input `list`.
20282 * @param {*} acc The accumulator value.
20283 * @param {Array} list The list to iterate over.
20284 * @return {*} The final, accumulated value.
20285 * @see R.addIndex, R.mapAccumRight
20286 * @example
20287 *
20288 * var digits = ['1', '2', '3', '4'];
20289 * var appender = (a, b) => [a + b, a + b];
20290 *
20291 * R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']]
20292 * @symb R.mapAccum(f, a, [b, c, d]) = [
20293 * f(f(f(a, b)[0], c)[0], d)[0],
20294 * [
20295 * f(a, b)[1],
20296 * f(f(a, b)[0], c)[1],
20297 * f(f(f(a, b)[0], c)[0], d)[1]
20298 * ]
20299 * ]
20300 */
20301module.exports = _curry3(function mapAccum(fn, acc, list) {
20302 var idx = 0;
20303 var len = list.length;
20304 var result = [];
20305 var tuple = [acc];
20306 while (idx < len) {
20307 tuple = fn(tuple[0], list[idx]);
20308 result[idx] = tuple[1];
20309 idx += 1;
20310 }
20311 return [tuple[0], result];
20312});
20313
20314
20315/***/ }),
20316/* 264 */
20317/***/ (function(module, exports, __webpack_require__) {
20318
20319var _curry3 = __webpack_require__(2);
20320
20321
20322/**
20323 * The mapAccumRight function behaves like a combination of map and reduce; it
20324 * applies a function to each element of a list, passing an accumulating
20325 * parameter from right to left, and returning a final value of this
20326 * accumulator together with the new list.
20327 *
20328 * Similar to `mapAccum`, except moves through the input list from the right to
20329 * the left.
20330 *
20331 * The iterator function receives two arguments, *value* and *acc*, and should
20332 * return a tuple *[value, acc]*.
20333 *
20334 * @func
20335 * @memberOf R
20336 * @since v0.10.0
20337 * @category List
20338 * @sig (x-> acc -> (y, acc)) -> acc -> [x] -> ([y], acc)
20339 * @param {Function} fn The function to be called on every element of the input `list`.
20340 * @param {*} acc The accumulator value.
20341 * @param {Array} list The list to iterate over.
20342 * @return {*} The final, accumulated value.
20343 * @see R.addIndex, R.mapAccum
20344 * @example
20345 *
20346 * var digits = ['1', '2', '3', '4'];
20347 * var append = (a, b) => [a + b, a + b];
20348 *
20349 * R.mapAccumRight(append, 5, digits); //=> [['12345', '2345', '345', '45'], '12345']
20350 * @symb R.mapAccumRight(f, a, [b, c, d]) = [
20351 * [
20352 * f(b, f(c, f(d, a)[0])[0])[1],
20353 * f(c, f(d, a)[0])[1],
20354 * f(d, a)[1],
20355 * ]
20356 * f(b, f(c, f(d, a)[0])[0])[0],
20357 * ]
20358 */
20359module.exports = _curry3(function mapAccumRight(fn, acc, list) {
20360 var idx = list.length - 1;
20361 var result = [];
20362 var tuple = [acc];
20363 while (idx >= 0) {
20364 tuple = fn(list[idx], tuple[0]);
20365 result[idx] = tuple[1];
20366 idx -= 1;
20367 }
20368 return [result, tuple[0]];
20369});
20370
20371
20372/***/ }),
20373/* 265 */
20374/***/ (function(module, exports, __webpack_require__) {
20375
20376var _curry2 = __webpack_require__(0);
20377var _reduce = __webpack_require__(9);
20378var keys = __webpack_require__(13);
20379
20380
20381/**
20382 * An Object-specific version of `map`. The function is applied to three
20383 * arguments: *(value, key, obj)*. If only the value is significant, use
20384 * `map` instead.
20385 *
20386 * @func
20387 * @memberOf R
20388 * @since v0.9.0
20389 * @category Object
20390 * @sig ((*, String, Object) -> *) -> Object -> Object
20391 * @param {Function} fn
20392 * @param {Object} obj
20393 * @return {Object}
20394 * @see R.map
20395 * @example
20396 *
20397 * var values = { x: 1, y: 2, z: 3 };
20398 * var prependKeyAndDouble = (num, key, obj) => key + (num * 2);
20399 *
20400 * R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' }
20401 */
20402module.exports = _curry2(function mapObjIndexed(fn, obj) {
20403 return _reduce(function(acc, key) {
20404 acc[key] = fn(obj[key], key, obj);
20405 return acc;
20406 }, {}, keys(obj));
20407});
20408
20409
20410/***/ }),
20411/* 266 */
20412/***/ (function(module, exports, __webpack_require__) {
20413
20414var _curry2 = __webpack_require__(0);
20415
20416
20417/**
20418 * Tests a regular expression against a String. Note that this function will
20419 * return an empty array when there are no matches. This differs from
20420 * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
20421 * which returns `null` when there are no matches.
20422 *
20423 * @func
20424 * @memberOf R
20425 * @since v0.1.0
20426 * @category String
20427 * @sig RegExp -> String -> [String | Undefined]
20428 * @param {RegExp} rx A regular expression.
20429 * @param {String} str The string to match against
20430 * @return {Array} The list of matches or empty array.
20431 * @see R.test
20432 * @example
20433 *
20434 * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na']
20435 * R.match(/a/, 'b'); //=> []
20436 * R.match(/a/, null); //=> TypeError: null does not have a method named "match"
20437 */
20438module.exports = _curry2(function match(rx, str) {
20439 return str.match(rx) || [];
20440});
20441
20442
20443/***/ }),
20444/* 267 */
20445/***/ (function(module, exports, __webpack_require__) {
20446
20447var _curry2 = __webpack_require__(0);
20448var _isInteger = __webpack_require__(90);
20449
20450
20451/**
20452 * mathMod behaves like the modulo operator should mathematically, unlike the
20453 * `%` operator (and by extension, R.modulo). So while "-17 % 5" is -2,
20454 * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN
20455 * when the modulus is zero or negative.
20456 *
20457 * @func
20458 * @memberOf R
20459 * @since v0.3.0
20460 * @category Math
20461 * @sig Number -> Number -> Number
20462 * @param {Number} m The dividend.
20463 * @param {Number} p the modulus.
20464 * @return {Number} The result of `b mod a`.
20465 * @example
20466 *
20467 * R.mathMod(-17, 5); //=> 3
20468 * R.mathMod(17, 5); //=> 2
20469 * R.mathMod(17, -5); //=> NaN
20470 * R.mathMod(17, 0); //=> NaN
20471 * R.mathMod(17.2, 5); //=> NaN
20472 * R.mathMod(17, 5.3); //=> NaN
20473 *
20474 * var clock = R.mathMod(R.__, 12);
20475 * clock(15); //=> 3
20476 * clock(24); //=> 0
20477 *
20478 * var seventeenMod = R.mathMod(17);
20479 * seventeenMod(3); //=> 2
20480 * seventeenMod(4); //=> 1
20481 * seventeenMod(10); //=> 7
20482 */
20483module.exports = _curry2(function mathMod(m, p) {
20484 if (!_isInteger(m)) { return NaN; }
20485 if (!_isInteger(p) || p < 1) { return NaN; }
20486 return ((m % p) + p) % p;
20487});
20488
20489
20490/***/ }),
20491/* 268 */
20492/***/ (function(module, exports, __webpack_require__) {
20493
20494var _curry3 = __webpack_require__(2);
20495
20496
20497/**
20498 * Takes a function and two values, and returns whichever value produces the
20499 * larger result when passed to the provided function.
20500 *
20501 * @func
20502 * @memberOf R
20503 * @since v0.8.0
20504 * @category Relation
20505 * @sig Ord b => (a -> b) -> a -> a -> a
20506 * @param {Function} f
20507 * @param {*} a
20508 * @param {*} b
20509 * @return {*}
20510 * @see R.max, R.minBy
20511 * @example
20512 *
20513 * // square :: Number -> Number
20514 * var square = n => n * n;
20515 *
20516 * R.maxBy(square, -3, 2); //=> -3
20517 *
20518 * R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5
20519 * R.reduce(R.maxBy(square), 0, []); //=> 0
20520 */
20521module.exports = _curry3(function maxBy(f, a, b) {
20522 return f(b) > f(a) ? b : a;
20523});
20524
20525
20526/***/ }),
20527/* 269 */
20528/***/ (function(module, exports, __webpack_require__) {
20529
20530var _curry1 = __webpack_require__(1);
20531var mean = __webpack_require__(102);
20532
20533
20534/**
20535 * Returns the median of the given list of numbers.
20536 *
20537 * @func
20538 * @memberOf R
20539 * @since v0.14.0
20540 * @category Math
20541 * @sig [Number] -> Number
20542 * @param {Array} list
20543 * @return {Number}
20544 * @example
20545 *
20546 * R.median([2, 9, 7]); //=> 7
20547 * R.median([7, 2, 10, 9]); //=> 8
20548 * R.median([]); //=> NaN
20549 */
20550module.exports = _curry1(function median(list) {
20551 var len = list.length;
20552 if (len === 0) {
20553 return NaN;
20554 }
20555 var width = 2 - len % 2;
20556 var idx = (len - width) / 2;
20557 return mean(Array.prototype.slice.call(list, 0).sort(function(a, b) {
20558 return a < b ? -1 : a > b ? 1 : 0;
20559 }).slice(idx, idx + width));
20560});
20561
20562
20563/***/ }),
20564/* 270 */
20565/***/ (function(module, exports, __webpack_require__) {
20566
20567var _arity = __webpack_require__(12);
20568var _curry1 = __webpack_require__(1);
20569var _has = __webpack_require__(6);
20570var toString = __webpack_require__(27);
20571
20572
20573/**
20574 * Creates a new function that, when invoked, caches the result of calling `fn`
20575 * for a given argument set and returns the result. Subsequent calls to the
20576 * memoized `fn` with the same argument set will not result in an additional
20577 * call to `fn`; instead, the cached result for that set of arguments will be
20578 * returned.
20579 *
20580 * @func
20581 * @memberOf R
20582 * @since v0.1.0
20583 * @category Function
20584 * @sig (*... -> a) -> (*... -> a)
20585 * @param {Function} fn The function to memoize.
20586 * @return {Function} Memoized version of `fn`.
20587 * @example
20588 *
20589 * var count = 0;
20590 * var factorial = R.memoize(n => {
20591 * count += 1;
20592 * return R.product(R.range(1, n + 1));
20593 * });
20594 * factorial(5); //=> 120
20595 * factorial(5); //=> 120
20596 * factorial(5); //=> 120
20597 * count; //=> 1
20598 */
20599module.exports = _curry1(function memoize(fn) {
20600 var cache = {};
20601 return _arity(fn.length, function() {
20602 var key = toString(arguments);
20603 if (!_has(key, cache)) {
20604 cache[key] = fn.apply(this, arguments);
20605 }
20606 return cache[key];
20607 });
20608});
20609
20610
20611/***/ }),
20612/* 271 */
20613/***/ (function(module, exports, __webpack_require__) {
20614
20615var _assign = __webpack_require__(52);
20616var _curry2 = __webpack_require__(0);
20617
20618
20619/**
20620 * Create a new object with the own properties of the first object merged with
20621 * the own properties of the second object. If a key exists in both objects,
20622 * the value from the second object will be used.
20623 *
20624 * @func
20625 * @memberOf R
20626 * @since v0.1.0
20627 * @category Object
20628 * @sig {k: v} -> {k: v} -> {k: v}
20629 * @param {Object} l
20630 * @param {Object} r
20631 * @return {Object}
20632 * @see R.mergeWith, R.mergeWithKey
20633 * @example
20634 *
20635 * R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
20636 * //=> { 'name': 'fred', 'age': 40 }
20637 *
20638 * var resetToDefault = R.merge(R.__, {x: 0});
20639 * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
20640 * @symb R.merge({ x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: 5, z: 3 }
20641 */
20642module.exports = _curry2(function merge(l, r) {
20643 return _assign({}, l, r);
20644});
20645
20646
20647/***/ }),
20648/* 272 */
20649/***/ (function(module, exports, __webpack_require__) {
20650
20651var _assign = __webpack_require__(52);
20652var _curry1 = __webpack_require__(1);
20653
20654
20655/**
20656 * Merges a list of objects together into one object.
20657 *
20658 * @func
20659 * @memberOf R
20660 * @since v0.10.0
20661 * @category List
20662 * @sig [{k: v}] -> {k: v}
20663 * @param {Array} list An array of objects
20664 * @return {Object} A merged object.
20665 * @see R.reduce
20666 * @example
20667 *
20668 * R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}
20669 * R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}
20670 * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 }
20671 */
20672module.exports = _curry1(function mergeAll(list) {
20673 return _assign.apply(null, [{}].concat(list));
20674});
20675
20676
20677/***/ }),
20678/* 273 */
20679/***/ (function(module, exports, __webpack_require__) {
20680
20681var _curry3 = __webpack_require__(2);
20682var mergeWithKey = __webpack_require__(103);
20683
20684
20685/**
20686 * Creates a new object with the own properties of the two provided objects. If
20687 * a key exists in both objects, the provided function is applied to the values
20688 * associated with the key in each object, with the result being used as the
20689 * value associated with the key in the returned object. The key will be
20690 * excluded from the returned object if the resulting value is `undefined`.
20691 *
20692 * @func
20693 * @memberOf R
20694 * @since v0.19.0
20695 * @category Object
20696 * @sig (a -> a -> a) -> {a} -> {a} -> {a}
20697 * @param {Function} fn
20698 * @param {Object} l
20699 * @param {Object} r
20700 * @return {Object}
20701 * @see R.merge, R.mergeWithKey
20702 * @example
20703 *
20704 * R.mergeWith(R.concat,
20705 * { a: true, values: [10, 20] },
20706 * { b: true, values: [15, 35] });
20707 * //=> { a: true, b: true, values: [10, 20, 15, 35] }
20708 */
20709module.exports = _curry3(function mergeWith(fn, l, r) {
20710 return mergeWithKey(function(_, _l, _r) {
20711 return fn(_l, _r);
20712 }, l, r);
20713});
20714
20715
20716/***/ }),
20717/* 274 */
20718/***/ (function(module, exports, __webpack_require__) {
20719
20720var _curry2 = __webpack_require__(0);
20721
20722
20723/**
20724 * Returns the smaller of its two arguments.
20725 *
20726 * @func
20727 * @memberOf R
20728 * @since v0.1.0
20729 * @category Relation
20730 * @sig Ord a => a -> a -> a
20731 * @param {*} a
20732 * @param {*} b
20733 * @return {*}
20734 * @see R.minBy, R.max
20735 * @example
20736 *
20737 * R.min(789, 123); //=> 123
20738 * R.min('a', 'b'); //=> 'a'
20739 */
20740module.exports = _curry2(function min(a, b) { return b < a ? b : a; });
20741
20742
20743/***/ }),
20744/* 275 */
20745/***/ (function(module, exports, __webpack_require__) {
20746
20747var _curry3 = __webpack_require__(2);
20748
20749
20750/**
20751 * Takes a function and two values, and returns whichever value produces the
20752 * smaller result when passed to the provided function.
20753 *
20754 * @func
20755 * @memberOf R
20756 * @since v0.8.0
20757 * @category Relation
20758 * @sig Ord b => (a -> b) -> a -> a -> a
20759 * @param {Function} f
20760 * @param {*} a
20761 * @param {*} b
20762 * @return {*}
20763 * @see R.min, R.maxBy
20764 * @example
20765 *
20766 * // square :: Number -> Number
20767 * var square = n => n * n;
20768 *
20769 * R.minBy(square, -3, 2); //=> 2
20770 *
20771 * R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1
20772 * R.reduce(R.minBy(square), Infinity, []); //=> Infinity
20773 */
20774module.exports = _curry3(function minBy(f, a, b) {
20775 return f(b) < f(a) ? b : a;
20776});
20777
20778
20779/***/ }),
20780/* 276 */
20781/***/ (function(module, exports, __webpack_require__) {
20782
20783var _curry2 = __webpack_require__(0);
20784
20785
20786/**
20787 * Divides the first parameter by the second and returns the remainder. Note
20788 * that this function preserves the JavaScript-style behavior for modulo. For
20789 * mathematical modulo see `mathMod`.
20790 *
20791 * @func
20792 * @memberOf R
20793 * @since v0.1.1
20794 * @category Math
20795 * @sig Number -> Number -> Number
20796 * @param {Number} a The value to the divide.
20797 * @param {Number} b The pseudo-modulus
20798 * @return {Number} The result of `b % a`.
20799 * @see R.mathMod
20800 * @example
20801 *
20802 * R.modulo(17, 3); //=> 2
20803 * // JS behavior:
20804 * R.modulo(-17, 3); //=> -2
20805 * R.modulo(17, -3); //=> 2
20806 *
20807 * var isOdd = R.modulo(R.__, 2);
20808 * isOdd(42); //=> 0
20809 * isOdd(21); //=> 1
20810 */
20811module.exports = _curry2(function modulo(a, b) { return a % b; });
20812
20813
20814/***/ }),
20815/* 277 */
20816/***/ (function(module, exports, __webpack_require__) {
20817
20818var _curry1 = __webpack_require__(1);
20819
20820
20821/**
20822 * Negates its argument.
20823 *
20824 * @func
20825 * @memberOf R
20826 * @since v0.9.0
20827 * @category Math
20828 * @sig Number -> Number
20829 * @param {Number} n
20830 * @return {Number}
20831 * @example
20832 *
20833 * R.negate(42); //=> -42
20834 */
20835module.exports = _curry1(function negate(n) { return -n; });
20836
20837
20838/***/ }),
20839/* 278 */
20840/***/ (function(module, exports, __webpack_require__) {
20841
20842var _complement = __webpack_require__(85);
20843var _curry2 = __webpack_require__(0);
20844var _dispatchable = __webpack_require__(3);
20845var _xany = __webpack_require__(94);
20846var any = __webpack_require__(68);
20847
20848
20849/**
20850 * Returns `true` if no elements of the list match the predicate, `false`
20851 * otherwise.
20852 *
20853 * Dispatches to the `any` method of the second argument, if present.
20854 *
20855 * @func
20856 * @memberOf R
20857 * @since v0.12.0
20858 * @category List
20859 * @sig (a -> Boolean) -> [a] -> Boolean
20860 * @param {Function} fn The predicate function.
20861 * @param {Array} list The array to consider.
20862 * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise.
20863 * @see R.all, R.any
20864 * @example
20865 *
20866 * var isEven = n => n % 2 === 0;
20867 *
20868 * R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true
20869 * R.none(isEven, [1, 3, 5, 7, 8, 11]); //=> false
20870 */
20871module.exports = _curry2(_complement(_dispatchable(['any'], _xany, any)));
20872
20873
20874/***/ }),
20875/* 279 */
20876/***/ (function(module, exports, __webpack_require__) {
20877
20878var _curry1 = __webpack_require__(1);
20879var curryN = __webpack_require__(5);
20880var nth = __webpack_require__(24);
20881
20882
20883/**
20884 * Returns a function which returns its nth argument.
20885 *
20886 * @func
20887 * @memberOf R
20888 * @since v0.9.0
20889 * @category Function
20890 * @sig Number -> *... -> *
20891 * @param {Number} n
20892 * @return {Function}
20893 * @example
20894 *
20895 * R.nthArg(1)('a', 'b', 'c'); //=> 'b'
20896 * R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
20897 * @symb R.nthArg(-1)(a, b, c) = c
20898 * @symb R.nthArg(0)(a, b, c) = a
20899 * @symb R.nthArg(1)(a, b, c) = b
20900 */
20901module.exports = _curry1(function nthArg(n) {
20902 var arity = n < 0 ? 1 : n + 1;
20903 return curryN(arity, function() {
20904 return nth(n, arguments);
20905 });
20906});
20907
20908
20909/***/ }),
20910/* 280 */
20911/***/ (function(module, exports, __webpack_require__) {
20912
20913var _curry1 = __webpack_require__(1);
20914var _of = __webpack_require__(224);
20915
20916
20917/**
20918 * Returns a singleton array containing the value provided.
20919 *
20920 * Note this `of` is different from the ES6 `of`; See
20921 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of
20922 *
20923 * @func
20924 * @memberOf R
20925 * @since v0.3.0
20926 * @category Function
20927 * @sig a -> [a]
20928 * @param {*} x any value
20929 * @return {Array} An array wrapping `x`.
20930 * @example
20931 *
20932 * R.of(null); //=> [null]
20933 * R.of([42]); //=> [[42]]
20934 */
20935module.exports = _curry1(_of);
20936
20937
20938/***/ }),
20939/* 281 */
20940/***/ (function(module, exports, __webpack_require__) {
20941
20942var _contains = __webpack_require__(17);
20943var _curry2 = __webpack_require__(0);
20944
20945
20946/**
20947 * Returns a partial copy of an object omitting the keys specified.
20948 *
20949 * @func
20950 * @memberOf R
20951 * @since v0.1.0
20952 * @category Object
20953 * @sig [String] -> {String: *} -> {String: *}
20954 * @param {Array} names an array of String property names to omit from the new object
20955 * @param {Object} obj The object to copy from
20956 * @return {Object} A new object with properties from `names` not on it.
20957 * @see R.pick
20958 * @example
20959 *
20960 * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}
20961 */
20962module.exports = _curry2(function omit(names, obj) {
20963 var result = {};
20964 for (var prop in obj) {
20965 if (!_contains(prop, names)) {
20966 result[prop] = obj[prop];
20967 }
20968 }
20969 return result;
20970});
20971
20972
20973/***/ }),
20974/* 282 */
20975/***/ (function(module, exports, __webpack_require__) {
20976
20977var _arity = __webpack_require__(12);
20978var _curry1 = __webpack_require__(1);
20979
20980
20981/**
20982 * Accepts a function `fn` and returns a function that guards invocation of
20983 * `fn` such that `fn` can only ever be called once, no matter how many times
20984 * the returned function is invoked. The first value calculated is returned in
20985 * subsequent invocations.
20986 *
20987 * @func
20988 * @memberOf R
20989 * @since v0.1.0
20990 * @category Function
20991 * @sig (a... -> b) -> (a... -> b)
20992 * @param {Function} fn The function to wrap in a call-only-once wrapper.
20993 * @return {Function} The wrapped function.
20994 * @example
20995 *
20996 * var addOneOnce = R.once(x => x + 1);
20997 * addOneOnce(10); //=> 11
20998 * addOneOnce(addOneOnce(50)); //=> 11
20999 */
21000module.exports = _curry1(function once(fn) {
21001 var called = false;
21002 var result;
21003 return _arity(fn.length, function() {
21004 if (called) {
21005 return result;
21006 }
21007 called = true;
21008 result = fn.apply(this, arguments);
21009 return result;
21010 });
21011});
21012
21013
21014/***/ }),
21015/* 283 */
21016/***/ (function(module, exports, __webpack_require__) {
21017
21018var _curry2 = __webpack_require__(0);
21019
21020
21021/**
21022 * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`.
21023 *
21024 * @func
21025 * @memberOf R
21026 * @since v0.18.0
21027 * @category List
21028 * @sig a -> b -> (a,b)
21029 * @param {*} fst
21030 * @param {*} snd
21031 * @return {Array}
21032 * @see R.objOf, R.of
21033 * @example
21034 *
21035 * R.pair('foo', 'bar'); //=> ['foo', 'bar']
21036 */
21037module.exports = _curry2(function pair(fst, snd) { return [fst, snd]; });
21038
21039
21040/***/ }),
21041/* 284 */
21042/***/ (function(module, exports, __webpack_require__) {
21043
21044var _concat = __webpack_require__(10);
21045var _createPartialApplicator = __webpack_require__(86);
21046
21047
21048/**
21049 * Takes a function `f` and a list of arguments, and returns a function `g`.
21050 * When applied, `g` returns the result of applying `f` to the arguments
21051 * provided initially followed by the arguments provided to `g`.
21052 *
21053 * @func
21054 * @memberOf R
21055 * @since v0.10.0
21056 * @category Function
21057 * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x)
21058 * @param {Function} f
21059 * @param {Array} args
21060 * @return {Function}
21061 * @see R.partialRight
21062 * @example
21063 *
21064 * var multiply2 = (a, b) => a * b;
21065 * var double = R.partial(multiply2, [2]);
21066 * double(2); //=> 4
21067 *
21068 * var greet = (salutation, title, firstName, lastName) =>
21069 * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
21070 *
21071 * var sayHello = R.partial(greet, ['Hello']);
21072 * var sayHelloToMs = R.partial(sayHello, ['Ms.']);
21073 * sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'
21074 * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d)
21075 */
21076module.exports = _createPartialApplicator(_concat);
21077
21078
21079/***/ }),
21080/* 285 */
21081/***/ (function(module, exports, __webpack_require__) {
21082
21083var _concat = __webpack_require__(10);
21084var _createPartialApplicator = __webpack_require__(86);
21085var flip = __webpack_require__(33);
21086
21087
21088/**
21089 * Takes a function `f` and a list of arguments, and returns a function `g`.
21090 * When applied, `g` returns the result of applying `f` to the arguments
21091 * provided to `g` followed by the arguments provided initially.
21092 *
21093 * @func
21094 * @memberOf R
21095 * @since v0.10.0
21096 * @category Function
21097 * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x)
21098 * @param {Function} f
21099 * @param {Array} args
21100 * @return {Function}
21101 * @see R.partial
21102 * @example
21103 *
21104 * var greet = (salutation, title, firstName, lastName) =>
21105 * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
21106 *
21107 * var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);
21108 *
21109 * greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!'
21110 * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b)
21111 */
21112module.exports = _createPartialApplicator(flip(_concat));
21113
21114
21115/***/ }),
21116/* 286 */
21117/***/ (function(module, exports, __webpack_require__) {
21118
21119var filter = __webpack_require__(50);
21120var juxt = __webpack_require__(98);
21121var reject = __webpack_require__(43);
21122
21123
21124/**
21125 * Takes a predicate and a list or other "filterable" object and returns the
21126 * pair of filterable objects of the same type of elements which do and do not
21127 * satisfy, the predicate, respectively.
21128 *
21129 * @func
21130 * @memberOf R
21131 * @since v0.1.4
21132 * @category List
21133 * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a]
21134 * @param {Function} pred A predicate to determine which side the element belongs to.
21135 * @param {Array} filterable the list (or other filterable) to partition.
21136 * @return {Array} An array, containing first the subset of elements that satisfy the
21137 * predicate, and second the subset of elements that do not satisfy.
21138 * @see R.filter, R.reject
21139 * @example
21140 *
21141 * R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']);
21142 * // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ]
21143 *
21144 * R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
21145 * // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ]
21146 */
21147module.exports = juxt([filter, reject]);
21148
21149
21150/***/ }),
21151/* 287 */
21152/***/ (function(module, exports, __webpack_require__) {
21153
21154var _curry3 = __webpack_require__(2);
21155var equals = __webpack_require__(11);
21156var path = __webpack_require__(25);
21157
21158
21159/**
21160 * Determines whether a nested path on an object has a specific value, in
21161 * `R.equals` terms. Most likely used to filter a list.
21162 *
21163 * @func
21164 * @memberOf R
21165 * @since v0.7.0
21166 * @category Relation
21167 * @typedefn Idx = String | Int
21168 * @sig [Idx] -> a -> {a} -> Boolean
21169 * @param {Array} path The path of the nested property to use
21170 * @param {*} val The value to compare the nested property with
21171 * @param {Object} obj The object to check the nested property in
21172 * @return {Boolean} `true` if the value equals the nested object property,
21173 * `false` otherwise.
21174 * @example
21175 *
21176 * var user1 = { address: { zipCode: 90210 } };
21177 * var user2 = { address: { zipCode: 55555 } };
21178 * var user3 = { name: 'Bob' };
21179 * var users = [ user1, user2, user3 ];
21180 * var isFamous = R.pathEq(['address', 'zipCode'], 90210);
21181 * R.filter(isFamous, users); //=> [ user1 ]
21182 */
21183module.exports = _curry3(function pathEq(_path, val, obj) {
21184 return equals(path(_path, obj), val);
21185});
21186
21187
21188/***/ }),
21189/* 288 */
21190/***/ (function(module, exports, __webpack_require__) {
21191
21192var _curry3 = __webpack_require__(2);
21193var defaultTo = __webpack_require__(75);
21194var path = __webpack_require__(25);
21195
21196
21197/**
21198 * If the given, non-null object has a value at the given path, returns the
21199 * value at that path. Otherwise returns the provided default value.
21200 *
21201 * @func
21202 * @memberOf R
21203 * @since v0.18.0
21204 * @category Object
21205 * @typedefn Idx = String | Int
21206 * @sig a -> [Idx] -> {a} -> a
21207 * @param {*} d The default value.
21208 * @param {Array} p The path to use.
21209 * @param {Object} obj The object to retrieve the nested property from.
21210 * @return {*} The data at `path` of the supplied object or the default value.
21211 * @example
21212 *
21213 * R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2
21214 * R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"
21215 */
21216module.exports = _curry3(function pathOr(d, p, obj) {
21217 return defaultTo(d, path(p, obj));
21218});
21219
21220
21221/***/ }),
21222/* 289 */
21223/***/ (function(module, exports, __webpack_require__) {
21224
21225var _curry3 = __webpack_require__(2);
21226var path = __webpack_require__(25);
21227
21228
21229/**
21230 * Returns `true` if the specified object property at given path satisfies the
21231 * given predicate; `false` otherwise.
21232 *
21233 * @func
21234 * @memberOf R
21235 * @since v0.19.0
21236 * @category Logic
21237 * @typedefn Idx = String | Int
21238 * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean
21239 * @param {Function} pred
21240 * @param {Array} propPath
21241 * @param {*} obj
21242 * @return {Boolean}
21243 * @see R.propSatisfies, R.path
21244 * @example
21245 *
21246 * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true
21247 */
21248module.exports = _curry3(function pathSatisfies(pred, propPath, obj) {
21249 return propPath.length > 0 && pred(path(propPath, obj));
21250});
21251
21252
21253/***/ }),
21254/* 290 */
21255/***/ (function(module, exports, __webpack_require__) {
21256
21257var _curry2 = __webpack_require__(0);
21258
21259
21260/**
21261 * Returns a partial copy of an object containing only the keys specified. If
21262 * the key does not exist, the property is ignored.
21263 *
21264 * @func
21265 * @memberOf R
21266 * @since v0.1.0
21267 * @category Object
21268 * @sig [k] -> {k: v} -> {k: v}
21269 * @param {Array} names an array of String property names to copy onto a new object
21270 * @param {Object} obj The object to copy from
21271 * @return {Object} A new object with only properties from `names` on it.
21272 * @see R.omit, R.props
21273 * @example
21274 *
21275 * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
21276 * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}
21277 */
21278module.exports = _curry2(function pick(names, obj) {
21279 var result = {};
21280 var idx = 0;
21281 while (idx < names.length) {
21282 if (names[idx] in obj) {
21283 result[names[idx]] = obj[names[idx]];
21284 }
21285 idx += 1;
21286 }
21287 return result;
21288});
21289
21290
21291/***/ }),
21292/* 291 */
21293/***/ (function(module, exports, __webpack_require__) {
21294
21295var _curry2 = __webpack_require__(0);
21296
21297
21298/**
21299 * Returns a partial copy of an object containing only the keys that satisfy
21300 * the supplied predicate.
21301 *
21302 * @func
21303 * @memberOf R
21304 * @since v0.8.0
21305 * @category Object
21306 * @sig (v, k -> Boolean) -> {k: v} -> {k: v}
21307 * @param {Function} pred A predicate to determine whether or not a key
21308 * should be included on the output object.
21309 * @param {Object} obj The object to copy from
21310 * @return {Object} A new object with only properties that satisfy `pred`
21311 * on it.
21312 * @see R.pick, R.filter
21313 * @example
21314 *
21315 * var isUpperCase = (val, key) => key.toUpperCase() === key;
21316 * R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
21317 */
21318module.exports = _curry2(function pickBy(test, obj) {
21319 var result = {};
21320 for (var prop in obj) {
21321 if (test(obj[prop], prop, obj)) {
21322 result[prop] = obj[prop];
21323 }
21324 }
21325 return result;
21326});
21327
21328
21329/***/ }),
21330/* 292 */
21331/***/ (function(module, exports, __webpack_require__) {
21332
21333var composeK = __webpack_require__(72);
21334var reverse = __webpack_require__(44);
21335
21336/**
21337 * Returns the left-to-right Kleisli composition of the provided functions,
21338 * each of which must return a value of a type supported by [`chain`](#chain).
21339 *
21340 * `R.pipeK(f, g, h)` is equivalent to `R.pipe(R.chain(f), R.chain(g), R.chain(h))`.
21341 *
21342 * @func
21343 * @memberOf R
21344 * @since v0.16.0
21345 * @category Function
21346 * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z)
21347 * @param {...Function}
21348 * @return {Function}
21349 * @see R.composeK
21350 * @example
21351 *
21352 * // parseJson :: String -> Maybe *
21353 * // get :: String -> Object -> Maybe *
21354 *
21355 * // getStateCode :: Maybe String -> Maybe String
21356 * var getStateCode = R.pipeK(
21357 * parseJson,
21358 * get('user'),
21359 * get('address'),
21360 * get('state'),
21361 * R.compose(Maybe.of, R.toUpper)
21362 * );
21363 *
21364 * getStateCode('{"user":{"address":{"state":"ny"}}}');
21365 * //=> Just('NY')
21366 * getStateCode('[Invalid JSON]');
21367 * //=> Nothing()
21368 * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a)))
21369 */
21370module.exports = function pipeK() {
21371 if (arguments.length === 0) {
21372 throw new Error('pipeK requires at least one argument');
21373 }
21374 return composeK.apply(this, reverse(arguments));
21375};
21376
21377
21378/***/ }),
21379/* 293 */
21380/***/ (function(module, exports, __webpack_require__) {
21381
21382var multiply = __webpack_require__(104);
21383var reduce = __webpack_require__(14);
21384
21385
21386/**
21387 * Multiplies together all the elements of a list.
21388 *
21389 * @func
21390 * @memberOf R
21391 * @since v0.1.0
21392 * @category Math
21393 * @sig [Number] -> Number
21394 * @param {Array} list An array of numbers
21395 * @return {Number} The product of all the numbers in the list.
21396 * @see R.reduce
21397 * @example
21398 *
21399 * R.product([2,4,6,8,100,1]); //=> 38400
21400 */
21401module.exports = reduce(multiply, 1);
21402
21403
21404/***/ }),
21405/* 294 */
21406/***/ (function(module, exports, __webpack_require__) {
21407
21408var _map = __webpack_require__(38);
21409var identity = __webpack_require__(51);
21410var pickAll = __webpack_require__(109);
21411var useWith = __webpack_require__(120);
21412
21413
21414/**
21415 * Reasonable analog to SQL `select` statement.
21416 *
21417 * @func
21418 * @memberOf R
21419 * @since v0.1.0
21420 * @category Object
21421 * @category Relation
21422 * @sig [k] -> [{k: v}] -> [{k: v}]
21423 * @param {Array} props The property names to project
21424 * @param {Array} objs The objects to query
21425 * @return {Array} An array of objects with just the `props` properties.
21426 * @example
21427 *
21428 * var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
21429 * var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
21430 * var kids = [abby, fred];
21431 * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
21432 */
21433module.exports = useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity
21434
21435
21436/***/ }),
21437/* 295 */
21438/***/ (function(module, exports, __webpack_require__) {
21439
21440var _curry3 = __webpack_require__(2);
21441var equals = __webpack_require__(11);
21442
21443
21444/**
21445 * Returns `true` if the specified object property is equal, in `R.equals`
21446 * terms, to the given value; `false` otherwise.
21447 *
21448 * @func
21449 * @memberOf R
21450 * @since v0.1.0
21451 * @category Relation
21452 * @sig String -> a -> Object -> Boolean
21453 * @param {String} name
21454 * @param {*} val
21455 * @param {*} obj
21456 * @return {Boolean}
21457 * @see R.equals, R.propSatisfies
21458 * @example
21459 *
21460 * var abby = {name: 'Abby', age: 7, hair: 'blond'};
21461 * var fred = {name: 'Fred', age: 12, hair: 'brown'};
21462 * var rusty = {name: 'Rusty', age: 10, hair: 'brown'};
21463 * var alois = {name: 'Alois', age: 15, disposition: 'surly'};
21464 * var kids = [abby, fred, rusty, alois];
21465 * var hasBrownHair = R.propEq('hair', 'brown');
21466 * R.filter(hasBrownHair, kids); //=> [fred, rusty]
21467 */
21468module.exports = _curry3(function propEq(name, val, obj) {
21469 return equals(val, obj[name]);
21470});
21471
21472
21473/***/ }),
21474/* 296 */
21475/***/ (function(module, exports, __webpack_require__) {
21476
21477var _curry3 = __webpack_require__(2);
21478var is = __webpack_require__(97);
21479
21480
21481/**
21482 * Returns `true` if the specified object property is of the given type;
21483 * `false` otherwise.
21484 *
21485 * @func
21486 * @memberOf R
21487 * @since v0.16.0
21488 * @category Type
21489 * @sig Type -> String -> Object -> Boolean
21490 * @param {Function} type
21491 * @param {String} name
21492 * @param {*} obj
21493 * @return {Boolean}
21494 * @see R.is, R.propSatisfies
21495 * @example
21496 *
21497 * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true
21498 * R.propIs(Number, 'x', {x: 'foo'}); //=> false
21499 * R.propIs(Number, 'x', {}); //=> false
21500 */
21501module.exports = _curry3(function propIs(type, name, obj) {
21502 return is(type, obj[name]);
21503});
21504
21505
21506/***/ }),
21507/* 297 */
21508/***/ (function(module, exports, __webpack_require__) {
21509
21510var _curry3 = __webpack_require__(2);
21511var _has = __webpack_require__(6);
21512
21513
21514/**
21515 * If the given, non-null object has an own property with the specified name,
21516 * returns the value of that property. Otherwise returns the provided default
21517 * value.
21518 *
21519 * @func
21520 * @memberOf R
21521 * @since v0.6.0
21522 * @category Object
21523 * @sig a -> String -> Object -> a
21524 * @param {*} val The default value.
21525 * @param {String} p The name of the property to return.
21526 * @param {Object} obj The object to query.
21527 * @return {*} The value of given property of the supplied object or the default value.
21528 * @example
21529 *
21530 * var alice = {
21531 * name: 'ALICE',
21532 * age: 101
21533 * };
21534 * var favorite = R.prop('favoriteLibrary');
21535 * var favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');
21536 *
21537 * favorite(alice); //=> undefined
21538 * favoriteWithDefault(alice); //=> 'Ramda'
21539 */
21540module.exports = _curry3(function propOr(val, p, obj) {
21541 return (obj != null && _has(p, obj)) ? obj[p] : val;
21542});
21543
21544
21545/***/ }),
21546/* 298 */
21547/***/ (function(module, exports, __webpack_require__) {
21548
21549var _curry3 = __webpack_require__(2);
21550
21551
21552/**
21553 * Returns `true` if the specified object property satisfies the given
21554 * predicate; `false` otherwise.
21555 *
21556 * @func
21557 * @memberOf R
21558 * @since v0.16.0
21559 * @category Logic
21560 * @sig (a -> Boolean) -> String -> {String: a} -> Boolean
21561 * @param {Function} pred
21562 * @param {String} name
21563 * @param {*} obj
21564 * @return {Boolean}
21565 * @see R.propEq, R.propIs
21566 * @example
21567 *
21568 * R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true
21569 */
21570module.exports = _curry3(function propSatisfies(pred, name, obj) {
21571 return pred(obj[name]);
21572});
21573
21574
21575/***/ }),
21576/* 299 */
21577/***/ (function(module, exports, __webpack_require__) {
21578
21579var _curry2 = __webpack_require__(0);
21580
21581
21582/**
21583 * Acts as multiple `prop`: array of keys in, array of values out. Preserves
21584 * order.
21585 *
21586 * @func
21587 * @memberOf R
21588 * @since v0.1.0
21589 * @category Object
21590 * @sig [k] -> {k: v} -> [v]
21591 * @param {Array} ps The property names to fetch
21592 * @param {Object} obj The object to query
21593 * @return {Array} The corresponding values or partially applied function.
21594 * @example
21595 *
21596 * R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
21597 * R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
21598 *
21599 * var fullName = R.compose(R.join(' '), R.props(['first', 'last']));
21600 * fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
21601 */
21602module.exports = _curry2(function props(ps, obj) {
21603 var len = ps.length;
21604 var out = [];
21605 var idx = 0;
21606
21607 while (idx < len) {
21608 out[idx] = obj[ps[idx]];
21609 idx += 1;
21610 }
21611
21612 return out;
21613});
21614
21615
21616/***/ }),
21617/* 300 */
21618/***/ (function(module, exports, __webpack_require__) {
21619
21620var _curry2 = __webpack_require__(0);
21621var _isNumber = __webpack_require__(91);
21622
21623
21624/**
21625 * Returns a list of numbers from `from` (inclusive) to `to` (exclusive).
21626 *
21627 * @func
21628 * @memberOf R
21629 * @since v0.1.0
21630 * @category List
21631 * @sig Number -> Number -> [Number]
21632 * @param {Number} from The first number in the list.
21633 * @param {Number} to One more than the last number in the list.
21634 * @return {Array} The list of numbers in tthe set `[a, b)`.
21635 * @example
21636 *
21637 * R.range(1, 5); //=> [1, 2, 3, 4]
21638 * R.range(50, 53); //=> [50, 51, 52]
21639 */
21640module.exports = _curry2(function range(from, to) {
21641 if (!(_isNumber(from) && _isNumber(to))) {
21642 throw new TypeError('Both arguments to range must be numbers');
21643 }
21644 var result = [];
21645 var n = from;
21646 while (n < to) {
21647 result.push(n);
21648 n += 1;
21649 }
21650 return result;
21651});
21652
21653
21654/***/ }),
21655/* 301 */
21656/***/ (function(module, exports, __webpack_require__) {
21657
21658var _curryN = __webpack_require__(34);
21659var _reduce = __webpack_require__(9);
21660var _reduced = __webpack_require__(16);
21661
21662
21663/**
21664 * Like `reduce`, `reduceWhile` returns a single item by iterating through
21665 * the list, successively calling the iterator function. `reduceWhile` also
21666 * takes a predicate that is evaluated before each step. If the predicate returns
21667 * `false`, it "short-circuits" the iteration and returns the current value
21668 * of the accumulator.
21669 *
21670 * @func
21671 * @memberOf R
21672 * @since v0.22.0
21673 * @category List
21674 * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a
21675 * @param {Function} pred The predicate. It is passed the accumulator and the
21676 * current element.
21677 * @param {Function} fn The iterator function. Receives two values, the
21678 * accumulator and the current element.
21679 * @param {*} a The accumulator value.
21680 * @param {Array} list The list to iterate over.
21681 * @return {*} The final, accumulated value.
21682 * @see R.reduce, R.reduced
21683 * @example
21684 *
21685 * var isOdd = (acc, x) => x % 2 === 1;
21686 * var xs = [1, 3, 5, 60, 777, 800];
21687 * R.reduceWhile(isOdd, R.add, 0, xs); //=> 9
21688 *
21689 * var ys = [2, 4, 6]
21690 * R.reduceWhile(isOdd, R.add, 111, ys); //=> 111
21691 */
21692module.exports = _curryN(4, [], function _reduceWhile(pred, fn, a, list) {
21693 return _reduce(function(acc, x) {
21694 return pred(acc, x) ? fn(acc, x) : _reduced(acc);
21695 }, a, list);
21696});
21697
21698
21699/***/ }),
21700/* 302 */
21701/***/ (function(module, exports, __webpack_require__) {
21702
21703var _curry1 = __webpack_require__(1);
21704var _reduced = __webpack_require__(16);
21705
21706/**
21707 * Returns a value wrapped to indicate that it is the final value of the reduce
21708 * and transduce functions. The returned value should be considered a black
21709 * box: the internal structure is not guaranteed to be stable.
21710 *
21711 * Note: this optimization is unavailable to functions not explicitly listed
21712 * above. For instance, it is not currently supported by reduceRight.
21713 *
21714 * @func
21715 * @memberOf R
21716 * @since v0.15.0
21717 * @category List
21718 * @sig a -> *
21719 * @param {*} x The final value of the reduce.
21720 * @return {*} The wrapped value.
21721 * @see R.reduce, R.transduce
21722 * @example
21723 *
21724 * R.reduce(
21725 * R.pipe(R.add, R.when(R.gte(R.__, 10), R.reduced)),
21726 * 0,
21727 * [1, 2, 3, 4, 5]) // 10
21728 */
21729
21730module.exports = _curry1(_reduced);
21731
21732
21733/***/ }),
21734/* 303 */
21735/***/ (function(module, exports, __webpack_require__) {
21736
21737var _curry3 = __webpack_require__(2);
21738
21739
21740/**
21741 * Removes the sub-list of `list` starting at index `start` and containing
21742 * `count` elements. _Note that this is not destructive_: it returns a copy of
21743 * the list with the changes.
21744 * <small>No lists have been harmed in the application of this function.</small>
21745 *
21746 * @func
21747 * @memberOf R
21748 * @since v0.2.2
21749 * @category List
21750 * @sig Number -> Number -> [a] -> [a]
21751 * @param {Number} start The position to start removing elements
21752 * @param {Number} count The number of elements to remove
21753 * @param {Array} list The list to remove from
21754 * @return {Array} A new Array with `count` elements from `start` removed.
21755 * @example
21756 *
21757 * R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8]
21758 */
21759module.exports = _curry3(function remove(start, count, list) {
21760 var result = Array.prototype.slice.call(list, 0);
21761 result.splice(start, count);
21762 return result;
21763});
21764
21765
21766/***/ }),
21767/* 304 */
21768/***/ (function(module, exports, __webpack_require__) {
21769
21770var _curry2 = __webpack_require__(0);
21771var always = __webpack_require__(19);
21772var times = __webpack_require__(117);
21773
21774
21775/**
21776 * Returns a fixed list of size `n` containing a specified identical value.
21777 *
21778 * @func
21779 * @memberOf R
21780 * @since v0.1.1
21781 * @category List
21782 * @sig a -> n -> [a]
21783 * @param {*} value The value to repeat.
21784 * @param {Number} n The desired size of the output list.
21785 * @return {Array} A new array containing `n` `value`s.
21786 * @example
21787 *
21788 * R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']
21789 *
21790 * var obj = {};
21791 * var repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]
21792 * repeatedObjs[0] === repeatedObjs[1]; //=> true
21793 * @symb R.repeat(a, 0) = []
21794 * @symb R.repeat(a, 1) = [a]
21795 * @symb R.repeat(a, 2) = [a, a]
21796 */
21797module.exports = _curry2(function repeat(value, n) {
21798 return times(always(value), n);
21799});
21800
21801
21802/***/ }),
21803/* 305 */
21804/***/ (function(module, exports, __webpack_require__) {
21805
21806var _curry3 = __webpack_require__(2);
21807
21808
21809/**
21810 * Replace a substring or regex match in a string with a replacement.
21811 *
21812 * @func
21813 * @memberOf R
21814 * @since v0.7.0
21815 * @category String
21816 * @sig RegExp|String -> String -> String -> String
21817 * @param {RegExp|String} pattern A regular expression or a substring to match.
21818 * @param {String} replacement The string to replace the matches with.
21819 * @param {String} str The String to do the search and replacement in.
21820 * @return {String} The result.
21821 * @example
21822 *
21823 * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
21824 * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
21825 *
21826 * // Use the "g" (global) flag to replace all occurrences:
21827 * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
21828 */
21829module.exports = _curry3(function replace(regex, replacement, str) {
21830 return str.replace(regex, replacement);
21831});
21832
21833
21834/***/ }),
21835/* 306 */
21836/***/ (function(module, exports, __webpack_require__) {
21837
21838var _curry3 = __webpack_require__(2);
21839
21840
21841/**
21842 * Scan is similar to reduce, but returns a list of successively reduced values
21843 * from the left
21844 *
21845 * @func
21846 * @memberOf R
21847 * @since v0.10.0
21848 * @category List
21849 * @sig (a,b -> a) -> a -> [b] -> [a]
21850 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
21851 * current element from the array
21852 * @param {*} acc The accumulator value.
21853 * @param {Array} list The list to iterate over.
21854 * @return {Array} A list of all intermediately reduced values.
21855 * @example
21856 *
21857 * var numbers = [1, 2, 3, 4];
21858 * var factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24]
21859 * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)]
21860 */
21861module.exports = _curry3(function scan(fn, acc, list) {
21862 var idx = 0;
21863 var len = list.length;
21864 var result = [acc];
21865 while (idx < len) {
21866 acc = fn(acc, list[idx]);
21867 result[idx + 1] = acc;
21868 idx += 1;
21869 }
21870 return result;
21871});
21872
21873
21874/***/ }),
21875/* 307 */
21876/***/ (function(module, exports, __webpack_require__) {
21877
21878var _curry3 = __webpack_require__(2);
21879var always = __webpack_require__(19);
21880var over = __webpack_require__(108);
21881
21882
21883/**
21884 * Returns the result of "setting" the portion of the given data structure
21885 * focused by the given lens to the given value.
21886 *
21887 * @func
21888 * @memberOf R
21889 * @since v0.16.0
21890 * @category Object
21891 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
21892 * @sig Lens s a -> a -> s -> s
21893 * @param {Lens} lens
21894 * @param {*} v
21895 * @param {*} x
21896 * @return {*}
21897 * @see R.prop, R.lensIndex, R.lensProp
21898 * @example
21899 *
21900 * var xLens = R.lensProp('x');
21901 *
21902 * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2}
21903 * R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2}
21904 */
21905module.exports = _curry3(function set(lens, v, x) {
21906 return over(lens, always(v), x);
21907});
21908
21909
21910/***/ }),
21911/* 308 */
21912/***/ (function(module, exports, __webpack_require__) {
21913
21914var _curry2 = __webpack_require__(0);
21915
21916
21917/**
21918 * Returns a copy of the list, sorted according to the comparator function,
21919 * which should accept two values at a time and return a negative number if the
21920 * first value is smaller, a positive number if it's larger, and zero if they
21921 * are equal. Please note that this is a **copy** of the list. It does not
21922 * modify the original.
21923 *
21924 * @func
21925 * @memberOf R
21926 * @since v0.1.0
21927 * @category List
21928 * @sig (a,a -> Number) -> [a] -> [a]
21929 * @param {Function} comparator A sorting function :: a -> b -> Int
21930 * @param {Array} list The list to sort
21931 * @return {Array} a new array with its elements sorted by the comparator function.
21932 * @example
21933 *
21934 * var diff = function(a, b) { return a - b; };
21935 * R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7]
21936 */
21937module.exports = _curry2(function sort(comparator, list) {
21938 return Array.prototype.slice.call(list, 0).sort(comparator);
21939});
21940
21941
21942/***/ }),
21943/* 309 */
21944/***/ (function(module, exports, __webpack_require__) {
21945
21946var _curry2 = __webpack_require__(0);
21947
21948
21949/**
21950 * Sorts the list according to the supplied function.
21951 *
21952 * @func
21953 * @memberOf R
21954 * @since v0.1.0
21955 * @category Relation
21956 * @sig Ord b => (a -> b) -> [a] -> [a]
21957 * @param {Function} fn
21958 * @param {Array} list The list to sort.
21959 * @return {Array} A new list sorted by the keys generated by `fn`.
21960 * @example
21961 *
21962 * var sortByFirstItem = R.sortBy(R.prop(0));
21963 * var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));
21964 * var pairs = [[-1, 1], [-2, 2], [-3, 3]];
21965 * sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]]
21966 * var alice = {
21967 * name: 'ALICE',
21968 * age: 101
21969 * };
21970 * var bob = {
21971 * name: 'Bob',
21972 * age: -10
21973 * };
21974 * var clara = {
21975 * name: 'clara',
21976 * age: 314.159
21977 * };
21978 * var people = [clara, bob, alice];
21979 * sortByNameCaseInsensitive(people); //=> [alice, bob, clara]
21980 */
21981module.exports = _curry2(function sortBy(fn, list) {
21982 return Array.prototype.slice.call(list, 0).sort(function(a, b) {
21983 var aa = fn(a);
21984 var bb = fn(b);
21985 return aa < bb ? -1 : aa > bb ? 1 : 0;
21986 });
21987});
21988
21989
21990/***/ }),
21991/* 310 */
21992/***/ (function(module, exports, __webpack_require__) {
21993
21994var _curry2 = __webpack_require__(0);
21995
21996
21997/**
21998 * Sorts a list according to a list of comparators.
21999 *
22000 * @func
22001 * @memberOf R
22002 * @since v0.23.0
22003 * @category Relation
22004 * @sig [a -> a -> Number] -> [a] -> [a]
22005 * @param {Array} functions A list of comparator functions.
22006 * @param {Array} list The list to sort.
22007 * @return {Array} A new list sorted according to the comarator functions.
22008 * @example
22009 *
22010 * var alice = {
22011 * name: 'alice',
22012 * age: 40
22013 * };
22014 * var bob = {
22015 * name: 'bob',
22016 * age: 30
22017 * };
22018 * var clara = {
22019 * name: 'clara',
22020 * age: 40
22021 * };
22022 * var people = [clara, bob, alice];
22023 * var ageNameSort = R.sortWith([
22024 * R.descend(R.prop('age')),
22025 * R.ascend(R.prop('name'))
22026 * ]);
22027 * ageNameSort(people); //=> [alice, clara, bob]
22028 */
22029module.exports = _curry2(function sortWith(fns, list) {
22030 return Array.prototype.slice.call(list, 0).sort(function(a, b) {
22031 var result = 0;
22032 var i = 0;
22033 while (result === 0 && i < fns.length) {
22034 result = fns[i](a, b);
22035 i += 1;
22036 }
22037 return result;
22038 });
22039});
22040
22041
22042/***/ }),
22043/* 311 */
22044/***/ (function(module, exports, __webpack_require__) {
22045
22046var invoker = __webpack_require__(22);
22047
22048
22049/**
22050 * Splits a string into an array of strings based on the given
22051 * separator.
22052 *
22053 * @func
22054 * @memberOf R
22055 * @since v0.1.0
22056 * @category String
22057 * @sig (String | RegExp) -> String -> [String]
22058 * @param {String|RegExp} sep The pattern.
22059 * @param {String} str The string to separate into an array.
22060 * @return {Array} The array of strings from `str` separated by `str`.
22061 * @see R.join
22062 * @example
22063 *
22064 * var pathComponents = R.split('/');
22065 * R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node']
22066 *
22067 * R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd']
22068 */
22069module.exports = invoker(1, 'split');
22070
22071
22072/***/ }),
22073/* 312 */
22074/***/ (function(module, exports, __webpack_require__) {
22075
22076var _curry2 = __webpack_require__(0);
22077var length = __webpack_require__(100);
22078var slice = __webpack_require__(18);
22079
22080
22081/**
22082 * Splits a given list or string at a given index.
22083 *
22084 * @func
22085 * @memberOf R
22086 * @since v0.19.0
22087 * @category List
22088 * @sig Number -> [a] -> [[a], [a]]
22089 * @sig Number -> String -> [String, String]
22090 * @param {Number} index The index where the array/string is split.
22091 * @param {Array|String} array The array/string to be split.
22092 * @return {Array}
22093 * @example
22094 *
22095 * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]]
22096 * R.splitAt(5, 'hello world'); //=> ['hello', ' world']
22097 * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r']
22098 */
22099module.exports = _curry2(function splitAt(index, array) {
22100 return [slice(0, index, array), slice(index, length(array), array)];
22101});
22102
22103
22104/***/ }),
22105/* 313 */
22106/***/ (function(module, exports, __webpack_require__) {
22107
22108var _curry2 = __webpack_require__(0);
22109var slice = __webpack_require__(18);
22110
22111
22112/**
22113 * Splits a collection into slices of the specified length.
22114 *
22115 * @func
22116 * @memberOf R
22117 * @since v0.16.0
22118 * @category List
22119 * @sig Number -> [a] -> [[a]]
22120 * @sig Number -> String -> [String]
22121 * @param {Number} n
22122 * @param {Array} list
22123 * @return {Array}
22124 * @example
22125 *
22126 * R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]]
22127 * R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz']
22128 */
22129module.exports = _curry2(function splitEvery(n, list) {
22130 if (n <= 0) {
22131 throw new Error('First argument to splitEvery must be a positive integer');
22132 }
22133 var result = [];
22134 var idx = 0;
22135 while (idx < list.length) {
22136 result.push(slice(idx, idx += n, list));
22137 }
22138 return result;
22139});
22140
22141
22142/***/ }),
22143/* 314 */
22144/***/ (function(module, exports, __webpack_require__) {
22145
22146var _curry2 = __webpack_require__(0);
22147
22148
22149/**
22150 * Takes a list and a predicate and returns a pair of lists with the following properties:
22151 *
22152 * - the result of concatenating the two output lists is equivalent to the input list;
22153 * - none of the elements of the first output list satisfies the predicate; and
22154 * - if the second output list is non-empty, its first element satisfies the predicate.
22155 *
22156 * @func
22157 * @memberOf R
22158 * @since v0.19.0
22159 * @category List
22160 * @sig (a -> Boolean) -> [a] -> [[a], [a]]
22161 * @param {Function} pred The predicate that determines where the array is split.
22162 * @param {Array} list The array to be split.
22163 * @return {Array}
22164 * @example
22165 *
22166 * R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]]
22167 */
22168module.exports = _curry2(function splitWhen(pred, list) {
22169 var idx = 0;
22170 var len = list.length;
22171 var prefix = [];
22172
22173 while (idx < len && !pred(list[idx])) {
22174 prefix.push(list[idx]);
22175 idx += 1;
22176 }
22177
22178 return [prefix, Array.prototype.slice.call(list, idx)];
22179});
22180
22181
22182/***/ }),
22183/* 315 */
22184/***/ (function(module, exports, __webpack_require__) {
22185
22186var _curry2 = __webpack_require__(0);
22187
22188
22189/**
22190 * Subtracts its second argument from its first argument.
22191 *
22192 * @func
22193 * @memberOf R
22194 * @since v0.1.0
22195 * @category Math
22196 * @sig Number -> Number -> Number
22197 * @param {Number} a The first value.
22198 * @param {Number} b The second value.
22199 * @return {Number} The result of `a - b`.
22200 * @see R.add
22201 * @example
22202 *
22203 * R.subtract(10, 8); //=> 2
22204 *
22205 * var minus5 = R.subtract(R.__, 5);
22206 * minus5(17); //=> 12
22207 *
22208 * var complementaryAngle = R.subtract(90);
22209 * complementaryAngle(30); //=> 60
22210 * complementaryAngle(72); //=> 18
22211 */
22212module.exports = _curry2(function subtract(a, b) {
22213 return Number(a) - Number(b);
22214});
22215
22216
22217/***/ }),
22218/* 316 */
22219/***/ (function(module, exports, __webpack_require__) {
22220
22221var _curry2 = __webpack_require__(0);
22222var concat = __webpack_require__(49);
22223var difference = __webpack_require__(76);
22224
22225
22226/**
22227 * Finds the set (i.e. no duplicates) of all elements contained in the first or
22228 * second list, but not both.
22229 *
22230 * @func
22231 * @memberOf R
22232 * @since v0.19.0
22233 * @category Relation
22234 * @sig [*] -> [*] -> [*]
22235 * @param {Array} list1 The first list.
22236 * @param {Array} list2 The second list.
22237 * @return {Array} The elements in `list1` or `list2`, but not both.
22238 * @see R.symmetricDifferenceWith, R.difference, R.differenceWith
22239 * @example
22240 *
22241 * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5]
22242 * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2]
22243 */
22244module.exports = _curry2(function symmetricDifference(list1, list2) {
22245 return concat(difference(list1, list2), difference(list2, list1));
22246});
22247
22248
22249/***/ }),
22250/* 317 */
22251/***/ (function(module, exports, __webpack_require__) {
22252
22253var _curry3 = __webpack_require__(2);
22254var concat = __webpack_require__(49);
22255var differenceWith = __webpack_require__(77);
22256
22257
22258/**
22259 * Finds the set (i.e. no duplicates) of all elements contained in the first or
22260 * second list, but not both. Duplication is determined according to the value
22261 * returned by applying the supplied predicate to two list elements.
22262 *
22263 * @func
22264 * @memberOf R
22265 * @since v0.19.0
22266 * @category Relation
22267 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
22268 * @param {Function} pred A predicate used to test whether two items are equal.
22269 * @param {Array} list1 The first list.
22270 * @param {Array} list2 The second list.
22271 * @return {Array} The elements in `list1` or `list2`, but not both.
22272 * @see R.symmetricDifference, R.difference, R.differenceWith
22273 * @example
22274 *
22275 * var eqA = R.eqBy(R.prop('a'));
22276 * var l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}];
22277 * var l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}];
22278 * R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}]
22279 */
22280module.exports = _curry3(function symmetricDifferenceWith(pred, list1, list2) {
22281 return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1));
22282});
22283
22284
22285/***/ }),
22286/* 318 */
22287/***/ (function(module, exports, __webpack_require__) {
22288
22289var _curry2 = __webpack_require__(0);
22290var drop = __webpack_require__(79);
22291
22292
22293/**
22294 * Returns a new list containing the last `n` elements of the given list.
22295 * If `n > list.length`, returns a list of `list.length` elements.
22296 *
22297 * @func
22298 * @memberOf R
22299 * @since v0.16.0
22300 * @category List
22301 * @sig Number -> [a] -> [a]
22302 * @sig Number -> String -> String
22303 * @param {Number} n The number of elements to return.
22304 * @param {Array} xs The collection to consider.
22305 * @return {Array}
22306 * @see R.dropLast
22307 * @example
22308 *
22309 * R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz']
22310 * R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
22311 * R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
22312 * R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
22313 * R.takeLast(3, 'ramda'); //=> 'mda'
22314 */
22315module.exports = _curry2(function takeLast(n, xs) {
22316 return drop(n >= 0 ? xs.length - n : 0, xs);
22317});
22318
22319
22320/***/ }),
22321/* 319 */
22322/***/ (function(module, exports, __webpack_require__) {
22323
22324var _curry2 = __webpack_require__(0);
22325
22326
22327/**
22328 * Returns a new list containing the last `n` elements of a given list, passing
22329 * each value to the supplied predicate function, and terminating when the
22330 * predicate function returns `false`. Excludes the element that caused the
22331 * predicate function to fail. The predicate function is passed one argument:
22332 * *(value)*.
22333 *
22334 * @func
22335 * @memberOf R
22336 * @since v0.16.0
22337 * @category List
22338 * @sig (a -> Boolean) -> [a] -> [a]
22339 * @param {Function} fn The function called per iteration.
22340 * @param {Array} list The collection to iterate over.
22341 * @return {Array} A new array.
22342 * @see R.dropLastWhile, R.addIndex
22343 * @example
22344 *
22345 * var isNotOne = x => x !== 1;
22346 *
22347 * R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4]
22348 */
22349module.exports = _curry2(function takeLastWhile(fn, list) {
22350 var idx = list.length - 1;
22351 while (idx >= 0 && fn(list[idx])) {
22352 idx -= 1;
22353 }
22354 return Array.prototype.slice.call(list, idx + 1);
22355});
22356
22357
22358/***/ }),
22359/* 320 */
22360/***/ (function(module, exports, __webpack_require__) {
22361
22362var _curry2 = __webpack_require__(0);
22363var _dispatchable = __webpack_require__(3);
22364var _xtakeWhile = __webpack_require__(246);
22365
22366
22367/**
22368 * Returns a new list containing the first `n` elements of a given list,
22369 * passing each value to the supplied predicate function, and terminating when
22370 * the predicate function returns `false`. Excludes the element that caused the
22371 * predicate function to fail. The predicate function is passed one argument:
22372 * *(value)*.
22373 *
22374 * Dispatches to the `takeWhile` method of the second argument, if present.
22375 *
22376 * Acts as a transducer if a transformer is given in list position.
22377 *
22378 * @func
22379 * @memberOf R
22380 * @since v0.1.0
22381 * @category List
22382 * @sig (a -> Boolean) -> [a] -> [a]
22383 * @param {Function} fn The function called per iteration.
22384 * @param {Array} list The collection to iterate over.
22385 * @return {Array} A new array.
22386 * @see R.dropWhile, R.transduce, R.addIndex
22387 * @example
22388 *
22389 * var isNotFour = x => x !== 4;
22390 *
22391 * R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3]
22392 */
22393module.exports = _curry2(_dispatchable(['takeWhile'], _xtakeWhile, function takeWhile(fn, list) {
22394 var idx = 0;
22395 var len = list.length;
22396 while (idx < len && fn(list[idx])) {
22397 idx += 1;
22398 }
22399 return Array.prototype.slice.call(list, 0, idx);
22400}));
22401
22402
22403/***/ }),
22404/* 321 */
22405/***/ (function(module, exports, __webpack_require__) {
22406
22407var _curry2 = __webpack_require__(0);
22408
22409
22410/**
22411 * Runs the given function with the supplied object, then returns the object.
22412 *
22413 * @func
22414 * @memberOf R
22415 * @since v0.1.0
22416 * @category Function
22417 * @sig (a -> *) -> a -> a
22418 * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.
22419 * @param {*} x
22420 * @return {*} `x`.
22421 * @example
22422 *
22423 * var sayX = x => console.log('x is ' + x);
22424 * R.tap(sayX, 100); //=> 100
22425 * // logs 'x is 100'
22426 * @symb R.tap(f, a) = a
22427 */
22428module.exports = _curry2(function tap(fn, x) {
22429 fn(x);
22430 return x;
22431});
22432
22433
22434/***/ }),
22435/* 322 */
22436/***/ (function(module, exports, __webpack_require__) {
22437
22438var _cloneRegExp = __webpack_require__(84);
22439var _curry2 = __webpack_require__(0);
22440var _isRegExp = __webpack_require__(222);
22441var toString = __webpack_require__(27);
22442
22443
22444/**
22445 * Determines whether a given string matches a given regular expression.
22446 *
22447 * @func
22448 * @memberOf R
22449 * @since v0.12.0
22450 * @category String
22451 * @sig RegExp -> String -> Boolean
22452 * @param {RegExp} pattern
22453 * @param {String} str
22454 * @return {Boolean}
22455 * @see R.match
22456 * @example
22457 *
22458 * R.test(/^x/, 'xyz'); //=> true
22459 * R.test(/^y/, 'xyz'); //=> false
22460 */
22461module.exports = _curry2(function test(pattern, str) {
22462 if (!_isRegExp(pattern)) {
22463 throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received ' + toString(pattern));
22464 }
22465 return _cloneRegExp(pattern).test(str);
22466});
22467
22468
22469/***/ }),
22470/* 323 */
22471/***/ (function(module, exports, __webpack_require__) {
22472
22473var invoker = __webpack_require__(22);
22474
22475
22476/**
22477 * The lower case version of a string.
22478 *
22479 * @func
22480 * @memberOf R
22481 * @since v0.9.0
22482 * @category String
22483 * @sig String -> String
22484 * @param {String} str The string to lower case.
22485 * @return {String} The lower case version of `str`.
22486 * @see R.toUpper
22487 * @example
22488 *
22489 * R.toLower('XYZ'); //=> 'xyz'
22490 */
22491module.exports = invoker(0, 'toLowerCase');
22492
22493
22494/***/ }),
22495/* 324 */
22496/***/ (function(module, exports, __webpack_require__) {
22497
22498var _curry1 = __webpack_require__(1);
22499var _has = __webpack_require__(6);
22500
22501
22502/**
22503 * Converts an object into an array of key, value arrays. Only the object's
22504 * own properties are used.
22505 * Note that the order of the output array is not guaranteed to be consistent
22506 * across different JS platforms.
22507 *
22508 * @func
22509 * @memberOf R
22510 * @since v0.4.0
22511 * @category Object
22512 * @sig {String: *} -> [[String,*]]
22513 * @param {Object} obj The object to extract from
22514 * @return {Array} An array of key, value arrays from the object's own properties.
22515 * @see R.fromPairs
22516 * @example
22517 *
22518 * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]
22519 */
22520module.exports = _curry1(function toPairs(obj) {
22521 var pairs = [];
22522 for (var prop in obj) {
22523 if (_has(prop, obj)) {
22524 pairs[pairs.length] = [prop, obj[prop]];
22525 }
22526 }
22527 return pairs;
22528});
22529
22530
22531/***/ }),
22532/* 325 */
22533/***/ (function(module, exports, __webpack_require__) {
22534
22535var _curry1 = __webpack_require__(1);
22536
22537
22538/**
22539 * Converts an object into an array of key, value arrays. The object's own
22540 * properties and prototype properties are used. Note that the order of the
22541 * output array is not guaranteed to be consistent across different JS
22542 * platforms.
22543 *
22544 * @func
22545 * @memberOf R
22546 * @since v0.4.0
22547 * @category Object
22548 * @sig {String: *} -> [[String,*]]
22549 * @param {Object} obj The object to extract from
22550 * @return {Array} An array of key, value arrays from the object's own
22551 * and prototype properties.
22552 * @example
22553 *
22554 * var F = function() { this.x = 'X'; };
22555 * F.prototype.y = 'Y';
22556 * var f = new F();
22557 * R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
22558 */
22559module.exports = _curry1(function toPairsIn(obj) {
22560 var pairs = [];
22561 for (var prop in obj) {
22562 pairs[pairs.length] = [prop, obj[prop]];
22563 }
22564 return pairs;
22565});
22566
22567
22568/***/ }),
22569/* 326 */
22570/***/ (function(module, exports, __webpack_require__) {
22571
22572var invoker = __webpack_require__(22);
22573
22574
22575/**
22576 * The upper case version of a string.
22577 *
22578 * @func
22579 * @memberOf R
22580 * @since v0.9.0
22581 * @category String
22582 * @sig String -> String
22583 * @param {String} str The string to upper case.
22584 * @return {String} The upper case version of `str`.
22585 * @see R.toLower
22586 * @example
22587 *
22588 * R.toUpper('abc'); //=> 'ABC'
22589 */
22590module.exports = invoker(0, 'toUpperCase');
22591
22592
22593/***/ }),
22594/* 327 */
22595/***/ (function(module, exports, __webpack_require__) {
22596
22597var _reduce = __webpack_require__(9);
22598var _xwrap = __webpack_require__(96);
22599var curryN = __webpack_require__(5);
22600
22601
22602/**
22603 * Initializes a transducer using supplied iterator function. Returns a single
22604 * item by iterating through the list, successively calling the transformed
22605 * iterator function and passing it an accumulator value and the current value
22606 * from the array, and then passing the result to the next call.
22607 *
22608 * The iterator function receives two values: *(acc, value)*. It will be
22609 * wrapped as a transformer to initialize the transducer. A transformer can be
22610 * passed directly in place of an iterator function. In both cases, iteration
22611 * may be stopped early with the `R.reduced` function.
22612 *
22613 * A transducer is a function that accepts a transformer and returns a
22614 * transformer and can be composed directly.
22615 *
22616 * A transformer is an an object that provides a 2-arity reducing iterator
22617 * function, step, 0-arity initial value function, init, and 1-arity result
22618 * extraction function, result. The step function is used as the iterator
22619 * function in reduce. The result function is used to convert the final
22620 * accumulator into the return type and in most cases is R.identity. The init
22621 * function can be used to provide an initial accumulator, but is ignored by
22622 * transduce.
22623 *
22624 * The iteration is performed with R.reduce after initializing the transducer.
22625 *
22626 * @func
22627 * @memberOf R
22628 * @since v0.12.0
22629 * @category List
22630 * @sig (c -> c) -> (a,b -> a) -> a -> [b] -> a
22631 * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
22632 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
22633 * current element from the array. Wrapped as transformer, if necessary, and used to
22634 * initialize the transducer
22635 * @param {*} acc The initial accumulator value.
22636 * @param {Array} list The list to iterate over.
22637 * @return {*} The final, accumulated value.
22638 * @see R.reduce, R.reduced, R.into
22639 * @example
22640 *
22641 * var numbers = [1, 2, 3, 4];
22642 * var transducer = R.compose(R.map(R.add(1)), R.take(2));
22643 *
22644 * R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3]
22645 */
22646module.exports = curryN(4, function transduce(xf, fn, acc, list) {
22647 return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);
22648});
22649
22650
22651/***/ }),
22652/* 328 */
22653/***/ (function(module, exports, __webpack_require__) {
22654
22655var _curry1 = __webpack_require__(1);
22656
22657
22658/**
22659 * Transposes the rows and columns of a 2D list.
22660 * When passed a list of `n` lists of length `x`,
22661 * returns a list of `x` lists of length `n`.
22662 *
22663 *
22664 * @func
22665 * @memberOf R
22666 * @since v0.19.0
22667 * @category List
22668 * @sig [[a]] -> [[a]]
22669 * @param {Array} list A 2D list
22670 * @return {Array} A 2D list
22671 * @example
22672 *
22673 * R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']]
22674 * R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']]
22675 *
22676 * If some of the rows are shorter than the following rows, their elements are skipped:
22677 *
22678 * R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]]
22679 * @symb R.transpose([[a], [b], [c]]) = [a, b, c]
22680 * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]]
22681 * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]]
22682 */
22683module.exports = _curry1(function transpose(outerlist) {
22684 var i = 0;
22685 var result = [];
22686 while (i < outerlist.length) {
22687 var innerlist = outerlist[i];
22688 var j = 0;
22689 while (j < innerlist.length) {
22690 if (typeof result[j] === 'undefined') {
22691 result[j] = [];
22692 }
22693 result[j].push(innerlist[j]);
22694 j += 1;
22695 }
22696 i += 1;
22697 }
22698 return result;
22699});
22700
22701
22702/***/ }),
22703/* 329 */
22704/***/ (function(module, exports, __webpack_require__) {
22705
22706var _curry3 = __webpack_require__(2);
22707var map = __webpack_require__(7);
22708var sequence = __webpack_require__(114);
22709
22710
22711/**
22712 * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
22713 * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
22714 * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
22715 * into an Applicative of Traversable.
22716 *
22717 * Dispatches to the `sequence` method of the third argument, if present.
22718 *
22719 * @func
22720 * @memberOf R
22721 * @since v0.19.0
22722 * @category List
22723 * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b)
22724 * @param {Function} of
22725 * @param {Function} f
22726 * @param {*} traversable
22727 * @return {*}
22728 * @see R.sequence
22729 * @example
22730 *
22731 * // Returns `Nothing` if the given divisor is `0`
22732 * safeDiv = n => d => d === 0 ? Nothing() : Just(n / d)
22733 *
22734 * R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Just([5, 2.5, 2])
22735 * R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Nothing
22736 */
22737module.exports = _curry3(function traverse(of, f, traversable) {
22738 return sequence(of, map(f, traversable));
22739});
22740
22741
22742/***/ }),
22743/* 330 */
22744/***/ (function(module, exports, __webpack_require__) {
22745
22746var _curry1 = __webpack_require__(1);
22747
22748
22749/**
22750 * Removes (strips) whitespace from both ends of the string.
22751 *
22752 * @func
22753 * @memberOf R
22754 * @since v0.6.0
22755 * @category String
22756 * @sig String -> String
22757 * @param {String} str The string to trim.
22758 * @return {String} Trimmed version of `str`.
22759 * @example
22760 *
22761 * R.trim(' xyz '); //=> 'xyz'
22762 * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z']
22763 */
22764module.exports = (function() {
22765 var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
22766 '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' +
22767 '\u2029\uFEFF';
22768 var zeroWidth = '\u200b';
22769 var hasProtoTrim = (typeof String.prototype.trim === 'function');
22770 if (!hasProtoTrim || (ws.trim() || !zeroWidth.trim())) {
22771 return _curry1(function trim(str) {
22772 var beginRx = new RegExp('^[' + ws + '][' + ws + ']*');
22773 var endRx = new RegExp('[' + ws + '][' + ws + ']*$');
22774 return str.replace(beginRx, '').replace(endRx, '');
22775 });
22776 } else {
22777 return _curry1(function trim(str) {
22778 return str.trim();
22779 });
22780 }
22781}());
22782
22783
22784/***/ }),
22785/* 331 */
22786/***/ (function(module, exports, __webpack_require__) {
22787
22788var _arity = __webpack_require__(12);
22789var _concat = __webpack_require__(10);
22790var _curry2 = __webpack_require__(0);
22791
22792
22793/**
22794 * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned
22795 * function evaluates the `tryer`; if it does not throw, it simply returns the
22796 * result. If the `tryer` *does* throw, the returned function evaluates the
22797 * `catcher` function and returns its result. Note that for effective
22798 * composition with this function, both the `tryer` and `catcher` functions
22799 * must return the same type of results.
22800 *
22801 * @func
22802 * @memberOf R
22803 * @since v0.20.0
22804 * @category Function
22805 * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a)
22806 * @param {Function} tryer The function that may throw.
22807 * @param {Function} catcher The function that will be evaluated if `tryer` throws.
22808 * @return {Function} A new function that will catch exceptions and send then to the catcher.
22809 * @example
22810 *
22811 * R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true
22812 * R.tryCatch(R.prop('x'), R.F)(null); //=> false
22813 */
22814module.exports = _curry2(function _tryCatch(tryer, catcher) {
22815 return _arity(tryer.length, function() {
22816 try {
22817 return tryer.apply(this, arguments);
22818 } catch (e) {
22819 return catcher.apply(this, _concat([e], arguments));
22820 }
22821 });
22822});
22823
22824
22825/***/ }),
22826/* 332 */
22827/***/ (function(module, exports, __webpack_require__) {
22828
22829var _curry1 = __webpack_require__(1);
22830
22831
22832/**
22833 * Takes a function `fn`, which takes a single array argument, and returns a
22834 * function which:
22835 *
22836 * - takes any number of positional arguments;
22837 * - passes these arguments to `fn` as an array; and
22838 * - returns the result.
22839 *
22840 * In other words, R.unapply derives a variadic function from a function which
22841 * takes an array. R.unapply is the inverse of R.apply.
22842 *
22843 * @func
22844 * @memberOf R
22845 * @since v0.8.0
22846 * @category Function
22847 * @sig ([*...] -> a) -> (*... -> a)
22848 * @param {Function} fn
22849 * @return {Function}
22850 * @see R.apply
22851 * @example
22852 *
22853 * R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
22854 * @symb R.unapply(f)(a, b) = f([a, b])
22855 */
22856module.exports = _curry1(function unapply(fn) {
22857 return function() {
22858 return fn(Array.prototype.slice.call(arguments, 0));
22859 };
22860});
22861
22862
22863/***/ }),
22864/* 333 */
22865/***/ (function(module, exports, __webpack_require__) {
22866
22867var _curry1 = __webpack_require__(1);
22868var nAry = __webpack_require__(41);
22869
22870
22871/**
22872 * Wraps a function of any arity (including nullary) in a function that accepts
22873 * exactly 1 parameter. Any extraneous parameters will not be passed to the
22874 * supplied function.
22875 *
22876 * @func
22877 * @memberOf R
22878 * @since v0.2.0
22879 * @category Function
22880 * @sig (* -> b) -> (a -> b)
22881 * @param {Function} fn The function to wrap.
22882 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
22883 * arity 1.
22884 * @example
22885 *
22886 * var takesTwoArgs = function(a, b) {
22887 * return [a, b];
22888 * };
22889 * takesTwoArgs.length; //=> 2
22890 * takesTwoArgs(1, 2); //=> [1, 2]
22891 *
22892 * var takesOneArg = R.unary(takesTwoArgs);
22893 * takesOneArg.length; //=> 1
22894 * // Only 1 argument is passed to the wrapped function
22895 * takesOneArg(1, 2); //=> [1, undefined]
22896 * @symb R.unary(f)(a, b, c) = f(a)
22897 */
22898module.exports = _curry1(function unary(fn) {
22899 return nAry(1, fn);
22900});
22901
22902
22903/***/ }),
22904/* 334 */
22905/***/ (function(module, exports, __webpack_require__) {
22906
22907var _curry2 = __webpack_require__(0);
22908var curryN = __webpack_require__(5);
22909
22910
22911/**
22912 * Returns a function of arity `n` from a (manually) curried function.
22913 *
22914 * @func
22915 * @memberOf R
22916 * @since v0.14.0
22917 * @category Function
22918 * @sig Number -> (a -> b) -> (a -> c)
22919 * @param {Number} length The arity for the returned function.
22920 * @param {Function} fn The function to uncurry.
22921 * @return {Function} A new function.
22922 * @see R.curry
22923 * @example
22924 *
22925 * var addFour = a => b => c => d => a + b + c + d;
22926 *
22927 * var uncurriedAddFour = R.uncurryN(4, addFour);
22928 * uncurriedAddFour(1, 2, 3, 4); //=> 10
22929 */
22930module.exports = _curry2(function uncurryN(depth, fn) {
22931 return curryN(depth, function() {
22932 var currentDepth = 1;
22933 var value = fn;
22934 var idx = 0;
22935 var endIdx;
22936 while (currentDepth <= depth && typeof value === 'function') {
22937 endIdx = currentDepth === depth ? arguments.length : idx + value.length;
22938 value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx));
22939 currentDepth += 1;
22940 idx = endIdx;
22941 }
22942 return value;
22943 });
22944});
22945
22946
22947/***/ }),
22948/* 335 */
22949/***/ (function(module, exports, __webpack_require__) {
22950
22951var _curry2 = __webpack_require__(0);
22952
22953
22954/**
22955 * Builds a list from a seed value. Accepts an iterator function, which returns
22956 * either false to stop iteration or an array of length 2 containing the value
22957 * to add to the resulting list and the seed to be used in the next call to the
22958 * iterator function.
22959 *
22960 * The iterator function receives one argument: *(seed)*.
22961 *
22962 * @func
22963 * @memberOf R
22964 * @since v0.10.0
22965 * @category List
22966 * @sig (a -> [b]) -> * -> [b]
22967 * @param {Function} fn The iterator function. receives one argument, `seed`, and returns
22968 * either false to quit iteration or an array of length two to proceed. The element
22969 * at index 0 of this array will be added to the resulting array, and the element
22970 * at index 1 will be passed to the next call to `fn`.
22971 * @param {*} seed The seed value.
22972 * @return {Array} The final list.
22973 * @example
22974 *
22975 * var f = n => n > 50 ? false : [-n, n + 10];
22976 * R.unfold(f, 10); //=> [-10, -20, -30, -40, -50]
22977 * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...]
22978 */
22979module.exports = _curry2(function unfold(fn, seed) {
22980 var pair = fn(seed);
22981 var result = [];
22982 while (pair && pair.length) {
22983 result[result.length] = pair[0];
22984 pair = fn(pair[1]);
22985 }
22986 return result;
22987});
22988
22989
22990/***/ }),
22991/* 336 */
22992/***/ (function(module, exports, __webpack_require__) {
22993
22994var _concat = __webpack_require__(10);
22995var _curry2 = __webpack_require__(0);
22996var compose = __webpack_require__(48);
22997var uniq = __webpack_require__(59);
22998
22999
23000/**
23001 * Combines two lists into a set (i.e. no duplicates) composed of the elements
23002 * of each list.
23003 *
23004 * @func
23005 * @memberOf R
23006 * @since v0.1.0
23007 * @category Relation
23008 * @sig [*] -> [*] -> [*]
23009 * @param {Array} as The first list.
23010 * @param {Array} bs The second list.
23011 * @return {Array} The first and second lists concatenated, with
23012 * duplicates removed.
23013 * @example
23014 *
23015 * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4]
23016 */
23017module.exports = _curry2(compose(uniq, _concat));
23018
23019
23020/***/ }),
23021/* 337 */
23022/***/ (function(module, exports, __webpack_require__) {
23023
23024var _concat = __webpack_require__(10);
23025var _curry3 = __webpack_require__(2);
23026var uniqWith = __webpack_require__(60);
23027
23028
23029/**
23030 * Combines two lists into a set (i.e. no duplicates) composed of the elements
23031 * of each list. Duplication is determined according to the value returned by
23032 * applying the supplied predicate to two list elements.
23033 *
23034 * @func
23035 * @memberOf R
23036 * @since v0.1.0
23037 * @category Relation
23038 * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*]
23039 * @param {Function} pred A predicate used to test whether two items are equal.
23040 * @param {Array} list1 The first list.
23041 * @param {Array} list2 The second list.
23042 * @return {Array} The first and second lists concatenated, with
23043 * duplicates removed.
23044 * @see R.union
23045 * @example
23046 *
23047 * var l1 = [{a: 1}, {a: 2}];
23048 * var l2 = [{a: 1}, {a: 4}];
23049 * R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
23050 */
23051module.exports = _curry3(function unionWith(pred, list1, list2) {
23052 return uniqWith(pred, _concat(list1, list2));
23053});
23054
23055
23056/***/ }),
23057/* 338 */
23058/***/ (function(module, exports, __webpack_require__) {
23059
23060var _curry3 = __webpack_require__(2);
23061
23062
23063/**
23064 * Tests the final argument by passing it to the given predicate function. If
23065 * the predicate is not satisfied, the function will return the result of
23066 * calling the `whenFalseFn` function with the same argument. If the predicate
23067 * is satisfied, the argument is returned as is.
23068 *
23069 * @func
23070 * @memberOf R
23071 * @since v0.18.0
23072 * @category Logic
23073 * @sig (a -> Boolean) -> (a -> a) -> a -> a
23074 * @param {Function} pred A predicate function
23075 * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates
23076 * to a falsy value.
23077 * @param {*} x An object to test with the `pred` function and
23078 * pass to `whenFalseFn` if necessary.
23079 * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.
23080 * @see R.ifElse, R.when
23081 * @example
23082 *
23083 * // coerceArray :: (a|[a]) -> [a]
23084 * var coerceArray = R.unless(R.isArrayLike, R.of);
23085 * coerceArray([1, 2, 3]); //=> [1, 2, 3]
23086 * coerceArray(1); //=> [1]
23087 */
23088module.exports = _curry3(function unless(pred, whenFalseFn, x) {
23089 return pred(x) ? x : whenFalseFn(x);
23090});
23091
23092
23093/***/ }),
23094/* 339 */
23095/***/ (function(module, exports, __webpack_require__) {
23096
23097var _identity = __webpack_require__(54);
23098var chain = __webpack_require__(47);
23099
23100
23101/**
23102 * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from
23103 * any [Chain](https://github.com/fantasyland/fantasy-land#chain).
23104 *
23105 * @func
23106 * @memberOf R
23107 * @since v0.3.0
23108 * @category List
23109 * @sig Chain c => c (c a) -> c a
23110 * @param {*} list
23111 * @return {*}
23112 * @see R.flatten, R.chain
23113 * @example
23114 *
23115 * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]]
23116 * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6]
23117 */
23118module.exports = chain(_identity);
23119
23120
23121/***/ }),
23122/* 340 */
23123/***/ (function(module, exports, __webpack_require__) {
23124
23125var _curry3 = __webpack_require__(2);
23126
23127
23128/**
23129 * Takes a predicate, a transformation function, and an initial value,
23130 * and returns a value of the same type as the initial value.
23131 * It does so by applying the transformation until the predicate is satisfied,
23132 * at which point it returns the satisfactory value.
23133 *
23134 * @func
23135 * @memberOf R
23136 * @since v0.20.0
23137 * @category Logic
23138 * @sig (a -> Boolean) -> (a -> a) -> a -> a
23139 * @param {Function} pred A predicate function
23140 * @param {Function} fn The iterator function
23141 * @param {*} init Initial value
23142 * @return {*} Final value that satisfies predicate
23143 * @example
23144 *
23145 * R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128
23146 */
23147module.exports = _curry3(function until(pred, fn, init) {
23148 var val = init;
23149 while (!pred(val)) {
23150 val = fn(val);
23151 }
23152 return val;
23153});
23154
23155
23156/***/ }),
23157/* 341 */
23158/***/ (function(module, exports, __webpack_require__) {
23159
23160var _curry1 = __webpack_require__(1);
23161
23162
23163/**
23164 * Returns a list of all the properties, including prototype properties, of the
23165 * supplied object.
23166 * Note that the order of the output array is not guaranteed to be consistent
23167 * across different JS platforms.
23168 *
23169 * @func
23170 * @memberOf R
23171 * @since v0.2.0
23172 * @category Object
23173 * @sig {k: v} -> [v]
23174 * @param {Object} obj The object to extract values from
23175 * @return {Array} An array of the values of the object's own and prototype properties.
23176 * @example
23177 *
23178 * var F = function() { this.x = 'X'; };
23179 * F.prototype.y = 'Y';
23180 * var f = new F();
23181 * R.valuesIn(f); //=> ['X', 'Y']
23182 */
23183module.exports = _curry1(function valuesIn(obj) {
23184 var prop;
23185 var vs = [];
23186 for (prop in obj) {
23187 vs[vs.length] = obj[prop];
23188 }
23189 return vs;
23190});
23191
23192
23193/***/ }),
23194/* 342 */
23195/***/ (function(module, exports, __webpack_require__) {
23196
23197var _curry2 = __webpack_require__(0);
23198
23199
23200/**
23201 * Returns a "view" of the given data structure, determined by the given lens.
23202 * The lens's focus determines which portion of the data structure is visible.
23203 *
23204 * @func
23205 * @memberOf R
23206 * @since v0.16.0
23207 * @category Object
23208 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
23209 * @sig Lens s a -> s -> a
23210 * @param {Lens} lens
23211 * @param {*} x
23212 * @return {*}
23213 * @see R.prop, R.lensIndex, R.lensProp
23214 * @example
23215 *
23216 * var xLens = R.lensProp('x');
23217 *
23218 * R.view(xLens, {x: 1, y: 2}); //=> 1
23219 * R.view(xLens, {x: 4, y: 2}); //=> 4
23220 */
23221module.exports = (function() {
23222 // `Const` is a functor that effectively ignores the function given to `map`.
23223 var Const = function(x) {
23224 return {value: x, map: function() { return this; }};
23225 };
23226
23227 return _curry2(function view(lens, x) {
23228 // Using `Const` effectively ignores the setter function of the `lens`,
23229 // leaving the value returned by the getter function unmodified.
23230 return lens(Const)(x).value;
23231 });
23232}());
23233
23234
23235/***/ }),
23236/* 343 */
23237/***/ (function(module, exports, __webpack_require__) {
23238
23239var _curry3 = __webpack_require__(2);
23240
23241
23242/**
23243 * Tests the final argument by passing it to the given predicate function. If
23244 * the predicate is satisfied, the function will return the result of calling
23245 * the `whenTrueFn` function with the same argument. If the predicate is not
23246 * satisfied, the argument is returned as is.
23247 *
23248 * @func
23249 * @memberOf R
23250 * @since v0.18.0
23251 * @category Logic
23252 * @sig (a -> Boolean) -> (a -> a) -> a -> a
23253 * @param {Function} pred A predicate function
23254 * @param {Function} whenTrueFn A function to invoke when the `condition`
23255 * evaluates to a truthy value.
23256 * @param {*} x An object to test with the `pred` function and
23257 * pass to `whenTrueFn` if necessary.
23258 * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`.
23259 * @see R.ifElse, R.unless
23260 * @example
23261 *
23262 * // truncate :: String -> String
23263 * var truncate = R.when(
23264 * R.propSatisfies(R.gt(R.__, 10), 'length'),
23265 * R.pipe(R.take(10), R.append('…'), R.join(''))
23266 * );
23267 * truncate('12345'); //=> '12345'
23268 * truncate('0123456789ABC'); //=> '0123456789…'
23269 */
23270module.exports = _curry3(function when(pred, whenTrueFn, x) {
23271 return pred(x) ? whenTrueFn(x) : x;
23272});
23273
23274
23275/***/ }),
23276/* 344 */
23277/***/ (function(module, exports, __webpack_require__) {
23278
23279var _curry2 = __webpack_require__(0);
23280var equals = __webpack_require__(11);
23281var map = __webpack_require__(7);
23282var where = __webpack_require__(122);
23283
23284
23285/**
23286 * Takes a spec object and a test object; returns true if the test satisfies
23287 * the spec, false otherwise. An object satisfies the spec if, for each of the
23288 * spec's own properties, accessing that property of the object gives the same
23289 * value (in `R.equals` terms) as accessing that property of the spec.
23290 *
23291 * `whereEq` is a specialization of [`where`](#where).
23292 *
23293 * @func
23294 * @memberOf R
23295 * @since v0.14.0
23296 * @category Object
23297 * @sig {String: *} -> {String: *} -> Boolean
23298 * @param {Object} spec
23299 * @param {Object} testObj
23300 * @return {Boolean}
23301 * @see R.where
23302 * @example
23303 *
23304 * // pred :: Object -> Boolean
23305 * var pred = R.whereEq({a: 1, b: 2});
23306 *
23307 * pred({a: 1}); //=> false
23308 * pred({a: 1, b: 2}); //=> true
23309 * pred({a: 1, b: 2, c: 3}); //=> true
23310 * pred({a: 1, b: 1}); //=> false
23311 */
23312module.exports = _curry2(function whereEq(spec, testObj) {
23313 return where(map(equals, spec), testObj);
23314});
23315
23316
23317/***/ }),
23318/* 345 */
23319/***/ (function(module, exports, __webpack_require__) {
23320
23321var _contains = __webpack_require__(17);
23322var _curry2 = __webpack_require__(0);
23323var flip = __webpack_require__(33);
23324var reject = __webpack_require__(43);
23325
23326
23327/**
23328 * Returns a new list without values in the first argument.
23329 * `R.equals` is used to determine equality.
23330 *
23331 * Acts as a transducer if a transformer is given in list position.
23332 *
23333 * @func
23334 * @memberOf R
23335 * @since v0.19.0
23336 * @category List
23337 * @sig [a] -> [a] -> [a]
23338 * @param {Array} list1 The values to be removed from `list2`.
23339 * @param {Array} list2 The array to remove values from.
23340 * @return {Array} The new array without values in `list1`.
23341 * @see R.transduce
23342 * @example
23343 *
23344 * R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4]
23345 */
23346module.exports = _curry2(function(xs, list) {
23347 return reject(flip(_contains)(xs), list);
23348});
23349
23350
23351/***/ }),
23352/* 346 */
23353/***/ (function(module, exports, __webpack_require__) {
23354
23355var _curry2 = __webpack_require__(0);
23356
23357
23358/**
23359 * Creates a new list out of the two supplied by creating each possible pair
23360 * from the lists.
23361 *
23362 * @func
23363 * @memberOf R
23364 * @since v0.1.0
23365 * @category List
23366 * @sig [a] -> [b] -> [[a,b]]
23367 * @param {Array} as The first list.
23368 * @param {Array} bs The second list.
23369 * @return {Array} The list made by combining each possible pair from
23370 * `as` and `bs` into pairs (`[a, b]`).
23371 * @example
23372 *
23373 * R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
23374 * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]]
23375 */
23376module.exports = _curry2(function xprod(a, b) { // = xprodWith(prepend); (takes about 3 times as long...)
23377 var idx = 0;
23378 var ilen = a.length;
23379 var j;
23380 var jlen = b.length;
23381 var result = [];
23382 while (idx < ilen) {
23383 j = 0;
23384 while (j < jlen) {
23385 result[result.length] = [a[idx], b[j]];
23386 j += 1;
23387 }
23388 idx += 1;
23389 }
23390 return result;
23391});
23392
23393
23394/***/ }),
23395/* 347 */
23396/***/ (function(module, exports, __webpack_require__) {
23397
23398var _curry2 = __webpack_require__(0);
23399
23400
23401/**
23402 * Creates a new list out of the two supplied by pairing up equally-positioned
23403 * items from both lists. The returned list is truncated to the length of the
23404 * shorter of the two input lists.
23405 * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.
23406 *
23407 * @func
23408 * @memberOf R
23409 * @since v0.1.0
23410 * @category List
23411 * @sig [a] -> [b] -> [[a,b]]
23412 * @param {Array} list1 The first array to consider.
23413 * @param {Array} list2 The second array to consider.
23414 * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`.
23415 * @example
23416 *
23417 * R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']]
23418 * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]]
23419 */
23420module.exports = _curry2(function zip(a, b) {
23421 var rv = [];
23422 var idx = 0;
23423 var len = Math.min(a.length, b.length);
23424 while (idx < len) {
23425 rv[idx] = [a[idx], b[idx]];
23426 idx += 1;
23427 }
23428 return rv;
23429});
23430
23431
23432/***/ }),
23433/* 348 */
23434/***/ (function(module, exports, __webpack_require__) {
23435
23436var _curry2 = __webpack_require__(0);
23437
23438
23439/**
23440 * Creates a new object out of a list of keys and a list of values.
23441 * Key/value pairing is truncated to the length of the shorter of the two lists.
23442 * Note: `zipObj` is equivalent to `pipe(zipWith(pair), fromPairs)`.
23443 *
23444 * @func
23445 * @memberOf R
23446 * @since v0.3.0
23447 * @category List
23448 * @sig [String] -> [*] -> {String: *}
23449 * @param {Array} keys The array that will be properties on the output object.
23450 * @param {Array} values The list of values on the output object.
23451 * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`.
23452 * @example
23453 *
23454 * R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3}
23455 */
23456module.exports = _curry2(function zipObj(keys, values) {
23457 var idx = 0;
23458 var len = Math.min(keys.length, values.length);
23459 var out = {};
23460 while (idx < len) {
23461 out[keys[idx]] = values[idx];
23462 idx += 1;
23463 }
23464 return out;
23465});
23466
23467
23468/***/ }),
23469/* 349 */
23470/***/ (function(module, exports, __webpack_require__) {
23471
23472var _curry3 = __webpack_require__(2);
23473
23474
23475/**
23476 * Creates a new list out of the two supplied by applying the function to each
23477 * equally-positioned pair in the lists. The returned list is truncated to the
23478 * length of the shorter of the two input lists.
23479 *
23480 * @function
23481 * @memberOf R
23482 * @since v0.1.0
23483 * @category List
23484 * @sig (a,b -> c) -> [a] -> [b] -> [c]
23485 * @param {Function} fn The function used to combine the two elements into one value.
23486 * @param {Array} list1 The first array to consider.
23487 * @param {Array} list2 The second array to consider.
23488 * @return {Array} The list made by combining same-indexed elements of `list1` and `list2`
23489 * using `fn`.
23490 * @example
23491 *
23492 * var f = (x, y) => {
23493 * // ...
23494 * };
23495 * R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']);
23496 * //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')]
23497 * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)]
23498 */
23499module.exports = _curry3(function zipWith(fn, a, b) {
23500 var rv = [];
23501 var idx = 0;
23502 var len = Math.min(a.length, b.length);
23503 while (idx < len) {
23504 rv[idx] = fn(a[idx], b[idx]);
23505 idx += 1;
23506 }
23507 return rv;
23508});
23509
23510
23511/***/ }),
23512/* 350 */
23513/***/ (function(module, exports, __webpack_require__) {
23514
23515/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
23516 "use strict";
23517
23518 if (global.setImmediate) {
23519 return;
23520 }
23521
23522 var nextHandle = 1; // Spec says greater than zero
23523 var tasksByHandle = {};
23524 var currentlyRunningATask = false;
23525 var doc = global.document;
23526 var registerImmediate;
23527
23528 function setImmediate(callback) {
23529 // Callback can either be a function or a string
23530 if (typeof callback !== "function") {
23531 callback = new Function("" + callback);
23532 }
23533 // Copy function arguments
23534 var args = new Array(arguments.length - 1);
23535 for (var i = 0; i < args.length; i++) {
23536 args[i] = arguments[i + 1];
23537 }
23538 // Store and register the task
23539 var task = { callback: callback, args: args };
23540 tasksByHandle[nextHandle] = task;
23541 registerImmediate(nextHandle);
23542 return nextHandle++;
23543 }
23544
23545 function clearImmediate(handle) {
23546 delete tasksByHandle[handle];
23547 }
23548
23549 function run(task) {
23550 var callback = task.callback;
23551 var args = task.args;
23552 switch (args.length) {
23553 case 0:
23554 callback();
23555 break;
23556 case 1:
23557 callback(args[0]);
23558 break;
23559 case 2:
23560 callback(args[0], args[1]);
23561 break;
23562 case 3:
23563 callback(args[0], args[1], args[2]);
23564 break;
23565 default:
23566 callback.apply(undefined, args);
23567 break;
23568 }
23569 }
23570
23571 function runIfPresent(handle) {
23572 // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
23573 // So if we're currently running a task, we'll need to delay this invocation.
23574 if (currentlyRunningATask) {
23575 // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
23576 // "too much recursion" error.
23577 setTimeout(runIfPresent, 0, handle);
23578 } else {
23579 var task = tasksByHandle[handle];
23580 if (task) {
23581 currentlyRunningATask = true;
23582 try {
23583 run(task);
23584 } finally {
23585 clearImmediate(handle);
23586 currentlyRunningATask = false;
23587 }
23588 }
23589 }
23590 }
23591
23592 function installNextTickImplementation() {
23593 registerImmediate = function(handle) {
23594 process.nextTick(function () { runIfPresent(handle); });
23595 };
23596 }
23597
23598 function canUsePostMessage() {
23599 // The test against `importScripts` prevents this implementation from being installed inside a web worker,
23600 // where `global.postMessage` means something completely different and can't be used for this purpose.
23601 if (global.postMessage && !global.importScripts) {
23602 var postMessageIsAsynchronous = true;
23603 var oldOnMessage = global.onmessage;
23604 global.onmessage = function() {
23605 postMessageIsAsynchronous = false;
23606 };
23607 global.postMessage("", "*");
23608 global.onmessage = oldOnMessage;
23609 return postMessageIsAsynchronous;
23610 }
23611 }
23612
23613 function installPostMessageImplementation() {
23614 // Installs an event handler on `global` for the `message` event: see
23615 // * https://developer.mozilla.org/en/DOM/window.postMessage
23616 // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
23617
23618 var messagePrefix = "setImmediate$" + Math.random() + "$";
23619 var onGlobalMessage = function(event) {
23620 if (event.source === global &&
23621 typeof event.data === "string" &&
23622 event.data.indexOf(messagePrefix) === 0) {
23623 runIfPresent(+event.data.slice(messagePrefix.length));
23624 }
23625 };
23626
23627 if (global.addEventListener) {
23628 global.addEventListener("message", onGlobalMessage, false);
23629 } else {
23630 global.attachEvent("onmessage", onGlobalMessage);
23631 }
23632
23633 registerImmediate = function(handle) {
23634 global.postMessage(messagePrefix + handle, "*");
23635 };
23636 }
23637
23638 function installMessageChannelImplementation() {
23639 var channel = new MessageChannel();
23640 channel.port1.onmessage = function(event) {
23641 var handle = event.data;
23642 runIfPresent(handle);
23643 };
23644
23645 registerImmediate = function(handle) {
23646 channel.port2.postMessage(handle);
23647 };
23648 }
23649
23650 function installReadyStateChangeImplementation() {
23651 var html = doc.documentElement;
23652 registerImmediate = function(handle) {
23653 // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
23654 // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
23655 var script = doc.createElement("script");
23656 script.onreadystatechange = function () {
23657 runIfPresent(handle);
23658 script.onreadystatechange = null;
23659 html.removeChild(script);
23660 script = null;
23661 };
23662 html.appendChild(script);
23663 };
23664 }
23665
23666 function installSetTimeoutImplementation() {
23667 registerImmediate = function(handle) {
23668 setTimeout(runIfPresent, 0, handle);
23669 };
23670 }
23671
23672 // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
23673 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
23674 attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
23675
23676 // Don't get fooled by e.g. browserify environments.
23677 if ({}.toString.call(global.process) === "[object process]") {
23678 // For Node.js before 0.9
23679 installNextTickImplementation();
23680
23681 } else if (canUsePostMessage()) {
23682 // For non-IE10 modern browsers
23683 installPostMessageImplementation();
23684
23685 } else if (global.MessageChannel) {
23686 // For web workers, where supported
23687 installMessageChannelImplementation();
23688
23689 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
23690 // For IE 6–8
23691 installReadyStateChangeImplementation();
23692
23693 } else {
23694 // For older browsers
23695 installSetTimeoutImplementation();
23696 }
23697
23698 attachTo.setImmediate = setImmediate;
23699 attachTo.clearImmediate = clearImmediate;
23700}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
23701
23702/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(123), __webpack_require__(29)))
23703
23704/***/ }),
23705/* 351 */
23706/***/ (function(module, exports, __webpack_require__) {
23707
23708var apply = Function.prototype.apply;
23709
23710// DOM APIs, for completeness
23711
23712exports.setTimeout = function() {
23713 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
23714};
23715exports.setInterval = function() {
23716 return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
23717};
23718exports.clearTimeout =
23719exports.clearInterval = function(timeout) {
23720 if (timeout) {
23721 timeout.close();
23722 }
23723};
23724
23725function Timeout(id, clearFn) {
23726 this._id = id;
23727 this._clearFn = clearFn;
23728}
23729Timeout.prototype.unref = Timeout.prototype.ref = function() {};
23730Timeout.prototype.close = function() {
23731 this._clearFn.call(window, this._id);
23732};
23733
23734// Does not start the time, just sets up the members needed.
23735exports.enroll = function(item, msecs) {
23736 clearTimeout(item._idleTimeoutId);
23737 item._idleTimeout = msecs;
23738};
23739
23740exports.unenroll = function(item) {
23741 clearTimeout(item._idleTimeoutId);
23742 item._idleTimeout = -1;
23743};
23744
23745exports._unrefActive = exports.active = function(item) {
23746 clearTimeout(item._idleTimeoutId);
23747
23748 var msecs = item._idleTimeout;
23749 if (msecs >= 0) {
23750 item._idleTimeoutId = setTimeout(function onTimeout() {
23751 if (item._onTimeout)
23752 item._onTimeout();
23753 }, msecs);
23754 }
23755};
23756
23757// setimmediate attaches itself to the global object
23758__webpack_require__(350);
23759exports.setImmediate = setImmediate;
23760exports.clearImmediate = clearImmediate;
23761
23762
23763/***/ }),
23764/* 352 */
23765/***/ (function(module, exports, __webpack_require__) {
23766
23767module.exports = __webpack_require__;
23768
23769/***/ })
23770/******/ ]);
23771//# sourceMappingURL=vendor.dll.js.map
\No newline at end of file