main.js (291307B)
1 /******/ (function(modules) { // webpackBootstrap 2 /******/ // The module cache 3 /******/ var installedModules = {}; 4 /******/ 5 /******/ // The require function 6 /******/ function __webpack_require__(moduleId) { 7 /******/ 8 /******/ // Check if module is in cache 9 /******/ if(installedModules[moduleId]) { 10 /******/ return installedModules[moduleId].exports; 11 /******/ } 12 /******/ // Create a new module (and put it into the cache) 13 /******/ var module = installedModules[moduleId] = { 14 /******/ i: moduleId, 15 /******/ l: false, 16 /******/ exports: {} 17 /******/ }; 18 /******/ 19 /******/ // Execute the module function 20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 /******/ 22 /******/ // Flag the module as loaded 23 /******/ module.l = true; 24 /******/ 25 /******/ // Return the exports of the module 26 /******/ return module.exports; 27 /******/ } 28 /******/ 29 /******/ 30 /******/ // expose the modules object (__webpack_modules__) 31 /******/ __webpack_require__.m = modules; 32 /******/ 33 /******/ // expose the module cache 34 /******/ __webpack_require__.c = installedModules; 35 /******/ 36 /******/ // define getter function for harmony exports 37 /******/ __webpack_require__.d = function(exports, name, getter) { 38 /******/ if(!__webpack_require__.o(exports, name)) { 39 /******/ Object.defineProperty(exports, name, { 40 /******/ configurable: false, 41 /******/ enumerable: true, 42 /******/ get: getter 43 /******/ }); 44 /******/ } 45 /******/ }; 46 /******/ 47 /******/ // getDefaultExport function for compatibility with non-harmony modules 48 /******/ __webpack_require__.n = function(module) { 49 /******/ var getter = module && module.__esModule ? 50 /******/ function getDefault() { return module['default']; } : 51 /******/ function getModuleExports() { return module; }; 52 /******/ __webpack_require__.d(getter, 'a', getter); 53 /******/ return getter; 54 /******/ }; 55 /******/ 56 /******/ // Object.prototype.hasOwnProperty.call 57 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 /******/ 59 /******/ // __webpack_public_path__ 60 /******/ __webpack_require__.p = "/"; 61 /******/ 62 /******/ // Load entry module and return exports 63 /******/ return __webpack_require__(__webpack_require__.s = 3); 64 /******/ }) 65 /************************************************************************/ 66 /******/ ([ 67 /* 0 */ 68 /***/ (function(module, exports, __webpack_require__) { 69 70 "use strict"; 71 /* 72 object-assign 73 (c) Sindre Sorhus 74 @license MIT 75 */ 76 77 78 /* eslint-disable no-unused-vars */ 79 var getOwnPropertySymbols = Object.getOwnPropertySymbols; 80 var hasOwnProperty = Object.prototype.hasOwnProperty; 81 var propIsEnumerable = Object.prototype.propertyIsEnumerable; 82 83 function toObject(val) { 84 if (val === null || val === undefined) { 85 throw new TypeError('Object.assign cannot be called with null or undefined'); 86 } 87 88 return Object(val); 89 } 90 91 function shouldUseNative() { 92 try { 93 if (!Object.assign) { 94 return false; 95 } 96 97 // Detect buggy property enumeration order in older V8 versions. 98 99 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 100 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 101 test1[5] = 'de'; 102 if (Object.getOwnPropertyNames(test1)[0] === '5') { 103 return false; 104 } 105 106 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 107 var test2 = {}; 108 for (var i = 0; i < 10; i++) { 109 test2['_' + String.fromCharCode(i)] = i; 110 } 111 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 112 return test2[n]; 113 }); 114 if (order2.join('') !== '0123456789') { 115 return false; 116 } 117 118 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 119 var test3 = {}; 120 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 121 test3[letter] = letter; 122 }); 123 if (Object.keys(Object.assign({}, test3)).join('') !== 124 'abcdefghijklmnopqrst') { 125 return false; 126 } 127 128 return true; 129 } catch (err) { 130 // We don't expect any of the above to throw, but better to be safe. 131 return false; 132 } 133 } 134 135 module.exports = shouldUseNative() ? Object.assign : function (target, source) { 136 var from; 137 var to = toObject(target); 138 var symbols; 139 140 for (var s = 1; s < arguments.length; s++) { 141 from = Object(arguments[s]); 142 143 for (var key in from) { 144 if (hasOwnProperty.call(from, key)) { 145 to[key] = from[key]; 146 } 147 } 148 149 if (getOwnPropertySymbols) { 150 symbols = getOwnPropertySymbols(from); 151 for (var i = 0; i < symbols.length; i++) { 152 if (propIsEnumerable.call(from, symbols[i])) { 153 to[symbols[i]] = from[symbols[i]]; 154 } 155 } 156 } 157 } 158 159 return to; 160 }; 161 162 163 /***/ }), 164 /* 1 */ 165 /***/ (function(module, exports, __webpack_require__) { 166 167 "use strict"; 168 169 170 if (true) { 171 module.exports = __webpack_require__(11); 172 } else { 173 module.exports = require('./cjs/react.development.js'); 174 } 175 176 177 /***/ }), 178 /* 2 */ 179 /***/ (function(module, exports, __webpack_require__) { 180 181 "use strict"; 182 183 184 var asap = __webpack_require__(6); 185 186 function noop() {} 187 188 // States: 189 // 190 // 0 - pending 191 // 1 - fulfilled with _value 192 // 2 - rejected with _value 193 // 3 - adopted the state of another promise, _value 194 // 195 // once the state is no longer pending (0) it is immutable 196 197 // All `_` prefixed properties will be reduced to `_{random number}` 198 // at build time to obfuscate them and discourage their use. 199 // We don't use symbols or Object.defineProperty to fully hide them 200 // because the performance isn't good enough. 201 202 203 // to avoid using try/catch inside critical functions, we 204 // extract them to here. 205 var LAST_ERROR = null; 206 var IS_ERROR = {}; 207 function getThen(obj) { 208 try { 209 return obj.then; 210 } catch (ex) { 211 LAST_ERROR = ex; 212 return IS_ERROR; 213 } 214 } 215 216 function tryCallOne(fn, a) { 217 try { 218 return fn(a); 219 } catch (ex) { 220 LAST_ERROR = ex; 221 return IS_ERROR; 222 } 223 } 224 function tryCallTwo(fn, a, b) { 225 try { 226 fn(a, b); 227 } catch (ex) { 228 LAST_ERROR = ex; 229 return IS_ERROR; 230 } 231 } 232 233 module.exports = Promise; 234 235 function Promise(fn) { 236 if (typeof this !== 'object') { 237 throw new TypeError('Promises must be constructed via new'); 238 } 239 if (typeof fn !== 'function') { 240 throw new TypeError('Promise constructor\'s argument is not a function'); 241 } 242 this._75 = 0; 243 this._83 = 0; 244 this._18 = null; 245 this._38 = null; 246 if (fn === noop) return; 247 doResolve(fn, this); 248 } 249 Promise._47 = null; 250 Promise._71 = null; 251 Promise._44 = noop; 252 253 Promise.prototype.then = function(onFulfilled, onRejected) { 254 if (this.constructor !== Promise) { 255 return safeThen(this, onFulfilled, onRejected); 256 } 257 var res = new Promise(noop); 258 handle(this, new Handler(onFulfilled, onRejected, res)); 259 return res; 260 }; 261 262 function safeThen(self, onFulfilled, onRejected) { 263 return new self.constructor(function (resolve, reject) { 264 var res = new Promise(noop); 265 res.then(resolve, reject); 266 handle(self, new Handler(onFulfilled, onRejected, res)); 267 }); 268 } 269 function handle(self, deferred) { 270 while (self._83 === 3) { 271 self = self._18; 272 } 273 if (Promise._47) { 274 Promise._47(self); 275 } 276 if (self._83 === 0) { 277 if (self._75 === 0) { 278 self._75 = 1; 279 self._38 = deferred; 280 return; 281 } 282 if (self._75 === 1) { 283 self._75 = 2; 284 self._38 = [self._38, deferred]; 285 return; 286 } 287 self._38.push(deferred); 288 return; 289 } 290 handleResolved(self, deferred); 291 } 292 293 function handleResolved(self, deferred) { 294 asap(function() { 295 var cb = self._83 === 1 ? deferred.onFulfilled : deferred.onRejected; 296 if (cb === null) { 297 if (self._83 === 1) { 298 resolve(deferred.promise, self._18); 299 } else { 300 reject(deferred.promise, self._18); 301 } 302 return; 303 } 304 var ret = tryCallOne(cb, self._18); 305 if (ret === IS_ERROR) { 306 reject(deferred.promise, LAST_ERROR); 307 } else { 308 resolve(deferred.promise, ret); 309 } 310 }); 311 } 312 function resolve(self, newValue) { 313 // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure 314 if (newValue === self) { 315 return reject( 316 self, 317 new TypeError('A promise cannot be resolved with itself.') 318 ); 319 } 320 if ( 321 newValue && 322 (typeof newValue === 'object' || typeof newValue === 'function') 323 ) { 324 var then = getThen(newValue); 325 if (then === IS_ERROR) { 326 return reject(self, LAST_ERROR); 327 } 328 if ( 329 then === self.then && 330 newValue instanceof Promise 331 ) { 332 self._83 = 3; 333 self._18 = newValue; 334 finale(self); 335 return; 336 } else if (typeof then === 'function') { 337 doResolve(then.bind(newValue), self); 338 return; 339 } 340 } 341 self._83 = 1; 342 self._18 = newValue; 343 finale(self); 344 } 345 346 function reject(self, newValue) { 347 self._83 = 2; 348 self._18 = newValue; 349 if (Promise._71) { 350 Promise._71(self, newValue); 351 } 352 finale(self); 353 } 354 function finale(self) { 355 if (self._75 === 1) { 356 handle(self, self._38); 357 self._38 = null; 358 } 359 if (self._75 === 2) { 360 for (var i = 0; i < self._38.length; i++) { 361 handle(self, self._38[i]); 362 } 363 self._38 = null; 364 } 365 } 366 367 function Handler(onFulfilled, onRejected, promise){ 368 this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; 369 this.onRejected = typeof onRejected === 'function' ? onRejected : null; 370 this.promise = promise; 371 } 372 373 /** 374 * Take a potentially misbehaving resolver function and make sure 375 * onFulfilled and onRejected are only called once. 376 * 377 * Makes no guarantees about asynchrony. 378 */ 379 function doResolve(fn, promise) { 380 var done = false; 381 var res = tryCallTwo(fn, function (value) { 382 if (done) return; 383 done = true; 384 resolve(promise, value); 385 }, function (reason) { 386 if (done) return; 387 done = true; 388 reject(promise, reason); 389 }); 390 if (!done && res === IS_ERROR) { 391 done = true; 392 reject(promise, LAST_ERROR); 393 } 394 } 395 396 397 /***/ }), 398 /* 3 */ 399 /***/ (function(module, exports, __webpack_require__) { 400 401 __webpack_require__(4); 402 module.exports = __webpack_require__(10); 403 404 405 /***/ }), 406 /* 4 */ 407 /***/ (function(module, exports, __webpack_require__) { 408 409 "use strict"; 410 // @remove-on-eject-begin 411 /** 412 * Copyright (c) 2015-present, Facebook, Inc. 413 * 414 * This source code is licensed under the MIT license found in the 415 * LICENSE file in the root directory of this source tree. 416 */ 417 // @remove-on-eject-end 418 419 420 if (typeof Promise === 'undefined') { 421 // Rejection tracking prevents a common issue where React gets into an 422 // inconsistent state due to an error, but it gets swallowed by a Promise, 423 // and the user has no idea what causes React's erratic future behavior. 424 __webpack_require__(5).enable(); 425 window.Promise = __webpack_require__(8); 426 } 427 428 // fetch() polyfill for making API calls. 429 __webpack_require__(9); 430 431 // Object.assign() is commonly used with React. 432 // It will use the native implementation if it's present and isn't buggy. 433 Object.assign = __webpack_require__(0); 434 435 // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. 436 // We don't polyfill it in the browser--this is user's responsibility. 437 if (false) { 438 require('raf').polyfill(global); 439 } 440 441 442 /***/ }), 443 /* 5 */ 444 /***/ (function(module, exports, __webpack_require__) { 445 446 "use strict"; 447 448 449 var Promise = __webpack_require__(2); 450 451 var DEFAULT_WHITELIST = [ 452 ReferenceError, 453 TypeError, 454 RangeError 455 ]; 456 457 var enabled = false; 458 exports.disable = disable; 459 function disable() { 460 enabled = false; 461 Promise._47 = null; 462 Promise._71 = null; 463 } 464 465 exports.enable = enable; 466 function enable(options) { 467 options = options || {}; 468 if (enabled) disable(); 469 enabled = true; 470 var id = 0; 471 var displayId = 0; 472 var rejections = {}; 473 Promise._47 = function (promise) { 474 if ( 475 promise._83 === 2 && // IS REJECTED 476 rejections[promise._56] 477 ) { 478 if (rejections[promise._56].logged) { 479 onHandled(promise._56); 480 } else { 481 clearTimeout(rejections[promise._56].timeout); 482 } 483 delete rejections[promise._56]; 484 } 485 }; 486 Promise._71 = function (promise, err) { 487 if (promise._75 === 0) { // not yet handled 488 promise._56 = id++; 489 rejections[promise._56] = { 490 displayId: null, 491 error: err, 492 timeout: setTimeout( 493 onUnhandled.bind(null, promise._56), 494 // For reference errors and type errors, this almost always 495 // means the programmer made a mistake, so log them after just 496 // 100ms 497 // otherwise, wait 2 seconds to see if they get handled 498 matchWhitelist(err, DEFAULT_WHITELIST) 499 ? 100 500 : 2000 501 ), 502 logged: false 503 }; 504 } 505 }; 506 function onUnhandled(id) { 507 if ( 508 options.allRejections || 509 matchWhitelist( 510 rejections[id].error, 511 options.whitelist || DEFAULT_WHITELIST 512 ) 513 ) { 514 rejections[id].displayId = displayId++; 515 if (options.onUnhandled) { 516 rejections[id].logged = true; 517 options.onUnhandled( 518 rejections[id].displayId, 519 rejections[id].error 520 ); 521 } else { 522 rejections[id].logged = true; 523 logError( 524 rejections[id].displayId, 525 rejections[id].error 526 ); 527 } 528 } 529 } 530 function onHandled(id) { 531 if (rejections[id].logged) { 532 if (options.onHandled) { 533 options.onHandled(rejections[id].displayId, rejections[id].error); 534 } else if (!rejections[id].onUnhandled) { 535 console.warn( 536 'Promise Rejection Handled (id: ' + rejections[id].displayId + '):' 537 ); 538 console.warn( 539 ' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id ' + 540 rejections[id].displayId + '.' 541 ); 542 } 543 } 544 } 545 } 546 547 function logError(id, error) { 548 console.warn('Possible Unhandled Promise Rejection (id: ' + id + '):'); 549 var errStr = (error && (error.stack || error)) + ''; 550 errStr.split('\n').forEach(function (line) { 551 console.warn(' ' + line); 552 }); 553 } 554 555 function matchWhitelist(error, list) { 556 return list.some(function (cls) { 557 return error instanceof cls; 558 }); 559 } 560 561 /***/ }), 562 /* 6 */ 563 /***/ (function(module, exports, __webpack_require__) { 564 565 "use strict"; 566 /* WEBPACK VAR INJECTION */(function(global) { 567 568 // Use the fastest means possible to execute a task in its own turn, with 569 // priority over other events including IO, animation, reflow, and redraw 570 // events in browsers. 571 // 572 // An exception thrown by a task will permanently interrupt the processing of 573 // subsequent tasks. The higher level `asap` function ensures that if an 574 // exception is thrown by a task, that the task queue will continue flushing as 575 // soon as possible, but if you use `rawAsap` directly, you are responsible to 576 // either ensure that no exceptions are thrown from your task, or to manually 577 // call `rawAsap.requestFlush` if an exception is thrown. 578 module.exports = rawAsap; 579 function rawAsap(task) { 580 if (!queue.length) { 581 requestFlush(); 582 flushing = true; 583 } 584 // Equivalent to push, but avoids a function call. 585 queue[queue.length] = task; 586 } 587 588 var queue = []; 589 // Once a flush has been requested, no further calls to `requestFlush` are 590 // necessary until the next `flush` completes. 591 var flushing = false; 592 // `requestFlush` is an implementation-specific method that attempts to kick 593 // off a `flush` event as quickly as possible. `flush` will attempt to exhaust 594 // the event queue before yielding to the browser's own event loop. 595 var requestFlush; 596 // The position of the next task to execute in the task queue. This is 597 // preserved between calls to `flush` so that it can be resumed if 598 // a task throws an exception. 599 var index = 0; 600 // If a task schedules additional tasks recursively, the task queue can grow 601 // unbounded. To prevent memory exhaustion, the task queue will periodically 602 // truncate already-completed tasks. 603 var capacity = 1024; 604 605 // The flush function processes all tasks that have been scheduled with 606 // `rawAsap` unless and until one of those tasks throws an exception. 607 // If a task throws an exception, `flush` ensures that its state will remain 608 // consistent and will resume where it left off when called again. 609 // However, `flush` does not make any arrangements to be called again if an 610 // exception is thrown. 611 function flush() { 612 while (index < queue.length) { 613 var currentIndex = index; 614 // Advance the index before calling the task. This ensures that we will 615 // begin flushing on the next task the task throws an error. 616 index = index + 1; 617 queue[currentIndex].call(); 618 // Prevent leaking memory for long chains of recursive calls to `asap`. 619 // If we call `asap` within tasks scheduled by `asap`, the queue will 620 // grow, but to avoid an O(n) walk for every task we execute, we don't 621 // shift tasks off the queue after they have been executed. 622 // Instead, we periodically shift 1024 tasks off the queue. 623 if (index > capacity) { 624 // Manually shift all values starting at the index back to the 625 // beginning of the queue. 626 for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) { 627 queue[scan] = queue[scan + index]; 628 } 629 queue.length -= index; 630 index = 0; 631 } 632 } 633 queue.length = 0; 634 index = 0; 635 flushing = false; 636 } 637 638 // `requestFlush` is implemented using a strategy based on data collected from 639 // every available SauceLabs Selenium web driver worker at time of writing. 640 // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 641 642 // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that 643 // have WebKitMutationObserver but not un-prefixed MutationObserver. 644 // Must use `global` or `self` instead of `window` to work in both frames and web 645 // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. 646 647 /* globals self */ 648 var scope = typeof global !== "undefined" ? global : self; 649 var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; 650 651 // MutationObservers are desirable because they have high priority and work 652 // reliably everywhere they are implemented. 653 // They are implemented in all modern browsers. 654 // 655 // - Android 4-4.3 656 // - Chrome 26-34 657 // - Firefox 14-29 658 // - Internet Explorer 11 659 // - iPad Safari 6-7.1 660 // - iPhone Safari 7-7.1 661 // - Safari 6-7 662 if (typeof BrowserMutationObserver === "function") { 663 requestFlush = makeRequestCallFromMutationObserver(flush); 664 665 // MessageChannels are desirable because they give direct access to the HTML 666 // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera 667 // 11-12, and in web workers in many engines. 668 // Although message channels yield to any queued rendering and IO tasks, they 669 // would be better than imposing the 4ms delay of timers. 670 // However, they do not work reliably in Internet Explorer or Safari. 671 672 // Internet Explorer 10 is the only browser that has setImmediate but does 673 // not have MutationObservers. 674 // Although setImmediate yields to the browser's renderer, it would be 675 // preferrable to falling back to setTimeout since it does not have 676 // the minimum 4ms penalty. 677 // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and 678 // Desktop to a lesser extent) that renders both setImmediate and 679 // MessageChannel useless for the purposes of ASAP. 680 // https://github.com/kriskowal/q/issues/396 681 682 // Timers are implemented universally. 683 // We fall back to timers in workers in most engines, and in foreground 684 // contexts in the following browsers. 685 // However, note that even this simple case requires nuances to operate in a 686 // broad spectrum of browsers. 687 // 688 // - Firefox 3-13 689 // - Internet Explorer 6-9 690 // - iPad Safari 4.3 691 // - Lynx 2.8.7 692 } else { 693 requestFlush = makeRequestCallFromTimer(flush); 694 } 695 696 // `requestFlush` requests that the high priority event queue be flushed as 697 // soon as possible. 698 // This is useful to prevent an error thrown in a task from stalling the event 699 // queue if the exception handled by Node.js’s 700 // `process.on("uncaughtException")` or by a domain. 701 rawAsap.requestFlush = requestFlush; 702 703 // To request a high priority event, we induce a mutation observer by toggling 704 // the text of a text node between "1" and "-1". 705 function makeRequestCallFromMutationObserver(callback) { 706 var toggle = 1; 707 var observer = new BrowserMutationObserver(callback); 708 var node = document.createTextNode(""); 709 observer.observe(node, {characterData: true}); 710 return function requestCall() { 711 toggle = -toggle; 712 node.data = toggle; 713 }; 714 } 715 716 // The message channel technique was discovered by Malte Ubl and was the 717 // original foundation for this library. 718 // http://www.nonblocking.io/2011/06/windownexttick.html 719 720 // Safari 6.0.5 (at least) intermittently fails to create message ports on a 721 // page's first load. Thankfully, this version of Safari supports 722 // MutationObservers, so we don't need to fall back in that case. 723 724 // function makeRequestCallFromMessageChannel(callback) { 725 // var channel = new MessageChannel(); 726 // channel.port1.onmessage = callback; 727 // return function requestCall() { 728 // channel.port2.postMessage(0); 729 // }; 730 // } 731 732 // For reasons explained above, we are also unable to use `setImmediate` 733 // under any circumstances. 734 // Even if we were, there is another bug in Internet Explorer 10. 735 // It is not sufficient to assign `setImmediate` to `requestFlush` because 736 // `setImmediate` must be called *by name* and therefore must be wrapped in a 737 // closure. 738 // Never forget. 739 740 // function makeRequestCallFromSetImmediate(callback) { 741 // return function requestCall() { 742 // setImmediate(callback); 743 // }; 744 // } 745 746 // Safari 6.0 has a problem where timers will get lost while the user is 747 // scrolling. This problem does not impact ASAP because Safari 6.0 supports 748 // mutation observers, so that implementation is used instead. 749 // However, if we ever elect to use timers in Safari, the prevalent work-around 750 // is to add a scroll event listener that calls for a flush. 751 752 // `setTimeout` does not call the passed callback if the delay is less than 753 // approximately 7 in web workers in Firefox 8 through 18, and sometimes not 754 // even then. 755 756 function makeRequestCallFromTimer(callback) { 757 return function requestCall() { 758 // We dispatch a timeout with a specified delay of 0 for engines that 759 // can reliably accommodate that request. This will usually be snapped 760 // to a 4 milisecond delay, but once we're flushing, there's no delay 761 // between events. 762 var timeoutHandle = setTimeout(handleTimer, 0); 763 // However, since this timer gets frequently dropped in Firefox 764 // workers, we enlist an interval handle that will try to fire 765 // an event 20 times per second until it succeeds. 766 var intervalHandle = setInterval(handleTimer, 50); 767 768 function handleTimer() { 769 // Whichever timer succeeds will cancel both timers and 770 // execute the callback. 771 clearTimeout(timeoutHandle); 772 clearInterval(intervalHandle); 773 callback(); 774 } 775 }; 776 } 777 778 // This is for `asap.js` only. 779 // Its name will be periodically randomized to break any code that depends on 780 // its existence. 781 rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; 782 783 // ASAP was originally a nextTick shim included in Q. This was factored out 784 // into this ASAP package. It was later adapted to RSVP which made further 785 // amendments. These decisions, particularly to marginalize MessageChannel and 786 // to capture the MutationObserver implementation in a closure, were integrated 787 // back into ASAP proper. 788 // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js 789 790 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) 791 792 /***/ }), 793 /* 7 */ 794 /***/ (function(module, exports) { 795 796 var g; 797 798 // This works in non-strict mode 799 g = (function() { 800 return this; 801 })(); 802 803 try { 804 // This works if eval is allowed (see CSP) 805 g = g || Function("return this")() || (1,eval)("this"); 806 } catch(e) { 807 // This works if the window reference is available 808 if(typeof window === "object") 809 g = window; 810 } 811 812 // g can still be undefined, but nothing to do about it... 813 // We return undefined, instead of nothing here, so it's 814 // easier to handle this case. if(!global) { ...} 815 816 module.exports = g; 817 818 819 /***/ }), 820 /* 8 */ 821 /***/ (function(module, exports, __webpack_require__) { 822 823 "use strict"; 824 825 826 //This file contains the ES6 extensions to the core Promises/A+ API 827 828 var Promise = __webpack_require__(2); 829 830 module.exports = Promise; 831 832 /* Static Functions */ 833 834 var TRUE = valuePromise(true); 835 var FALSE = valuePromise(false); 836 var NULL = valuePromise(null); 837 var UNDEFINED = valuePromise(undefined); 838 var ZERO = valuePromise(0); 839 var EMPTYSTRING = valuePromise(''); 840 841 function valuePromise(value) { 842 var p = new Promise(Promise._44); 843 p._83 = 1; 844 p._18 = value; 845 return p; 846 } 847 Promise.resolve = function (value) { 848 if (value instanceof Promise) return value; 849 850 if (value === null) return NULL; 851 if (value === undefined) return UNDEFINED; 852 if (value === true) return TRUE; 853 if (value === false) return FALSE; 854 if (value === 0) return ZERO; 855 if (value === '') return EMPTYSTRING; 856 857 if (typeof value === 'object' || typeof value === 'function') { 858 try { 859 var then = value.then; 860 if (typeof then === 'function') { 861 return new Promise(then.bind(value)); 862 } 863 } catch (ex) { 864 return new Promise(function (resolve, reject) { 865 reject(ex); 866 }); 867 } 868 } 869 return valuePromise(value); 870 }; 871 872 Promise.all = function (arr) { 873 var args = Array.prototype.slice.call(arr); 874 875 return new Promise(function (resolve, reject) { 876 if (args.length === 0) return resolve([]); 877 var remaining = args.length; 878 function res(i, val) { 879 if (val && (typeof val === 'object' || typeof val === 'function')) { 880 if (val instanceof Promise && val.then === Promise.prototype.then) { 881 while (val._83 === 3) { 882 val = val._18; 883 } 884 if (val._83 === 1) return res(i, val._18); 885 if (val._83 === 2) reject(val._18); 886 val.then(function (val) { 887 res(i, val); 888 }, reject); 889 return; 890 } else { 891 var then = val.then; 892 if (typeof then === 'function') { 893 var p = new Promise(then.bind(val)); 894 p.then(function (val) { 895 res(i, val); 896 }, reject); 897 return; 898 } 899 } 900 } 901 args[i] = val; 902 if (--remaining === 0) { 903 resolve(args); 904 } 905 } 906 for (var i = 0; i < args.length; i++) { 907 res(i, args[i]); 908 } 909 }); 910 }; 911 912 Promise.reject = function (value) { 913 return new Promise(function (resolve, reject) { 914 reject(value); 915 }); 916 }; 917 918 Promise.race = function (values) { 919 return new Promise(function (resolve, reject) { 920 values.forEach(function(value){ 921 Promise.resolve(value).then(resolve, reject); 922 }); 923 }); 924 }; 925 926 /* Prototype Methods */ 927 928 Promise.prototype['catch'] = function (onRejected) { 929 return this.then(null, onRejected); 930 }; 931 932 933 /***/ }), 934 /* 9 */ 935 /***/ (function(module, exports) { 936 937 (function(self) { 938 'use strict'; 939 940 if (self.fetch) { 941 return 942 } 943 944 var support = { 945 searchParams: 'URLSearchParams' in self, 946 iterable: 'Symbol' in self && 'iterator' in Symbol, 947 blob: 'FileReader' in self && 'Blob' in self && (function() { 948 try { 949 new Blob() 950 return true 951 } catch(e) { 952 return false 953 } 954 })(), 955 formData: 'FormData' in self, 956 arrayBuffer: 'ArrayBuffer' in self 957 } 958 959 if (support.arrayBuffer) { 960 var viewClasses = [ 961 '[object Int8Array]', 962 '[object Uint8Array]', 963 '[object Uint8ClampedArray]', 964 '[object Int16Array]', 965 '[object Uint16Array]', 966 '[object Int32Array]', 967 '[object Uint32Array]', 968 '[object Float32Array]', 969 '[object Float64Array]' 970 ] 971 972 var isDataView = function(obj) { 973 return obj && DataView.prototype.isPrototypeOf(obj) 974 } 975 976 var isArrayBufferView = ArrayBuffer.isView || function(obj) { 977 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 978 } 979 } 980 981 function normalizeName(name) { 982 if (typeof name !== 'string') { 983 name = String(name) 984 } 985 if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { 986 throw new TypeError('Invalid character in header field name') 987 } 988 return name.toLowerCase() 989 } 990 991 function normalizeValue(value) { 992 if (typeof value !== 'string') { 993 value = String(value) 994 } 995 return value 996 } 997 998 // Build a destructive iterator for the value list 999 function iteratorFor(items) { 1000 var iterator = { 1001 next: function() { 1002 var value = items.shift() 1003 return {done: value === undefined, value: value} 1004 } 1005 } 1006 1007 if (support.iterable) { 1008 iterator[Symbol.iterator] = function() { 1009 return iterator 1010 } 1011 } 1012 1013 return iterator 1014 } 1015 1016 function Headers(headers) { 1017 this.map = {} 1018 1019 if (headers instanceof Headers) { 1020 headers.forEach(function(value, name) { 1021 this.append(name, value) 1022 }, this) 1023 } else if (Array.isArray(headers)) { 1024 headers.forEach(function(header) { 1025 this.append(header[0], header[1]) 1026 }, this) 1027 } else if (headers) { 1028 Object.getOwnPropertyNames(headers).forEach(function(name) { 1029 this.append(name, headers[name]) 1030 }, this) 1031 } 1032 } 1033 1034 Headers.prototype.append = function(name, value) { 1035 name = normalizeName(name) 1036 value = normalizeValue(value) 1037 var oldValue = this.map[name] 1038 this.map[name] = oldValue ? oldValue+','+value : value 1039 } 1040 1041 Headers.prototype['delete'] = function(name) { 1042 delete this.map[normalizeName(name)] 1043 } 1044 1045 Headers.prototype.get = function(name) { 1046 name = normalizeName(name) 1047 return this.has(name) ? this.map[name] : null 1048 } 1049 1050 Headers.prototype.has = function(name) { 1051 return this.map.hasOwnProperty(normalizeName(name)) 1052 } 1053 1054 Headers.prototype.set = function(name, value) { 1055 this.map[normalizeName(name)] = normalizeValue(value) 1056 } 1057 1058 Headers.prototype.forEach = function(callback, thisArg) { 1059 for (var name in this.map) { 1060 if (this.map.hasOwnProperty(name)) { 1061 callback.call(thisArg, this.map[name], name, this) 1062 } 1063 } 1064 } 1065 1066 Headers.prototype.keys = function() { 1067 var items = [] 1068 this.forEach(function(value, name) { items.push(name) }) 1069 return iteratorFor(items) 1070 } 1071 1072 Headers.prototype.values = function() { 1073 var items = [] 1074 this.forEach(function(value) { items.push(value) }) 1075 return iteratorFor(items) 1076 } 1077 1078 Headers.prototype.entries = function() { 1079 var items = [] 1080 this.forEach(function(value, name) { items.push([name, value]) }) 1081 return iteratorFor(items) 1082 } 1083 1084 if (support.iterable) { 1085 Headers.prototype[Symbol.iterator] = Headers.prototype.entries 1086 } 1087 1088 function consumed(body) { 1089 if (body.bodyUsed) { 1090 return Promise.reject(new TypeError('Already read')) 1091 } 1092 body.bodyUsed = true 1093 } 1094 1095 function fileReaderReady(reader) { 1096 return new Promise(function(resolve, reject) { 1097 reader.onload = function() { 1098 resolve(reader.result) 1099 } 1100 reader.onerror = function() { 1101 reject(reader.error) 1102 } 1103 }) 1104 } 1105 1106 function readBlobAsArrayBuffer(blob) { 1107 var reader = new FileReader() 1108 var promise = fileReaderReady(reader) 1109 reader.readAsArrayBuffer(blob) 1110 return promise 1111 } 1112 1113 function readBlobAsText(blob) { 1114 var reader = new FileReader() 1115 var promise = fileReaderReady(reader) 1116 reader.readAsText(blob) 1117 return promise 1118 } 1119 1120 function readArrayBufferAsText(buf) { 1121 var view = new Uint8Array(buf) 1122 var chars = new Array(view.length) 1123 1124 for (var i = 0; i < view.length; i++) { 1125 chars[i] = String.fromCharCode(view[i]) 1126 } 1127 return chars.join('') 1128 } 1129 1130 function bufferClone(buf) { 1131 if (buf.slice) { 1132 return buf.slice(0) 1133 } else { 1134 var view = new Uint8Array(buf.byteLength) 1135 view.set(new Uint8Array(buf)) 1136 return view.buffer 1137 } 1138 } 1139 1140 function Body() { 1141 this.bodyUsed = false 1142 1143 this._initBody = function(body) { 1144 this._bodyInit = body 1145 if (!body) { 1146 this._bodyText = '' 1147 } else if (typeof body === 'string') { 1148 this._bodyText = body 1149 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { 1150 this._bodyBlob = body 1151 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { 1152 this._bodyFormData = body 1153 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 1154 this._bodyText = body.toString() 1155 } else if (support.arrayBuffer && support.blob && isDataView(body)) { 1156 this._bodyArrayBuffer = bufferClone(body.buffer) 1157 // IE 10-11 can't handle a DataView body. 1158 this._bodyInit = new Blob([this._bodyArrayBuffer]) 1159 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { 1160 this._bodyArrayBuffer = bufferClone(body) 1161 } else { 1162 throw new Error('unsupported BodyInit type') 1163 } 1164 1165 if (!this.headers.get('content-type')) { 1166 if (typeof body === 'string') { 1167 this.headers.set('content-type', 'text/plain;charset=UTF-8') 1168 } else if (this._bodyBlob && this._bodyBlob.type) { 1169 this.headers.set('content-type', this._bodyBlob.type) 1170 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 1171 this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') 1172 } 1173 } 1174 } 1175 1176 if (support.blob) { 1177 this.blob = function() { 1178 var rejected = consumed(this) 1179 if (rejected) { 1180 return rejected 1181 } 1182 1183 if (this._bodyBlob) { 1184 return Promise.resolve(this._bodyBlob) 1185 } else if (this._bodyArrayBuffer) { 1186 return Promise.resolve(new Blob([this._bodyArrayBuffer])) 1187 } else if (this._bodyFormData) { 1188 throw new Error('could not read FormData body as blob') 1189 } else { 1190 return Promise.resolve(new Blob([this._bodyText])) 1191 } 1192 } 1193 1194 this.arrayBuffer = function() { 1195 if (this._bodyArrayBuffer) { 1196 return consumed(this) || Promise.resolve(this._bodyArrayBuffer) 1197 } else { 1198 return this.blob().then(readBlobAsArrayBuffer) 1199 } 1200 } 1201 } 1202 1203 this.text = function() { 1204 var rejected = consumed(this) 1205 if (rejected) { 1206 return rejected 1207 } 1208 1209 if (this._bodyBlob) { 1210 return readBlobAsText(this._bodyBlob) 1211 } else if (this._bodyArrayBuffer) { 1212 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) 1213 } else if (this._bodyFormData) { 1214 throw new Error('could not read FormData body as text') 1215 } else { 1216 return Promise.resolve(this._bodyText) 1217 } 1218 } 1219 1220 if (support.formData) { 1221 this.formData = function() { 1222 return this.text().then(decode) 1223 } 1224 } 1225 1226 this.json = function() { 1227 return this.text().then(JSON.parse) 1228 } 1229 1230 return this 1231 } 1232 1233 // HTTP methods whose capitalization should be normalized 1234 var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] 1235 1236 function normalizeMethod(method) { 1237 var upcased = method.toUpperCase() 1238 return (methods.indexOf(upcased) > -1) ? upcased : method 1239 } 1240 1241 function Request(input, options) { 1242 options = options || {} 1243 var body = options.body 1244 1245 if (input instanceof Request) { 1246 if (input.bodyUsed) { 1247 throw new TypeError('Already read') 1248 } 1249 this.url = input.url 1250 this.credentials = input.credentials 1251 if (!options.headers) { 1252 this.headers = new Headers(input.headers) 1253 } 1254 this.method = input.method 1255 this.mode = input.mode 1256 if (!body && input._bodyInit != null) { 1257 body = input._bodyInit 1258 input.bodyUsed = true 1259 } 1260 } else { 1261 this.url = String(input) 1262 } 1263 1264 this.credentials = options.credentials || this.credentials || 'omit' 1265 if (options.headers || !this.headers) { 1266 this.headers = new Headers(options.headers) 1267 } 1268 this.method = normalizeMethod(options.method || this.method || 'GET') 1269 this.mode = options.mode || this.mode || null 1270 this.referrer = null 1271 1272 if ((this.method === 'GET' || this.method === 'HEAD') && body) { 1273 throw new TypeError('Body not allowed for GET or HEAD requests') 1274 } 1275 this._initBody(body) 1276 } 1277 1278 Request.prototype.clone = function() { 1279 return new Request(this, { body: this._bodyInit }) 1280 } 1281 1282 function decode(body) { 1283 var form = new FormData() 1284 body.trim().split('&').forEach(function(bytes) { 1285 if (bytes) { 1286 var split = bytes.split('=') 1287 var name = split.shift().replace(/\+/g, ' ') 1288 var value = split.join('=').replace(/\+/g, ' ') 1289 form.append(decodeURIComponent(name), decodeURIComponent(value)) 1290 } 1291 }) 1292 return form 1293 } 1294 1295 function parseHeaders(rawHeaders) { 1296 var headers = new Headers() 1297 rawHeaders.split(/\r?\n/).forEach(function(line) { 1298 var parts = line.split(':') 1299 var key = parts.shift().trim() 1300 if (key) { 1301 var value = parts.join(':').trim() 1302 headers.append(key, value) 1303 } 1304 }) 1305 return headers 1306 } 1307 1308 Body.call(Request.prototype) 1309 1310 function Response(bodyInit, options) { 1311 if (!options) { 1312 options = {} 1313 } 1314 1315 this.type = 'default' 1316 this.status = 'status' in options ? options.status : 200 1317 this.ok = this.status >= 200 && this.status < 300 1318 this.statusText = 'statusText' in options ? options.statusText : 'OK' 1319 this.headers = new Headers(options.headers) 1320 this.url = options.url || '' 1321 this._initBody(bodyInit) 1322 } 1323 1324 Body.call(Response.prototype) 1325 1326 Response.prototype.clone = function() { 1327 return new Response(this._bodyInit, { 1328 status: this.status, 1329 statusText: this.statusText, 1330 headers: new Headers(this.headers), 1331 url: this.url 1332 }) 1333 } 1334 1335 Response.error = function() { 1336 var response = new Response(null, {status: 0, statusText: ''}) 1337 response.type = 'error' 1338 return response 1339 } 1340 1341 var redirectStatuses = [301, 302, 303, 307, 308] 1342 1343 Response.redirect = function(url, status) { 1344 if (redirectStatuses.indexOf(status) === -1) { 1345 throw new RangeError('Invalid status code') 1346 } 1347 1348 return new Response(null, {status: status, headers: {location: url}}) 1349 } 1350 1351 self.Headers = Headers 1352 self.Request = Request 1353 self.Response = Response 1354 1355 self.fetch = function(input, init) { 1356 return new Promise(function(resolve, reject) { 1357 var request = new Request(input, init) 1358 var xhr = new XMLHttpRequest() 1359 1360 xhr.onload = function() { 1361 var options = { 1362 status: xhr.status, 1363 statusText: xhr.statusText, 1364 headers: parseHeaders(xhr.getAllResponseHeaders() || '') 1365 } 1366 options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') 1367 var body = 'response' in xhr ? xhr.response : xhr.responseText 1368 resolve(new Response(body, options)) 1369 } 1370 1371 xhr.onerror = function() { 1372 reject(new TypeError('Network request failed')) 1373 } 1374 1375 xhr.ontimeout = function() { 1376 reject(new TypeError('Network request failed')) 1377 } 1378 1379 xhr.open(request.method, request.url, true) 1380 1381 if (request.credentials === 'include') { 1382 xhr.withCredentials = true 1383 } 1384 1385 if ('responseType' in xhr && support.blob) { 1386 xhr.responseType = 'blob' 1387 } 1388 1389 request.headers.forEach(function(value, name) { 1390 xhr.setRequestHeader(name, value) 1391 }) 1392 1393 xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) 1394 }) 1395 } 1396 self.fetch.polyfill = true 1397 })(typeof self !== 'undefined' ? self : this); 1398 1399 1400 /***/ }), 1401 /* 10 */ 1402 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1403 1404 "use strict"; 1405 Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 1406 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1); 1407 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); 1408 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom__ = __webpack_require__(12); 1409 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react_dom__); 1410 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__App__ = __webpack_require__(16); 1411 __WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.render(__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__App__["a" /* default */],null),document.getElementById('root')); 1412 1413 /***/ }), 1414 /* 11 */ 1415 /***/ (function(module, exports, __webpack_require__) { 1416 1417 "use strict"; 1418 /** @license React v16.5.1 1419 * react.production.min.js 1420 * 1421 * Copyright (c) Facebook, Inc. and its affiliates. 1422 * 1423 * This source code is licensed under the MIT license found in the 1424 * LICENSE file in the root directory of this source tree. 1425 */ 1426 1427 var m=__webpack_require__(0),n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.async_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112;n&&Symbol.for("react.placeholder"); 1428 var z="function"===typeof Symbol&&Symbol.iterator;function A(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[d,c,e,g,h,f],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}} 1429 function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);A(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={}; 1430 function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}var H=G.prototype=new F; 1431 H.constructor=G;m(H,E.prototype);H.isPureReactComponent=!0;var I={current:null,currentDispatcher:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0}; 1432 function L(a,b,d){var c=void 0,e={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var k=Array(f),l=0;l<f;l++)k[l]=arguments[l+2];e.children=k}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===e[c]&&(e[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:e,_owner:I.current}} 1433 function M(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function N(a){return"object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var O=/\/+/g,P=[];function Q(a,b,d,c){if(P.length){var e=P.pop();e.result=a;e.keyPrefix=b;e.func=d;e.context=c;e.count=0;return e}return{result:a,keyPrefix:b,func:d,context:c,count:0}} 1434 function R(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>P.length&&P.push(a)} 1435 function S(a,b,d,c){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;var g=!1;if(null===a)g=!0;else switch(e){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0}}if(g)return d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){e=a[h];var f=b+T(e,h);g+=S(e,f,d,c)}else if(null===a||"object"!==typeof a?f=null:(f=z&&a[z]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),h= 1436 0;!(e=a.next()).done;)e=e.value,f=b+T(e,h++),g+=S(e,f,d,c);else"object"===e&&(d=""+a,B("31","[object Object]"===d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return g}function U(a,b,d){return null==a?0:S(a,"",b,d)}function T(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function V(a,b){a.func.call(a.context,b,a.count++)} 1437 function aa(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=M(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function W(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,aa,b);R(b)}function ba(a,b){var d=I.currentDispatcher;null===d?B("277"):void 0;return d.readContext(a,b)} 1438 var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];W(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=Q(null,null,b,d);U(a,V,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){N(a)?void 0:B("143");return a}},createRef:function(){return{current:null}},Component:E,PureComponent:G,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b, 1439 _currentValue:a,_currentValue2:a,Provider:null,Consumer:null,unstable_read:null};a.Provider={$$typeof:v,_context:a};a.Consumer=a;a.unstable_read=ba.bind(null,a);return a},forwardRef:function(a){return{$$typeof:y,render:a}},Fragment:r,StrictMode:t,unstable_AsyncMode:x,unstable_Profiler:u,createElement:L,cloneElement:function(a,b,d){null===a||void 0===a?B("267",a):void 0;var c=void 0,e=m({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key); 1440 var k=void 0;a.type&&a.type.defaultProps&&(k=a.type.defaultProps);for(c in b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==k?k[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){k=Array(c);for(var l=0;l<c;l++)k[l]=arguments[l+2];e.children=k}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=L.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.5.1",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I, 1441 assign:m}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z; 1442 1443 1444 /***/ }), 1445 /* 12 */ 1446 /***/ (function(module, exports, __webpack_require__) { 1447 1448 "use strict"; 1449 1450 1451 function checkDCE() { 1452 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 1453 if ( 1454 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || 1455 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' 1456 ) { 1457 return; 1458 } 1459 if (false) { 1460 // This branch is unreachable because this function is only called 1461 // in production, but the condition is true only in development. 1462 // Therefore if the branch is still here, dead code elimination wasn't 1463 // properly applied. 1464 // Don't change the message. React DevTools relies on it. Also make sure 1465 // this message doesn't occur elsewhere in this function, or it will cause 1466 // a false positive. 1467 throw new Error('^_^'); 1468 } 1469 try { 1470 // Verify that the code above has been dead code eliminated (DCE'd). 1471 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); 1472 } catch (err) { 1473 // DevTools shouldn't crash React, no matter what. 1474 // We should still report in case we break this code. 1475 console.error(err); 1476 } 1477 } 1478 1479 if (true) { 1480 // DCE check should happen before ReactDOM bundle executes so that 1481 // DevTools can report bad minification during injection. 1482 checkDCE(); 1483 module.exports = __webpack_require__(13); 1484 } else { 1485 module.exports = require('./cjs/react-dom.development.js'); 1486 } 1487 1488 1489 /***/ }), 1490 /* 13 */ 1491 /***/ (function(module, exports, __webpack_require__) { 1492 1493 "use strict"; 1494 /** @license React v16.5.1 1495 * react-dom.production.min.js 1496 * 1497 * Copyright (c) Facebook, Inc. and its affiliates. 1498 * 1499 * This source code is licensed under the MIT license found in the 1500 * LICENSE file in the root directory of this source tree. 1501 */ 1502 1503 /* 1504 Modernizr 3.0.0pre (Custom Build) | MIT 1505 */ 1506 var aa=__webpack_require__(1),n=__webpack_require__(0),ba=__webpack_require__(14);function ca(a,b,c,d,e,f,g,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[c,d,e,f,g,h],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}} 1507 function t(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)c+="&args[]="+encodeURIComponent(arguments[d+1]);ca(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}aa?void 0:t("227");function da(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l)}catch(m){this.onError(m)}} 1508 var ea=!1,fa=null,ha=!1,ia=null,ja={onError:function(a){ea=!0;fa=a}};function ka(a,b,c,d,e,f,g,h,k){ea=!1;fa=null;da.apply(ja,arguments)}function la(a,b,c,d,e,f,g,h,k){ka.apply(this,arguments);if(ea){if(ea){var l=fa;ea=!1;fa=null}else t("198"),l=void 0;ha||(ha=!0,ia=l)}}var ma=null,na={}; 1509 function oa(){if(ma)for(var a in na){var b=na[a],c=ma.indexOf(a);-1<c?void 0:t("96",a);if(!pa[c]){b.extractEvents?void 0:t("97",a);pa[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],g=b,h=d;qa.hasOwnProperty(h)?t("99",h):void 0;qa[h]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&ra(k[e],g,h);e=!0}else f.registrationName?(ra(f.registrationName,g,h),e=!0):e=!1;e?void 0:t("98",d,a)}}}} 1510 function ra(a,b,c){sa[a]?t("100",a):void 0;sa[a]=b;ta[a]=b.eventTypes[c].dependencies}var pa=[],qa={},sa={},ta={},ua=null,va=null,wa=null;function xa(a,b,c,d){b=a.type||"unknown-event";a.currentTarget=wa(d);la(b,c,void 0,a);a.currentTarget=null}function ya(a,b){null==b?t("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]} 1511 function za(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}var Aa=null;function Ba(a,b){if(a){var c=a._dispatchListeners,d=a._dispatchInstances;if(Array.isArray(c))for(var e=0;e<c.length&&!a.isPropagationStopped();e++)xa(a,b,c[e],d[e]);else c&&xa(a,b,c,d);a._dispatchListeners=null;a._dispatchInstances=null;a.isPersistent()||a.constructor.release(a)}}function Ca(a){return Ba(a,!0)}function Da(a){return Ba(a,!1)} 1512 var Ea={injectEventPluginOrder:function(a){ma?t("101"):void 0;ma=Array.prototype.slice.call(a);oa()},injectEventPluginsByName:function(a){var b=!1,c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];na.hasOwnProperty(c)&&na[c]===d||(na[c]?t("102",c):void 0,na[c]=d,b=!0)}b&&oa()}}; 1513 function Fa(a,b){var c=a.stateNode;if(!c)return null;var d=ua(c);if(!d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?t("231",b,typeof c):void 0; 1514 return c}function Ga(a,b){null!==a&&(Aa=ya(Aa,a));a=Aa;Aa=null;if(a&&(b?za(a,Ca):za(a,Da),Aa?t("95"):void 0,ha))throw b=ia,ha=!1,ia=null,b;}var Ha=Math.random().toString(36).slice(2),Ia="__reactInternalInstance$"+Ha,Ja="__reactEventHandlers$"+Ha;function Ka(a){if(a[Ia])return a[Ia];for(;!a[Ia];)if(a.parentNode)a=a.parentNode;else return null;a=a[Ia];return 7===a.tag||8===a.tag?a:null}function La(a){a=a[Ia];return!a||7!==a.tag&&8!==a.tag?null:a} 1515 function Ma(a){if(7===a.tag||8===a.tag)return a.stateNode;t("33")}function Na(a){return a[Ja]||null}function Oa(a){do a=a.return;while(a&&7!==a.tag);return a?a:null}function Pa(a,b,c){if(b=Fa(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a)} 1516 function Qa(a){if(a&&a.dispatchConfig.phasedRegistrationNames){for(var b=a._targetInst,c=[];b;)c.push(b),b=Oa(b);for(b=c.length;0<b--;)Pa(c[b],"captured",a);for(b=0;b<c.length;b++)Pa(c[b],"bubbled",a)}}function Ra(a,b,c){a&&c&&c.dispatchConfig.registrationName&&(b=Fa(a,c.dispatchConfig.registrationName))&&(c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a))}function Ta(a){a&&a.dispatchConfig.registrationName&&Ra(a._targetInst,null,a)} 1517 function Ua(a){za(a,Qa)}var Va=!("undefined"===typeof window||!window.document||!window.document.createElement);function Wa(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Ya={animationend:Wa("Animation","AnimationEnd"),animationiteration:Wa("Animation","AnimationIteration"),animationstart:Wa("Animation","AnimationStart"),transitionend:Wa("Transition","TransitionEnd")},Za={},$a={}; 1518 Va&&($a=document.createElement("div").style,"AnimationEvent"in window||(delete Ya.animationend.animation,delete Ya.animationiteration.animation,delete Ya.animationstart.animation),"TransitionEvent"in window||delete Ya.transitionend.transition);function ab(a){if(Za[a])return Za[a];if(!Ya[a])return a;var b=Ya[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in $a)return Za[a]=b[c];return a} 1519 var bb=ab("animationend"),cb=ab("animationiteration"),db=ab("animationstart"),eb=ab("transitionend"),fb="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gb=null,hb=null,ib=null; 1520 function jb(){if(ib)return ib;var a,b=hb,c=b.length,d,e="value"in gb?gb.value:gb.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return ib=e.slice(a,1<d?1-d:void 0)}function kb(){return!0}function lb(){return!1} 1521 function z(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?kb:lb;this.isPropagationStopped=lb;return this} 1522 n(z.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=kb)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=kb)},persist:function(){this.isPersistent=kb},isPersistent:lb,destructor:function(){var a=this.constructor.Interface, 1523 b;for(b in a)this[b]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=lb;this._dispatchInstances=this._dispatchListeners=null}});z.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null}; 1524 z.extend=function(a){function b(){}function c(){return d.apply(this,arguments)}var d=this;b.prototype=d.prototype;var e=new b;n(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=n({},d.Interface,a);c.extend=d.extend;mb(c);return c};mb(z);function nb(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}function ob(a){a instanceof this?void 0:t("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)} 1525 function mb(a){a.eventPool=[];a.getPooled=nb;a.release=ob}var pb=z.extend({data:null}),qb=z.extend({data:null}),rb=[9,13,27,32],sb=Va&&"CompositionEvent"in window,tb=null;Va&&"documentMode"in document&&(tb=document.documentMode); 1526 var ub=Va&&"TextEvent"in window&&!tb,vb=Va&&(!sb||tb&&8<tb&&11>=tb),wb=String.fromCharCode(32),xb={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart", 1527 captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},yb=!1; 1528 function zb(a,b){switch(a){case "keyup":return-1!==rb.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "blur":return!0;default:return!1}}function Ab(a){a=a.detail;return"object"===typeof a&&"data"in a?a.data:null}var Bb=!1;function Cb(a,b){switch(a){case "compositionend":return Ab(b);case "keypress":if(32!==b.which)return null;yb=!0;return wb;case "textInput":return a=b.data,a===wb&&yb?null:a;default:return null}} 1529 function Db(a,b){if(Bb)return"compositionend"===a||!sb&&zb(a,b)?(a=jb(),ib=hb=gb=null,Bb=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "compositionend":return vb&&"ko"!==b.locale?null:b.data;default:return null}} 1530 var Eb={eventTypes:xb,extractEvents:function(a,b,c,d){var e=void 0;var f=void 0;if(sb)b:{switch(a){case "compositionstart":e=xb.compositionStart;break b;case "compositionend":e=xb.compositionEnd;break b;case "compositionupdate":e=xb.compositionUpdate;break b}e=void 0}else Bb?zb(a,c)&&(e=xb.compositionEnd):"keydown"===a&&229===c.keyCode&&(e=xb.compositionStart);e?(vb&&"ko"!==c.locale&&(Bb||e!==xb.compositionStart?e===xb.compositionEnd&&Bb&&(f=jb()):(gb=d,hb="value"in gb?gb.value:gb.textContent,Bb= 1531 !0)),e=pb.getPooled(e,b,c,d),f?e.data=f:(f=Ab(c),null!==f&&(e.data=f)),Ua(e),f=e):f=null;(a=ub?Cb(a,c):Db(a,c))?(b=qb.getPooled(xb.beforeInput,b,c,d),b.data=a,Ua(b)):b=null;return null===f?b:null===b?f:[f,b]}},Fb=null,Gb=null,Hb=null;function Ib(a){if(a=va(a)){"function"!==typeof Fb?t("280"):void 0;var b=ua(a.stateNode);Fb(a.stateNode,a.type,b)}}function Jb(a){Gb?Hb?Hb.push(a):Hb=[a]:Gb=a}function Kb(){if(Gb){var a=Gb,b=Hb;Hb=Gb=null;Ib(a);if(b)for(a=0;a<b.length;a++)Ib(b[a])}} 1532 function Lb(a,b){return a(b)}function Mb(a,b,c){return a(b,c)}function Nb(){}var Ob=!1;function Pb(a,b){if(Ob)return a(b);Ob=!0;try{return Lb(a,b)}finally{if(Ob=!1,null!==Gb||null!==Hb)Nb(),Kb()}}var Qb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rb(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!Qb[a.type]:"textarea"===b?!0:!1} 1533 function Sb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}function Tb(a){if(!Va)return!1;a="on"+a;var b=a in document;b||(b=document.createElement("div"),b.setAttribute(a,"return;"),b="function"===typeof b[a]);return b}function Ub(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)} 1534 function Vb(a){var b=Ub(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker= 1535 null;delete a[b]}}}}function Wb(a){a._valueTracker||(a._valueTracker=Vb(a))}function Xb(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=Ub(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1} 1536 var Yb=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zb=/^(.*)[\\\/]/,C="function"===typeof Symbol&&Symbol.for,$b=C?Symbol.for("react.element"):60103,ac=C?Symbol.for("react.portal"):60106,bc=C?Symbol.for("react.fragment"):60107,cc=C?Symbol.for("react.strict_mode"):60108,dc=C?Symbol.for("react.profiler"):60114,ec=C?Symbol.for("react.provider"):60109,fc=C?Symbol.for("react.context"):60110,gc=C?Symbol.for("react.async_mode"):60111,hc=C?Symbol.for("react.forward_ref"):60112,ic=C?Symbol.for("react.placeholder"): 1537 60113,jc="function"===typeof Symbol&&Symbol.iterator;function kc(a){if(null===a||"object"!==typeof a)return null;a=jc&&a[jc]||a["@@iterator"];return"function"===typeof a?a:null} 1538 function lc(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case gc:return"AsyncMode";case bc:return"Fragment";case ac:return"Portal";case dc:return"Profiler";case cc:return"StrictMode";case ic:return"Placeholder"}if("object"===typeof a){switch(a.$$typeof){case fc:return"Context.Consumer";case ec:return"Context.Provider";case hc:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")": 1539 "ForwardRef")}if("function"===typeof a.then&&(a=1===a._reactStatus?a._reactResult:null))return lc(a)}return null}function mc(a){var b="";do{a:switch(a.tag){case 4:case 0:case 1:case 2:case 3:case 7:case 10:var c=a._debugOwner,d=a._debugSource,e=lc(a.type);var f=null;c&&(f=lc(c.type));c=e;e="";d?e=" (at "+d.fileName.replace(Zb,"")+":"+d.lineNumber+")":f&&(e=" (created by "+f+")");f="\n in "+(c||"Unknown")+e;break a;default:f=""}b+=f;a=a.return}while(a);return b} 1540 var nc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pc=Object.prototype.hasOwnProperty,qc={},rc={}; 1541 function sc(a){if(pc.call(rc,a))return!0;if(pc.call(qc,a))return!1;if(nc.test(a))return rc[a]=!0;qc[a]=!0;return!1}function tc(a,b,c,d){if(null!==c&&0===c.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(d)return!1;if(null!==c)return!c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}} 1542 function uc(a,b,c,d){if(null===b||"undefined"===typeof b||tc(a,b,c,d))return!0;if(d)return!1;if(null!==c)switch(c.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function D(a,b,c,d,e){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b}var E={}; 1543 "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){E[a]=new D(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];E[b]=new D(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){E[a]=new D(a,2,!1,a.toLowerCase(),null)}); 1544 ["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){E[a]=new D(a,2,!1,a,null)});"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){E[a]=new D(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){E[a]=new D(a,3,!0,a,null)}); 1545 ["capture","download"].forEach(function(a){E[a]=new D(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){E[a]=new D(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){E[a]=new D(a,5,!1,a.toLowerCase(),null)});var vc=/[\-:]([a-z])/g;function wc(a){return a[1].toUpperCase()} 1546 "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(vc, 1547 wc);E[b]=new D(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(vc,wc);E[b]=new D(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(vc,wc);E[b]=new D(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});E.tabIndex=new D("tabIndex",1,!1,"tabindex",null); 1548 function xc(a,b,c,d){var e=E.hasOwnProperty(b)?E[b]:null;var f=null!==e?0===e.type:d?!1:!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1]?!1:!0;f||(uc(b,c,e,d)&&(c=null),d||null===e?sc(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&!0===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))))} 1549 function yc(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return""}}function zc(a,b){var c=b.checked;return n({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})} 1550 function Bc(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=yc(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value}}function Cc(a,b){b=b.checked;null!=b&&xc(a,"checked",b,!1)} 1551 function Dc(a,b){Cc(a,b);var c=yc(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?Ec(a,b.type,c):b.hasOwnProperty("defaultValue")&&Ec(a,b.type,yc(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)} 1552 function Fc(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;""!==c&&(a.name="");a.defaultChecked=!a.defaultChecked;a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c)} 1553 function Ec(a,b,c){if("number"!==b||a.ownerDocument.activeElement!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c)}var Gc={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Hc(a,b,c){a=z.getPooled(Gc.change,a,b,c);a.type="change";Jb(c);Ua(a);return a}var Ic=null,Jc=null;function Kc(a){Ga(a,!1)} 1554 function Lc(a){var b=Ma(a);if(Xb(b))return a}function Mc(a,b){if("change"===a)return b}var Nc=!1;Va&&(Nc=Tb("input")&&(!document.documentMode||9<document.documentMode));function Oc(){Ic&&(Ic.detachEvent("onpropertychange",Pc),Jc=Ic=null)}function Pc(a){"value"===a.propertyName&&Lc(Jc)&&(a=Hc(Jc,a,Sb(a)),Pb(Kc,a))}function Qc(a,b,c){"focus"===a?(Oc(),Ic=b,Jc=c,Ic.attachEvent("onpropertychange",Pc)):"blur"===a&&Oc()}function Rc(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return Lc(Jc)} 1555 function Sc(a,b){if("click"===a)return Lc(b)}function Tc(a,b){if("input"===a||"change"===a)return Lc(b)} 1556 var Uc={eventTypes:Gc,_isInputEventSupported:Nc,extractEvents:function(a,b,c,d){var e=b?Ma(b):window,f=void 0,g=void 0,h=e.nodeName&&e.nodeName.toLowerCase();"select"===h||"input"===h&&"file"===e.type?f=Mc:Rb(e)?Nc?f=Tc:(f=Rc,g=Qc):(h=e.nodeName)&&"input"===h.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)&&(f=Sc);if(f&&(f=f(a,b)))return Hc(f,c,d);g&&g(a,e,b);"blur"===a&&(a=e._wrapperState)&&a.controlled&&"number"===e.type&&Ec(e,"number",e.value)}},Vc=z.extend({view:null,detail:null}),Wc={Alt:"altKey", 1557 Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xc(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Wc[a])?!!b[a]:!1}function Yc(){return Xc} 1558 var Zc=0,$c=0,ad=!1,bd=!1,cd=Vc.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Yc,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)},movementX:function(a){if("movementX"in a)return a.movementX;var b=Zc;Zc=a.screenX;return ad?"mousemove"===a.type?a.screenX-b:0:(ad=!0,0)},movementY:function(a){if("movementY"in a)return a.movementY; 1559 var b=$c;$c=a.screenY;return bd?"mousemove"===a.type?a.screenY-b:0:(bd=!0,0)}}),dd=cd.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),ed={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave", 1560 dependencies:["pointerout","pointerover"]}},fd={eventTypes:ed,extractEvents:function(a,b,c,d){var e="mouseover"===a||"pointerover"===a,f="mouseout"===a||"pointerout"===a;if(e&&(c.relatedTarget||c.fromElement)||!f&&!e)return null;e=d.window===d?d:(e=d.ownerDocument)?e.defaultView||e.parentWindow:window;f?(f=b,b=(b=c.relatedTarget||c.toElement)?Ka(b):null):f=null;if(f===b)return null;var g=void 0,h=void 0,k=void 0,l=void 0;if("mouseout"===a||"mouseover"===a)g=cd,h=ed.mouseLeave,k=ed.mouseEnter,l="mouse"; 1561 else if("pointerout"===a||"pointerover"===a)g=dd,h=ed.pointerLeave,k=ed.pointerEnter,l="pointer";var m=null==f?e:Ma(f);e=null==b?e:Ma(b);a=g.getPooled(h,f,c,d);a.type=l+"leave";a.target=m;a.relatedTarget=e;c=g.getPooled(k,b,c,d);c.type=l+"enter";c.target=e;c.relatedTarget=m;d=b;if(f&&d)a:{b=f;e=d;l=0;for(g=b;g;g=Oa(g))l++;g=0;for(k=e;k;k=Oa(k))g++;for(;0<l-g;)b=Oa(b),l--;for(;0<g-l;)e=Oa(e),g--;for(;l--;){if(b===e||b===e.alternate)break a;b=Oa(b);e=Oa(e)}b=null}else b=null;e=b;for(b=[];f&&f!==e;){l= 1562 f.alternate;if(null!==l&&l===e)break;b.push(f);f=Oa(f)}for(f=[];d&&d!==e;){l=d.alternate;if(null!==l&&l===e)break;f.push(d);d=Oa(d)}for(d=0;d<b.length;d++)Ra(b[d],"bubbled",a);for(d=f.length;0<d--;)Ra(f[d],"captured",c);return[a,c]}},gd=Object.prototype.hasOwnProperty;function hd(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b} 1563 function id(a,b){if(hd(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++)if(!gd.call(b,c[d])||!hd(a[c[d]],b[c[d]]))return!1;return!0}function jd(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 5===b.tag?2:3}function kd(a){2!==jd(a)?t("188"):void 0} 1564 function ld(a){var b=a.alternate;if(!b)return b=jd(a),3===b?t("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c.return,f=e?e.alternate:null;if(!e||!f)break;if(e.child===f.child){for(var g=e.child;g;){if(g===c)return kd(e),a;if(g===d)return kd(e),b;g=g.sibling}t("188")}if(c.return!==d.return)c=e,d=f;else{g=!1;for(var h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}g? 1565 void 0:t("189")}}c.alternate!==d?t("190"):void 0}5!==c.tag?t("188"):void 0;return c.stateNode.current===c?a:b}function md(a){a=ld(a);if(!a)return null;for(var b=a;;){if(7===b.tag||8===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}}return null} 1566 var nd=z.extend({animationName:null,elapsedTime:null,pseudoElement:null}),od=z.extend({clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),pd=Vc.extend({relatedTarget:null});function qd(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0} 1567 var rd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4", 1568 116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},td=Vc.extend({key:function(a){if(a.key){var b=rd[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=qd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?sd[a.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Yc,charCode:function(a){return"keypress"=== 1569 a.type?qd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===a.type?qd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),ud=cd.extend({dataTransfer:null}),vd=Vc.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Yc}),wd=z.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),xd=cd.extend({deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in 1570 a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:null,deltaMode:null}),yd=[["abort","abort"],[bb,"animationEnd"],[cb,"animationIteration"],[db,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"], 1571 ["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"], 1572 ["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[eb,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],zd={},Ad={};function Bd(a,b){var c=a[0];a=a[1];var d="on"+(a[0].toUpperCase()+a.slice(1));b={phasedRegistrationNames:{bubbled:d,captured:d+"Capture"},dependencies:[c],isInteractive:b};zd[a]=b;Ad[c]=b} 1573 [["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"], 1574 ["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(a){Bd(a,!0)});yd.forEach(function(a){Bd(a,!1)}); 1575 var Cd={eventTypes:zd,isInteractiveTopLevelEventType:function(a){a=Ad[a];return void 0!==a&&!0===a.isInteractive},extractEvents:function(a,b,c,d){var e=Ad[a];if(!e)return null;switch(a){case "keypress":if(0===qd(c))return null;case "keydown":case "keyup":a=td;break;case "blur":case "focus":a=pd;break;case "click":if(2===c.button)return null;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":a=cd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":a= 1576 ud;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":a=vd;break;case bb:case cb:case db:a=nd;break;case eb:a=wd;break;case "scroll":a=Vc;break;case "wheel":a=xd;break;case "copy":case "cut":case "paste":a=od;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":a=dd;break;default:a=z}b=a.getPooled(e,b,c,d);Ua(b);return b}},Dd=Cd.isInteractiveTopLevelEventType, 1577 Ed=[];function Fd(a){var b=a.targetInst,c=b;do{if(!c){a.ancestors.push(c);break}var d;for(d=c;d.return;)d=d.return;d=5!==d.tag?null:d.stateNode.containerInfo;if(!d)break;a.ancestors.push(c);c=Ka(d)}while(c);for(c=0;c<a.ancestors.length;c++){b=a.ancestors[c];var e=Sb(a.nativeEvent);d=a.topLevelType;for(var f=a.nativeEvent,g=null,h=0;h<pa.length;h++){var k=pa[h];k&&(k=k.extractEvents(d,b,f,e))&&(g=ya(g,k))}Ga(g,!1)}}var Gd=!0; 1578 function F(a,b){if(!b)return null;var c=(Dd(a)?Hd:Id).bind(null,a);b.addEventListener(a,c,!1)}function Jd(a,b){if(!b)return null;var c=(Dd(a)?Hd:Id).bind(null,a);b.addEventListener(a,c,!0)}function Hd(a,b){Mb(Id,a,b)} 1579 function Id(a,b){if(Gd){var c=Sb(b);c=Ka(c);null===c||"number"!==typeof c.tag||2===jd(c)||(c=null);if(Ed.length){var d=Ed.pop();d.topLevelType=a;d.nativeEvent=b;d.targetInst=c;a=d}else a={topLevelType:a,nativeEvent:b,targetInst:c,ancestors:[]};try{Pb(Fd,a)}finally{a.topLevelType=null,a.nativeEvent=null,a.targetInst=null,a.ancestors.length=0,10>Ed.length&&Ed.push(a)}}}var Kd={},Ld=0,Md="_reactListenersID"+(""+Math.random()).slice(2); 1580 function Nd(a){Object.prototype.hasOwnProperty.call(a,Md)||(a[Md]=Ld++,Kd[a[Md]]={});return Kd[a[Md]]}function Od(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}function Qd(a){for(;a&&a.firstChild;)a=a.firstChild;return a} 1581 function Rd(a,b){var c=Qd(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Qd(c)}}function Sd(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Sd(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1} 1582 function Td(){for(var a=window,b=Od();b instanceof a.HTMLIFrameElement;){try{a=b.contentDocument.defaultView}catch(c){break}b=Od(a.document)}return b}function Ud(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)} 1583 var Vd=Va&&"documentMode"in document&&11>=document.documentMode,Wd={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Xd=null,Yd=null,Zd=null,$d=!1; 1584 function ae(a,b){var c=b.window===b?b.document:9===b.nodeType?b:b.ownerDocument;if($d||null==Xd||Xd!==Od(c))return null;c=Xd;"selectionStart"in c&&Ud(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset});return Zd&&id(Zd,c)?null:(Zd=c,a=z.getPooled(Wd.select,Yd,a,b),a.type="select",a.target=Xd,Ua(a),a)} 1585 var be={eventTypes:Wd,extractEvents:function(a,b,c,d){var e=d.window===d?d.document:9===d.nodeType?d:d.ownerDocument,f;if(!(f=!e)){a:{e=Nd(e);f=ta.onSelect;for(var g=0;g<f.length;g++){var h=f[g];if(!e.hasOwnProperty(h)||!e[h]){e=!1;break a}}e=!0}f=!e}if(f)return null;e=b?Ma(b):window;switch(a){case "focus":if(Rb(e)||"true"===e.contentEditable)Xd=e,Yd=b,Zd=null;break;case "blur":Zd=Yd=Xd=null;break;case "mousedown":$d=!0;break;case "contextmenu":case "mouseup":case "dragend":return $d=!1,ae(c,d);case "selectionchange":if(Vd)break; 1586 case "keydown":case "keyup":return ae(c,d)}return null}};Ea.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));ua=Na;va=La;wa=Ma;Ea.injectEventPluginsByName({SimpleEventPlugin:Cd,EnterLeaveEventPlugin:fd,ChangeEventPlugin:Uc,SelectEventPlugin:be,BeforeInputEventPlugin:Eb});function ce(a){var b="";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b} 1587 function de(a,b){a=n({children:void 0},b);if(b=ce(b.children))a.children=b;return a}function ee(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0)}else{c=""+yc(c);b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e])}null!==b&&(b.selected=!0)}} 1588 function fe(a,b){null!=b.dangerouslySetInnerHTML?t("91"):void 0;return n({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function ge(a,b){var c=b.value;null==c&&(c=b.defaultValue,b=b.children,null!=b&&(null!=c?t("92"):void 0,Array.isArray(b)&&(1>=b.length?void 0:t("93"),b=b[0]),c=b),null==c&&(c=""));a._wrapperState={initialValue:yc(c)}} 1589 function he(a,b){var c=yc(b.value);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&(a.defaultValue=c));null!=b.defaultValue&&(a.defaultValue=""+yc(b.defaultValue))}function ie(a){var b=a.textContent;b===a._wrapperState.initialValue&&(a.value=b)}var je={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"}; 1590 function ke(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?ke(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a} 1591 var me=void 0,ne=function(a){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==je.svg||"innerHTML"in a)a.innerHTML=b;else{me=me||document.createElement("div");me.innerHTML="<svg>"+b+"</svg>";for(b=me.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}}); 1592 function oe(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b} 1593 var pe={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0, 1594 floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qe=["Webkit","ms","Moz","O"];Object.keys(pe).forEach(function(a){qe.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pe[b]=pe[a]})}); 1595 function re(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--");var e=c;var f=b[c];e=null==f||"boolean"===typeof f||""===f?"":d||"number"!==typeof f||0===f||pe.hasOwnProperty(e)&&pe[e]?(""+f).trim():f+"px";"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e}}var se=n({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}); 1596 function te(a,b){b&&(se[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML?t("137",a,""):void 0),null!=b.dangerouslySetInnerHTML&&(null!=b.children?t("60"):void 0,"object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML?void 0:t("61")),null!=b.style&&"object"!==typeof b.style?t("62",""):void 0)} 1597 function ue(a,b){if(-1===a.indexOf("-"))return"string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return!1;default:return!0}} 1598 function ve(a,b){a=9===a.nodeType||11===a.nodeType?a:a.ownerDocument;var c=Nd(a);b=ta[b];for(var d=0;d<b.length;d++){var e=b[d];if(!c.hasOwnProperty(e)||!c[e]){switch(e){case "scroll":Jd("scroll",a);break;case "focus":case "blur":Jd("focus",a);Jd("blur",a);c.blur=!0;c.focus=!0;break;case "cancel":case "close":Tb(e)&&Jd(e,a);break;case "invalid":case "submit":case "reset":break;default:-1===fb.indexOf(e)&&F(e,a)}c[e]=!0}}}function we(){}var xe=null,ye=null; 1599 function ze(a,b){switch(a){case "button":case "input":case "select":case "textarea":return!!b.autoFocus}return!1}function Ae(a,b){return"textarea"===a||"option"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}function Be(a){for(a=a.nextSibling;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a} 1600 function Ce(a){for(a=a.firstChild;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a}new Set;var De=[],Ee=-1;function G(a){0>Ee||(a.current=De[Ee],De[Ee]=null,Ee--)}function H(a,b){Ee++;De[Ee]=a.current;a.current=b}var Fe={},I={current:Fe},J={current:!1},Ge=Fe; 1601 function He(a,b){var c=a.type.contextTypes;if(!c)return Fe;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function K(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Ie(a){G(J,a);G(I,a)}function Je(a){G(J,a);G(I,a)} 1602 function Ke(a,b,c){I.current!==Fe?t("168"):void 0;H(I,b,a);H(J,c,a)}function Le(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)e in a?void 0:t("108",lc(b)||"Unknown",e);return n({},c,d)}function Me(a){var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||Fe;Ge=I.current;H(I,b,a);H(J,J.current,a);return!0} 1603 function Ne(a,b,c){var d=a.stateNode;d?void 0:t("169");c?(b=Le(a,b,Ge),d.__reactInternalMemoizedMergedChildContext=b,G(J,a),G(I,a),H(I,b,a)):G(J,a);H(J,c,a)}var Oe=null,Pe=null;function Qe(a){return function(b){try{return a(b)}catch(c){}}} 1604 function Re(a){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)return!0;try{var c=b.inject(a);Oe=Qe(function(a){return b.onCommitFiberRoot(c,a)});Pe=Qe(function(a){return b.onCommitFiberUnmount(c,a)})}catch(d){}return!0} 1605 function Se(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=null;this.index=0;this.ref=null;this.pendingProps=b;this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.effectTag=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childExpirationTime=this.expirationTime=0;this.alternate=null}function Te(a){a=a.prototype;return!(!a||!a.isReactComponent)} 1606 function Ue(a,b,c){var d=a.alternate;null===d?(d=new Se(a.tag,b,a.key,a.mode),d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=b,d.effectTag=0,d.nextEffect=null,d.firstEffect=null,d.lastEffect=null);d.childExpirationTime=a.childExpirationTime;d.expirationTime=b!==a.pendingProps?c:a.expirationTime;d.child=a.child;d.memoizedProps=a.memoizedProps;d.memoizedState=a.memoizedState;d.updateQueue=a.updateQueue;d.firstContextDependency=a.firstContextDependency;d.sibling=a.sibling; 1607 d.index=a.index;d.ref=a.ref;return d} 1608 function Ve(a,b,c){var d=a.type,e=a.key;a=a.props;var f=void 0;if("function"===typeof d)f=Te(d)?2:4;else if("string"===typeof d)f=7;else a:switch(d){case bc:return We(a.children,b,c,e);case gc:f=10;b|=3;break;case cc:f=10;b|=2;break;case dc:return d=new Se(15,a,e,b|4),d.type=dc,d.expirationTime=c,d;case ic:f=16;break;default:if("object"===typeof d&&null!==d)switch(d.$$typeof){case ec:f=12;break a;case fc:f=11;break a;case hc:f=13;break a;default:if("function"===typeof d.then){f=4;break a}}t("130", 1609 null==d?d:typeof d,"")}b=new Se(f,a,e,b);b.type=d;b.expirationTime=c;return b}function We(a,b,c,d){a=new Se(9,a,d,b);a.expirationTime=c;return a}function Xe(a,b,c){a=new Se(8,a,null,b);a.expirationTime=c;return a}function Ye(a,b,c){b=new Se(6,null!==a.children?a.children:[],a.key,b);b.expirationTime=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b} 1610 function Ze(a,b){a.didError=!1;var c=a.earliestPendingTime;0===c?a.earliestPendingTime=a.latestPendingTime=b:c>b?a.earliestPendingTime=b:a.latestPendingTime<b&&(a.latestPendingTime=b);$e(b,a)}function $e(a,b){var c=b.earliestSuspendedTime,d=b.latestSuspendedTime,e=b.earliestPendingTime,f=b.latestPingedTime;e=0!==e?e:f;0===e&&(0===a||d>a)&&(e=d);a=e;0!==a&&0!==c&&c<a&&(a=c);b.nextExpirationTimeToWorkOn=e;b.expirationTime=a}var af=!1; 1611 function bf(a){return{baseState:a,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function cf(a){return{baseState:a.baseState,firstUpdate:a.firstUpdate,lastUpdate:a.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}} 1612 function df(a){return{expirationTime:a,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function ef(a,b){null===a.lastUpdate?a.firstUpdate=a.lastUpdate=b:(a.lastUpdate.next=b,a.lastUpdate=b)} 1613 function ff(a,b){var c=a.alternate;if(null===c){var d=a.updateQueue;var e=null;null===d&&(d=a.updateQueue=bf(a.memoizedState))}else d=a.updateQueue,e=c.updateQueue,null===d?null===e?(d=a.updateQueue=bf(a.memoizedState),e=c.updateQueue=bf(c.memoizedState)):d=a.updateQueue=cf(e):null===e&&(e=c.updateQueue=cf(d));null===e||d===e?ef(d,b):null===d.lastUpdate||null===e.lastUpdate?(ef(d,b),ef(e,b)):(ef(d,b),e.lastUpdate=b)} 1614 function gf(a,b){var c=a.updateQueue;c=null===c?a.updateQueue=bf(a.memoizedState):hf(a,c);null===c.lastCapturedUpdate?c.firstCapturedUpdate=c.lastCapturedUpdate=b:(c.lastCapturedUpdate.next=b,c.lastCapturedUpdate=b)}function hf(a,b){var c=a.alternate;null!==c&&b===c.updateQueue&&(b=a.updateQueue=cf(b));return b} 1615 function jf(a,b,c,d,e,f){switch(c.tag){case 1:return a=c.payload,"function"===typeof a?a.call(f,d,e):a;case 3:a.effectTag=a.effectTag&-1025|64;case 0:a=c.payload;e="function"===typeof a?a.call(f,d,e):a;if(null===e||void 0===e)break;return n({},d,e);case 2:af=!0}return d} 1616 function kf(a,b,c,d,e){af=!1;b=hf(a,b);for(var f=b.baseState,g=null,h=0,k=b.firstUpdate,l=f;null!==k;){var m=k.expirationTime;if(m>e){if(null===g&&(g=k,f=l),0===h||h>m)h=m}else l=jf(a,b,k,l,c,d),null!==k.callback&&(a.effectTag|=32,k.nextEffect=null,null===b.lastEffect?b.firstEffect=b.lastEffect=k:(b.lastEffect.nextEffect=k,b.lastEffect=k));k=k.next}m=null;for(k=b.firstCapturedUpdate;null!==k;){var r=k.expirationTime;if(r>e){if(null===m&&(m=k,null===g&&(f=l)),0===h||h>r)h=r}else l=jf(a,b,k,l,c,d), 1617 null!==k.callback&&(a.effectTag|=32,k.nextEffect=null,null===b.lastCapturedEffect?b.firstCapturedEffect=b.lastCapturedEffect=k:(b.lastCapturedEffect.nextEffect=k,b.lastCapturedEffect=k));k=k.next}null===g&&(b.lastUpdate=null);null===m?b.lastCapturedUpdate=null:a.effectTag|=32;null===g&&null===m&&(f=l);b.baseState=f;b.firstUpdate=g;b.firstCapturedUpdate=m;a.expirationTime=h;a.memoizedState=l} 1618 function lf(a,b,c){null!==b.firstCapturedUpdate&&(null!==b.lastUpdate&&(b.lastUpdate.next=b.firstCapturedUpdate,b.lastUpdate=b.lastCapturedUpdate),b.firstCapturedUpdate=b.lastCapturedUpdate=null);mf(b.firstEffect,c);b.firstEffect=b.lastEffect=null;mf(b.firstCapturedEffect,c);b.firstCapturedEffect=b.lastCapturedEffect=null}function mf(a,b){for(;null!==a;){var c=a.callback;if(null!==c){a.callback=null;var d=b;"function"!==typeof c?t("191",c):void 0;c.call(d)}a=a.nextEffect}} 1619 function nf(a,b){return{value:a,source:b,stack:mc(b)}}var of={current:null},pf=null,qf=null,rf=null;function sf(a,b){var c=a.type._context;H(of,c._currentValue,a);c._currentValue=b}function tf(a){var b=of.current;G(of,a);a.type._context._currentValue=b}function uf(a){pf=a;rf=qf=null;a.firstContextDependency=null} 1620 function vf(a,b){if(rf!==a&&!1!==b&&0!==b){if("number"!==typeof b||1073741823===b)rf=a,b=1073741823;b={context:a,observedBits:b,next:null};null===qf?(null===pf?t("277"):void 0,pf.firstContextDependency=qf=b):qf=qf.next=b}return a._currentValue}var wf={},L={current:wf},xf={current:wf},yf={current:wf};function zf(a){a===wf?t("174"):void 0;return a} 1621 function Af(a,b){H(yf,b,a);H(xf,a,a);H(L,wf,a);var c=b.nodeType;switch(c){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:le(null,"");break;default:c=8===c?b.parentNode:b,b=c.namespaceURI||null,c=c.tagName,b=le(b,c)}G(L,a);H(L,b,a)}function Bf(a){G(L,a);G(xf,a);G(yf,a)}function Cf(a){zf(yf.current);var b=zf(L.current);var c=le(b,a.type);b!==c&&(H(xf,a,a),H(L,c,a))}function Df(a){xf.current===a&&(G(L,a),G(xf,a))}var Ef=(new aa.Component).refs; 1622 function Ff(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:n({},b,c);a.memoizedState=c;d=a.updateQueue;null!==d&&0===a.expirationTime&&(d.baseState=c)} 1623 var Jf={isMounted:function(a){return(a=a._reactInternalFiber)?2===jd(a):!1},enqueueSetState:function(a,b,c){a=a._reactInternalFiber;var d=Gf();d=Hf(d,a);var e=df(d);e.payload=b;void 0!==c&&null!==c&&(e.callback=c);ff(a,e);If(a,d)},enqueueReplaceState:function(a,b,c){a=a._reactInternalFiber;var d=Gf();d=Hf(d,a);var e=df(d);e.tag=1;e.payload=b;void 0!==c&&null!==c&&(e.callback=c);ff(a,e);If(a,d)},enqueueForceUpdate:function(a,b){a=a._reactInternalFiber;var c=Gf();c=Hf(c,a);var d=df(c);d.tag=2;void 0!== 1624 b&&null!==b&&(d.callback=b);ff(a,d);If(a,c)}};function Kf(a,b,c,d,e,f,g){a=a.stateNode;return"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!id(c,d)||!id(e,f):!0}function Lf(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Jf.enqueueReplaceState(b,b.state,null)} 1625 function Mf(a,b,c,d){var e=a.stateNode,f=K(b)?Ge:I.current;e.props=c;e.state=a.memoizedState;e.refs=Ef;e.context=He(a,f);f=a.updateQueue;null!==f&&(kf(a,f,c,e,d),e.state=a.memoizedState);f=b.getDerivedStateFromProps;"function"===typeof f&&(Ff(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(b=e.state,"function"===typeof e.componentWillMount&& 1626 e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Jf.enqueueReplaceState(e,e.state,null),f=a.updateQueue,null!==f&&(kf(a,f,c,e,d),e.state=a.memoizedState));"function"===typeof e.componentDidMount&&(a.effectTag|=4)}var Nf=Array.isArray; 1627 function Of(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;var d=void 0;c&&(2!==c.tag&&3!==c.tag?t("110"):void 0,d=c.stateNode);d?void 0:t("147",a);var e=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs;b===Ef&&(b=d.refs={});null===a?delete b[e]:b[e]=a};b._stringRef=e;return b}"string"!==typeof a?t("284"):void 0;c._owner?void 0:t("254",a)}return a} 1628 function Pf(a,b){"textarea"!==a.type&&t("31","[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b,"")} 1629 function Qf(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.effectTag=8}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b,c){a=Ue(a,b,c);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.effectTag= 1630 2,c):d;b.effectTag=2;return c}function g(b){a&&null===b.alternate&&(b.effectTag=2);return b}function h(a,b,c,d){if(null===b||8!==b.tag)return b=Xe(c,a.mode,d),b.return=a,b;b=e(b,c,d);b.return=a;return b}function k(a,b,c,d){if(null!==b&&b.type===c.type)return d=e(b,c.props,d),d.ref=Of(a,b,c),d.return=a,d;d=Ve(c,a.mode,d);d.ref=Of(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||6!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b= 1631 Ye(c,a.mode,d),b.return=a,b;b=e(b,c.children||[],d);b.return=a;return b}function m(a,b,c,d,f){if(null===b||9!==b.tag)return b=We(c,a.mode,d,f),b.return=a,b;b=e(b,c,d);b.return=a;return b}function r(a,b,c){if("string"===typeof b||"number"===typeof b)return b=Xe(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case $b:return c=Ve(b,a.mode,c),c.ref=Of(a,null,b),c.return=a,c;case ac:return b=Ye(b,a.mode,c),b.return=a,b}if(Nf(b)||kc(b))return b=We(b,a.mode,c,null),b.return= 1632 a,b;Pf(a,b)}return null}function A(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case $b:return c.key===e?c.type===bc?m(a,b,c.props.children,d,e):k(a,b,c,d):null;case ac:return c.key===e?l(a,b,c,d):null}if(Nf(c)||kc(c))return null!==e?null:m(a,b,c,d,null);Pf(a,c)}return null}function S(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||null,h(b,a,""+d,e); 1633 if("object"===typeof d&&null!==d){switch(d.$$typeof){case $b:return a=a.get(null===d.key?c:d.key)||null,d.type===bc?m(b,a,d.props.children,e,d.key):k(b,a,d,e);case ac:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e)}if(Nf(d)||kc(d))return a=a.get(c)||null,m(b,a,d,e,null);Pf(b,d)}return null}function B(e,g,h,k){for(var l=null,m=null,p=g,u=g=0,q=null;null!==p&&u<h.length;u++){p.index>u?(q=p,p=null):q=p.sibling;var v=A(e,p,h[u],k);if(null===v){null===p&&(p=q);break}a&&p&&null===v.alternate&&b(e, 1634 p);g=f(v,g,u);null===m?l=v:m.sibling=v;m=v;p=q}if(u===h.length)return c(e,p),l;if(null===p){for(;u<h.length;u++)if(p=r(e,h[u],k))g=f(p,g,u),null===m?l=p:m.sibling=p,m=p;return l}for(p=d(e,p);u<h.length;u++)if(q=S(p,e,u,h[u],k))a&&null!==q.alternate&&p.delete(null===q.key?u:q.key),g=f(q,g,u),null===m?l=q:m.sibling=q,m=q;a&&p.forEach(function(a){return b(e,a)});return l}function P(e,g,h,k){var l=kc(h);"function"!==typeof l?t("150"):void 0;h=l.call(h);null==h?t("151"):void 0;for(var m=l=null,p=g,u=g= 1635 0,q=null,v=h.next();null!==p&&!v.done;u++,v=h.next()){p.index>u?(q=p,p=null):q=p.sibling;var x=A(e,p,v.value,k);if(null===x){p||(p=q);break}a&&p&&null===x.alternate&&b(e,p);g=f(x,g,u);null===m?l=x:m.sibling=x;m=x;p=q}if(v.done)return c(e,p),l;if(null===p){for(;!v.done;u++,v=h.next())v=r(e,v.value,k),null!==v&&(g=f(v,g,u),null===m?l=v:m.sibling=v,m=v);return l}for(p=d(e,p);!v.done;u++,v=h.next())v=S(p,e,u,v.value,k),null!==v&&(a&&null!==v.alternate&&p.delete(null===v.key?u:v.key),g=f(v,g,u),null=== 1636 m?l=v:m.sibling=v,m=v);a&&p.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k="object"===typeof f&&null!==f&&f.type===bc&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case $b:a:{l=f.key;for(k=d;null!==k;){if(k.key===l)if(9===k.tag?f.type===bc:k.type===f.type){c(a,k.sibling);d=e(k,f.type===bc?f.props.children:f.props,h);d.ref=Of(a,k,f);d.return=a;a=d;break a}else{c(a,k);break}else b(a,k);k=k.sibling}f.type===bc?(d=We(f.props.children, 1637 a.mode,h,f.key),d.return=a,a=d):(h=Ve(f,a.mode,h),h.ref=Of(a,d,f),h.return=a,a=h)}return g(a);case ac:a:{for(k=f.key;null!==d;){if(d.key===k)if(6===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[],h);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Ye(f,a.mode,h);d.return=a;a=d}return g(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&8===d.tag?(c(a,d.sibling),d=e(d,f,h),d.return= 1638 a,a=d):(c(a,d),d=Xe(f,a.mode,h),d.return=a,a=d),g(a);if(Nf(f))return B(a,d,f,h);if(kc(f))return P(a,d,f,h);l&&Pf(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 2:case 3:case 0:h=a.type,t("152",h.displayName||h.name||"Component")}return c(a,d)}}var Rf=Qf(!0),Sf=Qf(!1),Tf=null,Uf=null,Vf=!1;function Wf(a,b){var c=new Se(7,null,null,0);c.type="DELETED";c.stateNode=b;c.return=a;c.effectTag=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c} 1639 function Xf(a,b){switch(a.tag){case 7:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 8:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;default:return!1}}function Yf(a){if(Vf){var b=Uf;if(b){var c=b;if(!Xf(a,b)){b=Be(c);if(!b||!Xf(a,b)){a.effectTag|=2;Vf=!1;Tf=a;return}Wf(Tf,c)}Tf=a;Uf=Ce(b)}else a.effectTag|=2,Vf=!1,Tf=a}} 1640 function Zf(a){for(a=a.return;null!==a&&7!==a.tag&&5!==a.tag;)a=a.return;Tf=a}function $f(a){if(a!==Tf)return!1;if(!Vf)return Zf(a),Vf=!0,!1;var b=a.type;if(7!==a.tag||"head"!==b&&"body"!==b&&!Ae(b,a.memoizedProps))for(b=Uf;b;)Wf(a,b),b=Be(b);Zf(a);Uf=Tf?Be(a.stateNode):null;return!0}function ag(){Uf=Tf=null;Vf=!1} 1641 function bg(a){switch(a._reactStatus){case 1:return a._reactResult;case 2:throw a._reactResult;case 0:throw a;default:throw a._reactStatus=0,a.then(function(b){if(0===a._reactStatus){a._reactStatus=1;if("object"===typeof b&&null!==b){var c=b.default;b=void 0!==c&&null!==c?c:b}a._reactResult=b}},function(b){0===a._reactStatus&&(a._reactStatus=2,a._reactResult=b)}),a;}}var cg=Yb.ReactCurrentOwner;function M(a,b,c,d){b.child=null===a?Sf(b,null,c,d):Rf(b,a.child,c,d)} 1642 function dg(a,b,c,d,e){c=c.render;var f=b.ref;if(!J.current&&b.memoizedProps===d&&f===(null!==a?a.ref:null))return eg(a,b,e);c=c(d,f);M(a,b,c,e);b.memoizedProps=d;return b.child}function fg(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.effectTag|=128}function gg(a,b,c,d,e){var f=K(c)?Ge:I.current;f=He(b,f);uf(b,e);c=c(d,f);b.effectTag|=1;M(a,b,c,e);b.memoizedProps=d;return b.child} 1643 function hg(a,b,c,d,e){if(K(c)){var f=!0;Me(b)}else f=!1;uf(b,e);if(null===a)if(null===b.stateNode){var g=K(c)?Ge:I.current,h=c.contextTypes,k=null!==h&&void 0!==h;h=k?He(b,g):Fe;var l=new c(d,h);b.memoizedState=null!==l.state&&void 0!==l.state?l.state:null;l.updater=Jf;b.stateNode=l;l._reactInternalFiber=b;k&&(k=b.stateNode,k.__reactInternalMemoizedUnmaskedChildContext=g,k.__reactInternalMemoizedMaskedChildContext=h);Mf(b,c,d,e);d=!0}else{g=b.stateNode;h=b.memoizedProps;g.props=h;var m=g.context; 1644 k=K(c)?Ge:I.current;k=He(b,k);var r=c.getDerivedStateFromProps;(l="function"===typeof r||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||m!==k)&&Lf(b,g,d,k);af=!1;var A=b.memoizedState;m=g.state=A;var S=b.updateQueue;null!==S&&(kf(b,S,d,g,e),m=b.memoizedState);h!==d||A!==m||J.current||af?("function"===typeof r&&(Ff(b,c,r,d),m=b.memoizedState),(h=af||Kf(b,c,h,d,A,m,k))?(l||"function"!== 1645 typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.effectTag|=4)):("function"===typeof g.componentDidMount&&(b.effectTag|=4),b.memoizedProps=d,b.memoizedState=m),g.props=d,g.state=m,g.context=k,d=h):("function"===typeof g.componentDidMount&&(b.effectTag|=4),d=!1)}else g=b.stateNode,h= 1646 b.memoizedProps,g.props=h,m=g.context,k=K(c)?Ge:I.current,k=He(b,k),r=c.getDerivedStateFromProps,(l="function"===typeof r||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||m!==k)&&Lf(b,g,d,k),af=!1,m=b.memoizedState,A=g.state=m,S=b.updateQueue,null!==S&&(kf(b,S,d,g,e),A=b.memoizedState),h!==d||m!==A||J.current||af?("function"===typeof r&&(Ff(b,c,r,d),A=b.memoizedState),(r=af||Kf(b,c,h,d, 1647 m,A,k))?(l||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,A,k),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,A,k)),"function"===typeof g.componentDidUpdate&&(b.effectTag|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.effectTag|=256)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=4),"function"!== 1648 typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=256),b.memoizedProps=d,b.memoizedState=A),g.props=d,g.state=A,g.context=k,d=r):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&m===a.memoizedState||(b.effectTag|=256),d=!1);return ig(a,b,c,d,f,e)} 1649 function ig(a,b,c,d,e,f){fg(a,b);var g=0!==(b.effectTag&64);if(!d&&!g)return e&&Ne(b,c,!1),eg(a,b,f);d=b.stateNode;cg.current=b;var h=g?null:d.render();b.effectTag|=1;null!==a&&g&&(M(a,b,null,f),b.child=null);M(a,b,h,f);b.memoizedState=d.state;b.memoizedProps=d.props;e&&Ne(b,c,!0);return b.child}function jg(a){var b=a.stateNode;b.pendingContext?Ke(a,b.pendingContext,b.pendingContext!==b.context):b.context&&Ke(a,b.context,!1);Af(a,b.containerInfo)} 1650 function ng(a,b){if(a&&a.defaultProps){b=n({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c])}return b} 1651 function og(a,b,c,d){null!==a?t("155"):void 0;var e=b.pendingProps;if("object"===typeof c&&null!==c&&"function"===typeof c.then){c=bg(c);var f=c;f="function"===typeof f?Te(f)?3:1:void 0!==f&&null!==f&&f.$$typeof?14:4;f=b.tag=f;var g=ng(c,e);switch(f){case 1:return gg(a,b,c,g,d);case 3:return hg(a,b,c,g,d);case 14:return dg(a,b,c,g,d);default:t("283",c)}}f=He(b,I.current);uf(b,d);f=c(e,f);b.effectTag|=1;if("object"===typeof f&&null!==f&&"function"===typeof f.render&&void 0===f.$$typeof){b.tag=2;K(c)? 1652 (g=!0,Me(b)):g=!1;b.memoizedState=null!==f.state&&void 0!==f.state?f.state:null;var h=c.getDerivedStateFromProps;"function"===typeof h&&Ff(b,c,h,e);f.updater=Jf;b.stateNode=f;f._reactInternalFiber=b;Mf(b,c,e,d);return ig(a,b,c,!0,g,d)}b.tag=0;M(a,b,f,d);b.memoizedProps=e;return b.child} 1653 function eg(a,b,c){null!==a&&(b.firstContextDependency=a.firstContextDependency);var d=b.childExpirationTime;if(0===d||d>c)return null;null!==a&&b.child!==a.child?t("153"):void 0;if(null!==b.child){a=b.child;c=Ue(a,a.pendingProps,a.expirationTime);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Ue(a,a.pendingProps,a.expirationTime),c.return=b;c.sibling=null}return b.child} 1654 function pg(a,b,c){var d=b.expirationTime;if(!J.current&&(0===d||d>c)){switch(b.tag){case 5:jg(b);ag();break;case 7:Cf(b);break;case 2:K(b.type)&&Me(b);break;case 3:K(b.type._reactResult)&&Me(b);break;case 6:Af(b,b.stateNode.containerInfo);break;case 12:sf(b,b.memoizedProps.value)}return eg(a,b,c)}b.expirationTime=0;switch(b.tag){case 4:return og(a,b,b.type,c);case 0:return gg(a,b,b.type,b.pendingProps,c);case 1:var e=b.type._reactResult;d=b.pendingProps;a=gg(a,b,e,ng(e,d),c);b.memoizedProps=d;return a; 1655 case 2:return hg(a,b,b.type,b.pendingProps,c);case 3:return e=b.type._reactResult,d=b.pendingProps,a=hg(a,b,e,ng(e,d),c),b.memoizedProps=d,a;case 5:jg(b);d=b.updateQueue;null===d?t("282"):void 0;e=b.memoizedState;e=null!==e?e.element:null;kf(b,d,b.pendingProps,null,c);d=b.memoizedState.element;if(d===e)ag(),b=eg(a,b,c);else{e=b.stateNode;if(e=(null===a||null===a.child)&&e.hydrate)Uf=Ce(b.stateNode.containerInfo),Tf=b,e=Vf=!0;e?(b.effectTag|=2,b.child=Sf(b,null,d,c)):(M(a,b,d,c),ag());b=b.child}return b; 1656 case 7:Cf(b);null===a&&Yf(b);d=b.type;e=b.pendingProps;var f=null!==a?a.memoizedProps:null,g=e.children;Ae(d,e)?g=null:null!==f&&Ae(d,f)&&(b.effectTag|=16);fg(a,b);1073741823!==c&&b.mode&1&&e.hidden?(b.expirationTime=1073741823,b.memoizedProps=e,b=null):(M(a,b,g,c),b.memoizedProps=e,b=b.child);return b;case 8:return null===a&&Yf(b),b.memoizedProps=b.pendingProps,null;case 16:return null;case 6:return Af(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Rf(b,null,d,c):M(a,b,d,c),b.memoizedProps= 1657 d,b.child;case 13:return dg(a,b,b.type,b.pendingProps,c);case 14:return e=b.type._reactResult,d=b.pendingProps,a=dg(a,b,e,ng(e,d),c),b.memoizedProps=d,a;case 9:return d=b.pendingProps,M(a,b,d,c),b.memoizedProps=d,b.child;case 10:return d=b.pendingProps.children,M(a,b,d,c),b.memoizedProps=d,b.child;case 15:return d=b.pendingProps,M(a,b,d.children,c),b.memoizedProps=d,b.child;case 12:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;b.memoizedProps=e;sf(b,f);if(null!==g){var h=g.value; 1658 f=h===f&&(0!==h||1/h===1/f)||h!==h&&f!==f?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0;if(0===f){if(g.children===e.children&&!J.current){b=eg(a,b,c);break a}}else for(g=b.child,null!==g&&(g.return=b);null!==g;){h=g.firstContextDependency;if(null!==h){do{if(h.context===d&&0!==(h.observedBits&f)){if(2===g.tag||3===g.tag){var k=df(c);k.tag=2;ff(g,k)}if(0===g.expirationTime||g.expirationTime>c)g.expirationTime=c;k=g.alternate;null!==k&&(0===k.expirationTime|| 1659 k.expirationTime>c)&&(k.expirationTime=c);for(var l=g.return;null!==l;){k=l.alternate;if(0===l.childExpirationTime||l.childExpirationTime>c)l.childExpirationTime=c,null!==k&&(0===k.childExpirationTime||k.childExpirationTime>c)&&(k.childExpirationTime=c);else if(null!==k&&(0===k.childExpirationTime||k.childExpirationTime>c))k.childExpirationTime=c;else break;l=l.return}}k=g.child;h=h.next}while(null!==h)}else k=12===g.tag?g.type===b.type?null:g.child:g.child;if(null!==k)k.return=g;else for(k=g;null!== 1660 k;){if(k===b){k=null;break}g=k.sibling;if(null!==g){g.return=k.return;k=g;break}k=k.return}g=k}}M(a,b,e.children,c);b=b.child}return b;case 11:return f=b.type,d=b.pendingProps,e=d.children,uf(b,c),f=vf(f,d.unstable_observedBits),e=e(f),b.effectTag|=1,M(a,b,e,c),b.memoizedProps=d,b.child;default:t("156")}}function qg(a){a.effectTag|=4}var rg=void 0,sg=void 0,tg=void 0;rg=function(){}; 1661 sg=function(a,b,c,d,e){var f=a.memoizedProps;if(f!==d){var g=b.stateNode;zf(L.current);a=null;switch(c){case "input":f=zc(g,f);d=zc(g,d);a=[];break;case "option":f=de(g,f);d=de(g,d);a=[];break;case "select":f=n({},f,{value:void 0});d=n({},d,{value:void 0});a=[];break;case "textarea":f=fe(g,f);d=fe(g,d);a=[];break;default:"function"!==typeof f.onClick&&"function"===typeof d.onClick&&(g.onclick=we)}te(c,d);g=c=void 0;var h=null;for(c in f)if(!d.hasOwnProperty(c)&&f.hasOwnProperty(c)&&null!=f[c])if("style"=== 1662 c){var k=f[c];for(g in k)k.hasOwnProperty(g)&&(h||(h={}),h[g]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(sa.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in d){var l=d[c];k=null!=f?f[c]:void 0;if(d.hasOwnProperty(c)&&l!==k&&(null!=l||null!=k))if("style"===c)if(k){for(g in k)!k.hasOwnProperty(g)||l&&l.hasOwnProperty(g)||(h||(h={}),h[g]="");for(g in l)l.hasOwnProperty(g)&&k[g]!==l[g]&&(h|| 1663 (h={}),h[g]=l[g])}else h||(a||(a=[]),a.push(c,h)),h=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,k=k?k.__html:void 0,null!=l&&k!==l&&(a=a||[]).push(c,""+l)):"children"===c?k===l||"string"!==typeof l&&"number"!==typeof l||(a=a||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(sa.hasOwnProperty(c)?(null!=l&&ve(e,c),a||k===l||(a=[])):(a=a||[]).push(c,l))}h&&(a=a||[]).push("style",h);e=a;(b.updateQueue=e)&&qg(b)}};tg=function(a,b,c,d){c!==d&&qg(b)}; 1664 function ug(a,b){var c=b.source,d=b.stack;null===d&&null!==c&&(d=mc(c));null!==c&&lc(c.type);b=b.value;null!==a&&2===a.tag&&lc(a.type);try{console.error(b)}catch(e){setTimeout(function(){throw e;})}}function vg(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null)}catch(c){wg(a,c)}else b.current=null} 1665 function xg(a){"function"===typeof Pe&&Pe(a);switch(a.tag){case 2:case 3:vg(a);var b=a.stateNode;if("function"===typeof b.componentWillUnmount)try{b.props=a.memoizedProps,b.state=a.memoizedState,b.componentWillUnmount()}catch(c){wg(a,c)}break;case 7:vg(a);break;case 6:yg(a)}}function zg(a){return 7===a.tag||5===a.tag||6===a.tag} 1666 function Ag(a){a:{for(var b=a.return;null!==b;){if(zg(b)){var c=b;break a}b=b.return}t("160");c=void 0}var d=b=void 0;switch(c.tag){case 7:b=c.stateNode;d=!1;break;case 5:b=c.stateNode.containerInfo;d=!0;break;case 6:b=c.stateNode.containerInfo;d=!0;break;default:t("161")}c.effectTag&16&&(oe(b,""),c.effectTag&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||zg(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;7!==c.tag&&8!==c.tag;){if(c.effectTag&2)continue b; 1667 if(null===c.child||6===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.effectTag&2)){c=c.stateNode;break a}}for(var e=a;;){if(7===e.tag||8===e.tag)if(c)if(d){var f=b,g=e.stateNode,h=c;8===f.nodeType?f.parentNode.insertBefore(g,h):f.insertBefore(g,h)}else b.insertBefore(e.stateNode,c);else d?(f=b,g=e.stateNode,8===f.nodeType?(h=f.parentNode,h.insertBefore(g,f)):(h=f,h.appendChild(g)),null===h.onclick&&(h.onclick=we)):b.appendChild(e.stateNode);else if(6!==e.tag&&null!==e.child){e.child.return= 1668 e;e=e.child;continue}if(e===a)break;for(;null===e.sibling;){if(null===e.return||e.return===a)return;e=e.return}e.sibling.return=e.return;e=e.sibling}} 1669 function yg(a){for(var b=a,c=!1,d=void 0,e=void 0;;){if(!c){c=b.return;a:for(;;){null===c?t("160"):void 0;switch(c.tag){case 7:d=c.stateNode;e=!1;break a;case 5:d=c.stateNode.containerInfo;e=!0;break a;case 6:d=c.stateNode.containerInfo;e=!0;break a}c=c.return}c=!0}if(7===b.tag||8===b.tag){a:for(var f=b,g=f;;)if(xg(g),null!==g.child&&6!==g.tag)g.child.return=g,g=g.child;else{if(g===f)break;for(;null===g.sibling;){if(null===g.return||g.return===f)break a;g=g.return}g.sibling.return=g.return;g=g.sibling}e? 1670 (f=d,g=b.stateNode,8===f.nodeType?f.parentNode.removeChild(g):f.removeChild(g)):d.removeChild(b.stateNode)}else if(6===b.tag?(d=b.stateNode.containerInfo,e=!0):xg(b),null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return;b=b.return;6===b.tag&&(c=!1)}b.sibling.return=b.return;b=b.sibling}} 1671 function Bg(a,b){switch(b.tag){case 2:case 3:break;case 7:var c=b.stateNode;if(null!=c){var d=b.memoizedProps,e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[Ja]=d;"input"===a&&"radio"===d.type&&null!=d.name&&Cc(c,d);ue(a,e);b=ue(a,d);for(e=0;e<f.length;e+=2){var g=f[e],h=f[e+1];"style"===g?re(c,h):"dangerouslySetInnerHTML"===g?ne(c,h):"children"===g?oe(c,h):xc(c,g,h,b)}switch(a){case "input":Dc(c,d);break;case "textarea":he(c,d);break;case "select":a=c._wrapperState.wasMultiple, 1672 c._wrapperState.wasMultiple=!!d.multiple,f=d.value,null!=f?ee(c,!!d.multiple,f,!1):a!==!!d.multiple&&(null!=d.defaultValue?ee(c,!!d.multiple,d.defaultValue,!0):ee(c,!!d.multiple,d.multiple?[]:"",!1))}}}break;case 8:null===b.stateNode?t("162"):void 0;b.stateNode.nodeValue=b.memoizedProps;break;case 5:break;case 15:break;case 16:break;default:t("163")}}function Cg(a,b,c){c=df(c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Dg(d);ug(a,b)};return c} 1673 function Eg(a,b,c){c=df(c);c.tag=3;var d=a.stateNode;null!==d&&"function"===typeof d.componentDidCatch&&(c.callback=function(){null===Fg?Fg=new Set([this]):Fg.add(this);var c=b.value,d=b.stack;ug(a,b);this.componentDidCatch(c,{componentStack:null!==d?d:""})});return c} 1674 function Gg(a){switch(a.tag){case 2:K(a.type)&&Ie(a);var b=a.effectTag;return b&1024?(a.effectTag=b&-1025|64,a):null;case 3:return K(a.type._reactResult)&&Ie(a),b=a.effectTag,b&1024?(a.effectTag=b&-1025|64,a):null;case 5:return Bf(a),Je(a),b=a.effectTag,0!==(b&64)?t("285"):void 0,a.effectTag=b&-1025|64,a;case 7:return Df(a),null;case 16:return b=a.effectTag,b&1024?(a.effectTag=b&-1025|64,a):null;case 6:return Bf(a),null;case 12:return tf(a),null;default:return null}} 1675 var Hg={readContext:vf},Ig=Yb.ReactCurrentOwner,Jg=0,Kg=0,Lg=!1,N=null,Mg=null,O=0,Ng=!1,Q=null,Og=!1,Fg=null;function Pg(){if(null!==N)for(var a=N.return;null!==a;){var b=a;switch(b.tag){case 2:var c=b.type.childContextTypes;null!==c&&void 0!==c&&Ie(b);break;case 3:c=b.type._reactResult.childContextTypes;null!==c&&void 0!==c&&Ie(b);break;case 5:Bf(b);Je(b);break;case 7:Df(b);break;case 6:Bf(b);break;case 12:tf(b)}a=a.return}Mg=null;O=0;Ng=!1;N=null} 1676 function Qg(a){for(;;){var b=a.alternate,c=a.return,d=a.sibling;if(0===(a.effectTag&512)){var e=b;b=a;var f=b.pendingProps;switch(b.tag){case 0:case 1:break;case 2:K(b.type)&&Ie(b);break;case 3:K(b.type._reactResult)&&Ie(b);break;case 5:Bf(b);Je(b);f=b.stateNode;f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null);if(null===e||null===e.child)$f(b),b.effectTag&=-3;rg(b);break;case 7:Df(b);var g=zf(yf.current),h=b.type;if(null!==e&&null!=b.stateNode)sg(e,b,h,f,g),e.ref!==b.ref&&(b.effectTag|= 1677 128);else if(f){var k=zf(L.current);if($f(b)){f=b;e=f.stateNode;var l=f.type,m=f.memoizedProps,r=g;e[Ia]=f;e[Ja]=m;h=void 0;g=l;switch(g){case "iframe":case "object":F("load",e);break;case "video":case "audio":for(l=0;l<fb.length;l++)F(fb[l],e);break;case "source":F("error",e);break;case "img":case "image":case "link":F("error",e);F("load",e);break;case "form":F("reset",e);F("submit",e);break;case "details":F("toggle",e);break;case "input":Bc(e,m);F("invalid",e);ve(r,"onChange");break;case "select":e._wrapperState= 1678 {wasMultiple:!!m.multiple};F("invalid",e);ve(r,"onChange");break;case "textarea":ge(e,m),F("invalid",e),ve(r,"onChange")}te(g,m);l=null;for(h in m)m.hasOwnProperty(h)&&(k=m[h],"children"===h?"string"===typeof k?e.textContent!==k&&(l=["children",k]):"number"===typeof k&&e.textContent!==""+k&&(l=["children",""+k]):sa.hasOwnProperty(h)&&null!=k&&ve(r,h));switch(g){case "input":Wb(e);Fc(e,m,!0);break;case "textarea":Wb(e);ie(e,m);break;case "select":case "option":break;default:"function"===typeof m.onClick&& 1679 (e.onclick=we)}h=l;f.updateQueue=h;f=null!==h?!0:!1;f&&qg(b)}else{m=b;e=h;r=f;l=9===g.nodeType?g:g.ownerDocument;k===je.html&&(k=ke(e));k===je.html?"script"===e?(e=l.createElement("div"),e.innerHTML="<script>\x3c/script>",l=e.removeChild(e.firstChild)):"string"===typeof r.is?l=l.createElement(e,{is:r.is}):(l=l.createElement(e),"select"===e&&r.multiple&&(l.multiple=!0)):l=l.createElementNS(k,e);e=l;e[Ia]=m;e[Ja]=f;a:for(m=e,r=b,l=r.child;null!==l;){if(7===l.tag||8===l.tag)m.appendChild(l.stateNode); 1680 else if(6!==l.tag&&null!==l.child){l.child.return=l;l=l.child;continue}if(l===r)break;for(;null===l.sibling;){if(null===l.return||l.return===r)break a;l=l.return}l.sibling.return=l.return;l=l.sibling}r=e;l=h;m=f;var A=g,S=ue(l,m);switch(l){case "iframe":case "object":F("load",r);g=m;break;case "video":case "audio":for(g=0;g<fb.length;g++)F(fb[g],r);g=m;break;case "source":F("error",r);g=m;break;case "img":case "image":case "link":F("error",r);F("load",r);g=m;break;case "form":F("reset",r);F("submit", 1681 r);g=m;break;case "details":F("toggle",r);g=m;break;case "input":Bc(r,m);g=zc(r,m);F("invalid",r);ve(A,"onChange");break;case "option":g=de(r,m);break;case "select":r._wrapperState={wasMultiple:!!m.multiple};g=n({},m,{value:void 0});F("invalid",r);ve(A,"onChange");break;case "textarea":ge(r,m);g=fe(r,m);F("invalid",r);ve(A,"onChange");break;default:g=m}te(l,g);k=void 0;var B=l,P=r,v=g;for(k in v)if(v.hasOwnProperty(k)){var p=v[k];"style"===k?re(P,p):"dangerouslySetInnerHTML"===k?(p=p?p.__html:void 0, 1682 null!=p&&ne(P,p)):"children"===k?"string"===typeof p?("textarea"!==B||""!==p)&&oe(P,p):"number"===typeof p&&oe(P,""+p):"suppressContentEditableWarning"!==k&&"suppressHydrationWarning"!==k&&"autoFocus"!==k&&(sa.hasOwnProperty(k)?null!=p&&ve(A,k):null!=p&&xc(P,k,p,S))}switch(l){case "input":Wb(r);Fc(r,m,!1);break;case "textarea":Wb(r);ie(r,m);break;case "option":null!=m.value&&r.setAttribute("value",""+yc(m.value));break;case "select":g=r;g.multiple=!!m.multiple;r=m.value;null!=r?ee(g,!!m.multiple, 1683 r,!1):null!=m.defaultValue&&ee(g,!!m.multiple,m.defaultValue,!0);break;default:"function"===typeof g.onClick&&(r.onclick=we)}(f=ze(h,f))&&qg(b);b.stateNode=e}null!==b.ref&&(b.effectTag|=128)}else null===b.stateNode?t("166"):void 0;break;case 8:e&&null!=b.stateNode?tg(e,b,e.memoizedProps,f):("string"!==typeof f&&(null===b.stateNode?t("166"):void 0),e=zf(yf.current),zf(L.current),$f(b)?(f=b,h=f.stateNode,e=f.memoizedProps,h[Ia]=f,(f=h.nodeValue!==e)&&qg(b)):(h=b,f=(9===e.nodeType?e:e.ownerDocument).createTextNode(f), 1684 f[Ia]=h,b.stateNode=f));break;case 13:case 14:break;case 16:break;case 9:break;case 10:break;case 15:break;case 6:Bf(b);rg(b);break;case 12:tf(b);break;case 11:break;case 4:t("167");default:t("156")}b=N=null;f=a;if(1073741823===O||1073741823!==f.childExpirationTime){h=0;for(e=f.child;null!==e;){g=e.expirationTime;m=e.childExpirationTime;if(0===h||0!==g&&g<h)h=g;if(0===h||0!==m&&m<h)h=m;e=e.sibling}f.childExpirationTime=h}if(null!==b)return b;null!==c&&0===(c.effectTag&512)&&(null===c.firstEffect&& 1685 (c.firstEffect=a.firstEffect),null!==a.lastEffect&&(null!==c.lastEffect&&(c.lastEffect.nextEffect=a.firstEffect),c.lastEffect=a.lastEffect),1<a.effectTag&&(null!==c.lastEffect?c.lastEffect.nextEffect=a:c.firstEffect=a,c.lastEffect=a))}else{a=Gg(a,O);if(null!==a)return a.effectTag&=511,a;null!==c&&(c.firstEffect=c.lastEffect=null,c.effectTag|=512)}if(null!==d)return d;if(null!==c)a=c;else break}return null}function Rg(a){var b=pg(a.alternate,a,O);null===b&&(b=Qg(a));Ig.current=null;return b} 1686 function Sg(a,b,c){Lg?t("243"):void 0;Lg=!0;Ig.currentDispatcher=Hg;var d=a.nextExpirationTimeToWorkOn;if(d!==O||a!==Mg||null===N)Pg(),Mg=a,O=d,N=Ue(Mg.current,null,O),a.pendingCommitExpirationTime=0;var e=!1;do{try{if(b)for(;null!==N&&!Tg();)N=Rg(N);else for(;null!==N;)N=Rg(N)}catch(r){if(null===N)e=!0,Dg(r);else{null===N?t("271"):void 0;var f=N,g=f.return;if(null===g)e=!0,Dg(r);else{a:{var h=g,k=f,l=r;g=O;k.effectTag|=512;k.firstEffect=k.lastEffect=null;Ng=!0;l=nf(l,k);do{switch(h.tag){case 5:h.effectTag|= 1687 1024;h.expirationTime=g;g=Cg(h,l,g);gf(h,g);break a;case 2:case 3:k=l;var m=h.stateNode;if(0===(h.effectTag&64)&&null!==m&&"function"===typeof m.componentDidCatch&&(null===Fg||!Fg.has(m))){h.effectTag|=1024;h.expirationTime=g;g=Eg(h,k,g);gf(h,g);break a}}h=h.return}while(null!==h)}N=Qg(f);continue}}}break}while(1);Lg=!1;rf=qf=pf=Ig.currentDispatcher=null;if(e)Mg=null,a.finishedWork=null;else if(null!==N)a.finishedWork=null;else{b=a.current.alternate;null===b?t("281"):void 0;Mg=null;if(Ng){e=a.latestPendingTime; 1688 f=a.latestSuspendedTime;g=a.latestPingedTime;if(0!==e&&e>d||0!==f&&f>d||0!==g&&g>d){a.didError=!1;c=a.latestPingedTime;0!==c&&c<=d&&(a.latestPingedTime=0);c=a.earliestPendingTime;b=a.latestPendingTime;c===d?a.earliestPendingTime=b===d?a.latestPendingTime=0:b:b===d&&(a.latestPendingTime=c);c=a.earliestSuspendedTime;b=a.latestSuspendedTime;0===c?a.earliestSuspendedTime=a.latestSuspendedTime=d:c>d?a.earliestSuspendedTime=d:b<d&&(a.latestSuspendedTime=d);$e(d,a);a.expirationTime=a.expirationTime;return}if(!a.didError&& 1689 !c){a.didError=!0;a.nextExpirationTimeToWorkOn=d;d=a.expirationTime=1;a.expirationTime=d;return}}a.pendingCommitExpirationTime=d;a.finishedWork=b}} 1690 function wg(a,b){var c;a:{Lg&&!Og?t("263"):void 0;for(c=a.return;null!==c;){switch(c.tag){case 2:case 3:var d=c.stateNode;if("function"===typeof c.type.getDerivedStateFromCatch||"function"===typeof d.componentDidCatch&&(null===Fg||!Fg.has(d))){a=nf(b,a);a=Eg(c,a,1);ff(c,a);If(c,1);c=void 0;break a}break;case 5:a=nf(b,a);a=Cg(c,a,1);ff(c,a);If(c,1);c=void 0;break a}c=c.return}5===a.tag&&(c=nf(b,a),c=Cg(a,c,1),ff(a,c),If(a,1));c=void 0}return c} 1691 function Hf(a,b){0!==Kg?a=Kg:Lg?a=Og?1:O:b.mode&1?(a=Ug?2+10*(((a-2+15)/10|0)+1):2+25*(((a-2+500)/25|0)+1),null!==Mg&&a===O&&(a+=1)):a=1;Ug&&(0===Vg||a>Vg)&&(Vg=a);return a} 1692 function If(a,b){a:{if(0===a.expirationTime||a.expirationTime>b)a.expirationTime=b;var c=a.alternate;null!==c&&(0===c.expirationTime||c.expirationTime>b)&&(c.expirationTime=b);var d=a.return;if(null===d&&5===a.tag)a=a.stateNode;else{for(;null!==d;){c=d.alternate;if(0===d.childExpirationTime||d.childExpirationTime>b)d.childExpirationTime=b;null!==c&&(0===c.childExpirationTime||c.childExpirationTime>b)&&(c.childExpirationTime=b);if(null===d.return&&5===d.tag){a=d.stateNode;break a}d=d.return}a=null}}if(null!== 1693 a){!Lg&&0!==O&&b<O&&Pg();Ze(a,b);if(!Lg||Og||Mg!==a){b=a;a=a.expirationTime;if(null===b.nextScheduledRoot)b.expirationTime=a,null===T?(U=T=b,b.nextScheduledRoot=b):(T=T.nextScheduledRoot=b,T.nextScheduledRoot=U);else if(c=b.expirationTime,0===c||a<c)b.expirationTime=a;V||(W?Wg&&(Y=b,Z=1,Xg(b,1,!0)):1===a?Yg(1,null):Zg(b,a))}$g>ah&&($g=0,t("185"))}}function bh(a,b,c,d,e){var f=Kg;Kg=1;try{return a(b,c,d,e)}finally{Kg=f}} 1694 var U=null,T=null,ch=0,dh=void 0,V=!1,Y=null,Z=0,Vg=0,eh=!1,fh=!1,gh=null,hh=null,W=!1,Wg=!1,Ug=!1,ih=null,jh=ba.unstable_now(),kh=(jh/10|0)+2,lh=kh,ah=50,$g=0,mh=null,nh=1;function oh(){kh=((ba.unstable_now()-jh)/10|0)+2}function Zg(a,b){if(0!==ch){if(b>ch)return;null!==dh&&ba.unstable_cancelScheduledWork(dh)}ch=b;a=ba.unstable_now()-jh;dh=ba.unstable_scheduleWork(ph,{timeout:10*(b-2)-a})}function Gf(){if(V)return lh;qh();if(0===Z||1073741823===Z)oh(),lh=kh;return lh} 1695 function qh(){var a=0,b=null;if(null!==T)for(var c=T,d=U;null!==d;){var e=d.expirationTime;if(0===e){null===c||null===T?t("244"):void 0;if(d===d.nextScheduledRoot){U=T=d.nextScheduledRoot=null;break}else if(d===U)U=e=d.nextScheduledRoot,T.nextScheduledRoot=e,d.nextScheduledRoot=null;else if(d===T){T=c;T.nextScheduledRoot=U;d.nextScheduledRoot=null;break}else c.nextScheduledRoot=d.nextScheduledRoot,d.nextScheduledRoot=null;d=c.nextScheduledRoot}else{if(0===a||e<a)a=e,b=d;if(d===T)break;if(1===a)break; 1696 c=d;d=d.nextScheduledRoot}}Y=b;Z=a}function ph(a){if(a.didTimeout&&null!==U){oh();var b=U;do{var c=b.expirationTime;0!==c&&kh>=c&&(b.nextExpirationTimeToWorkOn=kh);b=b.nextScheduledRoot}while(b!==U)}Yg(0,a)} 1697 function Yg(a,b){hh=b;qh();if(null!==hh)for(oh(),lh=kh;null!==Y&&0!==Z&&(0===a||a>=Z)&&(!eh||kh>=Z);)Xg(Y,Z,kh>=Z),qh(),oh(),lh=kh;else for(;null!==Y&&0!==Z&&(0===a||a>=Z);)Xg(Y,Z,!0),qh();null!==hh&&(ch=0,dh=null);0!==Z&&Zg(Y,Z);hh=null;eh=!1;$g=0;mh=null;if(null!==ih)for(a=ih,ih=null,b=0;b<a.length;b++){var c=a[b];try{c._onComplete()}catch(d){fh||(fh=!0,gh=d)}}if(fh)throw a=gh,gh=null,fh=!1,a;} 1698 function Xg(a,b,c){V?t("245"):void 0;V=!0;if(null===hh||c){var d=a.finishedWork;null!==d?rh(a,d,b):(a.finishedWork=null,Sg(a,!1,c),d=a.finishedWork,null!==d&&rh(a,d,b))}else d=a.finishedWork,null!==d?rh(a,d,b):(a.finishedWork=null,Sg(a,!0,c),d=a.finishedWork,null!==d&&(Tg()?a.finishedWork=d:rh(a,d,b)));V=!1} 1699 function rh(a,b,c){var d=a.firstBatch;if(null!==d&&d._expirationTime<=c&&(null===ih?ih=[d]:ih.push(d),d._defer)){a.finishedWork=b;a.expirationTime=0;return}a.finishedWork=null;a===mh?$g++:(mh=a,$g=0);Og=Lg=!0;a.current===b?t("177"):void 0;c=a.pendingCommitExpirationTime;0===c?t("261"):void 0;a.pendingCommitExpirationTime=0;d=b.expirationTime;var e=b.childExpirationTime;d=0===d||0!==e&&e<d?e:d;a.didError=!1;0===d?(a.earliestPendingTime=0,a.latestPendingTime=0,a.earliestSuspendedTime=0,a.latestSuspendedTime= 1700 0,a.latestPingedTime=0):(e=a.latestPendingTime,0!==e&&(e<d?a.earliestPendingTime=a.latestPendingTime=0:a.earliestPendingTime<d&&(a.earliestPendingTime=a.latestPendingTime)),e=a.earliestSuspendedTime,0===e?Ze(a,d):d>a.latestSuspendedTime?(a.earliestSuspendedTime=0,a.latestSuspendedTime=0,a.latestPingedTime=0,Ze(a,d)):d<e&&Ze(a,d));$e(0,a);Ig.current=null;1<b.effectTag?null!==b.lastEffect?(b.lastEffect.nextEffect=b,d=b.firstEffect):d=b:d=b.firstEffect;xe=Gd;e=Td();if(Ud(e)){if("selectionStart"in e)var f= 1701 {start:e.selectionStart,end:e.selectionEnd};else a:{f=(f=e.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&0!==g.rangeCount){f=g.anchorNode;var h=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{f.nodeType,k.nodeType}catch(Xa){f=null;break a}var l=0,m=-1,r=-1,A=0,S=0,B=e,P=null;b:for(;;){for(var v;;){B!==f||0!==h&&3!==B.nodeType||(m=l+h);B!==k||0!==g&&3!==B.nodeType||(r=l+g);3===B.nodeType&&(l+=B.nodeValue.length);if(null===(v=B.firstChild))break;P=B;B=v}for(;;){if(B=== 1702 e)break b;P===f&&++A===h&&(m=l);P===k&&++S===g&&(r=l);if(null!==(v=B.nextSibling))break;B=P;P=B.parentNode}B=v}f=-1===m||-1===r?null:{start:m,end:r}}else f=null}f=f||{start:0,end:0}}else f=null;ye={focusedElem:e,selectionRange:f};Gd=!1;for(Q=d;null!==Q;){e=!1;f=void 0;try{for(;null!==Q;){if(Q.effectTag&256){var p=Q.alternate;a:switch(h=Q,h.tag){case 2:case 3:if(h.effectTag&256&&null!==p){var u=p.memoizedProps,x=p.memoizedState,R=h.stateNode;R.props=h.memoizedProps;R.state=h.memoizedState;var yh=R.getSnapshotBeforeUpdate(u, 1703 x);R.__reactInternalSnapshotBeforeUpdate=yh}break a;case 5:case 7:case 8:case 6:break a;default:t("163")}}Q=Q.nextEffect}}catch(Xa){e=!0,f=Xa}e&&(null===Q?t("178"):void 0,wg(Q,f),null!==Q&&(Q=Q.nextEffect))}for(Q=d;null!==Q;){p=!1;u=void 0;try{for(;null!==Q;){var w=Q.effectTag;w&16&&oe(Q.stateNode,"");if(w&128){var y=Q.alternate;if(null!==y){var q=y.ref;null!==q&&("function"===typeof q?q(null):q.current=null)}}switch(w&14){case 2:Ag(Q);Q.effectTag&=-3;break;case 6:Ag(Q);Q.effectTag&=-3;Bg(Q.alternate, 1704 Q);break;case 4:Bg(Q.alternate,Q);break;case 8:x=Q,yg(x),x.return=null,x.child=null,x.alternate&&(x.alternate.child=null,x.alternate.return=null)}Q=Q.nextEffect}}catch(Xa){p=!0,u=Xa}p&&(null===Q?t("178"):void 0,wg(Q,u),null!==Q&&(Q=Q.nextEffect))}q=ye;y=Td();w=q.focusedElem;u=q.selectionRange;if(y!==w&&w&&w.ownerDocument&&Sd(w.ownerDocument.documentElement,w)){null!==u&&Ud(w)&&(y=u.start,q=u.end,void 0===q&&(q=y),"selectionStart"in w?(w.selectionStart=y,w.selectionEnd=Math.min(q,w.value.length)): 1705 (p=w.ownerDocument||document,y=(p?p.defaultView:window).getSelection(),x=w.textContent.length,q=Math.min(u.start,x),u=void 0===u.end?q:Math.min(u.end,x),!y.extend&&q>u&&(x=u,u=q,q=x),x=Rd(w,q),R=Rd(w,u),x&&R&&(1!==y.rangeCount||y.anchorNode!==x.node||y.anchorOffset!==x.offset||y.focusNode!==R.node||y.focusOffset!==R.offset)&&(p=p.createRange(),p.setStart(x.node,x.offset),y.removeAllRanges(),q>u?(y.addRange(p),y.extend(R.node,R.offset)):(p.setEnd(R.node,R.offset),y.addRange(p)))));y=[];for(q=w;q=q.parentNode;)1=== 1706 q.nodeType&&y.push({element:q,left:q.scrollLeft,top:q.scrollTop});"function"===typeof w.focus&&w.focus();for(w=0;w<y.length;w++)q=y[w],q.element.scrollLeft=q.left,q.element.scrollTop=q.top}ye=null;Gd=!!xe;xe=null;a.current=b;for(Q=d;null!==Q;){d=!1;w=void 0;try{for(y=c;null!==Q;){var Sa=Q.effectTag;if(Sa&36){var oc=Q.alternate;q=Q;p=y;switch(q.tag){case 2:case 3:var X=q.stateNode;if(q.effectTag&4)if(null===oc)X.props=q.memoizedProps,X.state=q.memoizedState,X.componentDidMount();else{var Ih=oc.memoizedProps, 1707 Jh=oc.memoizedState;X.props=q.memoizedProps;X.state=q.memoizedState;X.componentDidUpdate(Ih,Jh,X.__reactInternalSnapshotBeforeUpdate)}var kg=q.updateQueue;null!==kg&&(X.props=q.memoizedProps,X.state=q.memoizedState,lf(q,kg,X,p));break;case 5:var lg=q.updateQueue;if(null!==lg){u=null;if(null!==q.child)switch(q.child.tag){case 7:u=q.child.stateNode;break;case 2:case 3:u=q.child.stateNode}lf(q,lg,u,p)}break;case 7:var Kh=q.stateNode;null===oc&&q.effectTag&4&&ze(q.type,q.memoizedProps)&&Kh.focus();break; 1708 case 8:break;case 6:break;case 15:break;case 16:break;default:t("163")}}if(Sa&128){var Ac=Q.ref;if(null!==Ac){var mg=Q.stateNode;switch(Q.tag){case 7:var Pd=mg;break;default:Pd=mg}"function"===typeof Ac?Ac(Pd):Ac.current=Pd}}var Lh=Q.nextEffect;Q.nextEffect=null;Q=Lh}}catch(Xa){d=!0,w=Xa}d&&(null===Q?t("178"):void 0,wg(Q,w),null!==Q&&(Q=Q.nextEffect))}Lg=Og=!1;"function"===typeof Oe&&Oe(b.stateNode);Sa=b.expirationTime;b=b.childExpirationTime;b=0===Sa||0!==b&&b<Sa?b:Sa;0===b&&(Fg=null);a.expirationTime= 1709 b;a.finishedWork=null}function Tg(){return eh?!0:null===hh||hh.timeRemaining()>nh?!1:eh=!0}function Dg(a){null===Y?t("246"):void 0;Y.expirationTime=0;fh||(fh=!0,gh=a)}function sh(a,b){var c=W;W=!0;try{return a(b)}finally{(W=c)||V||Yg(1,null)}}function th(a,b){if(W&&!Wg){Wg=!0;try{return a(b)}finally{Wg=!1}}return a(b)}function uh(a,b,c){if(Ug)return a(b,c);W||V||0===Vg||(Yg(Vg,null),Vg=0);var d=Ug,e=W;W=Ug=!0;try{return a(b,c)}finally{Ug=d,(W=e)||V||Yg(1,null)}} 1710 function vh(a){if(!a)return Fe;a=a._reactInternalFiber;a:{2!==jd(a)||2!==a.tag&&3!==a.tag?t("170"):void 0;var b=a;do{switch(b.tag){case 5:b=b.stateNode.context;break a;case 2:if(K(b.type)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}break;case 3:if(K(b.type._reactResult)){b=b.stateNode.__reactInternalMemoizedMergedChildContext;break a}}b=b.return}while(null!==b);t("171");b=void 0}if(2===a.tag){var c=a.type;if(K(c))return Le(a,c,b)}else if(3===a.tag&&(c=a.type._reactResult,K(c)))return Le(a, 1711 c,b);return b}function wh(a,b,c,d,e){var f=b.current;c=vh(c);null===b.context?b.context=c:b.pendingContext=c;b=e;e=df(d);e.payload={element:a};b=void 0===b?null:b;null!==b&&(e.callback=b);ff(f,e);If(f,d);return d}function xh(a,b,c,d){var e=b.current,f=Gf();e=Hf(f,e);return wh(a,b,c,e,d)}function zh(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 7:return a.child.stateNode;default:return a.child.stateNode}} 1712 function Ah(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ac,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}} 1713 Fb=function(a,b,c){switch(b){case "input":Dc(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Na(d);e?void 0:t("90");Xb(d);Dc(d,e)}}}break;case "textarea":he(a,c);break;case "select":b=c.value,null!=b&&ee(a,!!c.multiple,b,!1)}}; 1714 function Bh(a){var b=2+25*(((Gf()-2+500)/25|0)+1);b<=Jg&&(b=Jg+1);this._expirationTime=Jg=b;this._root=a;this._callbacks=this._next=null;this._hasChildren=this._didComplete=!1;this._children=null;this._defer=!0}Bh.prototype.render=function(a){this._defer?void 0:t("250");this._hasChildren=!0;this._children=a;var b=this._root._internalRoot,c=this._expirationTime,d=new Ch;wh(a,b,null,c,d._onCommit);return d}; 1715 Bh.prototype.then=function(a){if(this._didComplete)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}}; 1716 Bh.prototype.commit=function(){var a=this._root._internalRoot,b=a.firstBatch;this._defer&&null!==b?void 0:t("251");if(this._hasChildren){var c=this._expirationTime;if(b!==this){this._hasChildren&&(c=this._expirationTime=b._expirationTime,this.render(this._children));for(var d=null,e=b;e!==this;)d=e,e=e._next;null===d?t("251"):void 0;d._next=e._next;this._next=b;a.firstBatch=this}this._defer=!1;b=c;V?t("253"):void 0;Y=a;Z=b;Xg(a,b,!0);Yg(1,null);b=this._next;this._next=null;b=a.firstBatch=b;null!== 1717 b&&b._hasChildren&&b.render(b._children)}else this._next=null,this._defer=!1};Bh.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++)(0,a[b])()}};function Ch(){this._callbacks=null;this._didCommit=!1;this._onCommit=this._onCommit.bind(this)}Ch.prototype.then=function(a){if(this._didCommit)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}}; 1718 Ch.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++){var c=a[b];"function"!==typeof c?t("191",c):void 0;c()}}}; 1719 function Dh(a,b,c){b=new Se(5,null,null,b?3:0);a={current:b,containerInfo:a,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:c,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null};this._internalRoot=b.stateNode=a} 1720 Dh.prototype.render=function(a,b){var c=this._internalRoot,d=new Ch;b=void 0===b?null:b;null!==b&&d.then(b);xh(a,c,null,d._onCommit);return d};Dh.prototype.unmount=function(a){var b=this._internalRoot,c=new Ch;a=void 0===a?null:a;null!==a&&c.then(a);xh(null,b,null,c._onCommit);return c};Dh.prototype.legacy_renderSubtreeIntoContainer=function(a,b,c){var d=this._internalRoot,e=new Ch;c=void 0===c?null:c;null!==c&&e.then(c);xh(b,d,a,e._onCommit);return e}; 1721 Dh.prototype.createBatch=function(){var a=new Bh(this),b=a._expirationTime,c=this._internalRoot,d=c.firstBatch;if(null===d)c.firstBatch=a,a._next=null;else{for(c=null;null!==d&&d._expirationTime<=b;)c=d,d=d._next;a._next=d;null!==c&&(c._next=a)}return a};function Eh(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}Lb=sh;Mb=uh;Nb=function(){V||0===Vg||(Yg(Vg,null),Vg=0)}; 1722 function Fh(a,b){b||(b=a?9===a.nodeType?a.documentElement:a.firstChild:null,b=!(!b||1!==b.nodeType||!b.hasAttribute("data-reactroot")));if(!b)for(var c;c=a.lastChild;)a.removeChild(c);return new Dh(a,!1,b)} 1723 function Gh(a,b,c,d,e){Eh(c)?void 0:t("200");var f=c._reactRootContainer;if(f){if("function"===typeof e){var g=e;e=function(){var a=zh(f._internalRoot);g.call(a)}}null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)}else{f=c._reactRootContainer=Fh(c,d);if("function"===typeof e){var h=e;e=function(){var a=zh(f._internalRoot);h.call(a)}}th(function(){null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)})}return zh(f._internalRoot)} 1724 function Hh(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;Eh(b)?void 0:t("200");return Ah(a,b,null,c)} 1725 var Mh={createPortal:Hh,findDOMNode:function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternalFiber;void 0===b&&("function"===typeof a.render?t("188"):t("268",Object.keys(a)));a=md(b);a=null===a?null:a.stateNode;return a},hydrate:function(a,b,c){return Gh(null,a,b,!0,c)},render:function(a,b,c){return Gh(null,a,b,!1,c)},unstable_renderSubtreeIntoContainer:function(a,b,c,d){null==a||void 0===a._reactInternalFiber?t("38"):void 0;return Gh(a,b,c,!1,d)},unmountComponentAtNode:function(a){Eh(a)? 1726 void 0:t("40");return a._reactRootContainer?(th(function(){Gh(null,null,a,!1,function(){a._reactRootContainer=null})}),!0):!1},unstable_createPortal:function(){return Hh.apply(void 0,arguments)},unstable_batchedUpdates:sh,unstable_interactiveUpdates:uh,flushSync:function(a,b){V?t("187"):void 0;var c=W;W=!0;try{return bh(a,b)}finally{W=c,Yg(1,null)}},unstable_flushControlled:function(a){var b=W;W=!0;try{bh(a)}finally{(W=b)||V||Yg(1,null)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[La, 1727 Ma,Na,Ea.injectEventPluginsByName,qa,Ua,function(a){za(a,Ta)},Jb,Kb,Id,Ga]},unstable_createRoot:function(a,b){Eh(a)?void 0:t("278");return new Dh(a,!0,null!=b&&!0===b.hydrate)}};(function(a){var b=a.findFiberByHostInstance;return Re(n({},a,{findHostInstanceByFiber:function(a){a=md(a);return null===a?null:a.stateNode},findFiberByHostInstance:function(a){return b?b(a):null}}))})({findFiberByHostInstance:Ka,bundleType:0,version:"16.5.1",rendererPackageName:"react-dom"}); 1728 var Nh={default:Mh},Oh=Nh&&Mh||Nh;module.exports=Oh.default||Oh; 1729 1730 1731 /***/ }), 1732 /* 14 */ 1733 /***/ (function(module, exports, __webpack_require__) { 1734 1735 "use strict"; 1736 1737 1738 if (true) { 1739 module.exports = __webpack_require__(15); 1740 } else { 1741 module.exports = require('./cjs/schedule.development.js'); 1742 } 1743 1744 1745 /***/ }), 1746 /* 15 */ 1747 /***/ (function(module, exports, __webpack_require__) { 1748 1749 "use strict"; 1750 /** @license React v16.5.1 1751 * schedule.production.min.js 1752 * 1753 * Copyright (c) Facebook, Inc. and its affiliates. 1754 * 1755 * This source code is licensed under the MIT license found in the 1756 * LICENSE file in the root directory of this source tree. 1757 */ 1758 1759 Object.defineProperty(exports,"__esModule",{value:!0});var d=!("undefined"===typeof window||!window.document||!window.document.createElement),f=Date,g="function"===typeof setTimeout?setTimeout:void 0,h="function"===typeof clearTimeout?clearTimeout:void 0,l="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,m="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0,n="object"===typeof performance&&"function"===typeof performance.now; 1760 exports.unstable_now=void 0;if(n){var p=performance;exports.unstable_now=function(){return p.now()}}else exports.unstable_now=function(){return f.now()};exports.unstable_scheduleWork=void 0;exports.unstable_cancelScheduledWork=void 0; 1761 if(d){var q=null,r=null,t=-1,u=!1,v=!1,w=void 0,x=void 0,y=function(a){w=l(function(b){h(x);a(b)});x=g(function(){m(w);a(exports.unstable_now())},100)},z=0,A=33,B=33,C={didTimeout:!1,timeRemaining:function(){var a=z-exports.unstable_now();return 0<a?a:0}},E=function(a,b){var c=a.scheduledCallback,e=!1;try{c(b),e=!0}finally{exports.unstable_cancelScheduledWork(a),e||(u=!0,window.postMessage(D,"*"))}},D="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(a){if(a.source=== 1762 window&&a.data===D&&(u=!1,null!==q)){if(null!==q){var b=exports.unstable_now();if(!(-1===t||t>b)){a=-1;for(var c=[],e=q;null!==e;){var k=e.timeoutTime;-1!==k&&k<=b?c.push(e):-1!==k&&(-1===a||k<a)&&(a=k);e=e.next}if(0<c.length)for(C.didTimeout=!0,b=0,e=c.length;b<e;b++)E(c[b],C);t=a}}for(a=exports.unstable_now();0<z-a&&null!==q;)a=q,C.didTimeout=!1,E(a,C),a=exports.unstable_now();null===q||v||(v=!0,y(F))}},!1);var F=function(a){v=!1;var b=a-z+B;b<B&&A<B?(8>b&&(b=8),B=b<A?A:b):A=b;z=a+B;u||(u=!0,window.postMessage(D, 1763 "*"))};exports.unstable_scheduleWork=function(a,b){var c=-1;null!=b&&"number"===typeof b.timeout&&(c=exports.unstable_now()+b.timeout);if(-1===t||-1!==c&&c<t)t=c;a={scheduledCallback:a,timeoutTime:c,prev:null,next:null};null===q?q=a:(b=a.prev=r,null!==b&&(b.next=a));r=a;v||(v=!0,y(F));return a};exports.unstable_cancelScheduledWork=function(a){if(null!==a.prev||q===a){var b=a.next,c=a.prev;a.next=null;a.prev=null;null!==b?null!==c?(c.next=b,b.prev=c):(b.prev=null,q=b):null!==c?(c.next=null,r=c):r= 1764 q=null}}}else{var G=new Map;exports.unstable_scheduleWork=function(a){var b={scheduledCallback:a,timeoutTime:0,next:null,prev:null},c=g(function(){a({timeRemaining:function(){return Infinity},didTimeout:!1})});G.set(a,c);return b};exports.unstable_cancelScheduledWork=function(a){var b=G.get(a.scheduledCallback);G.delete(a);h(b)}}; 1765 1766 1767 /***/ }), 1768 /* 16 */ 1769 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1770 1771 "use strict"; 1772 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(1); 1773 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); 1774 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_immutable__ = __webpack_require__(17); 1775 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_immutable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_immutable__); 1776 var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var App=function(_Component){_inherits(App,_Component);function App(){var _ref;var _temp,_this,_ret;_classCallCheck(this,App);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return _ret=(_temp=(_this=_possibleConstructorReturn(this,(_ref=App.__proto__||Object.getPrototypeOf(App)).call.apply(_ref,[this].concat(args))),_this),_this.onClick=function(){var f=_this.fields;console.log(f);},_temp),_possibleConstructorReturn(_this,_ret);}_createClass(App,[{key:"componentDidMount",value:function componentDidMount(){this.fields=new __WEBPACK_IMPORTED_MODULE_1_immutable___default.a.Map({a:2});}},{key:"render",value:function render(){return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("div",{className:"App"},__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("button",{onClick:this.onClick},"Click Me"));}}]);return App;}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);window.clickButton=function(){return document.querySelector("button").click();};/* harmony default export */ __webpack_exports__["a"] = (App); 1777 1778 /***/ }), 1779 /* 17 */ 1780 /***/ (function(module, exports, __webpack_require__) { 1781 1782 /** 1783 * Copyright (c) 2014-present, Facebook, Inc. 1784 * 1785 * This source code is licensed under the MIT license found in the 1786 * LICENSE file in the root directory of this source tree. 1787 */ 1788 1789 (function (global, factory) { 1790 true ? module.exports = factory() : 1791 typeof define === 'function' && define.amd ? define(factory) : 1792 (global.Immutable = factory()); 1793 }(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice; 1794 1795 function createClass(ctor, superClass) { 1796 if (superClass) { 1797 ctor.prototype = Object.create(superClass.prototype); 1798 } 1799 ctor.prototype.constructor = ctor; 1800 } 1801 1802 function Iterable(value) { 1803 return isIterable(value) ? value : Seq(value); 1804 } 1805 1806 1807 createClass(KeyedIterable, Iterable); 1808 function KeyedIterable(value) { 1809 return isKeyed(value) ? value : KeyedSeq(value); 1810 } 1811 1812 1813 createClass(IndexedIterable, Iterable); 1814 function IndexedIterable(value) { 1815 return isIndexed(value) ? value : IndexedSeq(value); 1816 } 1817 1818 1819 createClass(SetIterable, Iterable); 1820 function SetIterable(value) { 1821 return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); 1822 } 1823 1824 1825 1826 function isIterable(maybeIterable) { 1827 return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); 1828 } 1829 1830 function isKeyed(maybeKeyed) { 1831 return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); 1832 } 1833 1834 function isIndexed(maybeIndexed) { 1835 return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); 1836 } 1837 1838 function isAssociative(maybeAssociative) { 1839 return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); 1840 } 1841 1842 function isOrdered(maybeOrdered) { 1843 return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); 1844 } 1845 1846 Iterable.isIterable = isIterable; 1847 Iterable.isKeyed = isKeyed; 1848 Iterable.isIndexed = isIndexed; 1849 Iterable.isAssociative = isAssociative; 1850 Iterable.isOrdered = isOrdered; 1851 1852 Iterable.Keyed = KeyedIterable; 1853 Iterable.Indexed = IndexedIterable; 1854 Iterable.Set = SetIterable; 1855 1856 1857 var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; 1858 var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; 1859 var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; 1860 var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; 1861 1862 // Used for setting prototype methods that IE8 chokes on. 1863 var DELETE = 'delete'; 1864 1865 // Constants describing the size of trie nodes. 1866 var SHIFT = 5; // Resulted in best performance after ______? 1867 var SIZE = 1 << SHIFT; 1868 var MASK = SIZE - 1; 1869 1870 // A consistent shared value representing "not set" which equals nothing other 1871 // than itself, and nothing that could be provided externally. 1872 var NOT_SET = {}; 1873 1874 // Boolean references, Rough equivalent of `bool &`. 1875 var CHANGE_LENGTH = { value: false }; 1876 var DID_ALTER = { value: false }; 1877 1878 function MakeRef(ref) { 1879 ref.value = false; 1880 return ref; 1881 } 1882 1883 function SetRef(ref) { 1884 ref && (ref.value = true); 1885 } 1886 1887 // A function which returns a value representing an "owner" for transient writes 1888 // to tries. The return value will only ever equal itself, and will not equal 1889 // the return of any subsequent call of this function. 1890 function OwnerID() {} 1891 1892 // http://jsperf.com/copy-array-inline 1893 function arrCopy(arr, offset) { 1894 offset = offset || 0; 1895 var len = Math.max(0, arr.length - offset); 1896 var newArr = new Array(len); 1897 for (var ii = 0; ii < len; ii++) { 1898 newArr[ii] = arr[ii + offset]; 1899 } 1900 return newArr; 1901 } 1902 1903 function ensureSize(iter) { 1904 if (iter.size === undefined) { 1905 iter.size = iter.__iterate(returnTrue); 1906 } 1907 return iter.size; 1908 } 1909 1910 function wrapIndex(iter, index) { 1911 // This implements "is array index" which the ECMAString spec defines as: 1912 // 1913 // A String property name P is an array index if and only if 1914 // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal 1915 // to 2^32−1. 1916 // 1917 // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects 1918 if (typeof index !== 'number') { 1919 var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 1920 if ('' + uint32Index !== index || uint32Index === 4294967295) { 1921 return NaN; 1922 } 1923 index = uint32Index; 1924 } 1925 return index < 0 ? ensureSize(iter) + index : index; 1926 } 1927 1928 function returnTrue() { 1929 return true; 1930 } 1931 1932 function wholeSlice(begin, end, size) { 1933 return (begin === 0 || (size !== undefined && begin <= -size)) && 1934 (end === undefined || (size !== undefined && end >= size)); 1935 } 1936 1937 function resolveBegin(begin, size) { 1938 return resolveIndex(begin, size, 0); 1939 } 1940 1941 function resolveEnd(end, size) { 1942 return resolveIndex(end, size, size); 1943 } 1944 1945 function resolveIndex(index, size, defaultIndex) { 1946 return index === undefined ? 1947 defaultIndex : 1948 index < 0 ? 1949 Math.max(0, size + index) : 1950 size === undefined ? 1951 index : 1952 Math.min(size, index); 1953 } 1954 1955 /* global Symbol */ 1956 1957 var ITERATE_KEYS = 0; 1958 var ITERATE_VALUES = 1; 1959 var ITERATE_ENTRIES = 2; 1960 1961 var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 1962 var FAUX_ITERATOR_SYMBOL = '@@iterator'; 1963 1964 var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; 1965 1966 1967 function Iterator(next) { 1968 this.next = next; 1969 } 1970 1971 Iterator.prototype.toString = function() { 1972 return '[Iterator]'; 1973 }; 1974 1975 1976 Iterator.KEYS = ITERATE_KEYS; 1977 Iterator.VALUES = ITERATE_VALUES; 1978 Iterator.ENTRIES = ITERATE_ENTRIES; 1979 1980 Iterator.prototype.inspect = 1981 Iterator.prototype.toSource = function () { return this.toString(); } 1982 Iterator.prototype[ITERATOR_SYMBOL] = function () { 1983 return this; 1984 }; 1985 1986 1987 function iteratorValue(type, k, v, iteratorResult) { 1988 var value = type === 0 ? k : type === 1 ? v : [k, v]; 1989 iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { 1990 value: value, done: false 1991 }); 1992 return iteratorResult; 1993 } 1994 1995 function iteratorDone() { 1996 return { value: undefined, done: true }; 1997 } 1998 1999 function hasIterator(maybeIterable) { 2000 return !!getIteratorFn(maybeIterable); 2001 } 2002 2003 function isIterator(maybeIterator) { 2004 return maybeIterator && typeof maybeIterator.next === 'function'; 2005 } 2006 2007 function getIterator(iterable) { 2008 var iteratorFn = getIteratorFn(iterable); 2009 return iteratorFn && iteratorFn.call(iterable); 2010 } 2011 2012 function getIteratorFn(iterable) { 2013 var iteratorFn = iterable && ( 2014 (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || 2015 iterable[FAUX_ITERATOR_SYMBOL] 2016 ); 2017 if (typeof iteratorFn === 'function') { 2018 return iteratorFn; 2019 } 2020 } 2021 2022 function isArrayLike(value) { 2023 return value && typeof value.length === 'number'; 2024 } 2025 2026 createClass(Seq, Iterable); 2027 function Seq(value) { 2028 return value === null || value === undefined ? emptySequence() : 2029 isIterable(value) ? value.toSeq() : seqFromValue(value); 2030 } 2031 2032 Seq.of = function(/*...values*/) { 2033 return Seq(arguments); 2034 }; 2035 2036 Seq.prototype.toSeq = function() { 2037 return this; 2038 }; 2039 2040 Seq.prototype.toString = function() { 2041 return this.__toString('Seq {', '}'); 2042 }; 2043 2044 Seq.prototype.cacheResult = function() { 2045 if (!this._cache && this.__iterateUncached) { 2046 this._cache = this.entrySeq().toArray(); 2047 this.size = this._cache.length; 2048 } 2049 return this; 2050 }; 2051 2052 // abstract __iterateUncached(fn, reverse) 2053 2054 Seq.prototype.__iterate = function(fn, reverse) { 2055 return seqIterate(this, fn, reverse, true); 2056 }; 2057 2058 // abstract __iteratorUncached(type, reverse) 2059 2060 Seq.prototype.__iterator = function(type, reverse) { 2061 return seqIterator(this, type, reverse, true); 2062 }; 2063 2064 2065 2066 createClass(KeyedSeq, Seq); 2067 function KeyedSeq(value) { 2068 return value === null || value === undefined ? 2069 emptySequence().toKeyedSeq() : 2070 isIterable(value) ? 2071 (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : 2072 keyedSeqFromValue(value); 2073 } 2074 2075 KeyedSeq.prototype.toKeyedSeq = function() { 2076 return this; 2077 }; 2078 2079 2080 2081 createClass(IndexedSeq, Seq); 2082 function IndexedSeq(value) { 2083 return value === null || value === undefined ? emptySequence() : 2084 !isIterable(value) ? indexedSeqFromValue(value) : 2085 isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); 2086 } 2087 2088 IndexedSeq.of = function(/*...values*/) { 2089 return IndexedSeq(arguments); 2090 }; 2091 2092 IndexedSeq.prototype.toIndexedSeq = function() { 2093 return this; 2094 }; 2095 2096 IndexedSeq.prototype.toString = function() { 2097 return this.__toString('Seq [', ']'); 2098 }; 2099 2100 IndexedSeq.prototype.__iterate = function(fn, reverse) { 2101 return seqIterate(this, fn, reverse, false); 2102 }; 2103 2104 IndexedSeq.prototype.__iterator = function(type, reverse) { 2105 return seqIterator(this, type, reverse, false); 2106 }; 2107 2108 2109 2110 createClass(SetSeq, Seq); 2111 function SetSeq(value) { 2112 return ( 2113 value === null || value === undefined ? emptySequence() : 2114 !isIterable(value) ? indexedSeqFromValue(value) : 2115 isKeyed(value) ? value.entrySeq() : value 2116 ).toSetSeq(); 2117 } 2118 2119 SetSeq.of = function(/*...values*/) { 2120 return SetSeq(arguments); 2121 }; 2122 2123 SetSeq.prototype.toSetSeq = function() { 2124 return this; 2125 }; 2126 2127 2128 2129 Seq.isSeq = isSeq; 2130 Seq.Keyed = KeyedSeq; 2131 Seq.Set = SetSeq; 2132 Seq.Indexed = IndexedSeq; 2133 2134 var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; 2135 2136 Seq.prototype[IS_SEQ_SENTINEL] = true; 2137 2138 2139 2140 createClass(ArraySeq, IndexedSeq); 2141 function ArraySeq(array) { 2142 this._array = array; 2143 this.size = array.length; 2144 } 2145 2146 ArraySeq.prototype.get = function(index, notSetValue) { 2147 return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue; 2148 }; 2149 2150 ArraySeq.prototype.__iterate = function(fn, reverse) { 2151 var array = this._array; 2152 var maxIndex = array.length - 1; 2153 for (var ii = 0; ii <= maxIndex; ii++) { 2154 if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) { 2155 return ii + 1; 2156 } 2157 } 2158 return ii; 2159 }; 2160 2161 ArraySeq.prototype.__iterator = function(type, reverse) { 2162 var array = this._array; 2163 var maxIndex = array.length - 1; 2164 var ii = 0; 2165 return new Iterator(function() 2166 {return ii > maxIndex ? 2167 iteratorDone() : 2168 iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} 2169 ); 2170 }; 2171 2172 2173 2174 createClass(ObjectSeq, KeyedSeq); 2175 function ObjectSeq(object) { 2176 var keys = Object.keys(object); 2177 this._object = object; 2178 this._keys = keys; 2179 this.size = keys.length; 2180 } 2181 2182 ObjectSeq.prototype.get = function(key, notSetValue) { 2183 if (notSetValue !== undefined && !this.has(key)) { 2184 return notSetValue; 2185 } 2186 return this._object[key]; 2187 }; 2188 2189 ObjectSeq.prototype.has = function(key) { 2190 return this._object.hasOwnProperty(key); 2191 }; 2192 2193 ObjectSeq.prototype.__iterate = function(fn, reverse) { 2194 var object = this._object; 2195 var keys = this._keys; 2196 var maxIndex = keys.length - 1; 2197 for (var ii = 0; ii <= maxIndex; ii++) { 2198 var key = keys[reverse ? maxIndex - ii : ii]; 2199 if (fn(object[key], key, this) === false) { 2200 return ii + 1; 2201 } 2202 } 2203 return ii; 2204 }; 2205 2206 ObjectSeq.prototype.__iterator = function(type, reverse) { 2207 var object = this._object; 2208 var keys = this._keys; 2209 var maxIndex = keys.length - 1; 2210 var ii = 0; 2211 return new Iterator(function() { 2212 var key = keys[reverse ? maxIndex - ii : ii]; 2213 return ii++ > maxIndex ? 2214 iteratorDone() : 2215 iteratorValue(type, key, object[key]); 2216 }); 2217 }; 2218 2219 ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; 2220 2221 2222 createClass(IterableSeq, IndexedSeq); 2223 function IterableSeq(iterable) { 2224 this._iterable = iterable; 2225 this.size = iterable.length || iterable.size; 2226 } 2227 2228 IterableSeq.prototype.__iterateUncached = function(fn, reverse) { 2229 if (reverse) { 2230 return this.cacheResult().__iterate(fn, reverse); 2231 } 2232 var iterable = this._iterable; 2233 var iterator = getIterator(iterable); 2234 var iterations = 0; 2235 if (isIterator(iterator)) { 2236 var step; 2237 while (!(step = iterator.next()).done) { 2238 if (fn(step.value, iterations++, this) === false) { 2239 break; 2240 } 2241 } 2242 } 2243 return iterations; 2244 }; 2245 2246 IterableSeq.prototype.__iteratorUncached = function(type, reverse) { 2247 if (reverse) { 2248 return this.cacheResult().__iterator(type, reverse); 2249 } 2250 var iterable = this._iterable; 2251 var iterator = getIterator(iterable); 2252 if (!isIterator(iterator)) { 2253 return new Iterator(iteratorDone); 2254 } 2255 var iterations = 0; 2256 return new Iterator(function() { 2257 var step = iterator.next(); 2258 return step.done ? step : iteratorValue(type, iterations++, step.value); 2259 }); 2260 }; 2261 2262 2263 2264 createClass(IteratorSeq, IndexedSeq); 2265 function IteratorSeq(iterator) { 2266 this._iterator = iterator; 2267 this._iteratorCache = []; 2268 } 2269 2270 IteratorSeq.prototype.__iterateUncached = function(fn, reverse) { 2271 if (reverse) { 2272 return this.cacheResult().__iterate(fn, reverse); 2273 } 2274 var iterator = this._iterator; 2275 var cache = this._iteratorCache; 2276 var iterations = 0; 2277 while (iterations < cache.length) { 2278 if (fn(cache[iterations], iterations++, this) === false) { 2279 return iterations; 2280 } 2281 } 2282 var step; 2283 while (!(step = iterator.next()).done) { 2284 var val = step.value; 2285 cache[iterations] = val; 2286 if (fn(val, iterations++, this) === false) { 2287 break; 2288 } 2289 } 2290 return iterations; 2291 }; 2292 2293 IteratorSeq.prototype.__iteratorUncached = function(type, reverse) { 2294 if (reverse) { 2295 return this.cacheResult().__iterator(type, reverse); 2296 } 2297 var iterator = this._iterator; 2298 var cache = this._iteratorCache; 2299 var iterations = 0; 2300 return new Iterator(function() { 2301 if (iterations >= cache.length) { 2302 var step = iterator.next(); 2303 if (step.done) { 2304 return step; 2305 } 2306 cache[iterations] = step.value; 2307 } 2308 return iteratorValue(type, iterations, cache[iterations++]); 2309 }); 2310 }; 2311 2312 2313 2314 2315 // # pragma Helper functions 2316 2317 function isSeq(maybeSeq) { 2318 return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); 2319 } 2320 2321 var EMPTY_SEQ; 2322 2323 function emptySequence() { 2324 return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); 2325 } 2326 2327 function keyedSeqFromValue(value) { 2328 var seq = 2329 Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : 2330 isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : 2331 hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : 2332 typeof value === 'object' ? new ObjectSeq(value) : 2333 undefined; 2334 if (!seq) { 2335 throw new TypeError( 2336 'Expected Array or iterable object of [k, v] entries, '+ 2337 'or keyed object: ' + value 2338 ); 2339 } 2340 return seq; 2341 } 2342 2343 function indexedSeqFromValue(value) { 2344 var seq = maybeIndexedSeqFromValue(value); 2345 if (!seq) { 2346 throw new TypeError( 2347 'Expected Array or iterable object of values: ' + value 2348 ); 2349 } 2350 return seq; 2351 } 2352 2353 function seqFromValue(value) { 2354 var seq = maybeIndexedSeqFromValue(value) || 2355 (typeof value === 'object' && new ObjectSeq(value)); 2356 if (!seq) { 2357 throw new TypeError( 2358 'Expected Array or iterable object of values, or keyed object: ' + value 2359 ); 2360 } 2361 return seq; 2362 } 2363 2364 function maybeIndexedSeqFromValue(value) { 2365 return ( 2366 isArrayLike(value) ? new ArraySeq(value) : 2367 isIterator(value) ? new IteratorSeq(value) : 2368 hasIterator(value) ? new IterableSeq(value) : 2369 undefined 2370 ); 2371 } 2372 2373 function seqIterate(seq, fn, reverse, useKeys) { 2374 var cache = seq._cache; 2375 if (cache) { 2376 var maxIndex = cache.length - 1; 2377 for (var ii = 0; ii <= maxIndex; ii++) { 2378 var entry = cache[reverse ? maxIndex - ii : ii]; 2379 if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) { 2380 return ii + 1; 2381 } 2382 } 2383 return ii; 2384 } 2385 return seq.__iterateUncached(fn, reverse); 2386 } 2387 2388 function seqIterator(seq, type, reverse, useKeys) { 2389 var cache = seq._cache; 2390 if (cache) { 2391 var maxIndex = cache.length - 1; 2392 var ii = 0; 2393 return new Iterator(function() { 2394 var entry = cache[reverse ? maxIndex - ii : ii]; 2395 return ii++ > maxIndex ? 2396 iteratorDone() : 2397 iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]); 2398 }); 2399 } 2400 return seq.__iteratorUncached(type, reverse); 2401 } 2402 2403 function fromJS(json, converter) { 2404 return converter ? 2405 fromJSWith(converter, json, '', {'': json}) : 2406 fromJSDefault(json); 2407 } 2408 2409 function fromJSWith(converter, json, key, parentJSON) { 2410 if (Array.isArray(json)) { 2411 return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); 2412 } 2413 if (isPlainObj(json)) { 2414 return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); 2415 } 2416 return json; 2417 } 2418 2419 function fromJSDefault(json) { 2420 if (Array.isArray(json)) { 2421 return IndexedSeq(json).map(fromJSDefault).toList(); 2422 } 2423 if (isPlainObj(json)) { 2424 return KeyedSeq(json).map(fromJSDefault).toMap(); 2425 } 2426 return json; 2427 } 2428 2429 function isPlainObj(value) { 2430 return value && (value.constructor === Object || value.constructor === undefined); 2431 } 2432 2433 /** 2434 * An extension of the "same-value" algorithm as [described for use by ES6 Map 2435 * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality) 2436 * 2437 * NaN is considered the same as NaN, however -0 and 0 are considered the same 2438 * value, which is different from the algorithm described by 2439 * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). 2440 * 2441 * This is extended further to allow Objects to describe the values they 2442 * represent, by way of `valueOf` or `equals` (and `hashCode`). 2443 * 2444 * Note: because of this extension, the key equality of Immutable.Map and the 2445 * value equality of Immutable.Set will differ from ES6 Map and Set. 2446 * 2447 * ### Defining custom values 2448 * 2449 * The easiest way to describe the value an object represents is by implementing 2450 * `valueOf`. For example, `Date` represents a value by returning a unix 2451 * timestamp for `valueOf`: 2452 * 2453 * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ... 2454 * var date2 = new Date(1234567890000); 2455 * date1.valueOf(); // 1234567890000 2456 * assert( date1 !== date2 ); 2457 * assert( Immutable.is( date1, date2 ) ); 2458 * 2459 * Note: overriding `valueOf` may have other implications if you use this object 2460 * where JavaScript expects a primitive, such as implicit string coercion. 2461 * 2462 * For more complex types, especially collections, implementing `valueOf` may 2463 * not be performant. An alternative is to implement `equals` and `hashCode`. 2464 * 2465 * `equals` takes another object, presumably of similar type, and returns true 2466 * if the it is equal. Equality is symmetrical, so the same result should be 2467 * returned if this and the argument are flipped. 2468 * 2469 * assert( a.equals(b) === b.equals(a) ); 2470 * 2471 * `hashCode` returns a 32bit integer number representing the object which will 2472 * be used to determine how to store the value object in a Map or Set. You must 2473 * provide both or neither methods, one must not exist without the other. 2474 * 2475 * Also, an important relationship between these methods must be upheld: if two 2476 * values are equal, they *must* return the same hashCode. If the values are not 2477 * equal, they might have the same hashCode; this is called a hash collision, 2478 * and while undesirable for performance reasons, it is acceptable. 2479 * 2480 * if (a.equals(b)) { 2481 * assert( a.hashCode() === b.hashCode() ); 2482 * } 2483 * 2484 * All Immutable collections implement `equals` and `hashCode`. 2485 * 2486 */ 2487 function is(valueA, valueB) { 2488 if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { 2489 return true; 2490 } 2491 if (!valueA || !valueB) { 2492 return false; 2493 } 2494 if (typeof valueA.valueOf === 'function' && 2495 typeof valueB.valueOf === 'function') { 2496 valueA = valueA.valueOf(); 2497 valueB = valueB.valueOf(); 2498 if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { 2499 return true; 2500 } 2501 if (!valueA || !valueB) { 2502 return false; 2503 } 2504 } 2505 if (typeof valueA.equals === 'function' && 2506 typeof valueB.equals === 'function' && 2507 valueA.equals(valueB)) { 2508 return true; 2509 } 2510 return false; 2511 } 2512 2513 function deepEqual(a, b) { 2514 if (a === b) { 2515 return true; 2516 } 2517 2518 if ( 2519 !isIterable(b) || 2520 a.size !== undefined && b.size !== undefined && a.size !== b.size || 2521 a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || 2522 isKeyed(a) !== isKeyed(b) || 2523 isIndexed(a) !== isIndexed(b) || 2524 isOrdered(a) !== isOrdered(b) 2525 ) { 2526 return false; 2527 } 2528 2529 if (a.size === 0 && b.size === 0) { 2530 return true; 2531 } 2532 2533 var notAssociative = !isAssociative(a); 2534 2535 if (isOrdered(a)) { 2536 var entries = a.entries(); 2537 return b.every(function(v, k) { 2538 var entry = entries.next().value; 2539 return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); 2540 }) && entries.next().done; 2541 } 2542 2543 var flipped = false; 2544 2545 if (a.size === undefined) { 2546 if (b.size === undefined) { 2547 if (typeof a.cacheResult === 'function') { 2548 a.cacheResult(); 2549 } 2550 } else { 2551 flipped = true; 2552 var _ = a; 2553 a = b; 2554 b = _; 2555 } 2556 } 2557 2558 var allEqual = true; 2559 var bSize = b.__iterate(function(v, k) { 2560 if (notAssociative ? !a.has(v) : 2561 flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { 2562 allEqual = false; 2563 return false; 2564 } 2565 }); 2566 2567 return allEqual && a.size === bSize; 2568 } 2569 2570 createClass(Repeat, IndexedSeq); 2571 2572 function Repeat(value, times) { 2573 if (!(this instanceof Repeat)) { 2574 return new Repeat(value, times); 2575 } 2576 this._value = value; 2577 this.size = times === undefined ? Infinity : Math.max(0, times); 2578 if (this.size === 0) { 2579 if (EMPTY_REPEAT) { 2580 return EMPTY_REPEAT; 2581 } 2582 EMPTY_REPEAT = this; 2583 } 2584 } 2585 2586 Repeat.prototype.toString = function() { 2587 if (this.size === 0) { 2588 return 'Repeat []'; 2589 } 2590 return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; 2591 }; 2592 2593 Repeat.prototype.get = function(index, notSetValue) { 2594 return this.has(index) ? this._value : notSetValue; 2595 }; 2596 2597 Repeat.prototype.includes = function(searchValue) { 2598 return is(this._value, searchValue); 2599 }; 2600 2601 Repeat.prototype.slice = function(begin, end) { 2602 var size = this.size; 2603 return wholeSlice(begin, end, size) ? this : 2604 new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); 2605 }; 2606 2607 Repeat.prototype.reverse = function() { 2608 return this; 2609 }; 2610 2611 Repeat.prototype.indexOf = function(searchValue) { 2612 if (is(this._value, searchValue)) { 2613 return 0; 2614 } 2615 return -1; 2616 }; 2617 2618 Repeat.prototype.lastIndexOf = function(searchValue) { 2619 if (is(this._value, searchValue)) { 2620 return this.size; 2621 } 2622 return -1; 2623 }; 2624 2625 Repeat.prototype.__iterate = function(fn, reverse) { 2626 for (var ii = 0; ii < this.size; ii++) { 2627 if (fn(this._value, ii, this) === false) { 2628 return ii + 1; 2629 } 2630 } 2631 return ii; 2632 }; 2633 2634 Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; 2635 var ii = 0; 2636 return new Iterator(function() 2637 {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} 2638 ); 2639 }; 2640 2641 Repeat.prototype.equals = function(other) { 2642 return other instanceof Repeat ? 2643 is(this._value, other._value) : 2644 deepEqual(other); 2645 }; 2646 2647 2648 var EMPTY_REPEAT; 2649 2650 function invariant(condition, error) { 2651 if (!condition) throw new Error(error); 2652 } 2653 2654 createClass(Range, IndexedSeq); 2655 2656 function Range(start, end, step) { 2657 if (!(this instanceof Range)) { 2658 return new Range(start, end, step); 2659 } 2660 invariant(step !== 0, 'Cannot step a Range by 0'); 2661 start = start || 0; 2662 if (end === undefined) { 2663 end = Infinity; 2664 } 2665 step = step === undefined ? 1 : Math.abs(step); 2666 if (end < start) { 2667 step = -step; 2668 } 2669 this._start = start; 2670 this._end = end; 2671 this._step = step; 2672 this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); 2673 if (this.size === 0) { 2674 if (EMPTY_RANGE) { 2675 return EMPTY_RANGE; 2676 } 2677 EMPTY_RANGE = this; 2678 } 2679 } 2680 2681 Range.prototype.toString = function() { 2682 if (this.size === 0) { 2683 return 'Range []'; 2684 } 2685 return 'Range [ ' + 2686 this._start + '...' + this._end + 2687 (this._step !== 1 ? ' by ' + this._step : '') + 2688 ' ]'; 2689 }; 2690 2691 Range.prototype.get = function(index, notSetValue) { 2692 return this.has(index) ? 2693 this._start + wrapIndex(this, index) * this._step : 2694 notSetValue; 2695 }; 2696 2697 Range.prototype.includes = function(searchValue) { 2698 var possibleIndex = (searchValue - this._start) / this._step; 2699 return possibleIndex >= 0 && 2700 possibleIndex < this.size && 2701 possibleIndex === Math.floor(possibleIndex); 2702 }; 2703 2704 Range.prototype.slice = function(begin, end) { 2705 if (wholeSlice(begin, end, this.size)) { 2706 return this; 2707 } 2708 begin = resolveBegin(begin, this.size); 2709 end = resolveEnd(end, this.size); 2710 if (end <= begin) { 2711 return new Range(0, 0); 2712 } 2713 return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); 2714 }; 2715 2716 Range.prototype.indexOf = function(searchValue) { 2717 var offsetValue = searchValue - this._start; 2718 if (offsetValue % this._step === 0) { 2719 var index = offsetValue / this._step; 2720 if (index >= 0 && index < this.size) { 2721 return index 2722 } 2723 } 2724 return -1; 2725 }; 2726 2727 Range.prototype.lastIndexOf = function(searchValue) { 2728 return this.indexOf(searchValue); 2729 }; 2730 2731 Range.prototype.__iterate = function(fn, reverse) { 2732 var maxIndex = this.size - 1; 2733 var step = this._step; 2734 var value = reverse ? this._start + maxIndex * step : this._start; 2735 for (var ii = 0; ii <= maxIndex; ii++) { 2736 if (fn(value, ii, this) === false) { 2737 return ii + 1; 2738 } 2739 value += reverse ? -step : step; 2740 } 2741 return ii; 2742 }; 2743 2744 Range.prototype.__iterator = function(type, reverse) { 2745 var maxIndex = this.size - 1; 2746 var step = this._step; 2747 var value = reverse ? this._start + maxIndex * step : this._start; 2748 var ii = 0; 2749 return new Iterator(function() { 2750 var v = value; 2751 value += reverse ? -step : step; 2752 return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); 2753 }); 2754 }; 2755 2756 Range.prototype.equals = function(other) { 2757 return other instanceof Range ? 2758 this._start === other._start && 2759 this._end === other._end && 2760 this._step === other._step : 2761 deepEqual(this, other); 2762 }; 2763 2764 2765 var EMPTY_RANGE; 2766 2767 createClass(Collection, Iterable); 2768 function Collection() { 2769 throw TypeError('Abstract'); 2770 } 2771 2772 2773 createClass(KeyedCollection, Collection);function KeyedCollection() {} 2774 2775 createClass(IndexedCollection, Collection);function IndexedCollection() {} 2776 2777 createClass(SetCollection, Collection);function SetCollection() {} 2778 2779 2780 Collection.Keyed = KeyedCollection; 2781 Collection.Indexed = IndexedCollection; 2782 Collection.Set = SetCollection; 2783 2784 var imul = 2785 typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? 2786 Math.imul : 2787 function imul(a, b) { 2788 a = a | 0; // int 2789 b = b | 0; // int 2790 var c = a & 0xffff; 2791 var d = b & 0xffff; 2792 // Shift by 0 fixes the sign on the high part. 2793 return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int 2794 }; 2795 2796 // v8 has an optimization for storing 31-bit signed numbers. 2797 // Values which have either 00 or 11 as the high order bits qualify. 2798 // This function drops the highest order bit in a signed number, maintaining 2799 // the sign bit. 2800 function smi(i32) { 2801 return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); 2802 } 2803 2804 function hash(o) { 2805 if (o === false || o === null || o === undefined) { 2806 return 0; 2807 } 2808 if (typeof o.valueOf === 'function') { 2809 o = o.valueOf(); 2810 if (o === false || o === null || o === undefined) { 2811 return 0; 2812 } 2813 } 2814 if (o === true) { 2815 return 1; 2816 } 2817 var type = typeof o; 2818 if (type === 'number') { 2819 if (o !== o || o === Infinity) { 2820 return 0; 2821 } 2822 var h = o | 0; 2823 if (h !== o) { 2824 h ^= o * 0xFFFFFFFF; 2825 } 2826 while (o > 0xFFFFFFFF) { 2827 o /= 0xFFFFFFFF; 2828 h ^= o; 2829 } 2830 return smi(h); 2831 } 2832 if (type === 'string') { 2833 return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); 2834 } 2835 if (typeof o.hashCode === 'function') { 2836 return o.hashCode(); 2837 } 2838 if (type === 'object') { 2839 return hashJSObj(o); 2840 } 2841 if (typeof o.toString === 'function') { 2842 return hashString(o.toString()); 2843 } 2844 throw new Error('Value type ' + type + ' cannot be hashed.'); 2845 } 2846 2847 function cachedHashString(string) { 2848 var hash = stringHashCache[string]; 2849 if (hash === undefined) { 2850 hash = hashString(string); 2851 if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { 2852 STRING_HASH_CACHE_SIZE = 0; 2853 stringHashCache = {}; 2854 } 2855 STRING_HASH_CACHE_SIZE++; 2856 stringHashCache[string] = hash; 2857 } 2858 return hash; 2859 } 2860 2861 // http://jsperf.com/hashing-strings 2862 function hashString(string) { 2863 // This is the hash from JVM 2864 // The hash code for a string is computed as 2865 // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], 2866 // where s[i] is the ith character of the string and n is the length of 2867 // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 2868 // (exclusive) by dropping high bits. 2869 var hash = 0; 2870 for (var ii = 0; ii < string.length; ii++) { 2871 hash = 31 * hash + string.charCodeAt(ii) | 0; 2872 } 2873 return smi(hash); 2874 } 2875 2876 function hashJSObj(obj) { 2877 var hash; 2878 if (usingWeakMap) { 2879 hash = weakMap.get(obj); 2880 if (hash !== undefined) { 2881 return hash; 2882 } 2883 } 2884 2885 hash = obj[UID_HASH_KEY]; 2886 if (hash !== undefined) { 2887 return hash; 2888 } 2889 2890 if (!canDefineProperty) { 2891 hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; 2892 if (hash !== undefined) { 2893 return hash; 2894 } 2895 2896 hash = getIENodeHash(obj); 2897 if (hash !== undefined) { 2898 return hash; 2899 } 2900 } 2901 2902 hash = ++objHashUID; 2903 if (objHashUID & 0x40000000) { 2904 objHashUID = 0; 2905 } 2906 2907 if (usingWeakMap) { 2908 weakMap.set(obj, hash); 2909 } else if (isExtensible !== undefined && isExtensible(obj) === false) { 2910 throw new Error('Non-extensible objects are not allowed as keys.'); 2911 } else if (canDefineProperty) { 2912 Object.defineProperty(obj, UID_HASH_KEY, { 2913 'enumerable': false, 2914 'configurable': false, 2915 'writable': false, 2916 'value': hash 2917 }); 2918 } else if (obj.propertyIsEnumerable !== undefined && 2919 obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { 2920 // Since we can't define a non-enumerable property on the object 2921 // we'll hijack one of the less-used non-enumerable properties to 2922 // save our hash on it. Since this is a function it will not show up in 2923 // `JSON.stringify` which is what we want. 2924 obj.propertyIsEnumerable = function() { 2925 return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); 2926 }; 2927 obj.propertyIsEnumerable[UID_HASH_KEY] = hash; 2928 } else if (obj.nodeType !== undefined) { 2929 // At this point we couldn't get the IE `uniqueID` to use as a hash 2930 // and we couldn't use a non-enumerable property to exploit the 2931 // dontEnum bug so we simply add the `UID_HASH_KEY` on the node 2932 // itself. 2933 obj[UID_HASH_KEY] = hash; 2934 } else { 2935 throw new Error('Unable to set a non-enumerable property on object.'); 2936 } 2937 2938 return hash; 2939 } 2940 2941 // Get references to ES5 object methods. 2942 var isExtensible = Object.isExtensible; 2943 2944 // True if Object.defineProperty works as expected. IE8 fails this test. 2945 var canDefineProperty = (function() { 2946 try { 2947 Object.defineProperty({}, '@', {}); 2948 return true; 2949 } catch (e) { 2950 return false; 2951 } 2952 }()); 2953 2954 // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it 2955 // and avoid memory leaks from the IE cloneNode bug. 2956 function getIENodeHash(node) { 2957 if (node && node.nodeType > 0) { 2958 switch (node.nodeType) { 2959 case 1: // Element 2960 return node.uniqueID; 2961 case 9: // Document 2962 return node.documentElement && node.documentElement.uniqueID; 2963 } 2964 } 2965 } 2966 2967 // If possible, use a WeakMap. 2968 var usingWeakMap = typeof WeakMap === 'function'; 2969 var weakMap; 2970 if (usingWeakMap) { 2971 weakMap = new WeakMap(); 2972 } 2973 2974 var objHashUID = 0; 2975 2976 var UID_HASH_KEY = '__immutablehash__'; 2977 if (typeof Symbol === 'function') { 2978 UID_HASH_KEY = Symbol(UID_HASH_KEY); 2979 } 2980 2981 var STRING_HASH_CACHE_MIN_STRLEN = 16; 2982 var STRING_HASH_CACHE_MAX_SIZE = 255; 2983 var STRING_HASH_CACHE_SIZE = 0; 2984 var stringHashCache = {}; 2985 2986 function assertNotInfinite(size) { 2987 invariant( 2988 size !== Infinity, 2989 'Cannot perform this action with an infinite size.' 2990 ); 2991 } 2992 2993 createClass(Map, KeyedCollection); 2994 2995 // @pragma Construction 2996 2997 function Map(value) { 2998 return value === null || value === undefined ? emptyMap() : 2999 isMap(value) && !isOrdered(value) ? value : 3000 emptyMap().withMutations(function(map ) { 3001 var iter = KeyedIterable(value); 3002 assertNotInfinite(iter.size); 3003 iter.forEach(function(v, k) {return map.set(k, v)}); 3004 }); 3005 } 3006 3007 Map.of = function() {var keyValues = SLICE$0.call(arguments, 0); 3008 return emptyMap().withMutations(function(map ) { 3009 for (var i = 0; i < keyValues.length; i += 2) { 3010 if (i + 1 >= keyValues.length) { 3011 throw new Error('Missing value for key: ' + keyValues[i]); 3012 } 3013 map.set(keyValues[i], keyValues[i + 1]); 3014 } 3015 }); 3016 }; 3017 3018 Map.prototype.toString = function() { 3019 return this.__toString('Map {', '}'); 3020 }; 3021 3022 // @pragma Access 3023 3024 Map.prototype.get = function(k, notSetValue) { 3025 return this._root ? 3026 this._root.get(0, undefined, k, notSetValue) : 3027 notSetValue; 3028 }; 3029 3030 // @pragma Modification 3031 3032 Map.prototype.set = function(k, v) { 3033 return updateMap(this, k, v); 3034 }; 3035 3036 Map.prototype.setIn = function(keyPath, v) { 3037 return this.updateIn(keyPath, NOT_SET, function() {return v}); 3038 }; 3039 3040 Map.prototype.remove = function(k) { 3041 return updateMap(this, k, NOT_SET); 3042 }; 3043 3044 Map.prototype.deleteIn = function(keyPath) { 3045 return this.updateIn(keyPath, function() {return NOT_SET}); 3046 }; 3047 3048 Map.prototype.update = function(k, notSetValue, updater) { 3049 return arguments.length === 1 ? 3050 k(this) : 3051 this.updateIn([k], notSetValue, updater); 3052 }; 3053 3054 Map.prototype.updateIn = function(keyPath, notSetValue, updater) { 3055 if (!updater) { 3056 updater = notSetValue; 3057 notSetValue = undefined; 3058 } 3059 var updatedValue = updateInDeepMap( 3060 this, 3061 forceIterator(keyPath), 3062 notSetValue, 3063 updater 3064 ); 3065 return updatedValue === NOT_SET ? undefined : updatedValue; 3066 }; 3067 3068 Map.prototype.clear = function() { 3069 if (this.size === 0) { 3070 return this; 3071 } 3072 if (this.__ownerID) { 3073 this.size = 0; 3074 this._root = null; 3075 this.__hash = undefined; 3076 this.__altered = true; 3077 return this; 3078 } 3079 return emptyMap(); 3080 }; 3081 3082 // @pragma Composition 3083 3084 Map.prototype.merge = function(/*...iters*/) { 3085 return mergeIntoMapWith(this, undefined, arguments); 3086 }; 3087 3088 Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); 3089 return mergeIntoMapWith(this, merger, iters); 3090 }; 3091 3092 Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); 3093 return this.updateIn( 3094 keyPath, 3095 emptyMap(), 3096 function(m ) {return typeof m.merge === 'function' ? 3097 m.merge.apply(m, iters) : 3098 iters[iters.length - 1]} 3099 ); 3100 }; 3101 3102 Map.prototype.mergeDeep = function(/*...iters*/) { 3103 return mergeIntoMapWith(this, deepMerger, arguments); 3104 }; 3105 3106 Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); 3107 return mergeIntoMapWith(this, deepMergerWith(merger), iters); 3108 }; 3109 3110 Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); 3111 return this.updateIn( 3112 keyPath, 3113 emptyMap(), 3114 function(m ) {return typeof m.mergeDeep === 'function' ? 3115 m.mergeDeep.apply(m, iters) : 3116 iters[iters.length - 1]} 3117 ); 3118 }; 3119 3120 Map.prototype.sort = function(comparator) { 3121 // Late binding 3122 return OrderedMap(sortFactory(this, comparator)); 3123 }; 3124 3125 Map.prototype.sortBy = function(mapper, comparator) { 3126 // Late binding 3127 return OrderedMap(sortFactory(this, comparator, mapper)); 3128 }; 3129 3130 // @pragma Mutability 3131 3132 Map.prototype.withMutations = function(fn) { 3133 var mutable = this.asMutable(); 3134 fn(mutable); 3135 return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; 3136 }; 3137 3138 Map.prototype.asMutable = function() { 3139 return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); 3140 }; 3141 3142 Map.prototype.asImmutable = function() { 3143 return this.__ensureOwner(); 3144 }; 3145 3146 Map.prototype.wasAltered = function() { 3147 return this.__altered; 3148 }; 3149 3150 Map.prototype.__iterator = function(type, reverse) { 3151 return new MapIterator(this, type, reverse); 3152 }; 3153 3154 Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; 3155 var iterations = 0; 3156 this._root && this._root.iterate(function(entry ) { 3157 iterations++; 3158 return fn(entry[1], entry[0], this$0); 3159 }, reverse); 3160 return iterations; 3161 }; 3162 3163 Map.prototype.__ensureOwner = function(ownerID) { 3164 if (ownerID === this.__ownerID) { 3165 return this; 3166 } 3167 if (!ownerID) { 3168 this.__ownerID = ownerID; 3169 this.__altered = false; 3170 return this; 3171 } 3172 return makeMap(this.size, this._root, ownerID, this.__hash); 3173 }; 3174 3175 3176 function isMap(maybeMap) { 3177 return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); 3178 } 3179 3180 Map.isMap = isMap; 3181 3182 var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; 3183 3184 var MapPrototype = Map.prototype; 3185 MapPrototype[IS_MAP_SENTINEL] = true; 3186 MapPrototype[DELETE] = MapPrototype.remove; 3187 MapPrototype.removeIn = MapPrototype.deleteIn; 3188 3189 3190 // #pragma Trie Nodes 3191 3192 3193 3194 function ArrayMapNode(ownerID, entries) { 3195 this.ownerID = ownerID; 3196 this.entries = entries; 3197 } 3198 3199 ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { 3200 var entries = this.entries; 3201 for (var ii = 0, len = entries.length; ii < len; ii++) { 3202 if (is(key, entries[ii][0])) { 3203 return entries[ii][1]; 3204 } 3205 } 3206 return notSetValue; 3207 }; 3208 3209 ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3210 var removed = value === NOT_SET; 3211 3212 var entries = this.entries; 3213 var idx = 0; 3214 for (var len = entries.length; idx < len; idx++) { 3215 if (is(key, entries[idx][0])) { 3216 break; 3217 } 3218 } 3219 var exists = idx < len; 3220 3221 if (exists ? entries[idx][1] === value : removed) { 3222 return this; 3223 } 3224 3225 SetRef(didAlter); 3226 (removed || !exists) && SetRef(didChangeSize); 3227 3228 if (removed && entries.length === 1) { 3229 return; // undefined 3230 } 3231 3232 if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) { 3233 return createNodes(ownerID, entries, key, value); 3234 } 3235 3236 var isEditable = ownerID && ownerID === this.ownerID; 3237 var newEntries = isEditable ? entries : arrCopy(entries); 3238 3239 if (exists) { 3240 if (removed) { 3241 idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); 3242 } else { 3243 newEntries[idx] = [key, value]; 3244 } 3245 } else { 3246 newEntries.push([key, value]); 3247 } 3248 3249 if (isEditable) { 3250 this.entries = newEntries; 3251 return this; 3252 } 3253 3254 return new ArrayMapNode(ownerID, newEntries); 3255 }; 3256 3257 3258 3259 3260 function BitmapIndexedNode(ownerID, bitmap, nodes) { 3261 this.ownerID = ownerID; 3262 this.bitmap = bitmap; 3263 this.nodes = nodes; 3264 } 3265 3266 BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) { 3267 if (keyHash === undefined) { 3268 keyHash = hash(key); 3269 } 3270 var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); 3271 var bitmap = this.bitmap; 3272 return (bitmap & bit) === 0 ? notSetValue : 3273 this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); 3274 }; 3275 3276 BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3277 if (keyHash === undefined) { 3278 keyHash = hash(key); 3279 } 3280 var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; 3281 var bit = 1 << keyHashFrag; 3282 var bitmap = this.bitmap; 3283 var exists = (bitmap & bit) !== 0; 3284 3285 if (!exists && value === NOT_SET) { 3286 return this; 3287 } 3288 3289 var idx = popCount(bitmap & (bit - 1)); 3290 var nodes = this.nodes; 3291 var node = exists ? nodes[idx] : undefined; 3292 var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); 3293 3294 if (newNode === node) { 3295 return this; 3296 } 3297 3298 if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) { 3299 return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); 3300 } 3301 3302 if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { 3303 return nodes[idx ^ 1]; 3304 } 3305 3306 if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) { 3307 return newNode; 3308 } 3309 3310 var isEditable = ownerID && ownerID === this.ownerID; 3311 var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; 3312 var newNodes = exists ? newNode ? 3313 setIn(nodes, idx, newNode, isEditable) : 3314 spliceOut(nodes, idx, isEditable) : 3315 spliceIn(nodes, idx, newNode, isEditable); 3316 3317 if (isEditable) { 3318 this.bitmap = newBitmap; 3319 this.nodes = newNodes; 3320 return this; 3321 } 3322 3323 return new BitmapIndexedNode(ownerID, newBitmap, newNodes); 3324 }; 3325 3326 3327 3328 3329 function HashArrayMapNode(ownerID, count, nodes) { 3330 this.ownerID = ownerID; 3331 this.count = count; 3332 this.nodes = nodes; 3333 } 3334 3335 HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { 3336 if (keyHash === undefined) { 3337 keyHash = hash(key); 3338 } 3339 var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; 3340 var node = this.nodes[idx]; 3341 return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; 3342 }; 3343 3344 HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3345 if (keyHash === undefined) { 3346 keyHash = hash(key); 3347 } 3348 var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; 3349 var removed = value === NOT_SET; 3350 var nodes = this.nodes; 3351 var node = nodes[idx]; 3352 3353 if (removed && !node) { 3354 return this; 3355 } 3356 3357 var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); 3358 if (newNode === node) { 3359 return this; 3360 } 3361 3362 var newCount = this.count; 3363 if (!node) { 3364 newCount++; 3365 } else if (!newNode) { 3366 newCount--; 3367 if (newCount < MIN_HASH_ARRAY_MAP_SIZE) { 3368 return packNodes(ownerID, nodes, newCount, idx); 3369 } 3370 } 3371 3372 var isEditable = ownerID && ownerID === this.ownerID; 3373 var newNodes = setIn(nodes, idx, newNode, isEditable); 3374 3375 if (isEditable) { 3376 this.count = newCount; 3377 this.nodes = newNodes; 3378 return this; 3379 } 3380 3381 return new HashArrayMapNode(ownerID, newCount, newNodes); 3382 }; 3383 3384 3385 3386 3387 function HashCollisionNode(ownerID, keyHash, entries) { 3388 this.ownerID = ownerID; 3389 this.keyHash = keyHash; 3390 this.entries = entries; 3391 } 3392 3393 HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) { 3394 var entries = this.entries; 3395 for (var ii = 0, len = entries.length; ii < len; ii++) { 3396 if (is(key, entries[ii][0])) { 3397 return entries[ii][1]; 3398 } 3399 } 3400 return notSetValue; 3401 }; 3402 3403 HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3404 if (keyHash === undefined) { 3405 keyHash = hash(key); 3406 } 3407 3408 var removed = value === NOT_SET; 3409 3410 if (keyHash !== this.keyHash) { 3411 if (removed) { 3412 return this; 3413 } 3414 SetRef(didAlter); 3415 SetRef(didChangeSize); 3416 return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); 3417 } 3418 3419 var entries = this.entries; 3420 var idx = 0; 3421 for (var len = entries.length; idx < len; idx++) { 3422 if (is(key, entries[idx][0])) { 3423 break; 3424 } 3425 } 3426 var exists = idx < len; 3427 3428 if (exists ? entries[idx][1] === value : removed) { 3429 return this; 3430 } 3431 3432 SetRef(didAlter); 3433 (removed || !exists) && SetRef(didChangeSize); 3434 3435 if (removed && len === 2) { 3436 return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); 3437 } 3438 3439 var isEditable = ownerID && ownerID === this.ownerID; 3440 var newEntries = isEditable ? entries : arrCopy(entries); 3441 3442 if (exists) { 3443 if (removed) { 3444 idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); 3445 } else { 3446 newEntries[idx] = [key, value]; 3447 } 3448 } else { 3449 newEntries.push([key, value]); 3450 } 3451 3452 if (isEditable) { 3453 this.entries = newEntries; 3454 return this; 3455 } 3456 3457 return new HashCollisionNode(ownerID, this.keyHash, newEntries); 3458 }; 3459 3460 3461 3462 3463 function ValueNode(ownerID, keyHash, entry) { 3464 this.ownerID = ownerID; 3465 this.keyHash = keyHash; 3466 this.entry = entry; 3467 } 3468 3469 ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) { 3470 return is(key, this.entry[0]) ? this.entry[1] : notSetValue; 3471 }; 3472 3473 ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3474 var removed = value === NOT_SET; 3475 var keyMatch = is(key, this.entry[0]); 3476 if (keyMatch ? value === this.entry[1] : removed) { 3477 return this; 3478 } 3479 3480 SetRef(didAlter); 3481 3482 if (removed) { 3483 SetRef(didChangeSize); 3484 return; // undefined 3485 } 3486 3487 if (keyMatch) { 3488 if (ownerID && ownerID === this.ownerID) { 3489 this.entry[1] = value; 3490 return this; 3491 } 3492 return new ValueNode(ownerID, this.keyHash, [key, value]); 3493 } 3494 3495 SetRef(didChangeSize); 3496 return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]); 3497 }; 3498 3499 3500 3501 // #pragma Iterators 3502 3503 ArrayMapNode.prototype.iterate = 3504 HashCollisionNode.prototype.iterate = function (fn, reverse) { 3505 var entries = this.entries; 3506 for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { 3507 if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { 3508 return false; 3509 } 3510 } 3511 } 3512 3513 BitmapIndexedNode.prototype.iterate = 3514 HashArrayMapNode.prototype.iterate = function (fn, reverse) { 3515 var nodes = this.nodes; 3516 for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { 3517 var node = nodes[reverse ? maxIndex - ii : ii]; 3518 if (node && node.iterate(fn, reverse) === false) { 3519 return false; 3520 } 3521 } 3522 } 3523 3524 ValueNode.prototype.iterate = function (fn, reverse) { 3525 return fn(this.entry); 3526 } 3527 3528 createClass(MapIterator, Iterator); 3529 3530 function MapIterator(map, type, reverse) { 3531 this._type = type; 3532 this._reverse = reverse; 3533 this._stack = map._root && mapIteratorFrame(map._root); 3534 } 3535 3536 MapIterator.prototype.next = function() { 3537 var type = this._type; 3538 var stack = this._stack; 3539 while (stack) { 3540 var node = stack.node; 3541 var index = stack.index++; 3542 var maxIndex; 3543 if (node.entry) { 3544 if (index === 0) { 3545 return mapIteratorValue(type, node.entry); 3546 } 3547 } else if (node.entries) { 3548 maxIndex = node.entries.length - 1; 3549 if (index <= maxIndex) { 3550 return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); 3551 } 3552 } else { 3553 maxIndex = node.nodes.length - 1; 3554 if (index <= maxIndex) { 3555 var subNode = node.nodes[this._reverse ? maxIndex - index : index]; 3556 if (subNode) { 3557 if (subNode.entry) { 3558 return mapIteratorValue(type, subNode.entry); 3559 } 3560 stack = this._stack = mapIteratorFrame(subNode, stack); 3561 } 3562 continue; 3563 } 3564 } 3565 stack = this._stack = this._stack.__prev; 3566 } 3567 return iteratorDone(); 3568 }; 3569 3570 3571 function mapIteratorValue(type, entry) { 3572 return iteratorValue(type, entry[0], entry[1]); 3573 } 3574 3575 function mapIteratorFrame(node, prev) { 3576 return { 3577 node: node, 3578 index: 0, 3579 __prev: prev 3580 }; 3581 } 3582 3583 function makeMap(size, root, ownerID, hash) { 3584 var map = Object.create(MapPrototype); 3585 map.size = size; 3586 map._root = root; 3587 map.__ownerID = ownerID; 3588 map.__hash = hash; 3589 map.__altered = false; 3590 return map; 3591 } 3592 3593 var EMPTY_MAP; 3594 function emptyMap() { 3595 return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); 3596 } 3597 3598 function updateMap(map, k, v) { 3599 var newRoot; 3600 var newSize; 3601 if (!map._root) { 3602 if (v === NOT_SET) { 3603 return map; 3604 } 3605 newSize = 1; 3606 newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); 3607 } else { 3608 var didChangeSize = MakeRef(CHANGE_LENGTH); 3609 var didAlter = MakeRef(DID_ALTER); 3610 newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); 3611 if (!didAlter.value) { 3612 return map; 3613 } 3614 newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); 3615 } 3616 if (map.__ownerID) { 3617 map.size = newSize; 3618 map._root = newRoot; 3619 map.__hash = undefined; 3620 map.__altered = true; 3621 return map; 3622 } 3623 return newRoot ? makeMap(newSize, newRoot) : emptyMap(); 3624 } 3625 3626 function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { 3627 if (!node) { 3628 if (value === NOT_SET) { 3629 return node; 3630 } 3631 SetRef(didAlter); 3632 SetRef(didChangeSize); 3633 return new ValueNode(ownerID, keyHash, [key, value]); 3634 } 3635 return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); 3636 } 3637 3638 function isLeafNode(node) { 3639 return node.constructor === ValueNode || node.constructor === HashCollisionNode; 3640 } 3641 3642 function mergeIntoNode(node, ownerID, shift, keyHash, entry) { 3643 if (node.keyHash === keyHash) { 3644 return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); 3645 } 3646 3647 var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; 3648 var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; 3649 3650 var newNode; 3651 var nodes = idx1 === idx2 ? 3652 [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : 3653 ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); 3654 3655 return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); 3656 } 3657 3658 function createNodes(ownerID, entries, key, value) { 3659 if (!ownerID) { 3660 ownerID = new OwnerID(); 3661 } 3662 var node = new ValueNode(ownerID, hash(key), [key, value]); 3663 for (var ii = 0; ii < entries.length; ii++) { 3664 var entry = entries[ii]; 3665 node = node.update(ownerID, 0, undefined, entry[0], entry[1]); 3666 } 3667 return node; 3668 } 3669 3670 function packNodes(ownerID, nodes, count, excluding) { 3671 var bitmap = 0; 3672 var packedII = 0; 3673 var packedNodes = new Array(count); 3674 for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { 3675 var node = nodes[ii]; 3676 if (node !== undefined && ii !== excluding) { 3677 bitmap |= bit; 3678 packedNodes[packedII++] = node; 3679 } 3680 } 3681 return new BitmapIndexedNode(ownerID, bitmap, packedNodes); 3682 } 3683 3684 function expandNodes(ownerID, nodes, bitmap, including, node) { 3685 var count = 0; 3686 var expandedNodes = new Array(SIZE); 3687 for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { 3688 expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; 3689 } 3690 expandedNodes[including] = node; 3691 return new HashArrayMapNode(ownerID, count + 1, expandedNodes); 3692 } 3693 3694 function mergeIntoMapWith(map, merger, iterables) { 3695 var iters = []; 3696 for (var ii = 0; ii < iterables.length; ii++) { 3697 var value = iterables[ii]; 3698 var iter = KeyedIterable(value); 3699 if (!isIterable(value)) { 3700 iter = iter.map(function(v ) {return fromJS(v)}); 3701 } 3702 iters.push(iter); 3703 } 3704 return mergeIntoCollectionWith(map, merger, iters); 3705 } 3706 3707 function deepMerger(existing, value, key) { 3708 return existing && existing.mergeDeep && isIterable(value) ? 3709 existing.mergeDeep(value) : 3710 is(existing, value) ? existing : value; 3711 } 3712 3713 function deepMergerWith(merger) { 3714 return function(existing, value, key) { 3715 if (existing && existing.mergeDeepWith && isIterable(value)) { 3716 return existing.mergeDeepWith(merger, value); 3717 } 3718 var nextValue = merger(existing, value, key); 3719 return is(existing, nextValue) ? existing : nextValue; 3720 }; 3721 } 3722 3723 function mergeIntoCollectionWith(collection, merger, iters) { 3724 iters = iters.filter(function(x ) {return x.size !== 0}); 3725 if (iters.length === 0) { 3726 return collection; 3727 } 3728 if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { 3729 return collection.constructor(iters[0]); 3730 } 3731 return collection.withMutations(function(collection ) { 3732 var mergeIntoMap = merger ? 3733 function(value, key) { 3734 collection.update(key, NOT_SET, function(existing ) 3735 {return existing === NOT_SET ? value : merger(existing, value, key)} 3736 ); 3737 } : 3738 function(value, key) { 3739 collection.set(key, value); 3740 } 3741 for (var ii = 0; ii < iters.length; ii++) { 3742 iters[ii].forEach(mergeIntoMap); 3743 } 3744 }); 3745 } 3746 3747 function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { 3748 var isNotSet = existing === NOT_SET; 3749 var step = keyPathIter.next(); 3750 if (step.done) { 3751 var existingValue = isNotSet ? notSetValue : existing; 3752 var newValue = updater(existingValue); 3753 return newValue === existingValue ? existing : newValue; 3754 } 3755 invariant( 3756 isNotSet || (existing && existing.set), 3757 'invalid keyPath' 3758 ); 3759 var key = step.value; 3760 var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); 3761 var nextUpdated = updateInDeepMap( 3762 nextExisting, 3763 keyPathIter, 3764 notSetValue, 3765 updater 3766 ); 3767 return nextUpdated === nextExisting ? existing : 3768 nextUpdated === NOT_SET ? existing.remove(key) : 3769 (isNotSet ? emptyMap() : existing).set(key, nextUpdated); 3770 } 3771 3772 function popCount(x) { 3773 x = x - ((x >> 1) & 0x55555555); 3774 x = (x & 0x33333333) + ((x >> 2) & 0x33333333); 3775 x = (x + (x >> 4)) & 0x0f0f0f0f; 3776 x = x + (x >> 8); 3777 x = x + (x >> 16); 3778 return x & 0x7f; 3779 } 3780 3781 function setIn(array, idx, val, canEdit) { 3782 var newArray = canEdit ? array : arrCopy(array); 3783 newArray[idx] = val; 3784 return newArray; 3785 } 3786 3787 function spliceIn(array, idx, val, canEdit) { 3788 var newLen = array.length + 1; 3789 if (canEdit && idx + 1 === newLen) { 3790 array[idx] = val; 3791 return array; 3792 } 3793 var newArray = new Array(newLen); 3794 var after = 0; 3795 for (var ii = 0; ii < newLen; ii++) { 3796 if (ii === idx) { 3797 newArray[ii] = val; 3798 after = -1; 3799 } else { 3800 newArray[ii] = array[ii + after]; 3801 } 3802 } 3803 return newArray; 3804 } 3805 3806 function spliceOut(array, idx, canEdit) { 3807 var newLen = array.length - 1; 3808 if (canEdit && idx === newLen) { 3809 array.pop(); 3810 return array; 3811 } 3812 var newArray = new Array(newLen); 3813 var after = 0; 3814 for (var ii = 0; ii < newLen; ii++) { 3815 if (ii === idx) { 3816 after = 1; 3817 } 3818 newArray[ii] = array[ii + after]; 3819 } 3820 return newArray; 3821 } 3822 3823 var MAX_ARRAY_MAP_SIZE = SIZE / 4; 3824 var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; 3825 var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; 3826 3827 createClass(List, IndexedCollection); 3828 3829 // @pragma Construction 3830 3831 function List(value) { 3832 var empty = emptyList(); 3833 if (value === null || value === undefined) { 3834 return empty; 3835 } 3836 if (isList(value)) { 3837 return value; 3838 } 3839 var iter = IndexedIterable(value); 3840 var size = iter.size; 3841 if (size === 0) { 3842 return empty; 3843 } 3844 assertNotInfinite(size); 3845 if (size > 0 && size < SIZE) { 3846 return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); 3847 } 3848 return empty.withMutations(function(list ) { 3849 list.setSize(size); 3850 iter.forEach(function(v, i) {return list.set(i, v)}); 3851 }); 3852 } 3853 3854 List.of = function(/*...values*/) { 3855 return this(arguments); 3856 }; 3857 3858 List.prototype.toString = function() { 3859 return this.__toString('List [', ']'); 3860 }; 3861 3862 // @pragma Access 3863 3864 List.prototype.get = function(index, notSetValue) { 3865 index = wrapIndex(this, index); 3866 if (index >= 0 && index < this.size) { 3867 index += this._origin; 3868 var node = listNodeFor(this, index); 3869 return node && node.array[index & MASK]; 3870 } 3871 return notSetValue; 3872 }; 3873 3874 // @pragma Modification 3875 3876 List.prototype.set = function(index, value) { 3877 return updateList(this, index, value); 3878 }; 3879 3880 List.prototype.remove = function(index) { 3881 return !this.has(index) ? this : 3882 index === 0 ? this.shift() : 3883 index === this.size - 1 ? this.pop() : 3884 this.splice(index, 1); 3885 }; 3886 3887 List.prototype.insert = function(index, value) { 3888 return this.splice(index, 0, value); 3889 }; 3890 3891 List.prototype.clear = function() { 3892 if (this.size === 0) { 3893 return this; 3894 } 3895 if (this.__ownerID) { 3896 this.size = this._origin = this._capacity = 0; 3897 this._level = SHIFT; 3898 this._root = this._tail = null; 3899 this.__hash = undefined; 3900 this.__altered = true; 3901 return this; 3902 } 3903 return emptyList(); 3904 }; 3905 3906 List.prototype.push = function(/*...values*/) { 3907 var values = arguments; 3908 var oldSize = this.size; 3909 return this.withMutations(function(list ) { 3910 setListBounds(list, 0, oldSize + values.length); 3911 for (var ii = 0; ii < values.length; ii++) { 3912 list.set(oldSize + ii, values[ii]); 3913 } 3914 }); 3915 }; 3916 3917 List.prototype.pop = function() { 3918 return setListBounds(this, 0, -1); 3919 }; 3920 3921 List.prototype.unshift = function(/*...values*/) { 3922 var values = arguments; 3923 return this.withMutations(function(list ) { 3924 setListBounds(list, -values.length); 3925 for (var ii = 0; ii < values.length; ii++) { 3926 list.set(ii, values[ii]); 3927 } 3928 }); 3929 }; 3930 3931 List.prototype.shift = function() { 3932 return setListBounds(this, 1); 3933 }; 3934 3935 // @pragma Composition 3936 3937 List.prototype.merge = function(/*...iters*/) { 3938 return mergeIntoListWith(this, undefined, arguments); 3939 }; 3940 3941 List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); 3942 return mergeIntoListWith(this, merger, iters); 3943 }; 3944 3945 List.prototype.mergeDeep = function(/*...iters*/) { 3946 return mergeIntoListWith(this, deepMerger, arguments); 3947 }; 3948 3949 List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); 3950 return mergeIntoListWith(this, deepMergerWith(merger), iters); 3951 }; 3952 3953 List.prototype.setSize = function(size) { 3954 return setListBounds(this, 0, size); 3955 }; 3956 3957 // @pragma Iteration 3958 3959 List.prototype.slice = function(begin, end) { 3960 var size = this.size; 3961 if (wholeSlice(begin, end, size)) { 3962 return this; 3963 } 3964 return setListBounds( 3965 this, 3966 resolveBegin(begin, size), 3967 resolveEnd(end, size) 3968 ); 3969 }; 3970 3971 List.prototype.__iterator = function(type, reverse) { 3972 var index = 0; 3973 var values = iterateList(this, reverse); 3974 return new Iterator(function() { 3975 var value = values(); 3976 return value === DONE ? 3977 iteratorDone() : 3978 iteratorValue(type, index++, value); 3979 }); 3980 }; 3981 3982 List.prototype.__iterate = function(fn, reverse) { 3983 var index = 0; 3984 var values = iterateList(this, reverse); 3985 var value; 3986 while ((value = values()) !== DONE) { 3987 if (fn(value, index++, this) === false) { 3988 break; 3989 } 3990 } 3991 return index; 3992 }; 3993 3994 List.prototype.__ensureOwner = function(ownerID) { 3995 if (ownerID === this.__ownerID) { 3996 return this; 3997 } 3998 if (!ownerID) { 3999 this.__ownerID = ownerID; 4000 return this; 4001 } 4002 return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); 4003 }; 4004 4005 4006 function isList(maybeList) { 4007 return !!(maybeList && maybeList[IS_LIST_SENTINEL]); 4008 } 4009 4010 List.isList = isList; 4011 4012 var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; 4013 4014 var ListPrototype = List.prototype; 4015 ListPrototype[IS_LIST_SENTINEL] = true; 4016 ListPrototype[DELETE] = ListPrototype.remove; 4017 ListPrototype.setIn = MapPrototype.setIn; 4018 ListPrototype.deleteIn = 4019 ListPrototype.removeIn = MapPrototype.removeIn; 4020 ListPrototype.update = MapPrototype.update; 4021 ListPrototype.updateIn = MapPrototype.updateIn; 4022 ListPrototype.mergeIn = MapPrototype.mergeIn; 4023 ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; 4024 ListPrototype.withMutations = MapPrototype.withMutations; 4025 ListPrototype.asMutable = MapPrototype.asMutable; 4026 ListPrototype.asImmutable = MapPrototype.asImmutable; 4027 ListPrototype.wasAltered = MapPrototype.wasAltered; 4028 4029 4030 4031 function VNode(array, ownerID) { 4032 this.array = array; 4033 this.ownerID = ownerID; 4034 } 4035 4036 // TODO: seems like these methods are very similar 4037 4038 VNode.prototype.removeBefore = function(ownerID, level, index) { 4039 if (index === level ? 1 << level : 0 || this.array.length === 0) { 4040 return this; 4041 } 4042 var originIndex = (index >>> level) & MASK; 4043 if (originIndex >= this.array.length) { 4044 return new VNode([], ownerID); 4045 } 4046 var removingFirst = originIndex === 0; 4047 var newChild; 4048 if (level > 0) { 4049 var oldChild = this.array[originIndex]; 4050 newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); 4051 if (newChild === oldChild && removingFirst) { 4052 return this; 4053 } 4054 } 4055 if (removingFirst && !newChild) { 4056 return this; 4057 } 4058 var editable = editableVNode(this, ownerID); 4059 if (!removingFirst) { 4060 for (var ii = 0; ii < originIndex; ii++) { 4061 editable.array[ii] = undefined; 4062 } 4063 } 4064 if (newChild) { 4065 editable.array[originIndex] = newChild; 4066 } 4067 return editable; 4068 }; 4069 4070 VNode.prototype.removeAfter = function(ownerID, level, index) { 4071 if (index === (level ? 1 << level : 0) || this.array.length === 0) { 4072 return this; 4073 } 4074 var sizeIndex = ((index - 1) >>> level) & MASK; 4075 if (sizeIndex >= this.array.length) { 4076 return this; 4077 } 4078 4079 var newChild; 4080 if (level > 0) { 4081 var oldChild = this.array[sizeIndex]; 4082 newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); 4083 if (newChild === oldChild && sizeIndex === this.array.length - 1) { 4084 return this; 4085 } 4086 } 4087 4088 var editable = editableVNode(this, ownerID); 4089 editable.array.splice(sizeIndex + 1); 4090 if (newChild) { 4091 editable.array[sizeIndex] = newChild; 4092 } 4093 return editable; 4094 }; 4095 4096 4097 4098 var DONE = {}; 4099 4100 function iterateList(list, reverse) { 4101 var left = list._origin; 4102 var right = list._capacity; 4103 var tailPos = getTailOffset(right); 4104 var tail = list._tail; 4105 4106 return iterateNodeOrLeaf(list._root, list._level, 0); 4107 4108 function iterateNodeOrLeaf(node, level, offset) { 4109 return level === 0 ? 4110 iterateLeaf(node, offset) : 4111 iterateNode(node, level, offset); 4112 } 4113 4114 function iterateLeaf(node, offset) { 4115 var array = offset === tailPos ? tail && tail.array : node && node.array; 4116 var from = offset > left ? 0 : left - offset; 4117 var to = right - offset; 4118 if (to > SIZE) { 4119 to = SIZE; 4120 } 4121 return function() { 4122 if (from === to) { 4123 return DONE; 4124 } 4125 var idx = reverse ? --to : from++; 4126 return array && array[idx]; 4127 }; 4128 } 4129 4130 function iterateNode(node, level, offset) { 4131 var values; 4132 var array = node && node.array; 4133 var from = offset > left ? 0 : (left - offset) >> level; 4134 var to = ((right - offset) >> level) + 1; 4135 if (to > SIZE) { 4136 to = SIZE; 4137 } 4138 return function() { 4139 do { 4140 if (values) { 4141 var value = values(); 4142 if (value !== DONE) { 4143 return value; 4144 } 4145 values = null; 4146 } 4147 if (from === to) { 4148 return DONE; 4149 } 4150 var idx = reverse ? --to : from++; 4151 values = iterateNodeOrLeaf( 4152 array && array[idx], level - SHIFT, offset + (idx << level) 4153 ); 4154 } while (true); 4155 }; 4156 } 4157 } 4158 4159 function makeList(origin, capacity, level, root, tail, ownerID, hash) { 4160 var list = Object.create(ListPrototype); 4161 list.size = capacity - origin; 4162 list._origin = origin; 4163 list._capacity = capacity; 4164 list._level = level; 4165 list._root = root; 4166 list._tail = tail; 4167 list.__ownerID = ownerID; 4168 list.__hash = hash; 4169 list.__altered = false; 4170 return list; 4171 } 4172 4173 var EMPTY_LIST; 4174 function emptyList() { 4175 return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); 4176 } 4177 4178 function updateList(list, index, value) { 4179 index = wrapIndex(list, index); 4180 4181 if (index !== index) { 4182 return list; 4183 } 4184 4185 if (index >= list.size || index < 0) { 4186 return list.withMutations(function(list ) { 4187 index < 0 ? 4188 setListBounds(list, index).set(0, value) : 4189 setListBounds(list, 0, index + 1).set(index, value) 4190 }); 4191 } 4192 4193 index += list._origin; 4194 4195 var newTail = list._tail; 4196 var newRoot = list._root; 4197 var didAlter = MakeRef(DID_ALTER); 4198 if (index >= getTailOffset(list._capacity)) { 4199 newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); 4200 } else { 4201 newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); 4202 } 4203 4204 if (!didAlter.value) { 4205 return list; 4206 } 4207 4208 if (list.__ownerID) { 4209 list._root = newRoot; 4210 list._tail = newTail; 4211 list.__hash = undefined; 4212 list.__altered = true; 4213 return list; 4214 } 4215 return makeList(list._origin, list._capacity, list._level, newRoot, newTail); 4216 } 4217 4218 function updateVNode(node, ownerID, level, index, value, didAlter) { 4219 var idx = (index >>> level) & MASK; 4220 var nodeHas = node && idx < node.array.length; 4221 if (!nodeHas && value === undefined) { 4222 return node; 4223 } 4224 4225 var newNode; 4226 4227 if (level > 0) { 4228 var lowerNode = node && node.array[idx]; 4229 var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); 4230 if (newLowerNode === lowerNode) { 4231 return node; 4232 } 4233 newNode = editableVNode(node, ownerID); 4234 newNode.array[idx] = newLowerNode; 4235 return newNode; 4236 } 4237 4238 if (nodeHas && node.array[idx] === value) { 4239 return node; 4240 } 4241 4242 SetRef(didAlter); 4243 4244 newNode = editableVNode(node, ownerID); 4245 if (value === undefined && idx === newNode.array.length - 1) { 4246 newNode.array.pop(); 4247 } else { 4248 newNode.array[idx] = value; 4249 } 4250 return newNode; 4251 } 4252 4253 function editableVNode(node, ownerID) { 4254 if (ownerID && node && ownerID === node.ownerID) { 4255 return node; 4256 } 4257 return new VNode(node ? node.array.slice() : [], ownerID); 4258 } 4259 4260 function listNodeFor(list, rawIndex) { 4261 if (rawIndex >= getTailOffset(list._capacity)) { 4262 return list._tail; 4263 } 4264 if (rawIndex < 1 << (list._level + SHIFT)) { 4265 var node = list._root; 4266 var level = list._level; 4267 while (node && level > 0) { 4268 node = node.array[(rawIndex >>> level) & MASK]; 4269 level -= SHIFT; 4270 } 4271 return node; 4272 } 4273 } 4274 4275 function setListBounds(list, begin, end) { 4276 // Sanitize begin & end using this shorthand for ToInt32(argument) 4277 // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 4278 if (begin !== undefined) { 4279 begin = begin | 0; 4280 } 4281 if (end !== undefined) { 4282 end = end | 0; 4283 } 4284 var owner = list.__ownerID || new OwnerID(); 4285 var oldOrigin = list._origin; 4286 var oldCapacity = list._capacity; 4287 var newOrigin = oldOrigin + begin; 4288 var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; 4289 if (newOrigin === oldOrigin && newCapacity === oldCapacity) { 4290 return list; 4291 } 4292 4293 // If it's going to end after it starts, it's empty. 4294 if (newOrigin >= newCapacity) { 4295 return list.clear(); 4296 } 4297 4298 var newLevel = list._level; 4299 var newRoot = list._root; 4300 4301 // New origin might need creating a higher root. 4302 var offsetShift = 0; 4303 while (newOrigin + offsetShift < 0) { 4304 newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); 4305 newLevel += SHIFT; 4306 offsetShift += 1 << newLevel; 4307 } 4308 if (offsetShift) { 4309 newOrigin += offsetShift; 4310 oldOrigin += offsetShift; 4311 newCapacity += offsetShift; 4312 oldCapacity += offsetShift; 4313 } 4314 4315 var oldTailOffset = getTailOffset(oldCapacity); 4316 var newTailOffset = getTailOffset(newCapacity); 4317 4318 // New size might need creating a higher root. 4319 while (newTailOffset >= 1 << (newLevel + SHIFT)) { 4320 newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); 4321 newLevel += SHIFT; 4322 } 4323 4324 // Locate or create the new tail. 4325 var oldTail = list._tail; 4326 var newTail = newTailOffset < oldTailOffset ? 4327 listNodeFor(list, newCapacity - 1) : 4328 newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; 4329 4330 // Merge Tail into tree. 4331 if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { 4332 newRoot = editableVNode(newRoot, owner); 4333 var node = newRoot; 4334 for (var level = newLevel; level > SHIFT; level -= SHIFT) { 4335 var idx = (oldTailOffset >>> level) & MASK; 4336 node = node.array[idx] = editableVNode(node.array[idx], owner); 4337 } 4338 node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; 4339 } 4340 4341 // If the size has been reduced, there's a chance the tail needs to be trimmed. 4342 if (newCapacity < oldCapacity) { 4343 newTail = newTail && newTail.removeAfter(owner, 0, newCapacity); 4344 } 4345 4346 // If the new origin is within the tail, then we do not need a root. 4347 if (newOrigin >= newTailOffset) { 4348 newOrigin -= newTailOffset; 4349 newCapacity -= newTailOffset; 4350 newLevel = SHIFT; 4351 newRoot = null; 4352 newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); 4353 4354 // Otherwise, if the root has been trimmed, garbage collect. 4355 } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { 4356 offsetShift = 0; 4357 4358 // Identify the new top root node of the subtree of the old root. 4359 while (newRoot) { 4360 var beginIndex = (newOrigin >>> newLevel) & MASK; 4361 if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { 4362 break; 4363 } 4364 if (beginIndex) { 4365 offsetShift += (1 << newLevel) * beginIndex; 4366 } 4367 newLevel -= SHIFT; 4368 newRoot = newRoot.array[beginIndex]; 4369 } 4370 4371 // Trim the new sides of the new root. 4372 if (newRoot && newOrigin > oldOrigin) { 4373 newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); 4374 } 4375 if (newRoot && newTailOffset < oldTailOffset) { 4376 newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); 4377 } 4378 if (offsetShift) { 4379 newOrigin -= offsetShift; 4380 newCapacity -= offsetShift; 4381 } 4382 } 4383 4384 if (list.__ownerID) { 4385 list.size = newCapacity - newOrigin; 4386 list._origin = newOrigin; 4387 list._capacity = newCapacity; 4388 list._level = newLevel; 4389 list._root = newRoot; 4390 list._tail = newTail; 4391 list.__hash = undefined; 4392 list.__altered = true; 4393 return list; 4394 } 4395 return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); 4396 } 4397 4398 function mergeIntoListWith(list, merger, iterables) { 4399 var iters = []; 4400 var maxSize = 0; 4401 for (var ii = 0; ii < iterables.length; ii++) { 4402 var value = iterables[ii]; 4403 var iter = IndexedIterable(value); 4404 if (iter.size > maxSize) { 4405 maxSize = iter.size; 4406 } 4407 if (!isIterable(value)) { 4408 iter = iter.map(function(v ) {return fromJS(v)}); 4409 } 4410 iters.push(iter); 4411 } 4412 if (maxSize > list.size) { 4413 list = list.setSize(maxSize); 4414 } 4415 return mergeIntoCollectionWith(list, merger, iters); 4416 } 4417 4418 function getTailOffset(size) { 4419 return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); 4420 } 4421 4422 createClass(OrderedMap, Map); 4423 4424 // @pragma Construction 4425 4426 function OrderedMap(value) { 4427 return value === null || value === undefined ? emptyOrderedMap() : 4428 isOrderedMap(value) ? value : 4429 emptyOrderedMap().withMutations(function(map ) { 4430 var iter = KeyedIterable(value); 4431 assertNotInfinite(iter.size); 4432 iter.forEach(function(v, k) {return map.set(k, v)}); 4433 }); 4434 } 4435 4436 OrderedMap.of = function(/*...values*/) { 4437 return this(arguments); 4438 }; 4439 4440 OrderedMap.prototype.toString = function() { 4441 return this.__toString('OrderedMap {', '}'); 4442 }; 4443 4444 // @pragma Access 4445 4446 OrderedMap.prototype.get = function(k, notSetValue) { 4447 var index = this._map.get(k); 4448 return index !== undefined ? this._list.get(index)[1] : notSetValue; 4449 }; 4450 4451 // @pragma Modification 4452 4453 OrderedMap.prototype.clear = function() { 4454 if (this.size === 0) { 4455 return this; 4456 } 4457 if (this.__ownerID) { 4458 this.size = 0; 4459 this._map.clear(); 4460 this._list.clear(); 4461 return this; 4462 } 4463 return emptyOrderedMap(); 4464 }; 4465 4466 OrderedMap.prototype.set = function(k, v) { 4467 return updateOrderedMap(this, k, v); 4468 }; 4469 4470 OrderedMap.prototype.remove = function(k) { 4471 return updateOrderedMap(this, k, NOT_SET); 4472 }; 4473 4474 OrderedMap.prototype.wasAltered = function() { 4475 return this._map.wasAltered() || this._list.wasAltered(); 4476 }; 4477 4478 OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; 4479 return this._list.__iterate( 4480 function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, 4481 reverse 4482 ); 4483 }; 4484 4485 OrderedMap.prototype.__iterator = function(type, reverse) { 4486 return this._list.fromEntrySeq().__iterator(type, reverse); 4487 }; 4488 4489 OrderedMap.prototype.__ensureOwner = function(ownerID) { 4490 if (ownerID === this.__ownerID) { 4491 return this; 4492 } 4493 var newMap = this._map.__ensureOwner(ownerID); 4494 var newList = this._list.__ensureOwner(ownerID); 4495 if (!ownerID) { 4496 this.__ownerID = ownerID; 4497 this._map = newMap; 4498 this._list = newList; 4499 return this; 4500 } 4501 return makeOrderedMap(newMap, newList, ownerID, this.__hash); 4502 }; 4503 4504 4505 function isOrderedMap(maybeOrderedMap) { 4506 return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); 4507 } 4508 4509 OrderedMap.isOrderedMap = isOrderedMap; 4510 4511 OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; 4512 OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; 4513 4514 4515 4516 function makeOrderedMap(map, list, ownerID, hash) { 4517 var omap = Object.create(OrderedMap.prototype); 4518 omap.size = map ? map.size : 0; 4519 omap._map = map; 4520 omap._list = list; 4521 omap.__ownerID = ownerID; 4522 omap.__hash = hash; 4523 return omap; 4524 } 4525 4526 var EMPTY_ORDERED_MAP; 4527 function emptyOrderedMap() { 4528 return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); 4529 } 4530 4531 function updateOrderedMap(omap, k, v) { 4532 var map = omap._map; 4533 var list = omap._list; 4534 var i = map.get(k); 4535 var has = i !== undefined; 4536 var newMap; 4537 var newList; 4538 if (v === NOT_SET) { // removed 4539 if (!has) { 4540 return omap; 4541 } 4542 if (list.size >= SIZE && list.size >= map.size * 2) { 4543 newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); 4544 newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); 4545 if (omap.__ownerID) { 4546 newMap.__ownerID = newList.__ownerID = omap.__ownerID; 4547 } 4548 } else { 4549 newMap = map.remove(k); 4550 newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); 4551 } 4552 } else { 4553 if (has) { 4554 if (v === list.get(i)[1]) { 4555 return omap; 4556 } 4557 newMap = map; 4558 newList = list.set(i, [k, v]); 4559 } else { 4560 newMap = map.set(k, list.size); 4561 newList = list.set(list.size, [k, v]); 4562 } 4563 } 4564 if (omap.__ownerID) { 4565 omap.size = newMap.size; 4566 omap._map = newMap; 4567 omap._list = newList; 4568 omap.__hash = undefined; 4569 return omap; 4570 } 4571 return makeOrderedMap(newMap, newList); 4572 } 4573 4574 createClass(ToKeyedSequence, KeyedSeq); 4575 function ToKeyedSequence(indexed, useKeys) { 4576 this._iter = indexed; 4577 this._useKeys = useKeys; 4578 this.size = indexed.size; 4579 } 4580 4581 ToKeyedSequence.prototype.get = function(key, notSetValue) { 4582 return this._iter.get(key, notSetValue); 4583 }; 4584 4585 ToKeyedSequence.prototype.has = function(key) { 4586 return this._iter.has(key); 4587 }; 4588 4589 ToKeyedSequence.prototype.valueSeq = function() { 4590 return this._iter.valueSeq(); 4591 }; 4592 4593 ToKeyedSequence.prototype.reverse = function() {var this$0 = this; 4594 var reversedSequence = reverseFactory(this, true); 4595 if (!this._useKeys) { 4596 reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; 4597 } 4598 return reversedSequence; 4599 }; 4600 4601 ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; 4602 var mappedSequence = mapFactory(this, mapper, context); 4603 if (!this._useKeys) { 4604 mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; 4605 } 4606 return mappedSequence; 4607 }; 4608 4609 ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; 4610 var ii; 4611 return this._iter.__iterate( 4612 this._useKeys ? 4613 function(v, k) {return fn(v, k, this$0)} : 4614 ((ii = reverse ? resolveSize(this) : 0), 4615 function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), 4616 reverse 4617 ); 4618 }; 4619 4620 ToKeyedSequence.prototype.__iterator = function(type, reverse) { 4621 if (this._useKeys) { 4622 return this._iter.__iterator(type, reverse); 4623 } 4624 var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); 4625 var ii = reverse ? resolveSize(this) : 0; 4626 return new Iterator(function() { 4627 var step = iterator.next(); 4628 return step.done ? step : 4629 iteratorValue(type, reverse ? --ii : ii++, step.value, step); 4630 }); 4631 }; 4632 4633 ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; 4634 4635 4636 createClass(ToIndexedSequence, IndexedSeq); 4637 function ToIndexedSequence(iter) { 4638 this._iter = iter; 4639 this.size = iter.size; 4640 } 4641 4642 ToIndexedSequence.prototype.includes = function(value) { 4643 return this._iter.includes(value); 4644 }; 4645 4646 ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; 4647 var iterations = 0; 4648 return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); 4649 }; 4650 4651 ToIndexedSequence.prototype.__iterator = function(type, reverse) { 4652 var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); 4653 var iterations = 0; 4654 return new Iterator(function() { 4655 var step = iterator.next(); 4656 return step.done ? step : 4657 iteratorValue(type, iterations++, step.value, step) 4658 }); 4659 }; 4660 4661 4662 4663 createClass(ToSetSequence, SetSeq); 4664 function ToSetSequence(iter) { 4665 this._iter = iter; 4666 this.size = iter.size; 4667 } 4668 4669 ToSetSequence.prototype.has = function(key) { 4670 return this._iter.includes(key); 4671 }; 4672 4673 ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; 4674 return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); 4675 }; 4676 4677 ToSetSequence.prototype.__iterator = function(type, reverse) { 4678 var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); 4679 return new Iterator(function() { 4680 var step = iterator.next(); 4681 return step.done ? step : 4682 iteratorValue(type, step.value, step.value, step); 4683 }); 4684 }; 4685 4686 4687 4688 createClass(FromEntriesSequence, KeyedSeq); 4689 function FromEntriesSequence(entries) { 4690 this._iter = entries; 4691 this.size = entries.size; 4692 } 4693 4694 FromEntriesSequence.prototype.entrySeq = function() { 4695 return this._iter.toSeq(); 4696 }; 4697 4698 FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; 4699 return this._iter.__iterate(function(entry ) { 4700 // Check if entry exists first so array access doesn't throw for holes 4701 // in the parent iteration. 4702 if (entry) { 4703 validateEntry(entry); 4704 var indexedIterable = isIterable(entry); 4705 return fn( 4706 indexedIterable ? entry.get(1) : entry[1], 4707 indexedIterable ? entry.get(0) : entry[0], 4708 this$0 4709 ); 4710 } 4711 }, reverse); 4712 }; 4713 4714 FromEntriesSequence.prototype.__iterator = function(type, reverse) { 4715 var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); 4716 return new Iterator(function() { 4717 while (true) { 4718 var step = iterator.next(); 4719 if (step.done) { 4720 return step; 4721 } 4722 var entry = step.value; 4723 // Check if entry exists first so array access doesn't throw for holes 4724 // in the parent iteration. 4725 if (entry) { 4726 validateEntry(entry); 4727 var indexedIterable = isIterable(entry); 4728 return iteratorValue( 4729 type, 4730 indexedIterable ? entry.get(0) : entry[0], 4731 indexedIterable ? entry.get(1) : entry[1], 4732 step 4733 ); 4734 } 4735 } 4736 }); 4737 }; 4738 4739 4740 ToIndexedSequence.prototype.cacheResult = 4741 ToKeyedSequence.prototype.cacheResult = 4742 ToSetSequence.prototype.cacheResult = 4743 FromEntriesSequence.prototype.cacheResult = 4744 cacheResultThrough; 4745 4746 4747 function flipFactory(iterable) { 4748 var flipSequence = makeSequence(iterable); 4749 flipSequence._iter = iterable; 4750 flipSequence.size = iterable.size; 4751 flipSequence.flip = function() {return iterable}; 4752 flipSequence.reverse = function () { 4753 var reversedSequence = iterable.reverse.apply(this); // super.reverse() 4754 reversedSequence.flip = function() {return iterable.reverse()}; 4755 return reversedSequence; 4756 }; 4757 flipSequence.has = function(key ) {return iterable.includes(key)}; 4758 flipSequence.includes = function(key ) {return iterable.has(key)}; 4759 flipSequence.cacheResult = cacheResultThrough; 4760 flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; 4761 return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); 4762 } 4763 flipSequence.__iteratorUncached = function(type, reverse) { 4764 if (type === ITERATE_ENTRIES) { 4765 var iterator = iterable.__iterator(type, reverse); 4766 return new Iterator(function() { 4767 var step = iterator.next(); 4768 if (!step.done) { 4769 var k = step.value[0]; 4770 step.value[0] = step.value[1]; 4771 step.value[1] = k; 4772 } 4773 return step; 4774 }); 4775 } 4776 return iterable.__iterator( 4777 type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, 4778 reverse 4779 ); 4780 } 4781 return flipSequence; 4782 } 4783 4784 4785 function mapFactory(iterable, mapper, context) { 4786 var mappedSequence = makeSequence(iterable); 4787 mappedSequence.size = iterable.size; 4788 mappedSequence.has = function(key ) {return iterable.has(key)}; 4789 mappedSequence.get = function(key, notSetValue) { 4790 var v = iterable.get(key, NOT_SET); 4791 return v === NOT_SET ? 4792 notSetValue : 4793 mapper.call(context, v, key, iterable); 4794 }; 4795 mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; 4796 return iterable.__iterate( 4797 function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, 4798 reverse 4799 ); 4800 } 4801 mappedSequence.__iteratorUncached = function (type, reverse) { 4802 var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); 4803 return new Iterator(function() { 4804 var step = iterator.next(); 4805 if (step.done) { 4806 return step; 4807 } 4808 var entry = step.value; 4809 var key = entry[0]; 4810 return iteratorValue( 4811 type, 4812 key, 4813 mapper.call(context, entry[1], key, iterable), 4814 step 4815 ); 4816 }); 4817 } 4818 return mappedSequence; 4819 } 4820 4821 4822 function reverseFactory(iterable, useKeys) { 4823 var reversedSequence = makeSequence(iterable); 4824 reversedSequence._iter = iterable; 4825 reversedSequence.size = iterable.size; 4826 reversedSequence.reverse = function() {return iterable}; 4827 if (iterable.flip) { 4828 reversedSequence.flip = function () { 4829 var flipSequence = flipFactory(iterable); 4830 flipSequence.reverse = function() {return iterable.flip()}; 4831 return flipSequence; 4832 }; 4833 } 4834 reversedSequence.get = function(key, notSetValue) 4835 {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; 4836 reversedSequence.has = function(key ) 4837 {return iterable.has(useKeys ? key : -1 - key)}; 4838 reversedSequence.includes = function(value ) {return iterable.includes(value)}; 4839 reversedSequence.cacheResult = cacheResultThrough; 4840 reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; 4841 return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); 4842 }; 4843 reversedSequence.__iterator = 4844 function(type, reverse) {return iterable.__iterator(type, !reverse)}; 4845 return reversedSequence; 4846 } 4847 4848 4849 function filterFactory(iterable, predicate, context, useKeys) { 4850 var filterSequence = makeSequence(iterable); 4851 if (useKeys) { 4852 filterSequence.has = function(key ) { 4853 var v = iterable.get(key, NOT_SET); 4854 return v !== NOT_SET && !!predicate.call(context, v, key, iterable); 4855 }; 4856 filterSequence.get = function(key, notSetValue) { 4857 var v = iterable.get(key, NOT_SET); 4858 return v !== NOT_SET && predicate.call(context, v, key, iterable) ? 4859 v : notSetValue; 4860 }; 4861 } 4862 filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; 4863 var iterations = 0; 4864 iterable.__iterate(function(v, k, c) { 4865 if (predicate.call(context, v, k, c)) { 4866 iterations++; 4867 return fn(v, useKeys ? k : iterations - 1, this$0); 4868 } 4869 }, reverse); 4870 return iterations; 4871 }; 4872 filterSequence.__iteratorUncached = function (type, reverse) { 4873 var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); 4874 var iterations = 0; 4875 return new Iterator(function() { 4876 while (true) { 4877 var step = iterator.next(); 4878 if (step.done) { 4879 return step; 4880 } 4881 var entry = step.value; 4882 var key = entry[0]; 4883 var value = entry[1]; 4884 if (predicate.call(context, value, key, iterable)) { 4885 return iteratorValue(type, useKeys ? key : iterations++, value, step); 4886 } 4887 } 4888 }); 4889 } 4890 return filterSequence; 4891 } 4892 4893 4894 function countByFactory(iterable, grouper, context) { 4895 var groups = Map().asMutable(); 4896 iterable.__iterate(function(v, k) { 4897 groups.update( 4898 grouper.call(context, v, k, iterable), 4899 0, 4900 function(a ) {return a + 1} 4901 ); 4902 }); 4903 return groups.asImmutable(); 4904 } 4905 4906 4907 function groupByFactory(iterable, grouper, context) { 4908 var isKeyedIter = isKeyed(iterable); 4909 var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); 4910 iterable.__iterate(function(v, k) { 4911 groups.update( 4912 grouper.call(context, v, k, iterable), 4913 function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} 4914 ); 4915 }); 4916 var coerce = iterableClass(iterable); 4917 return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); 4918 } 4919 4920 4921 function sliceFactory(iterable, begin, end, useKeys) { 4922 var originalSize = iterable.size; 4923 4924 // Sanitize begin & end using this shorthand for ToInt32(argument) 4925 // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 4926 if (begin !== undefined) { 4927 begin = begin | 0; 4928 } 4929 if (end !== undefined) { 4930 if (end === Infinity) { 4931 end = originalSize; 4932 } else { 4933 end = end | 0; 4934 } 4935 } 4936 4937 if (wholeSlice(begin, end, originalSize)) { 4938 return iterable; 4939 } 4940 4941 var resolvedBegin = resolveBegin(begin, originalSize); 4942 var resolvedEnd = resolveEnd(end, originalSize); 4943 4944 // begin or end will be NaN if they were provided as negative numbers and 4945 // this iterable's size is unknown. In that case, cache first so there is 4946 // a known size and these do not resolve to NaN. 4947 if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { 4948 return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); 4949 } 4950 4951 // Note: resolvedEnd is undefined when the original sequence's length is 4952 // unknown and this slice did not supply an end and should contain all 4953 // elements after resolvedBegin. 4954 // In that case, resolvedSize will be NaN and sliceSize will remain undefined. 4955 var resolvedSize = resolvedEnd - resolvedBegin; 4956 var sliceSize; 4957 if (resolvedSize === resolvedSize) { 4958 sliceSize = resolvedSize < 0 ? 0 : resolvedSize; 4959 } 4960 4961 var sliceSeq = makeSequence(iterable); 4962 4963 // If iterable.size is undefined, the size of the realized sliceSeq is 4964 // unknown at this point unless the number of items to slice is 0 4965 sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; 4966 4967 if (!useKeys && isSeq(iterable) && sliceSize >= 0) { 4968 sliceSeq.get = function (index, notSetValue) { 4969 index = wrapIndex(this, index); 4970 return index >= 0 && index < sliceSize ? 4971 iterable.get(index + resolvedBegin, notSetValue) : 4972 notSetValue; 4973 } 4974 } 4975 4976 sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; 4977 if (sliceSize === 0) { 4978 return 0; 4979 } 4980 if (reverse) { 4981 return this.cacheResult().__iterate(fn, reverse); 4982 } 4983 var skipped = 0; 4984 var isSkipping = true; 4985 var iterations = 0; 4986 iterable.__iterate(function(v, k) { 4987 if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { 4988 iterations++; 4989 return fn(v, useKeys ? k : iterations - 1, this$0) !== false && 4990 iterations !== sliceSize; 4991 } 4992 }); 4993 return iterations; 4994 }; 4995 4996 sliceSeq.__iteratorUncached = function(type, reverse) { 4997 if (sliceSize !== 0 && reverse) { 4998 return this.cacheResult().__iterator(type, reverse); 4999 } 5000 // Don't bother instantiating parent iterator if taking 0. 5001 var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); 5002 var skipped = 0; 5003 var iterations = 0; 5004 return new Iterator(function() { 5005 while (skipped++ < resolvedBegin) { 5006 iterator.next(); 5007 } 5008 if (++iterations > sliceSize) { 5009 return iteratorDone(); 5010 } 5011 var step = iterator.next(); 5012 if (useKeys || type === ITERATE_VALUES) { 5013 return step; 5014 } else if (type === ITERATE_KEYS) { 5015 return iteratorValue(type, iterations - 1, undefined, step); 5016 } else { 5017 return iteratorValue(type, iterations - 1, step.value[1], step); 5018 } 5019 }); 5020 } 5021 5022 return sliceSeq; 5023 } 5024 5025 5026 function takeWhileFactory(iterable, predicate, context) { 5027 var takeSequence = makeSequence(iterable); 5028 takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; 5029 if (reverse) { 5030 return this.cacheResult().__iterate(fn, reverse); 5031 } 5032 var iterations = 0; 5033 iterable.__iterate(function(v, k, c) 5034 {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} 5035 ); 5036 return iterations; 5037 }; 5038 takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; 5039 if (reverse) { 5040 return this.cacheResult().__iterator(type, reverse); 5041 } 5042 var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); 5043 var iterating = true; 5044 return new Iterator(function() { 5045 if (!iterating) { 5046 return iteratorDone(); 5047 } 5048 var step = iterator.next(); 5049 if (step.done) { 5050 return step; 5051 } 5052 var entry = step.value; 5053 var k = entry[0]; 5054 var v = entry[1]; 5055 if (!predicate.call(context, v, k, this$0)) { 5056 iterating = false; 5057 return iteratorDone(); 5058 } 5059 return type === ITERATE_ENTRIES ? step : 5060 iteratorValue(type, k, v, step); 5061 }); 5062 }; 5063 return takeSequence; 5064 } 5065 5066 5067 function skipWhileFactory(iterable, predicate, context, useKeys) { 5068 var skipSequence = makeSequence(iterable); 5069 skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; 5070 if (reverse) { 5071 return this.cacheResult().__iterate(fn, reverse); 5072 } 5073 var isSkipping = true; 5074 var iterations = 0; 5075 iterable.__iterate(function(v, k, c) { 5076 if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { 5077 iterations++; 5078 return fn(v, useKeys ? k : iterations - 1, this$0); 5079 } 5080 }); 5081 return iterations; 5082 }; 5083 skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; 5084 if (reverse) { 5085 return this.cacheResult().__iterator(type, reverse); 5086 } 5087 var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); 5088 var skipping = true; 5089 var iterations = 0; 5090 return new Iterator(function() { 5091 var step, k, v; 5092 do { 5093 step = iterator.next(); 5094 if (step.done) { 5095 if (useKeys || type === ITERATE_VALUES) { 5096 return step; 5097 } else if (type === ITERATE_KEYS) { 5098 return iteratorValue(type, iterations++, undefined, step); 5099 } else { 5100 return iteratorValue(type, iterations++, step.value[1], step); 5101 } 5102 } 5103 var entry = step.value; 5104 k = entry[0]; 5105 v = entry[1]; 5106 skipping && (skipping = predicate.call(context, v, k, this$0)); 5107 } while (skipping); 5108 return type === ITERATE_ENTRIES ? step : 5109 iteratorValue(type, k, v, step); 5110 }); 5111 }; 5112 return skipSequence; 5113 } 5114 5115 5116 function concatFactory(iterable, values) { 5117 var isKeyedIterable = isKeyed(iterable); 5118 var iters = [iterable].concat(values).map(function(v ) { 5119 if (!isIterable(v)) { 5120 v = isKeyedIterable ? 5121 keyedSeqFromValue(v) : 5122 indexedSeqFromValue(Array.isArray(v) ? v : [v]); 5123 } else if (isKeyedIterable) { 5124 v = KeyedIterable(v); 5125 } 5126 return v; 5127 }).filter(function(v ) {return v.size !== 0}); 5128 5129 if (iters.length === 0) { 5130 return iterable; 5131 } 5132 5133 if (iters.length === 1) { 5134 var singleton = iters[0]; 5135 if (singleton === iterable || 5136 isKeyedIterable && isKeyed(singleton) || 5137 isIndexed(iterable) && isIndexed(singleton)) { 5138 return singleton; 5139 } 5140 } 5141 5142 var concatSeq = new ArraySeq(iters); 5143 if (isKeyedIterable) { 5144 concatSeq = concatSeq.toKeyedSeq(); 5145 } else if (!isIndexed(iterable)) { 5146 concatSeq = concatSeq.toSetSeq(); 5147 } 5148 concatSeq = concatSeq.flatten(true); 5149 concatSeq.size = iters.reduce( 5150 function(sum, seq) { 5151 if (sum !== undefined) { 5152 var size = seq.size; 5153 if (size !== undefined) { 5154 return sum + size; 5155 } 5156 } 5157 }, 5158 0 5159 ); 5160 return concatSeq; 5161 } 5162 5163 5164 function flattenFactory(iterable, depth, useKeys) { 5165 var flatSequence = makeSequence(iterable); 5166 flatSequence.__iterateUncached = function(fn, reverse) { 5167 var iterations = 0; 5168 var stopped = false; 5169 function flatDeep(iter, currentDepth) {var this$0 = this; 5170 iter.__iterate(function(v, k) { 5171 if ((!depth || currentDepth < depth) && isIterable(v)) { 5172 flatDeep(v, currentDepth + 1); 5173 } else if (fn(v, useKeys ? k : iterations++, this$0) === false) { 5174 stopped = true; 5175 } 5176 return !stopped; 5177 }, reverse); 5178 } 5179 flatDeep(iterable, 0); 5180 return iterations; 5181 } 5182 flatSequence.__iteratorUncached = function(type, reverse) { 5183 var iterator = iterable.__iterator(type, reverse); 5184 var stack = []; 5185 var iterations = 0; 5186 return new Iterator(function() { 5187 while (iterator) { 5188 var step = iterator.next(); 5189 if (step.done !== false) { 5190 iterator = stack.pop(); 5191 continue; 5192 } 5193 var v = step.value; 5194 if (type === ITERATE_ENTRIES) { 5195 v = v[1]; 5196 } 5197 if ((!depth || stack.length < depth) && isIterable(v)) { 5198 stack.push(iterator); 5199 iterator = v.__iterator(type, reverse); 5200 } else { 5201 return useKeys ? step : iteratorValue(type, iterations++, v, step); 5202 } 5203 } 5204 return iteratorDone(); 5205 }); 5206 } 5207 return flatSequence; 5208 } 5209 5210 5211 function flatMapFactory(iterable, mapper, context) { 5212 var coerce = iterableClass(iterable); 5213 return iterable.toSeq().map( 5214 function(v, k) {return coerce(mapper.call(context, v, k, iterable))} 5215 ).flatten(true); 5216 } 5217 5218 5219 function interposeFactory(iterable, separator) { 5220 var interposedSequence = makeSequence(iterable); 5221 interposedSequence.size = iterable.size && iterable.size * 2 -1; 5222 interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; 5223 var iterations = 0; 5224 iterable.__iterate(function(v, k) 5225 {return (!iterations || fn(separator, iterations++, this$0) !== false) && 5226 fn(v, iterations++, this$0) !== false}, 5227 reverse 5228 ); 5229 return iterations; 5230 }; 5231 interposedSequence.__iteratorUncached = function(type, reverse) { 5232 var iterator = iterable.__iterator(ITERATE_VALUES, reverse); 5233 var iterations = 0; 5234 var step; 5235 return new Iterator(function() { 5236 if (!step || iterations % 2) { 5237 step = iterator.next(); 5238 if (step.done) { 5239 return step; 5240 } 5241 } 5242 return iterations % 2 ? 5243 iteratorValue(type, iterations++, separator) : 5244 iteratorValue(type, iterations++, step.value, step); 5245 }); 5246 }; 5247 return interposedSequence; 5248 } 5249 5250 5251 function sortFactory(iterable, comparator, mapper) { 5252 if (!comparator) { 5253 comparator = defaultComparator; 5254 } 5255 var isKeyedIterable = isKeyed(iterable); 5256 var index = 0; 5257 var entries = iterable.toSeq().map( 5258 function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} 5259 ).toArray(); 5260 entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( 5261 isKeyedIterable ? 5262 function(v, i) { entries[i].length = 2; } : 5263 function(v, i) { entries[i] = v[1]; } 5264 ); 5265 return isKeyedIterable ? KeyedSeq(entries) : 5266 isIndexed(iterable) ? IndexedSeq(entries) : 5267 SetSeq(entries); 5268 } 5269 5270 5271 function maxFactory(iterable, comparator, mapper) { 5272 if (!comparator) { 5273 comparator = defaultComparator; 5274 } 5275 if (mapper) { 5276 var entry = iterable.toSeq() 5277 .map(function(v, k) {return [v, mapper(v, k, iterable)]}) 5278 .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); 5279 return entry && entry[0]; 5280 } else { 5281 return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); 5282 } 5283 } 5284 5285 function maxCompare(comparator, a, b) { 5286 var comp = comparator(b, a); 5287 // b is considered the new max if the comparator declares them equal, but 5288 // they are not equal and b is in fact a nullish value. 5289 return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; 5290 } 5291 5292 5293 function zipWithFactory(keyIter, zipper, iters) { 5294 var zipSequence = makeSequence(keyIter); 5295 zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); 5296 // Note: this a generic base implementation of __iterate in terms of 5297 // __iterator which may be more generically useful in the future. 5298 zipSequence.__iterate = function(fn, reverse) { 5299 /* generic: 5300 var iterator = this.__iterator(ITERATE_ENTRIES, reverse); 5301 var step; 5302 var iterations = 0; 5303 while (!(step = iterator.next()).done) { 5304 iterations++; 5305 if (fn(step.value[1], step.value[0], this) === false) { 5306 break; 5307 } 5308 } 5309 return iterations; 5310 */ 5311 // indexed: 5312 var iterator = this.__iterator(ITERATE_VALUES, reverse); 5313 var step; 5314 var iterations = 0; 5315 while (!(step = iterator.next()).done) { 5316 if (fn(step.value, iterations++, this) === false) { 5317 break; 5318 } 5319 } 5320 return iterations; 5321 }; 5322 zipSequence.__iteratorUncached = function(type, reverse) { 5323 var iterators = iters.map(function(i ) 5324 {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} 5325 ); 5326 var iterations = 0; 5327 var isDone = false; 5328 return new Iterator(function() { 5329 var steps; 5330 if (!isDone) { 5331 steps = iterators.map(function(i ) {return i.next()}); 5332 isDone = steps.some(function(s ) {return s.done}); 5333 } 5334 if (isDone) { 5335 return iteratorDone(); 5336 } 5337 return iteratorValue( 5338 type, 5339 iterations++, 5340 zipper.apply(null, steps.map(function(s ) {return s.value})) 5341 ); 5342 }); 5343 }; 5344 return zipSequence 5345 } 5346 5347 5348 // #pragma Helper Functions 5349 5350 function reify(iter, seq) { 5351 return isSeq(iter) ? seq : iter.constructor(seq); 5352 } 5353 5354 function validateEntry(entry) { 5355 if (entry !== Object(entry)) { 5356 throw new TypeError('Expected [K, V] tuple: ' + entry); 5357 } 5358 } 5359 5360 function resolveSize(iter) { 5361 assertNotInfinite(iter.size); 5362 return ensureSize(iter); 5363 } 5364 5365 function iterableClass(iterable) { 5366 return isKeyed(iterable) ? KeyedIterable : 5367 isIndexed(iterable) ? IndexedIterable : 5368 SetIterable; 5369 } 5370 5371 function makeSequence(iterable) { 5372 return Object.create( 5373 ( 5374 isKeyed(iterable) ? KeyedSeq : 5375 isIndexed(iterable) ? IndexedSeq : 5376 SetSeq 5377 ).prototype 5378 ); 5379 } 5380 5381 function cacheResultThrough() { 5382 if (this._iter.cacheResult) { 5383 this._iter.cacheResult(); 5384 this.size = this._iter.size; 5385 return this; 5386 } else { 5387 return Seq.prototype.cacheResult.call(this); 5388 } 5389 } 5390 5391 function defaultComparator(a, b) { 5392 return a > b ? 1 : a < b ? -1 : 0; 5393 } 5394 5395 function forceIterator(keyPath) { 5396 var iter = getIterator(keyPath); 5397 if (!iter) { 5398 // Array might not be iterable in this environment, so we need a fallback 5399 // to our wrapped type. 5400 if (!isArrayLike(keyPath)) { 5401 throw new TypeError('Expected iterable or array-like: ' + keyPath); 5402 } 5403 iter = getIterator(Iterable(keyPath)); 5404 } 5405 return iter; 5406 } 5407 5408 createClass(Record, KeyedCollection); 5409 5410 function Record(defaultValues, name) { 5411 var hasInitialized; 5412 5413 var RecordType = function Record(values) { 5414 if (values instanceof RecordType) { 5415 return values; 5416 } 5417 if (!(this instanceof RecordType)) { 5418 return new RecordType(values); 5419 } 5420 if (!hasInitialized) { 5421 hasInitialized = true; 5422 var keys = Object.keys(defaultValues); 5423 setProps(RecordTypePrototype, keys); 5424 RecordTypePrototype.size = keys.length; 5425 RecordTypePrototype._name = name; 5426 RecordTypePrototype._keys = keys; 5427 RecordTypePrototype._defaultValues = defaultValues; 5428 } 5429 this._map = Map(values); 5430 }; 5431 5432 var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); 5433 RecordTypePrototype.constructor = RecordType; 5434 5435 return RecordType; 5436 } 5437 5438 Record.prototype.toString = function() { 5439 return this.__toString(recordName(this) + ' {', '}'); 5440 }; 5441 5442 // @pragma Access 5443 5444 Record.prototype.has = function(k) { 5445 return this._defaultValues.hasOwnProperty(k); 5446 }; 5447 5448 Record.prototype.get = function(k, notSetValue) { 5449 if (!this.has(k)) { 5450 return notSetValue; 5451 } 5452 var defaultVal = this._defaultValues[k]; 5453 return this._map ? this._map.get(k, defaultVal) : defaultVal; 5454 }; 5455 5456 // @pragma Modification 5457 5458 Record.prototype.clear = function() { 5459 if (this.__ownerID) { 5460 this._map && this._map.clear(); 5461 return this; 5462 } 5463 var RecordType = this.constructor; 5464 return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); 5465 }; 5466 5467 Record.prototype.set = function(k, v) { 5468 if (!this.has(k)) { 5469 throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this)); 5470 } 5471 if (this._map && !this._map.has(k)) { 5472 var defaultVal = this._defaultValues[k]; 5473 if (v === defaultVal) { 5474 return this; 5475 } 5476 } 5477 var newMap = this._map && this._map.set(k, v); 5478 if (this.__ownerID || newMap === this._map) { 5479 return this; 5480 } 5481 return makeRecord(this, newMap); 5482 }; 5483 5484 Record.prototype.remove = function(k) { 5485 if (!this.has(k)) { 5486 return this; 5487 } 5488 var newMap = this._map && this._map.remove(k); 5489 if (this.__ownerID || newMap === this._map) { 5490 return this; 5491 } 5492 return makeRecord(this, newMap); 5493 }; 5494 5495 Record.prototype.wasAltered = function() { 5496 return this._map.wasAltered(); 5497 }; 5498 5499 Record.prototype.__iterator = function(type, reverse) {var this$0 = this; 5500 return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); 5501 }; 5502 5503 Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; 5504 return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); 5505 }; 5506 5507 Record.prototype.__ensureOwner = function(ownerID) { 5508 if (ownerID === this.__ownerID) { 5509 return this; 5510 } 5511 var newMap = this._map && this._map.__ensureOwner(ownerID); 5512 if (!ownerID) { 5513 this.__ownerID = ownerID; 5514 this._map = newMap; 5515 return this; 5516 } 5517 return makeRecord(this, newMap, ownerID); 5518 }; 5519 5520 5521 var RecordPrototype = Record.prototype; 5522 RecordPrototype[DELETE] = RecordPrototype.remove; 5523 RecordPrototype.deleteIn = 5524 RecordPrototype.removeIn = MapPrototype.removeIn; 5525 RecordPrototype.merge = MapPrototype.merge; 5526 RecordPrototype.mergeWith = MapPrototype.mergeWith; 5527 RecordPrototype.mergeIn = MapPrototype.mergeIn; 5528 RecordPrototype.mergeDeep = MapPrototype.mergeDeep; 5529 RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; 5530 RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; 5531 RecordPrototype.setIn = MapPrototype.setIn; 5532 RecordPrototype.update = MapPrototype.update; 5533 RecordPrototype.updateIn = MapPrototype.updateIn; 5534 RecordPrototype.withMutations = MapPrototype.withMutations; 5535 RecordPrototype.asMutable = MapPrototype.asMutable; 5536 RecordPrototype.asImmutable = MapPrototype.asImmutable; 5537 5538 5539 function makeRecord(likeRecord, map, ownerID) { 5540 var record = Object.create(Object.getPrototypeOf(likeRecord)); 5541 record._map = map; 5542 record.__ownerID = ownerID; 5543 return record; 5544 } 5545 5546 function recordName(record) { 5547 return record._name || record.constructor.name || 'Record'; 5548 } 5549 5550 function setProps(prototype, names) { 5551 try { 5552 names.forEach(setProp.bind(undefined, prototype)); 5553 } catch (error) { 5554 // Object.defineProperty failed. Probably IE8. 5555 } 5556 } 5557 5558 function setProp(prototype, name) { 5559 Object.defineProperty(prototype, name, { 5560 get: function() { 5561 return this.get(name); 5562 }, 5563 set: function(value) { 5564 invariant(this.__ownerID, 'Cannot set on an immutable record.'); 5565 this.set(name, value); 5566 } 5567 }); 5568 } 5569 5570 createClass(Set, SetCollection); 5571 5572 // @pragma Construction 5573 5574 function Set(value) { 5575 return value === null || value === undefined ? emptySet() : 5576 isSet(value) && !isOrdered(value) ? value : 5577 emptySet().withMutations(function(set ) { 5578 var iter = SetIterable(value); 5579 assertNotInfinite(iter.size); 5580 iter.forEach(function(v ) {return set.add(v)}); 5581 }); 5582 } 5583 5584 Set.of = function(/*...values*/) { 5585 return this(arguments); 5586 }; 5587 5588 Set.fromKeys = function(value) { 5589 return this(KeyedIterable(value).keySeq()); 5590 }; 5591 5592 Set.prototype.toString = function() { 5593 return this.__toString('Set {', '}'); 5594 }; 5595 5596 // @pragma Access 5597 5598 Set.prototype.has = function(value) { 5599 return this._map.has(value); 5600 }; 5601 5602 // @pragma Modification 5603 5604 Set.prototype.add = function(value) { 5605 return updateSet(this, this._map.set(value, true)); 5606 }; 5607 5608 Set.prototype.remove = function(value) { 5609 return updateSet(this, this._map.remove(value)); 5610 }; 5611 5612 Set.prototype.clear = function() { 5613 return updateSet(this, this._map.clear()); 5614 }; 5615 5616 // @pragma Composition 5617 5618 Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); 5619 iters = iters.filter(function(x ) {return x.size !== 0}); 5620 if (iters.length === 0) { 5621 return this; 5622 } 5623 if (this.size === 0 && !this.__ownerID && iters.length === 1) { 5624 return this.constructor(iters[0]); 5625 } 5626 return this.withMutations(function(set ) { 5627 for (var ii = 0; ii < iters.length; ii++) { 5628 SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)}); 5629 } 5630 }); 5631 }; 5632 5633 Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); 5634 if (iters.length === 0) { 5635 return this; 5636 } 5637 iters = iters.map(function(iter ) {return SetIterable(iter)}); 5638 var originalSet = this; 5639 return this.withMutations(function(set ) { 5640 originalSet.forEach(function(value ) { 5641 if (!iters.every(function(iter ) {return iter.includes(value)})) { 5642 set.remove(value); 5643 } 5644 }); 5645 }); 5646 }; 5647 5648 Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); 5649 if (iters.length === 0) { 5650 return this; 5651 } 5652 iters = iters.map(function(iter ) {return SetIterable(iter)}); 5653 var originalSet = this; 5654 return this.withMutations(function(set ) { 5655 originalSet.forEach(function(value ) { 5656 if (iters.some(function(iter ) {return iter.includes(value)})) { 5657 set.remove(value); 5658 } 5659 }); 5660 }); 5661 }; 5662 5663 Set.prototype.merge = function() { 5664 return this.union.apply(this, arguments); 5665 }; 5666 5667 Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); 5668 return this.union.apply(this, iters); 5669 }; 5670 5671 Set.prototype.sort = function(comparator) { 5672 // Late binding 5673 return OrderedSet(sortFactory(this, comparator)); 5674 }; 5675 5676 Set.prototype.sortBy = function(mapper, comparator) { 5677 // Late binding 5678 return OrderedSet(sortFactory(this, comparator, mapper)); 5679 }; 5680 5681 Set.prototype.wasAltered = function() { 5682 return this._map.wasAltered(); 5683 }; 5684 5685 Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; 5686 return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); 5687 }; 5688 5689 Set.prototype.__iterator = function(type, reverse) { 5690 return this._map.map(function(_, k) {return k}).__iterator(type, reverse); 5691 }; 5692 5693 Set.prototype.__ensureOwner = function(ownerID) { 5694 if (ownerID === this.__ownerID) { 5695 return this; 5696 } 5697 var newMap = this._map.__ensureOwner(ownerID); 5698 if (!ownerID) { 5699 this.__ownerID = ownerID; 5700 this._map = newMap; 5701 return this; 5702 } 5703 return this.__make(newMap, ownerID); 5704 }; 5705 5706 5707 function isSet(maybeSet) { 5708 return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); 5709 } 5710 5711 Set.isSet = isSet; 5712 5713 var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; 5714 5715 var SetPrototype = Set.prototype; 5716 SetPrototype[IS_SET_SENTINEL] = true; 5717 SetPrototype[DELETE] = SetPrototype.remove; 5718 SetPrototype.mergeDeep = SetPrototype.merge; 5719 SetPrototype.mergeDeepWith = SetPrototype.mergeWith; 5720 SetPrototype.withMutations = MapPrototype.withMutations; 5721 SetPrototype.asMutable = MapPrototype.asMutable; 5722 SetPrototype.asImmutable = MapPrototype.asImmutable; 5723 5724 SetPrototype.__empty = emptySet; 5725 SetPrototype.__make = makeSet; 5726 5727 function updateSet(set, newMap) { 5728 if (set.__ownerID) { 5729 set.size = newMap.size; 5730 set._map = newMap; 5731 return set; 5732 } 5733 return newMap === set._map ? set : 5734 newMap.size === 0 ? set.__empty() : 5735 set.__make(newMap); 5736 } 5737 5738 function makeSet(map, ownerID) { 5739 var set = Object.create(SetPrototype); 5740 set.size = map ? map.size : 0; 5741 set._map = map; 5742 set.__ownerID = ownerID; 5743 return set; 5744 } 5745 5746 var EMPTY_SET; 5747 function emptySet() { 5748 return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); 5749 } 5750 5751 createClass(OrderedSet, Set); 5752 5753 // @pragma Construction 5754 5755 function OrderedSet(value) { 5756 return value === null || value === undefined ? emptyOrderedSet() : 5757 isOrderedSet(value) ? value : 5758 emptyOrderedSet().withMutations(function(set ) { 5759 var iter = SetIterable(value); 5760 assertNotInfinite(iter.size); 5761 iter.forEach(function(v ) {return set.add(v)}); 5762 }); 5763 } 5764 5765 OrderedSet.of = function(/*...values*/) { 5766 return this(arguments); 5767 }; 5768 5769 OrderedSet.fromKeys = function(value) { 5770 return this(KeyedIterable(value).keySeq()); 5771 }; 5772 5773 OrderedSet.prototype.toString = function() { 5774 return this.__toString('OrderedSet {', '}'); 5775 }; 5776 5777 5778 function isOrderedSet(maybeOrderedSet) { 5779 return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); 5780 } 5781 5782 OrderedSet.isOrderedSet = isOrderedSet; 5783 5784 var OrderedSetPrototype = OrderedSet.prototype; 5785 OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; 5786 5787 OrderedSetPrototype.__empty = emptyOrderedSet; 5788 OrderedSetPrototype.__make = makeOrderedSet; 5789 5790 function makeOrderedSet(map, ownerID) { 5791 var set = Object.create(OrderedSetPrototype); 5792 set.size = map ? map.size : 0; 5793 set._map = map; 5794 set.__ownerID = ownerID; 5795 return set; 5796 } 5797 5798 var EMPTY_ORDERED_SET; 5799 function emptyOrderedSet() { 5800 return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); 5801 } 5802 5803 createClass(Stack, IndexedCollection); 5804 5805 // @pragma Construction 5806 5807 function Stack(value) { 5808 return value === null || value === undefined ? emptyStack() : 5809 isStack(value) ? value : 5810 emptyStack().unshiftAll(value); 5811 } 5812 5813 Stack.of = function(/*...values*/) { 5814 return this(arguments); 5815 }; 5816 5817 Stack.prototype.toString = function() { 5818 return this.__toString('Stack [', ']'); 5819 }; 5820 5821 // @pragma Access 5822 5823 Stack.prototype.get = function(index, notSetValue) { 5824 var head = this._head; 5825 index = wrapIndex(this, index); 5826 while (head && index--) { 5827 head = head.next; 5828 } 5829 return head ? head.value : notSetValue; 5830 }; 5831 5832 Stack.prototype.peek = function() { 5833 return this._head && this._head.value; 5834 }; 5835 5836 // @pragma Modification 5837 5838 Stack.prototype.push = function(/*...values*/) { 5839 if (arguments.length === 0) { 5840 return this; 5841 } 5842 var newSize = this.size + arguments.length; 5843 var head = this._head; 5844 for (var ii = arguments.length - 1; ii >= 0; ii--) { 5845 head = { 5846 value: arguments[ii], 5847 next: head 5848 }; 5849 } 5850 if (this.__ownerID) { 5851 this.size = newSize; 5852 this._head = head; 5853 this.__hash = undefined; 5854 this.__altered = true; 5855 return this; 5856 } 5857 return makeStack(newSize, head); 5858 }; 5859 5860 Stack.prototype.pushAll = function(iter) { 5861 iter = IndexedIterable(iter); 5862 if (iter.size === 0) { 5863 return this; 5864 } 5865 assertNotInfinite(iter.size); 5866 var newSize = this.size; 5867 var head = this._head; 5868 iter.reverse().forEach(function(value ) { 5869 newSize++; 5870 head = { 5871 value: value, 5872 next: head 5873 }; 5874 }); 5875 if (this.__ownerID) { 5876 this.size = newSize; 5877 this._head = head; 5878 this.__hash = undefined; 5879 this.__altered = true; 5880 return this; 5881 } 5882 return makeStack(newSize, head); 5883 }; 5884 5885 Stack.prototype.pop = function() { 5886 return this.slice(1); 5887 }; 5888 5889 Stack.prototype.unshift = function(/*...values*/) { 5890 return this.push.apply(this, arguments); 5891 }; 5892 5893 Stack.prototype.unshiftAll = function(iter) { 5894 return this.pushAll(iter); 5895 }; 5896 5897 Stack.prototype.shift = function() { 5898 return this.pop.apply(this, arguments); 5899 }; 5900 5901 Stack.prototype.clear = function() { 5902 if (this.size === 0) { 5903 return this; 5904 } 5905 if (this.__ownerID) { 5906 this.size = 0; 5907 this._head = undefined; 5908 this.__hash = undefined; 5909 this.__altered = true; 5910 return this; 5911 } 5912 return emptyStack(); 5913 }; 5914 5915 Stack.prototype.slice = function(begin, end) { 5916 if (wholeSlice(begin, end, this.size)) { 5917 return this; 5918 } 5919 var resolvedBegin = resolveBegin(begin, this.size); 5920 var resolvedEnd = resolveEnd(end, this.size); 5921 if (resolvedEnd !== this.size) { 5922 // super.slice(begin, end); 5923 return IndexedCollection.prototype.slice.call(this, begin, end); 5924 } 5925 var newSize = this.size - resolvedBegin; 5926 var head = this._head; 5927 while (resolvedBegin--) { 5928 head = head.next; 5929 } 5930 if (this.__ownerID) { 5931 this.size = newSize; 5932 this._head = head; 5933 this.__hash = undefined; 5934 this.__altered = true; 5935 return this; 5936 } 5937 return makeStack(newSize, head); 5938 }; 5939 5940 // @pragma Mutability 5941 5942 Stack.prototype.__ensureOwner = function(ownerID) { 5943 if (ownerID === this.__ownerID) { 5944 return this; 5945 } 5946 if (!ownerID) { 5947 this.__ownerID = ownerID; 5948 this.__altered = false; 5949 return this; 5950 } 5951 return makeStack(this.size, this._head, ownerID, this.__hash); 5952 }; 5953 5954 // @pragma Iteration 5955 5956 Stack.prototype.__iterate = function(fn, reverse) { 5957 if (reverse) { 5958 return this.reverse().__iterate(fn); 5959 } 5960 var iterations = 0; 5961 var node = this._head; 5962 while (node) { 5963 if (fn(node.value, iterations++, this) === false) { 5964 break; 5965 } 5966 node = node.next; 5967 } 5968 return iterations; 5969 }; 5970 5971 Stack.prototype.__iterator = function(type, reverse) { 5972 if (reverse) { 5973 return this.reverse().__iterator(type); 5974 } 5975 var iterations = 0; 5976 var node = this._head; 5977 return new Iterator(function() { 5978 if (node) { 5979 var value = node.value; 5980 node = node.next; 5981 return iteratorValue(type, iterations++, value); 5982 } 5983 return iteratorDone(); 5984 }); 5985 }; 5986 5987 5988 function isStack(maybeStack) { 5989 return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); 5990 } 5991 5992 Stack.isStack = isStack; 5993 5994 var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; 5995 5996 var StackPrototype = Stack.prototype; 5997 StackPrototype[IS_STACK_SENTINEL] = true; 5998 StackPrototype.withMutations = MapPrototype.withMutations; 5999 StackPrototype.asMutable = MapPrototype.asMutable; 6000 StackPrototype.asImmutable = MapPrototype.asImmutable; 6001 StackPrototype.wasAltered = MapPrototype.wasAltered; 6002 6003 6004 function makeStack(size, head, ownerID, hash) { 6005 var map = Object.create(StackPrototype); 6006 map.size = size; 6007 map._head = head; 6008 map.__ownerID = ownerID; 6009 map.__hash = hash; 6010 map.__altered = false; 6011 return map; 6012 } 6013 6014 var EMPTY_STACK; 6015 function emptyStack() { 6016 return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); 6017 } 6018 6019 /** 6020 * Contributes additional methods to a constructor 6021 */ 6022 function mixin(ctor, methods) { 6023 var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; }; 6024 Object.keys(methods).forEach(keyCopier); 6025 Object.getOwnPropertySymbols && 6026 Object.getOwnPropertySymbols(methods).forEach(keyCopier); 6027 return ctor; 6028 } 6029 6030 Iterable.Iterator = Iterator; 6031 6032 mixin(Iterable, { 6033 6034 // ### Conversion to other types 6035 6036 toArray: function() { 6037 assertNotInfinite(this.size); 6038 var array = new Array(this.size || 0); 6039 this.valueSeq().__iterate(function(v, i) { array[i] = v; }); 6040 return array; 6041 }, 6042 6043 toIndexedSeq: function() { 6044 return new ToIndexedSequence(this); 6045 }, 6046 6047 toJS: function() { 6048 return this.toSeq().map( 6049 function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value} 6050 ).__toJS(); 6051 }, 6052 6053 toJSON: function() { 6054 return this.toSeq().map( 6055 function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value} 6056 ).__toJS(); 6057 }, 6058 6059 toKeyedSeq: function() { 6060 return new ToKeyedSequence(this, true); 6061 }, 6062 6063 toMap: function() { 6064 // Use Late Binding here to solve the circular dependency. 6065 return Map(this.toKeyedSeq()); 6066 }, 6067 6068 toObject: function() { 6069 assertNotInfinite(this.size); 6070 var object = {}; 6071 this.__iterate(function(v, k) { object[k] = v; }); 6072 return object; 6073 }, 6074 6075 toOrderedMap: function() { 6076 // Use Late Binding here to solve the circular dependency. 6077 return OrderedMap(this.toKeyedSeq()); 6078 }, 6079 6080 toOrderedSet: function() { 6081 // Use Late Binding here to solve the circular dependency. 6082 return OrderedSet(isKeyed(this) ? this.valueSeq() : this); 6083 }, 6084 6085 toSet: function() { 6086 // Use Late Binding here to solve the circular dependency. 6087 return Set(isKeyed(this) ? this.valueSeq() : this); 6088 }, 6089 6090 toSetSeq: function() { 6091 return new ToSetSequence(this); 6092 }, 6093 6094 toSeq: function() { 6095 return isIndexed(this) ? this.toIndexedSeq() : 6096 isKeyed(this) ? this.toKeyedSeq() : 6097 this.toSetSeq(); 6098 }, 6099 6100 toStack: function() { 6101 // Use Late Binding here to solve the circular dependency. 6102 return Stack(isKeyed(this) ? this.valueSeq() : this); 6103 }, 6104 6105 toList: function() { 6106 // Use Late Binding here to solve the circular dependency. 6107 return List(isKeyed(this) ? this.valueSeq() : this); 6108 }, 6109 6110 6111 // ### Common JavaScript methods and properties 6112 6113 toString: function() { 6114 return '[Iterable]'; 6115 }, 6116 6117 __toString: function(head, tail) { 6118 if (this.size === 0) { 6119 return head + tail; 6120 } 6121 return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail; 6122 }, 6123 6124 6125 // ### ES6 Collection methods (ES6 Array and Map) 6126 6127 concat: function() {var values = SLICE$0.call(arguments, 0); 6128 return reify(this, concatFactory(this, values)); 6129 }, 6130 6131 includes: function(searchValue) { 6132 return this.some(function(value ) {return is(value, searchValue)}); 6133 }, 6134 6135 entries: function() { 6136 return this.__iterator(ITERATE_ENTRIES); 6137 }, 6138 6139 every: function(predicate, context) { 6140 assertNotInfinite(this.size); 6141 var returnValue = true; 6142 this.__iterate(function(v, k, c) { 6143 if (!predicate.call(context, v, k, c)) { 6144 returnValue = false; 6145 return false; 6146 } 6147 }); 6148 return returnValue; 6149 }, 6150 6151 filter: function(predicate, context) { 6152 return reify(this, filterFactory(this, predicate, context, true)); 6153 }, 6154 6155 find: function(predicate, context, notSetValue) { 6156 var entry = this.findEntry(predicate, context); 6157 return entry ? entry[1] : notSetValue; 6158 }, 6159 6160 forEach: function(sideEffect, context) { 6161 assertNotInfinite(this.size); 6162 return this.__iterate(context ? sideEffect.bind(context) : sideEffect); 6163 }, 6164 6165 join: function(separator) { 6166 assertNotInfinite(this.size); 6167 separator = separator !== undefined ? '' + separator : ','; 6168 var joined = ''; 6169 var isFirst = true; 6170 this.__iterate(function(v ) { 6171 isFirst ? (isFirst = false) : (joined += separator); 6172 joined += v !== null && v !== undefined ? v.toString() : ''; 6173 }); 6174 return joined; 6175 }, 6176 6177 keys: function() { 6178 return this.__iterator(ITERATE_KEYS); 6179 }, 6180 6181 map: function(mapper, context) { 6182 return reify(this, mapFactory(this, mapper, context)); 6183 }, 6184 6185 reduce: function(reducer, initialReduction, context) { 6186 assertNotInfinite(this.size); 6187 var reduction; 6188 var useFirst; 6189 if (arguments.length < 2) { 6190 useFirst = true; 6191 } else { 6192 reduction = initialReduction; 6193 } 6194 this.__iterate(function(v, k, c) { 6195 if (useFirst) { 6196 useFirst = false; 6197 reduction = v; 6198 } else { 6199 reduction = reducer.call(context, reduction, v, k, c); 6200 } 6201 }); 6202 return reduction; 6203 }, 6204 6205 reduceRight: function(reducer, initialReduction, context) { 6206 var reversed = this.toKeyedSeq().reverse(); 6207 return reversed.reduce.apply(reversed, arguments); 6208 }, 6209 6210 reverse: function() { 6211 return reify(this, reverseFactory(this, true)); 6212 }, 6213 6214 slice: function(begin, end) { 6215 return reify(this, sliceFactory(this, begin, end, true)); 6216 }, 6217 6218 some: function(predicate, context) { 6219 return !this.every(not(predicate), context); 6220 }, 6221 6222 sort: function(comparator) { 6223 return reify(this, sortFactory(this, comparator)); 6224 }, 6225 6226 values: function() { 6227 return this.__iterator(ITERATE_VALUES); 6228 }, 6229 6230 6231 // ### More sequential methods 6232 6233 butLast: function() { 6234 return this.slice(0, -1); 6235 }, 6236 6237 isEmpty: function() { 6238 return this.size !== undefined ? this.size === 0 : !this.some(function() {return true}); 6239 }, 6240 6241 count: function(predicate, context) { 6242 return ensureSize( 6243 predicate ? this.toSeq().filter(predicate, context) : this 6244 ); 6245 }, 6246 6247 countBy: function(grouper, context) { 6248 return countByFactory(this, grouper, context); 6249 }, 6250 6251 equals: function(other) { 6252 return deepEqual(this, other); 6253 }, 6254 6255 entrySeq: function() { 6256 var iterable = this; 6257 if (iterable._cache) { 6258 // We cache as an entries array, so we can just return the cache! 6259 return new ArraySeq(iterable._cache); 6260 } 6261 var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq(); 6262 entriesSequence.fromEntrySeq = function() {return iterable.toSeq()}; 6263 return entriesSequence; 6264 }, 6265 6266 filterNot: function(predicate, context) { 6267 return this.filter(not(predicate), context); 6268 }, 6269 6270 findEntry: function(predicate, context, notSetValue) { 6271 var found = notSetValue; 6272 this.__iterate(function(v, k, c) { 6273 if (predicate.call(context, v, k, c)) { 6274 found = [k, v]; 6275 return false; 6276 } 6277 }); 6278 return found; 6279 }, 6280 6281 findKey: function(predicate, context) { 6282 var entry = this.findEntry(predicate, context); 6283 return entry && entry[0]; 6284 }, 6285 6286 findLast: function(predicate, context, notSetValue) { 6287 return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); 6288 }, 6289 6290 findLastEntry: function(predicate, context, notSetValue) { 6291 return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue); 6292 }, 6293 6294 findLastKey: function(predicate, context) { 6295 return this.toKeyedSeq().reverse().findKey(predicate, context); 6296 }, 6297 6298 first: function() { 6299 return this.find(returnTrue); 6300 }, 6301 6302 flatMap: function(mapper, context) { 6303 return reify(this, flatMapFactory(this, mapper, context)); 6304 }, 6305 6306 flatten: function(depth) { 6307 return reify(this, flattenFactory(this, depth, true)); 6308 }, 6309 6310 fromEntrySeq: function() { 6311 return new FromEntriesSequence(this); 6312 }, 6313 6314 get: function(searchKey, notSetValue) { 6315 return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue); 6316 }, 6317 6318 getIn: function(searchKeyPath, notSetValue) { 6319 var nested = this; 6320 // Note: in an ES6 environment, we would prefer: 6321 // for (var key of searchKeyPath) { 6322 var iter = forceIterator(searchKeyPath); 6323 var step; 6324 while (!(step = iter.next()).done) { 6325 var key = step.value; 6326 nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET; 6327 if (nested === NOT_SET) { 6328 return notSetValue; 6329 } 6330 } 6331 return nested; 6332 }, 6333 6334 groupBy: function(grouper, context) { 6335 return groupByFactory(this, grouper, context); 6336 }, 6337 6338 has: function(searchKey) { 6339 return this.get(searchKey, NOT_SET) !== NOT_SET; 6340 }, 6341 6342 hasIn: function(searchKeyPath) { 6343 return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET; 6344 }, 6345 6346 isSubset: function(iter) { 6347 iter = typeof iter.includes === 'function' ? iter : Iterable(iter); 6348 return this.every(function(value ) {return iter.includes(value)}); 6349 }, 6350 6351 isSuperset: function(iter) { 6352 iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter); 6353 return iter.isSubset(this); 6354 }, 6355 6356 keyOf: function(searchValue) { 6357 return this.findKey(function(value ) {return is(value, searchValue)}); 6358 }, 6359 6360 keySeq: function() { 6361 return this.toSeq().map(keyMapper).toIndexedSeq(); 6362 }, 6363 6364 last: function() { 6365 return this.toSeq().reverse().first(); 6366 }, 6367 6368 lastKeyOf: function(searchValue) { 6369 return this.toKeyedSeq().reverse().keyOf(searchValue); 6370 }, 6371 6372 max: function(comparator) { 6373 return maxFactory(this, comparator); 6374 }, 6375 6376 maxBy: function(mapper, comparator) { 6377 return maxFactory(this, comparator, mapper); 6378 }, 6379 6380 min: function(comparator) { 6381 return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator); 6382 }, 6383 6384 minBy: function(mapper, comparator) { 6385 return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper); 6386 }, 6387 6388 rest: function() { 6389 return this.slice(1); 6390 }, 6391 6392 skip: function(amount) { 6393 return this.slice(Math.max(0, amount)); 6394 }, 6395 6396 skipLast: function(amount) { 6397 return reify(this, this.toSeq().reverse().skip(amount).reverse()); 6398 }, 6399 6400 skipWhile: function(predicate, context) { 6401 return reify(this, skipWhileFactory(this, predicate, context, true)); 6402 }, 6403 6404 skipUntil: function(predicate, context) { 6405 return this.skipWhile(not(predicate), context); 6406 }, 6407 6408 sortBy: function(mapper, comparator) { 6409 return reify(this, sortFactory(this, comparator, mapper)); 6410 }, 6411 6412 take: function(amount) { 6413 return this.slice(0, Math.max(0, amount)); 6414 }, 6415 6416 takeLast: function(amount) { 6417 return reify(this, this.toSeq().reverse().take(amount).reverse()); 6418 }, 6419 6420 takeWhile: function(predicate, context) { 6421 return reify(this, takeWhileFactory(this, predicate, context)); 6422 }, 6423 6424 takeUntil: function(predicate, context) { 6425 return this.takeWhile(not(predicate), context); 6426 }, 6427 6428 valueSeq: function() { 6429 return this.toIndexedSeq(); 6430 }, 6431 6432 6433 // ### Hashable Object 6434 6435 hashCode: function() { 6436 return this.__hash || (this.__hash = hashIterable(this)); 6437 } 6438 6439 6440 // ### Internal 6441 6442 // abstract __iterate(fn, reverse) 6443 6444 // abstract __iterator(type, reverse) 6445 }); 6446 6447 // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; 6448 // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; 6449 // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; 6450 // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; 6451 6452 var IterablePrototype = Iterable.prototype; 6453 IterablePrototype[IS_ITERABLE_SENTINEL] = true; 6454 IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values; 6455 IterablePrototype.__toJS = IterablePrototype.toArray; 6456 IterablePrototype.__toStringMapper = quoteString; 6457 IterablePrototype.inspect = 6458 IterablePrototype.toSource = function() { return this.toString(); }; 6459 IterablePrototype.chain = IterablePrototype.flatMap; 6460 IterablePrototype.contains = IterablePrototype.includes; 6461 6462 mixin(KeyedIterable, { 6463 6464 // ### More sequential methods 6465 6466 flip: function() { 6467 return reify(this, flipFactory(this)); 6468 }, 6469 6470 mapEntries: function(mapper, context) {var this$0 = this; 6471 var iterations = 0; 6472 return reify(this, 6473 this.toSeq().map( 6474 function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)} 6475 ).fromEntrySeq() 6476 ); 6477 }, 6478 6479 mapKeys: function(mapper, context) {var this$0 = this; 6480 return reify(this, 6481 this.toSeq().flip().map( 6482 function(k, v) {return mapper.call(context, k, v, this$0)} 6483 ).flip() 6484 ); 6485 } 6486 6487 }); 6488 6489 var KeyedIterablePrototype = KeyedIterable.prototype; 6490 KeyedIterablePrototype[IS_KEYED_SENTINEL] = true; 6491 KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries; 6492 KeyedIterablePrototype.__toJS = IterablePrototype.toObject; 6493 KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)}; 6494 6495 6496 6497 mixin(IndexedIterable, { 6498 6499 // ### Conversion to other types 6500 6501 toKeyedSeq: function() { 6502 return new ToKeyedSequence(this, false); 6503 }, 6504 6505 6506 // ### ES6 Collection methods (ES6 Array and Map) 6507 6508 filter: function(predicate, context) { 6509 return reify(this, filterFactory(this, predicate, context, false)); 6510 }, 6511 6512 findIndex: function(predicate, context) { 6513 var entry = this.findEntry(predicate, context); 6514 return entry ? entry[0] : -1; 6515 }, 6516 6517 indexOf: function(searchValue) { 6518 var key = this.keyOf(searchValue); 6519 return key === undefined ? -1 : key; 6520 }, 6521 6522 lastIndexOf: function(searchValue) { 6523 var key = this.lastKeyOf(searchValue); 6524 return key === undefined ? -1 : key; 6525 }, 6526 6527 reverse: function() { 6528 return reify(this, reverseFactory(this, false)); 6529 }, 6530 6531 slice: function(begin, end) { 6532 return reify(this, sliceFactory(this, begin, end, false)); 6533 }, 6534 6535 splice: function(index, removeNum /*, ...values*/) { 6536 var numArgs = arguments.length; 6537 removeNum = Math.max(removeNum | 0, 0); 6538 if (numArgs === 0 || (numArgs === 2 && !removeNum)) { 6539 return this; 6540 } 6541 // If index is negative, it should resolve relative to the size of the 6542 // collection. However size may be expensive to compute if not cached, so 6543 // only call count() if the number is in fact negative. 6544 index = resolveBegin(index, index < 0 ? this.count() : this.size); 6545 var spliced = this.slice(0, index); 6546 return reify( 6547 this, 6548 numArgs === 1 ? 6549 spliced : 6550 spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) 6551 ); 6552 }, 6553 6554 6555 // ### More collection methods 6556 6557 findLastIndex: function(predicate, context) { 6558 var entry = this.findLastEntry(predicate, context); 6559 return entry ? entry[0] : -1; 6560 }, 6561 6562 first: function() { 6563 return this.get(0); 6564 }, 6565 6566 flatten: function(depth) { 6567 return reify(this, flattenFactory(this, depth, false)); 6568 }, 6569 6570 get: function(index, notSetValue) { 6571 index = wrapIndex(this, index); 6572 return (index < 0 || (this.size === Infinity || 6573 (this.size !== undefined && index > this.size))) ? 6574 notSetValue : 6575 this.find(function(_, key) {return key === index}, undefined, notSetValue); 6576 }, 6577 6578 has: function(index) { 6579 index = wrapIndex(this, index); 6580 return index >= 0 && (this.size !== undefined ? 6581 this.size === Infinity || index < this.size : 6582 this.indexOf(index) !== -1 6583 ); 6584 }, 6585 6586 interpose: function(separator) { 6587 return reify(this, interposeFactory(this, separator)); 6588 }, 6589 6590 interleave: function(/*...iterables*/) { 6591 var iterables = [this].concat(arrCopy(arguments)); 6592 var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables); 6593 var interleaved = zipped.flatten(true); 6594 if (zipped.size) { 6595 interleaved.size = zipped.size * iterables.length; 6596 } 6597 return reify(this, interleaved); 6598 }, 6599 6600 keySeq: function() { 6601 return Range(0, this.size); 6602 }, 6603 6604 last: function() { 6605 return this.get(-1); 6606 }, 6607 6608 skipWhile: function(predicate, context) { 6609 return reify(this, skipWhileFactory(this, predicate, context, false)); 6610 }, 6611 6612 zip: function(/*, ...iterables */) { 6613 var iterables = [this].concat(arrCopy(arguments)); 6614 return reify(this, zipWithFactory(this, defaultZipper, iterables)); 6615 }, 6616 6617 zipWith: function(zipper/*, ...iterables */) { 6618 var iterables = arrCopy(arguments); 6619 iterables[0] = this; 6620 return reify(this, zipWithFactory(this, zipper, iterables)); 6621 } 6622 6623 }); 6624 6625 IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true; 6626 IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true; 6627 6628 6629 6630 mixin(SetIterable, { 6631 6632 // ### ES6 Collection methods (ES6 Array and Map) 6633 6634 get: function(value, notSetValue) { 6635 return this.has(value) ? value : notSetValue; 6636 }, 6637 6638 includes: function(value) { 6639 return this.has(value); 6640 }, 6641 6642 6643 // ### More sequential methods 6644 6645 keySeq: function() { 6646 return this.valueSeq(); 6647 } 6648 6649 }); 6650 6651 SetIterable.prototype.has = IterablePrototype.includes; 6652 SetIterable.prototype.contains = SetIterable.prototype.includes; 6653 6654 6655 // Mixin subclasses 6656 6657 mixin(KeyedSeq, KeyedIterable.prototype); 6658 mixin(IndexedSeq, IndexedIterable.prototype); 6659 mixin(SetSeq, SetIterable.prototype); 6660 6661 mixin(KeyedCollection, KeyedIterable.prototype); 6662 mixin(IndexedCollection, IndexedIterable.prototype); 6663 mixin(SetCollection, SetIterable.prototype); 6664 6665 6666 // #pragma Helper functions 6667 6668 function keyMapper(v, k) { 6669 return k; 6670 } 6671 6672 function entryMapper(v, k) { 6673 return [k, v]; 6674 } 6675 6676 function not(predicate) { 6677 return function() { 6678 return !predicate.apply(this, arguments); 6679 } 6680 } 6681 6682 function neg(predicate) { 6683 return function() { 6684 return -predicate.apply(this, arguments); 6685 } 6686 } 6687 6688 function quoteString(value) { 6689 return typeof value === 'string' ? JSON.stringify(value) : String(value); 6690 } 6691 6692 function defaultZipper() { 6693 return arrCopy(arguments); 6694 } 6695 6696 function defaultNegComparator(a, b) { 6697 return a < b ? 1 : a > b ? -1 : 0; 6698 } 6699 6700 function hashIterable(iterable) { 6701 if (iterable.size === Infinity) { 6702 return 0; 6703 } 6704 var ordered = isOrdered(iterable); 6705 var keyed = isKeyed(iterable); 6706 var h = ordered ? 1 : 0; 6707 var size = iterable.__iterate( 6708 keyed ? 6709 ordered ? 6710 function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } : 6711 function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } : 6712 ordered ? 6713 function(v ) { h = 31 * h + hash(v) | 0; } : 6714 function(v ) { h = h + hash(v) | 0; } 6715 ); 6716 return murmurHashOfSize(size, h); 6717 } 6718 6719 function murmurHashOfSize(size, h) { 6720 h = imul(h, 0xCC9E2D51); 6721 h = imul(h << 15 | h >>> -15, 0x1B873593); 6722 h = imul(h << 13 | h >>> -13, 5); 6723 h = (h + 0xE6546B64 | 0) ^ size; 6724 h = imul(h ^ h >>> 16, 0x85EBCA6B); 6725 h = imul(h ^ h >>> 13, 0xC2B2AE35); 6726 h = smi(h ^ h >>> 16); 6727 return h; 6728 } 6729 6730 function hashMerge(a, b) { 6731 return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int 6732 } 6733 6734 var Immutable = { 6735 6736 Iterable: Iterable, 6737 6738 Seq: Seq, 6739 Collection: Collection, 6740 Map: Map, 6741 OrderedMap: OrderedMap, 6742 List: List, 6743 Stack: Stack, 6744 Set: Set, 6745 OrderedSet: OrderedSet, 6746 6747 Record: Record, 6748 Range: Range, 6749 Repeat: Repeat, 6750 6751 is: is, 6752 fromJS: fromJS 6753 6754 }; 6755 6756 return Immutable; 6757 6758 })); 6759 6760 /***/ }) 6761 /******/ ]); 6762 //# sourceMappingURL=main.js.map