Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 198.52 KB | None | 0 0
  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 = 31);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69.  
  70. "use strict";
  71.  
  72.  
  73. var isValue = __webpack_require__(8);
  74.  
  75. module.exports = function (value) {
  76. if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
  77. return value;
  78. };
  79.  
  80.  
  81. /***/ }),
  82. /* 1 */
  83. /***/ (function(module, exports, __webpack_require__) {
  84.  
  85. "use strict";
  86.  
  87.  
  88. module.exports = function (fn) {
  89. if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
  90. return fn;
  91. };
  92.  
  93.  
  94. /***/ }),
  95. /* 2 */
  96. /***/ (function(module, exports, __webpack_require__) {
  97.  
  98. "use strict";
  99.  
  100. var __extends = (this && this.__extends) || function (d, b) {
  101. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  102. function __() { this.constructor = d; }
  103. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  104. };
  105. var symbol_observable_1 = __webpack_require__(33);
  106. var NO = {};
  107. exports.NO = NO;
  108. function noop() { }
  109. function cp(a) {
  110. var l = a.length;
  111. var b = Array(l);
  112. for (var i = 0; i < l; ++i)
  113. b[i] = a[i];
  114. return b;
  115. }
  116. function and(f1, f2) {
  117. return function andFn(t) {
  118. return f1(t) && f2(t);
  119. };
  120. }
  121. function _try(c, t, u) {
  122. try {
  123. return c.f(t);
  124. }
  125. catch (e) {
  126. u._e(e);
  127. return NO;
  128. }
  129. }
  130. var NO_IL = {
  131. _n: noop,
  132. _e: noop,
  133. _c: noop,
  134. };
  135. exports.NO_IL = NO_IL;
  136. // mutates the input
  137. function internalizeProducer(producer) {
  138. producer._start = function _start(il) {
  139. il.next = il._n;
  140. il.error = il._e;
  141. il.complete = il._c;
  142. this.start(il);
  143. };
  144. producer._stop = producer.stop;
  145. }
  146. var StreamSub = (function () {
  147. function StreamSub(_stream, _listener) {
  148. this._stream = _stream;
  149. this._listener = _listener;
  150. }
  151. StreamSub.prototype.unsubscribe = function () {
  152. this._stream.removeListener(this._listener);
  153. };
  154. return StreamSub;
  155. }());
  156. var Observer = (function () {
  157. function Observer(_listener) {
  158. this._listener = _listener;
  159. }
  160. Observer.prototype.next = function (value) {
  161. this._listener._n(value);
  162. };
  163. Observer.prototype.error = function (err) {
  164. this._listener._e(err);
  165. };
  166. Observer.prototype.complete = function () {
  167. this._listener._c();
  168. };
  169. return Observer;
  170. }());
  171. var FromObservable = (function () {
  172. function FromObservable(observable) {
  173. this.type = 'fromObservable';
  174. this.ins = observable;
  175. this.active = false;
  176. }
  177. FromObservable.prototype._start = function (out) {
  178. this.out = out;
  179. this.active = true;
  180. this._sub = this.ins.subscribe(new Observer(out));
  181. if (!this.active)
  182. this._sub.unsubscribe();
  183. };
  184. FromObservable.prototype._stop = function () {
  185. if (this._sub)
  186. this._sub.unsubscribe();
  187. this.active = false;
  188. };
  189. return FromObservable;
  190. }());
  191. var Merge = (function () {
  192. function Merge(insArr) {
  193. this.type = 'merge';
  194. this.insArr = insArr;
  195. this.out = NO;
  196. this.ac = 0;
  197. }
  198. Merge.prototype._start = function (out) {
  199. this.out = out;
  200. var s = this.insArr;
  201. var L = s.length;
  202. this.ac = L;
  203. for (var i = 0; i < L; i++)
  204. s[i]._add(this);
  205. };
  206. Merge.prototype._stop = function () {
  207. var s = this.insArr;
  208. var L = s.length;
  209. for (var i = 0; i < L; i++)
  210. s[i]._remove(this);
  211. this.out = NO;
  212. };
  213. Merge.prototype._n = function (t) {
  214. var u = this.out;
  215. if (u === NO)
  216. return;
  217. u._n(t);
  218. };
  219. Merge.prototype._e = function (err) {
  220. var u = this.out;
  221. if (u === NO)
  222. return;
  223. u._e(err);
  224. };
  225. Merge.prototype._c = function () {
  226. if (--this.ac <= 0) {
  227. var u = this.out;
  228. if (u === NO)
  229. return;
  230. u._c();
  231. }
  232. };
  233. return Merge;
  234. }());
  235. var CombineListener = (function () {
  236. function CombineListener(i, out, p) {
  237. this.i = i;
  238. this.out = out;
  239. this.p = p;
  240. p.ils.push(this);
  241. }
  242. CombineListener.prototype._n = function (t) {
  243. var p = this.p, out = this.out;
  244. if (out === NO)
  245. return;
  246. if (p.up(t, this.i)) {
  247. var a = p.vals;
  248. var l = a.length;
  249. var b = Array(l);
  250. for (var i = 0; i < l; ++i)
  251. b[i] = a[i];
  252. out._n(b);
  253. }
  254. };
  255. CombineListener.prototype._e = function (err) {
  256. var out = this.out;
  257. if (out === NO)
  258. return;
  259. out._e(err);
  260. };
  261. CombineListener.prototype._c = function () {
  262. var p = this.p;
  263. if (p.out === NO)
  264. return;
  265. if (--p.Nc === 0)
  266. p.out._c();
  267. };
  268. return CombineListener;
  269. }());
  270. var Combine = (function () {
  271. function Combine(insArr) {
  272. this.type = 'combine';
  273. this.insArr = insArr;
  274. this.out = NO;
  275. this.ils = [];
  276. this.Nc = this.Nn = 0;
  277. this.vals = [];
  278. }
  279. Combine.prototype.up = function (t, i) {
  280. var v = this.vals[i];
  281. var Nn = !this.Nn ? 0 : v === NO ? --this.Nn : this.Nn;
  282. this.vals[i] = t;
  283. return Nn === 0;
  284. };
  285. Combine.prototype._start = function (out) {
  286. this.out = out;
  287. var s = this.insArr;
  288. var n = this.Nc = this.Nn = s.length;
  289. var vals = this.vals = new Array(n);
  290. if (n === 0) {
  291. out._n([]);
  292. out._c();
  293. }
  294. else {
  295. for (var i = 0; i < n; i++) {
  296. vals[i] = NO;
  297. s[i]._add(new CombineListener(i, out, this));
  298. }
  299. }
  300. };
  301. Combine.prototype._stop = function () {
  302. var s = this.insArr;
  303. var n = s.length;
  304. var ils = this.ils;
  305. for (var i = 0; i < n; i++)
  306. s[i]._remove(ils[i]);
  307. this.out = NO;
  308. this.ils = [];
  309. this.vals = [];
  310. };
  311. return Combine;
  312. }());
  313. var FromArray = (function () {
  314. function FromArray(a) {
  315. this.type = 'fromArray';
  316. this.a = a;
  317. }
  318. FromArray.prototype._start = function (out) {
  319. var a = this.a;
  320. for (var i = 0, n = a.length; i < n; i++)
  321. out._n(a[i]);
  322. out._c();
  323. };
  324. FromArray.prototype._stop = function () {
  325. };
  326. return FromArray;
  327. }());
  328. var FromPromise = (function () {
  329. function FromPromise(p) {
  330. this.type = 'fromPromise';
  331. this.on = false;
  332. this.p = p;
  333. }
  334. FromPromise.prototype._start = function (out) {
  335. var prod = this;
  336. this.on = true;
  337. this.p.then(function (v) {
  338. if (prod.on) {
  339. out._n(v);
  340. out._c();
  341. }
  342. }, function (e) {
  343. out._e(e);
  344. }).then(noop, function (err) {
  345. setTimeout(function () { throw err; });
  346. });
  347. };
  348. FromPromise.prototype._stop = function () {
  349. this.on = false;
  350. };
  351. return FromPromise;
  352. }());
  353. var Periodic = (function () {
  354. function Periodic(period) {
  355. this.type = 'periodic';
  356. this.period = period;
  357. this.intervalID = -1;
  358. this.i = 0;
  359. }
  360. Periodic.prototype._start = function (out) {
  361. var self = this;
  362. function intervalHandler() { out._n(self.i++); }
  363. this.intervalID = setInterval(intervalHandler, this.period);
  364. };
  365. Periodic.prototype._stop = function () {
  366. if (this.intervalID !== -1)
  367. clearInterval(this.intervalID);
  368. this.intervalID = -1;
  369. this.i = 0;
  370. };
  371. return Periodic;
  372. }());
  373. var Debug = (function () {
  374. function Debug(ins, arg) {
  375. this.type = 'debug';
  376. this.ins = ins;
  377. this.out = NO;
  378. this.s = noop;
  379. this.l = '';
  380. if (typeof arg === 'string')
  381. this.l = arg;
  382. else if (typeof arg === 'function')
  383. this.s = arg;
  384. }
  385. Debug.prototype._start = function (out) {
  386. this.out = out;
  387. this.ins._add(this);
  388. };
  389. Debug.prototype._stop = function () {
  390. this.ins._remove(this);
  391. this.out = NO;
  392. };
  393. Debug.prototype._n = function (t) {
  394. var u = this.out;
  395. if (u === NO)
  396. return;
  397. var s = this.s, l = this.l;
  398. if (s !== noop) {
  399. try {
  400. s(t);
  401. }
  402. catch (e) {
  403. u._e(e);
  404. }
  405. }
  406. else if (l)
  407. console.log(l + ':', t);
  408. else
  409. console.log(t);
  410. u._n(t);
  411. };
  412. Debug.prototype._e = function (err) {
  413. var u = this.out;
  414. if (u === NO)
  415. return;
  416. u._e(err);
  417. };
  418. Debug.prototype._c = function () {
  419. var u = this.out;
  420. if (u === NO)
  421. return;
  422. u._c();
  423. };
  424. return Debug;
  425. }());
  426. var Drop = (function () {
  427. function Drop(max, ins) {
  428. this.type = 'drop';
  429. this.ins = ins;
  430. this.out = NO;
  431. this.max = max;
  432. this.dropped = 0;
  433. }
  434. Drop.prototype._start = function (out) {
  435. this.out = out;
  436. this.dropped = 0;
  437. this.ins._add(this);
  438. };
  439. Drop.prototype._stop = function () {
  440. this.ins._remove(this);
  441. this.out = NO;
  442. };
  443. Drop.prototype._n = function (t) {
  444. var u = this.out;
  445. if (u === NO)
  446. return;
  447. if (this.dropped++ >= this.max)
  448. u._n(t);
  449. };
  450. Drop.prototype._e = function (err) {
  451. var u = this.out;
  452. if (u === NO)
  453. return;
  454. u._e(err);
  455. };
  456. Drop.prototype._c = function () {
  457. var u = this.out;
  458. if (u === NO)
  459. return;
  460. u._c();
  461. };
  462. return Drop;
  463. }());
  464. var EndWhenListener = (function () {
  465. function EndWhenListener(out, op) {
  466. this.out = out;
  467. this.op = op;
  468. }
  469. EndWhenListener.prototype._n = function () {
  470. this.op.end();
  471. };
  472. EndWhenListener.prototype._e = function (err) {
  473. this.out._e(err);
  474. };
  475. EndWhenListener.prototype._c = function () {
  476. this.op.end();
  477. };
  478. return EndWhenListener;
  479. }());
  480. var EndWhen = (function () {
  481. function EndWhen(o, ins) {
  482. this.type = 'endWhen';
  483. this.ins = ins;
  484. this.out = NO;
  485. this.o = o;
  486. this.oil = NO_IL;
  487. }
  488. EndWhen.prototype._start = function (out) {
  489. this.out = out;
  490. this.o._add(this.oil = new EndWhenListener(out, this));
  491. this.ins._add(this);
  492. };
  493. EndWhen.prototype._stop = function () {
  494. this.ins._remove(this);
  495. this.o._remove(this.oil);
  496. this.out = NO;
  497. this.oil = NO_IL;
  498. };
  499. EndWhen.prototype.end = function () {
  500. var u = this.out;
  501. if (u === NO)
  502. return;
  503. u._c();
  504. };
  505. EndWhen.prototype._n = function (t) {
  506. var u = this.out;
  507. if (u === NO)
  508. return;
  509. u._n(t);
  510. };
  511. EndWhen.prototype._e = function (err) {
  512. var u = this.out;
  513. if (u === NO)
  514. return;
  515. u._e(err);
  516. };
  517. EndWhen.prototype._c = function () {
  518. this.end();
  519. };
  520. return EndWhen;
  521. }());
  522. var Filter = (function () {
  523. function Filter(passes, ins) {
  524. this.type = 'filter';
  525. this.ins = ins;
  526. this.out = NO;
  527. this.f = passes;
  528. }
  529. Filter.prototype._start = function (out) {
  530. this.out = out;
  531. this.ins._add(this);
  532. };
  533. Filter.prototype._stop = function () {
  534. this.ins._remove(this);
  535. this.out = NO;
  536. };
  537. Filter.prototype._n = function (t) {
  538. var u = this.out;
  539. if (u === NO)
  540. return;
  541. var r = _try(this, t, u);
  542. if (r === NO || !r)
  543. return;
  544. u._n(t);
  545. };
  546. Filter.prototype._e = function (err) {
  547. var u = this.out;
  548. if (u === NO)
  549. return;
  550. u._e(err);
  551. };
  552. Filter.prototype._c = function () {
  553. var u = this.out;
  554. if (u === NO)
  555. return;
  556. u._c();
  557. };
  558. return Filter;
  559. }());
  560. var FlattenListener = (function () {
  561. function FlattenListener(out, op) {
  562. this.out = out;
  563. this.op = op;
  564. }
  565. FlattenListener.prototype._n = function (t) {
  566. this.out._n(t);
  567. };
  568. FlattenListener.prototype._e = function (err) {
  569. this.out._e(err);
  570. };
  571. FlattenListener.prototype._c = function () {
  572. this.op.inner = NO;
  573. this.op.less();
  574. };
  575. return FlattenListener;
  576. }());
  577. var Flatten = (function () {
  578. function Flatten(ins) {
  579. this.type = 'flatten';
  580. this.ins = ins;
  581. this.out = NO;
  582. this.open = true;
  583. this.inner = NO;
  584. this.il = NO_IL;
  585. }
  586. Flatten.prototype._start = function (out) {
  587. this.out = out;
  588. this.open = true;
  589. this.inner = NO;
  590. this.il = NO_IL;
  591. this.ins._add(this);
  592. };
  593. Flatten.prototype._stop = function () {
  594. this.ins._remove(this);
  595. if (this.inner !== NO)
  596. this.inner._remove(this.il);
  597. this.out = NO;
  598. this.open = true;
  599. this.inner = NO;
  600. this.il = NO_IL;
  601. };
  602. Flatten.prototype.less = function () {
  603. var u = this.out;
  604. if (u === NO)
  605. return;
  606. if (!this.open && this.inner === NO)
  607. u._c();
  608. };
  609. Flatten.prototype._n = function (s) {
  610. var u = this.out;
  611. if (u === NO)
  612. return;
  613. var _a = this, inner = _a.inner, il = _a.il;
  614. if (inner !== NO && il !== NO_IL)
  615. inner._remove(il);
  616. (this.inner = s)._add(this.il = new FlattenListener(u, this));
  617. };
  618. Flatten.prototype._e = function (err) {
  619. var u = this.out;
  620. if (u === NO)
  621. return;
  622. u._e(err);
  623. };
  624. Flatten.prototype._c = function () {
  625. this.open = false;
  626. this.less();
  627. };
  628. return Flatten;
  629. }());
  630. var Fold = (function () {
  631. function Fold(f, seed, ins) {
  632. var _this = this;
  633. this.type = 'fold';
  634. this.ins = ins;
  635. this.out = NO;
  636. this.f = function (t) { return f(_this.acc, t); };
  637. this.acc = this.seed = seed;
  638. }
  639. Fold.prototype._start = function (out) {
  640. this.out = out;
  641. this.acc = this.seed;
  642. out._n(this.acc);
  643. this.ins._add(this);
  644. };
  645. Fold.prototype._stop = function () {
  646. this.ins._remove(this);
  647. this.out = NO;
  648. this.acc = this.seed;
  649. };
  650. Fold.prototype._n = function (t) {
  651. var u = this.out;
  652. if (u === NO)
  653. return;
  654. var r = _try(this, t, u);
  655. if (r === NO)
  656. return;
  657. u._n(this.acc = r);
  658. };
  659. Fold.prototype._e = function (err) {
  660. var u = this.out;
  661. if (u === NO)
  662. return;
  663. u._e(err);
  664. };
  665. Fold.prototype._c = function () {
  666. var u = this.out;
  667. if (u === NO)
  668. return;
  669. u._c();
  670. };
  671. return Fold;
  672. }());
  673. var Last = (function () {
  674. function Last(ins) {
  675. this.type = 'last';
  676. this.ins = ins;
  677. this.out = NO;
  678. this.has = false;
  679. this.val = NO;
  680. }
  681. Last.prototype._start = function (out) {
  682. this.out = out;
  683. this.has = false;
  684. this.ins._add(this);
  685. };
  686. Last.prototype._stop = function () {
  687. this.ins._remove(this);
  688. this.out = NO;
  689. this.val = NO;
  690. };
  691. Last.prototype._n = function (t) {
  692. this.has = true;
  693. this.val = t;
  694. };
  695. Last.prototype._e = function (err) {
  696. var u = this.out;
  697. if (u === NO)
  698. return;
  699. u._e(err);
  700. };
  701. Last.prototype._c = function () {
  702. var u = this.out;
  703. if (u === NO)
  704. return;
  705. if (this.has) {
  706. u._n(this.val);
  707. u._c();
  708. }
  709. else
  710. u._e(new Error('last() failed because input stream completed'));
  711. };
  712. return Last;
  713. }());
  714. var MapOp = (function () {
  715. function MapOp(project, ins) {
  716. this.type = 'map';
  717. this.ins = ins;
  718. this.out = NO;
  719. this.f = project;
  720. }
  721. MapOp.prototype._start = function (out) {
  722. this.out = out;
  723. this.ins._add(this);
  724. };
  725. MapOp.prototype._stop = function () {
  726. this.ins._remove(this);
  727. this.out = NO;
  728. };
  729. MapOp.prototype._n = function (t) {
  730. var u = this.out;
  731. if (u === NO)
  732. return;
  733. var r = _try(this, t, u);
  734. if (r === NO)
  735. return;
  736. u._n(r);
  737. };
  738. MapOp.prototype._e = function (err) {
  739. var u = this.out;
  740. if (u === NO)
  741. return;
  742. u._e(err);
  743. };
  744. MapOp.prototype._c = function () {
  745. var u = this.out;
  746. if (u === NO)
  747. return;
  748. u._c();
  749. };
  750. return MapOp;
  751. }());
  752. var Remember = (function () {
  753. function Remember(ins) {
  754. this.type = 'remember';
  755. this.ins = ins;
  756. this.out = NO;
  757. }
  758. Remember.prototype._start = function (out) {
  759. this.out = out;
  760. this.ins._add(out);
  761. };
  762. Remember.prototype._stop = function () {
  763. this.ins._remove(this.out);
  764. this.out = NO;
  765. };
  766. return Remember;
  767. }());
  768. var ReplaceError = (function () {
  769. function ReplaceError(replacer, ins) {
  770. this.type = 'replaceError';
  771. this.ins = ins;
  772. this.out = NO;
  773. this.f = replacer;
  774. }
  775. ReplaceError.prototype._start = function (out) {
  776. this.out = out;
  777. this.ins._add(this);
  778. };
  779. ReplaceError.prototype._stop = function () {
  780. this.ins._remove(this);
  781. this.out = NO;
  782. };
  783. ReplaceError.prototype._n = function (t) {
  784. var u = this.out;
  785. if (u === NO)
  786. return;
  787. u._n(t);
  788. };
  789. ReplaceError.prototype._e = function (err) {
  790. var u = this.out;
  791. if (u === NO)
  792. return;
  793. try {
  794. this.ins._remove(this);
  795. (this.ins = this.f(err))._add(this);
  796. }
  797. catch (e) {
  798. u._e(e);
  799. }
  800. };
  801. ReplaceError.prototype._c = function () {
  802. var u = this.out;
  803. if (u === NO)
  804. return;
  805. u._c();
  806. };
  807. return ReplaceError;
  808. }());
  809. var StartWith = (function () {
  810. function StartWith(ins, val) {
  811. this.type = 'startWith';
  812. this.ins = ins;
  813. this.out = NO;
  814. this.val = val;
  815. }
  816. StartWith.prototype._start = function (out) {
  817. this.out = out;
  818. this.out._n(this.val);
  819. this.ins._add(out);
  820. };
  821. StartWith.prototype._stop = function () {
  822. this.ins._remove(this.out);
  823. this.out = NO;
  824. };
  825. return StartWith;
  826. }());
  827. var Take = (function () {
  828. function Take(max, ins) {
  829. this.type = 'take';
  830. this.ins = ins;
  831. this.out = NO;
  832. this.max = max;
  833. this.taken = 0;
  834. }
  835. Take.prototype._start = function (out) {
  836. this.out = out;
  837. this.taken = 0;
  838. if (this.max <= 0)
  839. out._c();
  840. else
  841. this.ins._add(this);
  842. };
  843. Take.prototype._stop = function () {
  844. this.ins._remove(this);
  845. this.out = NO;
  846. };
  847. Take.prototype._n = function (t) {
  848. var u = this.out;
  849. if (u === NO)
  850. return;
  851. var m = ++this.taken;
  852. if (m < this.max)
  853. u._n(t);
  854. else if (m === this.max) {
  855. u._n(t);
  856. u._c();
  857. }
  858. };
  859. Take.prototype._e = function (err) {
  860. var u = this.out;
  861. if (u === NO)
  862. return;
  863. u._e(err);
  864. };
  865. Take.prototype._c = function () {
  866. var u = this.out;
  867. if (u === NO)
  868. return;
  869. u._c();
  870. };
  871. return Take;
  872. }());
  873. var Stream = (function () {
  874. function Stream(producer) {
  875. this._prod = producer || NO;
  876. this._ils = [];
  877. this._stopID = NO;
  878. this._dl = NO;
  879. this._d = false;
  880. this._target = NO;
  881. this._err = NO;
  882. }
  883. Stream.prototype._n = function (t) {
  884. var a = this._ils;
  885. var L = a.length;
  886. if (this._d)
  887. this._dl._n(t);
  888. if (L == 1)
  889. a[0]._n(t);
  890. else if (L == 0)
  891. return;
  892. else {
  893. var b = cp(a);
  894. for (var i = 0; i < L; i++)
  895. b[i]._n(t);
  896. }
  897. };
  898. Stream.prototype._e = function (err) {
  899. if (this._err !== NO)
  900. return;
  901. this._err = err;
  902. var a = this._ils;
  903. var L = a.length;
  904. this._x();
  905. if (this._d)
  906. this._dl._e(err);
  907. if (L == 1)
  908. a[0]._e(err);
  909. else if (L == 0)
  910. return;
  911. else {
  912. var b = cp(a);
  913. for (var i = 0; i < L; i++)
  914. b[i]._e(err);
  915. }
  916. if (!this._d && L == 0)
  917. throw this._err;
  918. };
  919. Stream.prototype._c = function () {
  920. var a = this._ils;
  921. var L = a.length;
  922. this._x();
  923. if (this._d)
  924. this._dl._c();
  925. if (L == 1)
  926. a[0]._c();
  927. else if (L == 0)
  928. return;
  929. else {
  930. var b = cp(a);
  931. for (var i = 0; i < L; i++)
  932. b[i]._c();
  933. }
  934. };
  935. Stream.prototype._x = function () {
  936. if (this._ils.length === 0)
  937. return;
  938. if (this._prod !== NO)
  939. this._prod._stop();
  940. this._err = NO;
  941. this._ils = [];
  942. };
  943. Stream.prototype._stopNow = function () {
  944. // WARNING: code that calls this method should
  945. // first check if this._prod is valid (not `NO`)
  946. this._prod._stop();
  947. this._err = NO;
  948. this._stopID = NO;
  949. };
  950. Stream.prototype._add = function (il) {
  951. var ta = this._target;
  952. if (ta !== NO)
  953. return ta._add(il);
  954. var a = this._ils;
  955. a.push(il);
  956. if (a.length > 1)
  957. return;
  958. if (this._stopID !== NO) {
  959. clearTimeout(this._stopID);
  960. this._stopID = NO;
  961. }
  962. else {
  963. var p = this._prod;
  964. if (p !== NO)
  965. p._start(this);
  966. }
  967. };
  968. Stream.prototype._remove = function (il) {
  969. var _this = this;
  970. var ta = this._target;
  971. if (ta !== NO)
  972. return ta._remove(il);
  973. var a = this._ils;
  974. var i = a.indexOf(il);
  975. if (i > -1) {
  976. a.splice(i, 1);
  977. if (this._prod !== NO && a.length <= 0) {
  978. this._err = NO;
  979. this._stopID = setTimeout(function () { return _this._stopNow(); });
  980. }
  981. else if (a.length === 1) {
  982. this._pruneCycles();
  983. }
  984. }
  985. };
  986. // If all paths stemming from `this` stream eventually end at `this`
  987. // stream, then we remove the single listener of `this` stream, to
  988. // force it to end its execution and dispose resources. This method
  989. // assumes as a precondition that this._ils has just one listener.
  990. Stream.prototype._pruneCycles = function () {
  991. if (this._hasNoSinks(this, []))
  992. this._remove(this._ils[0]);
  993. };
  994. // Checks whether *there is no* path starting from `x` that leads to an end
  995. // listener (sink) in the stream graph, following edges A->B where B is a
  996. // listener of A. This means these paths constitute a cycle somehow. Is given
  997. // a trace of all visited nodes so far.
  998. Stream.prototype._hasNoSinks = function (x, trace) {
  999. if (trace.indexOf(x) !== -1)
  1000. return true;
  1001. else if (x.out === this)
  1002. return true;
  1003. else if (x.out && x.out !== NO)
  1004. return this._hasNoSinks(x.out, trace.concat(x));
  1005. else if (x._ils) {
  1006. for (var i = 0, N = x._ils.length; i < N; i++)
  1007. if (!this._hasNoSinks(x._ils[i], trace.concat(x)))
  1008. return false;
  1009. return true;
  1010. }
  1011. else
  1012. return false;
  1013. };
  1014. Stream.prototype.ctor = function () {
  1015. return this instanceof MemoryStream ? MemoryStream : Stream;
  1016. };
  1017. /**
  1018. * Adds a Listener to the Stream.
  1019. *
  1020. * @param {Listener} listener
  1021. */
  1022. Stream.prototype.addListener = function (listener) {
  1023. listener._n = listener.next || noop;
  1024. listener._e = listener.error || noop;
  1025. listener._c = listener.complete || noop;
  1026. this._add(listener);
  1027. };
  1028. /**
  1029. * Removes a Listener from the Stream, assuming the Listener was added to it.
  1030. *
  1031. * @param {Listener<T>} listener
  1032. */
  1033. Stream.prototype.removeListener = function (listener) {
  1034. this._remove(listener);
  1035. };
  1036. /**
  1037. * Adds a Listener to the Stream returning a Subscription to remove that
  1038. * listener.
  1039. *
  1040. * @param {Listener} listener
  1041. * @returns {Subscription}
  1042. */
  1043. Stream.prototype.subscribe = function (listener) {
  1044. this.addListener(listener);
  1045. return new StreamSub(this, listener);
  1046. };
  1047. /**
  1048. * Add interop between most.js and RxJS 5
  1049. *
  1050. * @returns {Stream}
  1051. */
  1052. Stream.prototype[symbol_observable_1.default] = function () {
  1053. return this;
  1054. };
  1055. /**
  1056. * Creates a new Stream given a Producer.
  1057. *
  1058. * @factory true
  1059. * @param {Producer} producer An optional Producer that dictates how to
  1060. * start, generate events, and stop the Stream.
  1061. * @return {Stream}
  1062. */
  1063. Stream.create = function (producer) {
  1064. if (producer) {
  1065. if (typeof producer.start !== 'function'
  1066. || typeof producer.stop !== 'function')
  1067. throw new Error('producer requires both start and stop functions');
  1068. internalizeProducer(producer); // mutates the input
  1069. }
  1070. return new Stream(producer);
  1071. };
  1072. /**
  1073. * Creates a new MemoryStream given a Producer.
  1074. *
  1075. * @factory true
  1076. * @param {Producer} producer An optional Producer that dictates how to
  1077. * start, generate events, and stop the Stream.
  1078. * @return {MemoryStream}
  1079. */
  1080. Stream.createWithMemory = function (producer) {
  1081. if (producer)
  1082. internalizeProducer(producer); // mutates the input
  1083. return new MemoryStream(producer);
  1084. };
  1085. /**
  1086. * Creates a Stream that does nothing when started. It never emits any event.
  1087. *
  1088. * Marble diagram:
  1089. *
  1090. * ```text
  1091. * never
  1092. * -----------------------
  1093. * ```
  1094. *
  1095. * @factory true
  1096. * @return {Stream}
  1097. */
  1098. Stream.never = function () {
  1099. return new Stream({ _start: noop, _stop: noop });
  1100. };
  1101. /**
  1102. * Creates a Stream that immediately emits the "complete" notification when
  1103. * started, and that's it.
  1104. *
  1105. * Marble diagram:
  1106. *
  1107. * ```text
  1108. * empty
  1109. * -|
  1110. * ```
  1111. *
  1112. * @factory true
  1113. * @return {Stream}
  1114. */
  1115. Stream.empty = function () {
  1116. return new Stream({
  1117. _start: function (il) { il._c(); },
  1118. _stop: noop,
  1119. });
  1120. };
  1121. /**
  1122. * Creates a Stream that immediately emits an "error" notification with the
  1123. * value you passed as the `error` argument when the stream starts, and that's
  1124. * it.
  1125. *
  1126. * Marble diagram:
  1127. *
  1128. * ```text
  1129. * throw(X)
  1130. * -X
  1131. * ```
  1132. *
  1133. * @factory true
  1134. * @param error The error event to emit on the created stream.
  1135. * @return {Stream}
  1136. */
  1137. Stream.throw = function (error) {
  1138. return new Stream({
  1139. _start: function (il) { il._e(error); },
  1140. _stop: noop,
  1141. });
  1142. };
  1143. /**
  1144. * Creates a stream from an Array, Promise, or an Observable.
  1145. *
  1146. * @factory true
  1147. * @param {Array|PromiseLike|Observable} input The input to make a stream from.
  1148. * @return {Stream}
  1149. */
  1150. Stream.from = function (input) {
  1151. if (typeof input[symbol_observable_1.default] === 'function')
  1152. return Stream.fromObservable(input);
  1153. else if (typeof input.then === 'function')
  1154. return Stream.fromPromise(input);
  1155. else if (Array.isArray(input))
  1156. return Stream.fromArray(input);
  1157. throw new TypeError("Type of input to from() must be an Array, Promise, or Observable");
  1158. };
  1159. /**
  1160. * Creates a Stream that immediately emits the arguments that you give to
  1161. * *of*, then completes.
  1162. *
  1163. * Marble diagram:
  1164. *
  1165. * ```text
  1166. * of(1,2,3)
  1167. * 123|
  1168. * ```
  1169. *
  1170. * @factory true
  1171. * @param a The first value you want to emit as an event on the stream.
  1172. * @param b The second value you want to emit as an event on the stream. One
  1173. * or more of these values may be given as arguments.
  1174. * @return {Stream}
  1175. */
  1176. Stream.of = function () {
  1177. var items = [];
  1178. for (var _i = 0; _i < arguments.length; _i++) {
  1179. items[_i] = arguments[_i];
  1180. }
  1181. return Stream.fromArray(items);
  1182. };
  1183. /**
  1184. * Converts an array to a stream. The returned stream will emit synchronously
  1185. * all the items in the array, and then complete.
  1186. *
  1187. * Marble diagram:
  1188. *
  1189. * ```text
  1190. * fromArray([1,2,3])
  1191. * 123|
  1192. * ```
  1193. *
  1194. * @factory true
  1195. * @param {Array} array The array to be converted as a stream.
  1196. * @return {Stream}
  1197. */
  1198. Stream.fromArray = function (array) {
  1199. return new Stream(new FromArray(array));
  1200. };
  1201. /**
  1202. * Converts a promise to a stream. The returned stream will emit the resolved
  1203. * value of the promise, and then complete. However, if the promise is
  1204. * rejected, the stream will emit the corresponding error.
  1205. *
  1206. * Marble diagram:
  1207. *
  1208. * ```text
  1209. * fromPromise( ----42 )
  1210. * -----------------42|
  1211. * ```
  1212. *
  1213. * @factory true
  1214. * @param {PromiseLike} promise The promise to be converted as a stream.
  1215. * @return {Stream}
  1216. */
  1217. Stream.fromPromise = function (promise) {
  1218. return new Stream(new FromPromise(promise));
  1219. };
  1220. /**
  1221. * Converts an Observable into a Stream.
  1222. *
  1223. * @factory true
  1224. * @param {any} observable The observable to be converted as a stream.
  1225. * @return {Stream}
  1226. */
  1227. Stream.fromObservable = function (obs) {
  1228. if (obs.endWhen)
  1229. return obs;
  1230. return new Stream(new FromObservable(obs));
  1231. };
  1232. /**
  1233. * Creates a stream that periodically emits incremental numbers, every
  1234. * `period` milliseconds.
  1235. *
  1236. * Marble diagram:
  1237. *
  1238. * ```text
  1239. * periodic(1000)
  1240. * ---0---1---2---3---4---...
  1241. * ```
  1242. *
  1243. * @factory true
  1244. * @param {number} period The interval in milliseconds to use as a rate of
  1245. * emission.
  1246. * @return {Stream}
  1247. */
  1248. Stream.periodic = function (period) {
  1249. return new Stream(new Periodic(period));
  1250. };
  1251. Stream.prototype._map = function (project) {
  1252. return new (this.ctor())(new MapOp(project, this));
  1253. };
  1254. /**
  1255. * Transforms each event from the input Stream through a `project` function,
  1256. * to get a Stream that emits those transformed events.
  1257. *
  1258. * Marble diagram:
  1259. *
  1260. * ```text
  1261. * --1---3--5-----7------
  1262. * map(i => i * 10)
  1263. * --10--30-50----70-----
  1264. * ```
  1265. *
  1266. * @param {Function} project A function of type `(t: T) => U` that takes event
  1267. * `t` of type `T` from the input Stream and produces an event of type `U`, to
  1268. * be emitted on the output Stream.
  1269. * @return {Stream}
  1270. */
  1271. Stream.prototype.map = function (project) {
  1272. return this._map(project);
  1273. };
  1274. /**
  1275. * It's like `map`, but transforms each input event to always the same
  1276. * constant value on the output Stream.
  1277. *
  1278. * Marble diagram:
  1279. *
  1280. * ```text
  1281. * --1---3--5-----7-----
  1282. * mapTo(10)
  1283. * --10--10-10----10----
  1284. * ```
  1285. *
  1286. * @param projectedValue A value to emit on the output Stream whenever the
  1287. * input Stream emits any value.
  1288. * @return {Stream}
  1289. */
  1290. Stream.prototype.mapTo = function (projectedValue) {
  1291. var s = this.map(function () { return projectedValue; });
  1292. var op = s._prod;
  1293. op.type = 'mapTo';
  1294. return s;
  1295. };
  1296. /**
  1297. * Only allows events that pass the test given by the `passes` argument.
  1298. *
  1299. * Each event from the input stream is given to the `passes` function. If the
  1300. * function returns `true`, the event is forwarded to the output stream,
  1301. * otherwise it is ignored and not forwarded.
  1302. *
  1303. * Marble diagram:
  1304. *
  1305. * ```text
  1306. * --1---2--3-----4-----5---6--7-8--
  1307. * filter(i => i % 2 === 0)
  1308. * ------2--------4---------6----8--
  1309. * ```
  1310. *
  1311. * @param {Function} passes A function of type `(t: T) +> boolean` that takes
  1312. * an event from the input stream and checks if it passes, by returning a
  1313. * boolean.
  1314. * @return {Stream}
  1315. */
  1316. Stream.prototype.filter = function (passes) {
  1317. var p = this._prod;
  1318. if (p instanceof Filter)
  1319. return new Stream(new Filter(and(p.f, passes), p.ins));
  1320. return new Stream(new Filter(passes, this));
  1321. };
  1322. /**
  1323. * Lets the first `amount` many events from the input stream pass to the
  1324. * output stream, then makes the output stream complete.
  1325. *
  1326. * Marble diagram:
  1327. *
  1328. * ```text
  1329. * --a---b--c----d---e--
  1330. * take(3)
  1331. * --a---b--c|
  1332. * ```
  1333. *
  1334. * @param {number} amount How many events to allow from the input stream
  1335. * before completing the output stream.
  1336. * @return {Stream}
  1337. */
  1338. Stream.prototype.take = function (amount) {
  1339. return new (this.ctor())(new Take(amount, this));
  1340. };
  1341. /**
  1342. * Ignores the first `amount` many events from the input stream, and then
  1343. * after that starts forwarding events from the input stream to the output
  1344. * stream.
  1345. *
  1346. * Marble diagram:
  1347. *
  1348. * ```text
  1349. * --a---b--c----d---e--
  1350. * drop(3)
  1351. * --------------d---e--
  1352. * ```
  1353. *
  1354. * @param {number} amount How many events to ignore from the input stream
  1355. * before forwarding all events from the input stream to the output stream.
  1356. * @return {Stream}
  1357. */
  1358. Stream.prototype.drop = function (amount) {
  1359. return new Stream(new Drop(amount, this));
  1360. };
  1361. /**
  1362. * When the input stream completes, the output stream will emit the last event
  1363. * emitted by the input stream, and then will also complete.
  1364. *
  1365. * Marble diagram:
  1366. *
  1367. * ```text
  1368. * --a---b--c--d----|
  1369. * last()
  1370. * -----------------d|
  1371. * ```
  1372. *
  1373. * @return {Stream}
  1374. */
  1375. Stream.prototype.last = function () {
  1376. return new Stream(new Last(this));
  1377. };
  1378. /**
  1379. * Prepends the given `initial` value to the sequence of events emitted by the
  1380. * input stream. The returned stream is a MemoryStream, which means it is
  1381. * already `remember()`'d.
  1382. *
  1383. * Marble diagram:
  1384. *
  1385. * ```text
  1386. * ---1---2-----3---
  1387. * startWith(0)
  1388. * 0--1---2-----3---
  1389. * ```
  1390. *
  1391. * @param initial The value or event to prepend.
  1392. * @return {MemoryStream}
  1393. */
  1394. Stream.prototype.startWith = function (initial) {
  1395. return new MemoryStream(new StartWith(this, initial));
  1396. };
  1397. /**
  1398. * Uses another stream to determine when to complete the current stream.
  1399. *
  1400. * When the given `other` stream emits an event or completes, the output
  1401. * stream will complete. Before that happens, the output stream will behaves
  1402. * like the input stream.
  1403. *
  1404. * Marble diagram:
  1405. *
  1406. * ```text
  1407. * ---1---2-----3--4----5----6---
  1408. * endWhen( --------a--b--| )
  1409. * ---1---2-----3--4--|
  1410. * ```
  1411. *
  1412. * @param other Some other stream that is used to know when should the output
  1413. * stream of this operator complete.
  1414. * @return {Stream}
  1415. */
  1416. Stream.prototype.endWhen = function (other) {
  1417. return new (this.ctor())(new EndWhen(other, this));
  1418. };
  1419. /**
  1420. * "Folds" the stream onto itself.
  1421. *
  1422. * Combines events from the past throughout
  1423. * the entire execution of the input stream, allowing you to accumulate them
  1424. * together. It's essentially like `Array.prototype.reduce`. The returned
  1425. * stream is a MemoryStream, which means it is already `remember()`'d.
  1426. *
  1427. * The output stream starts by emitting the `seed` which you give as argument.
  1428. * Then, when an event happens on the input stream, it is combined with that
  1429. * seed value through the `accumulate` function, and the output value is
  1430. * emitted on the output stream. `fold` remembers that output value as `acc`
  1431. * ("accumulator"), and then when a new input event `t` happens, `acc` will be
  1432. * combined with that to produce the new `acc` and so forth.
  1433. *
  1434. * Marble diagram:
  1435. *
  1436. * ```text
  1437. * ------1-----1--2----1----1------
  1438. * fold((acc, x) => acc + x, 3)
  1439. * 3-----4-----5--7----8----9------
  1440. * ```
  1441. *
  1442. * @param {Function} accumulate A function of type `(acc: R, t: T) => R` that
  1443. * takes the previous accumulated value `acc` and the incoming event from the
  1444. * input stream and produces the new accumulated value.
  1445. * @param seed The initial accumulated value, of type `R`.
  1446. * @return {MemoryStream}
  1447. */
  1448. Stream.prototype.fold = function (accumulate, seed) {
  1449. return new MemoryStream(new Fold(accumulate, seed, this));
  1450. };
  1451. /**
  1452. * Replaces an error with another stream.
  1453. *
  1454. * When (and if) an error happens on the input stream, instead of forwarding
  1455. * that error to the output stream, *replaceError* will call the `replace`
  1456. * function which returns the stream that the output stream will replicate.
  1457. * And, in case that new stream also emits an error, `replace` will be called
  1458. * again to get another stream to start replicating.
  1459. *
  1460. * Marble diagram:
  1461. *
  1462. * ```text
  1463. * --1---2-----3--4-----X
  1464. * replaceError( () => --10--| )
  1465. * --1---2-----3--4--------10--|
  1466. * ```
  1467. *
  1468. * @param {Function} replace A function of type `(err) => Stream` that takes
  1469. * the error that occurred on the input stream or on the previous replacement
  1470. * stream and returns a new stream. The output stream will behave like the
  1471. * stream that this function returns.
  1472. * @return {Stream}
  1473. */
  1474. Stream.prototype.replaceError = function (replace) {
  1475. return new (this.ctor())(new ReplaceError(replace, this));
  1476. };
  1477. /**
  1478. * Flattens a "stream of streams", handling only one nested stream at a time
  1479. * (no concurrency).
  1480. *
  1481. * If the input stream is a stream that emits streams, then this operator will
  1482. * return an output stream which is a flat stream: emits regular events. The
  1483. * flattening happens without concurrency. It works like this: when the input
  1484. * stream emits a nested stream, *flatten* will start imitating that nested
  1485. * one. However, as soon as the next nested stream is emitted on the input
  1486. * stream, *flatten* will forget the previous nested one it was imitating, and
  1487. * will start imitating the new nested one.
  1488. *
  1489. * Marble diagram:
  1490. *
  1491. * ```text
  1492. * --+--------+---------------
  1493. * \ \
  1494. * \ ----1----2---3--
  1495. * --a--b----c----d--------
  1496. * flatten
  1497. * -----a--b------1----2---3--
  1498. * ```
  1499. *
  1500. * @return {Stream}
  1501. */
  1502. Stream.prototype.flatten = function () {
  1503. var p = this._prod;
  1504. return new Stream(new Flatten(this));
  1505. };
  1506. /**
  1507. * Passes the input stream to a custom operator, to produce an output stream.
  1508. *
  1509. * *compose* is a handy way of using an existing function in a chained style.
  1510. * Instead of writing `outStream = f(inStream)` you can write
  1511. * `outStream = inStream.compose(f)`.
  1512. *
  1513. * @param {function} operator A function that takes a stream as input and
  1514. * returns a stream as well.
  1515. * @return {Stream}
  1516. */
  1517. Stream.prototype.compose = function (operator) {
  1518. return operator(this);
  1519. };
  1520. /**
  1521. * Returns an output stream that behaves like the input stream, but also
  1522. * remembers the most recent event that happens on the input stream, so that a
  1523. * newly added listener will immediately receive that memorised event.
  1524. *
  1525. * @return {MemoryStream}
  1526. */
  1527. Stream.prototype.remember = function () {
  1528. return new MemoryStream(new Remember(this));
  1529. };
  1530. /**
  1531. * Returns an output stream that identically behaves like the input stream,
  1532. * but also runs a `spy` function for each event, to help you debug your app.
  1533. *
  1534. * *debug* takes a `spy` function as argument, and runs that for each event
  1535. * happening on the input stream. If you don't provide the `spy` argument,
  1536. * then *debug* will just `console.log` each event. This helps you to
  1537. * understand the flow of events through some operator chain.
  1538. *
  1539. * Please note that if the output stream has no listeners, then it will not
  1540. * start, which means `spy` will never run because no actual event happens in
  1541. * that case.
  1542. *
  1543. * Marble diagram:
  1544. *
  1545. * ```text
  1546. * --1----2-----3-----4--
  1547. * debug
  1548. * --1----2-----3-----4--
  1549. * ```
  1550. *
  1551. * @param {function} labelOrSpy A string to use as the label when printing
  1552. * debug information on the console, or a 'spy' function that takes an event
  1553. * as argument, and does not need to return anything.
  1554. * @return {Stream}
  1555. */
  1556. Stream.prototype.debug = function (labelOrSpy) {
  1557. return new (this.ctor())(new Debug(this, labelOrSpy));
  1558. };
  1559. /**
  1560. * *imitate* changes this current Stream to emit the same events that the
  1561. * `other` given Stream does. This method returns nothing.
  1562. *
  1563. * This method exists to allow one thing: **circular dependency of streams**.
  1564. * For instance, let's imagine that for some reason you need to create a
  1565. * circular dependency where stream `first$` depends on stream `second$`
  1566. * which in turn depends on `first$`:
  1567. *
  1568. * <!-- skip-example -->
  1569. * ```js
  1570. * import delay from 'xstream/extra/delay'
  1571. *
  1572. * var first$ = second$.map(x => x * 10).take(3);
  1573. * var second$ = first$.map(x => x + 1).startWith(1).compose(delay(100));
  1574. * ```
  1575. *
  1576. * However, that is invalid JavaScript, because `second$` is undefined
  1577. * on the first line. This is how *imitate* can help solve it:
  1578. *
  1579. * ```js
  1580. * import delay from 'xstream/extra/delay'
  1581. *
  1582. * var secondProxy$ = xs.create();
  1583. * var first$ = secondProxy$.map(x => x * 10).take(3);
  1584. * var second$ = first$.map(x => x + 1).startWith(1).compose(delay(100));
  1585. * secondProxy$.imitate(second$);
  1586. * ```
  1587. *
  1588. * We create `secondProxy$` before the others, so it can be used in the
  1589. * declaration of `first$`. Then, after both `first$` and `second$` are
  1590. * defined, we hook `secondProxy$` with `second$` with `imitate()` to tell
  1591. * that they are "the same". `imitate` will not trigger the start of any
  1592. * stream, it just binds `secondProxy$` and `second$` together.
  1593. *
  1594. * The following is an example where `imitate()` is important in Cycle.js
  1595. * applications. A parent component contains some child components. A child
  1596. * has an action stream which is given to the parent to define its state:
  1597. *
  1598. * <!-- skip-example -->
  1599. * ```js
  1600. * const childActionProxy$ = xs.create();
  1601. * const parent = Parent({...sources, childAction$: childActionProxy$});
  1602. * const childAction$ = parent.state$.map(s => s.child.action$).flatten();
  1603. * childActionProxy$.imitate(childAction$);
  1604. * ```
  1605. *
  1606. * Note, though, that **`imitate()` does not support MemoryStreams**. If we
  1607. * would attempt to imitate a MemoryStream in a circular dependency, we would
  1608. * either get a race condition (where the symptom would be "nothing happens")
  1609. * or an infinite cyclic emission of values. It's useful to think about
  1610. * MemoryStreams as cells in a spreadsheet. It doesn't make any sense to
  1611. * define a spreadsheet cell `A1` with a formula that depends on `B1` and
  1612. * cell `B1` defined with a formula that depends on `A1`.
  1613. *
  1614. * If you find yourself wanting to use `imitate()` with a
  1615. * MemoryStream, you should rework your code around `imitate()` to use a
  1616. * Stream instead. Look for the stream in the circular dependency that
  1617. * represents an event stream, and that would be a candidate for creating a
  1618. * proxy Stream which then imitates the target Stream.
  1619. *
  1620. * @param {Stream} target The other stream to imitate on the current one. Must
  1621. * not be a MemoryStream.
  1622. */
  1623. Stream.prototype.imitate = function (target) {
  1624. if (target instanceof MemoryStream)
  1625. throw new Error('A MemoryStream was given to imitate(), but it only ' +
  1626. 'supports a Stream. Read more about this restriction here: ' +
  1627. 'https://github.com/staltz/xstream#faq');
  1628. this._target = target;
  1629. for (var ils = this._ils, N = ils.length, i = 0; i < N; i++)
  1630. target._add(ils[i]);
  1631. this._ils = [];
  1632. };
  1633. /**
  1634. * Forces the Stream to emit the given value to its listeners.
  1635. *
  1636. * As the name indicates, if you use this, you are most likely doing something
  1637. * The Wrong Way. Please try to understand the reactive way before using this
  1638. * method. Use it only when you know what you are doing.
  1639. *
  1640. * @param value The "next" value you want to broadcast to all listeners of
  1641. * this Stream.
  1642. */
  1643. Stream.prototype.shamefullySendNext = function (value) {
  1644. this._n(value);
  1645. };
  1646. /**
  1647. * Forces the Stream to emit the given error to its listeners.
  1648. *
  1649. * As the name indicates, if you use this, you are most likely doing something
  1650. * The Wrong Way. Please try to understand the reactive way before using this
  1651. * method. Use it only when you know what you are doing.
  1652. *
  1653. * @param {any} error The error you want to broadcast to all the listeners of
  1654. * this Stream.
  1655. */
  1656. Stream.prototype.shamefullySendError = function (error) {
  1657. this._e(error);
  1658. };
  1659. /**
  1660. * Forces the Stream to emit the "completed" event to its listeners.
  1661. *
  1662. * As the name indicates, if you use this, you are most likely doing something
  1663. * The Wrong Way. Please try to understand the reactive way before using this
  1664. * method. Use it only when you know what you are doing.
  1665. */
  1666. Stream.prototype.shamefullySendComplete = function () {
  1667. this._c();
  1668. };
  1669. /**
  1670. * Adds a "debug" listener to the stream. There can only be one debug
  1671. * listener, that's why this is 'setDebugListener'. To remove the debug
  1672. * listener, just call setDebugListener(null).
  1673. *
  1674. * A debug listener is like any other listener. The only difference is that a
  1675. * debug listener is "stealthy": its presence/absence does not trigger the
  1676. * start/stop of the stream (or the producer inside the stream). This is
  1677. * useful so you can inspect what is going on without changing the behavior
  1678. * of the program. If you have an idle stream and you add a normal listener to
  1679. * it, the stream will start executing. But if you set a debug listener on an
  1680. * idle stream, it won't start executing (not until the first normal listener
  1681. * is added).
  1682. *
  1683. * As the name indicates, we don't recommend using this method to build app
  1684. * logic. In fact, in most cases the debug operator works just fine. Only use
  1685. * this one if you know what you're doing.
  1686. *
  1687. * @param {Listener<T>} listener
  1688. */
  1689. Stream.prototype.setDebugListener = function (listener) {
  1690. if (!listener) {
  1691. this._d = false;
  1692. this._dl = NO;
  1693. }
  1694. else {
  1695. this._d = true;
  1696. listener._n = listener.next || noop;
  1697. listener._e = listener.error || noop;
  1698. listener._c = listener.complete || noop;
  1699. this._dl = listener;
  1700. }
  1701. };
  1702. return Stream;
  1703. }());
  1704. /**
  1705. * Blends multiple streams together, emitting events from all of them
  1706. * concurrently.
  1707. *
  1708. * *merge* takes multiple streams as arguments, and creates a stream that
  1709. * behaves like each of the argument streams, in parallel.
  1710. *
  1711. * Marble diagram:
  1712. *
  1713. * ```text
  1714. * --1----2-----3--------4---
  1715. * ----a-----b----c---d------
  1716. * merge
  1717. * --1-a--2--b--3-c---d--4---
  1718. * ```
  1719. *
  1720. * @factory true
  1721. * @param {Stream} stream1 A stream to merge together with other streams.
  1722. * @param {Stream} stream2 A stream to merge together with other streams. Two
  1723. * or more streams may be given as arguments.
  1724. * @return {Stream}
  1725. */
  1726. Stream.merge = function merge() {
  1727. var streams = [];
  1728. for (var _i = 0; _i < arguments.length; _i++) {
  1729. streams[_i] = arguments[_i];
  1730. }
  1731. return new Stream(new Merge(streams));
  1732. };
  1733. /**
  1734. * Combines multiple input streams together to return a stream whose events
  1735. * are arrays that collect the latest events from each input stream.
  1736. *
  1737. * *combine* internally remembers the most recent event from each of the input
  1738. * streams. When any of the input streams emits an event, that event together
  1739. * with all the other saved events are combined into an array. That array will
  1740. * be emitted on the output stream. It's essentially a way of joining together
  1741. * the events from multiple streams.
  1742. *
  1743. * Marble diagram:
  1744. *
  1745. * ```text
  1746. * --1----2-----3--------4---
  1747. * ----a-----b-----c--d------
  1748. * combine
  1749. * ----1a-2a-2b-3b-3c-3d-4d--
  1750. * ```
  1751. *
  1752. * Note: to minimize garbage collection, *combine* uses the same array
  1753. * instance for each emission. If you need to compare emissions over time,
  1754. * cache the values with `map` first:
  1755. *
  1756. * ```js
  1757. * import pairwise from 'xstream/extra/pairwise'
  1758. *
  1759. * const stream1 = xs.of(1);
  1760. * const stream2 = xs.of(2);
  1761. *
  1762. * xs.combine(stream1, stream2).map(
  1763. * combinedEmissions => ([ ...combinedEmissions ])
  1764. * ).compose(pairwise)
  1765. * ```
  1766. *
  1767. * @factory true
  1768. * @param {Stream} stream1 A stream to combine together with other streams.
  1769. * @param {Stream} stream2 A stream to combine together with other streams.
  1770. * Multiple streams, not just two, may be given as arguments.
  1771. * @return {Stream}
  1772. */
  1773. Stream.combine = function combine() {
  1774. var streams = [];
  1775. for (var _i = 0; _i < arguments.length; _i++) {
  1776. streams[_i] = arguments[_i];
  1777. }
  1778. return new Stream(new Combine(streams));
  1779. };
  1780. exports.Stream = Stream;
  1781. var MemoryStream = (function (_super) {
  1782. __extends(MemoryStream, _super);
  1783. function MemoryStream(producer) {
  1784. var _this = _super.call(this, producer) || this;
  1785. _this._has = false;
  1786. return _this;
  1787. }
  1788. MemoryStream.prototype._n = function (x) {
  1789. this._v = x;
  1790. this._has = true;
  1791. _super.prototype._n.call(this, x);
  1792. };
  1793. MemoryStream.prototype._add = function (il) {
  1794. var ta = this._target;
  1795. if (ta !== NO)
  1796. return ta._add(il);
  1797. var a = this._ils;
  1798. a.push(il);
  1799. if (a.length > 1) {
  1800. if (this._has)
  1801. il._n(this._v);
  1802. return;
  1803. }
  1804. if (this._stopID !== NO) {
  1805. if (this._has)
  1806. il._n(this._v);
  1807. clearTimeout(this._stopID);
  1808. this._stopID = NO;
  1809. }
  1810. else if (this._has)
  1811. il._n(this._v);
  1812. else {
  1813. var p = this._prod;
  1814. if (p !== NO)
  1815. p._start(this);
  1816. }
  1817. };
  1818. MemoryStream.prototype._stopNow = function () {
  1819. this._has = false;
  1820. _super.prototype._stopNow.call(this);
  1821. };
  1822. MemoryStream.prototype._x = function () {
  1823. this._has = false;
  1824. _super.prototype._x.call(this);
  1825. };
  1826. MemoryStream.prototype.map = function (project) {
  1827. return this._map(project);
  1828. };
  1829. MemoryStream.prototype.mapTo = function (projectedValue) {
  1830. return _super.prototype.mapTo.call(this, projectedValue);
  1831. };
  1832. MemoryStream.prototype.take = function (amount) {
  1833. return _super.prototype.take.call(this, amount);
  1834. };
  1835. MemoryStream.prototype.endWhen = function (other) {
  1836. return _super.prototype.endWhen.call(this, other);
  1837. };
  1838. MemoryStream.prototype.replaceError = function (replace) {
  1839. return _super.prototype.replaceError.call(this, replace);
  1840. };
  1841. MemoryStream.prototype.remember = function () {
  1842. return this;
  1843. };
  1844. MemoryStream.prototype.debug = function (labelOrSpy) {
  1845. return _super.prototype.debug.call(this, labelOrSpy);
  1846. };
  1847. return MemoryStream;
  1848. }(Stream));
  1849. exports.MemoryStream = MemoryStream;
  1850. Object.defineProperty(exports, "__esModule", { value: true });
  1851. exports.default = Stream;
  1852. //# sourceMappingURL=index.js.map
  1853.  
  1854. /***/ }),
  1855. /* 3 */
  1856. /***/ (function(module, exports, __webpack_require__) {
  1857.  
  1858. "use strict";
  1859.  
  1860.  
  1861. var assign = __webpack_require__(14)
  1862. , normalizeOpts = __webpack_require__(28)
  1863. , isCallable = __webpack_require__(75)
  1864. , contains = __webpack_require__(29)
  1865.  
  1866. , d;
  1867.  
  1868. d = module.exports = function (dscr, value/*, options*/) {
  1869. var c, e, w, options, desc;
  1870. if ((arguments.length < 2) || (typeof dscr !== 'string')) {
  1871. options = value;
  1872. value = dscr;
  1873. dscr = null;
  1874. } else {
  1875. options = arguments[2];
  1876. }
  1877. if (dscr == null) {
  1878. c = w = true;
  1879. e = false;
  1880. } else {
  1881. c = contains.call(dscr, 'c');
  1882. e = contains.call(dscr, 'e');
  1883. w = contains.call(dscr, 'w');
  1884. }
  1885.  
  1886. desc = { value: value, configurable: c, enumerable: e, writable: w };
  1887. return !options ? desc : assign(normalizeOpts(options), desc);
  1888. };
  1889.  
  1890. d.gs = function (dscr, get, set/*, options*/) {
  1891. var c, e, options, desc;
  1892. if (typeof dscr !== 'string') {
  1893. options = set;
  1894. set = get;
  1895. get = dscr;
  1896. dscr = null;
  1897. } else {
  1898. options = arguments[3];
  1899. }
  1900. if (get == null) {
  1901. get = undefined;
  1902. } else if (!isCallable(get)) {
  1903. options = get;
  1904. get = set = undefined;
  1905. } else if (set == null) {
  1906. set = undefined;
  1907. } else if (!isCallable(set)) {
  1908. options = set;
  1909. set = undefined;
  1910. }
  1911. if (dscr == null) {
  1912. c = true;
  1913. e = false;
  1914. } else {
  1915. c = contains.call(dscr, 'c');
  1916. e = contains.call(dscr, 'e');
  1917. }
  1918.  
  1919. desc = { get: get, set: set, configurable: c, enumerable: e };
  1920. return !options ? desc : assign(normalizeOpts(options), desc);
  1921. };
  1922.  
  1923.  
  1924. /***/ }),
  1925. /* 4 */
  1926. /***/ (function(module, exports, __webpack_require__) {
  1927.  
  1928. "use strict";
  1929.  
  1930. Object.defineProperty(exports, "__esModule", { value: true });
  1931. var vnode_1 = __webpack_require__(9);
  1932. var is = __webpack_require__(16);
  1933. function addNS(data, children, sel) {
  1934. data.ns = 'http://www.w3.org/2000/svg';
  1935. if (sel !== 'foreignObject' && children !== undefined) {
  1936. for (var i = 0; i < children.length; ++i) {
  1937. var childData = children[i].data;
  1938. if (childData !== undefined) {
  1939. addNS(childData, children[i].children, children[i].sel);
  1940. }
  1941. }
  1942. }
  1943. }
  1944. function h(sel, b, c) {
  1945. var data = {}, children, text, i;
  1946. if (c !== undefined) {
  1947. data = b;
  1948. if (is.array(c)) {
  1949. children = c;
  1950. }
  1951. else if (is.primitive(c)) {
  1952. text = c;
  1953. }
  1954. else if (c && c.sel) {
  1955. children = [c];
  1956. }
  1957. }
  1958. else if (b !== undefined) {
  1959. if (is.array(b)) {
  1960. children = b;
  1961. }
  1962. else if (is.primitive(b)) {
  1963. text = b;
  1964. }
  1965. else if (b && b.sel) {
  1966. children = [b];
  1967. }
  1968. else {
  1969. data = b;
  1970. }
  1971. }
  1972. if (is.array(children)) {
  1973. for (i = 0; i < children.length; ++i) {
  1974. if (is.primitive(children[i]))
  1975. children[i] = vnode_1.vnode(undefined, undefined, undefined, children[i]);
  1976. }
  1977. }
  1978. if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g' &&
  1979. (sel.length === 3 || sel[3] === '.' || sel[3] === '#')) {
  1980. addNS(data, children, sel);
  1981. }
  1982. return vnode_1.vnode(sel, data, children, text, undefined);
  1983. }
  1984. exports.h = h;
  1985. ;
  1986. exports.default = h;
  1987. //# sourceMappingURL=h.js.map
  1988.  
  1989. /***/ }),
  1990. /* 5 */
  1991. /***/ (function(module, exports, __webpack_require__) {
  1992.  
  1993. "use strict";
  1994.  
  1995.  
  1996. module.exports = __webpack_require__(79)() ? Symbol : __webpack_require__(80);
  1997.  
  1998.  
  1999. /***/ }),
  2000. /* 6 */
  2001. /***/ (function(module, exports, __webpack_require__) {
  2002.  
  2003. "use strict";
  2004.  
  2005. Object.defineProperty(exports, "__esModule", { value: true });
  2006. var adaptStream = function (x) { return x; };
  2007. function setAdapt(f) {
  2008. adaptStream = f;
  2009. }
  2010. exports.setAdapt = setAdapt;
  2011. function adapt(stream) {
  2012. return adaptStream(stream);
  2013. }
  2014. exports.adapt = adapt;
  2015. //# sourceMappingURL=adapt.js.map
  2016.  
  2017. /***/ }),
  2018. /* 7 */
  2019. /***/ (function(module, exports, __webpack_require__) {
  2020.  
  2021. "use strict";
  2022.  
  2023. Object.defineProperty(exports, "__esModule", { value: true });
  2024. function isElement(obj) {
  2025. var ELEM_TYPE = 1;
  2026. var FRAG_TYPE = 11;
  2027. return typeof HTMLElement === 'object'
  2028. ? obj instanceof HTMLElement || obj instanceof DocumentFragment
  2029. : obj &&
  2030. typeof obj === 'object' &&
  2031. obj !== null &&
  2032. (obj.nodeType === ELEM_TYPE || obj.nodeType === FRAG_TYPE) &&
  2033. typeof obj.nodeName === 'string';
  2034. }
  2035. function isClassOrId(str) {
  2036. return str.length > 1 && (str[0] === '.' || str[0] === '#');
  2037. }
  2038. exports.isClassOrId = isClassOrId;
  2039. exports.SCOPE_PREFIX = '$$CYCLEDOM$$-';
  2040. function getElement(selectors) {
  2041. var domElement = typeof selectors === 'string'
  2042. ? document.querySelector(selectors)
  2043. : selectors;
  2044. if (typeof selectors === 'string' && domElement === null) {
  2045. throw new Error("Cannot render into unknown element `" + selectors + "`");
  2046. }
  2047. else if (!isElement(domElement)) {
  2048. throw new Error('Given container is not a DOM element neither a ' + 'selector string.');
  2049. }
  2050. return domElement;
  2051. }
  2052. exports.getElement = getElement;
  2053. /**
  2054. * The full scope of a namespace is the "absolute path" of scopes from
  2055. * parent to child. This is extracted from the namespace, filter only for
  2056. * scopes in the namespace.
  2057. */
  2058. function getFullScope(namespace) {
  2059. return namespace
  2060. .filter(function (c) { return c.indexOf(exports.SCOPE_PREFIX) > -1; })
  2061. .map(function (c) { return c.replace(exports.SCOPE_PREFIX, ''); })
  2062. .join('-');
  2063. }
  2064. exports.getFullScope = getFullScope;
  2065. function getSelectors(namespace) {
  2066. return namespace.filter(function (c) { return c.indexOf(exports.SCOPE_PREFIX) === -1; }).join(' ');
  2067. }
  2068. exports.getSelectors = getSelectors;
  2069. //# sourceMappingURL=utils.js.map
  2070.  
  2071. /***/ }),
  2072. /* 8 */
  2073. /***/ (function(module, exports, __webpack_require__) {
  2074.  
  2075. "use strict";
  2076.  
  2077.  
  2078. var _undefined = __webpack_require__(24)(); // Support ES3 engines
  2079.  
  2080. module.exports = function (val) {
  2081. return (val !== _undefined) && (val !== null);
  2082. };
  2083.  
  2084.  
  2085. /***/ }),
  2086. /* 9 */
  2087. /***/ (function(module, exports, __webpack_require__) {
  2088.  
  2089. "use strict";
  2090.  
  2091. Object.defineProperty(exports, "__esModule", { value: true });
  2092. function vnode(sel, data, children, text, elm) {
  2093. var key = data === undefined ? undefined : data.key;
  2094. return { sel: sel, data: data, children: children,
  2095. text: text, elm: elm, key: key };
  2096. }
  2097. exports.vnode = vnode;
  2098. exports.default = vnode;
  2099. //# sourceMappingURL=vnode.js.map
  2100.  
  2101. /***/ }),
  2102. /* 10 */
  2103. /***/ (function(module, exports, __webpack_require__) {
  2104.  
  2105. "use strict";
  2106.  
  2107.  
  2108. module.exports = __webpack_require__(26)()
  2109. ? Object.setPrototypeOf
  2110. : __webpack_require__(27);
  2111.  
  2112.  
  2113. /***/ }),
  2114. /* 11 */
  2115. /***/ (function(module, exports, __webpack_require__) {
  2116.  
  2117. "use strict";
  2118.  
  2119.  
  2120. var objToString = Object.prototype.toString
  2121. , id = objToString.call(
  2122. (function () {
  2123. return arguments;
  2124. })()
  2125. );
  2126.  
  2127. module.exports = function (value) {
  2128. return objToString.call(value) === id;
  2129. };
  2130.  
  2131.  
  2132. /***/ }),
  2133. /* 12 */
  2134. /***/ (function(module, exports, __webpack_require__) {
  2135.  
  2136. "use strict";
  2137.  
  2138.  
  2139. var objToString = Object.prototype.toString, id = objToString.call("");
  2140.  
  2141. module.exports = function (value) {
  2142. return (
  2143. typeof value === "string" ||
  2144. (value &&
  2145. typeof value === "object" &&
  2146. (value instanceof String || objToString.call(value) === id)) ||
  2147. false
  2148. );
  2149. };
  2150.  
  2151.  
  2152. /***/ }),
  2153. /* 13 */
  2154. /***/ (function(module, exports, __webpack_require__) {
  2155.  
  2156. "use strict";
  2157.  
  2158. Object.defineProperty(exports, "__esModule", { value: true });
  2159. var xstream_1 = __webpack_require__(2);
  2160. function fromEvent(element, eventName, useCapture, preventDefault) {
  2161. if (useCapture === void 0) { useCapture = false; }
  2162. if (preventDefault === void 0) { preventDefault = false; }
  2163. return xstream_1.Stream.create({
  2164. element: element,
  2165. next: null,
  2166. start: function start(listener) {
  2167. if (preventDefault) {
  2168. this.next = function next(event) {
  2169. event.preventDefault();
  2170. listener.next(event);
  2171. };
  2172. }
  2173. else {
  2174. this.next = function next(event) {
  2175. listener.next(event);
  2176. };
  2177. }
  2178. this.element.addEventListener(eventName, this.next, useCapture);
  2179. },
  2180. stop: function stop() {
  2181. this.element.removeEventListener(eventName, this.next, useCapture);
  2182. },
  2183. });
  2184. }
  2185. exports.fromEvent = fromEvent;
  2186. //# sourceMappingURL=fromEvent.js.map
  2187.  
  2188. /***/ }),
  2189. /* 14 */
  2190. /***/ (function(module, exports, __webpack_require__) {
  2191.  
  2192. "use strict";
  2193.  
  2194.  
  2195. module.exports = __webpack_require__(70)()
  2196. ? Object.assign
  2197. : __webpack_require__(71);
  2198.  
  2199.  
  2200. /***/ }),
  2201. /* 15 */
  2202. /***/ (function(module, exports, __webpack_require__) {
  2203.  
  2204. "use strict";
  2205.  
  2206.  
  2207. var clear = __webpack_require__(23)
  2208. , assign = __webpack_require__(14)
  2209. , callable = __webpack_require__(1)
  2210. , value = __webpack_require__(0)
  2211. , d = __webpack_require__(3)
  2212. , autoBind = __webpack_require__(87)
  2213. , Symbol = __webpack_require__(5)
  2214.  
  2215. , defineProperty = Object.defineProperty
  2216. , defineProperties = Object.defineProperties
  2217. , Iterator;
  2218.  
  2219. module.exports = Iterator = function (list, context) {
  2220. if (!(this instanceof Iterator)) return new Iterator(list, context);
  2221. defineProperties(this, {
  2222. __list__: d('w', value(list)),
  2223. __context__: d('w', context),
  2224. __nextIndex__: d('w', 0)
  2225. });
  2226. if (!context) return;
  2227. callable(context.on);
  2228. context.on('_add', this._onAdd);
  2229. context.on('_delete', this._onDelete);
  2230. context.on('_clear', this._onClear);
  2231. };
  2232.  
  2233. defineProperties(Iterator.prototype, assign({
  2234. constructor: d(Iterator),
  2235. _next: d(function () {
  2236. var i;
  2237. if (!this.__list__) return;
  2238. if (this.__redo__) {
  2239. i = this.__redo__.shift();
  2240. if (i !== undefined) return i;
  2241. }
  2242. if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
  2243. this._unBind();
  2244. }),
  2245. next: d(function () { return this._createResult(this._next()); }),
  2246. _createResult: d(function (i) {
  2247. if (i === undefined) return { done: true, value: undefined };
  2248. return { done: false, value: this._resolve(i) };
  2249. }),
  2250. _resolve: d(function (i) { return this.__list__[i]; }),
  2251. _unBind: d(function () {
  2252. this.__list__ = null;
  2253. delete this.__redo__;
  2254. if (!this.__context__) return;
  2255. this.__context__.off('_add', this._onAdd);
  2256. this.__context__.off('_delete', this._onDelete);
  2257. this.__context__.off('_clear', this._onClear);
  2258. this.__context__ = null;
  2259. }),
  2260. toString: d(function () { return '[object Iterator]'; })
  2261. }, autoBind({
  2262. _onAdd: d(function (index) {
  2263. if (index >= this.__nextIndex__) return;
  2264. ++this.__nextIndex__;
  2265. if (!this.__redo__) {
  2266. defineProperty(this, '__redo__', d('c', [index]));
  2267. return;
  2268. }
  2269. this.__redo__.forEach(function (redo, i) {
  2270. if (redo >= index) this.__redo__[i] = ++redo;
  2271. }, this);
  2272. this.__redo__.push(index);
  2273. }),
  2274. _onDelete: d(function (index) {
  2275. var i;
  2276. if (index >= this.__nextIndex__) return;
  2277. --this.__nextIndex__;
  2278. if (!this.__redo__) return;
  2279. i = this.__redo__.indexOf(index);
  2280. if (i !== -1) this.__redo__.splice(i, 1);
  2281. this.__redo__.forEach(function (redo, i) {
  2282. if (redo > index) this.__redo__[i] = --redo;
  2283. }, this);
  2284. }),
  2285. _onClear: d(function () {
  2286. if (this.__redo__) clear.call(this.__redo__);
  2287. this.__nextIndex__ = 0;
  2288. })
  2289. })));
  2290.  
  2291. defineProperty(Iterator.prototype, Symbol.iterator, d(function () {
  2292. return this;
  2293. }));
  2294. defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator'));
  2295.  
  2296.  
  2297. /***/ }),
  2298. /* 16 */
  2299. /***/ (function(module, exports, __webpack_require__) {
  2300.  
  2301. "use strict";
  2302.  
  2303. Object.defineProperty(exports, "__esModule", { value: true });
  2304. exports.array = Array.isArray;
  2305. function primitive(s) {
  2306. return typeof s === 'string' || typeof s === 'number';
  2307. }
  2308. exports.primitive = primitive;
  2309. //# sourceMappingURL=is.js.map
  2310.  
  2311. /***/ }),
  2312. /* 17 */
  2313. /***/ (function(module, exports, __webpack_require__) {
  2314.  
  2315. "use strict";
  2316.  
  2317. Object.defineProperty(exports, "__esModule", { value: true });
  2318. var adapt_1 = __webpack_require__(6);
  2319. var DocumentDOMSource_1 = __webpack_require__(40);
  2320. var BodyDOMSource_1 = __webpack_require__(41);
  2321. var ElementFinder_1 = __webpack_require__(42);
  2322. var fromEvent_1 = __webpack_require__(13);
  2323. var isolate_1 = __webpack_require__(43);
  2324. var EventDelegator_1 = __webpack_require__(44);
  2325. var utils_1 = __webpack_require__(7);
  2326. var eventTypesThatDontBubble = [
  2327. "blur",
  2328. "canplay",
  2329. "canplaythrough",
  2330. "change",
  2331. "durationchange",
  2332. "emptied",
  2333. "ended",
  2334. "focus",
  2335. "load",
  2336. "loadeddata",
  2337. "loadedmetadata",
  2338. "mouseenter",
  2339. "mouseleave",
  2340. "pause",
  2341. "play",
  2342. "playing",
  2343. "ratechange",
  2344. "reset",
  2345. "scroll",
  2346. "seeked",
  2347. "seeking",
  2348. "stalled",
  2349. "submit",
  2350. "suspend",
  2351. "timeupdate",
  2352. "unload",
  2353. "volumechange",
  2354. "waiting",
  2355. ];
  2356. function determineUseCapture(eventType, options) {
  2357. var result = false;
  2358. if (typeof options.useCapture === 'boolean') {
  2359. result = options.useCapture;
  2360. }
  2361. if (eventTypesThatDontBubble.indexOf(eventType) !== -1) {
  2362. result = true;
  2363. }
  2364. return result;
  2365. }
  2366. function filterBasedOnIsolation(domSource, fullScope) {
  2367. return function filterBasedOnIsolationOperator(rootElement$) {
  2368. var initialState = {
  2369. wasIsolated: false,
  2370. shouldPass: false,
  2371. element: null,
  2372. };
  2373. return rootElement$
  2374. .fold(function checkIfShouldPass(state, element) {
  2375. var isIsolated = !!domSource._isolateModule.getElement(fullScope);
  2376. state.shouldPass = isIsolated && !state.wasIsolated;
  2377. state.wasIsolated = isIsolated;
  2378. state.element = element;
  2379. return state;
  2380. }, initialState)
  2381. .drop(1)
  2382. .filter(function (s) { return s.shouldPass; })
  2383. .map(function (s) { return s.element; });
  2384. };
  2385. }
  2386. var MainDOMSource = (function () {
  2387. function MainDOMSource(_rootElement$, _sanitation$, _namespace, _isolateModule, _delegators, _name) {
  2388. if (_namespace === void 0) { _namespace = []; }
  2389. var _this = this;
  2390. this._rootElement$ = _rootElement$;
  2391. this._sanitation$ = _sanitation$;
  2392. this._namespace = _namespace;
  2393. this._isolateModule = _isolateModule;
  2394. this._delegators = _delegators;
  2395. this._name = _name;
  2396. this.isolateSource = isolate_1.isolateSource;
  2397. this.isolateSink = function (sink, scope) {
  2398. if (scope === ':root') {
  2399. return sink;
  2400. }
  2401. else if (utils_1.isClassOrId(scope)) {
  2402. return isolate_1.siblingIsolateSink(sink, scope);
  2403. }
  2404. else {
  2405. var prevFullScope = utils_1.getFullScope(_this._namespace);
  2406. var nextFullScope = [prevFullScope, scope].filter(function (x) { return !!x; }).join('-');
  2407. return isolate_1.totalIsolateSink(sink, nextFullScope);
  2408. }
  2409. };
  2410. }
  2411. MainDOMSource.prototype.elements = function () {
  2412. var output$;
  2413. if (this._namespace.length === 0) {
  2414. output$ = this._rootElement$;
  2415. }
  2416. else {
  2417. var elementFinder_1 = new ElementFinder_1.ElementFinder(this._namespace, this._isolateModule);
  2418. output$ = this._rootElement$.map(function (el) { return elementFinder_1.call(el); });
  2419. }
  2420. var out = adapt_1.adapt(output$.remember());
  2421. out._isCycleSource = this._name;
  2422. return out;
  2423. };
  2424. Object.defineProperty(MainDOMSource.prototype, "namespace", {
  2425. get: function () {
  2426. return this._namespace;
  2427. },
  2428. enumerable: true,
  2429. configurable: true
  2430. });
  2431. MainDOMSource.prototype.select = function (selector) {
  2432. if (typeof selector !== 'string') {
  2433. throw new Error("DOM driver's select() expects the argument to be a " +
  2434. "string as a CSS selector");
  2435. }
  2436. if (selector === 'document') {
  2437. return new DocumentDOMSource_1.DocumentDOMSource(this._name);
  2438. }
  2439. if (selector === 'body') {
  2440. return new BodyDOMSource_1.BodyDOMSource(this._name);
  2441. }
  2442. var trimmedSelector = selector.trim();
  2443. var childNamespace = trimmedSelector === ":root"
  2444. ? this._namespace
  2445. : this._namespace.concat(trimmedSelector);
  2446. return new MainDOMSource(this._rootElement$, this._sanitation$, childNamespace, this._isolateModule, this._delegators, this._name);
  2447. };
  2448. MainDOMSource.prototype.events = function (eventType, options) {
  2449. if (options === void 0) { options = {}; }
  2450. if (typeof eventType !== "string") {
  2451. throw new Error("DOM driver's events() expects argument to be a " +
  2452. "string representing the event type to listen for.");
  2453. }
  2454. var useCapture = determineUseCapture(eventType, options);
  2455. var namespace = this._namespace;
  2456. var fullScope = utils_1.getFullScope(namespace);
  2457. var keyParts = [eventType, useCapture];
  2458. if (fullScope) {
  2459. keyParts.push(fullScope);
  2460. }
  2461. var key = keyParts.join('~');
  2462. var domSource = this;
  2463. var rootElement$;
  2464. if (fullScope) {
  2465. rootElement$ = this._rootElement$.compose(filterBasedOnIsolation(domSource, fullScope));
  2466. }
  2467. else {
  2468. rootElement$ = this._rootElement$.take(2);
  2469. }
  2470. var event$ = rootElement$
  2471. .map(function setupEventDelegatorOnTopElement(rootElement) {
  2472. // Event listener just for the root element
  2473. if (!namespace || namespace.length === 0) {
  2474. return fromEvent_1.fromEvent(rootElement, eventType, useCapture, options.preventDefault);
  2475. }
  2476. // Event listener on the origin element as an EventDelegator
  2477. var delegators = domSource._delegators;
  2478. var origin = domSource._isolateModule.getElement(fullScope) || rootElement;
  2479. var delegator;
  2480. if (delegators.has(key)) {
  2481. delegator = delegators.get(key);
  2482. delegator.updateOrigin(origin);
  2483. }
  2484. else {
  2485. delegator = new EventDelegator_1.EventDelegator(origin, eventType, useCapture, domSource._isolateModule, options.preventDefault);
  2486. delegators.set(key, delegator);
  2487. }
  2488. if (fullScope) {
  2489. domSource._isolateModule.addEventDelegator(fullScope, delegator);
  2490. }
  2491. var subject = delegator.createDestination(namespace);
  2492. return subject;
  2493. })
  2494. .flatten();
  2495. var out = adapt_1.adapt(event$);
  2496. out._isCycleSource = domSource._name;
  2497. return out;
  2498. };
  2499. MainDOMSource.prototype.dispose = function () {
  2500. this._sanitation$.shamefullySendNext(null);
  2501. this._isolateModule.reset();
  2502. };
  2503. return MainDOMSource;
  2504. }());
  2505. exports.MainDOMSource = MainDOMSource;
  2506. //# sourceMappingURL=MainDOMSource.js.map
  2507.  
  2508. /***/ }),
  2509. /* 18 */
  2510. /***/ (function(module, exports, __webpack_require__) {
  2511.  
  2512. "use strict";
  2513.  
  2514. Object.defineProperty(exports, "__esModule", { value: true });
  2515. var ScopeChecker = (function () {
  2516. function ScopeChecker(fullScope, isolateModule) {
  2517. this.fullScope = fullScope;
  2518. this.isolateModule = isolateModule;
  2519. }
  2520. /**
  2521. * Checks whether the given element is *directly* in the scope of this
  2522. * scope checker. Being contained *indirectly* through other scopes
  2523. * is not valid. This is crucial for implementing parent-child isolation,
  2524. * so that the parent selectors don't search inside a child scope.
  2525. */
  2526. ScopeChecker.prototype.isDirectlyInScope = function (leaf) {
  2527. for (var el = leaf; el; el = el.parentElement) {
  2528. var fullScope = this.isolateModule.getFullScope(el);
  2529. if (fullScope && fullScope !== this.fullScope) {
  2530. return false;
  2531. }
  2532. if (fullScope) {
  2533. return true;
  2534. }
  2535. }
  2536. return true;
  2537. };
  2538. return ScopeChecker;
  2539. }());
  2540. exports.ScopeChecker = ScopeChecker;
  2541. //# sourceMappingURL=ScopeChecker.js.map
  2542.  
  2543. /***/ }),
  2544. /* 19 */
  2545. /***/ (function(module, exports, __webpack_require__) {
  2546.  
  2547. "use strict";
  2548.  
  2549. Object.defineProperty(exports, "__esModule", { value: true });
  2550. function createMatchesSelector() {
  2551. var vendor;
  2552. try {
  2553. var proto = Element.prototype;
  2554. vendor =
  2555. proto.matches ||
  2556. proto.matchesSelector ||
  2557. proto.webkitMatchesSelector ||
  2558. proto.mozMatchesSelector ||
  2559. proto.msMatchesSelector ||
  2560. proto.oMatchesSelector;
  2561. }
  2562. catch (err) {
  2563. vendor = null;
  2564. }
  2565. return function match(elem, selector) {
  2566. if (selector.length === 0) {
  2567. return true;
  2568. }
  2569. if (vendor) {
  2570. return vendor.call(elem, selector);
  2571. }
  2572. var nodes = elem.parentNode.querySelectorAll(selector);
  2573. for (var i = 0; i < nodes.length; i++) {
  2574. if (nodes[i] === elem) {
  2575. return true;
  2576. }
  2577. }
  2578. return false;
  2579. };
  2580. }
  2581. exports.matchesSelector = createMatchesSelector();
  2582. //# sourceMappingURL=matchesSelector.js.map
  2583.  
  2584. /***/ }),
  2585. /* 20 */
  2586. /***/ (function(module, exports, __webpack_require__) {
  2587.  
  2588. "use strict";
  2589.  
  2590. Object.defineProperty(exports, "__esModule", { value: true });
  2591. function createElement(tagName) {
  2592. return document.createElement(tagName);
  2593. }
  2594. function createElementNS(namespaceURI, qualifiedName) {
  2595. return document.createElementNS(namespaceURI, qualifiedName);
  2596. }
  2597. function createTextNode(text) {
  2598. return document.createTextNode(text);
  2599. }
  2600. function createComment(text) {
  2601. return document.createComment(text);
  2602. }
  2603. function insertBefore(parentNode, newNode, referenceNode) {
  2604. parentNode.insertBefore(newNode, referenceNode);
  2605. }
  2606. function removeChild(node, child) {
  2607. node.removeChild(child);
  2608. }
  2609. function appendChild(node, child) {
  2610. node.appendChild(child);
  2611. }
  2612. function parentNode(node) {
  2613. return node.parentNode;
  2614. }
  2615. function nextSibling(node) {
  2616. return node.nextSibling;
  2617. }
  2618. function tagName(elm) {
  2619. return elm.tagName;
  2620. }
  2621. function setTextContent(node, text) {
  2622. node.textContent = text;
  2623. }
  2624. function getTextContent(node) {
  2625. return node.textContent;
  2626. }
  2627. function isElement(node) {
  2628. return node.nodeType === 1;
  2629. }
  2630. function isText(node) {
  2631. return node.nodeType === 3;
  2632. }
  2633. function isComment(node) {
  2634. return node.nodeType === 8;
  2635. }
  2636. exports.htmlDomApi = {
  2637. createElement: createElement,
  2638. createElementNS: createElementNS,
  2639. createTextNode: createTextNode,
  2640. createComment: createComment,
  2641. insertBefore: insertBefore,
  2642. removeChild: removeChild,
  2643. appendChild: appendChild,
  2644. parentNode: parentNode,
  2645. nextSibling: nextSibling,
  2646. tagName: tagName,
  2647. setTextContent: setTextContent,
  2648. getTextContent: getTextContent,
  2649. isElement: isElement,
  2650. isText: isText,
  2651. isComment: isComment,
  2652. };
  2653. exports.default = exports.htmlDomApi;
  2654. //# sourceMappingURL=htmldomapi.js.map
  2655.  
  2656. /***/ }),
  2657. /* 21 */
  2658. /***/ (function(module, exports, __webpack_require__) {
  2659.  
  2660. "use strict";
  2661.  
  2662. function selectorParser(node) {
  2663. if (!node.sel) {
  2664. return {
  2665. tagName: '',
  2666. id: '',
  2667. className: '',
  2668. };
  2669. }
  2670. var sel = node.sel;
  2671. var hashIdx = sel.indexOf('#');
  2672. var dotIdx = sel.indexOf('.', hashIdx);
  2673. var hash = hashIdx > 0 ? hashIdx : sel.length;
  2674. var dot = dotIdx > 0 ? dotIdx : sel.length;
  2675. var tagName = hashIdx !== -1 || dotIdx !== -1 ?
  2676. sel.slice(0, Math.min(hash, dot)) :
  2677. sel;
  2678. var id = hash < dot ? sel.slice(hash + 1, dot) : void 0;
  2679. var className = dotIdx > 0 ? sel.slice(dot + 1).replace(/\./g, ' ') : void 0;
  2680. return {
  2681. tagName: tagName,
  2682. id: id,
  2683. className: className,
  2684. };
  2685. }
  2686. exports.selectorParser = selectorParser;
  2687. //# sourceMappingURL=selectorParser.js.map
  2688.  
  2689. /***/ }),
  2690. /* 22 */
  2691. /***/ (function(module, exports, __webpack_require__) {
  2692.  
  2693. "use strict";
  2694.  
  2695.  
  2696. module.exports = __webpack_require__(58)() ? Map : __webpack_require__(59);
  2697.  
  2698.  
  2699. /***/ }),
  2700. /* 23 */
  2701. /***/ (function(module, exports, __webpack_require__) {
  2702.  
  2703. "use strict";
  2704. // Inspired by Google Closure:
  2705. // http://closure-library.googlecode.com/svn/docs/
  2706. // closure_goog_array_array.js.html#goog.array.clear
  2707.  
  2708.  
  2709.  
  2710. var value = __webpack_require__(0);
  2711.  
  2712. module.exports = function () {
  2713. value(this).length = 0;
  2714. return this;
  2715. };
  2716.  
  2717.  
  2718. /***/ }),
  2719. /* 24 */
  2720. /***/ (function(module, exports, __webpack_require__) {
  2721.  
  2722. "use strict";
  2723.  
  2724.  
  2725. // eslint-disable-next-line no-empty-function
  2726. module.exports = function () {};
  2727.  
  2728.  
  2729. /***/ }),
  2730. /* 25 */
  2731. /***/ (function(module, exports, __webpack_require__) {
  2732.  
  2733. "use strict";
  2734.  
  2735.  
  2736. var toInteger = __webpack_require__(64)
  2737.  
  2738. , max = Math.max;
  2739.  
  2740. module.exports = function (value) {
  2741. return max(0, toInteger(value));
  2742. };
  2743.  
  2744.  
  2745. /***/ }),
  2746. /* 26 */
  2747. /***/ (function(module, exports, __webpack_require__) {
  2748.  
  2749. "use strict";
  2750.  
  2751.  
  2752. var create = Object.create, getPrototypeOf = Object.getPrototypeOf, plainObject = {};
  2753.  
  2754. module.exports = function (/* CustomCreate*/) {
  2755. var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create;
  2756. if (typeof setPrototypeOf !== "function") return false;
  2757. return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;
  2758. };
  2759.  
  2760.  
  2761. /***/ }),
  2762. /* 27 */
  2763. /***/ (function(module, exports, __webpack_require__) {
  2764.  
  2765. "use strict";
  2766. /* eslint no-proto: "off" */
  2767.  
  2768. // Big thanks to @WebReflection for sorting this out
  2769. // https://gist.github.com/WebReflection/5593554
  2770.  
  2771.  
  2772.  
  2773. var isObject = __webpack_require__(68)
  2774. , value = __webpack_require__(0)
  2775. , objIsPrototypOf = Object.prototype.isPrototypeOf
  2776. , defineProperty = Object.defineProperty
  2777. , nullDesc = {
  2778. configurable: true,
  2779. enumerable: false,
  2780. writable: true,
  2781. value: undefined
  2782. }
  2783. , validate;
  2784.  
  2785. validate = function (obj, prototype) {
  2786. value(obj);
  2787. if (prototype === null || isObject(prototype)) return obj;
  2788. throw new TypeError("Prototype must be null or an object");
  2789. };
  2790.  
  2791. module.exports = (function (status) {
  2792. var fn, set;
  2793. if (!status) return null;
  2794. if (status.level === 2) {
  2795. if (status.set) {
  2796. set = status.set;
  2797. fn = function (obj, prototype) {
  2798. set.call(validate(obj, prototype), prototype);
  2799. return obj;
  2800. };
  2801. } else {
  2802. fn = function (obj, prototype) {
  2803. validate(obj, prototype).__proto__ = prototype;
  2804. return obj;
  2805. };
  2806. }
  2807. } else {
  2808. fn = function self (obj, prototype) {
  2809. var isNullBase;
  2810. validate(obj, prototype);
  2811. isNullBase = objIsPrototypOf.call(self.nullPolyfill, obj);
  2812. if (isNullBase) delete self.nullPolyfill.__proto__;
  2813. if (prototype === null) prototype = self.nullPolyfill;
  2814. obj.__proto__ = prototype;
  2815. if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc);
  2816. return obj;
  2817. };
  2818. }
  2819. return Object.defineProperty(fn, "level", {
  2820. configurable: false,
  2821. enumerable: false,
  2822. writable: false,
  2823. value: status.level
  2824. });
  2825. }(
  2826. (function () {
  2827. var tmpObj1 = Object.create(null)
  2828. , tmpObj2 = {}
  2829. , set
  2830. , desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
  2831.  
  2832. if (desc) {
  2833. try {
  2834. set = desc.set; // Opera crashes at this point
  2835. set.call(tmpObj1, tmpObj2);
  2836. } catch (ignore) {}
  2837. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { set: set, level: 2 };
  2838. }
  2839.  
  2840. tmpObj1.__proto__ = tmpObj2;
  2841. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 2 };
  2842.  
  2843. tmpObj1 = {};
  2844. tmpObj1.__proto__ = tmpObj2;
  2845. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return { level: 1 };
  2846.  
  2847. return false;
  2848. })()
  2849. ));
  2850.  
  2851. __webpack_require__(69);
  2852.  
  2853.  
  2854. /***/ }),
  2855. /* 28 */
  2856. /***/ (function(module, exports, __webpack_require__) {
  2857.  
  2858. "use strict";
  2859.  
  2860.  
  2861. var isValue = __webpack_require__(8);
  2862.  
  2863. var forEach = Array.prototype.forEach, create = Object.create;
  2864.  
  2865. var process = function (src, obj) {
  2866. var key;
  2867. for (key in src) obj[key] = src[key];
  2868. };
  2869.  
  2870. // eslint-disable-next-line no-unused-vars
  2871. module.exports = function (opts1 /*, …options*/) {
  2872. var result = create(null);
  2873. forEach.call(arguments, function (options) {
  2874. if (!isValue(options)) return;
  2875. process(Object(options), result);
  2876. });
  2877. return result;
  2878. };
  2879.  
  2880.  
  2881. /***/ }),
  2882. /* 29 */
  2883. /***/ (function(module, exports, __webpack_require__) {
  2884.  
  2885. "use strict";
  2886.  
  2887.  
  2888. module.exports = __webpack_require__(76)()
  2889. ? String.prototype.contains
  2890. : __webpack_require__(77);
  2891.  
  2892.  
  2893. /***/ }),
  2894. /* 30 */
  2895. /***/ (function(module, exports, __webpack_require__) {
  2896.  
  2897. "use strict";
  2898.  
  2899.  
  2900. var isIterable = __webpack_require__(83);
  2901.  
  2902. module.exports = function (value) {
  2903. if (!isIterable(value)) throw new TypeError(value + " is not iterable");
  2904. return value;
  2905. };
  2906.  
  2907.  
  2908. /***/ }),
  2909. /* 31 */
  2910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2911.  
  2912. "use strict";
  2913. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  2914. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cycle_run__ = __webpack_require__(32);
  2915. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cycle_run___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__cycle_run__);
  2916. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cycle_dom__ = __webpack_require__(38);
  2917. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cycle_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__cycle_dom__);
  2918.  
  2919.  
  2920. function main(sources) {
  2921. var add$ = sources.DOM
  2922. .select('.add')
  2923. .events('click')
  2924. .map(function (ev) { alert('hi'); return 1; });
  2925. var count$ = add$.fold(function (total, change) { return total + change; }, 0);
  2926. return {
  2927. DOM: count$.map(function (count) {
  2928. return Object(__WEBPACK_IMPORTED_MODULE_1__cycle_dom__["div"])('.counter', [
  2929. 'Count: ' + count,
  2930. Object(__WEBPACK_IMPORTED_MODULE_1__cycle_dom__["button"])('.add', 'Add')
  2931. ]);
  2932. })
  2933. };
  2934. }
  2935. var drivers = {
  2936. DOM: Object(__WEBPACK_IMPORTED_MODULE_1__cycle_dom__["makeDOMDriver"])('.app')
  2937. };
  2938. function runApp() {
  2939. Object(__WEBPACK_IMPORTED_MODULE_0__cycle_run__["run"])(main, {
  2940. DOM: Object(__WEBPACK_IMPORTED_MODULE_1__cycle_dom__["makeDOMDriver"])('#app')
  2941. });
  2942. }
  2943. //# sourceMappingURL=MyScript.js.map
  2944.  
  2945. /***/ }),
  2946. /* 32 */
  2947. /***/ (function(module, exports, __webpack_require__) {
  2948.  
  2949. "use strict";
  2950.  
  2951. Object.defineProperty(exports, "__esModule", { value: true });
  2952. var xstream_1 = __webpack_require__(2);
  2953. var adapt_1 = __webpack_require__(6);
  2954. function logToConsoleError(err) {
  2955. var target = err.stack || err;
  2956. if (console && console.error) {
  2957. console.error(target);
  2958. }
  2959. else if (console && console.log) {
  2960. console.log(target);
  2961. }
  2962. }
  2963. function makeSinkProxies(drivers) {
  2964. var sinkProxies = {};
  2965. for (var name_1 in drivers) {
  2966. if (drivers.hasOwnProperty(name_1)) {
  2967. sinkProxies[name_1] = xstream_1.default.createWithMemory();
  2968. }
  2969. }
  2970. return sinkProxies;
  2971. }
  2972. function callDrivers(drivers, sinkProxies) {
  2973. var sources = {};
  2974. for (var name_2 in drivers) {
  2975. if (drivers.hasOwnProperty(name_2)) {
  2976. sources[name_2] = drivers[name_2](sinkProxies[name_2], name_2);
  2977. if (sources[name_2] && typeof sources[name_2] === 'object') {
  2978. sources[name_2]._isCycleSource = name_2;
  2979. }
  2980. }
  2981. }
  2982. return sources;
  2983. }
  2984. // NOTE: this will mutate `sources`.
  2985. function adaptSources(sources) {
  2986. for (var name_3 in sources) {
  2987. if (sources.hasOwnProperty(name_3)
  2988. && sources[name_3]
  2989. && typeof sources[name_3]['shamefullySendNext'] === 'function') {
  2990. sources[name_3] = adapt_1.adapt(sources[name_3]);
  2991. }
  2992. }
  2993. return sources;
  2994. }
  2995. function replicateMany(sinks, sinkProxies) {
  2996. var sinkNames = Object.keys(sinks).filter(function (name) { return !!sinkProxies[name]; });
  2997. var buffers = {};
  2998. var replicators = {};
  2999. sinkNames.forEach(function (name) {
  3000. buffers[name] = { _n: [], _e: [] };
  3001. replicators[name] = {
  3002. next: function (x) { return buffers[name]._n.push(x); },
  3003. error: function (err) { return buffers[name]._e.push(err); },
  3004. complete: function () { },
  3005. };
  3006. });
  3007. var subscriptions = sinkNames
  3008. .map(function (name) { return xstream_1.default.fromObservable(sinks[name]).subscribe(replicators[name]); });
  3009. sinkNames.forEach(function (name) {
  3010. var listener = sinkProxies[name];
  3011. var next = function (x) { listener._n(x); };
  3012. var error = function (err) { logToConsoleError(err); listener._e(err); };
  3013. buffers[name]._n.forEach(next);
  3014. buffers[name]._e.forEach(error);
  3015. replicators[name].next = next;
  3016. replicators[name].error = error;
  3017. // because sink.subscribe(replicator) had mutated replicator to add
  3018. // _n, _e, _c, we must also update these:
  3019. replicators[name]._n = next;
  3020. replicators[name]._e = error;
  3021. });
  3022. buffers = null; // free up for GC
  3023. return function disposeReplication() {
  3024. subscriptions.forEach(function (s) { return s.unsubscribe(); });
  3025. sinkNames.forEach(function (name) { return sinkProxies[name]._c(); });
  3026. };
  3027. }
  3028. function disposeSources(sources) {
  3029. for (var k in sources) {
  3030. if (sources.hasOwnProperty(k) && sources[k] && sources[k].dispose) {
  3031. sources[k].dispose();
  3032. }
  3033. }
  3034. }
  3035. function isObjectEmpty(obj) {
  3036. return Object.keys(obj).length === 0;
  3037. }
  3038. /**
  3039. * A function that prepares the Cycle application to be executed. Takes a `main`
  3040. * function and prepares to circularly connects it to the given collection of
  3041. * driver functions. As an output, `setup()` returns an object with three
  3042. * properties: `sources`, `sinks` and `run`. Only when `run()` is called will
  3043. * the application actually execute. Refer to the documentation of `run()` for
  3044. * more details.
  3045. *
  3046. * **Example:**
  3047. * ```js
  3048. * import {setup} from '@cycle/run';
  3049. * const {sources, sinks, run} = setup(main, drivers);
  3050. * // ...
  3051. * const dispose = run(); // Executes the application
  3052. * // ...
  3053. * dispose();
  3054. * ```
  3055. *
  3056. * @param {Function} main a function that takes `sources` as input and outputs
  3057. * `sinks`.
  3058. * @param {Object} drivers an object where keys are driver names and values
  3059. * are driver functions.
  3060. * @return {Object} an object with three properties: `sources`, `sinks` and
  3061. * `run`. `sources` is the collection of driver sources, `sinks` is the
  3062. * collection of driver sinks, these can be used for debugging or testing. `run`
  3063. * is the function that once called will execute the application.
  3064. * @function setup
  3065. */
  3066. function setup(main, drivers) {
  3067. if (typeof main !== "function") {
  3068. throw new Error("First argument given to Cycle must be the 'main' " +
  3069. "function.");
  3070. }
  3071. if (typeof drivers !== "object" || drivers === null) {
  3072. throw new Error("Second argument given to Cycle must be an object " +
  3073. "with driver functions as properties.");
  3074. }
  3075. if (isObjectEmpty(drivers)) {
  3076. throw new Error("Second argument given to Cycle must be an object " +
  3077. "with at least one driver function declared as a property.");
  3078. }
  3079. var sinkProxies = makeSinkProxies(drivers);
  3080. var sources = callDrivers(drivers, sinkProxies);
  3081. var adaptedSources = adaptSources(sources);
  3082. var sinks = main(adaptedSources);
  3083. if (typeof window !== 'undefined') {
  3084. window.Cyclejs = window.Cyclejs || {};
  3085. window.Cyclejs.sinks = sinks;
  3086. }
  3087. function run() {
  3088. var disposeReplication = replicateMany(sinks, sinkProxies);
  3089. return function dispose() {
  3090. disposeSources(sources);
  3091. disposeReplication();
  3092. };
  3093. }
  3094. ;
  3095. return { sinks: sinks, sources: sources, run: run };
  3096. }
  3097. exports.setup = setup;
  3098. /**
  3099. * Takes a `main` function and circularly connects it to the given collection
  3100. * of driver functions.
  3101. *
  3102. * **Example:**
  3103. * ```js
  3104. * import run from '@cycle/run';
  3105. * const dispose = run(main, drivers);
  3106. * // ...
  3107. * dispose();
  3108. * ```
  3109. *
  3110. * The `main` function expects a collection of "source" streams (returned from
  3111. * drivers) as input, and should return a collection of "sink" streams (to be
  3112. * given to drivers). A "collection of streams" is a JavaScript object where
  3113. * keys match the driver names registered by the `drivers` object, and values
  3114. * are the streams. Refer to the documentation of each driver to see more
  3115. * details on what types of sources it outputs and sinks it receives.
  3116. *
  3117. * @param {Function} main a function that takes `sources` as input and outputs
  3118. * `sinks`.
  3119. * @param {Object} drivers an object where keys are driver names and values
  3120. * are driver functions.
  3121. * @return {Function} a dispose function, used to terminate the execution of the
  3122. * Cycle.js program, cleaning up resources used.
  3123. * @function run
  3124. */
  3125. function run(main, drivers) {
  3126. var _a = setup(main, drivers), run = _a.run, sinks = _a.sinks;
  3127. if (typeof window !== 'undefined' && window['CyclejsDevTool_startGraphSerializer']) {
  3128. window['CyclejsDevTool_startGraphSerializer'](sinks);
  3129. }
  3130. return run();
  3131. }
  3132. exports.run = run;
  3133. exports.default = run;
  3134. //# sourceMappingURL=index.js.map
  3135.  
  3136. /***/ }),
  3137. /* 33 */
  3138. /***/ (function(module, exports, __webpack_require__) {
  3139.  
  3140. module.exports = __webpack_require__(34);
  3141.  
  3142.  
  3143. /***/ }),
  3144. /* 34 */
  3145. /***/ (function(module, exports, __webpack_require__) {
  3146.  
  3147. "use strict";
  3148. /* WEBPACK VAR INJECTION */(function(global, module) {
  3149.  
  3150. Object.defineProperty(exports, "__esModule", {
  3151. value: true
  3152. });
  3153.  
  3154. var _ponyfill = __webpack_require__(37);
  3155.  
  3156. var _ponyfill2 = _interopRequireDefault(_ponyfill);
  3157.  
  3158. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  3159.  
  3160. var root; /* global window */
  3161.  
  3162.  
  3163. if (typeof self !== 'undefined') {
  3164. root = self;
  3165. } else if (typeof window !== 'undefined') {
  3166. root = window;
  3167. } else if (typeof global !== 'undefined') {
  3168. root = global;
  3169. } else if (true) {
  3170. root = module;
  3171. } else {
  3172. root = Function('return this')();
  3173. }
  3174.  
  3175. var result = (0, _ponyfill2['default'])(root);
  3176. exports['default'] = result;
  3177. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35), __webpack_require__(36)(module)))
  3178.  
  3179. /***/ }),
  3180. /* 35 */
  3181. /***/ (function(module, exports) {
  3182.  
  3183. var g;
  3184.  
  3185. // This works in non-strict mode
  3186. g = (function() {
  3187. return this;
  3188. })();
  3189.  
  3190. try {
  3191. // This works if eval is allowed (see CSP)
  3192. g = g || Function("return this")() || (1,eval)("this");
  3193. } catch(e) {
  3194. // This works if the window reference is available
  3195. if(typeof window === "object")
  3196. g = window;
  3197. }
  3198.  
  3199. // g can still be undefined, but nothing to do about it...
  3200. // We return undefined, instead of nothing here, so it's
  3201. // easier to handle this case. if(!global) { ...}
  3202.  
  3203. module.exports = g;
  3204.  
  3205.  
  3206. /***/ }),
  3207. /* 36 */
  3208. /***/ (function(module, exports) {
  3209.  
  3210. module.exports = function(module) {
  3211. if(!module.webpackPolyfill) {
  3212. module.deprecate = function() {};
  3213. module.paths = [];
  3214. // module.parent = undefined by default
  3215. if(!module.children) module.children = [];
  3216. Object.defineProperty(module, "loaded", {
  3217. enumerable: true,
  3218. get: function() {
  3219. return module.l;
  3220. }
  3221. });
  3222. Object.defineProperty(module, "id", {
  3223. enumerable: true,
  3224. get: function() {
  3225. return module.i;
  3226. }
  3227. });
  3228. module.webpackPolyfill = 1;
  3229. }
  3230. return module;
  3231. };
  3232.  
  3233.  
  3234. /***/ }),
  3235. /* 37 */
  3236. /***/ (function(module, exports, __webpack_require__) {
  3237.  
  3238. "use strict";
  3239.  
  3240.  
  3241. Object.defineProperty(exports, "__esModule", {
  3242. value: true
  3243. });
  3244. exports['default'] = symbolObservablePonyfill;
  3245. function symbolObservablePonyfill(root) {
  3246. var result;
  3247. var _Symbol = root.Symbol;
  3248.  
  3249. if (typeof _Symbol === 'function') {
  3250. if (_Symbol.observable) {
  3251. result = _Symbol.observable;
  3252. } else {
  3253. result = _Symbol('observable');
  3254. _Symbol.observable = result;
  3255. }
  3256. } else {
  3257. result = '@@observable';
  3258. }
  3259.  
  3260. return result;
  3261. };
  3262.  
  3263. /***/ }),
  3264. /* 38 */
  3265. /***/ (function(module, exports, __webpack_require__) {
  3266.  
  3267. "use strict";
  3268.  
  3269. Object.defineProperty(exports, "__esModule", { value: true });
  3270. var thunk_1 = __webpack_require__(39);
  3271. exports.thunk = thunk_1.thunk;
  3272. var MainDOMSource_1 = __webpack_require__(17);
  3273. exports.MainDOMSource = MainDOMSource_1.MainDOMSource;
  3274. /**
  3275. * A factory for the DOM driver function.
  3276. *
  3277. * Takes a `container` to define the target on the existing DOM which this
  3278. * driver will operate on, and an `options` object as the second argument. The
  3279. * input to this driver is a stream of virtual DOM objects, or in other words,
  3280. * Snabbdom "VNode" objects. The output of this driver is a "DOMSource": a
  3281. * collection of Observables queried with the methods `select()` and `events()`.
  3282. *
  3283. * `DOMSource.select(selector)` returns a new DOMSource with scope restricted to
  3284. * the element(s) that matches the CSS `selector` given.
  3285. *
  3286. * `DOMSource.events(eventType, options)` returns a stream of events of
  3287. * `eventType` happening on the elements that match the current DOMSource. The
  3288. * event object contains the `ownerTarget` property that behaves exactly like
  3289. * `currentTarget`. The reason for this is that some browsers doesn't allow
  3290. * `currentTarget` property to be mutated, hence a new property is created. The
  3291. * returned stream is an *xstream* Stream if you use `@cycle/xstream-run` to run
  3292. * your app with this driver, or it is an RxJS Observable if you use
  3293. * `@cycle/rxjs-run`, and so forth. The `options` parameter can have the
  3294. * property `useCapture`, which is by default `false`, except it is `true` for
  3295. * event types that do not bubble. Read more here
  3296. * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  3297. * about the `useCapture` and its purpose.
  3298. * The other option is `preventDefault` that is set to false by default.
  3299. * If set to true, the driver will automatically call `preventDefault()` on every event.
  3300. *
  3301. * `DOMSource.elements()` returns a stream of the DOM element(s) matched by the
  3302. * selectors in the DOMSource. Also, `DOMSource.select(':root').elements()`
  3303. * returns a stream of DOM element corresponding to the root (or container) of
  3304. * the app on the DOM.
  3305. *
  3306. * @param {(String|HTMLElement)} container the DOM selector for the element
  3307. * (or the element itself) to contain the rendering of the VTrees.
  3308. * @param {DOMDriverOptions} options an object with two optional properties:
  3309. *
  3310. * - `modules: array` overrides `@cycle/dom`'s default Snabbdom modules as
  3311. * as defined in [`src/modules.ts`](./src/modules.ts).
  3312. * - `transposition: boolean` enables/disables transposition of inner streams
  3313. * in the virtual DOM tree.
  3314. * @return {Function} the DOM driver function. The function expects a stream of
  3315. * VNode as input, and outputs the DOMSource object.
  3316. * @function makeDOMDriver
  3317. */
  3318. var makeDOMDriver_1 = __webpack_require__(45);
  3319. exports.makeDOMDriver = makeDOMDriver_1.makeDOMDriver;
  3320. /**
  3321. * A factory function to create mocked DOMSource objects, for testing purposes.
  3322. *
  3323. * Takes a `mockConfig` object as argument, and returns
  3324. * a DOMSource that can be given to any Cycle.js app that expects a DOMSource in
  3325. * the sources, for testing.
  3326. *
  3327. * The `mockConfig` parameter is an object specifying selectors, eventTypes and
  3328. * their streams. Example:
  3329. *
  3330. * ```js
  3331. * const domSource = mockDOMSource({
  3332. * '.foo': {
  3333. * 'click': xs.of({target: {}}),
  3334. * 'mouseover': xs.of({target: {}}),
  3335. * },
  3336. * '.bar': {
  3337. * 'scroll': xs.of({target: {}}),
  3338. * elements: xs.of({tagName: 'div'}),
  3339. * }
  3340. * });
  3341. *
  3342. * // Usage
  3343. * const click$ = domSource.select('.foo').events('click');
  3344. * const element$ = domSource.select('.bar').elements();
  3345. * ```
  3346. *
  3347. * The mocked DOM Source supports isolation. It has the functions `isolateSink`
  3348. * and `isolateSource` attached to it, and performs simple isolation using
  3349. * classNames. *isolateSink* with scope `foo` will append the class `___foo` to
  3350. * the stream of virtual DOM nodes, and *isolateSource* with scope `foo` will
  3351. * perform a conventional `mockedDOMSource.select('.__foo')` call.
  3352. *
  3353. * @param {Object} mockConfig an object where keys are selector strings
  3354. * and values are objects. Those nested objects have `eventType` strings as keys
  3355. * and values are streams you created.
  3356. * @return {Object} fake DOM source object, with an API containing `select()`
  3357. * and `events()` and `elements()` which can be used just like the DOM Driver's
  3358. * DOMSource.
  3359. *
  3360. * @function mockDOMSource
  3361. */
  3362. var mockDOMSource_1 = __webpack_require__(101);
  3363. exports.mockDOMSource = mockDOMSource_1.mockDOMSource;
  3364. exports.MockedDOMSource = mockDOMSource_1.MockedDOMSource;
  3365. /**
  3366. * The hyperscript function `h()` is a function to create virtual DOM objects,
  3367. * also known as VNodes. Call
  3368. *
  3369. * ```js
  3370. * h('div.myClass', {style: {color: 'red'}}, [])
  3371. * ```
  3372. *
  3373. * to create a VNode that represents a `DIV` element with className `myClass`,
  3374. * styled with red color, and no children because the `[]` array was passed. The
  3375. * API is `h(tagOrSelector, optionalData, optionalChildrenOrText)`.
  3376. *
  3377. * However, usually you should use "hyperscript helpers", which are shortcut
  3378. * functions based on hyperscript. There is one hyperscript helper function for
  3379. * each DOM tagName, such as `h1()`, `h2()`, `div()`, `span()`, `label()`,
  3380. * `input()`. For instance, the previous example could have been written
  3381. * as:
  3382. *
  3383. * ```js
  3384. * div('.myClass', {style: {color: 'red'}}, [])
  3385. * ```
  3386. *
  3387. * There are also SVG helper functions, which apply the appropriate SVG
  3388. * namespace to the resulting elements. `svg()` function creates the top-most
  3389. * SVG element, and `svg.g`, `svg.polygon`, `svg.circle`, `svg.path` are for
  3390. * SVG-specific child elements. Example:
  3391. *
  3392. * ```js
  3393. * svg({width: 150, height: 150}, [
  3394. * svg.polygon({
  3395. * attrs: {
  3396. * class: 'triangle',
  3397. * points: '20 0 20 150 150 20'
  3398. * }
  3399. * })
  3400. * ])
  3401. * ```
  3402. *
  3403. * @function h
  3404. */
  3405. var h_1 = __webpack_require__(4);
  3406. exports.h = h_1.h;
  3407. var hyperscript_helpers_1 = __webpack_require__(102);
  3408. exports.svg = hyperscript_helpers_1.default.svg;
  3409. exports.a = hyperscript_helpers_1.default.a;
  3410. exports.abbr = hyperscript_helpers_1.default.abbr;
  3411. exports.address = hyperscript_helpers_1.default.address;
  3412. exports.area = hyperscript_helpers_1.default.area;
  3413. exports.article = hyperscript_helpers_1.default.article;
  3414. exports.aside = hyperscript_helpers_1.default.aside;
  3415. exports.audio = hyperscript_helpers_1.default.audio;
  3416. exports.b = hyperscript_helpers_1.default.b;
  3417. exports.base = hyperscript_helpers_1.default.base;
  3418. exports.bdi = hyperscript_helpers_1.default.bdi;
  3419. exports.bdo = hyperscript_helpers_1.default.bdo;
  3420. exports.blockquote = hyperscript_helpers_1.default.blockquote;
  3421. exports.body = hyperscript_helpers_1.default.body;
  3422. exports.br = hyperscript_helpers_1.default.br;
  3423. exports.button = hyperscript_helpers_1.default.button;
  3424. exports.canvas = hyperscript_helpers_1.default.canvas;
  3425. exports.caption = hyperscript_helpers_1.default.caption;
  3426. exports.cite = hyperscript_helpers_1.default.cite;
  3427. exports.code = hyperscript_helpers_1.default.code;
  3428. exports.col = hyperscript_helpers_1.default.col;
  3429. exports.colgroup = hyperscript_helpers_1.default.colgroup;
  3430. exports.dd = hyperscript_helpers_1.default.dd;
  3431. exports.del = hyperscript_helpers_1.default.del;
  3432. exports.dfn = hyperscript_helpers_1.default.dfn;
  3433. exports.dir = hyperscript_helpers_1.default.dir;
  3434. exports.div = hyperscript_helpers_1.default.div;
  3435. exports.dl = hyperscript_helpers_1.default.dl;
  3436. exports.dt = hyperscript_helpers_1.default.dt;
  3437. exports.em = hyperscript_helpers_1.default.em;
  3438. exports.embed = hyperscript_helpers_1.default.embed;
  3439. exports.fieldset = hyperscript_helpers_1.default.fieldset;
  3440. exports.figcaption = hyperscript_helpers_1.default.figcaption;
  3441. exports.figure = hyperscript_helpers_1.default.figure;
  3442. exports.footer = hyperscript_helpers_1.default.footer;
  3443. exports.form = hyperscript_helpers_1.default.form;
  3444. exports.h1 = hyperscript_helpers_1.default.h1;
  3445. exports.h2 = hyperscript_helpers_1.default.h2;
  3446. exports.h3 = hyperscript_helpers_1.default.h3;
  3447. exports.h4 = hyperscript_helpers_1.default.h4;
  3448. exports.h5 = hyperscript_helpers_1.default.h5;
  3449. exports.h6 = hyperscript_helpers_1.default.h6;
  3450. exports.head = hyperscript_helpers_1.default.head;
  3451. exports.header = hyperscript_helpers_1.default.header;
  3452. exports.hgroup = hyperscript_helpers_1.default.hgroup;
  3453. exports.hr = hyperscript_helpers_1.default.hr;
  3454. exports.html = hyperscript_helpers_1.default.html;
  3455. exports.i = hyperscript_helpers_1.default.i;
  3456. exports.iframe = hyperscript_helpers_1.default.iframe;
  3457. exports.img = hyperscript_helpers_1.default.img;
  3458. exports.input = hyperscript_helpers_1.default.input;
  3459. exports.ins = hyperscript_helpers_1.default.ins;
  3460. exports.kbd = hyperscript_helpers_1.default.kbd;
  3461. exports.keygen = hyperscript_helpers_1.default.keygen;
  3462. exports.label = hyperscript_helpers_1.default.label;
  3463. exports.legend = hyperscript_helpers_1.default.legend;
  3464. exports.li = hyperscript_helpers_1.default.li;
  3465. exports.link = hyperscript_helpers_1.default.link;
  3466. exports.main = hyperscript_helpers_1.default.main;
  3467. exports.map = hyperscript_helpers_1.default.map;
  3468. exports.mark = hyperscript_helpers_1.default.mark;
  3469. exports.menu = hyperscript_helpers_1.default.menu;
  3470. exports.meta = hyperscript_helpers_1.default.meta;
  3471. exports.nav = hyperscript_helpers_1.default.nav;
  3472. exports.noscript = hyperscript_helpers_1.default.noscript;
  3473. exports.object = hyperscript_helpers_1.default.object;
  3474. exports.ol = hyperscript_helpers_1.default.ol;
  3475. exports.optgroup = hyperscript_helpers_1.default.optgroup;
  3476. exports.option = hyperscript_helpers_1.default.option;
  3477. exports.p = hyperscript_helpers_1.default.p;
  3478. exports.param = hyperscript_helpers_1.default.param;
  3479. exports.pre = hyperscript_helpers_1.default.pre;
  3480. exports.progress = hyperscript_helpers_1.default.progress;
  3481. exports.q = hyperscript_helpers_1.default.q;
  3482. exports.rp = hyperscript_helpers_1.default.rp;
  3483. exports.rt = hyperscript_helpers_1.default.rt;
  3484. exports.ruby = hyperscript_helpers_1.default.ruby;
  3485. exports.s = hyperscript_helpers_1.default.s;
  3486. exports.samp = hyperscript_helpers_1.default.samp;
  3487. exports.script = hyperscript_helpers_1.default.script;
  3488. exports.section = hyperscript_helpers_1.default.section;
  3489. exports.select = hyperscript_helpers_1.default.select;
  3490. exports.small = hyperscript_helpers_1.default.small;
  3491. exports.source = hyperscript_helpers_1.default.source;
  3492. exports.span = hyperscript_helpers_1.default.span;
  3493. exports.strong = hyperscript_helpers_1.default.strong;
  3494. exports.style = hyperscript_helpers_1.default.style;
  3495. exports.sub = hyperscript_helpers_1.default.sub;
  3496. exports.sup = hyperscript_helpers_1.default.sup;
  3497. exports.table = hyperscript_helpers_1.default.table;
  3498. exports.tbody = hyperscript_helpers_1.default.tbody;
  3499. exports.td = hyperscript_helpers_1.default.td;
  3500. exports.textarea = hyperscript_helpers_1.default.textarea;
  3501. exports.tfoot = hyperscript_helpers_1.default.tfoot;
  3502. exports.th = hyperscript_helpers_1.default.th;
  3503. exports.thead = hyperscript_helpers_1.default.thead;
  3504. exports.title = hyperscript_helpers_1.default.title;
  3505. exports.tr = hyperscript_helpers_1.default.tr;
  3506. exports.u = hyperscript_helpers_1.default.u;
  3507. exports.ul = hyperscript_helpers_1.default.ul;
  3508. exports.video = hyperscript_helpers_1.default.video;
  3509. //# sourceMappingURL=index.js.map
  3510.  
  3511. /***/ }),
  3512. /* 39 */
  3513. /***/ (function(module, exports, __webpack_require__) {
  3514.  
  3515. "use strict";
  3516.  
  3517. Object.defineProperty(exports, "__esModule", { value: true });
  3518. var h_1 = __webpack_require__(4);
  3519. function copyToThunk(vnode, thunk) {
  3520. thunk.elm = vnode.elm;
  3521. vnode.data.fn = thunk.data.fn;
  3522. vnode.data.args = thunk.data.args;
  3523. vnode.data.isolate = thunk.data.isolate;
  3524. thunk.data = vnode.data;
  3525. thunk.children = vnode.children;
  3526. thunk.text = vnode.text;
  3527. thunk.elm = vnode.elm;
  3528. }
  3529. function init(thunk) {
  3530. var cur = thunk.data;
  3531. var vnode = cur.fn.apply(undefined, cur.args);
  3532. copyToThunk(vnode, thunk);
  3533. }
  3534. function prepatch(oldVnode, thunk) {
  3535. var old = oldVnode.data, cur = thunk.data;
  3536. var i;
  3537. var oldArgs = old.args, args = cur.args;
  3538. if (old.fn !== cur.fn || oldArgs.length !== args.length) {
  3539. copyToThunk(cur.fn.apply(undefined, args), thunk);
  3540. }
  3541. for (i = 0; i < args.length; ++i) {
  3542. if (oldArgs[i] !== args[i]) {
  3543. copyToThunk(cur.fn.apply(undefined, args), thunk);
  3544. return;
  3545. }
  3546. }
  3547. copyToThunk(oldVnode, thunk);
  3548. }
  3549. exports.thunk = function thunk(sel, key, fn, args) {
  3550. if (args === undefined) {
  3551. args = fn;
  3552. fn = key;
  3553. key = undefined;
  3554. }
  3555. return h_1.h(sel, {
  3556. key: key,
  3557. hook: { init: init, prepatch: prepatch },
  3558. fn: fn,
  3559. args: args,
  3560. });
  3561. };
  3562. exports.default = exports.thunk;
  3563. //# sourceMappingURL=thunk.js.map
  3564.  
  3565. /***/ }),
  3566. /* 40 */
  3567. /***/ (function(module, exports, __webpack_require__) {
  3568.  
  3569. "use strict";
  3570.  
  3571. Object.defineProperty(exports, "__esModule", { value: true });
  3572. var xstream_1 = __webpack_require__(2);
  3573. var adapt_1 = __webpack_require__(6);
  3574. var fromEvent_1 = __webpack_require__(13);
  3575. var DocumentDOMSource = (function () {
  3576. function DocumentDOMSource(_name) {
  3577. this._name = _name;
  3578. }
  3579. DocumentDOMSource.prototype.select = function (selector) {
  3580. // This functionality is still undefined/undecided.
  3581. return this;
  3582. };
  3583. DocumentDOMSource.prototype.elements = function () {
  3584. var out = adapt_1.adapt(xstream_1.default.of(document));
  3585. out._isCycleSource = this._name;
  3586. return out;
  3587. };
  3588. DocumentDOMSource.prototype.events = function (eventType, options) {
  3589. if (options === void 0) { options = {}; }
  3590. var stream;
  3591. stream = fromEvent_1.fromEvent(document, eventType, options.useCapture, options.preventDefault);
  3592. var out = adapt_1.adapt(stream);
  3593. out._isCycleSource = this._name;
  3594. return out;
  3595. };
  3596. return DocumentDOMSource;
  3597. }());
  3598. exports.DocumentDOMSource = DocumentDOMSource;
  3599. //# sourceMappingURL=DocumentDOMSource.js.map
  3600.  
  3601. /***/ }),
  3602. /* 41 */
  3603. /***/ (function(module, exports, __webpack_require__) {
  3604.  
  3605. "use strict";
  3606.  
  3607. Object.defineProperty(exports, "__esModule", { value: true });
  3608. var xstream_1 = __webpack_require__(2);
  3609. var adapt_1 = __webpack_require__(6);
  3610. var fromEvent_1 = __webpack_require__(13);
  3611. var BodyDOMSource = (function () {
  3612. function BodyDOMSource(_name) {
  3613. this._name = _name;
  3614. }
  3615. BodyDOMSource.prototype.select = function (selector) {
  3616. // This functionality is still undefined/undecided.
  3617. return this;
  3618. };
  3619. BodyDOMSource.prototype.elements = function () {
  3620. var out = adapt_1.adapt(xstream_1.default.of(document.body));
  3621. out._isCycleSource = this._name;
  3622. return out;
  3623. };
  3624. BodyDOMSource.prototype.events = function (eventType, options) {
  3625. if (options === void 0) { options = {}; }
  3626. var stream;
  3627. stream = fromEvent_1.fromEvent(document.body, eventType, options.useCapture, options.preventDefault);
  3628. var out = adapt_1.adapt(stream);
  3629. out._isCycleSource = this._name;
  3630. return out;
  3631. };
  3632. return BodyDOMSource;
  3633. }());
  3634. exports.BodyDOMSource = BodyDOMSource;
  3635. //# sourceMappingURL=BodyDOMSource.js.map
  3636.  
  3637. /***/ }),
  3638. /* 42 */
  3639. /***/ (function(module, exports, __webpack_require__) {
  3640.  
  3641. "use strict";
  3642.  
  3643. Object.defineProperty(exports, "__esModule", { value: true });
  3644. var ScopeChecker_1 = __webpack_require__(18);
  3645. var utils_1 = __webpack_require__(7);
  3646. var matchesSelector_1 = __webpack_require__(19);
  3647. function toElArray(input) {
  3648. return Array.prototype.slice.call(input);
  3649. }
  3650. var ElementFinder = (function () {
  3651. function ElementFinder(namespace, isolateModule) {
  3652. this.namespace = namespace;
  3653. this.isolateModule = isolateModule;
  3654. }
  3655. ElementFinder.prototype.call = function (rootElement) {
  3656. var namespace = this.namespace;
  3657. var selector = utils_1.getSelectors(namespace);
  3658. if (!selector) {
  3659. return rootElement;
  3660. }
  3661. var fullScope = utils_1.getFullScope(namespace);
  3662. var scopeChecker = new ScopeChecker_1.ScopeChecker(fullScope, this.isolateModule);
  3663. var topNode = fullScope
  3664. ? this.isolateModule.getElement(fullScope) || rootElement
  3665. : rootElement;
  3666. var topNodeMatchesSelector = !!fullScope && !!selector && matchesSelector_1.matchesSelector(topNode, selector);
  3667. return toElArray(topNode.querySelectorAll(selector))
  3668. .filter(scopeChecker.isDirectlyInScope, scopeChecker)
  3669. .concat(topNodeMatchesSelector ? [topNode] : []);
  3670. };
  3671. return ElementFinder;
  3672. }());
  3673. exports.ElementFinder = ElementFinder;
  3674. //# sourceMappingURL=ElementFinder.js.map
  3675.  
  3676. /***/ }),
  3677. /* 43 */
  3678. /***/ (function(module, exports, __webpack_require__) {
  3679.  
  3680. "use strict";
  3681.  
  3682. Object.defineProperty(exports, "__esModule", { value: true });
  3683. var vnode_1 = __webpack_require__(9);
  3684. var utils_1 = __webpack_require__(7);
  3685. function totalIsolateSource(source, scope) {
  3686. return source.select(utils_1.SCOPE_PREFIX + scope);
  3687. }
  3688. function siblingIsolateSource(source, scope) {
  3689. return source.select(scope);
  3690. }
  3691. function isolateSource(source, scope) {
  3692. if (scope === ':root') {
  3693. return source;
  3694. }
  3695. else if (utils_1.isClassOrId(scope)) {
  3696. return siblingIsolateSource(source, scope);
  3697. }
  3698. else {
  3699. return totalIsolateSource(source, scope);
  3700. }
  3701. }
  3702. exports.isolateSource = isolateSource;
  3703. function siblingIsolateSink(sink, scope) {
  3704. return sink.map(function (node) {
  3705. return node
  3706. ? vnode_1.vnode(node.sel + scope, node.data, node.children, node.text, node.elm)
  3707. : node;
  3708. });
  3709. }
  3710. exports.siblingIsolateSink = siblingIsolateSink;
  3711. function totalIsolateSink(sink, fullScope) {
  3712. return sink.map(function (node) {
  3713. if (!node) {
  3714. return node;
  3715. }
  3716. // Ignore if already had up-to-date full scope in vnode.data.isolate
  3717. if (node.data && node.data.isolate) {
  3718. var isolateData = node.data.isolate;
  3719. var prevFullScopeNum = isolateData.replace(/(cycle|\-)/g, '');
  3720. var fullScopeNum = fullScope.replace(/(cycle|\-)/g, '');
  3721. if (isNaN(parseInt(prevFullScopeNum)) ||
  3722. isNaN(parseInt(fullScopeNum)) ||
  3723. prevFullScopeNum > fullScopeNum) {
  3724. // > is lexicographic string comparison
  3725. return node;
  3726. }
  3727. }
  3728. // Insert up-to-date full scope in vnode.data.isolate, and also a key if needed
  3729. node.data = node.data || {};
  3730. node.data.isolate = fullScope;
  3731. if (typeof node.key === 'undefined') {
  3732. node.key = utils_1.SCOPE_PREFIX + fullScope;
  3733. }
  3734. return node;
  3735. });
  3736. }
  3737. exports.totalIsolateSink = totalIsolateSink;
  3738. //# sourceMappingURL=isolate.js.map
  3739.  
  3740. /***/ }),
  3741. /* 44 */
  3742. /***/ (function(module, exports, __webpack_require__) {
  3743.  
  3744. "use strict";
  3745.  
  3746. Object.defineProperty(exports, "__esModule", { value: true });
  3747. var xstream_1 = __webpack_require__(2);
  3748. var ScopeChecker_1 = __webpack_require__(18);
  3749. var utils_1 = __webpack_require__(7);
  3750. var matchesSelector_1 = __webpack_require__(19);
  3751. /**
  3752. * Finds (with binary search) index of the destination that id equal to searchId
  3753. * among the destinations in the given array.
  3754. */
  3755. function indexOf(arr, searchId) {
  3756. var minIndex = 0;
  3757. var maxIndex = arr.length - 1;
  3758. var currentIndex;
  3759. var current;
  3760. while (minIndex <= maxIndex) {
  3761. currentIndex = ((minIndex + maxIndex) / 2) | 0; // tslint:disable-line:no-bitwise
  3762. current = arr[currentIndex];
  3763. var currentId = current.id;
  3764. if (currentId < searchId) {
  3765. minIndex = currentIndex + 1;
  3766. }
  3767. else if (currentId > searchId) {
  3768. maxIndex = currentIndex - 1;
  3769. }
  3770. else {
  3771. return currentIndex;
  3772. }
  3773. }
  3774. return -1;
  3775. }
  3776. function stopPropagation() {
  3777. this.oldStopPropagation();
  3778. this.propagationHasBeenStopped = true;
  3779. }
  3780. /**
  3781. * Manages "Event delegation", by connecting an origin with multiple
  3782. * destinations.
  3783. *
  3784. * Attaches a DOM event listener to the DOM element called the "origin",
  3785. * and delegates events to "destinations", which are subjects as outputs
  3786. * for the DOMSource. Simulates bubbling or capturing, with regards to
  3787. * isolation boundaries too.
  3788. */
  3789. var EventDelegator = (function () {
  3790. function EventDelegator(origin, eventType, useCapture, isolateModule, preventDefault) {
  3791. if (preventDefault === void 0) { preventDefault = false; }
  3792. var _this = this;
  3793. this.origin = origin;
  3794. this.eventType = eventType;
  3795. this.useCapture = useCapture;
  3796. this.isolateModule = isolateModule;
  3797. this.preventDefault = preventDefault;
  3798. this.destinations = [];
  3799. this._lastId = 0;
  3800. if (preventDefault) {
  3801. if (useCapture) {
  3802. this.listener = function (ev) {
  3803. ev.preventDefault();
  3804. _this.capture(ev);
  3805. };
  3806. }
  3807. else {
  3808. this.listener = function (ev) {
  3809. ev.preventDefault();
  3810. _this.bubble(ev);
  3811. };
  3812. }
  3813. }
  3814. else {
  3815. if (useCapture) {
  3816. this.listener = function (ev) { return _this.capture(ev); };
  3817. }
  3818. else {
  3819. this.listener = function (ev) { return _this.bubble(ev); };
  3820. }
  3821. }
  3822. origin.addEventListener(eventType, this.listener, useCapture);
  3823. }
  3824. EventDelegator.prototype.updateOrigin = function (newOrigin) {
  3825. this.origin.removeEventListener(this.eventType, this.listener, this.useCapture);
  3826. newOrigin.addEventListener(this.eventType, this.listener, this.useCapture);
  3827. this.origin = newOrigin;
  3828. };
  3829. /**
  3830. * Creates a *new* destination given the namespace and returns the subject
  3831. * representing the destination of events. Is not referentially transparent,
  3832. * will always return a different output for the same input.
  3833. */
  3834. EventDelegator.prototype.createDestination = function (namespace) {
  3835. var _this = this;
  3836. var id = this._lastId++;
  3837. var selector = utils_1.getSelectors(namespace);
  3838. var scopeChecker = new ScopeChecker_1.ScopeChecker(utils_1.getFullScope(namespace), this.isolateModule);
  3839. var subject = xstream_1.default.create({
  3840. start: function () { },
  3841. stop: function () {
  3842. if ('requestIdleCallback' in window) {
  3843. requestIdleCallback(function () {
  3844. _this.removeDestination(id);
  3845. });
  3846. }
  3847. else {
  3848. _this.removeDestination(id);
  3849. }
  3850. },
  3851. });
  3852. var destination = { id: id, selector: selector, scopeChecker: scopeChecker, subject: subject };
  3853. this.destinations.push(destination);
  3854. return subject;
  3855. };
  3856. /**
  3857. * Removes the destination that has the given id.
  3858. */
  3859. EventDelegator.prototype.removeDestination = function (id) {
  3860. var i = indexOf(this.destinations, id);
  3861. i >= 0 && this.destinations.splice(i, 1); // tslint:disable-line:no-unused-expression
  3862. };
  3863. EventDelegator.prototype.capture = function (ev) {
  3864. var n = this.destinations.length;
  3865. for (var i = 0; i < n; i++) {
  3866. var dest = this.destinations[i];
  3867. if (matchesSelector_1.matchesSelector(ev.target, dest.selector)) {
  3868. dest.subject._n(ev);
  3869. }
  3870. }
  3871. };
  3872. EventDelegator.prototype.bubble = function (rawEvent) {
  3873. var origin = this.origin;
  3874. if (!origin.contains(rawEvent.currentTarget)) {
  3875. return;
  3876. }
  3877. var roof = origin.parentElement;
  3878. var ev = this.patchEvent(rawEvent);
  3879. for (var el = ev.target; el && el !== roof; el = el.parentElement) {
  3880. if (!origin.contains(el)) {
  3881. ev.stopPropagation();
  3882. }
  3883. if (ev.propagationHasBeenStopped) {
  3884. return;
  3885. }
  3886. this.matchEventAgainstDestinations(el, ev);
  3887. }
  3888. };
  3889. EventDelegator.prototype.patchEvent = function (event) {
  3890. var pEvent = event;
  3891. pEvent.propagationHasBeenStopped = false;
  3892. pEvent.oldStopPropagation = pEvent.stopPropagation;
  3893. pEvent.stopPropagation = stopPropagation;
  3894. return pEvent;
  3895. };
  3896. EventDelegator.prototype.matchEventAgainstDestinations = function (el, ev) {
  3897. var n = this.destinations.length;
  3898. for (var i = 0; i < n; i++) {
  3899. var dest = this.destinations[i];
  3900. if (!dest.scopeChecker.isDirectlyInScope(el)) {
  3901. continue;
  3902. }
  3903. if (matchesSelector_1.matchesSelector(el, dest.selector)) {
  3904. this.mutateEventCurrentTarget(ev, el);
  3905. dest.subject._n(ev);
  3906. }
  3907. }
  3908. };
  3909. EventDelegator.prototype.mutateEventCurrentTarget = function (event, currentTargetElement) {
  3910. try {
  3911. Object.defineProperty(event, "currentTarget", {
  3912. value: currentTargetElement,
  3913. configurable: true,
  3914. });
  3915. }
  3916. catch (err) {
  3917. console.log("please use event.ownerTarget");
  3918. }
  3919. event.ownerTarget = currentTargetElement;
  3920. };
  3921. return EventDelegator;
  3922. }());
  3923. exports.EventDelegator = EventDelegator;
  3924. //# sourceMappingURL=EventDelegator.js.map
  3925.  
  3926. /***/ }),
  3927. /* 45 */
  3928. /***/ (function(module, exports, __webpack_require__) {
  3929.  
  3930. "use strict";
  3931.  
  3932. Object.defineProperty(exports, "__esModule", { value: true });
  3933. var snabbdom_1 = __webpack_require__(46);
  3934. var xstream_1 = __webpack_require__(2);
  3935. var MainDOMSource_1 = __webpack_require__(17);
  3936. var tovnode_1 = __webpack_require__(48);
  3937. var VNodeWrapper_1 = __webpack_require__(49);
  3938. var utils_1 = __webpack_require__(7);
  3939. var modules_1 = __webpack_require__(51);
  3940. var IsolateModule_1 = __webpack_require__(57);
  3941. var MapPolyfill = __webpack_require__(22);
  3942. function makeDOMDriverInputGuard(modules) {
  3943. if (!Array.isArray(modules)) {
  3944. throw new Error("Optional modules option must be " + "an array for snabbdom modules");
  3945. }
  3946. }
  3947. function domDriverInputGuard(view$) {
  3948. if (!view$ ||
  3949. typeof view$.addListener !== "function" ||
  3950. typeof view$.fold !== "function") {
  3951. throw new Error("The DOM driver function expects as input a Stream of " +
  3952. "virtual DOM elements");
  3953. }
  3954. }
  3955. function dropCompletion(input) {
  3956. return xstream_1.default.merge(input, xstream_1.default.never());
  3957. }
  3958. function unwrapElementFromVNode(vnode) {
  3959. return vnode.elm;
  3960. }
  3961. function reportSnabbdomError(err) {
  3962. (console.error || console.log)(err);
  3963. }
  3964. function makeDOMDriver(container, options) {
  3965. if (!options) {
  3966. options = {};
  3967. }
  3968. var modules = options.modules || modules_1.default;
  3969. var isolateModule = new IsolateModule_1.IsolateModule();
  3970. var patch = snabbdom_1.init([isolateModule.createModule()].concat(modules));
  3971. var rootElement = utils_1.getElement(container) || document.body;
  3972. var vnodeWrapper = new VNodeWrapper_1.VNodeWrapper(rootElement);
  3973. var delegators = new MapPolyfill();
  3974. makeDOMDriverInputGuard(modules);
  3975. function DOMDriver(vnode$, name) {
  3976. if (name === void 0) { name = 'DOM'; }
  3977. domDriverInputGuard(vnode$);
  3978. var sanitation$ = xstream_1.default.create();
  3979. var rootElement$ = xstream_1.default
  3980. .merge(vnode$.endWhen(sanitation$), sanitation$)
  3981. .map(function (vnode) { return vnodeWrapper.call(vnode); })
  3982. .fold(patch, tovnode_1.toVNode(rootElement))
  3983. .drop(1)
  3984. .map(unwrapElementFromVNode)
  3985. .compose(dropCompletion) // don't complete this stream
  3986. .startWith(rootElement);
  3987. // Start the snabbdom patching, over time
  3988. var listener = { error: reportSnabbdomError };
  3989. if (document.readyState === 'loading') {
  3990. document.addEventListener('readystatechange', function () {
  3991. if (document.readyState === 'interactive') {
  3992. rootElement$.addListener(listener);
  3993. }
  3994. });
  3995. }
  3996. else {
  3997. rootElement$.addListener(listener);
  3998. }
  3999. return new MainDOMSource_1.MainDOMSource(rootElement$, sanitation$, [], isolateModule, delegators, name);
  4000. }
  4001. return DOMDriver;
  4002. }
  4003. exports.makeDOMDriver = makeDOMDriver;
  4004. //# sourceMappingURL=makeDOMDriver.js.map
  4005.  
  4006. /***/ }),
  4007. /* 46 */
  4008. /***/ (function(module, exports, __webpack_require__) {
  4009.  
  4010. "use strict";
  4011.  
  4012. Object.defineProperty(exports, "__esModule", { value: true });
  4013. var vnode_1 = __webpack_require__(9);
  4014. var is = __webpack_require__(16);
  4015. var htmldomapi_1 = __webpack_require__(20);
  4016. function isUndef(s) { return s === undefined; }
  4017. function isDef(s) { return s !== undefined; }
  4018. var emptyNode = vnode_1.default('', {}, [], undefined, undefined);
  4019. function sameVnode(vnode1, vnode2) {
  4020. return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
  4021. }
  4022. function isVnode(vnode) {
  4023. return vnode.sel !== undefined;
  4024. }
  4025. function createKeyToOldIdx(children, beginIdx, endIdx) {
  4026. var i, map = {}, key, ch;
  4027. for (i = beginIdx; i <= endIdx; ++i) {
  4028. ch = children[i];
  4029. if (ch != null) {
  4030. key = ch.key;
  4031. if (key !== undefined)
  4032. map[key] = i;
  4033. }
  4034. }
  4035. return map;
  4036. }
  4037. var hooks = ['create', 'update', 'remove', 'destroy', 'pre', 'post'];
  4038. var h_1 = __webpack_require__(4);
  4039. exports.h = h_1.h;
  4040. var thunk_1 = __webpack_require__(47);
  4041. exports.thunk = thunk_1.thunk;
  4042. function init(modules, domApi) {
  4043. var i, j, cbs = {};
  4044. var api = domApi !== undefined ? domApi : htmldomapi_1.default;
  4045. for (i = 0; i < hooks.length; ++i) {
  4046. cbs[hooks[i]] = [];
  4047. for (j = 0; j < modules.length; ++j) {
  4048. var hook = modules[j][hooks[i]];
  4049. if (hook !== undefined) {
  4050. cbs[hooks[i]].push(hook);
  4051. }
  4052. }
  4053. }
  4054. function emptyNodeAt(elm) {
  4055. var id = elm.id ? '#' + elm.id : '';
  4056. var c = elm.className ? '.' + elm.className.split(' ').join('.') : '';
  4057. return vnode_1.default(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
  4058. }
  4059. function createRmCb(childElm, listeners) {
  4060. return function rmCb() {
  4061. if (--listeners === 0) {
  4062. var parent_1 = api.parentNode(childElm);
  4063. api.removeChild(parent_1, childElm);
  4064. }
  4065. };
  4066. }
  4067. function createElm(vnode, insertedVnodeQueue) {
  4068. var i, data = vnode.data;
  4069. if (data !== undefined) {
  4070. if (isDef(i = data.hook) && isDef(i = i.init)) {
  4071. i(vnode);
  4072. data = vnode.data;
  4073. }
  4074. }
  4075. var children = vnode.children, sel = vnode.sel;
  4076. if (sel === '!') {
  4077. if (isUndef(vnode.text)) {
  4078. vnode.text = '';
  4079. }
  4080. vnode.elm = api.createComment(vnode.text);
  4081. }
  4082. else if (sel !== undefined) {
  4083. // Parse selector
  4084. var hashIdx = sel.indexOf('#');
  4085. var dotIdx = sel.indexOf('.', hashIdx);
  4086. var hash = hashIdx > 0 ? hashIdx : sel.length;
  4087. var dot = dotIdx > 0 ? dotIdx : sel.length;
  4088. var tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel;
  4089. var elm = vnode.elm = isDef(data) && isDef(i = data.ns) ? api.createElementNS(i, tag)
  4090. : api.createElement(tag);
  4091. if (hash < dot)
  4092. elm.setAttribute('id', sel.slice(hash + 1, dot));
  4093. if (dotIdx > 0)
  4094. elm.setAttribute('class', sel.slice(dot + 1).replace(/\./g, ' '));
  4095. for (i = 0; i < cbs.create.length; ++i)
  4096. cbs.create[i](emptyNode, vnode);
  4097. if (is.array(children)) {
  4098. for (i = 0; i < children.length; ++i) {
  4099. var ch = children[i];
  4100. if (ch != null) {
  4101. api.appendChild(elm, createElm(ch, insertedVnodeQueue));
  4102. }
  4103. }
  4104. }
  4105. else if (is.primitive(vnode.text)) {
  4106. api.appendChild(elm, api.createTextNode(vnode.text));
  4107. }
  4108. i = vnode.data.hook; // Reuse variable
  4109. if (isDef(i)) {
  4110. if (i.create)
  4111. i.create(emptyNode, vnode);
  4112. if (i.insert)
  4113. insertedVnodeQueue.push(vnode);
  4114. }
  4115. }
  4116. else {
  4117. vnode.elm = api.createTextNode(vnode.text);
  4118. }
  4119. return vnode.elm;
  4120. }
  4121. function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  4122. for (; startIdx <= endIdx; ++startIdx) {
  4123. var ch = vnodes[startIdx];
  4124. if (ch != null) {
  4125. api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
  4126. }
  4127. }
  4128. }
  4129. function invokeDestroyHook(vnode) {
  4130. var i, j, data = vnode.data;
  4131. if (data !== undefined) {
  4132. if (isDef(i = data.hook) && isDef(i = i.destroy))
  4133. i(vnode);
  4134. for (i = 0; i < cbs.destroy.length; ++i)
  4135. cbs.destroy[i](vnode);
  4136. if (vnode.children !== undefined) {
  4137. for (j = 0; j < vnode.children.length; ++j) {
  4138. i = vnode.children[j];
  4139. if (i != null && typeof i !== "string") {
  4140. invokeDestroyHook(i);
  4141. }
  4142. }
  4143. }
  4144. }
  4145. }
  4146. function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
  4147. for (; startIdx <= endIdx; ++startIdx) {
  4148. var i_1 = void 0, listeners = void 0, rm = void 0, ch = vnodes[startIdx];
  4149. if (ch != null) {
  4150. if (isDef(ch.sel)) {
  4151. invokeDestroyHook(ch);
  4152. listeners = cbs.remove.length + 1;
  4153. rm = createRmCb(ch.elm, listeners);
  4154. for (i_1 = 0; i_1 < cbs.remove.length; ++i_1)
  4155. cbs.remove[i_1](ch, rm);
  4156. if (isDef(i_1 = ch.data) && isDef(i_1 = i_1.hook) && isDef(i_1 = i_1.remove)) {
  4157. i_1(ch, rm);
  4158. }
  4159. else {
  4160. rm();
  4161. }
  4162. }
  4163. else {
  4164. api.removeChild(parentElm, ch.elm);
  4165. }
  4166. }
  4167. }
  4168. }
  4169. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
  4170. var oldStartIdx = 0, newStartIdx = 0;
  4171. var oldEndIdx = oldCh.length - 1;
  4172. var oldStartVnode = oldCh[0];
  4173. var oldEndVnode = oldCh[oldEndIdx];
  4174. var newEndIdx = newCh.length - 1;
  4175. var newStartVnode = newCh[0];
  4176. var newEndVnode = newCh[newEndIdx];
  4177. var oldKeyToIdx;
  4178. var idxInOld;
  4179. var elmToMove;
  4180. var before;
  4181. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  4182. if (oldStartVnode == null) {
  4183. oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
  4184. }
  4185. else if (oldEndVnode == null) {
  4186. oldEndVnode = oldCh[--oldEndIdx];
  4187. }
  4188. else if (newStartVnode == null) {
  4189. newStartVnode = newCh[++newStartIdx];
  4190. }
  4191. else if (newEndVnode == null) {
  4192. newEndVnode = newCh[--newEndIdx];
  4193. }
  4194. else if (sameVnode(oldStartVnode, newStartVnode)) {
  4195. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  4196. oldStartVnode = oldCh[++oldStartIdx];
  4197. newStartVnode = newCh[++newStartIdx];
  4198. }
  4199. else if (sameVnode(oldEndVnode, newEndVnode)) {
  4200. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  4201. oldEndVnode = oldCh[--oldEndIdx];
  4202. newEndVnode = newCh[--newEndIdx];
  4203. }
  4204. else if (sameVnode(oldStartVnode, newEndVnode)) {
  4205. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  4206. api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
  4207. oldStartVnode = oldCh[++oldStartIdx];
  4208. newEndVnode = newCh[--newEndIdx];
  4209. }
  4210. else if (sameVnode(oldEndVnode, newStartVnode)) {
  4211. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  4212. api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  4213. oldEndVnode = oldCh[--oldEndIdx];
  4214. newStartVnode = newCh[++newStartIdx];
  4215. }
  4216. else {
  4217. if (oldKeyToIdx === undefined) {
  4218. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  4219. }
  4220. idxInOld = oldKeyToIdx[newStartVnode.key];
  4221. if (isUndef(idxInOld)) {
  4222. api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  4223. newStartVnode = newCh[++newStartIdx];
  4224. }
  4225. else {
  4226. elmToMove = oldCh[idxInOld];
  4227. if (elmToMove.sel !== newStartVnode.sel) {
  4228. api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  4229. }
  4230. else {
  4231. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  4232. oldCh[idxInOld] = undefined;
  4233. api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
  4234. }
  4235. newStartVnode = newCh[++newStartIdx];
  4236. }
  4237. }
  4238. }
  4239. if (oldStartIdx > oldEndIdx) {
  4240. before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
  4241. addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  4242. }
  4243. else if (newStartIdx > newEndIdx) {
  4244. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  4245. }
  4246. }
  4247. function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
  4248. var i, hook;
  4249. if (isDef(i = vnode.data) && isDef(hook = i.hook) && isDef(i = hook.prepatch)) {
  4250. i(oldVnode, vnode);
  4251. }
  4252. var elm = vnode.elm = oldVnode.elm;
  4253. var oldCh = oldVnode.children;
  4254. var ch = vnode.children;
  4255. if (oldVnode === vnode)
  4256. return;
  4257. if (vnode.data !== undefined) {
  4258. for (i = 0; i < cbs.update.length; ++i)
  4259. cbs.update[i](oldVnode, vnode);
  4260. i = vnode.data.hook;
  4261. if (isDef(i) && isDef(i = i.update))
  4262. i(oldVnode, vnode);
  4263. }
  4264. if (isUndef(vnode.text)) {
  4265. if (isDef(oldCh) && isDef(ch)) {
  4266. if (oldCh !== ch)
  4267. updateChildren(elm, oldCh, ch, insertedVnodeQueue);
  4268. }
  4269. else if (isDef(ch)) {
  4270. if (isDef(oldVnode.text))
  4271. api.setTextContent(elm, '');
  4272. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  4273. }
  4274. else if (isDef(oldCh)) {
  4275. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  4276. }
  4277. else if (isDef(oldVnode.text)) {
  4278. api.setTextContent(elm, '');
  4279. }
  4280. }
  4281. else if (oldVnode.text !== vnode.text) {
  4282. api.setTextContent(elm, vnode.text);
  4283. }
  4284. if (isDef(hook) && isDef(i = hook.postpatch)) {
  4285. i(oldVnode, vnode);
  4286. }
  4287. }
  4288. return function patch(oldVnode, vnode) {
  4289. var i, elm, parent;
  4290. var insertedVnodeQueue = [];
  4291. for (i = 0; i < cbs.pre.length; ++i)
  4292. cbs.pre[i]();
  4293. if (!isVnode(oldVnode)) {
  4294. oldVnode = emptyNodeAt(oldVnode);
  4295. }
  4296. if (sameVnode(oldVnode, vnode)) {
  4297. patchVnode(oldVnode, vnode, insertedVnodeQueue);
  4298. }
  4299. else {
  4300. elm = oldVnode.elm;
  4301. parent = api.parentNode(elm);
  4302. createElm(vnode, insertedVnodeQueue);
  4303. if (parent !== null) {
  4304. api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
  4305. removeVnodes(parent, [oldVnode], 0, 0);
  4306. }
  4307. }
  4308. for (i = 0; i < insertedVnodeQueue.length; ++i) {
  4309. insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
  4310. }
  4311. for (i = 0; i < cbs.post.length; ++i)
  4312. cbs.post[i]();
  4313. return vnode;
  4314. };
  4315. }
  4316. exports.init = init;
  4317. //# sourceMappingURL=snabbdom.js.map
  4318.  
  4319. /***/ }),
  4320. /* 47 */
  4321. /***/ (function(module, exports, __webpack_require__) {
  4322.  
  4323. "use strict";
  4324.  
  4325. Object.defineProperty(exports, "__esModule", { value: true });
  4326. var h_1 = __webpack_require__(4);
  4327. function copyToThunk(vnode, thunk) {
  4328. thunk.elm = vnode.elm;
  4329. vnode.data.fn = thunk.data.fn;
  4330. vnode.data.args = thunk.data.args;
  4331. thunk.data = vnode.data;
  4332. thunk.children = vnode.children;
  4333. thunk.text = vnode.text;
  4334. thunk.elm = vnode.elm;
  4335. }
  4336. function init(thunk) {
  4337. var cur = thunk.data;
  4338. var vnode = cur.fn.apply(undefined, cur.args);
  4339. copyToThunk(vnode, thunk);
  4340. }
  4341. function prepatch(oldVnode, thunk) {
  4342. var i, old = oldVnode.data, cur = thunk.data;
  4343. var oldArgs = old.args, args = cur.args;
  4344. if (old.fn !== cur.fn || oldArgs.length !== args.length) {
  4345. copyToThunk(cur.fn.apply(undefined, args), thunk);
  4346. return;
  4347. }
  4348. for (i = 0; i < args.length; ++i) {
  4349. if (oldArgs[i] !== args[i]) {
  4350. copyToThunk(cur.fn.apply(undefined, args), thunk);
  4351. return;
  4352. }
  4353. }
  4354. copyToThunk(oldVnode, thunk);
  4355. }
  4356. exports.thunk = function thunk(sel, key, fn, args) {
  4357. if (args === undefined) {
  4358. args = fn;
  4359. fn = key;
  4360. key = undefined;
  4361. }
  4362. return h_1.h(sel, {
  4363. key: key,
  4364. hook: { init: init, prepatch: prepatch },
  4365. fn: fn,
  4366. args: args
  4367. });
  4368. };
  4369. exports.default = exports.thunk;
  4370. //# sourceMappingURL=thunk.js.map
  4371.  
  4372. /***/ }),
  4373. /* 48 */
  4374. /***/ (function(module, exports, __webpack_require__) {
  4375.  
  4376. "use strict";
  4377.  
  4378. Object.defineProperty(exports, "__esModule", { value: true });
  4379. var vnode_1 = __webpack_require__(9);
  4380. var htmldomapi_1 = __webpack_require__(20);
  4381. function toVNode(node, domApi) {
  4382. var api = domApi !== undefined ? domApi : htmldomapi_1.default;
  4383. var text;
  4384. if (api.isElement(node)) {
  4385. var id = node.id ? '#' + node.id : '';
  4386. var cn = node.getAttribute('class');
  4387. var c = cn ? '.' + cn.split(' ').join('.') : '';
  4388. var sel = api.tagName(node).toLowerCase() + id + c;
  4389. var attrs = {};
  4390. var children = [];
  4391. var name_1;
  4392. var i = void 0, n = void 0;
  4393. var elmAttrs = node.attributes;
  4394. var elmChildren = node.childNodes;
  4395. for (i = 0, n = elmAttrs.length; i < n; i++) {
  4396. name_1 = elmAttrs[i].nodeName;
  4397. if (name_1 !== 'id' && name_1 !== 'class') {
  4398. attrs[name_1] = elmAttrs[i].nodeValue;
  4399. }
  4400. }
  4401. for (i = 0, n = elmChildren.length; i < n; i++) {
  4402. children.push(toVNode(elmChildren[i]));
  4403. }
  4404. return vnode_1.default(sel, { attrs: attrs }, children, undefined, node);
  4405. }
  4406. else if (api.isText(node)) {
  4407. text = api.getTextContent(node);
  4408. return vnode_1.default(undefined, undefined, undefined, text, node);
  4409. }
  4410. else if (api.isComment(node)) {
  4411. text = api.getTextContent(node);
  4412. return vnode_1.default('!', {}, [], text, node);
  4413. }
  4414. else {
  4415. return vnode_1.default('', {}, [], undefined, undefined);
  4416. }
  4417. }
  4418. exports.toVNode = toVNode;
  4419. exports.default = toVNode;
  4420. //# sourceMappingURL=tovnode.js.map
  4421.  
  4422. /***/ }),
  4423. /* 49 */
  4424. /***/ (function(module, exports, __webpack_require__) {
  4425.  
  4426. "use strict";
  4427.  
  4428. Object.defineProperty(exports, "__esModule", { value: true });
  4429. var h_1 = __webpack_require__(4);
  4430. var classNameFromVNode_1 = __webpack_require__(50);
  4431. var selectorParser_1 = __webpack_require__(21);
  4432. var VNodeWrapper = (function () {
  4433. function VNodeWrapper(rootElement) {
  4434. this.rootElement = rootElement;
  4435. }
  4436. VNodeWrapper.prototype.call = function (vnode) {
  4437. if (vnode === null) {
  4438. return this.wrap([]);
  4439. }
  4440. var _a = selectorParser_1.selectorParser(vnode), selTagName = _a.tagName, selId = _a.id;
  4441. var vNodeClassName = classNameFromVNode_1.classNameFromVNode(vnode);
  4442. var vNodeData = vnode.data || {};
  4443. var vNodeDataProps = vNodeData.props || {};
  4444. var _b = vNodeDataProps.id, vNodeId = _b === void 0 ? selId : _b;
  4445. var isVNodeAndRootElementIdentical = typeof vNodeId === 'string' &&
  4446. vNodeId.toUpperCase() === this.rootElement.id.toUpperCase() &&
  4447. selTagName.toUpperCase() === this.rootElement.tagName.toUpperCase() &&
  4448. vNodeClassName.toUpperCase() === this.rootElement.className.toUpperCase();
  4449. if (isVNodeAndRootElementIdentical) {
  4450. return vnode;
  4451. }
  4452. return this.wrap([vnode]);
  4453. };
  4454. VNodeWrapper.prototype.wrap = function (children) {
  4455. var _a = this.rootElement, tagName = _a.tagName, id = _a.id, className = _a.className;
  4456. var selId = id ? "#" + id : '';
  4457. var selClass = className ? "." + className.split(" ").join(".") : '';
  4458. return h_1.h("" + tagName.toLowerCase() + selId + selClass, {}, children);
  4459. };
  4460. return VNodeWrapper;
  4461. }());
  4462. exports.VNodeWrapper = VNodeWrapper;
  4463. //# sourceMappingURL=VNodeWrapper.js.map
  4464.  
  4465. /***/ }),
  4466. /* 50 */
  4467. /***/ (function(module, exports, __webpack_require__) {
  4468.  
  4469. "use strict";
  4470.  
  4471. var selectorParser_1 = __webpack_require__(21);
  4472. function classNameFromVNode(vNode) {
  4473. var _a = selectorParser_1.selectorParser(vNode).className, cn = _a === void 0 ? '' : _a;
  4474. if (!vNode.data) {
  4475. return cn;
  4476. }
  4477. var _b = vNode.data, dataClass = _b.class, props = _b.props;
  4478. if (dataClass) {
  4479. var c = Object.keys(dataClass)
  4480. .filter(function (cl) { return dataClass[cl]; });
  4481. cn += " " + c.join(" ");
  4482. }
  4483. if (props && props.className) {
  4484. cn += " " + props.className;
  4485. }
  4486. return cn && cn.trim();
  4487. }
  4488. exports.classNameFromVNode = classNameFromVNode;
  4489. //# sourceMappingURL=classNameFromVNode.js.map
  4490.  
  4491. /***/ }),
  4492. /* 51 */
  4493. /***/ (function(module, exports, __webpack_require__) {
  4494.  
  4495. "use strict";
  4496.  
  4497. Object.defineProperty(exports, "__esModule", { value: true });
  4498. var class_1 = __webpack_require__(52);
  4499. exports.ClassModule = class_1.default;
  4500. var props_1 = __webpack_require__(53);
  4501. exports.PropsModule = props_1.default;
  4502. var attributes_1 = __webpack_require__(54);
  4503. exports.AttrsModule = attributes_1.default;
  4504. var style_1 = __webpack_require__(55);
  4505. exports.StyleModule = style_1.default;
  4506. var dataset_1 = __webpack_require__(56);
  4507. exports.DatasetModule = dataset_1.default;
  4508. var modules = [
  4509. style_1.default,
  4510. class_1.default,
  4511. props_1.default,
  4512. attributes_1.default,
  4513. dataset_1.default,
  4514. ];
  4515. exports.default = modules;
  4516. //# sourceMappingURL=modules.js.map
  4517.  
  4518. /***/ }),
  4519. /* 52 */
  4520. /***/ (function(module, exports, __webpack_require__) {
  4521.  
  4522. "use strict";
  4523.  
  4524. Object.defineProperty(exports, "__esModule", { value: true });
  4525. function updateClass(oldVnode, vnode) {
  4526. var cur, name, elm = vnode.elm, oldClass = oldVnode.data.class, klass = vnode.data.class;
  4527. if (!oldClass && !klass)
  4528. return;
  4529. if (oldClass === klass)
  4530. return;
  4531. oldClass = oldClass || {};
  4532. klass = klass || {};
  4533. for (name in oldClass) {
  4534. if (!klass[name]) {
  4535. elm.classList.remove(name);
  4536. }
  4537. }
  4538. for (name in klass) {
  4539. cur = klass[name];
  4540. if (cur !== oldClass[name]) {
  4541. elm.classList[cur ? 'add' : 'remove'](name);
  4542. }
  4543. }
  4544. }
  4545. exports.classModule = { create: updateClass, update: updateClass };
  4546. exports.default = exports.classModule;
  4547. //# sourceMappingURL=class.js.map
  4548.  
  4549. /***/ }),
  4550. /* 53 */
  4551. /***/ (function(module, exports, __webpack_require__) {
  4552.  
  4553. "use strict";
  4554.  
  4555. Object.defineProperty(exports, "__esModule", { value: true });
  4556. function updateProps(oldVnode, vnode) {
  4557. var key, cur, old, elm = vnode.elm, oldProps = oldVnode.data.props, props = vnode.data.props;
  4558. if (!oldProps && !props)
  4559. return;
  4560. if (oldProps === props)
  4561. return;
  4562. oldProps = oldProps || {};
  4563. props = props || {};
  4564. for (key in oldProps) {
  4565. if (!props[key]) {
  4566. delete elm[key];
  4567. }
  4568. }
  4569. for (key in props) {
  4570. cur = props[key];
  4571. old = oldProps[key];
  4572. if (old !== cur && (key !== 'value' || elm[key] !== cur)) {
  4573. elm[key] = cur;
  4574. }
  4575. }
  4576. }
  4577. exports.propsModule = { create: updateProps, update: updateProps };
  4578. exports.default = exports.propsModule;
  4579. //# sourceMappingURL=props.js.map
  4580.  
  4581. /***/ }),
  4582. /* 54 */
  4583. /***/ (function(module, exports, __webpack_require__) {
  4584.  
  4585. "use strict";
  4586.  
  4587. Object.defineProperty(exports, "__esModule", { value: true });
  4588. var booleanAttrs = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "compact", "controls", "declare",
  4589. "default", "defaultchecked", "defaultmuted", "defaultselected", "defer", "disabled", "draggable",
  4590. "enabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "itemscope", "loop", "multiple",
  4591. "muted", "nohref", "noresize", "noshade", "novalidate", "nowrap", "open", "pauseonexit", "readonly",
  4592. "required", "reversed", "scoped", "seamless", "selected", "sortable", "spellcheck", "translate",
  4593. "truespeed", "typemustmatch", "visible"];
  4594. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4595. var xmlNS = 'http://www.w3.org/XML/1998/namespace';
  4596. var colonChar = 58;
  4597. var xChar = 120;
  4598. var booleanAttrsDict = Object.create(null);
  4599. for (var i = 0, len = booleanAttrs.length; i < len; i++) {
  4600. booleanAttrsDict[booleanAttrs[i]] = true;
  4601. }
  4602. function updateAttrs(oldVnode, vnode) {
  4603. var key, elm = vnode.elm, oldAttrs = oldVnode.data.attrs, attrs = vnode.data.attrs;
  4604. if (!oldAttrs && !attrs)
  4605. return;
  4606. if (oldAttrs === attrs)
  4607. return;
  4608. oldAttrs = oldAttrs || {};
  4609. attrs = attrs || {};
  4610. // update modified attributes, add new attributes
  4611. for (key in attrs) {
  4612. var cur = attrs[key];
  4613. var old = oldAttrs[key];
  4614. if (old !== cur) {
  4615. if (booleanAttrsDict[key]) {
  4616. if (cur) {
  4617. elm.setAttribute(key, "");
  4618. }
  4619. else {
  4620. elm.removeAttribute(key);
  4621. }
  4622. }
  4623. else {
  4624. if (key.charCodeAt(0) !== xChar) {
  4625. elm.setAttribute(key, cur);
  4626. }
  4627. else if (key.charCodeAt(3) === colonChar) {
  4628. // Assume xml namespace
  4629. elm.setAttributeNS(xmlNS, key, cur);
  4630. }
  4631. else if (key.charCodeAt(5) === colonChar) {
  4632. // Assume xlink namespace
  4633. elm.setAttributeNS(xlinkNS, key, cur);
  4634. }
  4635. else {
  4636. elm.setAttribute(key, cur);
  4637. }
  4638. }
  4639. }
  4640. }
  4641. // remove removed attributes
  4642. // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
  4643. // the other option is to remove all attributes with value == undefined
  4644. for (key in oldAttrs) {
  4645. if (!(key in attrs)) {
  4646. elm.removeAttribute(key);
  4647. }
  4648. }
  4649. }
  4650. exports.attributesModule = { create: updateAttrs, update: updateAttrs };
  4651. exports.default = exports.attributesModule;
  4652. //# sourceMappingURL=attributes.js.map
  4653.  
  4654. /***/ }),
  4655. /* 55 */
  4656. /***/ (function(module, exports, __webpack_require__) {
  4657.  
  4658. "use strict";
  4659.  
  4660. Object.defineProperty(exports, "__esModule", { value: true });
  4661. var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout;
  4662. var nextFrame = function (fn) { raf(function () { raf(fn); }); };
  4663. function setNextFrame(obj, prop, val) {
  4664. nextFrame(function () { obj[prop] = val; });
  4665. }
  4666. function updateStyle(oldVnode, vnode) {
  4667. var cur, name, elm = vnode.elm, oldStyle = oldVnode.data.style, style = vnode.data.style;
  4668. if (!oldStyle && !style)
  4669. return;
  4670. if (oldStyle === style)
  4671. return;
  4672. oldStyle = oldStyle || {};
  4673. style = style || {};
  4674. var oldHasDel = 'delayed' in oldStyle;
  4675. for (name in oldStyle) {
  4676. if (!style[name]) {
  4677. if (name[0] === '-' && name[1] === '-') {
  4678. elm.style.removeProperty(name);
  4679. }
  4680. else {
  4681. elm.style[name] = '';
  4682. }
  4683. }
  4684. }
  4685. for (name in style) {
  4686. cur = style[name];
  4687. if (name === 'delayed' && style.delayed) {
  4688. for (var name2 in style.delayed) {
  4689. cur = style.delayed[name2];
  4690. if (!oldHasDel || cur !== oldStyle.delayed[name2]) {
  4691. setNextFrame(elm.style, name2, cur);
  4692. }
  4693. }
  4694. }
  4695. else if (name !== 'remove' && cur !== oldStyle[name]) {
  4696. if (name[0] === '-' && name[1] === '-') {
  4697. elm.style.setProperty(name, cur);
  4698. }
  4699. else {
  4700. elm.style[name] = cur;
  4701. }
  4702. }
  4703. }
  4704. }
  4705. function applyDestroyStyle(vnode) {
  4706. var style, name, elm = vnode.elm, s = vnode.data.style;
  4707. if (!s || !(style = s.destroy))
  4708. return;
  4709. for (name in style) {
  4710. elm.style[name] = style[name];
  4711. }
  4712. }
  4713. function applyRemoveStyle(vnode, rm) {
  4714. var s = vnode.data.style;
  4715. if (!s || !s.remove) {
  4716. rm();
  4717. return;
  4718. }
  4719. var name, elm = vnode.elm, i = 0, compStyle, style = s.remove, amount = 0, applied = [];
  4720. for (name in style) {
  4721. applied.push(name);
  4722. elm.style[name] = style[name];
  4723. }
  4724. compStyle = getComputedStyle(elm);
  4725. var props = compStyle['transition-property'].split(', ');
  4726. for (; i < props.length; ++i) {
  4727. if (applied.indexOf(props[i]) !== -1)
  4728. amount++;
  4729. }
  4730. elm.addEventListener('transitionend', function (ev) {
  4731. if (ev.target === elm)
  4732. --amount;
  4733. if (amount === 0)
  4734. rm();
  4735. });
  4736. }
  4737. exports.styleModule = {
  4738. create: updateStyle,
  4739. update: updateStyle,
  4740. destroy: applyDestroyStyle,
  4741. remove: applyRemoveStyle
  4742. };
  4743. exports.default = exports.styleModule;
  4744. //# sourceMappingURL=style.js.map
  4745.  
  4746. /***/ }),
  4747. /* 56 */
  4748. /***/ (function(module, exports, __webpack_require__) {
  4749.  
  4750. "use strict";
  4751.  
  4752. Object.defineProperty(exports, "__esModule", { value: true });
  4753. var CAPS_REGEX = /[A-Z]/g;
  4754. function updateDataset(oldVnode, vnode) {
  4755. var elm = vnode.elm, oldDataset = oldVnode.data.dataset, dataset = vnode.data.dataset, key;
  4756. if (!oldDataset && !dataset)
  4757. return;
  4758. if (oldDataset === dataset)
  4759. return;
  4760. oldDataset = oldDataset || {};
  4761. dataset = dataset || {};
  4762. var d = elm.dataset;
  4763. for (key in oldDataset) {
  4764. if (!dataset[key]) {
  4765. if (d) {
  4766. delete d[key];
  4767. }
  4768. else {
  4769. elm.removeAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase());
  4770. }
  4771. }
  4772. }
  4773. for (key in dataset) {
  4774. if (oldDataset[key] !== dataset[key]) {
  4775. if (d) {
  4776. d[key] = dataset[key];
  4777. }
  4778. else {
  4779. elm.setAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase(), dataset[key]);
  4780. }
  4781. }
  4782. }
  4783. }
  4784. exports.datasetModule = { create: updateDataset, update: updateDataset };
  4785. exports.default = exports.datasetModule;
  4786. //# sourceMappingURL=dataset.js.map
  4787.  
  4788. /***/ }),
  4789. /* 57 */
  4790. /***/ (function(module, exports, __webpack_require__) {
  4791.  
  4792. "use strict";
  4793.  
  4794. Object.defineProperty(exports, "__esModule", { value: true });
  4795. var MapPolyfill = __webpack_require__(22);
  4796. var IsolateModule = (function () {
  4797. function IsolateModule() {
  4798. this.elementsByFullScope = new MapPolyfill();
  4799. this.delegatorsByFullScope = new MapPolyfill();
  4800. this.fullScopesBeingUpdated = [];
  4801. }
  4802. IsolateModule.prototype.cleanupVNode = function (_a) {
  4803. var data = _a.data, elm = _a.elm;
  4804. var fullScope = (data || {}).isolate || '';
  4805. var isCurrentElm = this.elementsByFullScope.get(fullScope) === elm;
  4806. var isScopeBeingUpdated = this.fullScopesBeingUpdated.indexOf(fullScope) >= 0;
  4807. if (fullScope && isCurrentElm && !isScopeBeingUpdated) {
  4808. this.elementsByFullScope.delete(fullScope);
  4809. this.delegatorsByFullScope.delete(fullScope);
  4810. }
  4811. };
  4812. IsolateModule.prototype.getElement = function (fullScope) {
  4813. return this.elementsByFullScope.get(fullScope);
  4814. };
  4815. IsolateModule.prototype.getFullScope = function (elm) {
  4816. var iterator = this.elementsByFullScope.entries();
  4817. for (var result = iterator.next(); !!result.value; result = iterator.next()) {
  4818. var _a = result.value, fullScope = _a[0], element = _a[1];
  4819. if (elm === element) {
  4820. return fullScope;
  4821. }
  4822. }
  4823. return '';
  4824. };
  4825. IsolateModule.prototype.addEventDelegator = function (fullScope, eventDelegator) {
  4826. var delegators = this.delegatorsByFullScope.get(fullScope);
  4827. if (!delegators) {
  4828. delegators = [];
  4829. this.delegatorsByFullScope.set(fullScope, delegators);
  4830. }
  4831. delegators[delegators.length] = eventDelegator;
  4832. };
  4833. IsolateModule.prototype.reset = function () {
  4834. this.elementsByFullScope.clear();
  4835. this.delegatorsByFullScope.clear();
  4836. this.fullScopesBeingUpdated = [];
  4837. };
  4838. IsolateModule.prototype.createModule = function () {
  4839. var self = this;
  4840. return {
  4841. create: function (oldVNode, vNode) {
  4842. var _a = oldVNode.data, oldData = _a === void 0 ? {} : _a;
  4843. var elm = vNode.elm, _b = vNode.data, data = _b === void 0 ? {} : _b;
  4844. var oldFullScope = oldData.isolate || '';
  4845. var fullScope = data.isolate || '';
  4846. // Update data structures with the newly-created element
  4847. if (fullScope) {
  4848. self.fullScopesBeingUpdated.push(fullScope);
  4849. if (oldFullScope) {
  4850. self.elementsByFullScope.delete(oldFullScope);
  4851. }
  4852. self.elementsByFullScope.set(fullScope, elm);
  4853. // Update delegators for this scope
  4854. var delegators = self.delegatorsByFullScope.get(fullScope);
  4855. if (delegators) {
  4856. var len = delegators.length;
  4857. for (var i = 0; i < len; ++i) {
  4858. delegators[i].updateOrigin(elm);
  4859. }
  4860. }
  4861. }
  4862. if (oldFullScope && !fullScope) {
  4863. self.elementsByFullScope.delete(fullScope);
  4864. }
  4865. },
  4866. update: function (oldVNode, vNode) {
  4867. var _a = oldVNode.data, oldData = _a === void 0 ? {} : _a;
  4868. var elm = vNode.elm, _b = vNode.data, data = _b === void 0 ? {} : _b;
  4869. var oldFullScope = oldData.isolate || '';
  4870. var fullScope = data.isolate || '';
  4871. // Same element, but different scope, so update the data structures
  4872. if (fullScope && fullScope !== oldFullScope) {
  4873. if (oldFullScope) {
  4874. self.elementsByFullScope.delete(oldFullScope);
  4875. }
  4876. self.elementsByFullScope.set(fullScope, elm);
  4877. var delegators = self.delegatorsByFullScope.get(oldFullScope);
  4878. if (delegators) {
  4879. self.delegatorsByFullScope.delete(oldFullScope);
  4880. self.delegatorsByFullScope.set(fullScope, delegators);
  4881. }
  4882. }
  4883. // Same element, but lost the scope, so update the data structures
  4884. if (oldFullScope && !fullScope) {
  4885. self.elementsByFullScope.delete(oldFullScope);
  4886. self.delegatorsByFullScope.delete(oldFullScope);
  4887. }
  4888. },
  4889. destroy: function (vNode) {
  4890. self.cleanupVNode(vNode);
  4891. },
  4892. remove: function (vNode, cb) {
  4893. self.cleanupVNode(vNode);
  4894. cb();
  4895. },
  4896. post: function () {
  4897. self.fullScopesBeingUpdated = [];
  4898. },
  4899. };
  4900. };
  4901. return IsolateModule;
  4902. }());
  4903. exports.IsolateModule = IsolateModule;
  4904. //# sourceMappingURL=IsolateModule.js.map
  4905.  
  4906. /***/ }),
  4907. /* 58 */
  4908. /***/ (function(module, exports, __webpack_require__) {
  4909.  
  4910. "use strict";
  4911.  
  4912.  
  4913. module.exports = function () {
  4914. var map, iterator, result;
  4915. if (typeof Map !== 'function') return false;
  4916. try {
  4917. // WebKit doesn't support arguments and crashes
  4918. map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]);
  4919. } catch (e) {
  4920. return false;
  4921. }
  4922. if (String(map) !== '[object Map]') return false;
  4923. if (map.size !== 3) return false;
  4924. if (typeof map.clear !== 'function') return false;
  4925. if (typeof map.delete !== 'function') return false;
  4926. if (typeof map.entries !== 'function') return false;
  4927. if (typeof map.forEach !== 'function') return false;
  4928. if (typeof map.get !== 'function') return false;
  4929. if (typeof map.has !== 'function') return false;
  4930. if (typeof map.keys !== 'function') return false;
  4931. if (typeof map.set !== 'function') return false;
  4932. if (typeof map.values !== 'function') return false;
  4933.  
  4934. iterator = map.entries();
  4935. result = iterator.next();
  4936. if (result.done !== false) return false;
  4937. if (!result.value) return false;
  4938. if (result.value[0] !== 'raz') return false;
  4939. if (result.value[1] !== 'one') return false;
  4940.  
  4941. return true;
  4942. };
  4943.  
  4944.  
  4945. /***/ }),
  4946. /* 59 */
  4947. /***/ (function(module, exports, __webpack_require__) {
  4948.  
  4949. "use strict";
  4950.  
  4951.  
  4952. var clear = __webpack_require__(23)
  4953. , eIndexOf = __webpack_require__(60)
  4954. , setPrototypeOf = __webpack_require__(10)
  4955. , callable = __webpack_require__(1)
  4956. , validValue = __webpack_require__(0)
  4957. , d = __webpack_require__(3)
  4958. , ee = __webpack_require__(78)
  4959. , Symbol = __webpack_require__(5)
  4960. , iterator = __webpack_require__(30)
  4961. , forOf = __webpack_require__(84)
  4962. , Iterator = __webpack_require__(97)
  4963. , isNative = __webpack_require__(100)
  4964.  
  4965. , call = Function.prototype.call
  4966. , defineProperties = Object.defineProperties, getPrototypeOf = Object.getPrototypeOf
  4967. , MapPoly;
  4968.  
  4969. module.exports = MapPoly = function (/*iterable*/) {
  4970. var iterable = arguments[0], keys, values, self;
  4971. if (!(this instanceof MapPoly)) throw new TypeError('Constructor requires \'new\'');
  4972. if (isNative && setPrototypeOf && (Map !== MapPoly)) {
  4973. self = setPrototypeOf(new Map(), getPrototypeOf(this));
  4974. } else {
  4975. self = this;
  4976. }
  4977. if (iterable != null) iterator(iterable);
  4978. defineProperties(self, {
  4979. __mapKeysData__: d('c', keys = []),
  4980. __mapValuesData__: d('c', values = [])
  4981. });
  4982. if (!iterable) return self;
  4983. forOf(iterable, function (value) {
  4984. var key = validValue(value)[0];
  4985. value = value[1];
  4986. if (eIndexOf.call(keys, key) !== -1) return;
  4987. keys.push(key);
  4988. values.push(value);
  4989. }, self);
  4990. return self;
  4991. };
  4992.  
  4993. if (isNative) {
  4994. if (setPrototypeOf) setPrototypeOf(MapPoly, Map);
  4995. MapPoly.prototype = Object.create(Map.prototype, {
  4996. constructor: d(MapPoly)
  4997. });
  4998. }
  4999.  
  5000. ee(defineProperties(MapPoly.prototype, {
  5001. clear: d(function () {
  5002. if (!this.__mapKeysData__.length) return;
  5003. clear.call(this.__mapKeysData__);
  5004. clear.call(this.__mapValuesData__);
  5005. this.emit('_clear');
  5006. }),
  5007. delete: d(function (key) {
  5008. var index = eIndexOf.call(this.__mapKeysData__, key);
  5009. if (index === -1) return false;
  5010. this.__mapKeysData__.splice(index, 1);
  5011. this.__mapValuesData__.splice(index, 1);
  5012. this.emit('_delete', index, key);
  5013. return true;
  5014. }),
  5015. entries: d(function () { return new Iterator(this, 'key+value'); }),
  5016. forEach: d(function (cb/*, thisArg*/) {
  5017. var thisArg = arguments[1], iterator, result;
  5018. callable(cb);
  5019. iterator = this.entries();
  5020. result = iterator._next();
  5021. while (result !== undefined) {
  5022. call.call(cb, thisArg, this.__mapValuesData__[result],
  5023. this.__mapKeysData__[result], this);
  5024. result = iterator._next();
  5025. }
  5026. }),
  5027. get: d(function (key) {
  5028. var index = eIndexOf.call(this.__mapKeysData__, key);
  5029. if (index === -1) return;
  5030. return this.__mapValuesData__[index];
  5031. }),
  5032. has: d(function (key) {
  5033. return (eIndexOf.call(this.__mapKeysData__, key) !== -1);
  5034. }),
  5035. keys: d(function () { return new Iterator(this, 'key'); }),
  5036. set: d(function (key, value) {
  5037. var index = eIndexOf.call(this.__mapKeysData__, key), emit;
  5038. if (index === -1) {
  5039. index = this.__mapKeysData__.push(key) - 1;
  5040. emit = true;
  5041. }
  5042. this.__mapValuesData__[index] = value;
  5043. if (emit) this.emit('_add', index, key);
  5044. return this;
  5045. }),
  5046. size: d.gs(function () { return this.__mapKeysData__.length; }),
  5047. values: d(function () { return new Iterator(this, 'value'); }),
  5048. toString: d(function () { return '[object Map]'; })
  5049. }));
  5050. Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () {
  5051. return this.entries();
  5052. }));
  5053. Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map'));
  5054.  
  5055.  
  5056. /***/ }),
  5057. /* 60 */
  5058. /***/ (function(module, exports, __webpack_require__) {
  5059.  
  5060. "use strict";
  5061.  
  5062.  
  5063. var numberIsNaN = __webpack_require__(61)
  5064. , toPosInt = __webpack_require__(25)
  5065. , value = __webpack_require__(0)
  5066. , indexOf = Array.prototype.indexOf
  5067. , objHasOwnProperty = Object.prototype.hasOwnProperty
  5068. , abs = Math.abs
  5069. , floor = Math.floor;
  5070.  
  5071. module.exports = function (searchElement /*, fromIndex*/) {
  5072. var i, length, fromIndex, val;
  5073. if (!numberIsNaN(searchElement)) return indexOf.apply(this, arguments);
  5074.  
  5075. length = toPosInt(value(this).length);
  5076. fromIndex = arguments[1];
  5077. if (isNaN(fromIndex)) fromIndex = 0;
  5078. else if (fromIndex >= 0) fromIndex = floor(fromIndex);
  5079. else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
  5080.  
  5081. for (i = fromIndex; i < length; ++i) {
  5082. if (objHasOwnProperty.call(this, i)) {
  5083. val = this[i];
  5084. if (numberIsNaN(val)) return i; // Jslint: ignore
  5085. }
  5086. }
  5087. return -1;
  5088. };
  5089.  
  5090.  
  5091. /***/ }),
  5092. /* 61 */
  5093. /***/ (function(module, exports, __webpack_require__) {
  5094.  
  5095. "use strict";
  5096.  
  5097.  
  5098. module.exports = __webpack_require__(62)()
  5099. ? Number.isNaN
  5100. : __webpack_require__(63);
  5101.  
  5102.  
  5103. /***/ }),
  5104. /* 62 */
  5105. /***/ (function(module, exports, __webpack_require__) {
  5106.  
  5107. "use strict";
  5108.  
  5109.  
  5110. module.exports = function () {
  5111. var numberIsNaN = Number.isNaN;
  5112. if (typeof numberIsNaN !== "function") return false;
  5113. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  5114. };
  5115.  
  5116.  
  5117. /***/ }),
  5118. /* 63 */
  5119. /***/ (function(module, exports, __webpack_require__) {
  5120.  
  5121. "use strict";
  5122.  
  5123.  
  5124. module.exports = function (value) {
  5125. // eslint-disable-next-line no-self-compare
  5126. return value !== value;
  5127. };
  5128.  
  5129.  
  5130. /***/ }),
  5131. /* 64 */
  5132. /***/ (function(module, exports, __webpack_require__) {
  5133.  
  5134. "use strict";
  5135.  
  5136.  
  5137. var sign = __webpack_require__(65)
  5138.  
  5139. , abs = Math.abs, floor = Math.floor;
  5140.  
  5141. module.exports = function (value) {
  5142. if (isNaN(value)) return 0;
  5143. value = Number(value);
  5144. if ((value === 0) || !isFinite(value)) return value;
  5145. return sign(value) * floor(abs(value));
  5146. };
  5147.  
  5148.  
  5149. /***/ }),
  5150. /* 65 */
  5151. /***/ (function(module, exports, __webpack_require__) {
  5152.  
  5153. "use strict";
  5154.  
  5155.  
  5156. module.exports = __webpack_require__(66)()
  5157. ? Math.sign
  5158. : __webpack_require__(67);
  5159.  
  5160.  
  5161. /***/ }),
  5162. /* 66 */
  5163. /***/ (function(module, exports, __webpack_require__) {
  5164.  
  5165. "use strict";
  5166.  
  5167.  
  5168. module.exports = function () {
  5169. var sign = Math.sign;
  5170. if (typeof sign !== "function") return false;
  5171. return (sign(10) === 1) && (sign(-20) === -1);
  5172. };
  5173.  
  5174.  
  5175. /***/ }),
  5176. /* 67 */
  5177. /***/ (function(module, exports, __webpack_require__) {
  5178.  
  5179. "use strict";
  5180.  
  5181.  
  5182. module.exports = function (value) {
  5183. value = Number(value);
  5184. if (isNaN(value) || (value === 0)) return value;
  5185. return value > 0 ? 1 : -1;
  5186. };
  5187.  
  5188.  
  5189. /***/ }),
  5190. /* 68 */
  5191. /***/ (function(module, exports, __webpack_require__) {
  5192.  
  5193. "use strict";
  5194.  
  5195.  
  5196. var isValue = __webpack_require__(8);
  5197.  
  5198. var map = { function: true, object: true };
  5199.  
  5200. module.exports = function (value) {
  5201. return (isValue(value) && map[typeof value]) || false;
  5202. };
  5203.  
  5204.  
  5205. /***/ }),
  5206. /* 69 */
  5207. /***/ (function(module, exports, __webpack_require__) {
  5208.  
  5209. "use strict";
  5210. // Workaround for http://code.google.com/p/v8/issues/detail?id=2804
  5211.  
  5212.  
  5213.  
  5214. var create = Object.create, shim;
  5215.  
  5216. if (!__webpack_require__(26)()) {
  5217. shim = __webpack_require__(27);
  5218. }
  5219.  
  5220. module.exports = (function () {
  5221. var nullObject, polyProps, desc;
  5222. if (!shim) return create;
  5223. if (shim.level !== 1) return create;
  5224.  
  5225. nullObject = {};
  5226. polyProps = {};
  5227. desc = {
  5228. configurable: false,
  5229. enumerable: false,
  5230. writable: true,
  5231. value: undefined
  5232. };
  5233. Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
  5234. if (name === "__proto__") {
  5235. polyProps[name] = {
  5236. configurable: true,
  5237. enumerable: false,
  5238. writable: true,
  5239. value: undefined
  5240. };
  5241. return;
  5242. }
  5243. polyProps[name] = desc;
  5244. });
  5245. Object.defineProperties(nullObject, polyProps);
  5246.  
  5247. Object.defineProperty(shim, "nullPolyfill", {
  5248. configurable: false,
  5249. enumerable: false,
  5250. writable: false,
  5251. value: nullObject
  5252. });
  5253.  
  5254. return function (prototype, props) {
  5255. return create(prototype === null ? nullObject : prototype, props);
  5256. };
  5257. }());
  5258.  
  5259.  
  5260. /***/ }),
  5261. /* 70 */
  5262. /***/ (function(module, exports, __webpack_require__) {
  5263.  
  5264. "use strict";
  5265.  
  5266.  
  5267. module.exports = function () {
  5268. var assign = Object.assign, obj;
  5269. if (typeof assign !== "function") return false;
  5270. obj = { foo: "raz" };
  5271. assign(obj, { bar: "dwa" }, { trzy: "trzy" });
  5272. return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
  5273. };
  5274.  
  5275.  
  5276. /***/ }),
  5277. /* 71 */
  5278. /***/ (function(module, exports, __webpack_require__) {
  5279.  
  5280. "use strict";
  5281.  
  5282.  
  5283. var keys = __webpack_require__(72)
  5284. , value = __webpack_require__(0)
  5285. , max = Math.max;
  5286.  
  5287. module.exports = function (dest, src /*, …srcn*/) {
  5288. var error, i, length = max(arguments.length, 2), assign;
  5289. dest = Object(value(dest));
  5290. assign = function (key) {
  5291. try {
  5292. dest[key] = src[key];
  5293. } catch (e) {
  5294. if (!error) error = e;
  5295. }
  5296. };
  5297. for (i = 1; i < length; ++i) {
  5298. src = arguments[i];
  5299. keys(src).forEach(assign);
  5300. }
  5301. if (error !== undefined) throw error;
  5302. return dest;
  5303. };
  5304.  
  5305.  
  5306. /***/ }),
  5307. /* 72 */
  5308. /***/ (function(module, exports, __webpack_require__) {
  5309.  
  5310. "use strict";
  5311.  
  5312.  
  5313. module.exports = __webpack_require__(73)()
  5314. ? Object.keys
  5315. : __webpack_require__(74);
  5316.  
  5317.  
  5318. /***/ }),
  5319. /* 73 */
  5320. /***/ (function(module, exports, __webpack_require__) {
  5321.  
  5322. "use strict";
  5323.  
  5324.  
  5325. module.exports = function () {
  5326. try {
  5327. Object.keys("primitive");
  5328. return true;
  5329. } catch (e) {
  5330. return false;
  5331. }
  5332. };
  5333.  
  5334.  
  5335. /***/ }),
  5336. /* 74 */
  5337. /***/ (function(module, exports, __webpack_require__) {
  5338.  
  5339. "use strict";
  5340.  
  5341.  
  5342. var isValue = __webpack_require__(8);
  5343.  
  5344. var keys = Object.keys;
  5345.  
  5346. module.exports = function (object) {
  5347. return keys(isValue(object) ? Object(object) : object);
  5348. };
  5349.  
  5350.  
  5351. /***/ }),
  5352. /* 75 */
  5353. /***/ (function(module, exports, __webpack_require__) {
  5354.  
  5355. "use strict";
  5356. // Deprecated
  5357.  
  5358.  
  5359.  
  5360. module.exports = function (obj) {
  5361. return typeof obj === "function";
  5362. };
  5363.  
  5364.  
  5365. /***/ }),
  5366. /* 76 */
  5367. /***/ (function(module, exports, __webpack_require__) {
  5368.  
  5369. "use strict";
  5370.  
  5371.  
  5372. var str = "razdwatrzy";
  5373.  
  5374. module.exports = function () {
  5375. if (typeof str.contains !== "function") return false;
  5376. return (str.contains("dwa") === true) && (str.contains("foo") === false);
  5377. };
  5378.  
  5379.  
  5380. /***/ }),
  5381. /* 77 */
  5382. /***/ (function(module, exports, __webpack_require__) {
  5383.  
  5384. "use strict";
  5385.  
  5386.  
  5387. var indexOf = String.prototype.indexOf;
  5388.  
  5389. module.exports = function (searchString/*, position*/) {
  5390. return indexOf.call(this, searchString, arguments[1]) > -1;
  5391. };
  5392.  
  5393.  
  5394. /***/ }),
  5395. /* 78 */
  5396. /***/ (function(module, exports, __webpack_require__) {
  5397.  
  5398. "use strict";
  5399.  
  5400.  
  5401. var d = __webpack_require__(3)
  5402. , callable = __webpack_require__(1)
  5403.  
  5404. , apply = Function.prototype.apply, call = Function.prototype.call
  5405. , create = Object.create, defineProperty = Object.defineProperty
  5406. , defineProperties = Object.defineProperties
  5407. , hasOwnProperty = Object.prototype.hasOwnProperty
  5408. , descriptor = { configurable: true, enumerable: false, writable: true }
  5409.  
  5410. , on, once, off, emit, methods, descriptors, base;
  5411.  
  5412. on = function (type, listener) {
  5413. var data;
  5414.  
  5415. callable(listener);
  5416.  
  5417. if (!hasOwnProperty.call(this, '__ee__')) {
  5418. data = descriptor.value = create(null);
  5419. defineProperty(this, '__ee__', descriptor);
  5420. descriptor.value = null;
  5421. } else {
  5422. data = this.__ee__;
  5423. }
  5424. if (!data[type]) data[type] = listener;
  5425. else if (typeof data[type] === 'object') data[type].push(listener);
  5426. else data[type] = [data[type], listener];
  5427.  
  5428. return this;
  5429. };
  5430.  
  5431. once = function (type, listener) {
  5432. var once, self;
  5433.  
  5434. callable(listener);
  5435. self = this;
  5436. on.call(this, type, once = function () {
  5437. off.call(self, type, once);
  5438. apply.call(listener, this, arguments);
  5439. });
  5440.  
  5441. once.__eeOnceListener__ = listener;
  5442. return this;
  5443. };
  5444.  
  5445. off = function (type, listener) {
  5446. var data, listeners, candidate, i;
  5447.  
  5448. callable(listener);
  5449.  
  5450. if (!hasOwnProperty.call(this, '__ee__')) return this;
  5451. data = this.__ee__;
  5452. if (!data[type]) return this;
  5453. listeners = data[type];
  5454.  
  5455. if (typeof listeners === 'object') {
  5456. for (i = 0; (candidate = listeners[i]); ++i) {
  5457. if ((candidate === listener) ||
  5458. (candidate.__eeOnceListener__ === listener)) {
  5459. if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
  5460. else listeners.splice(i, 1);
  5461. }
  5462. }
  5463. } else {
  5464. if ((listeners === listener) ||
  5465. (listeners.__eeOnceListener__ === listener)) {
  5466. delete data[type];
  5467. }
  5468. }
  5469.  
  5470. return this;
  5471. };
  5472.  
  5473. emit = function (type) {
  5474. var i, l, listener, listeners, args;
  5475.  
  5476. if (!hasOwnProperty.call(this, '__ee__')) return;
  5477. listeners = this.__ee__[type];
  5478. if (!listeners) return;
  5479.  
  5480. if (typeof listeners === 'object') {
  5481. l = arguments.length;
  5482. args = new Array(l - 1);
  5483. for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
  5484.  
  5485. listeners = listeners.slice();
  5486. for (i = 0; (listener = listeners[i]); ++i) {
  5487. apply.call(listener, this, args);
  5488. }
  5489. } else {
  5490. switch (arguments.length) {
  5491. case 1:
  5492. call.call(listeners, this);
  5493. break;
  5494. case 2:
  5495. call.call(listeners, this, arguments[1]);
  5496. break;
  5497. case 3:
  5498. call.call(listeners, this, arguments[1], arguments[2]);
  5499. break;
  5500. default:
  5501. l = arguments.length;
  5502. args = new Array(l - 1);
  5503. for (i = 1; i < l; ++i) {
  5504. args[i - 1] = arguments[i];
  5505. }
  5506. apply.call(listeners, this, args);
  5507. }
  5508. }
  5509. };
  5510.  
  5511. methods = {
  5512. on: on,
  5513. once: once,
  5514. off: off,
  5515. emit: emit
  5516. };
  5517.  
  5518. descriptors = {
  5519. on: d(on),
  5520. once: d(once),
  5521. off: d(off),
  5522. emit: d(emit)
  5523. };
  5524.  
  5525. base = defineProperties({}, descriptors);
  5526.  
  5527. module.exports = exports = function (o) {
  5528. return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
  5529. };
  5530. exports.methods = methods;
  5531.  
  5532.  
  5533. /***/ }),
  5534. /* 79 */
  5535. /***/ (function(module, exports, __webpack_require__) {
  5536.  
  5537. "use strict";
  5538.  
  5539.  
  5540. var validTypes = { object: true, symbol: true };
  5541.  
  5542. module.exports = function () {
  5543. var symbol;
  5544. if (typeof Symbol !== 'function') return false;
  5545. symbol = Symbol('test symbol');
  5546. try { String(symbol); } catch (e) { return false; }
  5547.  
  5548. // Return 'true' also for polyfills
  5549. if (!validTypes[typeof Symbol.iterator]) return false;
  5550. if (!validTypes[typeof Symbol.toPrimitive]) return false;
  5551. if (!validTypes[typeof Symbol.toStringTag]) return false;
  5552.  
  5553. return true;
  5554. };
  5555.  
  5556.  
  5557. /***/ }),
  5558. /* 80 */
  5559. /***/ (function(module, exports, __webpack_require__) {
  5560.  
  5561. "use strict";
  5562. // ES2015 Symbol polyfill for environments that do not (or partially) support it
  5563.  
  5564.  
  5565.  
  5566. var d = __webpack_require__(3)
  5567. , validateSymbol = __webpack_require__(81)
  5568.  
  5569. , create = Object.create, defineProperties = Object.defineProperties
  5570. , defineProperty = Object.defineProperty, objPrototype = Object.prototype
  5571. , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
  5572. , isNativeSafe;
  5573.  
  5574. if (typeof Symbol === 'function') {
  5575. NativeSymbol = Symbol;
  5576. try {
  5577. String(NativeSymbol());
  5578. isNativeSafe = true;
  5579. } catch (ignore) {}
  5580. }
  5581.  
  5582. var generateName = (function () {
  5583. var created = create(null);
  5584. return function (desc) {
  5585. var postfix = 0, name, ie11BugWorkaround;
  5586. while (created[desc + (postfix || '')]) ++postfix;
  5587. desc += (postfix || '');
  5588. created[desc] = true;
  5589. name = '@@' + desc;
  5590. defineProperty(objPrototype, name, d.gs(null, function (value) {
  5591. // For IE11 issue see:
  5592. // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
  5593. // ie11-broken-getters-on-dom-objects
  5594. // https://github.com/medikoo/es6-symbol/issues/12
  5595. if (ie11BugWorkaround) return;
  5596. ie11BugWorkaround = true;
  5597. defineProperty(this, name, d(value));
  5598. ie11BugWorkaround = false;
  5599. }));
  5600. return name;
  5601. };
  5602. }());
  5603.  
  5604. // Internal constructor (not one exposed) for creating Symbol instances.
  5605. // This one is used to ensure that `someSymbol instanceof Symbol` always return false
  5606. HiddenSymbol = function Symbol(description) {
  5607. if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
  5608. return SymbolPolyfill(description);
  5609. };
  5610.  
  5611. // Exposed `Symbol` constructor
  5612. // (returns instances of HiddenSymbol)
  5613. module.exports = SymbolPolyfill = function Symbol(description) {
  5614. var symbol;
  5615. if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
  5616. if (isNativeSafe) return NativeSymbol(description);
  5617. symbol = create(HiddenSymbol.prototype);
  5618. description = (description === undefined ? '' : String(description));
  5619. return defineProperties(symbol, {
  5620. __description__: d('', description),
  5621. __name__: d('', generateName(description))
  5622. });
  5623. };
  5624. defineProperties(SymbolPolyfill, {
  5625. for: d(function (key) {
  5626. if (globalSymbols[key]) return globalSymbols[key];
  5627. return (globalSymbols[key] = SymbolPolyfill(String(key)));
  5628. }),
  5629. keyFor: d(function (s) {
  5630. var key;
  5631. validateSymbol(s);
  5632. for (key in globalSymbols) if (globalSymbols[key] === s) return key;
  5633. }),
  5634.  
  5635. // To ensure proper interoperability with other native functions (e.g. Array.from)
  5636. // fallback to eventual native implementation of given symbol
  5637. hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
  5638. isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
  5639. SymbolPolyfill('isConcatSpreadable')),
  5640. iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
  5641. match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
  5642. replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
  5643. search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
  5644. species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
  5645. split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
  5646. toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
  5647. toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
  5648. unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
  5649. });
  5650.  
  5651. // Internal tweaks for real symbol producer
  5652. defineProperties(HiddenSymbol.prototype, {
  5653. constructor: d(SymbolPolyfill),
  5654. toString: d('', function () { return this.__name__; })
  5655. });
  5656.  
  5657. // Proper implementation of methods exposed on Symbol.prototype
  5658. // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
  5659. defineProperties(SymbolPolyfill.prototype, {
  5660. toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
  5661. valueOf: d(function () { return validateSymbol(this); })
  5662. });
  5663. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
  5664. var symbol = validateSymbol(this);
  5665. if (typeof symbol === 'symbol') return symbol;
  5666. return symbol.toString();
  5667. }));
  5668. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
  5669.  
  5670. // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
  5671. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
  5672. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  5673.  
  5674. // Note: It's important to define `toPrimitive` as last one, as some implementations
  5675. // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
  5676. // And that may invoke error in definition flow:
  5677. // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
  5678. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
  5679. d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  5680.  
  5681.  
  5682. /***/ }),
  5683. /* 81 */
  5684. /***/ (function(module, exports, __webpack_require__) {
  5685.  
  5686. "use strict";
  5687.  
  5688.  
  5689. var isSymbol = __webpack_require__(82);
  5690.  
  5691. module.exports = function (value) {
  5692. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  5693. return value;
  5694. };
  5695.  
  5696.  
  5697. /***/ }),
  5698. /* 82 */
  5699. /***/ (function(module, exports, __webpack_require__) {
  5700.  
  5701. "use strict";
  5702.  
  5703.  
  5704. module.exports = function (x) {
  5705. if (!x) return false;
  5706. if (typeof x === 'symbol') return true;
  5707. if (!x.constructor) return false;
  5708. if (x.constructor.name !== 'Symbol') return false;
  5709. return (x[x.constructor.toStringTag] === 'Symbol');
  5710. };
  5711.  
  5712.  
  5713. /***/ }),
  5714. /* 83 */
  5715. /***/ (function(module, exports, __webpack_require__) {
  5716.  
  5717. "use strict";
  5718.  
  5719.  
  5720. var isArguments = __webpack_require__(11)
  5721. , isString = __webpack_require__(12)
  5722. , iteratorSymbol = __webpack_require__(5).iterator
  5723.  
  5724. , isArray = Array.isArray;
  5725.  
  5726. module.exports = function (value) {
  5727. if (value == null) return false;
  5728. if (isArray(value)) return true;
  5729. if (isString(value)) return true;
  5730. if (isArguments(value)) return true;
  5731. return (typeof value[iteratorSymbol] === 'function');
  5732. };
  5733.  
  5734.  
  5735. /***/ }),
  5736. /* 84 */
  5737. /***/ (function(module, exports, __webpack_require__) {
  5738.  
  5739. "use strict";
  5740.  
  5741.  
  5742. var isArguments = __webpack_require__(11)
  5743. , callable = __webpack_require__(1)
  5744. , isString = __webpack_require__(12)
  5745. , get = __webpack_require__(85)
  5746.  
  5747. , isArray = Array.isArray, call = Function.prototype.call
  5748. , some = Array.prototype.some;
  5749.  
  5750. module.exports = function (iterable, cb/*, thisArg*/) {
  5751. var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code;
  5752. if (isArray(iterable) || isArguments(iterable)) mode = 'array';
  5753. else if (isString(iterable)) mode = 'string';
  5754. else iterable = get(iterable);
  5755.  
  5756. callable(cb);
  5757. doBreak = function () { broken = true; };
  5758. if (mode === 'array') {
  5759. some.call(iterable, function (value) {
  5760. call.call(cb, thisArg, value, doBreak);
  5761. if (broken) return true;
  5762. });
  5763. return;
  5764. }
  5765. if (mode === 'string') {
  5766. l = iterable.length;
  5767. for (i = 0; i < l; ++i) {
  5768. char = iterable[i];
  5769. if ((i + 1) < l) {
  5770. code = char.charCodeAt(0);
  5771. if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i];
  5772. }
  5773. call.call(cb, thisArg, char, doBreak);
  5774. if (broken) break;
  5775. }
  5776. return;
  5777. }
  5778. result = iterable.next();
  5779.  
  5780. while (!result.done) {
  5781. call.call(cb, thisArg, result.value, doBreak);
  5782. if (broken) return;
  5783. result = iterable.next();
  5784. }
  5785. };
  5786.  
  5787.  
  5788. /***/ }),
  5789. /* 85 */
  5790. /***/ (function(module, exports, __webpack_require__) {
  5791.  
  5792. "use strict";
  5793.  
  5794.  
  5795. var isArguments = __webpack_require__(11)
  5796. , isString = __webpack_require__(12)
  5797. , ArrayIterator = __webpack_require__(86)
  5798. , StringIterator = __webpack_require__(96)
  5799. , iterable = __webpack_require__(30)
  5800. , iteratorSymbol = __webpack_require__(5).iterator;
  5801.  
  5802. module.exports = function (obj) {
  5803. if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
  5804. if (isArguments(obj)) return new ArrayIterator(obj);
  5805. if (isString(obj)) return new StringIterator(obj);
  5806. return new ArrayIterator(obj);
  5807. };
  5808.  
  5809.  
  5810. /***/ }),
  5811. /* 86 */
  5812. /***/ (function(module, exports, __webpack_require__) {
  5813.  
  5814. "use strict";
  5815.  
  5816.  
  5817. var setPrototypeOf = __webpack_require__(10)
  5818. , contains = __webpack_require__(29)
  5819. , d = __webpack_require__(3)
  5820. , Iterator = __webpack_require__(15)
  5821.  
  5822. , defineProperty = Object.defineProperty
  5823. , ArrayIterator;
  5824.  
  5825. ArrayIterator = module.exports = function (arr, kind) {
  5826. if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
  5827. Iterator.call(this, arr);
  5828. if (!kind) kind = 'value';
  5829. else if (contains.call(kind, 'key+value')) kind = 'key+value';
  5830. else if (contains.call(kind, 'key')) kind = 'key';
  5831. else kind = 'value';
  5832. defineProperty(this, '__kind__', d('', kind));
  5833. };
  5834. if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
  5835.  
  5836. ArrayIterator.prototype = Object.create(Iterator.prototype, {
  5837. constructor: d(ArrayIterator),
  5838. _resolve: d(function (i) {
  5839. if (this.__kind__ === 'value') return this.__list__[i];
  5840. if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
  5841. return i;
  5842. }),
  5843. toString: d(function () { return '[object Array Iterator]'; })
  5844. });
  5845.  
  5846.  
  5847. /***/ }),
  5848. /* 87 */
  5849. /***/ (function(module, exports, __webpack_require__) {
  5850.  
  5851. "use strict";
  5852.  
  5853.  
  5854. var copy = __webpack_require__(88)
  5855. , normalizeOptions = __webpack_require__(28)
  5856. , ensureCallable = __webpack_require__(1)
  5857. , map = __webpack_require__(93)
  5858. , callable = __webpack_require__(1)
  5859. , validValue = __webpack_require__(0)
  5860.  
  5861. , bind = Function.prototype.bind, defineProperty = Object.defineProperty
  5862. , hasOwnProperty = Object.prototype.hasOwnProperty
  5863. , define;
  5864.  
  5865. define = function (name, desc, options) {
  5866. var value = validValue(desc) && callable(desc.value), dgs;
  5867. dgs = copy(desc);
  5868. delete dgs.writable;
  5869. delete dgs.value;
  5870. dgs.get = function () {
  5871. if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
  5872. desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
  5873. defineProperty(this, name, desc);
  5874. return this[name];
  5875. };
  5876. return dgs;
  5877. };
  5878.  
  5879. module.exports = function (props/*, options*/) {
  5880. var options = normalizeOptions(arguments[1]);
  5881. if (options.resolveContext != null) ensureCallable(options.resolveContext);
  5882. return map(props, function (desc, name) { return define(name, desc, options); });
  5883. };
  5884.  
  5885.  
  5886. /***/ }),
  5887. /* 88 */
  5888. /***/ (function(module, exports, __webpack_require__) {
  5889.  
  5890. "use strict";
  5891.  
  5892.  
  5893. var aFrom = __webpack_require__(89)
  5894. , assign = __webpack_require__(14)
  5895. , value = __webpack_require__(0);
  5896.  
  5897. module.exports = function (obj/*, propertyNames, options*/) {
  5898. var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]);
  5899. if (copy !== obj && !propertyNames) return copy;
  5900. var result = {};
  5901. if (propertyNames) {
  5902. aFrom(propertyNames, function (propertyName) {
  5903. if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];
  5904. });
  5905. } else {
  5906. assign(result, obj);
  5907. }
  5908. return result;
  5909. };
  5910.  
  5911.  
  5912. /***/ }),
  5913. /* 89 */
  5914. /***/ (function(module, exports, __webpack_require__) {
  5915.  
  5916. "use strict";
  5917.  
  5918.  
  5919. module.exports = __webpack_require__(90)()
  5920. ? Array.from
  5921. : __webpack_require__(91);
  5922.  
  5923.  
  5924. /***/ }),
  5925. /* 90 */
  5926. /***/ (function(module, exports, __webpack_require__) {
  5927.  
  5928. "use strict";
  5929.  
  5930.  
  5931. module.exports = function () {
  5932. var from = Array.from, arr, result;
  5933. if (typeof from !== "function") return false;
  5934. arr = ["raz", "dwa"];
  5935. result = from(arr);
  5936. return Boolean(result && (result !== arr) && (result[1] === "dwa"));
  5937. };
  5938.  
  5939.  
  5940. /***/ }),
  5941. /* 91 */
  5942. /***/ (function(module, exports, __webpack_require__) {
  5943.  
  5944. "use strict";
  5945.  
  5946.  
  5947. var iteratorSymbol = __webpack_require__(5).iterator
  5948. , isArguments = __webpack_require__(11)
  5949. , isFunction = __webpack_require__(92)
  5950. , toPosInt = __webpack_require__(25)
  5951. , callable = __webpack_require__(1)
  5952. , validValue = __webpack_require__(0)
  5953. , isValue = __webpack_require__(8)
  5954. , isString = __webpack_require__(12)
  5955. , isArray = Array.isArray
  5956. , call = Function.prototype.call
  5957. , desc = { configurable: true, enumerable: true, writable: true, value: null }
  5958. , defineProperty = Object.defineProperty;
  5959.  
  5960. // eslint-disable-next-line complexity
  5961. module.exports = function (arrayLike /*, mapFn, thisArg*/) {
  5962. var mapFn = arguments[1]
  5963. , thisArg = arguments[2]
  5964. , Context
  5965. , i
  5966. , j
  5967. , arr
  5968. , length
  5969. , code
  5970. , iterator
  5971. , result
  5972. , getIterator
  5973. , value;
  5974.  
  5975. arrayLike = Object(validValue(arrayLike));
  5976.  
  5977. if (isValue(mapFn)) callable(mapFn);
  5978. if (!this || this === Array || !isFunction(this)) {
  5979. // Result: Plain array
  5980. if (!mapFn) {
  5981. if (isArguments(arrayLike)) {
  5982. // Source: Arguments
  5983. length = arrayLike.length;
  5984. if (length !== 1) return Array.apply(null, arrayLike);
  5985. arr = new Array(1);
  5986. arr[0] = arrayLike[0];
  5987. return arr;
  5988. }
  5989. if (isArray(arrayLike)) {
  5990. // Source: Array
  5991. arr = new Array(length = arrayLike.length);
  5992. for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
  5993. return arr;
  5994. }
  5995. }
  5996. arr = [];
  5997. } else {
  5998. // Result: Non plain array
  5999. Context = this;
  6000. }
  6001.  
  6002. if (!isArray(arrayLike)) {
  6003. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  6004. // Source: Iterator
  6005. iterator = callable(getIterator).call(arrayLike);
  6006. if (Context) arr = new Context();
  6007. result = iterator.next();
  6008. i = 0;
  6009. while (!result.done) {
  6010. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  6011. if (Context) {
  6012. desc.value = value;
  6013. defineProperty(arr, i, desc);
  6014. } else {
  6015. arr[i] = value;
  6016. }
  6017. result = iterator.next();
  6018. ++i;
  6019. }
  6020. length = i;
  6021. } else if (isString(arrayLike)) {
  6022. // Source: String
  6023. length = arrayLike.length;
  6024. if (Context) arr = new Context();
  6025. for (i = 0, j = 0; i < length; ++i) {
  6026. value = arrayLike[i];
  6027. if (i + 1 < length) {
  6028. code = value.charCodeAt(0);
  6029. // eslint-disable-next-line max-depth
  6030. if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
  6031. }
  6032. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  6033. if (Context) {
  6034. desc.value = value;
  6035. defineProperty(arr, j, desc);
  6036. } else {
  6037. arr[j] = value;
  6038. }
  6039. ++j;
  6040. }
  6041. length = j;
  6042. }
  6043. }
  6044. if (length === undefined) {
  6045. // Source: array or array-like
  6046. length = toPosInt(arrayLike.length);
  6047. if (Context) arr = new Context(length);
  6048. for (i = 0; i < length; ++i) {
  6049. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  6050. if (Context) {
  6051. desc.value = value;
  6052. defineProperty(arr, i, desc);
  6053. } else {
  6054. arr[i] = value;
  6055. }
  6056. }
  6057. }
  6058. if (Context) {
  6059. desc.value = null;
  6060. arr.length = length;
  6061. }
  6062. return arr;
  6063. };
  6064.  
  6065.  
  6066. /***/ }),
  6067. /* 92 */
  6068. /***/ (function(module, exports, __webpack_require__) {
  6069.  
  6070. "use strict";
  6071.  
  6072.  
  6073. var objToString = Object.prototype.toString, id = objToString.call(__webpack_require__(24));
  6074.  
  6075. module.exports = function (value) {
  6076. return typeof value === "function" && objToString.call(value) === id;
  6077. };
  6078.  
  6079.  
  6080. /***/ }),
  6081. /* 93 */
  6082. /***/ (function(module, exports, __webpack_require__) {
  6083.  
  6084. "use strict";
  6085.  
  6086.  
  6087. var callable = __webpack_require__(1)
  6088. , forEach = __webpack_require__(94)
  6089. , call = Function.prototype.call;
  6090.  
  6091. module.exports = function (obj, cb /*, thisArg*/) {
  6092. var result = {}, thisArg = arguments[2];
  6093. callable(cb);
  6094. forEach(obj, function (value, key, targetObj, index) {
  6095. result[key] = call.call(cb, thisArg, value, key, targetObj, index);
  6096. });
  6097. return result;
  6098. };
  6099.  
  6100.  
  6101. /***/ }),
  6102. /* 94 */
  6103. /***/ (function(module, exports, __webpack_require__) {
  6104.  
  6105. "use strict";
  6106.  
  6107.  
  6108. module.exports = __webpack_require__(95)("forEach");
  6109.  
  6110.  
  6111. /***/ }),
  6112. /* 95 */
  6113. /***/ (function(module, exports, __webpack_require__) {
  6114.  
  6115. "use strict";
  6116. // Internal method, used by iteration functions.
  6117. // Calls a function for each key-value pair found in object
  6118. // Optionally takes compareFn to iterate object in specific order
  6119.  
  6120.  
  6121.  
  6122. var callable = __webpack_require__(1)
  6123. , value = __webpack_require__(0)
  6124. , bind = Function.prototype.bind
  6125. , call = Function.prototype.call
  6126. , keys = Object.keys
  6127. , objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  6128.  
  6129. module.exports = function (method, defVal) {
  6130. return function (obj, cb /*, thisArg, compareFn*/) {
  6131. var list, thisArg = arguments[2], compareFn = arguments[3];
  6132. obj = Object(value(obj));
  6133. callable(cb);
  6134.  
  6135. list = keys(obj);
  6136. if (compareFn) {
  6137. list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
  6138. }
  6139. if (typeof method !== "function") method = list[method];
  6140. return call.call(method, list, function (key, index) {
  6141. if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
  6142. return call.call(cb, thisArg, obj[key], key, obj, index);
  6143. });
  6144. };
  6145. };
  6146.  
  6147.  
  6148. /***/ }),
  6149. /* 96 */
  6150. /***/ (function(module, exports, __webpack_require__) {
  6151.  
  6152. "use strict";
  6153. // Thanks @mathiasbynens
  6154. // http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
  6155.  
  6156.  
  6157.  
  6158. var setPrototypeOf = __webpack_require__(10)
  6159. , d = __webpack_require__(3)
  6160. , Iterator = __webpack_require__(15)
  6161.  
  6162. , defineProperty = Object.defineProperty
  6163. , StringIterator;
  6164.  
  6165. StringIterator = module.exports = function (str) {
  6166. if (!(this instanceof StringIterator)) return new StringIterator(str);
  6167. str = String(str);
  6168. Iterator.call(this, str);
  6169. defineProperty(this, '__length__', d('', str.length));
  6170.  
  6171. };
  6172. if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
  6173.  
  6174. StringIterator.prototype = Object.create(Iterator.prototype, {
  6175. constructor: d(StringIterator),
  6176. _next: d(function () {
  6177. if (!this.__list__) return;
  6178. if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
  6179. this._unBind();
  6180. }),
  6181. _resolve: d(function (i) {
  6182. var char = this.__list__[i], code;
  6183. if (this.__nextIndex__ === this.__length__) return char;
  6184. code = char.charCodeAt(0);
  6185. if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
  6186. return char;
  6187. }),
  6188. toString: d(function () { return '[object String Iterator]'; })
  6189. });
  6190.  
  6191.  
  6192. /***/ }),
  6193. /* 97 */
  6194. /***/ (function(module, exports, __webpack_require__) {
  6195.  
  6196. "use strict";
  6197.  
  6198.  
  6199. var setPrototypeOf = __webpack_require__(10)
  6200. , d = __webpack_require__(3)
  6201. , Iterator = __webpack_require__(15)
  6202. , toStringTagSymbol = __webpack_require__(5).toStringTag
  6203. , kinds = __webpack_require__(98)
  6204.  
  6205. , defineProperties = Object.defineProperties
  6206. , unBind = Iterator.prototype._unBind
  6207. , MapIterator;
  6208.  
  6209. MapIterator = module.exports = function (map, kind) {
  6210. if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
  6211. Iterator.call(this, map.__mapKeysData__, map);
  6212. if (!kind || !kinds[kind]) kind = 'key+value';
  6213. defineProperties(this, {
  6214. __kind__: d('', kind),
  6215. __values__: d('w', map.__mapValuesData__)
  6216. });
  6217. };
  6218. if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator);
  6219.  
  6220. MapIterator.prototype = Object.create(Iterator.prototype, {
  6221. constructor: d(MapIterator),
  6222. _resolve: d(function (i) {
  6223. if (this.__kind__ === 'value') return this.__values__[i];
  6224. if (this.__kind__ === 'key') return this.__list__[i];
  6225. return [this.__list__[i], this.__values__[i]];
  6226. }),
  6227. _unBind: d(function () {
  6228. this.__values__ = null;
  6229. unBind.call(this);
  6230. }),
  6231. toString: d(function () { return '[object Map Iterator]'; })
  6232. });
  6233. Object.defineProperty(MapIterator.prototype, toStringTagSymbol,
  6234. d('c', 'Map Iterator'));
  6235.  
  6236.  
  6237. /***/ }),
  6238. /* 98 */
  6239. /***/ (function(module, exports, __webpack_require__) {
  6240.  
  6241. "use strict";
  6242.  
  6243.  
  6244. module.exports = __webpack_require__(99)('key',
  6245. 'value', 'key+value');
  6246.  
  6247.  
  6248. /***/ }),
  6249. /* 99 */
  6250. /***/ (function(module, exports, __webpack_require__) {
  6251.  
  6252. "use strict";
  6253.  
  6254.  
  6255. var forEach = Array.prototype.forEach, create = Object.create;
  6256.  
  6257. // eslint-disable-next-line no-unused-vars
  6258. module.exports = function (arg /*, …args*/) {
  6259. var set = create(null);
  6260. forEach.call(arguments, function (name) {
  6261. set[name] = true;
  6262. });
  6263. return set;
  6264. };
  6265.  
  6266.  
  6267. /***/ }),
  6268. /* 100 */
  6269. /***/ (function(module, exports, __webpack_require__) {
  6270.  
  6271. "use strict";
  6272. // Exports true if environment provides native `Map` implementation,
  6273. // whatever that is.
  6274.  
  6275.  
  6276.  
  6277. module.exports = (function () {
  6278. if (typeof Map === 'undefined') return false;
  6279. return (Object.prototype.toString.call(new Map()) === '[object Map]');
  6280. }());
  6281.  
  6282.  
  6283. /***/ }),
  6284. /* 101 */
  6285. /***/ (function(module, exports, __webpack_require__) {
  6286.  
  6287. "use strict";
  6288.  
  6289. Object.defineProperty(exports, "__esModule", { value: true });
  6290. var xstream_1 = __webpack_require__(2);
  6291. var adapt_1 = __webpack_require__(6);
  6292. var SCOPE_PREFIX = '___';
  6293. var MockedDOMSource = (function () {
  6294. function MockedDOMSource(_mockConfig) {
  6295. this._mockConfig = _mockConfig;
  6296. if (_mockConfig['elements']) {
  6297. this._elements = _mockConfig['elements'];
  6298. }
  6299. else {
  6300. this._elements = adapt_1.adapt(xstream_1.default.empty());
  6301. }
  6302. }
  6303. MockedDOMSource.prototype.elements = function () {
  6304. var out = this
  6305. ._elements;
  6306. out._isCycleSource = 'MockedDOM';
  6307. return out;
  6308. };
  6309. MockedDOMSource.prototype.events = function (eventType, options) {
  6310. var streamForEventType = this._mockConfig[eventType];
  6311. var out = adapt_1.adapt(streamForEventType || xstream_1.default.empty());
  6312. out._isCycleSource = 'MockedDOM';
  6313. return out;
  6314. };
  6315. MockedDOMSource.prototype.select = function (selector) {
  6316. var mockConfigForSelector = this._mockConfig[selector] || {};
  6317. return new MockedDOMSource(mockConfigForSelector);
  6318. };
  6319. MockedDOMSource.prototype.isolateSource = function (source, scope) {
  6320. return source.select('.' + SCOPE_PREFIX + scope);
  6321. };
  6322. MockedDOMSource.prototype.isolateSink = function (sink, scope) {
  6323. return sink.map(function (vnode) {
  6324. if (vnode.sel && vnode.sel.indexOf(SCOPE_PREFIX + scope) !== -1) {
  6325. return vnode;
  6326. }
  6327. else {
  6328. vnode.sel += "." + SCOPE_PREFIX + scope;
  6329. return vnode;
  6330. }
  6331. });
  6332. };
  6333. return MockedDOMSource;
  6334. }());
  6335. exports.MockedDOMSource = MockedDOMSource;
  6336. function mockDOMSource(mockConfig) {
  6337. return new MockedDOMSource(mockConfig);
  6338. }
  6339. exports.mockDOMSource = mockDOMSource;
  6340. //# sourceMappingURL=mockDOMSource.js.map
  6341.  
  6342. /***/ }),
  6343. /* 102 */
  6344. /***/ (function(module, exports, __webpack_require__) {
  6345.  
  6346. "use strict";
  6347.  
  6348. Object.defineProperty(exports, "__esModule", { value: true });
  6349. // tslint:disable-next-line:max-file-line-count
  6350. var h_1 = __webpack_require__(4);
  6351. function isValidString(param) {
  6352. return typeof param === 'string' && param.length > 0;
  6353. }
  6354. function isSelector(param) {
  6355. return isValidString(param) && (param[0] === '.' || param[0] === '#');
  6356. }
  6357. function createTagFunction(tagName) {
  6358. return function hyperscript(a, b, c) {
  6359. var hasA = typeof a !== 'undefined';
  6360. var hasB = typeof b !== 'undefined';
  6361. var hasC = typeof c !== 'undefined';
  6362. if (isSelector(a)) {
  6363. if (hasB && hasC) {
  6364. return h_1.h(tagName + a, b, c);
  6365. }
  6366. else if (hasB) {
  6367. return h_1.h(tagName + a, b);
  6368. }
  6369. else {
  6370. return h_1.h(tagName + a, {});
  6371. }
  6372. }
  6373. else if (hasC) {
  6374. return h_1.h(tagName + a, b, c);
  6375. }
  6376. else if (hasB) {
  6377. return h_1.h(tagName, a, b);
  6378. }
  6379. else if (hasA) {
  6380. return h_1.h(tagName, a);
  6381. }
  6382. else {
  6383. return h_1.h(tagName, {});
  6384. }
  6385. };
  6386. }
  6387. var SVG_TAG_NAMES = [
  6388. 'a',
  6389. 'altGlyph',
  6390. 'altGlyphDef',
  6391. 'altGlyphItem',
  6392. 'animate',
  6393. 'animateColor',
  6394. 'animateMotion',
  6395. 'animateTransform',
  6396. 'circle',
  6397. 'clipPath',
  6398. 'colorProfile',
  6399. 'cursor',
  6400. 'defs',
  6401. 'desc',
  6402. 'ellipse',
  6403. 'feBlend',
  6404. 'feColorMatrix',
  6405. 'feComponentTransfer',
  6406. 'feComposite',
  6407. 'feConvolveMatrix',
  6408. 'feDiffuseLighting',
  6409. 'feDisplacementMap',
  6410. 'feDistantLight',
  6411. 'feFlood',
  6412. 'feFuncA',
  6413. 'feFuncB',
  6414. 'feFuncG',
  6415. 'feFuncR',
  6416. 'feGaussianBlur',
  6417. 'feImage',
  6418. 'feMerge',
  6419. 'feMergeNode',
  6420. 'feMorphology',
  6421. 'feOffset',
  6422. 'fePointLight',
  6423. 'feSpecularLighting',
  6424. 'feSpotlight',
  6425. 'feTile',
  6426. 'feTurbulence',
  6427. 'filter',
  6428. 'font',
  6429. 'fontFace',
  6430. 'fontFaceFormat',
  6431. 'fontFaceName',
  6432. 'fontFaceSrc',
  6433. 'fontFaceUri',
  6434. 'foreignObject',
  6435. 'g',
  6436. 'glyph',
  6437. 'glyphRef',
  6438. 'hkern',
  6439. 'image',
  6440. 'line',
  6441. 'linearGradient',
  6442. 'marker',
  6443. 'mask',
  6444. 'metadata',
  6445. 'missingGlyph',
  6446. 'mpath',
  6447. 'path',
  6448. 'pattern',
  6449. 'polygon',
  6450. 'polyline',
  6451. 'radialGradient',
  6452. 'rect',
  6453. 'script',
  6454. 'set',
  6455. 'stop',
  6456. 'style',
  6457. 'switch',
  6458. 'symbol',
  6459. 'text',
  6460. 'textPath',
  6461. 'title',
  6462. 'tref',
  6463. 'tspan',
  6464. 'use',
  6465. 'view',
  6466. 'vkern',
  6467. ];
  6468. var svg = createTagFunction('svg');
  6469. SVG_TAG_NAMES.forEach(function (tag) {
  6470. svg[tag] = createTagFunction(tag);
  6471. });
  6472. var TAG_NAMES = [
  6473. 'a',
  6474. 'abbr',
  6475. 'address',
  6476. 'area',
  6477. 'article',
  6478. 'aside',
  6479. 'audio',
  6480. 'b',
  6481. 'base',
  6482. 'bdi',
  6483. 'bdo',
  6484. 'blockquote',
  6485. 'body',
  6486. 'br',
  6487. 'button',
  6488. 'canvas',
  6489. 'caption',
  6490. 'cite',
  6491. 'code',
  6492. 'col',
  6493. 'colgroup',
  6494. 'dd',
  6495. 'del',
  6496. 'dfn',
  6497. 'dir',
  6498. 'div',
  6499. 'dl',
  6500. 'dt',
  6501. 'em',
  6502. 'embed',
  6503. 'fieldset',
  6504. 'figcaption',
  6505. 'figure',
  6506. 'footer',
  6507. 'form',
  6508. 'h1',
  6509. 'h2',
  6510. 'h3',
  6511. 'h4',
  6512. 'h5',
  6513. 'h6',
  6514. 'head',
  6515. 'header',
  6516. 'hgroup',
  6517. 'hr',
  6518. 'html',
  6519. 'i',
  6520. 'iframe',
  6521. 'img',
  6522. 'input',
  6523. 'ins',
  6524. 'kbd',
  6525. 'keygen',
  6526. 'label',
  6527. 'legend',
  6528. 'li',
  6529. 'link',
  6530. 'main',
  6531. 'map',
  6532. 'mark',
  6533. 'menu',
  6534. 'meta',
  6535. 'nav',
  6536. 'noscript',
  6537. 'object',
  6538. 'ol',
  6539. 'optgroup',
  6540. 'option',
  6541. 'p',
  6542. 'param',
  6543. 'pre',
  6544. 'progress',
  6545. 'q',
  6546. 'rp',
  6547. 'rt',
  6548. 'ruby',
  6549. 's',
  6550. 'samp',
  6551. 'script',
  6552. 'section',
  6553. 'select',
  6554. 'small',
  6555. 'source',
  6556. 'span',
  6557. 'strong',
  6558. 'style',
  6559. 'sub',
  6560. 'sup',
  6561. 'table',
  6562. 'tbody',
  6563. 'td',
  6564. 'textarea',
  6565. 'tfoot',
  6566. 'th',
  6567. 'thead',
  6568. 'time',
  6569. 'title',
  6570. 'tr',
  6571. 'u',
  6572. 'ul',
  6573. 'video',
  6574. ];
  6575. var exported = {
  6576. SVG_TAG_NAMES: SVG_TAG_NAMES,
  6577. TAG_NAMES: TAG_NAMES,
  6578. svg: svg,
  6579. isSelector: isSelector,
  6580. createTagFunction: createTagFunction,
  6581. };
  6582. TAG_NAMES.forEach(function (n) {
  6583. exported[n] = createTagFunction(n);
  6584. });
  6585. exports.default = exported;
  6586. //# sourceMappingURL=hyperscript-helpers.js.map
  6587.  
  6588. /***/ })
  6589. /******/ ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement