ably-ui 5.0.0.dev.bf26560 → 5.0.0.dev.d3162ab

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ably_ui/core/code/component.css +0 -2
  3. data/lib/ably_ui/core/code/component.js +1 -7468
  4. data/lib/ably_ui/core/connect_state_wrapper/component.js +1 -22
  5. data/lib/ably_ui/core/contact_footer/component.css +0 -2
  6. data/lib/ably_ui/core/contact_footer/component.js +1 -211
  7. data/lib/ably_ui/core/cookie_message/component.css +0 -2
  8. data/lib/ably_ui/core/cookie_message/component.js +1 -82
  9. data/lib/ably_ui/core/feature_footer/component.css +0 -2
  10. data/lib/ably_ui/core/feature_footer/component.js +1 -211
  11. data/lib/ably_ui/core/featured_link/component.css +0 -2
  12. data/lib/ably_ui/core/featured_link/component.js +1 -82
  13. data/lib/ably_ui/core/flash/component.css +0 -2
  14. data/lib/ably_ui/core/flash/component.js +1 -82
  15. data/lib/ably_ui/core/footer/component.css +0 -2
  16. data/lib/ably_ui/core/footer/component.js +1 -82
  17. data/lib/ably_ui/core/icon/component.js +1 -22
  18. data/lib/ably_ui/core/logo/component.js +1 -22
  19. data/lib/ably_ui/core/meganav/component.css +0 -2
  20. data/lib/ably_ui/core/meganav/component.js +1 -1857
  21. data/lib/ably_ui/core/meganav_blog_posts_list/component.js +1 -1934
  22. data/lib/ably_ui/core/meganav_content_developers/component.js +1 -22
  23. data/lib/ably_ui/core/meganav_content_platform/component.js +1 -22
  24. data/lib/ably_ui/core/meganav_content_use_cases/component.js +1 -22
  25. data/lib/ably_ui/core/meganav_content_why_ably/component.js +1 -22
  26. data/lib/ably_ui/core/meganav_control/component.js +1 -208
  27. data/lib/ably_ui/core/meganav_control_mobile_dropdown/component.js +1 -975
  28. data/lib/ably_ui/core/meganav_control_mobile_panel_close/component.js +1 -142
  29. data/lib/ably_ui/core/meganav_control_mobile_panel_open/component.js +1 -170
  30. data/lib/ably_ui/core/meganav_items_desktop/component.js +1 -22
  31. data/lib/ably_ui/core/meganav_items_mobile/component.js +1 -22
  32. data/lib/ably_ui/core/meganav_items_signed_in/component.js +1 -22
  33. data/lib/ably_ui/core/notice/component.css +0 -2
  34. data/lib/ably_ui/core/notice/component.js +2 -4613
  35. data/lib/ably_ui/core/showcase/component.css +0 -2
  36. data/lib/ably_ui/core/showcase/component.js +1 -343
  37. data/lib/ably_ui/core/sign_out_link/component.js +1 -22
  38. data/lib/ably_ui/core/slider/component.css +0 -2
  39. data/lib/ably_ui/core/slider/component.js +1 -38
  40. data/lib/ably_ui/core/uptime/component.css +0 -2
  41. data/lib/ably_ui/core/uptime/component.js +1 -82
  42. data/lib/ably_ui/version.rb +1 -1
  43. metadata +1 -1
@@ -1,1934 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["AblyUi"] = factory();
8
- else
9
- root["AblyUi"] = root["AblyUi"] || {}, root["AblyUi"]["Core"] = root["AblyUi"]["Core"] || {}, root["AblyUi"]["Core"]["MeganavBlogPostsList"] = factory();
10
- })(this, function() {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ var __webpack_modules__ = ({
13
-
14
- /***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
15
- /*!*******************************************************************!*\
16
- !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
17
- \*******************************************************************/
18
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
19
-
20
- "use strict";
21
- __webpack_require__.r(__webpack_exports__);
22
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23
- /* harmony export */ "default": () => (/* binding */ _defineProperty)
24
- /* harmony export */ });
25
- function _defineProperty(obj, key, value) {
26
- if (key in obj) {
27
- Object.defineProperty(obj, key, {
28
- value: value,
29
- enumerable: true,
30
- configurable: true,
31
- writable: true
32
- });
33
- } else {
34
- obj[key] = value;
35
- }
36
-
37
- return obj;
38
- }
39
-
40
- /***/ }),
41
-
42
- /***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js":
43
- /*!******************************************************************!*\
44
- !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js ***!
45
- \******************************************************************/
46
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
47
-
48
- "use strict";
49
- __webpack_require__.r(__webpack_exports__);
50
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
51
- /* harmony export */ "default": () => (/* binding */ _objectSpread2)
52
- /* harmony export */ });
53
- /* harmony import */ var _defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty.js */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
54
-
55
-
56
- function ownKeys(object, enumerableOnly) {
57
- var keys = Object.keys(object);
58
-
59
- if (Object.getOwnPropertySymbols) {
60
- var symbols = Object.getOwnPropertySymbols(object);
61
-
62
- if (enumerableOnly) {
63
- symbols = symbols.filter(function (sym) {
64
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
- });
66
- }
67
-
68
- keys.push.apply(keys, symbols);
69
- }
70
-
71
- return keys;
72
- }
73
-
74
- function _objectSpread2(target) {
75
- for (var i = 1; i < arguments.length; i++) {
76
- var source = arguments[i] != null ? arguments[i] : {};
77
-
78
- if (i % 2) {
79
- ownKeys(Object(source), true).forEach(function (key) {
80
- (0,_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__.default)(target, key, source[key]);
81
- });
82
- } else if (Object.getOwnPropertyDescriptors) {
83
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84
- } else {
85
- ownKeys(Object(source)).forEach(function (key) {
86
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
87
- });
88
- }
89
- }
90
-
91
- return target;
92
- }
93
-
94
- /***/ }),
95
-
96
- /***/ "./node_modules/@babel/runtime/regenerator/index.js":
97
- /*!**********************************************************!*\
98
- !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
99
- \**********************************************************/
100
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
101
-
102
- module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
103
-
104
-
105
- /***/ }),
106
-
107
- /***/ "./src/core/dom-query.js":
108
- /*!*******************************!*\
109
- !*** ./src/core/dom-query.js ***!
110
- \*******************************/
111
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
112
-
113
- "use strict";
114
- __webpack_require__.r(__webpack_exports__);
115
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
116
- /* harmony export */ "queryId": () => (/* binding */ queryId),
117
- /* harmony export */ "queryIdAll": () => (/* binding */ queryIdAll)
118
- /* harmony export */ });
119
- var queryId = function queryId(val) {
120
- var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
121
- return root.querySelector("[data-id=".concat(val, "]"));
122
- };
123
- var queryIdAll = function queryIdAll(val) {
124
- var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
125
- return root.querySelectorAll("[data-id=".concat(val, "]"));
126
- };
127
-
128
- /***/ }),
129
-
130
- /***/ "./src/core/remote-blogs-posts.js":
131
- /*!****************************************!*\
132
- !*** ./src/core/remote-blogs-posts.js ***!
133
- \****************************************/
134
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
135
-
136
- "use strict";
137
- __webpack_require__.r(__webpack_exports__);
138
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
139
- /* harmony export */ "fetchBlogPosts": () => (/* binding */ fetchBlogPosts),
140
- /* harmony export */ "reducerBlogPosts": () => (/* binding */ reducerBlogPosts),
141
- /* harmony export */ "selectRecentBlogPosts": () => (/* binding */ selectRecentBlogPosts)
142
- /* harmony export */ });
143
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
144
- /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
145
- /* harmony import */ var _remote_data_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./remote-data-util */ "./src/core/remote-data-util.js");
146
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
147
-
148
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
149
-
150
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
151
-
152
-
153
-
154
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
155
-
156
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
157
-
158
-
159
-
160
- var fetchBlogPosts = /*#__PURE__*/function () {
161
- var _ref = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(store, blogUrl) {
162
- var res, payload;
163
- return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
164
- while (1) {
165
- switch (_context.prev = _context.next) {
166
- case 0:
167
- _context.prev = 0;
168
-
169
- if (blogUrl) {
170
- _context.next = 4;
171
- break;
172
- }
173
-
174
- console.warn("Skipping fetching blog posts, invalid blogUrl: \"".concat(blogUrl, "\""));
175
- return _context.abrupt("return");
176
-
177
- case 4:
178
- _context.next = 6;
179
- return fetch(blogUrl);
180
-
181
- case 6:
182
- res = _context.sent;
183
-
184
- if (!(0,_remote_data_util__WEBPACK_IMPORTED_MODULE_1__.isJsonResponse)(res.headers.get("content-type"))) {
185
- _context.next = 14;
186
- break;
187
- }
188
-
189
- _context.next = 10;
190
- return res.json();
191
-
192
- case 10:
193
- payload = _context.sent;
194
- store.dispatch({
195
- type: "blog/loaded",
196
- payload: payload
197
- });
198
- _context.next = 15;
199
- break;
200
-
201
- case 14:
202
- throw new Error("Blog posts url is not serving json");
203
-
204
- case 15:
205
- _context.next = 20;
206
- break;
207
-
208
- case 17:
209
- _context.prev = 17;
210
- _context.t0 = _context["catch"](0);
211
- console.warn("Could not fetch blog posts due to error:", _context.t0);
212
-
213
- case 20:
214
- case "end":
215
- return _context.stop();
216
- }
217
- }
218
- }, _callee, null, [[0, 17]]);
219
- }));
220
-
221
- return function fetchBlogPosts(_x, _x2) {
222
- return _ref.apply(this, arguments);
223
- };
224
- }();
225
-
226
- var initialState = {
227
- recent: null
228
- };
229
- var REDUCER_KEY = "blogPosts";
230
-
231
- var reducerBlogPosts = _defineProperty({}, REDUCER_KEY, function () {
232
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
233
- var action = arguments.length > 1 ? arguments[1] : undefined;
234
-
235
- switch (action.type) {
236
- case "blog/loaded":
237
- return _objectSpread(_objectSpread({}, state), {}, {
238
- recent: action.payload
239
- });
240
-
241
- default:
242
- return state;
243
- }
244
- });
245
-
246
- var selectRecentBlogPosts = function selectRecentBlogPosts(store) {
247
- var _store$getState$REDUC;
248
-
249
- return (_store$getState$REDUC = store.getState()[REDUCER_KEY]) === null || _store$getState$REDUC === void 0 ? void 0 : _store$getState$REDUC.recent;
250
- };
251
-
252
-
253
-
254
- /***/ }),
255
-
256
- /***/ "./src/core/remote-data-store.js":
257
- /*!***************************************!*\
258
- !*** ./src/core/remote-data-store.js ***!
259
- \***************************************/
260
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
261
-
262
- "use strict";
263
- __webpack_require__.r(__webpack_exports__);
264
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
265
- /* harmony export */ "attachStoreToWindow": () => (/* binding */ attachStoreToWindow),
266
- /* harmony export */ "getRemoteDataStore": () => (/* binding */ getRemoteDataStore),
267
- /* harmony export */ "connectState": () => (/* binding */ connectState),
268
- /* harmony export */ "createRemoteDataStore": () => (/* binding */ createRemoteDataStore)
269
- /* harmony export */ });
270
- /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js");
271
-
272
- var attachStoreToWindow = function attachStoreToWindow(store) {
273
- window.AblyUi = window.AblyUi || {};
274
- window.AblyUi.RemoteDataStore = store;
275
- };
276
- var getRemoteDataStore = function getRemoteDataStore() {
277
- if (!window.AblyUi.RemoteDataStore) {
278
- throw new Error("Remote store was called before one was created");
279
- }
280
-
281
- return window.AblyUi.RemoteDataStore;
282
- };
283
- var connectState = function connectState(selector, setState) {
284
- var store = getRemoteDataStore();
285
- var cachedOldState = selector(store);
286
- store.subscribe(function () {
287
- var newState = selector(store); // Do nothing, state is the same
288
-
289
- if (newState === cachedOldState) {
290
- return;
291
- }
292
-
293
- cachedOldState = newState;
294
- setState(newState);
295
- });
296
- };
297
- var createRemoteDataStore = function createRemoteDataStore(reducers) {
298
- return (0,redux__WEBPACK_IMPORTED_MODULE_0__.createStore)((0,redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers)(reducers));
299
- };
300
-
301
- /***/ }),
302
-
303
- /***/ "./src/core/remote-data-util.js":
304
- /*!**************************************!*\
305
- !*** ./src/core/remote-data-util.js ***!
306
- \**************************************/
307
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
308
-
309
- "use strict";
310
- __webpack_require__.r(__webpack_exports__);
311
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
312
- /* harmony export */ "isJsonResponse": () => (/* binding */ isJsonResponse)
313
- /* harmony export */ });
314
- // isJsonResponse is useful for environments where hitting an endpoint
315
- // would return an html page (eg. Gatsby local dev)
316
- var isJsonResponse = function isJsonResponse(contentType) {
317
- return contentType && contentType.includes("application/json");
318
- };
319
-
320
- /***/ }),
321
-
322
- /***/ "./node_modules/redux/es/redux.js":
323
- /*!****************************************!*\
324
- !*** ./node_modules/redux/es/redux.js ***!
325
- \****************************************/
326
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
327
-
328
- "use strict";
329
- __webpack_require__.r(__webpack_exports__);
330
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
331
- /* harmony export */ "__DO_NOT_USE__ActionTypes": () => (/* binding */ ActionTypes),
332
- /* harmony export */ "applyMiddleware": () => (/* binding */ applyMiddleware),
333
- /* harmony export */ "bindActionCreators": () => (/* binding */ bindActionCreators),
334
- /* harmony export */ "combineReducers": () => (/* binding */ combineReducers),
335
- /* harmony export */ "compose": () => (/* binding */ compose),
336
- /* harmony export */ "createStore": () => (/* binding */ createStore)
337
- /* harmony export */ });
338
- /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
339
-
340
-
341
- /**
342
- * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
343
- *
344
- * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
345
- * during build.
346
- * @param {number} code
347
- */
348
- function formatProdErrorMessage(code) {
349
- return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
350
- }
351
-
352
- // Inlined version of the `symbol-observable` polyfill
353
- var $$observable = (function () {
354
- return typeof Symbol === 'function' && Symbol.observable || '@@observable';
355
- })();
356
-
357
- /**
358
- * These are private action types reserved by Redux.
359
- * For any unknown actions, you must return the current state.
360
- * If the current state is undefined, you must return the initial state.
361
- * Do not reference these action types directly in your code.
362
- */
363
- var randomString = function randomString() {
364
- return Math.random().toString(36).substring(7).split('').join('.');
365
- };
366
-
367
- var ActionTypes = {
368
- INIT: "@@redux/INIT" + randomString(),
369
- REPLACE: "@@redux/REPLACE" + randomString(),
370
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
371
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
372
- }
373
- };
374
-
375
- /**
376
- * @param {any} obj The object to inspect.
377
- * @returns {boolean} True if the argument appears to be a plain object.
378
- */
379
- function isPlainObject(obj) {
380
- if (typeof obj !== 'object' || obj === null) return false;
381
- var proto = obj;
382
-
383
- while (Object.getPrototypeOf(proto) !== null) {
384
- proto = Object.getPrototypeOf(proto);
385
- }
386
-
387
- return Object.getPrototypeOf(obj) === proto;
388
- }
389
-
390
- function kindOf(val) {
391
- var typeOfVal = typeof val;
392
-
393
- if (true) {
394
- // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
395
- function miniKindOf(val) {
396
- if (val === void 0) return 'undefined';
397
- if (val === null) return 'null';
398
- var type = typeof val;
399
-
400
- switch (type) {
401
- case 'boolean':
402
- case 'string':
403
- case 'number':
404
- case 'symbol':
405
- case 'function':
406
- {
407
- return type;
408
- }
409
- }
410
-
411
- if (Array.isArray(val)) return 'array';
412
- if (isDate(val)) return 'date';
413
- if (isError(val)) return 'error';
414
- var constructorName = ctorName(val);
415
-
416
- switch (constructorName) {
417
- case 'Symbol':
418
- case 'Promise':
419
- case 'WeakMap':
420
- case 'WeakSet':
421
- case 'Map':
422
- case 'Set':
423
- return constructorName;
424
- } // other
425
-
426
-
427
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
428
- }
429
-
430
- function ctorName(val) {
431
- return typeof val.constructor === 'function' ? val.constructor.name : null;
432
- }
433
-
434
- function isError(val) {
435
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
436
- }
437
-
438
- function isDate(val) {
439
- if (val instanceof Date) return true;
440
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
441
- }
442
-
443
- typeOfVal = miniKindOf(val);
444
- }
445
-
446
- return typeOfVal;
447
- }
448
-
449
- /**
450
- * Creates a Redux store that holds the state tree.
451
- * The only way to change the data in the store is to call `dispatch()` on it.
452
- *
453
- * There should only be a single store in your app. To specify how different
454
- * parts of the state tree respond to actions, you may combine several reducers
455
- * into a single reducer function by using `combineReducers`.
456
- *
457
- * @param {Function} reducer A function that returns the next state tree, given
458
- * the current state tree and the action to handle.
459
- *
460
- * @param {any} [preloadedState] The initial state. You may optionally specify it
461
- * to hydrate the state from the server in universal apps, or to restore a
462
- * previously serialized user session.
463
- * If you use `combineReducers` to produce the root reducer function, this must be
464
- * an object with the same shape as `combineReducers` keys.
465
- *
466
- * @param {Function} [enhancer] The store enhancer. You may optionally specify it
467
- * to enhance the store with third-party capabilities such as middleware,
468
- * time travel, persistence, etc. The only store enhancer that ships with Redux
469
- * is `applyMiddleware()`.
470
- *
471
- * @returns {Store} A Redux store that lets you read the state, dispatch actions
472
- * and subscribe to changes.
473
- */
474
-
475
- function createStore(reducer, preloadedState, enhancer) {
476
- var _ref2;
477
-
478
- if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
479
- throw new Error( false ? 0 : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
480
- }
481
-
482
- if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
483
- enhancer = preloadedState;
484
- preloadedState = undefined;
485
- }
486
-
487
- if (typeof enhancer !== 'undefined') {
488
- if (typeof enhancer !== 'function') {
489
- throw new Error( false ? 0 : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
490
- }
491
-
492
- return enhancer(createStore)(reducer, preloadedState);
493
- }
494
-
495
- if (typeof reducer !== 'function') {
496
- throw new Error( false ? 0 : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
497
- }
498
-
499
- var currentReducer = reducer;
500
- var currentState = preloadedState;
501
- var currentListeners = [];
502
- var nextListeners = currentListeners;
503
- var isDispatching = false;
504
- /**
505
- * This makes a shallow copy of currentListeners so we can use
506
- * nextListeners as a temporary list while dispatching.
507
- *
508
- * This prevents any bugs around consumers calling
509
- * subscribe/unsubscribe in the middle of a dispatch.
510
- */
511
-
512
- function ensureCanMutateNextListeners() {
513
- if (nextListeners === currentListeners) {
514
- nextListeners = currentListeners.slice();
515
- }
516
- }
517
- /**
518
- * Reads the state tree managed by the store.
519
- *
520
- * @returns {any} The current state tree of your application.
521
- */
522
-
523
-
524
- function getState() {
525
- if (isDispatching) {
526
- throw new Error( false ? 0 : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
527
- }
528
-
529
- return currentState;
530
- }
531
- /**
532
- * Adds a change listener. It will be called any time an action is dispatched,
533
- * and some part of the state tree may potentially have changed. You may then
534
- * call `getState()` to read the current state tree inside the callback.
535
- *
536
- * You may call `dispatch()` from a change listener, with the following
537
- * caveats:
538
- *
539
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
540
- * If you subscribe or unsubscribe while the listeners are being invoked, this
541
- * will not have any effect on the `dispatch()` that is currently in progress.
542
- * However, the next `dispatch()` call, whether nested or not, will use a more
543
- * recent snapshot of the subscription list.
544
- *
545
- * 2. The listener should not expect to see all state changes, as the state
546
- * might have been updated multiple times during a nested `dispatch()` before
547
- * the listener is called. It is, however, guaranteed that all subscribers
548
- * registered before the `dispatch()` started will be called with the latest
549
- * state by the time it exits.
550
- *
551
- * @param {Function} listener A callback to be invoked on every dispatch.
552
- * @returns {Function} A function to remove this change listener.
553
- */
554
-
555
-
556
- function subscribe(listener) {
557
- if (typeof listener !== 'function') {
558
- throw new Error( false ? 0 : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
559
- }
560
-
561
- if (isDispatching) {
562
- throw new Error( false ? 0 : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
563
- }
564
-
565
- var isSubscribed = true;
566
- ensureCanMutateNextListeners();
567
- nextListeners.push(listener);
568
- return function unsubscribe() {
569
- if (!isSubscribed) {
570
- return;
571
- }
572
-
573
- if (isDispatching) {
574
- throw new Error( false ? 0 : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
575
- }
576
-
577
- isSubscribed = false;
578
- ensureCanMutateNextListeners();
579
- var index = nextListeners.indexOf(listener);
580
- nextListeners.splice(index, 1);
581
- currentListeners = null;
582
- };
583
- }
584
- /**
585
- * Dispatches an action. It is the only way to trigger a state change.
586
- *
587
- * The `reducer` function, used to create the store, will be called with the
588
- * current state tree and the given `action`. Its return value will
589
- * be considered the **next** state of the tree, and the change listeners
590
- * will be notified.
591
- *
592
- * The base implementation only supports plain object actions. If you want to
593
- * dispatch a Promise, an Observable, a thunk, or something else, you need to
594
- * wrap your store creating function into the corresponding middleware. For
595
- * example, see the documentation for the `redux-thunk` package. Even the
596
- * middleware will eventually dispatch plain object actions using this method.
597
- *
598
- * @param {Object} action A plain object representing “what changed”. It is
599
- * a good idea to keep actions serializable so you can record and replay user
600
- * sessions, or use the time travelling `redux-devtools`. An action must have
601
- * a `type` property which may not be `undefined`. It is a good idea to use
602
- * string constants for action types.
603
- *
604
- * @returns {Object} For convenience, the same action object you dispatched.
605
- *
606
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
607
- * return something else (for example, a Promise you can await).
608
- */
609
-
610
-
611
- function dispatch(action) {
612
- if (!isPlainObject(action)) {
613
- throw new Error( false ? 0 : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
614
- }
615
-
616
- if (typeof action.type === 'undefined') {
617
- throw new Error( false ? 0 : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
618
- }
619
-
620
- if (isDispatching) {
621
- throw new Error( false ? 0 : 'Reducers may not dispatch actions.');
622
- }
623
-
624
- try {
625
- isDispatching = true;
626
- currentState = currentReducer(currentState, action);
627
- } finally {
628
- isDispatching = false;
629
- }
630
-
631
- var listeners = currentListeners = nextListeners;
632
-
633
- for (var i = 0; i < listeners.length; i++) {
634
- var listener = listeners[i];
635
- listener();
636
- }
637
-
638
- return action;
639
- }
640
- /**
641
- * Replaces the reducer currently used by the store to calculate the state.
642
- *
643
- * You might need this if your app implements code splitting and you want to
644
- * load some of the reducers dynamically. You might also need this if you
645
- * implement a hot reloading mechanism for Redux.
646
- *
647
- * @param {Function} nextReducer The reducer for the store to use instead.
648
- * @returns {void}
649
- */
650
-
651
-
652
- function replaceReducer(nextReducer) {
653
- if (typeof nextReducer !== 'function') {
654
- throw new Error( false ? 0 : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
655
- }
656
-
657
- currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
658
- // Any reducers that existed in both the new and old rootReducer
659
- // will receive the previous state. This effectively populates
660
- // the new state tree with any relevant data from the old one.
661
-
662
- dispatch({
663
- type: ActionTypes.REPLACE
664
- });
665
- }
666
- /**
667
- * Interoperability point for observable/reactive libraries.
668
- * @returns {observable} A minimal observable of state changes.
669
- * For more information, see the observable proposal:
670
- * https://github.com/tc39/proposal-observable
671
- */
672
-
673
-
674
- function observable() {
675
- var _ref;
676
-
677
- var outerSubscribe = subscribe;
678
- return _ref = {
679
- /**
680
- * The minimal observable subscription method.
681
- * @param {Object} observer Any object that can be used as an observer.
682
- * The observer object should have a `next` method.
683
- * @returns {subscription} An object with an `unsubscribe` method that can
684
- * be used to unsubscribe the observable from the store, and prevent further
685
- * emission of values from the observable.
686
- */
687
- subscribe: function subscribe(observer) {
688
- if (typeof observer !== 'object' || observer === null) {
689
- throw new Error( false ? 0 : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
690
- }
691
-
692
- function observeState() {
693
- if (observer.next) {
694
- observer.next(getState());
695
- }
696
- }
697
-
698
- observeState();
699
- var unsubscribe = outerSubscribe(observeState);
700
- return {
701
- unsubscribe: unsubscribe
702
- };
703
- }
704
- }, _ref[$$observable] = function () {
705
- return this;
706
- }, _ref;
707
- } // When a store is created, an "INIT" action is dispatched so that every
708
- // reducer returns their initial state. This effectively populates
709
- // the initial state tree.
710
-
711
-
712
- dispatch({
713
- type: ActionTypes.INIT
714
- });
715
- return _ref2 = {
716
- dispatch: dispatch,
717
- subscribe: subscribe,
718
- getState: getState,
719
- replaceReducer: replaceReducer
720
- }, _ref2[$$observable] = observable, _ref2;
721
- }
722
-
723
- /**
724
- * Prints a warning in the console if it exists.
725
- *
726
- * @param {String} message The warning message.
727
- * @returns {void}
728
- */
729
- function warning(message) {
730
- /* eslint-disable no-console */
731
- if (typeof console !== 'undefined' && typeof console.error === 'function') {
732
- console.error(message);
733
- }
734
- /* eslint-enable no-console */
735
-
736
-
737
- try {
738
- // This error was thrown as a convenience so that if you enable
739
- // "break on all exceptions" in your console,
740
- // it would pause the execution at this line.
741
- throw new Error(message);
742
- } catch (e) {} // eslint-disable-line no-empty
743
-
744
- }
745
-
746
- function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
747
- var reducerKeys = Object.keys(reducers);
748
- var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
749
-
750
- if (reducerKeys.length === 0) {
751
- return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
752
- }
753
-
754
- if (!isPlainObject(inputState)) {
755
- return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
756
- }
757
-
758
- var unexpectedKeys = Object.keys(inputState).filter(function (key) {
759
- return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
760
- });
761
- unexpectedKeys.forEach(function (key) {
762
- unexpectedKeyCache[key] = true;
763
- });
764
- if (action && action.type === ActionTypes.REPLACE) return;
765
-
766
- if (unexpectedKeys.length > 0) {
767
- return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
768
- }
769
- }
770
-
771
- function assertReducerShape(reducers) {
772
- Object.keys(reducers).forEach(function (key) {
773
- var reducer = reducers[key];
774
- var initialState = reducer(undefined, {
775
- type: ActionTypes.INIT
776
- });
777
-
778
- if (typeof initialState === 'undefined') {
779
- throw new Error( false ? 0 : "The slice reducer for key \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
780
- }
781
-
782
- if (typeof reducer(undefined, {
783
- type: ActionTypes.PROBE_UNKNOWN_ACTION()
784
- }) === 'undefined') {
785
- throw new Error( false ? 0 : "The slice reducer for key \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
786
- }
787
- });
788
- }
789
- /**
790
- * Turns an object whose values are different reducer functions, into a single
791
- * reducer function. It will call every child reducer, and gather their results
792
- * into a single state object, whose keys correspond to the keys of the passed
793
- * reducer functions.
794
- *
795
- * @param {Object} reducers An object whose values correspond to different
796
- * reducer functions that need to be combined into one. One handy way to obtain
797
- * it is to use ES6 `import * as reducers` syntax. The reducers may never return
798
- * undefined for any action. Instead, they should return their initial state
799
- * if the state passed to them was undefined, and the current state for any
800
- * unrecognized action.
801
- *
802
- * @returns {Function} A reducer function that invokes every reducer inside the
803
- * passed object, and builds a state object with the same shape.
804
- */
805
-
806
-
807
- function combineReducers(reducers) {
808
- var reducerKeys = Object.keys(reducers);
809
- var finalReducers = {};
810
-
811
- for (var i = 0; i < reducerKeys.length; i++) {
812
- var key = reducerKeys[i];
813
-
814
- if (true) {
815
- if (typeof reducers[key] === 'undefined') {
816
- warning("No reducer provided for key \"" + key + "\"");
817
- }
818
- }
819
-
820
- if (typeof reducers[key] === 'function') {
821
- finalReducers[key] = reducers[key];
822
- }
823
- }
824
-
825
- var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
826
- // keys multiple times.
827
-
828
- var unexpectedKeyCache;
829
-
830
- if (true) {
831
- unexpectedKeyCache = {};
832
- }
833
-
834
- var shapeAssertionError;
835
-
836
- try {
837
- assertReducerShape(finalReducers);
838
- } catch (e) {
839
- shapeAssertionError = e;
840
- }
841
-
842
- return function combination(state, action) {
843
- if (state === void 0) {
844
- state = {};
845
- }
846
-
847
- if (shapeAssertionError) {
848
- throw shapeAssertionError;
849
- }
850
-
851
- if (true) {
852
- var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
853
-
854
- if (warningMessage) {
855
- warning(warningMessage);
856
- }
857
- }
858
-
859
- var hasChanged = false;
860
- var nextState = {};
861
-
862
- for (var _i = 0; _i < finalReducerKeys.length; _i++) {
863
- var _key = finalReducerKeys[_i];
864
- var reducer = finalReducers[_key];
865
- var previousStateForKey = state[_key];
866
- var nextStateForKey = reducer(previousStateForKey, action);
867
-
868
- if (typeof nextStateForKey === 'undefined') {
869
- var actionType = action && action.type;
870
- throw new Error( false ? 0 : "When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.");
871
- }
872
-
873
- nextState[_key] = nextStateForKey;
874
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
875
- }
876
-
877
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
878
- return hasChanged ? nextState : state;
879
- };
880
- }
881
-
882
- function bindActionCreator(actionCreator, dispatch) {
883
- return function () {
884
- return dispatch(actionCreator.apply(this, arguments));
885
- };
886
- }
887
- /**
888
- * Turns an object whose values are action creators, into an object with the
889
- * same keys, but with every function wrapped into a `dispatch` call so they
890
- * may be invoked directly. This is just a convenience method, as you can call
891
- * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
892
- *
893
- * For convenience, you can also pass an action creator as the first argument,
894
- * and get a dispatch wrapped function in return.
895
- *
896
- * @param {Function|Object} actionCreators An object whose values are action
897
- * creator functions. One handy way to obtain it is to use ES6 `import * as`
898
- * syntax. You may also pass a single function.
899
- *
900
- * @param {Function} dispatch The `dispatch` function available on your Redux
901
- * store.
902
- *
903
- * @returns {Function|Object} The object mimicking the original object, but with
904
- * every action creator wrapped into the `dispatch` call. If you passed a
905
- * function as `actionCreators`, the return value will also be a single
906
- * function.
907
- */
908
-
909
-
910
- function bindActionCreators(actionCreators, dispatch) {
911
- if (typeof actionCreators === 'function') {
912
- return bindActionCreator(actionCreators, dispatch);
913
- }
914
-
915
- if (typeof actionCreators !== 'object' || actionCreators === null) {
916
- throw new Error( false ? 0 : "bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
917
- }
918
-
919
- var boundActionCreators = {};
920
-
921
- for (var key in actionCreators) {
922
- var actionCreator = actionCreators[key];
923
-
924
- if (typeof actionCreator === 'function') {
925
- boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
926
- }
927
- }
928
-
929
- return boundActionCreators;
930
- }
931
-
932
- /**
933
- * Composes single-argument functions from right to left. The rightmost
934
- * function can take multiple arguments as it provides the signature for
935
- * the resulting composite function.
936
- *
937
- * @param {...Function} funcs The functions to compose.
938
- * @returns {Function} A function obtained by composing the argument functions
939
- * from right to left. For example, compose(f, g, h) is identical to doing
940
- * (...args) => f(g(h(...args))).
941
- */
942
- function compose() {
943
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
944
- funcs[_key] = arguments[_key];
945
- }
946
-
947
- if (funcs.length === 0) {
948
- return function (arg) {
949
- return arg;
950
- };
951
- }
952
-
953
- if (funcs.length === 1) {
954
- return funcs[0];
955
- }
956
-
957
- return funcs.reduce(function (a, b) {
958
- return function () {
959
- return a(b.apply(void 0, arguments));
960
- };
961
- });
962
- }
963
-
964
- /**
965
- * Creates a store enhancer that applies middleware to the dispatch method
966
- * of the Redux store. This is handy for a variety of tasks, such as expressing
967
- * asynchronous actions in a concise manner, or logging every action payload.
968
- *
969
- * See `redux-thunk` package as an example of the Redux middleware.
970
- *
971
- * Because middleware is potentially asynchronous, this should be the first
972
- * store enhancer in the composition chain.
973
- *
974
- * Note that each middleware will be given the `dispatch` and `getState` functions
975
- * as named arguments.
976
- *
977
- * @param {...Function} middlewares The middleware chain to be applied.
978
- * @returns {Function} A store enhancer applying the middleware.
979
- */
980
-
981
- function applyMiddleware() {
982
- for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
983
- middlewares[_key] = arguments[_key];
984
- }
985
-
986
- return function (createStore) {
987
- return function () {
988
- var store = createStore.apply(void 0, arguments);
989
-
990
- var _dispatch = function dispatch() {
991
- throw new Error( false ? 0 : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
992
- };
993
-
994
- var middlewareAPI = {
995
- getState: store.getState,
996
- dispatch: function dispatch() {
997
- return _dispatch.apply(void 0, arguments);
998
- }
999
- };
1000
- var chain = middlewares.map(function (middleware) {
1001
- return middleware(middlewareAPI);
1002
- });
1003
- _dispatch = compose.apply(void 0, chain)(store.dispatch);
1004
- return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__.default)((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__.default)({}, store), {}, {
1005
- dispatch: _dispatch
1006
- });
1007
- };
1008
- };
1009
- }
1010
-
1011
- /*
1012
- * This is a dummy function to check if the function name has been altered by minification.
1013
- * If the function has been minified and NODE_ENV !== 'production', warn the user.
1014
- */
1015
-
1016
- function isCrushed() {}
1017
-
1018
- if ( true && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
1019
- warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
1020
- }
1021
-
1022
-
1023
-
1024
-
1025
- /***/ }),
1026
-
1027
- /***/ "./node_modules/regenerator-runtime/runtime.js":
1028
- /*!*****************************************************!*\
1029
- !*** ./node_modules/regenerator-runtime/runtime.js ***!
1030
- \*****************************************************/
1031
- /***/ ((module) => {
1032
-
1033
- /**
1034
- * Copyright (c) 2014-present, Facebook, Inc.
1035
- *
1036
- * This source code is licensed under the MIT license found in the
1037
- * LICENSE file in the root directory of this source tree.
1038
- */
1039
-
1040
- var runtime = (function (exports) {
1041
- "use strict";
1042
-
1043
- var Op = Object.prototype;
1044
- var hasOwn = Op.hasOwnProperty;
1045
- var undefined; // More compressible than void 0.
1046
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
1047
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
1048
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
1049
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
1050
-
1051
- function define(obj, key, value) {
1052
- Object.defineProperty(obj, key, {
1053
- value: value,
1054
- enumerable: true,
1055
- configurable: true,
1056
- writable: true
1057
- });
1058
- return obj[key];
1059
- }
1060
- try {
1061
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
1062
- define({}, "");
1063
- } catch (err) {
1064
- define = function(obj, key, value) {
1065
- return obj[key] = value;
1066
- };
1067
- }
1068
-
1069
- function wrap(innerFn, outerFn, self, tryLocsList) {
1070
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
1071
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
1072
- var generator = Object.create(protoGenerator.prototype);
1073
- var context = new Context(tryLocsList || []);
1074
-
1075
- // The ._invoke method unifies the implementations of the .next,
1076
- // .throw, and .return methods.
1077
- generator._invoke = makeInvokeMethod(innerFn, self, context);
1078
-
1079
- return generator;
1080
- }
1081
- exports.wrap = wrap;
1082
-
1083
- // Try/catch helper to minimize deoptimizations. Returns a completion
1084
- // record like context.tryEntries[i].completion. This interface could
1085
- // have been (and was previously) designed to take a closure to be
1086
- // invoked without arguments, but in all the cases we care about we
1087
- // already have an existing method we want to call, so there's no need
1088
- // to create a new function object. We can even get away with assuming
1089
- // the method takes exactly one argument, since that happens to be true
1090
- // in every case, so we don't have to touch the arguments object. The
1091
- // only additional allocation required is the completion record, which
1092
- // has a stable shape and so hopefully should be cheap to allocate.
1093
- function tryCatch(fn, obj, arg) {
1094
- try {
1095
- return { type: "normal", arg: fn.call(obj, arg) };
1096
- } catch (err) {
1097
- return { type: "throw", arg: err };
1098
- }
1099
- }
1100
-
1101
- var GenStateSuspendedStart = "suspendedStart";
1102
- var GenStateSuspendedYield = "suspendedYield";
1103
- var GenStateExecuting = "executing";
1104
- var GenStateCompleted = "completed";
1105
-
1106
- // Returning this object from the innerFn has the same effect as
1107
- // breaking out of the dispatch switch statement.
1108
- var ContinueSentinel = {};
1109
-
1110
- // Dummy constructor functions that we use as the .constructor and
1111
- // .constructor.prototype properties for functions that return Generator
1112
- // objects. For full spec compliance, you may wish to configure your
1113
- // minifier not to mangle the names of these two functions.
1114
- function Generator() {}
1115
- function GeneratorFunction() {}
1116
- function GeneratorFunctionPrototype() {}
1117
-
1118
- // This is a polyfill for %IteratorPrototype% for environments that
1119
- // don't natively support it.
1120
- var IteratorPrototype = {};
1121
- IteratorPrototype[iteratorSymbol] = function () {
1122
- return this;
1123
- };
1124
-
1125
- var getProto = Object.getPrototypeOf;
1126
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
1127
- if (NativeIteratorPrototype &&
1128
- NativeIteratorPrototype !== Op &&
1129
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
1130
- // This environment has a native %IteratorPrototype%; use it instead
1131
- // of the polyfill.
1132
- IteratorPrototype = NativeIteratorPrototype;
1133
- }
1134
-
1135
- var Gp = GeneratorFunctionPrototype.prototype =
1136
- Generator.prototype = Object.create(IteratorPrototype);
1137
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
1138
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
1139
- GeneratorFunction.displayName = define(
1140
- GeneratorFunctionPrototype,
1141
- toStringTagSymbol,
1142
- "GeneratorFunction"
1143
- );
1144
-
1145
- // Helper for defining the .next, .throw, and .return methods of the
1146
- // Iterator interface in terms of a single ._invoke method.
1147
- function defineIteratorMethods(prototype) {
1148
- ["next", "throw", "return"].forEach(function(method) {
1149
- define(prototype, method, function(arg) {
1150
- return this._invoke(method, arg);
1151
- });
1152
- });
1153
- }
1154
-
1155
- exports.isGeneratorFunction = function(genFun) {
1156
- var ctor = typeof genFun === "function" && genFun.constructor;
1157
- return ctor
1158
- ? ctor === GeneratorFunction ||
1159
- // For the native GeneratorFunction constructor, the best we can
1160
- // do is to check its .name property.
1161
- (ctor.displayName || ctor.name) === "GeneratorFunction"
1162
- : false;
1163
- };
1164
-
1165
- exports.mark = function(genFun) {
1166
- if (Object.setPrototypeOf) {
1167
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
1168
- } else {
1169
- genFun.__proto__ = GeneratorFunctionPrototype;
1170
- define(genFun, toStringTagSymbol, "GeneratorFunction");
1171
- }
1172
- genFun.prototype = Object.create(Gp);
1173
- return genFun;
1174
- };
1175
-
1176
- // Within the body of any async function, `await x` is transformed to
1177
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
1178
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
1179
- // meant to be awaited.
1180
- exports.awrap = function(arg) {
1181
- return { __await: arg };
1182
- };
1183
-
1184
- function AsyncIterator(generator, PromiseImpl) {
1185
- function invoke(method, arg, resolve, reject) {
1186
- var record = tryCatch(generator[method], generator, arg);
1187
- if (record.type === "throw") {
1188
- reject(record.arg);
1189
- } else {
1190
- var result = record.arg;
1191
- var value = result.value;
1192
- if (value &&
1193
- typeof value === "object" &&
1194
- hasOwn.call(value, "__await")) {
1195
- return PromiseImpl.resolve(value.__await).then(function(value) {
1196
- invoke("next", value, resolve, reject);
1197
- }, function(err) {
1198
- invoke("throw", err, resolve, reject);
1199
- });
1200
- }
1201
-
1202
- return PromiseImpl.resolve(value).then(function(unwrapped) {
1203
- // When a yielded Promise is resolved, its final value becomes
1204
- // the .value of the Promise<{value,done}> result for the
1205
- // current iteration.
1206
- result.value = unwrapped;
1207
- resolve(result);
1208
- }, function(error) {
1209
- // If a rejected Promise was yielded, throw the rejection back
1210
- // into the async generator function so it can be handled there.
1211
- return invoke("throw", error, resolve, reject);
1212
- });
1213
- }
1214
- }
1215
-
1216
- var previousPromise;
1217
-
1218
- function enqueue(method, arg) {
1219
- function callInvokeWithMethodAndArg() {
1220
- return new PromiseImpl(function(resolve, reject) {
1221
- invoke(method, arg, resolve, reject);
1222
- });
1223
- }
1224
-
1225
- return previousPromise =
1226
- // If enqueue has been called before, then we want to wait until
1227
- // all previous Promises have been resolved before calling invoke,
1228
- // so that results are always delivered in the correct order. If
1229
- // enqueue has not been called before, then it is important to
1230
- // call invoke immediately, without waiting on a callback to fire,
1231
- // so that the async generator function has the opportunity to do
1232
- // any necessary setup in a predictable way. This predictability
1233
- // is why the Promise constructor synchronously invokes its
1234
- // executor callback, and why async functions synchronously
1235
- // execute code before the first await. Since we implement simple
1236
- // async functions in terms of async generators, it is especially
1237
- // important to get this right, even though it requires care.
1238
- previousPromise ? previousPromise.then(
1239
- callInvokeWithMethodAndArg,
1240
- // Avoid propagating failures to Promises returned by later
1241
- // invocations of the iterator.
1242
- callInvokeWithMethodAndArg
1243
- ) : callInvokeWithMethodAndArg();
1244
- }
1245
-
1246
- // Define the unified helper method that is used to implement .next,
1247
- // .throw, and .return (see defineIteratorMethods).
1248
- this._invoke = enqueue;
1249
- }
1250
-
1251
- defineIteratorMethods(AsyncIterator.prototype);
1252
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
1253
- return this;
1254
- };
1255
- exports.AsyncIterator = AsyncIterator;
1256
-
1257
- // Note that simple async functions are implemented on top of
1258
- // AsyncIterator objects; they just return a Promise for the value of
1259
- // the final result produced by the iterator.
1260
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
1261
- if (PromiseImpl === void 0) PromiseImpl = Promise;
1262
-
1263
- var iter = new AsyncIterator(
1264
- wrap(innerFn, outerFn, self, tryLocsList),
1265
- PromiseImpl
1266
- );
1267
-
1268
- return exports.isGeneratorFunction(outerFn)
1269
- ? iter // If outerFn is a generator, return the full iterator.
1270
- : iter.next().then(function(result) {
1271
- return result.done ? result.value : iter.next();
1272
- });
1273
- };
1274
-
1275
- function makeInvokeMethod(innerFn, self, context) {
1276
- var state = GenStateSuspendedStart;
1277
-
1278
- return function invoke(method, arg) {
1279
- if (state === GenStateExecuting) {
1280
- throw new Error("Generator is already running");
1281
- }
1282
-
1283
- if (state === GenStateCompleted) {
1284
- if (method === "throw") {
1285
- throw arg;
1286
- }
1287
-
1288
- // Be forgiving, per 25.3.3.3.3 of the spec:
1289
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
1290
- return doneResult();
1291
- }
1292
-
1293
- context.method = method;
1294
- context.arg = arg;
1295
-
1296
- while (true) {
1297
- var delegate = context.delegate;
1298
- if (delegate) {
1299
- var delegateResult = maybeInvokeDelegate(delegate, context);
1300
- if (delegateResult) {
1301
- if (delegateResult === ContinueSentinel) continue;
1302
- return delegateResult;
1303
- }
1304
- }
1305
-
1306
- if (context.method === "next") {
1307
- // Setting context._sent for legacy support of Babel's
1308
- // function.sent implementation.
1309
- context.sent = context._sent = context.arg;
1310
-
1311
- } else if (context.method === "throw") {
1312
- if (state === GenStateSuspendedStart) {
1313
- state = GenStateCompleted;
1314
- throw context.arg;
1315
- }
1316
-
1317
- context.dispatchException(context.arg);
1318
-
1319
- } else if (context.method === "return") {
1320
- context.abrupt("return", context.arg);
1321
- }
1322
-
1323
- state = GenStateExecuting;
1324
-
1325
- var record = tryCatch(innerFn, self, context);
1326
- if (record.type === "normal") {
1327
- // If an exception is thrown from innerFn, we leave state ===
1328
- // GenStateExecuting and loop back for another invocation.
1329
- state = context.done
1330
- ? GenStateCompleted
1331
- : GenStateSuspendedYield;
1332
-
1333
- if (record.arg === ContinueSentinel) {
1334
- continue;
1335
- }
1336
-
1337
- return {
1338
- value: record.arg,
1339
- done: context.done
1340
- };
1341
-
1342
- } else if (record.type === "throw") {
1343
- state = GenStateCompleted;
1344
- // Dispatch the exception by looping back around to the
1345
- // context.dispatchException(context.arg) call above.
1346
- context.method = "throw";
1347
- context.arg = record.arg;
1348
- }
1349
- }
1350
- };
1351
- }
1352
-
1353
- // Call delegate.iterator[context.method](context.arg) and handle the
1354
- // result, either by returning a { value, done } result from the
1355
- // delegate iterator, or by modifying context.method and context.arg,
1356
- // setting context.delegate to null, and returning the ContinueSentinel.
1357
- function maybeInvokeDelegate(delegate, context) {
1358
- var method = delegate.iterator[context.method];
1359
- if (method === undefined) {
1360
- // A .throw or .return when the delegate iterator has no .throw
1361
- // method always terminates the yield* loop.
1362
- context.delegate = null;
1363
-
1364
- if (context.method === "throw") {
1365
- // Note: ["return"] must be used for ES3 parsing compatibility.
1366
- if (delegate.iterator["return"]) {
1367
- // If the delegate iterator has a return method, give it a
1368
- // chance to clean up.
1369
- context.method = "return";
1370
- context.arg = undefined;
1371
- maybeInvokeDelegate(delegate, context);
1372
-
1373
- if (context.method === "throw") {
1374
- // If maybeInvokeDelegate(context) changed context.method from
1375
- // "return" to "throw", let that override the TypeError below.
1376
- return ContinueSentinel;
1377
- }
1378
- }
1379
-
1380
- context.method = "throw";
1381
- context.arg = new TypeError(
1382
- "The iterator does not provide a 'throw' method");
1383
- }
1384
-
1385
- return ContinueSentinel;
1386
- }
1387
-
1388
- var record = tryCatch(method, delegate.iterator, context.arg);
1389
-
1390
- if (record.type === "throw") {
1391
- context.method = "throw";
1392
- context.arg = record.arg;
1393
- context.delegate = null;
1394
- return ContinueSentinel;
1395
- }
1396
-
1397
- var info = record.arg;
1398
-
1399
- if (! info) {
1400
- context.method = "throw";
1401
- context.arg = new TypeError("iterator result is not an object");
1402
- context.delegate = null;
1403
- return ContinueSentinel;
1404
- }
1405
-
1406
- if (info.done) {
1407
- // Assign the result of the finished delegate to the temporary
1408
- // variable specified by delegate.resultName (see delegateYield).
1409
- context[delegate.resultName] = info.value;
1410
-
1411
- // Resume execution at the desired location (see delegateYield).
1412
- context.next = delegate.nextLoc;
1413
-
1414
- // If context.method was "throw" but the delegate handled the
1415
- // exception, let the outer generator proceed normally. If
1416
- // context.method was "next", forget context.arg since it has been
1417
- // "consumed" by the delegate iterator. If context.method was
1418
- // "return", allow the original .return call to continue in the
1419
- // outer generator.
1420
- if (context.method !== "return") {
1421
- context.method = "next";
1422
- context.arg = undefined;
1423
- }
1424
-
1425
- } else {
1426
- // Re-yield the result returned by the delegate method.
1427
- return info;
1428
- }
1429
-
1430
- // The delegate iterator is finished, so forget it and continue with
1431
- // the outer generator.
1432
- context.delegate = null;
1433
- return ContinueSentinel;
1434
- }
1435
-
1436
- // Define Generator.prototype.{next,throw,return} in terms of the
1437
- // unified ._invoke helper method.
1438
- defineIteratorMethods(Gp);
1439
-
1440
- define(Gp, toStringTagSymbol, "Generator");
1441
-
1442
- // A Generator should always return itself as the iterator object when the
1443
- // @@iterator function is called on it. Some browsers' implementations of the
1444
- // iterator prototype chain incorrectly implement this, causing the Generator
1445
- // object to not be returned from this call. This ensures that doesn't happen.
1446
- // See https://github.com/facebook/regenerator/issues/274 for more details.
1447
- Gp[iteratorSymbol] = function() {
1448
- return this;
1449
- };
1450
-
1451
- Gp.toString = function() {
1452
- return "[object Generator]";
1453
- };
1454
-
1455
- function pushTryEntry(locs) {
1456
- var entry = { tryLoc: locs[0] };
1457
-
1458
- if (1 in locs) {
1459
- entry.catchLoc = locs[1];
1460
- }
1461
-
1462
- if (2 in locs) {
1463
- entry.finallyLoc = locs[2];
1464
- entry.afterLoc = locs[3];
1465
- }
1466
-
1467
- this.tryEntries.push(entry);
1468
- }
1469
-
1470
- function resetTryEntry(entry) {
1471
- var record = entry.completion || {};
1472
- record.type = "normal";
1473
- delete record.arg;
1474
- entry.completion = record;
1475
- }
1476
-
1477
- function Context(tryLocsList) {
1478
- // The root entry object (effectively a try statement without a catch
1479
- // or a finally block) gives us a place to store values thrown from
1480
- // locations where there is no enclosing try statement.
1481
- this.tryEntries = [{ tryLoc: "root" }];
1482
- tryLocsList.forEach(pushTryEntry, this);
1483
- this.reset(true);
1484
- }
1485
-
1486
- exports.keys = function(object) {
1487
- var keys = [];
1488
- for (var key in object) {
1489
- keys.push(key);
1490
- }
1491
- keys.reverse();
1492
-
1493
- // Rather than returning an object with a next method, we keep
1494
- // things simple and return the next function itself.
1495
- return function next() {
1496
- while (keys.length) {
1497
- var key = keys.pop();
1498
- if (key in object) {
1499
- next.value = key;
1500
- next.done = false;
1501
- return next;
1502
- }
1503
- }
1504
-
1505
- // To avoid creating an additional object, we just hang the .value
1506
- // and .done properties off the next function object itself. This
1507
- // also ensures that the minifier will not anonymize the function.
1508
- next.done = true;
1509
- return next;
1510
- };
1511
- };
1512
-
1513
- function values(iterable) {
1514
- if (iterable) {
1515
- var iteratorMethod = iterable[iteratorSymbol];
1516
- if (iteratorMethod) {
1517
- return iteratorMethod.call(iterable);
1518
- }
1519
-
1520
- if (typeof iterable.next === "function") {
1521
- return iterable;
1522
- }
1523
-
1524
- if (!isNaN(iterable.length)) {
1525
- var i = -1, next = function next() {
1526
- while (++i < iterable.length) {
1527
- if (hasOwn.call(iterable, i)) {
1528
- next.value = iterable[i];
1529
- next.done = false;
1530
- return next;
1531
- }
1532
- }
1533
-
1534
- next.value = undefined;
1535
- next.done = true;
1536
-
1537
- return next;
1538
- };
1539
-
1540
- return next.next = next;
1541
- }
1542
- }
1543
-
1544
- // Return an iterator with no values.
1545
- return { next: doneResult };
1546
- }
1547
- exports.values = values;
1548
-
1549
- function doneResult() {
1550
- return { value: undefined, done: true };
1551
- }
1552
-
1553
- Context.prototype = {
1554
- constructor: Context,
1555
-
1556
- reset: function(skipTempReset) {
1557
- this.prev = 0;
1558
- this.next = 0;
1559
- // Resetting context._sent for legacy support of Babel's
1560
- // function.sent implementation.
1561
- this.sent = this._sent = undefined;
1562
- this.done = false;
1563
- this.delegate = null;
1564
-
1565
- this.method = "next";
1566
- this.arg = undefined;
1567
-
1568
- this.tryEntries.forEach(resetTryEntry);
1569
-
1570
- if (!skipTempReset) {
1571
- for (var name in this) {
1572
- // Not sure about the optimal order of these conditions:
1573
- if (name.charAt(0) === "t" &&
1574
- hasOwn.call(this, name) &&
1575
- !isNaN(+name.slice(1))) {
1576
- this[name] = undefined;
1577
- }
1578
- }
1579
- }
1580
- },
1581
-
1582
- stop: function() {
1583
- this.done = true;
1584
-
1585
- var rootEntry = this.tryEntries[0];
1586
- var rootRecord = rootEntry.completion;
1587
- if (rootRecord.type === "throw") {
1588
- throw rootRecord.arg;
1589
- }
1590
-
1591
- return this.rval;
1592
- },
1593
-
1594
- dispatchException: function(exception) {
1595
- if (this.done) {
1596
- throw exception;
1597
- }
1598
-
1599
- var context = this;
1600
- function handle(loc, caught) {
1601
- record.type = "throw";
1602
- record.arg = exception;
1603
- context.next = loc;
1604
-
1605
- if (caught) {
1606
- // If the dispatched exception was caught by a catch block,
1607
- // then let that catch block handle the exception normally.
1608
- context.method = "next";
1609
- context.arg = undefined;
1610
- }
1611
-
1612
- return !! caught;
1613
- }
1614
-
1615
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1616
- var entry = this.tryEntries[i];
1617
- var record = entry.completion;
1618
-
1619
- if (entry.tryLoc === "root") {
1620
- // Exception thrown outside of any try block that could handle
1621
- // it, so set the completion value of the entire function to
1622
- // throw the exception.
1623
- return handle("end");
1624
- }
1625
-
1626
- if (entry.tryLoc <= this.prev) {
1627
- var hasCatch = hasOwn.call(entry, "catchLoc");
1628
- var hasFinally = hasOwn.call(entry, "finallyLoc");
1629
-
1630
- if (hasCatch && hasFinally) {
1631
- if (this.prev < entry.catchLoc) {
1632
- return handle(entry.catchLoc, true);
1633
- } else if (this.prev < entry.finallyLoc) {
1634
- return handle(entry.finallyLoc);
1635
- }
1636
-
1637
- } else if (hasCatch) {
1638
- if (this.prev < entry.catchLoc) {
1639
- return handle(entry.catchLoc, true);
1640
- }
1641
-
1642
- } else if (hasFinally) {
1643
- if (this.prev < entry.finallyLoc) {
1644
- return handle(entry.finallyLoc);
1645
- }
1646
-
1647
- } else {
1648
- throw new Error("try statement without catch or finally");
1649
- }
1650
- }
1651
- }
1652
- },
1653
-
1654
- abrupt: function(type, arg) {
1655
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1656
- var entry = this.tryEntries[i];
1657
- if (entry.tryLoc <= this.prev &&
1658
- hasOwn.call(entry, "finallyLoc") &&
1659
- this.prev < entry.finallyLoc) {
1660
- var finallyEntry = entry;
1661
- break;
1662
- }
1663
- }
1664
-
1665
- if (finallyEntry &&
1666
- (type === "break" ||
1667
- type === "continue") &&
1668
- finallyEntry.tryLoc <= arg &&
1669
- arg <= finallyEntry.finallyLoc) {
1670
- // Ignore the finally entry if control is not jumping to a
1671
- // location outside the try/catch block.
1672
- finallyEntry = null;
1673
- }
1674
-
1675
- var record = finallyEntry ? finallyEntry.completion : {};
1676
- record.type = type;
1677
- record.arg = arg;
1678
-
1679
- if (finallyEntry) {
1680
- this.method = "next";
1681
- this.next = finallyEntry.finallyLoc;
1682
- return ContinueSentinel;
1683
- }
1684
-
1685
- return this.complete(record);
1686
- },
1687
-
1688
- complete: function(record, afterLoc) {
1689
- if (record.type === "throw") {
1690
- throw record.arg;
1691
- }
1692
-
1693
- if (record.type === "break" ||
1694
- record.type === "continue") {
1695
- this.next = record.arg;
1696
- } else if (record.type === "return") {
1697
- this.rval = this.arg = record.arg;
1698
- this.method = "return";
1699
- this.next = "end";
1700
- } else if (record.type === "normal" && afterLoc) {
1701
- this.next = afterLoc;
1702
- }
1703
-
1704
- return ContinueSentinel;
1705
- },
1706
-
1707
- finish: function(finallyLoc) {
1708
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1709
- var entry = this.tryEntries[i];
1710
- if (entry.finallyLoc === finallyLoc) {
1711
- this.complete(entry.completion, entry.afterLoc);
1712
- resetTryEntry(entry);
1713
- return ContinueSentinel;
1714
- }
1715
- }
1716
- },
1717
-
1718
- "catch": function(tryLoc) {
1719
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1720
- var entry = this.tryEntries[i];
1721
- if (entry.tryLoc === tryLoc) {
1722
- var record = entry.completion;
1723
- if (record.type === "throw") {
1724
- var thrown = record.arg;
1725
- resetTryEntry(entry);
1726
- }
1727
- return thrown;
1728
- }
1729
- }
1730
-
1731
- // The context.catch method must only be called with a location
1732
- // argument that corresponds to a known catch block.
1733
- throw new Error("illegal catch attempt");
1734
- },
1735
-
1736
- delegateYield: function(iterable, resultName, nextLoc) {
1737
- this.delegate = {
1738
- iterator: values(iterable),
1739
- resultName: resultName,
1740
- nextLoc: nextLoc
1741
- };
1742
-
1743
- if (this.method === "next") {
1744
- // Deliberately forget the last sent value so that we don't
1745
- // accidentally pass it on to the delegate.
1746
- this.arg = undefined;
1747
- }
1748
-
1749
- return ContinueSentinel;
1750
- }
1751
- };
1752
-
1753
- // Regardless of whether this script is executing as a CommonJS module
1754
- // or not, return the runtime object so that we can declare the variable
1755
- // regeneratorRuntime in the outer scope, which allows this module to be
1756
- // injected easily by `bin/regenerator --include-runtime script.js`.
1757
- return exports;
1758
-
1759
- }(
1760
- // If this script is executing as a CommonJS module, use module.exports
1761
- // as the regeneratorRuntime namespace. Otherwise create a new empty
1762
- // object. Either way, the resulting object will be used to initialize
1763
- // the regeneratorRuntime variable at the top of this file.
1764
- true ? module.exports : 0
1765
- ));
1766
-
1767
- try {
1768
- regeneratorRuntime = runtime;
1769
- } catch (accidentalStrictMode) {
1770
- // This module should not be running in strict mode, so the above
1771
- // assignment should always work unless something is misconfigured. Just
1772
- // in case runtime.js accidentally runs in strict mode, we can escape
1773
- // strict mode using a global Function call. This could conceivably fail
1774
- // if a Content Security Policy forbids using Function, but in that case
1775
- // the proper solution is to fix the accidental strict mode problem. If
1776
- // you've misconfigured your bundler to force strict mode and applied a
1777
- // CSP to forbid Function, and you're not willing to fix either of those
1778
- // problems, please detail your unique predicament in a GitHub issue.
1779
- Function("r", "regeneratorRuntime = r")(runtime);
1780
- }
1781
-
1782
-
1783
- /***/ })
1784
-
1785
- /******/ });
1786
- /************************************************************************/
1787
- /******/ // The module cache
1788
- /******/ var __webpack_module_cache__ = {};
1789
- /******/
1790
- /******/ // The require function
1791
- /******/ function __webpack_require__(moduleId) {
1792
- /******/ // Check if module is in cache
1793
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
1794
- /******/ if (cachedModule !== undefined) {
1795
- /******/ return cachedModule.exports;
1796
- /******/ }
1797
- /******/ // Create a new module (and put it into the cache)
1798
- /******/ var module = __webpack_module_cache__[moduleId] = {
1799
- /******/ // no module.id needed
1800
- /******/ // no module.loaded needed
1801
- /******/ exports: {}
1802
- /******/ };
1803
- /******/
1804
- /******/ // Execute the module function
1805
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1806
- /******/
1807
- /******/ // Return the exports of the module
1808
- /******/ return module.exports;
1809
- /******/ }
1810
- /******/
1811
- /************************************************************************/
1812
- /******/ /* webpack/runtime/compat get default export */
1813
- /******/ (() => {
1814
- /******/ // getDefaultExport function for compatibility with non-harmony modules
1815
- /******/ __webpack_require__.n = (module) => {
1816
- /******/ var getter = module && module.__esModule ?
1817
- /******/ () => (module['default']) :
1818
- /******/ () => (module);
1819
- /******/ __webpack_require__.d(getter, { a: getter });
1820
- /******/ return getter;
1821
- /******/ };
1822
- /******/ })();
1823
- /******/
1824
- /******/ /* webpack/runtime/define property getters */
1825
- /******/ (() => {
1826
- /******/ // define getter functions for harmony exports
1827
- /******/ __webpack_require__.d = (exports, definition) => {
1828
- /******/ for(var key in definition) {
1829
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1830
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1831
- /******/ }
1832
- /******/ }
1833
- /******/ };
1834
- /******/ })();
1835
- /******/
1836
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
1837
- /******/ (() => {
1838
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1839
- /******/ })();
1840
- /******/
1841
- /******/ /* webpack/runtime/make namespace object */
1842
- /******/ (() => {
1843
- /******/ // define __esModule on exports
1844
- /******/ __webpack_require__.r = (exports) => {
1845
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1846
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1847
- /******/ }
1848
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
1849
- /******/ };
1850
- /******/ })();
1851
- /******/
1852
- /************************************************************************/
1853
- var __webpack_exports__ = {};
1854
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
1855
- (() => {
1856
- "use strict";
1857
- /*!****************************************************!*\
1858
- !*** ./src/core/MeganavBlogPostsList/component.js ***!
1859
- \****************************************************/
1860
- __webpack_require__.r(__webpack_exports__);
1861
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1862
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1863
- /* harmony export */ });
1864
- /* harmony import */ var _dom_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom-query */ "./src/core/dom-query.js");
1865
- /* harmony import */ var _remote_blogs_posts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../remote-blogs-posts */ "./src/core/remote-blogs-posts.js");
1866
- /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../remote-data-store */ "./src/core/remote-data-store.js");
1867
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1868
-
1869
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1870
-
1871
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1872
-
1873
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1874
-
1875
- function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1876
-
1877
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1878
-
1879
-
1880
-
1881
-
1882
-
1883
- var template = function template(_ref) {
1884
- var link = _ref.link,
1885
- title = _ref.title,
1886
- pubDate = _ref.pubDate;
1887
-
1888
- var _map = ["li", "a", "p", "p"].map(function (el) {
1889
- return document.createElement(el);
1890
- }),
1891
- _map2 = _slicedToArray(_map, 4),
1892
- li = _map2[0],
1893
- a = _map2[1],
1894
- heading = _map2[2],
1895
- copy = _map2[3];
1896
-
1897
- a.href = link;
1898
- a.classList.add("ui-meganav-media", "group");
1899
- heading.textContent = title;
1900
- heading.classList.add("ui-meganav-media-heading");
1901
- copy.textContent = pubDate;
1902
- copy.classList.add("ui-meganav-media-copy");
1903
- a.appendChild(heading);
1904
- a.appendChild(copy);
1905
- li.appendChild(a);
1906
- return li;
1907
- };
1908
-
1909
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () {
1910
- (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_2__.connectState)(_remote_blogs_posts__WEBPACK_IMPORTED_MODULE_1__.selectRecentBlogPosts, function (recentBlogPosts) {
1911
- if (Array.isArray(recentBlogPosts) && recentBlogPosts.length > 0) {
1912
- var sections = (0,_dom_query__WEBPACK_IMPORTED_MODULE_0__.queryIdAll)("meganav-why-ably-panel-blog-section");
1913
- var containers = (0,_dom_query__WEBPACK_IMPORTED_MODULE_0__.queryIdAll)("meganav-why-ably-panel-recent-blog-posts");
1914
- Array.from(containers).forEach(function (container) {
1915
- var fragment = document.createDocumentFragment();
1916
- recentBlogPosts.forEach(function (post) {
1917
- return fragment.appendChild(template(post));
1918
- });
1919
- container.appendChild(fragment);
1920
- });
1921
- Array.from(sections).forEach(function (section) {
1922
- return section.classList.remove("hidden");
1923
- });
1924
- }
1925
- });
1926
- });
1927
- })();
1928
-
1929
- __webpack_exports__ = __webpack_exports__.default;
1930
- /******/ return __webpack_exports__;
1931
- /******/ })()
1932
- ;
1933
- });
1934
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9BYmx5VWkuQ29yZS5bbmFtZV0vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovL0FibHlVaS5Db3JlLltuYW1lXS8uL25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL2VzbS9kZWZpbmVQcm9wZXJ0eS5qcyIsIndlYnBhY2s6Ly9BYmx5VWkuQ29yZS5bbmFtZV0vLi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9lc20vb2JqZWN0U3ByZWFkMi5qcyIsIndlYnBhY2s6Ly9BYmx5VWkuQ29yZS5bbmFtZV0vLi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvcmVnZW5lcmF0b3IvaW5kZXguanMiLCJ3ZWJwYWNrOi8vQWJseVVpLkNvcmUuW25hbWVdLy4vc3JjL2NvcmUvZG9tLXF1ZXJ5LmpzIiwid2VicGFjazovL0FibHlVaS5Db3JlLltuYW1lXS8uL3NyYy9jb3JlL3JlbW90ZS1ibG9ncy1wb3N0cy5qcyIsIndlYnBhY2s6Ly9BYmx5VW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9PT1cbiAgICAgICAgICAvLyBHZW5TdGF0ZUV4ZWN1dGluZyBhbmQgbG9vcCBiYWNrIGZvciBhbm90aGVyIGludm9jYXRpb24uXG4gICAgICAgICAgc3RhdGUgPSBjb250ZXh0LmRvbmVcbiAgICAgICAgICAgID8gR2VuU3RhdGVDb21wbGV0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGV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GV4dCk7XG5cbiAgICAgICAgICBpZiAoY29udGV4dC5tZXRob2QgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgICAgLy8gSWYgbWF5YmVJbnZva2VEZWxlZ2F0ZShjb250ZXh0KSBjaGFuZ2VkIGNvbnRleHQubWV0aG9kIGZyb21cbiAgICAgICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG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5RW50cnkpO1xuXG4gICAgICBpZiAoIXNraXBUZW1wUmVzZXQpIHtcbiAgICAgICAgZm9yICh2YXIgbmFtZSBpbiB0aGlzKSB7XG4gICAgICAgICAgLy8gTm90IHN1cmUgYWJvdXQgdGhlIG9wdGltYWwgb3JkZXIgb2YgdGhlc2UgY29uZGl0aW9uczpcbiAgICAgICAgICBpZiAobmFtZS5jaGFyQXQoMCkgPT09IFwidFwiICYmXG4gICAgICAgICAgICAgIGhhc093bi5jYWxsKHRoaXMsIG5hbWUpICYmXG4gICAgICAgICAgICAgICFpc05hTigrbmFtZS5zbGljZSgxKSkpIHtcbiAgICAgICAgICAgIHRoaXNbbmFtZV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcblxuICAgICAgdmFyIHJvb3RFbnRyeSA9IHRoaXMudHJ5RW50cmllc1swXTtcbiAgICAgIHZhciByb290UmVjb3JkID0gcm9vdEVudHJ5LmNvbXBsZXRpb247XG4gICAgICBpZiAocm9vdFJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcm9vdFJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLnJ2YWw7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXhjZXB0aW9uOiBmdW5jdGlvbihleGNlcHRpb24pIHtcbiAgICAgIGlmICh0aGlzLmRvbmUpIHtcbiAgICAgICAgdGhyb3cgZXhjZXB0aW9uO1xuICAgICAgfVxuXG4gICAgICB2YXIgY29udGV4dCA9IHRoaXM7XG4gICAgICBmdW5jdGlvbiBoYW5kbGUobG9jLCBjYXVnaHQpIHtcbiAgICAgICAgcmVjb3JkLnR5cGUgPSBcInRocm93XCI7XG4gICAgICAgIHJlY29yZC5hcmcgPSBleGNlcHRpb247XG4gICAgIC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ICAgICAgdmFyIGhhc0ZpbmFsbHkgPSBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpO1xuXG4gICAgICAgICAgaWYgKGhhc0NhdGNoICYmIGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNDYXRjaCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5XCIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBhYnJ1cHQ6IGZ1bmN0aW9uKHR5cGUsIGFyZykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2ICYmXG4gICAgICAgICAgICBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpICYmXG4gICAgICAgICAgICB0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgdmFyIGZpbmFsbHlFbnRyeSA9IGVudHJ5O1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkgJiZcbiAgICAgICAgICAodHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgIHR5cGUgPT09IFwiY29udGludWVcIikgJiZcbiAgICAgICAgICBmaW5hbGx5RW50cnkudHJ5TG9jIDw9IGFyZyAmJlxuICAgICAgICAgIGFyZyA8PSBmaW5hbGx5RW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAvLyBJZ25vcmUgdGhlIGZpbmFsbHkgZW50cnkgaWYgY29udHJvbCBpcyBub3QganVtcGluZyB0byBhXG4gICAgICAgIC8vIGxvY2F0aW9uIG91dHNpZGUgdGhlIHRyeS9jYXRjaCBibG9jay5cbiAgICAgICAgZmluYWxseUVudHJ5ID0gbnVsbDtcbiAgICAgIH1cblxuICAgICAgdmFyIHJlY29yZCA9IGZpbmFsbHlFbnRyeSA/IGZpbmFsbHlFbnRyeS5jb21wbGV0aW9uIDoge307XG4gICAgICByZWNvcmQudHlwZSA9IHR5cGU7XG4gICAgICByZWNvcmQuYXJnID0gYXJnO1xuXG4gICAgICBpZiAoZmluYWxseUVudHJ5KSB7XG4gICAgICAgIHRoaXMubWV0aG9kID0gXCJuZXh0XCI7XG4gICAgICAgIHRoaXMubmV4dCA9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jO1xuICAgICAgICByZXR1cm4gQ29udGludWVTZW50aW5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Y2VSb290IjoiIn0=
1
+ !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.AblyUi=r():(t.AblyUi=t.AblyUi||{},t.AblyUi.Core=t.AblyUi.Core||{},t.AblyUi.Core.MeganavBlogPostsList=r())}(this,(function(){return(()=>{var t={7757:(t,r,e)=>{e(5666)},5666:t=>{var r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,r,e){var n=s;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return C()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===d)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===s)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:h,u.arg===d)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var s="suspendedStart",h="suspendedYield",p="executing",y="completed",d={};function v(){}function g(){}function m(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(_([])));x&&x!==e&&n.call(x,i)&&(b=x);var O=m.prototype=v.prototype=Object.create(b);function L(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}}function E(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function A(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:C}}function C(){return{value:r,done:!0}}return g.prototype=O.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},L(j.prototype),j.prototype[a]=function(){return this},t.AsyncIterator=j,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new j(l(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),u(O,c,"Generator"),O[i]=function(){return this},O.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return t[n](i,i.exports,e),i.exports}e.d=(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);var n={};return(()=>{"use strict";e.d(n,{default:()=>l});var t=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return r.querySelectorAll("[data-id=".concat(t,"]"))};function r(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(r){i(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}function i(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}e(7757);var a={recent:null},c=(i({},"blogPosts",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case"blog/loaded":return o(o({},t),{},{recent:r.payload});default:return t}})),function(t){var r;return null===(r=t.getState().blogPosts)||void 0===r?void 0:r.recent});function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}const l=function(){var r,e,n,o;r=c,e=function(r){if(Array.isArray(r)&&r.length>0){var e=t("meganav-why-ably-panel-blog-section"),n=t("meganav-why-ably-panel-recent-blog-posts");Array.from(n).forEach((function(t){var e=document.createDocumentFragment();r.forEach((function(t){return e.appendChild((i=(r=t).link,a=r.title,c=r.pubDate,n=["li","a","p","p"].map((function(t){return document.createElement(t)})),o=4,l=function(t){if(Array.isArray(t))return t}(n)||function(t,r){var e=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=e){var n,o,i=[],a=!0,c=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(c)throw o}}return i}}(n,o)||function(t,r){if(t){if("string"==typeof t)return u(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(t,r):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=l[0],s=l[1],h=l[2],p=l[3],s.href=i,s.classList.add("ui-meganav-media","group"),h.textContent=a,h.classList.add("ui-meganav-media-heading"),p.textContent=c,p.classList.add("ui-meganav-media-copy"),s.appendChild(h),s.appendChild(p),f.appendChild(s),f));var r,n,o,i,a,c,l,f,s,h,p})),t.appendChild(e)})),Array.from(e).forEach((function(t){return t.classList.remove("hidden")}))}},n=function(){if(!window.AblyUi.RemoteDataStore)throw new Error("Remote store was called before one was created");return window.AblyUi.RemoteDataStore}(),o=r(n),n.subscribe((function(){var t=r(n);t!==o&&(o=t,e(t))}))}})(),n.default})()}));