[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 this["wp"] = this["wp"] || {}; this["wp"]["data"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = 348); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ 0: 91 /***/ (function(module, exports) { 92 93 (function() { module.exports = this["wp"]["element"]; }()); 94 95 /***/ }), 96 97 /***/ 10: 98 /***/ (function(module, __webpack_exports__, __webpack_require__) { 99 100 "use strict"; 101 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); 102 function _defineProperty(obj, key, value) { 103 if (key in obj) { 104 Object.defineProperty(obj, key, { 105 value: value, 106 enumerable: true, 107 configurable: true, 108 writable: true 109 }); 110 } else { 111 obj[key] = value; 112 } 113 114 return obj; 115 } 116 117 /***/ }), 118 119 /***/ 111: 120 /***/ (function(module, exports) { 121 122 function combineReducers( reducers ) { 123 var keys = Object.keys( reducers ), 124 getNextState; 125 126 getNextState = ( function() { 127 var fn, i, key; 128 129 fn = 'return {'; 130 for ( i = 0; i < keys.length; i++ ) { 131 // Rely on Quoted escaping of JSON.stringify with guarantee that 132 // each member of Object.keys is a string. 133 // 134 // "If Type(value) is String, then return the result of calling the 135 // abstract operation Quote with argument value. [...] The abstract 136 // operation Quote(value) wraps a String value in double quotes and 137 // escapes characters within it." 138 // 139 // https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3 140 key = JSON.stringify( keys[ i ] ); 141 142 fn += key + ':r[' + key + '](s[' + key + '],a),'; 143 } 144 fn += '}'; 145 146 return new Function( 'r,s,a', fn ); 147 } )(); 148 149 return function combinedReducer( state, action ) { 150 var nextState, i, key; 151 152 // Assumed changed if initial state. 153 if ( state === undefined ) { 154 return getNextState( reducers, {}, action ); 155 } 156 157 nextState = getNextState( reducers, state, action ); 158 159 // Determine whether state has changed. 160 i = keys.length; 161 while ( i-- ) { 162 key = keys[ i ]; 163 if ( state[ key ] !== nextState[ key ] ) { 164 // Return immediately if a changed value is encountered. 165 return nextState; 166 } 167 } 168 169 return state; 170 }; 171 } 172 173 module.exports = combineReducers; 174 175 176 /***/ }), 177 178 /***/ 145: 179 /***/ (function(module, __webpack_exports__, __webpack_require__) { 180 181 "use strict"; 182 /* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(229); 183 /* global window */ 184 185 186 var root; 187 188 if (typeof self !== 'undefined') { 189 root = self; 190 } else if (typeof window !== 'undefined') { 191 root = window; 192 } else if (typeof global !== 'undefined') { 193 root = global; 194 } else if (true) { 195 root = module; 196 } else {} 197 198 var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(root); 199 /* harmony default export */ __webpack_exports__["a"] = (result); 200 201 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(65), __webpack_require__(318)(module))) 202 203 /***/ }), 204 205 /***/ 17: 206 /***/ (function(module, __webpack_exports__, __webpack_require__) { 207 208 "use strict"; 209 210 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js 211 function _arrayWithoutHoles(arr) { 212 if (Array.isArray(arr)) { 213 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { 214 arr2[i] = arr[i]; 215 } 216 217 return arr2; 218 } 219 } 220 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js 221 var iterableToArray = __webpack_require__(30); 222 223 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js 224 function _nonIterableSpread() { 225 throw new TypeError("Invalid attempt to spread non-iterable instance"); 226 } 227 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js 228 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); 229 230 231 232 function _toConsumableArray(arr) { 233 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); 234 } 235 236 /***/ }), 237 238 /***/ 18: 239 /***/ (function(module, __webpack_exports__, __webpack_require__) { 240 241 "use strict"; 242 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); 243 function _extends() { 244 _extends = Object.assign || function (target) { 245 for (var i = 1; i < arguments.length; i++) { 246 var source = arguments[i]; 247 248 for (var key in source) { 249 if (Object.prototype.hasOwnProperty.call(source, key)) { 250 target[key] = source[key]; 251 } 252 } 253 } 254 255 return target; 256 }; 257 258 return _extends.apply(this, arguments); 259 } 260 261 /***/ }), 262 263 /***/ 2: 264 /***/ (function(module, exports) { 265 266 (function() { module.exports = this["lodash"]; }()); 267 268 /***/ }), 269 270 /***/ 20: 271 /***/ (function(module, exports, __webpack_require__) { 272 273 module.exports = __webpack_require__(47); 274 275 276 /***/ }), 277 278 /***/ 228: 279 /***/ (function(module, exports) { 280 281 (function() { module.exports = this["wp"]["reduxRoutine"]; }()); 282 283 /***/ }), 284 285 /***/ 229: 286 /***/ (function(module, __webpack_exports__, __webpack_require__) { 287 288 "use strict"; 289 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; }); 290 function symbolObservablePonyfill(root) { 291 var result; 292 var Symbol = root.Symbol; 293 294 if (typeof Symbol === 'function') { 295 if (Symbol.observable) { 296 result = Symbol.observable; 297 } else { 298 result = Symbol('observable'); 299 Symbol.observable = result; 300 } 301 } else { 302 result = '@@observable'; 303 } 304 305 return result; 306 }; 307 308 309 /***/ }), 310 311 /***/ 23: 312 /***/ (function(module, __webpack_exports__, __webpack_require__) { 313 314 "use strict"; 315 316 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js 317 var arrayWithHoles = __webpack_require__(38); 318 319 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js 320 function _iterableToArrayLimit(arr, i) { 321 var _arr = []; 322 var _n = true; 323 var _d = false; 324 var _e = undefined; 325 326 try { 327 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 328 _arr.push(_s.value); 329 330 if (i && _arr.length === i) break; 331 } 332 } catch (err) { 333 _d = true; 334 _e = err; 335 } finally { 336 try { 337 if (!_n && _i["return"] != null) _i["return"](); 338 } finally { 339 if (_d) throw _e; 340 } 341 } 342 343 return _arr; 344 } 345 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js 346 var nonIterableRest = __webpack_require__(39); 347 348 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js 349 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); 350 351 352 353 function _slicedToArray(arr, i) { 354 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); 355 } 356 357 /***/ }), 358 359 /***/ 230: 360 /***/ (function(module, exports) { 361 362 (function() { module.exports = this["wp"]["priorityQueue"]; }()); 363 364 /***/ }), 365 366 /***/ 30: 367 /***/ (function(module, __webpack_exports__, __webpack_require__) { 368 369 "use strict"; 370 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); 371 function _iterableToArray(iter) { 372 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); 373 } 374 375 /***/ }), 376 377 /***/ 318: 378 /***/ (function(module, exports) { 379 380 module.exports = function(originalModule) { 381 if (!originalModule.webpackPolyfill) { 382 var module = Object.create(originalModule); 383 // module.parent = undefined by default 384 if (!module.children) module.children = []; 385 Object.defineProperty(module, "loaded", { 386 enumerable: true, 387 get: function() { 388 return module.l; 389 } 390 }); 391 Object.defineProperty(module, "id", { 392 enumerable: true, 393 get: function() { 394 return module.i; 395 } 396 }); 397 Object.defineProperty(module, "exports", { 398 enumerable: true 399 }); 400 module.webpackPolyfill = 1; 401 } 402 return module; 403 }; 404 405 406 /***/ }), 407 408 /***/ 348: 409 /***/ (function(module, __webpack_exports__, __webpack_require__) { 410 411 "use strict"; 412 __webpack_require__.r(__webpack_exports__); 413 var selectors_namespaceObject = {}; 414 __webpack_require__.r(selectors_namespaceObject); 415 __webpack_require__.d(selectors_namespaceObject, "getIsResolving", function() { return getIsResolving; }); 416 __webpack_require__.d(selectors_namespaceObject, "hasStartedResolution", function() { return hasStartedResolution; }); 417 __webpack_require__.d(selectors_namespaceObject, "hasFinishedResolution", function() { return hasFinishedResolution; }); 418 __webpack_require__.d(selectors_namespaceObject, "isResolving", function() { return isResolving; }); 419 __webpack_require__.d(selectors_namespaceObject, "getCachedResolvers", function() { return getCachedResolvers; }); 420 var actions_namespaceObject = {}; 421 __webpack_require__.r(actions_namespaceObject); 422 __webpack_require__.d(actions_namespaceObject, "startResolution", function() { return startResolution; }); 423 __webpack_require__.d(actions_namespaceObject, "finishResolution", function() { return finishResolution; }); 424 __webpack_require__.d(actions_namespaceObject, "invalidateResolution", function() { return invalidateResolution; }); 425 __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStore", function() { return invalidateResolutionForStore; }); 426 __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStoreSelector", function() { return invalidateResolutionForStoreSelector; }); 427 var plugins_namespaceObject = {}; 428 __webpack_require__.r(plugins_namespaceObject); 429 __webpack_require__.d(plugins_namespaceObject, "controls", function() { return controls; }); 430 __webpack_require__.d(plugins_namespaceObject, "persistence", function() { return plugins_persistence; }); 431 432 // EXTERNAL MODULE: ./node_modules/turbo-combine-reducers/index.js 433 var turbo_combine_reducers = __webpack_require__(111); 434 var turbo_combine_reducers_default = /*#__PURE__*/__webpack_require__.n(turbo_combine_reducers); 435 436 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules 437 var slicedToArray = __webpack_require__(23); 438 439 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js 440 var objectSpread = __webpack_require__(7); 441 442 // EXTERNAL MODULE: external "lodash" 443 var external_lodash_ = __webpack_require__(2); 444 445 // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js 446 var regenerator = __webpack_require__(20); 447 var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); 448 449 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js 450 var asyncToGenerator = __webpack_require__(43); 451 452 // EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js 453 var es = __webpack_require__(145); 454 455 // CONCATENATED MODULE: ./node_modules/redux/es/redux.js 456 457 458 /** 459 * These are private action types reserved by Redux. 460 * For any unknown actions, you must return the current state. 461 * If the current state is undefined, you must return the initial state. 462 * Do not reference these action types directly in your code. 463 */ 464 var randomString = function randomString() { 465 return Math.random().toString(36).substring(7).split('').join('.'); 466 }; 467 468 var ActionTypes = { 469 INIT: "@@redux/INIT" + randomString(), 470 REPLACE: "@@redux/REPLACE" + randomString(), 471 PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { 472 return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); 473 } 474 }; 475 476 /** 477 * @param {any} obj The object to inspect. 478 * @returns {boolean} True if the argument appears to be a plain object. 479 */ 480 function isPlainObject(obj) { 481 if (typeof obj !== 'object' || obj === null) return false; 482 var proto = obj; 483 484 while (Object.getPrototypeOf(proto) !== null) { 485 proto = Object.getPrototypeOf(proto); 486 } 487 488 return Object.getPrototypeOf(obj) === proto; 489 } 490 491 /** 492 * Creates a Redux store that holds the state tree. 493 * The only way to change the data in the store is to call `dispatch()` on it. 494 * 495 * There should only be a single store in your app. To specify how different 496 * parts of the state tree respond to actions, you may combine several reducers 497 * into a single reducer function by using `combineReducers`. 498 * 499 * @param {Function} reducer A function that returns the next state tree, given 500 * the current state tree and the action to handle. 501 * 502 * @param {any} [preloadedState] The initial state. You may optionally specify it 503 * to hydrate the state from the server in universal apps, or to restore a 504 * previously serialized user session. 505 * If you use `combineReducers` to produce the root reducer function, this must be 506 * an object with the same shape as `combineReducers` keys. 507 * 508 * @param {Function} [enhancer] The store enhancer. You may optionally specify it 509 * to enhance the store with third-party capabilities such as middleware, 510 * time travel, persistence, etc. The only store enhancer that ships with Redux 511 * is `applyMiddleware()`. 512 * 513 * @returns {Store} A Redux store that lets you read the state, dispatch actions 514 * and subscribe to changes. 515 */ 516 517 function createStore(reducer, preloadedState, enhancer) { 518 var _ref2; 519 520 if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { 521 throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.'); 522 } 523 524 if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { 525 enhancer = preloadedState; 526 preloadedState = undefined; 527 } 528 529 if (typeof enhancer !== 'undefined') { 530 if (typeof enhancer !== 'function') { 531 throw new Error('Expected the enhancer to be a function.'); 532 } 533 534 return enhancer(createStore)(reducer, preloadedState); 535 } 536 537 if (typeof reducer !== 'function') { 538 throw new Error('Expected the reducer to be a function.'); 539 } 540 541 var currentReducer = reducer; 542 var currentState = preloadedState; 543 var currentListeners = []; 544 var nextListeners = currentListeners; 545 var isDispatching = false; 546 /** 547 * This makes a shallow copy of currentListeners so we can use 548 * nextListeners as a temporary list while dispatching. 549 * 550 * This prevents any bugs around consumers calling 551 * subscribe/unsubscribe in the middle of a dispatch. 552 */ 553 554 function ensureCanMutateNextListeners() { 555 if (nextListeners === currentListeners) { 556 nextListeners = currentListeners.slice(); 557 } 558 } 559 /** 560 * Reads the state tree managed by the store. 561 * 562 * @returns {any} The current state tree of your application. 563 */ 564 565 566 function getState() { 567 if (isDispatching) { 568 throw new Error('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.'); 569 } 570 571 return currentState; 572 } 573 /** 574 * Adds a change listener. It will be called any time an action is dispatched, 575 * and some part of the state tree may potentially have changed. You may then 576 * call `getState()` to read the current state tree inside the callback. 577 * 578 * You may call `dispatch()` from a change listener, with the following 579 * caveats: 580 * 581 * 1. The subscriptions are snapshotted just before every `dispatch()` call. 582 * If you subscribe or unsubscribe while the listeners are being invoked, this 583 * will not have any effect on the `dispatch()` that is currently in progress. 584 * However, the next `dispatch()` call, whether nested or not, will use a more 585 * recent snapshot of the subscription list. 586 * 587 * 2. The listener should not expect to see all state changes, as the state 588 * might have been updated multiple times during a nested `dispatch()` before 589 * the listener is called. It is, however, guaranteed that all subscribers 590 * registered before the `dispatch()` started will be called with the latest 591 * state by the time it exits. 592 * 593 * @param {Function} listener A callback to be invoked on every dispatch. 594 * @returns {Function} A function to remove this change listener. 595 */ 596 597 598 function subscribe(listener) { 599 if (typeof listener !== 'function') { 600 throw new Error('Expected the listener to be a function.'); 601 } 602 603 if (isDispatching) { 604 throw new Error('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-reference/store#subscribe(listener) for more details.'); 605 } 606 607 var isSubscribed = true; 608 ensureCanMutateNextListeners(); 609 nextListeners.push(listener); 610 return function unsubscribe() { 611 if (!isSubscribed) { 612 return; 613 } 614 615 if (isDispatching) { 616 throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); 617 } 618 619 isSubscribed = false; 620 ensureCanMutateNextListeners(); 621 var index = nextListeners.indexOf(listener); 622 nextListeners.splice(index, 1); 623 }; 624 } 625 /** 626 * Dispatches an action. It is the only way to trigger a state change. 627 * 628 * The `reducer` function, used to create the store, will be called with the 629 * current state tree and the given `action`. Its return value will 630 * be considered the **next** state of the tree, and the change listeners 631 * will be notified. 632 * 633 * The base implementation only supports plain object actions. If you want to 634 * dispatch a Promise, an Observable, a thunk, or something else, you need to 635 * wrap your store creating function into the corresponding middleware. For 636 * example, see the documentation for the `redux-thunk` package. Even the 637 * middleware will eventually dispatch plain object actions using this method. 638 * 639 * @param {Object} action A plain object representing “what changed”. It is 640 * a good idea to keep actions serializable so you can record and replay user 641 * sessions, or use the time travelling `redux-devtools`. An action must have 642 * a `type` property which may not be `undefined`. It is a good idea to use 643 * string constants for action types. 644 * 645 * @returns {Object} For convenience, the same action object you dispatched. 646 * 647 * Note that, if you use a custom middleware, it may wrap `dispatch()` to 648 * return something else (for example, a Promise you can await). 649 */ 650 651 652 function dispatch(action) { 653 if (!isPlainObject(action)) { 654 throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); 655 } 656 657 if (typeof action.type === 'undefined') { 658 throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); 659 } 660 661 if (isDispatching) { 662 throw new Error('Reducers may not dispatch actions.'); 663 } 664 665 try { 666 isDispatching = true; 667 currentState = currentReducer(currentState, action); 668 } finally { 669 isDispatching = false; 670 } 671 672 var listeners = currentListeners = nextListeners; 673 674 for (var i = 0; i < listeners.length; i++) { 675 var listener = listeners[i]; 676 listener(); 677 } 678 679 return action; 680 } 681 /** 682 * Replaces the reducer currently used by the store to calculate the state. 683 * 684 * You might need this if your app implements code splitting and you want to 685 * load some of the reducers dynamically. You might also need this if you 686 * implement a hot reloading mechanism for Redux. 687 * 688 * @param {Function} nextReducer The reducer for the store to use instead. 689 * @returns {void} 690 */ 691 692 693 function replaceReducer(nextReducer) { 694 if (typeof nextReducer !== 'function') { 695 throw new Error('Expected the nextReducer to be a function.'); 696 } 697 698 currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. 699 // Any reducers that existed in both the new and old rootReducer 700 // will receive the previous state. This effectively populates 701 // the new state tree with any relevant data from the old one. 702 703 dispatch({ 704 type: ActionTypes.REPLACE 705 }); 706 } 707 /** 708 * Interoperability point for observable/reactive libraries. 709 * @returns {observable} A minimal observable of state changes. 710 * For more information, see the observable proposal: 711 * https://github.com/tc39/proposal-observable 712 */ 713 714 715 function observable() { 716 var _ref; 717 718 var outerSubscribe = subscribe; 719 return _ref = { 720 /** 721 * The minimal observable subscription method. 722 * @param {Object} observer Any object that can be used as an observer. 723 * The observer object should have a `next` method. 724 * @returns {subscription} An object with an `unsubscribe` method that can 725 * be used to unsubscribe the observable from the store, and prevent further 726 * emission of values from the observable. 727 */ 728 subscribe: function subscribe(observer) { 729 if (typeof observer !== 'object' || observer === null) { 730 throw new TypeError('Expected the observer to be an object.'); 731 } 732 733 function observeState() { 734 if (observer.next) { 735 observer.next(getState()); 736 } 737 } 738 739 observeState(); 740 var unsubscribe = outerSubscribe(observeState); 741 return { 742 unsubscribe: unsubscribe 743 }; 744 } 745 }, _ref[es["a" /* default */]] = function () { 746 return this; 747 }, _ref; 748 } // When a store is created, an "INIT" action is dispatched so that every 749 // reducer returns their initial state. This effectively populates 750 // the initial state tree. 751 752 753 dispatch({ 754 type: ActionTypes.INIT 755 }); 756 return _ref2 = { 757 dispatch: dispatch, 758 subscribe: subscribe, 759 getState: getState, 760 replaceReducer: replaceReducer 761 }, _ref2[es["a" /* default */]] = observable, _ref2; 762 } 763 764 /** 765 * Prints a warning in the console if it exists. 766 * 767 * @param {String} message The warning message. 768 * @returns {void} 769 */ 770 function warning(message) { 771 /* eslint-disable no-console */ 772 if (typeof console !== 'undefined' && typeof console.error === 'function') { 773 console.error(message); 774 } 775 /* eslint-enable no-console */ 776 777 778 try { 779 // This error was thrown as a convenience so that if you enable 780 // "break on all exceptions" in your console, 781 // it would pause the execution at this line. 782 throw new Error(message); 783 } catch (e) {} // eslint-disable-line no-empty 784 785 } 786 787 function getUndefinedStateErrorMessage(key, action) { 788 var actionType = action && action.type; 789 var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action'; 790 return "Given " + actionDescription + ", reducer \"" + 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."; 791 } 792 793 function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { 794 var reducerKeys = Object.keys(reducers); 795 var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; 796 797 if (reducerKeys.length === 0) { 798 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; 799 } 800 801 if (!isPlainObject(inputState)) { 802 return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); 803 } 804 805 var unexpectedKeys = Object.keys(inputState).filter(function (key) { 806 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; 807 }); 808 unexpectedKeys.forEach(function (key) { 809 unexpectedKeyCache[key] = true; 810 }); 811 if (action && action.type === ActionTypes.REPLACE) return; 812 813 if (unexpectedKeys.length > 0) { 814 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."); 815 } 816 } 817 818 function assertReducerShape(reducers) { 819 Object.keys(reducers).forEach(function (key) { 820 var reducer = reducers[key]; 821 var initialState = reducer(undefined, { 822 type: ActionTypes.INIT 823 }); 824 825 if (typeof initialState === 'undefined') { 826 throw new Error("Reducer \"" + 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."); 827 } 828 829 if (typeof reducer(undefined, { 830 type: ActionTypes.PROBE_UNKNOWN_ACTION() 831 }) === 'undefined') { 832 throw new Error("Reducer \"" + 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."); 833 } 834 }); 835 } 836 /** 837 * Turns an object whose values are different reducer functions, into a single 838 * reducer function. It will call every child reducer, and gather their results 839 * into a single state object, whose keys correspond to the keys of the passed 840 * reducer functions. 841 * 842 * @param {Object} reducers An object whose values correspond to different 843 * reducer functions that need to be combined into one. One handy way to obtain 844 * it is to use ES6 `import * as reducers` syntax. The reducers may never return 845 * undefined for any action. Instead, they should return their initial state 846 * if the state passed to them was undefined, and the current state for any 847 * unrecognized action. 848 * 849 * @returns {Function} A reducer function that invokes every reducer inside the 850 * passed object, and builds a state object with the same shape. 851 */ 852 853 854 function combineReducers(reducers) { 855 var reducerKeys = Object.keys(reducers); 856 var finalReducers = {}; 857 858 for (var i = 0; i < reducerKeys.length; i++) { 859 var key = reducerKeys[i]; 860 861 if (false) {} 862 863 if (typeof reducers[key] === 'function') { 864 finalReducers[key] = reducers[key]; 865 } 866 } 867 868 var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same 869 // keys multiple times. 870 871 var unexpectedKeyCache; 872 873 if (false) {} 874 875 var shapeAssertionError; 876 877 try { 878 assertReducerShape(finalReducers); 879 } catch (e) { 880 shapeAssertionError = e; 881 } 882 883 return function combination(state, action) { 884 if (state === void 0) { 885 state = {}; 886 } 887 888 if (shapeAssertionError) { 889 throw shapeAssertionError; 890 } 891 892 if (false) { var warningMessage; } 893 894 var hasChanged = false; 895 var nextState = {}; 896 897 for (var _i = 0; _i < finalReducerKeys.length; _i++) { 898 var _key = finalReducerKeys[_i]; 899 var reducer = finalReducers[_key]; 900 var previousStateForKey = state[_key]; 901 var nextStateForKey = reducer(previousStateForKey, action); 902 903 if (typeof nextStateForKey === 'undefined') { 904 var errorMessage = getUndefinedStateErrorMessage(_key, action); 905 throw new Error(errorMessage); 906 } 907 908 nextState[_key] = nextStateForKey; 909 hasChanged = hasChanged || nextStateForKey !== previousStateForKey; 910 } 911 912 return hasChanged ? nextState : state; 913 }; 914 } 915 916 function bindActionCreator(actionCreator, dispatch) { 917 return function () { 918 return dispatch(actionCreator.apply(this, arguments)); 919 }; 920 } 921 /** 922 * Turns an object whose values are action creators, into an object with the 923 * same keys, but with every function wrapped into a `dispatch` call so they 924 * may be invoked directly. This is just a convenience method, as you can call 925 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. 926 * 927 * For convenience, you can also pass an action creator as the first argument, 928 * and get a dispatch wrapped function in return. 929 * 930 * @param {Function|Object} actionCreators An object whose values are action 931 * creator functions. One handy way to obtain it is to use ES6 `import * as` 932 * syntax. You may also pass a single function. 933 * 934 * @param {Function} dispatch The `dispatch` function available on your Redux 935 * store. 936 * 937 * @returns {Function|Object} The object mimicking the original object, but with 938 * every action creator wrapped into the `dispatch` call. If you passed a 939 * function as `actionCreators`, the return value will also be a single 940 * function. 941 */ 942 943 944 function bindActionCreators(actionCreators, dispatch) { 945 if (typeof actionCreators === 'function') { 946 return bindActionCreator(actionCreators, dispatch); 947 } 948 949 if (typeof actionCreators !== 'object' || actionCreators === null) { 950 throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"); 951 } 952 953 var boundActionCreators = {}; 954 955 for (var key in actionCreators) { 956 var actionCreator = actionCreators[key]; 957 958 if (typeof actionCreator === 'function') { 959 boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); 960 } 961 } 962 963 return boundActionCreators; 964 } 965 966 function _defineProperty(obj, key, value) { 967 if (key in obj) { 968 Object.defineProperty(obj, key, { 969 value: value, 970 enumerable: true, 971 configurable: true, 972 writable: true 973 }); 974 } else { 975 obj[key] = value; 976 } 977 978 return obj; 979 } 980 981 function ownKeys(object, enumerableOnly) { 982 var keys = Object.keys(object); 983 984 if (Object.getOwnPropertySymbols) { 985 keys.push.apply(keys, Object.getOwnPropertySymbols(object)); 986 } 987 988 if (enumerableOnly) keys = keys.filter(function (sym) { 989 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 990 }); 991 return keys; 992 } 993 994 function _objectSpread2(target) { 995 for (var i = 1; i < arguments.length; i++) { 996 var source = arguments[i] != null ? arguments[i] : {}; 997 998 if (i % 2) { 999 ownKeys(source, true).forEach(function (key) { 1000 _defineProperty(target, key, source[key]); 1001 }); 1002 } else if (Object.getOwnPropertyDescriptors) { 1003 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 1004 } else { 1005 ownKeys(source).forEach(function (key) { 1006 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 1007 }); 1008 } 1009 } 1010 1011 return target; 1012 } 1013 1014 /** 1015 * Composes single-argument functions from right to left. The rightmost 1016 * function can take multiple arguments as it provides the signature for 1017 * the resulting composite function. 1018 * 1019 * @param {...Function} funcs The functions to compose. 1020 * @returns {Function} A function obtained by composing the argument functions 1021 * from right to left. For example, compose(f, g, h) is identical to doing 1022 * (...args) => f(g(h(...args))). 1023 */ 1024 function compose() { 1025 for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { 1026 funcs[_key] = arguments[_key]; 1027 } 1028 1029 if (funcs.length === 0) { 1030 return function (arg) { 1031 return arg; 1032 }; 1033 } 1034 1035 if (funcs.length === 1) { 1036 return funcs[0]; 1037 } 1038 1039 return funcs.reduce(function (a, b) { 1040 return function () { 1041 return a(b.apply(void 0, arguments)); 1042 }; 1043 }); 1044 } 1045 1046 /** 1047 * Creates a store enhancer that applies middleware to the dispatch method 1048 * of the Redux store. This is handy for a variety of tasks, such as expressing 1049 * asynchronous actions in a concise manner, or logging every action payload. 1050 * 1051 * See `redux-thunk` package as an example of the Redux middleware. 1052 * 1053 * Because middleware is potentially asynchronous, this should be the first 1054 * store enhancer in the composition chain. 1055 * 1056 * Note that each middleware will be given the `dispatch` and `getState` functions 1057 * as named arguments. 1058 * 1059 * @param {...Function} middlewares The middleware chain to be applied. 1060 * @returns {Function} A store enhancer applying the middleware. 1061 */ 1062 1063 function applyMiddleware() { 1064 for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) { 1065 middlewares[_key] = arguments[_key]; 1066 } 1067 1068 return function (createStore) { 1069 return function () { 1070 var store = createStore.apply(void 0, arguments); 1071 1072 var _dispatch = function dispatch() { 1073 throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); 1074 }; 1075 1076 var middlewareAPI = { 1077 getState: store.getState, 1078 dispatch: function dispatch() { 1079 return _dispatch.apply(void 0, arguments); 1080 } 1081 }; 1082 var chain = middlewares.map(function (middleware) { 1083 return middleware(middlewareAPI); 1084 }); 1085 _dispatch = compose.apply(void 0, chain)(store.dispatch); 1086 return _objectSpread2({}, store, { 1087 dispatch: _dispatch 1088 }); 1089 }; 1090 }; 1091 } 1092 1093 /* 1094 * This is a dummy function to check if the function name has been altered by minification. 1095 * If the function has been minified and NODE_ENV !== 'production', warn the user. 1096 */ 1097 1098 function isCrushed() {} 1099 1100 if (false) {} 1101 1102 1103 1104 // EXTERNAL MODULE: external {"this":["wp","reduxRoutine"]} 1105 var external_this_wp_reduxRoutine_ = __webpack_require__(228); 1106 var external_this_wp_reduxRoutine_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_reduxRoutine_); 1107 1108 // EXTERNAL MODULE: ./node_modules/is-promise/index.js 1109 var is_promise = __webpack_require__(98); 1110 var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise); 1111 1112 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/promise-middleware.js 1113 /** 1114 * External dependencies 1115 */ 1116 1117 /** 1118 * Simplest possible promise redux middleware. 1119 * 1120 * @return {Function} middleware. 1121 */ 1122 1123 var promise_middleware_promiseMiddleware = function promiseMiddleware() { 1124 return function (next) { 1125 return function (action) { 1126 if (is_promise_default()(action)) { 1127 return action.then(function (resolvedAction) { 1128 if (resolvedAction) { 1129 return next(resolvedAction); 1130 } 1131 }); 1132 } 1133 1134 return next(action); 1135 }; 1136 }; 1137 }; 1138 1139 /* harmony default export */ var promise_middleware = (promise_middleware_promiseMiddleware); 1140 1141 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules 1142 var toConsumableArray = __webpack_require__(17); 1143 1144 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js 1145 1146 1147 1148 /** 1149 * External dependencies 1150 */ 1151 1152 /** 1153 * Creates a middleware handling resolvers cache invalidation. 1154 * 1155 * @param {WPDataRegistry} registry The registry reference for which to create 1156 * the middleware. 1157 * @param {string} reducerKey The namespace for which to create the 1158 * middleware. 1159 * 1160 * @return {Function} Middleware function. 1161 */ 1162 1163 var resolvers_cache_middleware_createResolversCacheMiddleware = function createResolversCacheMiddleware(registry, reducerKey) { 1164 return function () { 1165 return function (next) { 1166 return function (action) { 1167 var resolvers = registry.select('core/data').getCachedResolvers(reducerKey); 1168 Object.entries(resolvers).forEach(function (_ref) { 1169 var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2), 1170 selectorName = _ref2[0], 1171 resolversByArgs = _ref2[1]; 1172 1173 var resolver = Object(external_lodash_["get"])(registry.stores, [reducerKey, 'resolvers', selectorName]); 1174 1175 if (!resolver || !resolver.shouldInvalidate) { 1176 return; 1177 } 1178 1179 resolversByArgs.forEach(function (value, args) { 1180 // resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector. 1181 // If the value is false it means this resolver has finished its resolution which means we need to invalidate it, 1182 // if it's true it means it's inflight and the invalidation is not necessary. 1183 if (value !== false || !resolver.shouldInvalidate.apply(resolver, [action].concat(Object(toConsumableArray["a" /* default */])(args)))) { 1184 return; 1185 } // Trigger cache invalidation 1186 1187 1188 registry.dispatch('core/data').invalidateResolution(reducerKey, selectorName, args); 1189 }); 1190 }); 1191 return next(action); 1192 }; 1193 }; 1194 }; 1195 }; 1196 1197 /* harmony default export */ var resolvers_cache_middleware = (resolvers_cache_middleware_createResolversCacheMiddleware); 1198 1199 // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js 1200 var equivalent_key_map = __webpack_require__(74); 1201 var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map); 1202 1203 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 1204 var defineProperty = __webpack_require__(10); 1205 1206 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/utils.js 1207 1208 1209 1210 /** 1211 * Higher-order reducer creator which creates a combined reducer object, keyed 1212 * by a property on the action object. 1213 * 1214 * @param {string} actionProperty Action property by which to key object. 1215 * 1216 * @return {Function} Higher-order reducer. 1217 */ 1218 var utils_onSubKey = function onSubKey(actionProperty) { 1219 return function (reducer) { 1220 return function () { 1221 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1222 var action = arguments.length > 1 ? arguments[1] : undefined; 1223 // Retrieve subkey from action. Do not track if undefined; useful for cases 1224 // where reducer is scoped by action shape. 1225 var key = action[actionProperty]; 1226 1227 if (key === undefined) { 1228 return state; 1229 } // Avoid updating state if unchanged. Note that this also accounts for a 1230 // reducer which returns undefined on a key which is not yet tracked. 1231 1232 1233 var nextKeyState = reducer(state[key], action); 1234 1235 if (nextKeyState === state[key]) { 1236 return state; 1237 } 1238 1239 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, key, nextKeyState)); 1240 }; 1241 }; 1242 }; 1243 1244 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/reducer.js 1245 /** 1246 * External dependencies 1247 */ 1248 1249 1250 /** 1251 * Internal dependencies 1252 */ 1253 1254 1255 /** 1256 * Reducer function returning next state for selector resolution of 1257 * subkeys, object form: 1258 * 1259 * selectorName -> EquivalentKeyMap<Array,boolean> 1260 * 1261 * @param {Object} state Current state. 1262 * @param {Object} action Dispatched action. 1263 * 1264 * @return {Object} Next state. 1265 */ 1266 1267 var subKeysIsResolved = Object(external_lodash_["flowRight"])([utils_onSubKey('selectorName')])(function () { 1268 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new equivalent_key_map_default.a(); 1269 var action = arguments.length > 1 ? arguments[1] : undefined; 1270 1271 switch (action.type) { 1272 case 'START_RESOLUTION': 1273 case 'FINISH_RESOLUTION': 1274 { 1275 var isStarting = action.type === 'START_RESOLUTION'; 1276 var nextState = new equivalent_key_map_default.a(state); 1277 nextState.set(action.args, isStarting); 1278 return nextState; 1279 } 1280 1281 case 'INVALIDATE_RESOLUTION': 1282 { 1283 var _nextState = new equivalent_key_map_default.a(state); 1284 1285 _nextState.delete(action.args); 1286 1287 return _nextState; 1288 } 1289 } 1290 1291 return state; 1292 }); 1293 /** 1294 * Reducer function returning next state for selector resolution, object form: 1295 * 1296 * selectorName -> EquivalentKeyMap<Array, boolean> 1297 * 1298 * @param {Object} state Current state. 1299 * @param {Object} action Dispatched action. 1300 * 1301 * @return {Object} Next state. 1302 */ 1303 1304 var reducer_isResolved = function isResolved() { 1305 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1306 var action = arguments.length > 1 ? arguments[1] : undefined; 1307 1308 switch (action.type) { 1309 case 'INVALIDATE_RESOLUTION_FOR_STORE': 1310 return {}; 1311 1312 case 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR': 1313 return Object(external_lodash_["has"])(state, [action.selectorName]) ? Object(external_lodash_["omit"])(state, [action.selectorName]) : state; 1314 1315 case 'START_RESOLUTION': 1316 case 'FINISH_RESOLUTION': 1317 case 'INVALIDATE_RESOLUTION': 1318 return subKeysIsResolved(state, action); 1319 } 1320 1321 return state; 1322 }; 1323 1324 /* harmony default export */ var metadata_reducer = (reducer_isResolved); 1325 1326 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/selectors.js 1327 /** 1328 * External dependencies 1329 */ 1330 1331 /** 1332 * Returns the raw `isResolving` value for a given selector name, 1333 * and arguments set. May be undefined if the selector has never been resolved 1334 * or not resolved for the given set of arguments, otherwise true or false for 1335 * resolution started and completed respectively. 1336 * 1337 * @param {Object} state Data state. 1338 * @param {string} selectorName Selector name. 1339 * @param {Array} args Arguments passed to selector. 1340 * 1341 * @return {?boolean} isResolving value. 1342 */ 1343 1344 function getIsResolving(state, selectorName, args) { 1345 var map = Object(external_lodash_["get"])(state, [selectorName]); 1346 1347 if (!map) { 1348 return; 1349 } 1350 1351 return map.get(args); 1352 } 1353 /** 1354 * Returns true if resolution has already been triggered for a given 1355 * selector name, and arguments set. 1356 * 1357 * @param {Object} state Data state. 1358 * @param {string} selectorName Selector name. 1359 * @param {?Array} args Arguments passed to selector (default `[]`). 1360 * 1361 * @return {boolean} Whether resolution has been triggered. 1362 */ 1363 1364 function hasStartedResolution(state, selectorName) { 1365 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 1366 return getIsResolving(state, selectorName, args) !== undefined; 1367 } 1368 /** 1369 * Returns true if resolution has completed for a given selector 1370 * name, and arguments set. 1371 * 1372 * @param {Object} state Data state. 1373 * @param {string} selectorName Selector name. 1374 * @param {?Array} args Arguments passed to selector. 1375 * 1376 * @return {boolean} Whether resolution has completed. 1377 */ 1378 1379 function hasFinishedResolution(state, selectorName) { 1380 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 1381 return getIsResolving(state, selectorName, args) === false; 1382 } 1383 /** 1384 * Returns true if resolution has been triggered but has not yet completed for 1385 * a given selector name, and arguments set. 1386 * 1387 * @param {Object} state Data state. 1388 * @param {string} selectorName Selector name. 1389 * @param {?Array} args Arguments passed to selector. 1390 * 1391 * @return {boolean} Whether resolution is in progress. 1392 */ 1393 1394 function isResolving(state, selectorName) { 1395 var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 1396 return getIsResolving(state, selectorName, args) === true; 1397 } 1398 /** 1399 * Returns the list of the cached resolvers. 1400 * 1401 * @param {Object} state Data state. 1402 * 1403 * @return {Object} Resolvers mapped by args and selectorName. 1404 */ 1405 1406 function getCachedResolvers(state) { 1407 return state; 1408 } 1409 1410 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/actions.js 1411 /** 1412 * Returns an action object used in signalling that selector resolution has 1413 * started. 1414 * 1415 * @param {string} selectorName Name of selector for which resolver triggered. 1416 * @param {...*} args Arguments to associate for uniqueness. 1417 * 1418 * @return {Object} Action object. 1419 */ 1420 function startResolution(selectorName, args) { 1421 return { 1422 type: 'START_RESOLUTION', 1423 selectorName: selectorName, 1424 args: args 1425 }; 1426 } 1427 /** 1428 * Returns an action object used in signalling that selector resolution has 1429 * completed. 1430 * 1431 * @param {string} selectorName Name of selector for which resolver triggered. 1432 * @param {...*} args Arguments to associate for uniqueness. 1433 * 1434 * @return {Object} Action object. 1435 */ 1436 1437 function finishResolution(selectorName, args) { 1438 return { 1439 type: 'FINISH_RESOLUTION', 1440 selectorName: selectorName, 1441 args: args 1442 }; 1443 } 1444 /** 1445 * Returns an action object used in signalling that we should invalidate the resolution cache. 1446 * 1447 * @param {string} selectorName Name of selector for which resolver should be invalidated. 1448 * @param {Array} args Arguments to associate for uniqueness. 1449 * 1450 * @return {Object} Action object. 1451 */ 1452 1453 function invalidateResolution(selectorName, args) { 1454 return { 1455 type: 'INVALIDATE_RESOLUTION', 1456 selectorName: selectorName, 1457 args: args 1458 }; 1459 } 1460 /** 1461 * Returns an action object used in signalling that the resolution 1462 * should be invalidated. 1463 * 1464 * @return {Object} Action object. 1465 */ 1466 1467 function invalidateResolutionForStore() { 1468 return { 1469 type: 'INVALIDATE_RESOLUTION_FOR_STORE' 1470 }; 1471 } 1472 /** 1473 * Returns an action object used in signalling that the resolution cache for a 1474 * given selectorName should be invalidated. 1475 * 1476 * @param {string} selectorName Name of selector for which all resolvers should 1477 * be invalidated. 1478 * 1479 * @return {Object} Action object. 1480 */ 1481 1482 function invalidateResolutionForStoreSelector(selectorName) { 1483 return { 1484 type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR', 1485 selectorName: selectorName 1486 }; 1487 } 1488 1489 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/index.js 1490 1491 1492 1493 1494 /** 1495 * External dependencies 1496 */ 1497 1498 1499 1500 /** 1501 * WordPress dependencies 1502 */ 1503 1504 1505 /** 1506 * Internal dependencies 1507 */ 1508 1509 1510 1511 1512 1513 1514 /** 1515 * @typedef {import('../registry').WPDataRegistry} WPDataRegistry 1516 */ 1517 1518 /** 1519 * Creates a namespace object with a store derived from the reducer given. 1520 * 1521 * @param {string} key Unique namespace identifier. 1522 * @param {Object} options Registered store options, with properties 1523 * describing reducer, actions, selectors, and 1524 * resolvers. 1525 * @param {WPDataRegistry} registry Registry reference. 1526 * 1527 * @return {Object} Store Object. 1528 */ 1529 1530 function createNamespace(key, options, registry) { 1531 var reducer = options.reducer; 1532 var store = createReduxStore(key, options, registry); 1533 var resolvers; 1534 var actions = mapActions(Object(objectSpread["a" /* default */])({}, actions_namespaceObject, options.actions), store); 1535 var selectors = mapSelectors(Object(objectSpread["a" /* default */])({}, Object(external_lodash_["mapValues"])(selectors_namespaceObject, function (selector) { 1536 return function (state) { 1537 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 1538 args[_key - 1] = arguments[_key]; 1539 } 1540 1541 return selector.apply(void 0, [state.metadata].concat(args)); 1542 }; 1543 }), Object(external_lodash_["mapValues"])(options.selectors, function (selector) { 1544 if (selector.isRegistrySelector) { 1545 selector.registry = registry; 1546 } 1547 1548 return function (state) { 1549 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 1550 args[_key2 - 1] = arguments[_key2]; 1551 } 1552 1553 return selector.apply(void 0, [state.root].concat(args)); 1554 }; 1555 })), store); 1556 1557 if (options.resolvers) { 1558 var result = mapResolvers(options.resolvers, selectors, store); 1559 resolvers = result.resolvers; 1560 selectors = result.selectors; 1561 } 1562 1563 var getSelectors = function getSelectors() { 1564 return selectors; 1565 }; 1566 1567 var getActions = function getActions() { 1568 return actions; 1569 }; // We have some modules monkey-patching the store object 1570 // It's wrong to do so but until we refactor all of our effects to controls 1571 // We need to keep the same "store" instance here. 1572 1573 1574 store.__unstableOriginalGetState = store.getState; 1575 1576 store.getState = function () { 1577 return store.__unstableOriginalGetState().root; 1578 }; // Customize subscribe behavior to call listeners only on effective change, 1579 // not on every dispatch. 1580 1581 1582 var subscribe = store && function (listener) { 1583 var lastState = store.__unstableOriginalGetState(); 1584 1585 store.subscribe(function () { 1586 var state = store.__unstableOriginalGetState(); 1587 1588 var hasChanged = state !== lastState; 1589 lastState = state; 1590 1591 if (hasChanged) { 1592 listener(); 1593 } 1594 }); 1595 }; // This can be simplified to just { subscribe, getSelectors, getActions } 1596 // Once we remove the use function. 1597 1598 1599 return { 1600 reducer: reducer, 1601 store: store, 1602 actions: actions, 1603 selectors: selectors, 1604 resolvers: resolvers, 1605 getSelectors: getSelectors, 1606 getActions: getActions, 1607 subscribe: subscribe 1608 }; 1609 } 1610 /** 1611 * Creates a redux store for a namespace. 1612 * 1613 * @param {string} key Unique namespace identifier. 1614 * @param {Object} options Registered store options, with properties 1615 * describing reducer, actions, selectors, and 1616 * resolvers. 1617 * @param {WPDataRegistry} registry Registry reference. 1618 * 1619 * @return {Object} Newly created redux store. 1620 */ 1621 1622 function createReduxStore(key, options, registry) { 1623 var middlewares = [resolvers_cache_middleware(registry, key), promise_middleware]; 1624 1625 if (options.controls) { 1626 var normalizedControls = Object(external_lodash_["mapValues"])(options.controls, function (control) { 1627 return control.isRegistryControl ? control(registry) : control; 1628 }); 1629 middlewares.push(external_this_wp_reduxRoutine_default()(normalizedControls)); 1630 } 1631 1632 var enhancers = [applyMiddleware.apply(void 0, middlewares)]; 1633 1634 if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) { 1635 enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({ 1636 name: key, 1637 instanceId: key 1638 })); 1639 } 1640 1641 var reducer = options.reducer, 1642 initialState = options.initialState; 1643 var enhancedReducer = turbo_combine_reducers_default()({ 1644 metadata: metadata_reducer, 1645 root: reducer 1646 }); 1647 return createStore(enhancedReducer, { 1648 root: initialState 1649 }, Object(external_lodash_["flowRight"])(enhancers)); 1650 } 1651 /** 1652 * Maps selectors to a store. 1653 * 1654 * @param {Object} selectors Selectors to register. Keys will be used as the 1655 * public facing API. Selectors will get passed the 1656 * state as first argument. 1657 * @param {Object} store The store to which the selectors should be mapped. 1658 * 1659 * @return {Object} Selectors mapped to the provided store. 1660 */ 1661 1662 1663 function mapSelectors(selectors, store) { 1664 var createStateSelector = function createStateSelector(registrySelector) { 1665 var selector = function runSelector() { 1666 // This function is an optimized implementation of: 1667 // 1668 // selector( store.getState(), ...arguments ) 1669 // 1670 // Where the above would incur an `Array#concat` in its application, 1671 // the logic here instead efficiently constructs an arguments array via 1672 // direct assignment. 1673 var argsLength = arguments.length; 1674 var args = new Array(argsLength + 1); 1675 args[0] = store.__unstableOriginalGetState(); 1676 1677 for (var i = 0; i < argsLength; i++) { 1678 args[i + 1] = arguments[i]; 1679 } 1680 1681 return registrySelector.apply(void 0, args); 1682 }; 1683 1684 selector.hasResolver = false; 1685 return selector; 1686 }; 1687 1688 return Object(external_lodash_["mapValues"])(selectors, createStateSelector); 1689 } 1690 /** 1691 * Maps actions to dispatch from a given store. 1692 * 1693 * @param {Object} actions Actions to register. 1694 * @param {Object} store The redux store to which the actions should be mapped. 1695 * @return {Object} Actions mapped to the redux store provided. 1696 */ 1697 1698 1699 function mapActions(actions, store) { 1700 var createBoundAction = function createBoundAction(action) { 1701 return function () { 1702 return Promise.resolve(store.dispatch(action.apply(void 0, arguments))); 1703 }; 1704 }; 1705 1706 return Object(external_lodash_["mapValues"])(actions, createBoundAction); 1707 } 1708 /** 1709 * Returns resolvers with matched selectors for a given namespace. 1710 * Resolvers are side effects invoked once per argument set of a given selector call, 1711 * used in ensuring that the data needs for the selector are satisfied. 1712 * 1713 * @param {Object} resolvers Resolvers to register. 1714 * @param {Object} selectors The current selectors to be modified. 1715 * @param {Object} store The redux store to which the resolvers should be mapped. 1716 * @return {Object} An object containing updated selectors and resolvers. 1717 */ 1718 1719 1720 function mapResolvers(resolvers, selectors, store) { 1721 var mappedResolvers = Object(external_lodash_["mapValues"])(resolvers, function (resolver) { 1722 var _resolver$fulfill = resolver.fulfill, 1723 resolverFulfill = _resolver$fulfill === void 0 ? resolver : _resolver$fulfill; 1724 return Object(objectSpread["a" /* default */])({}, resolver, { 1725 fulfill: resolverFulfill 1726 }); 1727 }); 1728 1729 var mapSelector = function mapSelector(selector, selectorName) { 1730 var resolver = resolvers[selectorName]; 1731 1732 if (!resolver) { 1733 selector.hasResolver = false; 1734 return selector; 1735 } 1736 1737 var selectorResolver = function selectorResolver() { 1738 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 1739 args[_key3] = arguments[_key3]; 1740 } 1741 1742 function fulfillSelector() { 1743 return _fulfillSelector.apply(this, arguments); 1744 } 1745 1746 function _fulfillSelector() { 1747 _fulfillSelector = Object(asyncToGenerator["a" /* default */])( 1748 /*#__PURE__*/ 1749 regenerator_default.a.mark(function _callee() { 1750 var state, _store$__unstableOrig, metadata; 1751 1752 return regenerator_default.a.wrap(function _callee$(_context) { 1753 while (1) { 1754 switch (_context.prev = _context.next) { 1755 case 0: 1756 state = store.getState(); 1757 1758 if (!(typeof resolver.isFulfilled === 'function' && resolver.isFulfilled.apply(resolver, [state].concat(args)))) { 1759 _context.next = 3; 1760 break; 1761 } 1762 1763 return _context.abrupt("return"); 1764 1765 case 3: 1766 _store$__unstableOrig = store.__unstableOriginalGetState(), metadata = _store$__unstableOrig.metadata; 1767 1768 if (!hasStartedResolution(metadata, selectorName, args)) { 1769 _context.next = 6; 1770 break; 1771 } 1772 1773 return _context.abrupt("return"); 1774 1775 case 6: 1776 store.dispatch(startResolution(selectorName, args)); 1777 _context.next = 9; 1778 return fulfillResolver.apply(void 0, [store, mappedResolvers, selectorName].concat(args)); 1779 1780 case 9: 1781 store.dispatch(finishResolution(selectorName, args)); 1782 1783 case 10: 1784 case "end": 1785 return _context.stop(); 1786 } 1787 } 1788 }, _callee); 1789 })); 1790 return _fulfillSelector.apply(this, arguments); 1791 } 1792 1793 fulfillSelector.apply(void 0, args); 1794 return selector.apply(void 0, args); 1795 }; 1796 1797 selectorResolver.hasResolver = true; 1798 return selectorResolver; 1799 }; 1800 1801 return { 1802 resolvers: mappedResolvers, 1803 selectors: Object(external_lodash_["mapValues"])(selectors, mapSelector) 1804 }; 1805 } 1806 /** 1807 * Calls a resolver given arguments 1808 * 1809 * @param {Object} store Store reference, for fulfilling via resolvers 1810 * @param {Object} resolvers Store Resolvers 1811 * @param {string} selectorName Selector name to fulfill. 1812 * @param {Array} args Selector Arguments. 1813 */ 1814 1815 1816 function fulfillResolver(_x, _x2, _x3) { 1817 return _fulfillResolver.apply(this, arguments); 1818 } 1819 1820 function _fulfillResolver() { 1821 _fulfillResolver = Object(asyncToGenerator["a" /* default */])( 1822 /*#__PURE__*/ 1823 regenerator_default.a.mark(function _callee2(store, resolvers, selectorName) { 1824 var resolver, 1825 _len4, 1826 args, 1827 _key4, 1828 action, 1829 _args2 = arguments; 1830 1831 return regenerator_default.a.wrap(function _callee2$(_context2) { 1832 while (1) { 1833 switch (_context2.prev = _context2.next) { 1834 case 0: 1835 resolver = Object(external_lodash_["get"])(resolvers, [selectorName]); 1836 1837 if (resolver) { 1838 _context2.next = 3; 1839 break; 1840 } 1841 1842 return _context2.abrupt("return"); 1843 1844 case 3: 1845 for (_len4 = _args2.length, args = new Array(_len4 > 3 ? _len4 - 3 : 0), _key4 = 3; _key4 < _len4; _key4++) { 1846 args[_key4 - 3] = _args2[_key4]; 1847 } 1848 1849 action = resolver.fulfill.apply(resolver, args); 1850 1851 if (!action) { 1852 _context2.next = 8; 1853 break; 1854 } 1855 1856 _context2.next = 8; 1857 return store.dispatch(action); 1858 1859 case 8: 1860 case "end": 1861 return _context2.stop(); 1862 } 1863 } 1864 }, _callee2); 1865 })); 1866 return _fulfillResolver.apply(this, arguments); 1867 } 1868 1869 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/store/index.js 1870 1871 1872 1873 function createCoreDataStore(registry) { 1874 var getCoreDataSelector = function getCoreDataSelector(selectorName) { 1875 return function (reducerKey) { 1876 var _registry$select; 1877 1878 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 1879 args[_key - 1] = arguments[_key]; 1880 } 1881 1882 return (_registry$select = registry.select(reducerKey))[selectorName].apply(_registry$select, args); 1883 }; 1884 }; 1885 1886 var getCoreDataAction = function getCoreDataAction(actionName) { 1887 return function (reducerKey) { 1888 var _registry$dispatch; 1889 1890 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 1891 args[_key2 - 1] = arguments[_key2]; 1892 } 1893 1894 return (_registry$dispatch = registry.dispatch(reducerKey))[actionName].apply(_registry$dispatch, args); 1895 }; 1896 }; 1897 1898 return { 1899 getSelectors: function getSelectors() { 1900 return ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'].reduce(function (memo, selectorName) { 1901 return Object(objectSpread["a" /* default */])({}, memo, Object(defineProperty["a" /* default */])({}, selectorName, getCoreDataSelector(selectorName))); 1902 }, {}); 1903 }, 1904 getActions: function getActions() { 1905 return ['startResolution', 'finishResolution', 'invalidateResolution', 'invalidateResolutionForStore', 'invalidateResolutionForStoreSelector'].reduce(function (memo, actionName) { 1906 return Object(objectSpread["a" /* default */])({}, memo, Object(defineProperty["a" /* default */])({}, actionName, getCoreDataAction(actionName))); 1907 }, {}); 1908 }, 1909 subscribe: function subscribe() { 1910 // There's no reasons to trigger any listener when we subscribe to this store 1911 // because there's no state stored in this store that need to retrigger selectors 1912 // if a change happens, the corresponding store where the tracking stated live 1913 // would have already triggered a "subscribe" call. 1914 return function () {}; 1915 } 1916 }; 1917 } 1918 1919 /* harmony default export */ var build_module_store = (createCoreDataStore); 1920 1921 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/registry.js 1922 1923 1924 1925 /** 1926 * External dependencies 1927 */ 1928 1929 /** 1930 * Internal dependencies 1931 */ 1932 1933 1934 1935 /** 1936 * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations. 1937 * 1938 * @property {Function} registerGenericStore Given a namespace key and settings 1939 * object, registers a new generic 1940 * store. 1941 * @property {Function} registerStore Given a namespace key and settings 1942 * object, registers a new namespace 1943 * store. 1944 * @property {Function} subscribe Given a function callback, invokes 1945 * the callback on any change to state 1946 * within any registered store. 1947 * @property {Function} select Given a namespace key, returns an 1948 * object of the store's registered 1949 * selectors. 1950 * @property {Function} dispatch Given a namespace key, returns an 1951 * object of the store's registered 1952 * action dispatchers. 1953 */ 1954 1955 /** 1956 * @typedef {Object} WPDataPlugin An object of registry function overrides. 1957 */ 1958 1959 /** 1960 * Creates a new store registry, given an optional object of initial store 1961 * configurations. 1962 * 1963 * @param {Object} storeConfigs Initial store configurations. 1964 * @param {Object?} parent Parent registry. 1965 * 1966 * @return {WPDataRegistry} Data registry. 1967 */ 1968 1969 function createRegistry() { 1970 var storeConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1971 var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 1972 var stores = {}; 1973 var listeners = []; 1974 /** 1975 * Global listener called for each store's update. 1976 */ 1977 1978 function globalListener() { 1979 listeners.forEach(function (listener) { 1980 return listener(); 1981 }); 1982 } 1983 /** 1984 * Subscribe to changes to any data. 1985 * 1986 * @param {Function} listener Listener function. 1987 * 1988 * @return {Function} Unsubscribe function. 1989 */ 1990 1991 1992 var subscribe = function subscribe(listener) { 1993 listeners.push(listener); 1994 return function () { 1995 listeners = Object(external_lodash_["without"])(listeners, listener); 1996 }; 1997 }; 1998 /** 1999 * Calls a selector given the current state and extra arguments. 2000 * 2001 * @param {string} reducerKey Part of the state shape to register the 2002 * selectors for. 2003 * 2004 * @return {*} The selector's returned value. 2005 */ 2006 2007 2008 function select(reducerKey) { 2009 var store = stores[reducerKey]; 2010 2011 if (store) { 2012 return store.getSelectors(); 2013 } 2014 2015 return parent && parent.select(reducerKey); 2016 } 2017 /** 2018 * Returns the available actions for a part of the state. 2019 * 2020 * @param {string} reducerKey Part of the state shape to dispatch the 2021 * action for. 2022 * 2023 * @return {*} The action's returned value. 2024 */ 2025 2026 2027 function dispatch(reducerKey) { 2028 var store = stores[reducerKey]; 2029 2030 if (store) { 2031 return store.getActions(); 2032 } 2033 2034 return parent && parent.dispatch(reducerKey); 2035 } // 2036 // Deprecated 2037 // TODO: Remove this after `use()` is removed. 2038 // 2039 2040 2041 function withPlugins(attributes) { 2042 return Object(external_lodash_["mapValues"])(attributes, function (attribute, key) { 2043 if (typeof attribute !== 'function') { 2044 return attribute; 2045 } 2046 2047 return function () { 2048 return registry[key].apply(null, arguments); 2049 }; 2050 }); 2051 } 2052 /** 2053 * Registers a generic store. 2054 * 2055 * @param {string} key Store registry key. 2056 * @param {Object} config Configuration (getSelectors, getActions, subscribe). 2057 */ 2058 2059 2060 function registerGenericStore(key, config) { 2061 if (typeof config.getSelectors !== 'function') { 2062 throw new TypeError('config.getSelectors must be a function'); 2063 } 2064 2065 if (typeof config.getActions !== 'function') { 2066 throw new TypeError('config.getActions must be a function'); 2067 } 2068 2069 if (typeof config.subscribe !== 'function') { 2070 throw new TypeError('config.subscribe must be a function'); 2071 } 2072 2073 stores[key] = config; 2074 config.subscribe(globalListener); 2075 } 2076 2077 var registry = { 2078 registerGenericStore: registerGenericStore, 2079 stores: stores, 2080 namespaces: stores, 2081 // TODO: Deprecate/remove this. 2082 subscribe: subscribe, 2083 select: select, 2084 dispatch: dispatch, 2085 use: use 2086 }; 2087 /** 2088 * Registers a standard `@wordpress/data` store. 2089 * 2090 * @param {string} reducerKey Reducer key. 2091 * @param {Object} options Store description (reducer, actions, selectors, resolvers). 2092 * 2093 * @return {Object} Registered store object. 2094 */ 2095 2096 registry.registerStore = function (reducerKey, options) { 2097 if (!options.reducer) { 2098 throw new TypeError('Must specify store reducer'); 2099 } 2100 2101 var namespace = createNamespace(reducerKey, options, registry); 2102 registerGenericStore(reducerKey, namespace); 2103 return namespace.store; 2104 }; // 2105 // TODO: 2106 // This function will be deprecated as soon as it is no longer internally referenced. 2107 // 2108 2109 2110 function use(plugin, options) { 2111 registry = Object(objectSpread["a" /* default */])({}, registry, plugin(registry, options)); 2112 return registry; 2113 } 2114 2115 registerGenericStore('core/data', build_module_store(registry)); 2116 Object.entries(storeConfigs).forEach(function (_ref) { 2117 var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2), 2118 name = _ref2[0], 2119 config = _ref2[1]; 2120 2121 return registry.registerStore(name, config); 2122 }); 2123 2124 if (parent) { 2125 parent.subscribe(globalListener); 2126 } 2127 2128 return withPlugins(registry); 2129 } 2130 2131 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/default-registry.js 2132 /** 2133 * Internal dependencies 2134 */ 2135 2136 /* harmony default export */ var default_registry = (createRegistry()); 2137 2138 // EXTERNAL MODULE: external {"this":["wp","deprecated"]} 2139 var external_this_wp_deprecated_ = __webpack_require__(37); 2140 var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); 2141 2142 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/controls/index.js 2143 /** 2144 * WordPress dependencies 2145 */ 2146 2147 /* harmony default export */ var controls = (function (registry) { 2148 external_this_wp_deprecated_default()('wp.data.plugins.controls', { 2149 hint: 'The controls plugins is now baked-in.' 2150 }); 2151 return registry; 2152 }); 2153 2154 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/object.js 2155 var objectStorage; 2156 var object_storage = { 2157 getItem: function getItem(key) { 2158 if (!objectStorage || !objectStorage[key]) { 2159 return null; 2160 } 2161 2162 return objectStorage[key]; 2163 }, 2164 setItem: function setItem(key, value) { 2165 if (!objectStorage) { 2166 object_storage.clear(); 2167 } 2168 2169 objectStorage[key] = String(value); 2170 }, 2171 clear: function clear() { 2172 objectStorage = Object.create(null); 2173 } 2174 }; 2175 /* harmony default export */ var object = (object_storage); 2176 2177 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/default.js 2178 /** 2179 * Internal dependencies 2180 */ 2181 2182 var default_storage; 2183 2184 try { 2185 // Private Browsing in Safari 10 and earlier will throw an error when 2186 // attempting to set into localStorage. The test here is intentional in 2187 // causing a thrown error as condition for using fallback object storage. 2188 default_storage = window.localStorage; 2189 default_storage.setItem('__wpDataTestLocalStorage', ''); 2190 default_storage.removeItem('__wpDataTestLocalStorage'); 2191 } catch (error) { 2192 default_storage = object; 2193 } 2194 2195 /* harmony default export */ var storage_default = (default_storage); 2196 2197 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/index.js 2198 2199 2200 2201 /** 2202 * External dependencies 2203 */ 2204 2205 /** 2206 * Internal dependencies 2207 */ 2208 2209 2210 2211 /** 2212 * @typedef {Object} WPDataPersistencePluginOptions Persistence plugin options. 2213 * 2214 * @property {Storage} storage Persistent storage implementation. This must 2215 * at least implement `getItem` and `setItem` of 2216 * the Web Storage API. 2217 * @property {string} storageKey Key on which to set in persistent storage. 2218 * 2219 */ 2220 2221 /** 2222 * Default plugin storage. 2223 * 2224 * @type {Storage} 2225 */ 2226 2227 var DEFAULT_STORAGE = storage_default; 2228 /** 2229 * Default plugin storage key. 2230 * 2231 * @type {string} 2232 */ 2233 2234 var DEFAULT_STORAGE_KEY = 'WP_DATA'; 2235 /** 2236 * Higher-order reducer which invokes the original reducer only if state is 2237 * inequal from that of the action's `nextState` property, otherwise returning 2238 * the original state reference. 2239 * 2240 * @param {Function} reducer Original reducer. 2241 * 2242 * @return {Function} Enhanced reducer. 2243 */ 2244 2245 var withLazySameState = function withLazySameState(reducer) { 2246 return function (state, action) { 2247 if (action.nextState === state) { 2248 return state; 2249 } 2250 2251 return reducer(state, action); 2252 }; 2253 }; 2254 /** 2255 * Creates a persistence interface, exposing getter and setter methods (`get` 2256 * and `set` respectively). 2257 * 2258 * @param {WPDataPersistencePluginOptions} options Plugin options. 2259 * 2260 * @return {Object} Persistence interface. 2261 */ 2262 2263 function createPersistenceInterface(options) { 2264 var _options$storage = options.storage, 2265 storage = _options$storage === void 0 ? DEFAULT_STORAGE : _options$storage, 2266 _options$storageKey = options.storageKey, 2267 storageKey = _options$storageKey === void 0 ? DEFAULT_STORAGE_KEY : _options$storageKey; 2268 var data; 2269 /** 2270 * Returns the persisted data as an object, defaulting to an empty object. 2271 * 2272 * @return {Object} Persisted data. 2273 */ 2274 2275 function getData() { 2276 if (data === undefined) { 2277 // If unset, getItem is expected to return null. Fall back to 2278 // empty object. 2279 var persisted = storage.getItem(storageKey); 2280 2281 if (persisted === null) { 2282 data = {}; 2283 } else { 2284 try { 2285 data = JSON.parse(persisted); 2286 } catch (error) { 2287 // Similarly, should any error be thrown during parse of 2288 // the string (malformed JSON), fall back to empty object. 2289 data = {}; 2290 } 2291 } 2292 } 2293 2294 return data; 2295 } 2296 /** 2297 * Merges an updated reducer state into the persisted data. 2298 * 2299 * @param {string} key Key to update. 2300 * @param {*} value Updated value. 2301 */ 2302 2303 2304 function setData(key, value) { 2305 data = Object(objectSpread["a" /* default */])({}, data, Object(defineProperty["a" /* default */])({}, key, value)); 2306 storage.setItem(storageKey, JSON.stringify(data)); 2307 } 2308 2309 return { 2310 get: getData, 2311 set: setData 2312 }; 2313 } 2314 /** 2315 * Data plugin to persist store state into a single storage key. 2316 * 2317 * @param {WPDataRegistry} registry Data registry. 2318 * @param {?WPDataPersistencePluginOptions} pluginOptions Plugin options. 2319 * 2320 * @return {WPDataPlugin} Data plugin. 2321 */ 2322 2323 var persistence_persistencePlugin = function persistencePlugin(registry, pluginOptions) { 2324 var persistence = createPersistenceInterface(pluginOptions); 2325 /** 2326 * Creates an enhanced store dispatch function, triggering the state of the 2327 * given reducer key to be persisted when changed. 2328 * 2329 * @param {Function} getState Function which returns current state. 2330 * @param {string} reducerKey Reducer key. 2331 * @param {?Array<string>} keys Optional subset of keys to save. 2332 * 2333 * @return {Function} Enhanced dispatch function. 2334 */ 2335 2336 function createPersistOnChange(getState, reducerKey, keys) { 2337 var getPersistedState; 2338 2339 if (Array.isArray(keys)) { 2340 // Given keys, the persisted state should by produced as an object 2341 // of the subset of keys. This implementation uses combineReducers 2342 // to leverage its behavior of returning the same object when none 2343 // of the property values changes. This allows a strict reference 2344 // equality to bypass a persistence set on an unchanging state. 2345 var reducers = keys.reduce(function (result, key) { 2346 return Object.assign(result, Object(defineProperty["a" /* default */])({}, key, function (state, action) { 2347 return action.nextState[key]; 2348 })); 2349 }, {}); 2350 getPersistedState = withLazySameState(turbo_combine_reducers_default()(reducers)); 2351 } else { 2352 getPersistedState = function getPersistedState(state, action) { 2353 return action.nextState; 2354 }; 2355 } 2356 2357 var lastState = getPersistedState(undefined, { 2358 nextState: getState() 2359 }); 2360 return function () { 2361 var state = getPersistedState(lastState, { 2362 nextState: getState() 2363 }); 2364 2365 if (state !== lastState) { 2366 persistence.set(reducerKey, state); 2367 lastState = state; 2368 } 2369 }; 2370 } 2371 2372 return { 2373 registerStore: function registerStore(reducerKey, options) { 2374 if (!options.persist) { 2375 return registry.registerStore(reducerKey, options); 2376 } // Load from persistence to use as initial state. 2377 2378 2379 var persistedState = persistence.get()[reducerKey]; 2380 2381 if (persistedState !== undefined) { 2382 var initialState = options.reducer(undefined, { 2383 type: '@@WP/PERSISTENCE_RESTORE' 2384 }); 2385 2386 if (Object(external_lodash_["isPlainObject"])(initialState) && Object(external_lodash_["isPlainObject"])(persistedState)) { 2387 // If state is an object, ensure that: 2388 // - Other keys are left intact when persisting only a 2389 // subset of keys. 2390 // - New keys in what would otherwise be used as initial 2391 // state are deeply merged as base for persisted value. 2392 initialState = Object(external_lodash_["merge"])({}, initialState, persistedState); 2393 } else { 2394 // If there is a mismatch in object-likeness of default 2395 // initial or persisted state, defer to persisted value. 2396 initialState = persistedState; 2397 } 2398 2399 options = Object(objectSpread["a" /* default */])({}, options, { 2400 initialState: initialState 2401 }); 2402 } 2403 2404 var store = registry.registerStore(reducerKey, options); 2405 store.subscribe(createPersistOnChange(store.getState, reducerKey, options.persist)); 2406 return store; 2407 } 2408 }; 2409 }; 2410 /** 2411 * Deprecated: Remove this function once WordPress 5.3 is released. 2412 */ 2413 2414 2415 persistence_persistencePlugin.__unstableMigrate = function (pluginOptions) { 2416 var persistence = createPersistenceInterface(pluginOptions); // Preferences migration to introduce the block editor module 2417 2418 var insertUsage = Object(external_lodash_["get"])(persistence.get(), ['core/editor', 'preferences', 'insertUsage']); 2419 2420 if (insertUsage) { 2421 persistence.set('core/block-editor', { 2422 preferences: { 2423 insertUsage: insertUsage 2424 } 2425 }); 2426 } 2427 }; 2428 2429 /* harmony default export */ var plugins_persistence = (persistence_persistencePlugin); 2430 2431 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/index.js 2432 2433 2434 2435 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 2436 var esm_extends = __webpack_require__(18); 2437 2438 // EXTERNAL MODULE: external {"this":["wp","element"]} 2439 var external_this_wp_element_ = __webpack_require__(0); 2440 2441 // EXTERNAL MODULE: external {"this":["wp","compose"]} 2442 var external_this_wp_compose_ = __webpack_require__(8); 2443 2444 // EXTERNAL MODULE: external {"this":["wp","priorityQueue"]} 2445 var external_this_wp_priorityQueue_ = __webpack_require__(230); 2446 2447 // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]} 2448 var external_this_wp_isShallowEqual_ = __webpack_require__(41); 2449 var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_); 2450 2451 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/context.js 2452 /** 2453 * WordPress dependencies 2454 */ 2455 2456 /** 2457 * Internal dependencies 2458 */ 2459 2460 2461 var Context = Object(external_this_wp_element_["createContext"])(default_registry); 2462 var Consumer = Context.Consumer, 2463 Provider = Context.Provider; 2464 /** 2465 * A custom react Context consumer exposing the provided `registry` to 2466 * children components. Used along with the RegistryProvider. 2467 * 2468 * You can read more about the react context api here: 2469 * https://reactjs.org/docs/context.html#contextprovider 2470 * 2471 * @example 2472 * ```js 2473 * const { 2474 * RegistryProvider, 2475 * RegistryConsumer, 2476 * createRegistry 2477 * } = wp.data; 2478 * 2479 * const registry = createRegistry( {} ); 2480 * 2481 * const App = ( { props } ) => { 2482 * return <RegistryProvider value={ registry }> 2483 * <div>Hello There</div> 2484 * <RegistryConsumer> 2485 * { ( registry ) => ( 2486 * <ComponentUsingRegistry 2487 * { ...props } 2488 * registry={ registry } 2489 * ) } 2490 * </RegistryConsumer> 2491 * </RegistryProvider> 2492 * } 2493 * ``` 2494 */ 2495 2496 var RegistryConsumer = Consumer; 2497 /** 2498 * A custom Context provider for exposing the provided `registry` to children 2499 * components via a consumer. 2500 * 2501 * See <a name="#RegistryConsumer">RegistryConsumer</a> documentation for 2502 * example. 2503 */ 2504 2505 /* harmony default export */ var context = (Provider); 2506 2507 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/use-registry.js 2508 /** 2509 * WordPress dependencies 2510 */ 2511 2512 /** 2513 * Internal dependencies 2514 */ 2515 2516 2517 /** 2518 * A custom react hook exposing the registry context for use. 2519 * 2520 * This exposes the `registry` value provided via the 2521 * <a href="#RegistryProvider">Registry Provider</a> to a component implementing 2522 * this hook. 2523 * 2524 * It acts similarly to the `useContext` react hook. 2525 * 2526 * Note: Generally speaking, `useRegistry` is a low level hook that in most cases 2527 * won't be needed for implementation. Most interactions with the wp.data api 2528 * can be performed via the `useSelect` hook, or the `withSelect` and 2529 * `withDispatch` higher order components. 2530 * 2531 * @example 2532 * ```js 2533 * const { 2534 * RegistryProvider, 2535 * createRegistry, 2536 * useRegistry, 2537 * } = wp.data 2538 * 2539 * const registry = createRegistry( {} ); 2540 * 2541 * const SomeChildUsingRegistry = ( props ) => { 2542 * const registry = useRegistry( registry ); 2543 * // ...logic implementing the registry in other react hooks. 2544 * }; 2545 * 2546 * 2547 * const ParentProvidingRegistry = ( props ) => { 2548 * return <RegistryProvider value={ registry }> 2549 * <SomeChildUsingRegistry { ...props } /> 2550 * </RegistryProvider> 2551 * }; 2552 * ``` 2553 * 2554 * @return {Function} A custom react hook exposing the registry context value. 2555 */ 2556 2557 function useRegistry() { 2558 return Object(external_this_wp_element_["useContext"])(Context); 2559 } 2560 2561 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/context.js 2562 /** 2563 * WordPress dependencies 2564 */ 2565 2566 var context_Context = Object(external_this_wp_element_["createContext"])(false); 2567 var context_Consumer = context_Context.Consumer, 2568 context_Provider = context_Context.Provider; 2569 var AsyncModeConsumer = context_Consumer; 2570 /* harmony default export */ var async_mode_provider_context = (context_Provider); 2571 2572 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/use-async-mode.js 2573 /** 2574 * WordPress dependencies 2575 */ 2576 2577 /** 2578 * Internal dependencies 2579 */ 2580 2581 2582 function useAsyncMode() { 2583 return Object(external_this_wp_element_["useContext"])(context_Context); 2584 } 2585 2586 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-select/index.js 2587 2588 2589 /** 2590 * WordPress dependencies 2591 */ 2592 2593 2594 2595 /** 2596 * Internal dependencies 2597 */ 2598 2599 2600 2601 /** 2602 * Favor useLayoutEffect to ensure the store subscription callback always has 2603 * the selector from the latest render. If a store update happens between render 2604 * and the effect, this could cause missed/stale updates or inconsistent state. 2605 * 2606 * Fallback to useEffect for server rendered components because currently React 2607 * throws a warning when using useLayoutEffect in that environment. 2608 */ 2609 2610 var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_this_wp_element_["useLayoutEffect"] : external_this_wp_element_["useEffect"]; 2611 var renderQueue = Object(external_this_wp_priorityQueue_["createQueue"])(); 2612 /** 2613 * Custom react hook for retrieving props from registered selectors. 2614 * 2615 * In general, this custom React hook follows the 2616 * [rules of hooks](https://reactjs.org/docs/hooks-rules.html). 2617 * 2618 * @param {Function} _mapSelect Function called on every state change. The 2619 * returned value is exposed to the component 2620 * implementing this hook. The function receives 2621 * the `registry.select` method on the first 2622 * argument and the `registry` on the second 2623 * argument. 2624 * @param {Array} deps If provided, this memoizes the mapSelect so the 2625 * same `mapSelect` is invoked on every state 2626 * change unless the dependencies change. 2627 * 2628 * @example 2629 * ```js 2630 * const { useSelect } = wp.data; 2631 * 2632 * function HammerPriceDisplay( { currency } ) { 2633 * const price = useSelect( ( select ) => { 2634 * return select( 'my-shop' ).getPrice( 'hammer', currency ) 2635 * }, [ currency ] ); 2636 * return new Intl.NumberFormat( 'en-US', { 2637 * style: 'currency', 2638 * currency, 2639 * } ).format( price ); 2640 * } 2641 * 2642 * // Rendered in the application: 2643 * // <HammerPriceDisplay currency="USD" /> 2644 * ``` 2645 * 2646 * In the above example, when `HammerPriceDisplay` is rendered into an 2647 * application, the price will be retrieved from the store state using the 2648 * `mapSelect` callback on `useSelect`. If the currency prop changes then 2649 * any price in the state for that currency is retrieved. If the currency prop 2650 * doesn't change and other props are passed in that do change, the price will 2651 * not change because the dependency is just the currency. 2652 * 2653 * @return {Function} A custom react hook. 2654 */ 2655 2656 function useSelect(_mapSelect, deps) { 2657 var mapSelect = Object(external_this_wp_element_["useCallback"])(_mapSelect, deps); 2658 var registry = useRegistry(); 2659 var isAsync = useAsyncMode(); 2660 var queueContext = Object(external_this_wp_element_["useMemo"])(function () { 2661 return { 2662 queue: true 2663 }; 2664 }, [registry]); 2665 2666 var _useReducer = Object(external_this_wp_element_["useReducer"])(function (s) { 2667 return s + 1; 2668 }, 0), 2669 _useReducer2 = Object(slicedToArray["a" /* default */])(_useReducer, 2), 2670 forceRender = _useReducer2[1]; 2671 2672 var latestMapSelect = Object(external_this_wp_element_["useRef"])(); 2673 var latestIsAsync = Object(external_this_wp_element_["useRef"])(isAsync); 2674 var latestMapOutput = Object(external_this_wp_element_["useRef"])(); 2675 var latestMapOutputError = Object(external_this_wp_element_["useRef"])(); 2676 var isMounted = Object(external_this_wp_element_["useRef"])(); 2677 var mapOutput; 2678 2679 try { 2680 if (latestMapSelect.current !== mapSelect || latestMapOutputError.current) { 2681 mapOutput = mapSelect(registry.select, registry); 2682 } else { 2683 mapOutput = latestMapOutput.current; 2684 } 2685 } catch (error) { 2686 var errorMessage = "An error occurred while running 'mapSelect': ".concat(error.message); 2687 2688 if (latestMapOutputError.current) { 2689 errorMessage += "\nThe error may be correlated with this previous error:\n"; 2690 errorMessage += "".concat(latestMapOutputError.current.stack, "\n\n"); 2691 errorMessage += 'Original stack trace:'; 2692 throw new Error(errorMessage); 2693 } 2694 } 2695 2696 useIsomorphicLayoutEffect(function () { 2697 latestMapSelect.current = mapSelect; 2698 2699 if (latestIsAsync.current !== isAsync) { 2700 latestIsAsync.current = isAsync; 2701 renderQueue.flush(queueContext); 2702 } 2703 2704 latestMapOutput.current = mapOutput; 2705 latestMapOutputError.current = undefined; 2706 isMounted.current = true; 2707 }); 2708 useIsomorphicLayoutEffect(function () { 2709 var onStoreChange = function onStoreChange() { 2710 if (isMounted.current) { 2711 try { 2712 var newMapOutput = latestMapSelect.current(registry.select, registry); 2713 2714 if (external_this_wp_isShallowEqual_default()(latestMapOutput.current, newMapOutput)) { 2715 return; 2716 } 2717 2718 latestMapOutput.current = newMapOutput; 2719 } catch (error) { 2720 latestMapOutputError.current = error; 2721 } 2722 2723 forceRender({}); 2724 } 2725 }; // catch any possible state changes during mount before the subscription 2726 // could be set. 2727 2728 2729 if (latestIsAsync.current) { 2730 renderQueue.add(queueContext, onStoreChange); 2731 } else { 2732 onStoreChange(); 2733 } 2734 2735 var unsubscribe = registry.subscribe(function () { 2736 if (latestIsAsync.current) { 2737 renderQueue.add(queueContext, onStoreChange); 2738 } else { 2739 onStoreChange(); 2740 } 2741 }); 2742 return function () { 2743 isMounted.current = false; 2744 unsubscribe(); 2745 renderQueue.flush(queueContext); 2746 }; 2747 }, [registry]); 2748 return mapOutput; 2749 } 2750 2751 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-select/index.js 2752 2753 2754 2755 /** 2756 * WordPress dependencies 2757 */ 2758 2759 /** 2760 * Internal dependencies 2761 */ 2762 2763 2764 /** 2765 * Higher-order component used to inject state-derived props using registered 2766 * selectors. 2767 * 2768 * @param {Function} mapSelectToProps Function called on every state change, 2769 * expected to return object of props to 2770 * merge with the component's own props. 2771 * 2772 * @example 2773 * ```js 2774 * function PriceDisplay( { price, currency } ) { 2775 * return new Intl.NumberFormat( 'en-US', { 2776 * style: 'currency', 2777 * currency, 2778 * } ).format( price ); 2779 * } 2780 * 2781 * const { withSelect } = wp.data; 2782 * 2783 * const HammerPriceDisplay = withSelect( ( select, ownProps ) => { 2784 * const { getPrice } = select( 'my-shop' ); 2785 * const { currency } = ownProps; 2786 * 2787 * return { 2788 * price: getPrice( 'hammer', currency ), 2789 * }; 2790 * } )( PriceDisplay ); 2791 * 2792 * // Rendered in the application: 2793 * // 2794 * // <HammerPriceDisplay currency="USD" /> 2795 * ``` 2796 * In the above example, when `HammerPriceDisplay` is rendered into an 2797 * application, it will pass the price into the underlying `PriceDisplay` 2798 * component and update automatically if the price of a hammer ever changes in 2799 * the store. 2800 * 2801 * @return {Component} Enhanced component with merged state data props. 2802 */ 2803 2804 var with_select_withSelect = function withSelect(mapSelectToProps) { 2805 return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (WrappedComponent) { 2806 return Object(external_this_wp_compose_["pure"])(function (ownProps) { 2807 var mapSelect = function mapSelect(select, registry) { 2808 return mapSelectToProps(select, ownProps, registry); 2809 }; 2810 2811 var mergeProps = useSelect(mapSelect); 2812 return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, mergeProps)); 2813 }); 2814 }, 'withSelect'); 2815 }; 2816 2817 /* harmony default export */ var with_select = (with_select_withSelect); 2818 2819 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch.js 2820 /** 2821 * Internal dependencies 2822 */ 2823 2824 /** 2825 * A custom react hook returning the current registry dispatch actions creators. 2826 * 2827 * Note: The component using this hook must be within the context of a 2828 * RegistryProvider. 2829 * 2830 * @param {string} [storeName] Optionally provide the name of the store from 2831 * which to retrieve action creators. If not 2832 * provided, the registry.dispatch function is 2833 * returned instead. 2834 * 2835 * @example 2836 * This illustrates a pattern where you may need to retrieve dynamic data from 2837 * the server via the `useSelect` hook to use in combination with the dispatch 2838 * action. 2839 * 2840 * ```jsx 2841 * const { useDispatch, useSelect } = wp.data; 2842 * const { useCallback } = wp.element; 2843 * 2844 * function Button( { onClick, children } ) { 2845 * return <button type="button" onClick={ onClick }>{ children }</button> 2846 * } 2847 * 2848 * const SaleButton = ( { children } ) => { 2849 * const { stockNumber } = useSelect( 2850 * ( select ) => select( 'my-shop' ).getStockNumber() 2851 * ); 2852 * const { startSale } = useDispatch( 'my-shop' ); 2853 * const onClick = useCallback( () => { 2854 * const discountPercent = stockNumber > 50 ? 10: 20; 2855 * startSale( discountPercent ); 2856 * }, [ stockNumber ] ); 2857 * return <Button onClick={ onClick }>{ children }</Button> 2858 * } 2859 * 2860 * // Rendered somewhere in the application: 2861 * // 2862 * // <SaleButton>Start Sale!</SaleButton> 2863 * ``` 2864 * @return {Function} A custom react hook. 2865 */ 2866 2867 var use_dispatch_useDispatch = function useDispatch(storeName) { 2868 var _useRegistry = useRegistry(), 2869 dispatch = _useRegistry.dispatch; 2870 2871 return storeName === void 0 ? dispatch : dispatch(storeName); 2872 }; 2873 2874 /* harmony default export */ var use_dispatch = (use_dispatch_useDispatch); 2875 2876 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch-with-map.js 2877 2878 2879 /** 2880 * External dependencies 2881 */ 2882 2883 /** 2884 * WordPress dependencies 2885 */ 2886 2887 2888 /** 2889 * Internal dependencies 2890 */ 2891 2892 2893 /** 2894 * Favor useLayoutEffect to ensure the store subscription callback always has 2895 * the dispatchMap from the latest render. If a store update happens between 2896 * render and the effect, this could cause missed/stale updates or 2897 * inconsistent state. 2898 * 2899 * Fallback to useEffect for server rendered components because currently React 2900 * throws a warning when using useLayoutEffect in that environment. 2901 */ 2902 2903 var use_dispatch_with_map_useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_this_wp_element_["useLayoutEffect"] : external_this_wp_element_["useEffect"]; 2904 /** 2905 * Custom react hook for returning aggregate dispatch actions using the provided 2906 * dispatchMap. 2907 * 2908 * Currently this is an internal api only and is implemented by `withDispatch` 2909 * 2910 * @param {Function} dispatchMap Receives the `registry.dispatch` function as 2911 * the first argument and the `registry` object 2912 * as the second argument. Should return an 2913 * object mapping props to functions. 2914 * @param {Array} deps An array of dependencies for the hook. 2915 * @return {Object} An object mapping props to functions created by the passed 2916 * in dispatchMap. 2917 */ 2918 2919 var use_dispatch_with_map_useDispatchWithMap = function useDispatchWithMap(dispatchMap, deps) { 2920 var registry = useRegistry(); 2921 var currentDispatchMap = Object(external_this_wp_element_["useRef"])(dispatchMap); 2922 use_dispatch_with_map_useIsomorphicLayoutEffect(function () { 2923 currentDispatchMap.current = dispatchMap; 2924 }); 2925 return Object(external_this_wp_element_["useMemo"])(function () { 2926 var currentDispatchProps = currentDispatchMap.current(registry.dispatch, registry); 2927 return Object(external_lodash_["mapValues"])(currentDispatchProps, function (dispatcher, propName) { 2928 if (typeof dispatcher !== 'function') { 2929 // eslint-disable-next-line no-console 2930 console.warn("Property ".concat(propName, " returned from dispatchMap in useDispatchWithMap must be a function.")); 2931 } 2932 2933 return function () { 2934 var _currentDispatchMap$c; 2935 2936 return (_currentDispatchMap$c = currentDispatchMap.current(registry.dispatch, registry))[propName].apply(_currentDispatchMap$c, arguments); 2937 }; 2938 }); 2939 }, [registry].concat(Object(toConsumableArray["a" /* default */])(deps))); 2940 }; 2941 2942 /* harmony default export */ var use_dispatch_with_map = (use_dispatch_with_map_useDispatchWithMap); 2943 2944 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/index.js 2945 2946 2947 2948 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-dispatch/index.js 2949 2950 2951 2952 /** 2953 * WordPress dependencies 2954 */ 2955 2956 /** 2957 * Internal dependencies 2958 */ 2959 2960 2961 /** 2962 * Higher-order component used to add dispatch props using registered action 2963 * creators. 2964 * 2965 * @param {Function} mapDispatchToProps A function of returning an object of 2966 * prop names where value is a 2967 * dispatch-bound action creator, or a 2968 * function to be called with the 2969 * component's props and returning an 2970 * action creator. 2971 * 2972 * @example 2973 * ```jsx 2974 * function Button( { onClick, children } ) { 2975 * return <button type="button" onClick={ onClick }>{ children }</button>; 2976 * } 2977 * 2978 * const { withDispatch } = wp.data; 2979 * 2980 * const SaleButton = withDispatch( ( dispatch, ownProps ) => { 2981 * const { startSale } = dispatch( 'my-shop' ); 2982 * const { discountPercent } = ownProps; 2983 * 2984 * return { 2985 * onClick() { 2986 * startSale( discountPercent ); 2987 * }, 2988 * }; 2989 * } )( Button ); 2990 * 2991 * // Rendered in the application: 2992 * // 2993 * // <SaleButton discountPercent="20">Start Sale!</SaleButton> 2994 * ``` 2995 * 2996 * @example 2997 * In the majority of cases, it will be sufficient to use only two first params 2998 * passed to `mapDispatchToProps` as illustrated in the previous example. 2999 * However, there might be some very advanced use cases where using the 3000 * `registry` object might be used as a tool to optimize the performance of 3001 * your component. Using `select` function from the registry might be useful 3002 * when you need to fetch some dynamic data from the store at the time when the 3003 * event is fired, but at the same time, you never use it to render your 3004 * component. In such scenario, you can avoid using the `withSelect` higher 3005 * order component to compute such prop, which might lead to unnecessary 3006 * re-renders of your component caused by its frequent value change. 3007 * Keep in mind, that `mapDispatchToProps` must return an object with functions 3008 * only. 3009 * 3010 * ```jsx 3011 * function Button( { onClick, children } ) { 3012 * return <button type="button" onClick={ onClick }>{ children }</button>; 3013 * } 3014 * 3015 * const { withDispatch } = wp.data; 3016 * 3017 * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => { 3018 * // Stock number changes frequently. 3019 * const { getStockNumber } = select( 'my-shop' ); 3020 * const { startSale } = dispatch( 'my-shop' ); 3021 * return { 3022 * onClick() { 3023 * const discountPercent = getStockNumber() > 50 ? 10 : 20; 3024 * startSale( discountPercent ); 3025 * }, 3026 * }; 3027 * } )( Button ); 3028 * 3029 * // Rendered in the application: 3030 * // 3031 * // <SaleButton>Start Sale!</SaleButton> 3032 * ``` 3033 * 3034 * _Note:_ It is important that the `mapDispatchToProps` function always 3035 * returns an object with the same keys. For example, it should not contain 3036 * conditions under which a different value would be returned. 3037 * 3038 * @return {Component} Enhanced component with merged dispatcher props. 3039 */ 3040 3041 var with_dispatch_withDispatch = function withDispatch(mapDispatchToProps) { 3042 return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (WrappedComponent) { 3043 return function (ownProps) { 3044 var mapDispatch = function mapDispatch(dispatch, registry) { 3045 return mapDispatchToProps(dispatch, ownProps, registry); 3046 }; 3047 3048 var dispatchProps = use_dispatch_with_map(mapDispatch, []); 3049 return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, dispatchProps)); 3050 }; 3051 }, 'withDispatch'); 3052 }; 3053 3054 /* harmony default export */ var with_dispatch = (with_dispatch_withDispatch); 3055 3056 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/index.js 3057 3058 3059 3060 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-registry/index.js 3061 3062 3063 3064 /** 3065 * WordPress dependencies 3066 */ 3067 3068 /** 3069 * Internal dependencies 3070 */ 3071 3072 3073 /** 3074 * Higher-order component which renders the original component with the current 3075 * registry context passed as its `registry` prop. 3076 * 3077 * @param {WPComponent} OriginalComponent Original component. 3078 * 3079 * @return {WPComponent} Enhanced component. 3080 */ 3081 3082 var withRegistry = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) { 3083 return function (props) { 3084 return Object(external_this_wp_element_["createElement"])(RegistryConsumer, null, function (registry) { 3085 return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, { 3086 registry: registry 3087 })); 3088 }); 3089 }; 3090 }, 'withRegistry'); 3091 /* harmony default export */ var with_registry = (withRegistry); 3092 3093 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/index.js 3094 3095 3096 3097 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/factory.js 3098 /** 3099 * Internal dependencies 3100 */ 3101 3102 /** 3103 * @typedef {import('./registry').WPDataRegistry} WPDataRegistry 3104 */ 3105 3106 /** 3107 * Mark a selector as a registry selector. 3108 * 3109 * @param {Function} registrySelector Function receiving a registry object and returning a state selector. 3110 * 3111 * @return {Function} marked registry selector. 3112 */ 3113 3114 function createRegistrySelector(registrySelector) { 3115 var selector = function selector() { 3116 return registrySelector(selector.registry.select).apply(void 0, arguments); 3117 }; 3118 /** 3119 * Flag indicating to selector registration mapping that the selector should 3120 * be mapped as a registry selector. 3121 * 3122 * @type {boolean} 3123 */ 3124 3125 3126 selector.isRegistrySelector = true; 3127 /** 3128 * Registry on which to call `select`, stubbed for non-standard usage to 3129 * use the default registry. 3130 * 3131 * @type {WPDataRegistry} 3132 */ 3133 3134 selector.registry = default_registry; 3135 return selector; 3136 } 3137 /** 3138 * Mark a control as a registry control. 3139 * 3140 * @param {Function} registryControl Function receiving a registry object and returning a control. 3141 * 3142 * @return {Function} marked registry control. 3143 */ 3144 3145 function createRegistryControl(registryControl) { 3146 registryControl.isRegistryControl = true; 3147 return registryControl; 3148 } 3149 3150 // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/index.js 3151 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return build_module_select; }); 3152 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function() { return build_module_dispatch; }); 3153 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return build_module_subscribe; }); 3154 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerGenericStore", function() { return build_module_registerGenericStore; }); 3155 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerStore", function() { return build_module_registerStore; }); 3156 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "use", function() { return build_module_use; }); 3157 /* concated harmony reexport withSelect */__webpack_require__.d(__webpack_exports__, "withSelect", function() { return with_select; }); 3158 /* concated harmony reexport withDispatch */__webpack_require__.d(__webpack_exports__, "withDispatch", function() { return with_dispatch; }); 3159 /* concated harmony reexport withRegistry */__webpack_require__.d(__webpack_exports__, "withRegistry", function() { return with_registry; }); 3160 /* concated harmony reexport RegistryProvider */__webpack_require__.d(__webpack_exports__, "RegistryProvider", function() { return context; }); 3161 /* concated harmony reexport RegistryConsumer */__webpack_require__.d(__webpack_exports__, "RegistryConsumer", function() { return RegistryConsumer; }); 3162 /* concated harmony reexport useRegistry */__webpack_require__.d(__webpack_exports__, "useRegistry", function() { return useRegistry; }); 3163 /* concated harmony reexport useSelect */__webpack_require__.d(__webpack_exports__, "useSelect", function() { return useSelect; }); 3164 /* concated harmony reexport useDispatch */__webpack_require__.d(__webpack_exports__, "useDispatch", function() { return use_dispatch; }); 3165 /* concated harmony reexport __experimentalAsyncModeProvider */__webpack_require__.d(__webpack_exports__, "__experimentalAsyncModeProvider", function() { return async_mode_provider_context; }); 3166 /* concated harmony reexport createRegistry */__webpack_require__.d(__webpack_exports__, "createRegistry", function() { return createRegistry; }); 3167 /* concated harmony reexport createRegistrySelector */__webpack_require__.d(__webpack_exports__, "createRegistrySelector", function() { return createRegistrySelector; }); 3168 /* concated harmony reexport createRegistryControl */__webpack_require__.d(__webpack_exports__, "createRegistryControl", function() { return createRegistryControl; }); 3169 /* concated harmony reexport plugins */__webpack_require__.d(__webpack_exports__, "plugins", function() { return plugins_namespaceObject; }); 3170 /* concated harmony reexport combineReducers */__webpack_require__.d(__webpack_exports__, "combineReducers", function() { return turbo_combine_reducers_default.a; }); 3171 /** 3172 * External dependencies 3173 */ 3174 3175 /** 3176 * Internal dependencies 3177 */ 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 /** 3191 * Object of available plugins to use with a registry. 3192 * 3193 * @see [use](#use) 3194 * 3195 * @type {Object} 3196 */ 3197 3198 3199 /** 3200 * The combineReducers helper function turns an object whose values are different 3201 * reducing functions into a single reducing function you can pass to registerReducer. 3202 * 3203 * @param {Object} reducers An object whose values correspond to different reducing 3204 * functions that need to be combined into one. 3205 * 3206 * @example 3207 * ```js 3208 * const { combineReducers, registerStore } = wp.data; 3209 * 3210 * const prices = ( state = {}, action ) => { 3211 * return action.type === 'SET_PRICE' ? 3212 * { 3213 * ...state, 3214 * [ action.item ]: action.price, 3215 * } : 3216 * state; 3217 * }; 3218 * 3219 * const discountPercent = ( state = 0, action ) => { 3220 * return action.type === 'START_SALE' ? 3221 * action.discountPercent : 3222 * state; 3223 * }; 3224 * 3225 * registerStore( 'my-shop', { 3226 * reducer: combineReducers( { 3227 * prices, 3228 * discountPercent, 3229 * } ), 3230 * } ); 3231 * ``` 3232 * 3233 * @return {Function} A reducer that invokes every reducer inside the reducers 3234 * object, and constructs a state object with the same shape. 3235 */ 3236 3237 3238 /** 3239 * Given the name of a registered store, returns an object of the store's selectors. 3240 * The selector functions are been pre-bound to pass the current state automatically. 3241 * As a consumer, you need only pass arguments of the selector, if applicable. 3242 * 3243 * @param {string} name Store name 3244 * 3245 * @example 3246 * ```js 3247 * const { select } = wp.data; 3248 * 3249 * select( 'my-shop' ).getPrice( 'hammer' ); 3250 * ``` 3251 * 3252 * @return {Object} Object containing the store's selectors. 3253 */ 3254 3255 var build_module_select = default_registry.select; 3256 /** 3257 * Given the name of a registered store, returns an object of the store's action creators. 3258 * Calling an action creator will cause it to be dispatched, updating the state value accordingly. 3259 * 3260 * Note: Action creators returned by the dispatch will return a promise when 3261 * they are called. 3262 * 3263 * @param {string} name Store name 3264 * 3265 * @example 3266 * ```js 3267 * const { dispatch } = wp.data; 3268 * 3269 * dispatch( 'my-shop' ).setPrice( 'hammer', 9.75 ); 3270 * ``` 3271 * @return {Object} Object containing the action creators. 3272 */ 3273 3274 var build_module_dispatch = default_registry.dispatch; 3275 /** 3276 * Given a listener function, the function will be called any time the state value 3277 * of one of the registered stores has changed. This function returns a `unsubscribe` 3278 * function used to stop the subscription. 3279 * 3280 * @param {Function} listener Callback function. 3281 * 3282 * @example 3283 * ```js 3284 * const { subscribe } = wp.data; 3285 * 3286 * const unsubscribe = subscribe( () => { 3287 * // You could use this opportunity to test whether the derived result of a 3288 * // selector has subsequently changed as the result of a state update. 3289 * } ); 3290 * 3291 * // Later, if necessary... 3292 * unsubscribe(); 3293 * ``` 3294 */ 3295 3296 var build_module_subscribe = default_registry.subscribe; 3297 /** 3298 * Registers a generic store. 3299 * 3300 * @param {string} key Store registry key. 3301 * @param {Object} config Configuration (getSelectors, getActions, subscribe). 3302 */ 3303 3304 var build_module_registerGenericStore = default_registry.registerGenericStore; 3305 /** 3306 * Registers a standard `@wordpress/data` store. 3307 * 3308 * @param {string} reducerKey Reducer key. 3309 * @param {Object} options Store description (reducer, actions, selectors, resolvers). 3310 * 3311 * @return {Object} Registered store object. 3312 */ 3313 3314 var build_module_registerStore = default_registry.registerStore; 3315 /** 3316 * Extends a registry to inherit functionality provided by a given plugin. A 3317 * plugin is an object with properties aligning to that of a registry, merged 3318 * to extend the default registry behavior. 3319 * 3320 * @param {Object} plugin Plugin object. 3321 */ 3322 3323 var build_module_use = default_registry.use; 3324 3325 3326 /***/ }), 3327 3328 /***/ 37: 3329 /***/ (function(module, exports) { 3330 3331 (function() { module.exports = this["wp"]["deprecated"]; }()); 3332 3333 /***/ }), 3334 3335 /***/ 38: 3336 /***/ (function(module, __webpack_exports__, __webpack_require__) { 3337 3338 "use strict"; 3339 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); 3340 function _arrayWithHoles(arr) { 3341 if (Array.isArray(arr)) return arr; 3342 } 3343 3344 /***/ }), 3345 3346 /***/ 39: 3347 /***/ (function(module, __webpack_exports__, __webpack_require__) { 3348 3349 "use strict"; 3350 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); 3351 function _nonIterableRest() { 3352 throw new TypeError("Invalid attempt to destructure non-iterable instance"); 3353 } 3354 3355 /***/ }), 3356 3357 /***/ 41: 3358 /***/ (function(module, exports) { 3359 3360 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); 3361 3362 /***/ }), 3363 3364 /***/ 43: 3365 /***/ (function(module, __webpack_exports__, __webpack_require__) { 3366 3367 "use strict"; 3368 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); 3369 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 3370 try { 3371 var info = gen[key](arg); 3372 var value = info.value; 3373 } catch (error) { 3374 reject(error); 3375 return; 3376 } 3377 3378 if (info.done) { 3379 resolve(value); 3380 } else { 3381 Promise.resolve(value).then(_next, _throw); 3382 } 3383 } 3384 3385 function _asyncToGenerator(fn) { 3386 return function () { 3387 var self = this, 3388 args = arguments; 3389 return new Promise(function (resolve, reject) { 3390 var gen = fn.apply(self, args); 3391 3392 function _next(value) { 3393 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 3394 } 3395 3396 function _throw(err) { 3397 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 3398 } 3399 3400 _next(undefined); 3401 }); 3402 }; 3403 } 3404 3405 /***/ }), 3406 3407 /***/ 47: 3408 /***/ (function(module, exports, __webpack_require__) { 3409 3410 /** 3411 * Copyright (c) 2014-present, Facebook, Inc. 3412 * 3413 * This source code is licensed under the MIT license found in the 3414 * LICENSE file in the root directory of this source tree. 3415 */ 3416 3417 var runtime = (function (exports) { 3418 "use strict"; 3419 3420 var Op = Object.prototype; 3421 var hasOwn = Op.hasOwnProperty; 3422 var undefined; // More compressible than void 0. 3423 var $Symbol = typeof Symbol === "function" ? Symbol : {}; 3424 var iteratorSymbol = $Symbol.iterator || "@@iterator"; 3425 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; 3426 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 3427 3428 function wrap(innerFn, outerFn, self, tryLocsList) { 3429 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. 3430 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; 3431 var generator = Object.create(protoGenerator.prototype); 3432 var context = new Context(tryLocsList || []); 3433 3434 // The ._invoke method unifies the implementations of the .next, 3435 // .throw, and .return methods. 3436 generator._invoke = makeInvokeMethod(innerFn, self, context); 3437 3438 return generator; 3439 } 3440 exports.wrap = wrap; 3441 3442 // Try/catch helper to minimize deoptimizations. Returns a completion 3443 // record like context.tryEntries[i].completion. This interface could 3444 // have been (and was previously) designed to take a closure to be 3445 // invoked without arguments, but in all the cases we care about we 3446 // already have an existing method we want to call, so there's no need 3447 // to create a new function object. We can even get away with assuming 3448 // the method takes exactly one argument, since that happens to be true 3449 // in every case, so we don't have to touch the arguments object. The 3450 // only additional allocation required is the completion record, which 3451 // has a stable shape and so hopefully should be cheap to allocate. 3452 function tryCatch(fn, obj, arg) { 3453 try { 3454 return { type: "normal", arg: fn.call(obj, arg) }; 3455 } catch (err) { 3456 return { type: "throw", arg: err }; 3457 } 3458 } 3459 3460 var GenStateSuspendedStart = "suspendedStart"; 3461 var GenStateSuspendedYield = "suspendedYield"; 3462 var GenStateExecuting = "executing"; 3463 var GenStateCompleted = "completed"; 3464 3465 // Returning this object from the innerFn has the same effect as 3466 // breaking out of the dispatch switch statement. 3467 var ContinueSentinel = {}; 3468 3469 // Dummy constructor functions that we use as the .constructor and 3470 // .constructor.prototype properties for functions that return Generator 3471 // objects. For full spec compliance, you may wish to configure your 3472 // minifier not to mangle the names of these two functions. 3473 function Generator() {} 3474 function GeneratorFunction() {} 3475 function GeneratorFunctionPrototype() {} 3476 3477 // This is a polyfill for %IteratorPrototype% for environments that 3478 // don't natively support it. 3479 var IteratorPrototype = {}; 3480 IteratorPrototype[iteratorSymbol] = function () { 3481 return this; 3482 }; 3483 3484 var getProto = Object.getPrototypeOf; 3485 var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 3486 if (NativeIteratorPrototype && 3487 NativeIteratorPrototype !== Op && 3488 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { 3489 // This environment has a native %IteratorPrototype%; use it instead 3490 // of the polyfill. 3491 IteratorPrototype = NativeIteratorPrototype; 3492 } 3493 3494 var Gp = GeneratorFunctionPrototype.prototype = 3495 Generator.prototype = Object.create(IteratorPrototype); 3496 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; 3497 GeneratorFunctionPrototype.constructor = GeneratorFunction; 3498 GeneratorFunctionPrototype[toStringTagSymbol] = 3499 GeneratorFunction.displayName = "GeneratorFunction"; 3500 3501 // Helper for defining the .next, .throw, and .return methods of the 3502 // Iterator interface in terms of a single ._invoke method. 3503 function defineIteratorMethods(prototype) { 3504 ["next", "throw", "return"].forEach(function(method) { 3505 prototype[method] = function(arg) { 3506 return this._invoke(method, arg); 3507 }; 3508 }); 3509 } 3510 3511 exports.isGeneratorFunction = function(genFun) { 3512 var ctor = typeof genFun === "function" && genFun.constructor; 3513 return ctor 3514 ? ctor === GeneratorFunction || 3515 // For the native GeneratorFunction constructor, the best we can 3516 // do is to check its .name property. 3517 (ctor.displayName || ctor.name) === "GeneratorFunction" 3518 : false; 3519 }; 3520 3521 exports.mark = function(genFun) { 3522 if (Object.setPrototypeOf) { 3523 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); 3524 } else { 3525 genFun.__proto__ = GeneratorFunctionPrototype; 3526 if (!(toStringTagSymbol in genFun)) { 3527 genFun[toStringTagSymbol] = "GeneratorFunction"; 3528 } 3529 } 3530 genFun.prototype = Object.create(Gp); 3531 return genFun; 3532 }; 3533 3534 // Within the body of any async function, `await x` is transformed to 3535 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test 3536 // `hasOwn.call(value, "__await")` to determine if the yielded value is 3537 // meant to be awaited. 3538 exports.awrap = function(arg) { 3539 return { __await: arg }; 3540 }; 3541 3542 function AsyncIterator(generator) { 3543 function invoke(method, arg, resolve, reject) { 3544 var record = tryCatch(generator[method], generator, arg); 3545 if (record.type === "throw") { 3546 reject(record.arg); 3547 } else { 3548 var result = record.arg; 3549 var value = result.value; 3550 if (value && 3551 typeof value === "object" && 3552 hasOwn.call(value, "__await")) { 3553 return Promise.resolve(value.__await).then(function(value) { 3554 invoke("next", value, resolve, reject); 3555 }, function(err) { 3556 invoke("throw", err, resolve, reject); 3557 }); 3558 } 3559 3560 return Promise.resolve(value).then(function(unwrapped) { 3561 // When a yielded Promise is resolved, its final value becomes 3562 // the .value of the Promise<{value,done}> result for the 3563 // current iteration. 3564 result.value = unwrapped; 3565 resolve(result); 3566 }, function(error) { 3567 // If a rejected Promise was yielded, throw the rejection back 3568 // into the async generator function so it can be handled there. 3569 return invoke("throw", error, resolve, reject); 3570 }); 3571 } 3572 } 3573 3574 var previousPromise; 3575 3576 function enqueue(method, arg) { 3577 function callInvokeWithMethodAndArg() { 3578 return new Promise(function(resolve, reject) { 3579 invoke(method, arg, resolve, reject); 3580 }); 3581 } 3582 3583 return previousPromise = 3584 // If enqueue has been called before, then we want to wait until 3585 // all previous Promises have been resolved before calling invoke, 3586 // so that results are always delivered in the correct order. If 3587 // enqueue has not been called before, then it is important to 3588 // call invoke immediately, without waiting on a callback to fire, 3589 // so that the async generator function has the opportunity to do 3590 // any necessary setup in a predictable way. This predictability 3591 // is why the Promise constructor synchronously invokes its 3592 // executor callback, and why async functions synchronously 3593 // execute code before the first await. Since we implement simple 3594 // async functions in terms of async generators, it is especially 3595 // important to get this right, even though it requires care. 3596 previousPromise ? previousPromise.then( 3597 callInvokeWithMethodAndArg, 3598 // Avoid propagating failures to Promises returned by later 3599 // invocations of the iterator. 3600 callInvokeWithMethodAndArg 3601 ) : callInvokeWithMethodAndArg(); 3602 } 3603 3604 // Define the unified helper method that is used to implement .next, 3605 // .throw, and .return (see defineIteratorMethods). 3606 this._invoke = enqueue; 3607 } 3608 3609 defineIteratorMethods(AsyncIterator.prototype); 3610 AsyncIterator.prototype[asyncIteratorSymbol] = function () { 3611 return this; 3612 }; 3613 exports.AsyncIterator = AsyncIterator; 3614 3615 // Note that simple async functions are implemented on top of 3616 // AsyncIterator objects; they just return a Promise for the value of 3617 // the final result produced by the iterator. 3618 exports.async = function(innerFn, outerFn, self, tryLocsList) { 3619 var iter = new AsyncIterator( 3620 wrap(innerFn, outerFn, self, tryLocsList) 3621 ); 3622 3623 return exports.isGeneratorFunction(outerFn) 3624 ? iter // If outerFn is a generator, return the full iterator. 3625 : iter.next().then(function(result) { 3626 return result.done ? result.value : iter.next(); 3627 }); 3628 }; 3629 3630 function makeInvokeMethod(innerFn, self, context) { 3631 var state = GenStateSuspendedStart; 3632 3633 return function invoke(method, arg) { 3634 if (state === GenStateExecuting) { 3635 throw new Error("Generator is already running"); 3636 } 3637 3638 if (state === GenStateCompleted) { 3639 if (method === "throw") { 3640 throw arg; 3641 } 3642 3643 // Be forgiving, per 25.3.3.3.3 of the spec: 3644 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume 3645 return doneResult(); 3646 } 3647 3648 context.method = method; 3649 context.arg = arg; 3650 3651 while (true) { 3652 var delegate = context.delegate; 3653 if (delegate) { 3654 var delegateResult = maybeInvokeDelegate(delegate, context); 3655 if (delegateResult) { 3656 if (delegateResult === ContinueSentinel) continue; 3657 return delegateResult; 3658 } 3659 } 3660 3661 if (context.method === "next") { 3662 // Setting context._sent for legacy support of Babel's 3663 // function.sent implementation. 3664 context.sent = context._sent = context.arg; 3665 3666 } else if (context.method === "throw") { 3667 if (state === GenStateSuspendedStart) { 3668 state = GenStateCompleted; 3669 throw context.arg; 3670 } 3671 3672 context.dispatchException(context.arg); 3673 3674 } else if (context.method === "return") { 3675 context.abrupt("return", context.arg); 3676 } 3677 3678 state = GenStateExecuting; 3679 3680 var record = tryCatch(innerFn, self, context); 3681 if (record.type === "normal") { 3682 // If an exception is thrown from innerFn, we leave state === 3683 // GenStateExecuting and loop back for another invocation. 3684 state = context.done 3685 ? GenStateCompleted 3686 : GenStateSuspendedYield; 3687 3688 if (record.arg === ContinueSentinel) { 3689 continue; 3690 } 3691 3692 return { 3693 value: record.arg, 3694 done: context.done 3695 }; 3696 3697 } else if (record.type === "throw") { 3698 state = GenStateCompleted; 3699 // Dispatch the exception by looping back around to the 3700 // context.dispatchException(context.arg) call above. 3701 context.method = "throw"; 3702 context.arg = record.arg; 3703 } 3704 } 3705 }; 3706 } 3707 3708 // Call delegate.iterator[context.method](context.arg) and handle the 3709 // result, either by returning a { value, done } result from the 3710 // delegate iterator, or by modifying context.method and context.arg, 3711 // setting context.delegate to null, and returning the ContinueSentinel. 3712 function maybeInvokeDelegate(delegate, context) { 3713 var method = delegate.iterator[context.method]; 3714 if (method === undefined) { 3715 // A .throw or .return when the delegate iterator has no .throw 3716 // method always terminates the yield* loop. 3717 context.delegate = null; 3718 3719 if (context.method === "throw") { 3720 // Note: ["return"] must be used for ES3 parsing compatibility. 3721 if (delegate.iterator["return"]) { 3722 // If the delegate iterator has a return method, give it a 3723 // chance to clean up. 3724 context.method = "return"; 3725 context.arg = undefined; 3726 maybeInvokeDelegate(delegate, context); 3727 3728 if (context.method === "throw") { 3729 // If maybeInvokeDelegate(context) changed context.method from 3730 // "return" to "throw", let that override the TypeError below. 3731 return ContinueSentinel; 3732 } 3733 } 3734 3735 context.method = "throw"; 3736 context.arg = new TypeError( 3737 "The iterator does not provide a 'throw' method"); 3738 } 3739 3740 return ContinueSentinel; 3741 } 3742 3743 var record = tryCatch(method, delegate.iterator, context.arg); 3744 3745 if (record.type === "throw") { 3746 context.method = "throw"; 3747 context.arg = record.arg; 3748 context.delegate = null; 3749 return ContinueSentinel; 3750 } 3751 3752 var info = record.arg; 3753 3754 if (! info) { 3755 context.method = "throw"; 3756 context.arg = new TypeError("iterator result is not an object"); 3757 context.delegate = null; 3758 return ContinueSentinel; 3759 } 3760 3761 if (info.done) { 3762 // Assign the result of the finished delegate to the temporary 3763 // variable specified by delegate.resultName (see delegateYield). 3764 context[delegate.resultName] = info.value; 3765 3766 // Resume execution at the desired location (see delegateYield). 3767 context.next = delegate.nextLoc; 3768 3769 // If context.method was "throw" but the delegate handled the 3770 // exception, let the outer generator proceed normally. If 3771 // context.method was "next", forget context.arg since it has been 3772 // "consumed" by the delegate iterator. If context.method was 3773 // "return", allow the original .return call to continue in the 3774 // outer generator. 3775 if (context.method !== "return") { 3776 context.method = "next"; 3777 context.arg = undefined; 3778 } 3779 3780 } else { 3781 // Re-yield the result returned by the delegate method. 3782 return info; 3783 } 3784 3785 // The delegate iterator is finished, so forget it and continue with 3786 // the outer generator. 3787 context.delegate = null; 3788 return ContinueSentinel; 3789 } 3790 3791 // Define Generator.prototype.{next,throw,return} in terms of the 3792 // unified ._invoke helper method. 3793 defineIteratorMethods(Gp); 3794 3795 Gp[toStringTagSymbol] = "Generator"; 3796 3797 // A Generator should always return itself as the iterator object when the 3798 // @@iterator function is called on it. Some browsers' implementations of the 3799 // iterator prototype chain incorrectly implement this, causing the Generator 3800 // object to not be returned from this call. This ensures that doesn't happen. 3801 // See https://github.com/facebook/regenerator/issues/274 for more details. 3802 Gp[iteratorSymbol] = function() { 3803 return this; 3804 }; 3805 3806 Gp.toString = function() { 3807 return "[object Generator]"; 3808 }; 3809 3810 function pushTryEntry(locs) { 3811 var entry = { tryLoc: locs[0] }; 3812 3813 if (1 in locs) { 3814 entry.catchLoc = locs[1]; 3815 } 3816 3817 if (2 in locs) { 3818 entry.finallyLoc = locs[2]; 3819 entry.afterLoc = locs[3]; 3820 } 3821 3822 this.tryEntries.push(entry); 3823 } 3824 3825 function resetTryEntry(entry) { 3826 var record = entry.completion || {}; 3827 record.type = "normal"; 3828 delete record.arg; 3829 entry.completion = record; 3830 } 3831 3832 function Context(tryLocsList) { 3833 // The root entry object (effectively a try statement without a catch 3834 // or a finally block) gives us a place to store values thrown from 3835 // locations where there is no enclosing try statement. 3836 this.tryEntries = [{ tryLoc: "root" }]; 3837 tryLocsList.forEach(pushTryEntry, this); 3838 this.reset(true); 3839 } 3840 3841 exports.keys = function(object) { 3842 var keys = []; 3843 for (var key in object) { 3844 keys.push(key); 3845 } 3846 keys.reverse(); 3847 3848 // Rather than returning an object with a next method, we keep 3849 // things simple and return the next function itself. 3850 return function next() { 3851 while (keys.length) { 3852 var key = keys.pop(); 3853 if (key in object) { 3854 next.value = key; 3855 next.done = false; 3856 return next; 3857 } 3858 } 3859 3860 // To avoid creating an additional object, we just hang the .value 3861 // and .done properties off the next function object itself. This 3862 // also ensures that the minifier will not anonymize the function. 3863 next.done = true; 3864 return next; 3865 }; 3866 }; 3867 3868 function values(iterable) { 3869 if (iterable) { 3870 var iteratorMethod = iterable[iteratorSymbol]; 3871 if (iteratorMethod) { 3872 return iteratorMethod.call(iterable); 3873 } 3874 3875 if (typeof iterable.next === "function") { 3876 return iterable; 3877 } 3878 3879 if (!isNaN(iterable.length)) { 3880 var i = -1, next = function next() { 3881 while (++i < iterable.length) { 3882 if (hasOwn.call(iterable, i)) { 3883 next.value = iterable[i]; 3884 next.done = false; 3885 return next; 3886 } 3887 } 3888 3889 next.value = undefined; 3890 next.done = true; 3891 3892 return next; 3893 }; 3894 3895 return next.next = next; 3896 } 3897 } 3898 3899 // Return an iterator with no values. 3900 return { next: doneResult }; 3901 } 3902 exports.values = values; 3903 3904 function doneResult() { 3905 return { value: undefined, done: true }; 3906 } 3907 3908 Context.prototype = { 3909 constructor: Context, 3910 3911 reset: function(skipTempReset) { 3912 this.prev = 0; 3913 this.next = 0; 3914 // Resetting context._sent for legacy support of Babel's 3915 // function.sent implementation. 3916 this.sent = this._sent = undefined; 3917 this.done = false; 3918 this.delegate = null; 3919 3920 this.method = "next"; 3921 this.arg = undefined; 3922 3923 this.tryEntries.forEach(resetTryEntry); 3924 3925 if (!skipTempReset) { 3926 for (var name in this) { 3927 // Not sure about the optimal order of these conditions: 3928 if (name.charAt(0) === "t" && 3929 hasOwn.call(this, name) && 3930 !isNaN(+name.slice(1))) { 3931 this[name] = undefined; 3932 } 3933 } 3934 } 3935 }, 3936 3937 stop: function() { 3938 this.done = true; 3939 3940 var rootEntry = this.tryEntries[0]; 3941 var rootRecord = rootEntry.completion; 3942 if (rootRecord.type === "throw") { 3943 throw rootRecord.arg; 3944 } 3945 3946 return this.rval; 3947 }, 3948 3949 dispatchException: function(exception) { 3950 if (this.done) { 3951 throw exception; 3952 } 3953 3954 var context = this; 3955 function handle(loc, caught) { 3956 record.type = "throw"; 3957 record.arg = exception; 3958 context.next = loc; 3959 3960 if (caught) { 3961 // If the dispatched exception was caught by a catch block, 3962 // then let that catch block handle the exception normally. 3963 context.method = "next"; 3964 context.arg = undefined; 3965 } 3966 3967 return !! caught; 3968 } 3969 3970 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 3971 var entry = this.tryEntries[i]; 3972 var record = entry.completion; 3973 3974 if (entry.tryLoc === "root") { 3975 // Exception thrown outside of any try block that could handle 3976 // it, so set the completion value of the entire function to 3977 // throw the exception. 3978 return handle("end"); 3979 } 3980 3981 if (entry.tryLoc <= this.prev) { 3982 var hasCatch = hasOwn.call(entry, "catchLoc"); 3983 var hasFinally = hasOwn.call(entry, "finallyLoc"); 3984 3985 if (hasCatch && hasFinally) { 3986 if (this.prev < entry.catchLoc) { 3987 return handle(entry.catchLoc, true); 3988 } else if (this.prev < entry.finallyLoc) { 3989 return handle(entry.finallyLoc); 3990 } 3991 3992 } else if (hasCatch) { 3993 if (this.prev < entry.catchLoc) { 3994 return handle(entry.catchLoc, true); 3995 } 3996 3997 } else if (hasFinally) { 3998 if (this.prev < entry.finallyLoc) { 3999 return handle(entry.finallyLoc); 4000 } 4001 4002 } else { 4003 throw new Error("try statement without catch or finally"); 4004 } 4005 } 4006 } 4007 }, 4008 4009 abrupt: function(type, arg) { 4010 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 4011 var entry = this.tryEntries[i]; 4012 if (entry.tryLoc <= this.prev && 4013 hasOwn.call(entry, "finallyLoc") && 4014 this.prev < entry.finallyLoc) { 4015 var finallyEntry = entry; 4016 break; 4017 } 4018 } 4019 4020 if (finallyEntry && 4021 (type === "break" || 4022 type === "continue") && 4023 finallyEntry.tryLoc <= arg && 4024 arg <= finallyEntry.finallyLoc) { 4025 // Ignore the finally entry if control is not jumping to a 4026 // location outside the try/catch block. 4027 finallyEntry = null; 4028 } 4029 4030 var record = finallyEntry ? finallyEntry.completion : {}; 4031 record.type = type; 4032 record.arg = arg; 4033 4034 if (finallyEntry) { 4035 this.method = "next"; 4036 this.next = finallyEntry.finallyLoc; 4037 return ContinueSentinel; 4038 } 4039 4040 return this.complete(record); 4041 }, 4042 4043 complete: function(record, afterLoc) { 4044 if (record.type === "throw") { 4045 throw record.arg; 4046 } 4047 4048 if (record.type === "break" || 4049 record.type === "continue") { 4050 this.next = record.arg; 4051 } else if (record.type === "return") { 4052 this.rval = this.arg = record.arg; 4053 this.method = "return"; 4054 this.next = "end"; 4055 } else if (record.type === "normal" && afterLoc) { 4056 this.next = afterLoc; 4057 } 4058 4059 return ContinueSentinel; 4060 }, 4061 4062 finish: function(finallyLoc) { 4063 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 4064 var entry = this.tryEntries[i]; 4065 if (entry.finallyLoc === finallyLoc) { 4066 this.complete(entry.completion, entry.afterLoc); 4067 resetTryEntry(entry); 4068 return ContinueSentinel; 4069 } 4070 } 4071 }, 4072 4073 "catch": function(tryLoc) { 4074 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 4075 var entry = this.tryEntries[i]; 4076 if (entry.tryLoc === tryLoc) { 4077 var record = entry.completion; 4078 if (record.type === "throw") { 4079 var thrown = record.arg; 4080 resetTryEntry(entry); 4081 } 4082 return thrown; 4083 } 4084 } 4085 4086 // The context.catch method must only be called with a location 4087 // argument that corresponds to a known catch block. 4088 throw new Error("illegal catch attempt"); 4089 }, 4090 4091 delegateYield: function(iterable, resultName, nextLoc) { 4092 this.delegate = { 4093 iterator: values(iterable), 4094 resultName: resultName, 4095 nextLoc: nextLoc 4096 }; 4097 4098 if (this.method === "next") { 4099 // Deliberately forget the last sent value so that we don't 4100 // accidentally pass it on to the delegate. 4101 this.arg = undefined; 4102 } 4103 4104 return ContinueSentinel; 4105 } 4106 }; 4107 4108 // Regardless of whether this script is executing as a CommonJS module 4109 // or not, return the runtime object so that we can declare the variable 4110 // regeneratorRuntime in the outer scope, which allows this module to be 4111 // injected easily by `bin/regenerator --include-runtime script.js`. 4112 return exports; 4113 4114 }( 4115 // If this script is executing as a CommonJS module, use module.exports 4116 // as the regeneratorRuntime namespace. Otherwise create a new empty 4117 // object. Either way, the resulting object will be used to initialize 4118 // the regeneratorRuntime variable at the top of this file. 4119 true ? module.exports : undefined 4120 )); 4121 4122 try { 4123 regeneratorRuntime = runtime; 4124 } catch (accidentalStrictMode) { 4125 // This module should not be running in strict mode, so the above 4126 // assignment should always work unless something is misconfigured. Just 4127 // in case runtime.js accidentally runs in strict mode, we can escape 4128 // strict mode using a global Function call. This could conceivably fail 4129 // if a Content Security Policy forbids using Function, but in that case 4130 // the proper solution is to fix the accidental strict mode problem. If 4131 // you've misconfigured your bundler to force strict mode and applied a 4132 // CSP to forbid Function, and you're not willing to fix either of those 4133 // problems, please detail your unique predicament in a GitHub issue. 4134 Function("r", "regeneratorRuntime = r")(runtime); 4135 } 4136 4137 4138 /***/ }), 4139 4140 /***/ 65: 4141 /***/ (function(module, exports) { 4142 4143 var g; 4144 4145 // This works in non-strict mode 4146 g = (function() { 4147 return this; 4148 })(); 4149 4150 try { 4151 // This works if eval is allowed (see CSP) 4152 g = g || new Function("return this")(); 4153 } catch (e) { 4154 // This works if the window reference is available 4155 if (typeof window === "object") g = window; 4156 } 4157 4158 // g can still be undefined, but nothing to do about it... 4159 // We return undefined, instead of nothing here, so it's 4160 // easier to handle this case. if(!global) { ...} 4161 4162 module.exports = g; 4163 4164 4165 /***/ }), 4166 4167 /***/ 7: 4168 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4169 4170 "use strict"; 4171 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); 4172 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10); 4173 4174 function _objectSpread(target) { 4175 for (var i = 1; i < arguments.length; i++) { 4176 var source = arguments[i] != null ? arguments[i] : {}; 4177 var ownKeys = Object.keys(source); 4178 4179 if (typeof Object.getOwnPropertySymbols === 'function') { 4180 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 4181 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 4182 })); 4183 } 4184 4185 ownKeys.forEach(function (key) { 4186 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); 4187 }); 4188 } 4189 4190 return target; 4191 } 4192 4193 /***/ }), 4194 4195 /***/ 74: 4196 /***/ (function(module, exports, __webpack_require__) { 4197 4198 "use strict"; 4199 4200 4201 function _typeof(obj) { 4202 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 4203 _typeof = function (obj) { 4204 return typeof obj; 4205 }; 4206 } else { 4207 _typeof = function (obj) { 4208 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 4209 }; 4210 } 4211 4212 return _typeof(obj); 4213 } 4214 4215 function _classCallCheck(instance, Constructor) { 4216 if (!(instance instanceof Constructor)) { 4217 throw new TypeError("Cannot call a class as a function"); 4218 } 4219 } 4220 4221 function _defineProperties(target, props) { 4222 for (var i = 0; i < props.length; i++) { 4223 var descriptor = props[i]; 4224 descriptor.enumerable = descriptor.enumerable || false; 4225 descriptor.configurable = true; 4226 if ("value" in descriptor) descriptor.writable = true; 4227 Object.defineProperty(target, descriptor.key, descriptor); 4228 } 4229 } 4230 4231 function _createClass(Constructor, protoProps, staticProps) { 4232 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 4233 if (staticProps) _defineProperties(Constructor, staticProps); 4234 return Constructor; 4235 } 4236 4237 /** 4238 * Given an instance of EquivalentKeyMap, returns its internal value pair tuple 4239 * for a key, if one exists. The tuple members consist of the last reference 4240 * value for the key (used in efficient subsequent lookups) and the value 4241 * assigned for the key at the leaf node. 4242 * 4243 * @param {EquivalentKeyMap} instance EquivalentKeyMap instance. 4244 * @param {*} key The key for which to return value pair. 4245 * 4246 * @return {?Array} Value pair, if exists. 4247 */ 4248 function getValuePair(instance, key) { 4249 var _map = instance._map, 4250 _arrayTreeMap = instance._arrayTreeMap, 4251 _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the 4252 // value, which can be used to shortcut immediately to the value. 4253 4254 if (_map.has(key)) { 4255 return _map.get(key); 4256 } // Sort keys to ensure stable retrieval from tree. 4257 4258 4259 var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value. 4260 4261 var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap; 4262 4263 for (var i = 0; i < properties.length; i++) { 4264 var property = properties[i]; 4265 map = map.get(property); 4266 4267 if (map === undefined) { 4268 return; 4269 } 4270 4271 var propertyValue = key[property]; 4272 map = map.get(propertyValue); 4273 4274 if (map === undefined) { 4275 return; 4276 } 4277 } 4278 4279 var valuePair = map.get('_ekm_value'); 4280 4281 if (!valuePair) { 4282 return; 4283 } // If reached, it implies that an object-like key was set with another 4284 // reference, so delete the reference and replace with the current. 4285 4286 4287 _map.delete(valuePair[0]); 4288 4289 valuePair[0] = key; 4290 map.set('_ekm_value', valuePair); 4291 4292 _map.set(key, valuePair); 4293 4294 return valuePair; 4295 } 4296 /** 4297 * Variant of a Map object which enables lookup by equivalent (deeply equal) 4298 * object and array keys. 4299 */ 4300 4301 4302 var EquivalentKeyMap = 4303 /*#__PURE__*/ 4304 function () { 4305 /** 4306 * Constructs a new instance of EquivalentKeyMap. 4307 * 4308 * @param {Iterable.<*>} iterable Initial pair of key, value for map. 4309 */ 4310 function EquivalentKeyMap(iterable) { 4311 _classCallCheck(this, EquivalentKeyMap); 4312 4313 this.clear(); 4314 4315 if (iterable instanceof EquivalentKeyMap) { 4316 // Map#forEach is only means of iterating with support for IE11. 4317 var iterablePairs = []; 4318 iterable.forEach(function (value, key) { 4319 iterablePairs.push([key, value]); 4320 }); 4321 iterable = iterablePairs; 4322 } 4323 4324 if (iterable != null) { 4325 for (var i = 0; i < iterable.length; i++) { 4326 this.set(iterable[i][0], iterable[i][1]); 4327 } 4328 } 4329 } 4330 /** 4331 * Accessor property returning the number of elements. 4332 * 4333 * @return {number} Number of elements. 4334 */ 4335 4336 4337 _createClass(EquivalentKeyMap, [{ 4338 key: "set", 4339 4340 /** 4341 * Add or update an element with a specified key and value. 4342 * 4343 * @param {*} key The key of the element to add. 4344 * @param {*} value The value of the element to add. 4345 * 4346 * @return {EquivalentKeyMap} Map instance. 4347 */ 4348 value: function set(key, value) { 4349 // Shortcut non-object-like to set on internal Map. 4350 if (key === null || _typeof(key) !== 'object') { 4351 this._map.set(key, value); 4352 4353 return this; 4354 } // Sort keys to ensure stable assignment into tree. 4355 4356 4357 var properties = Object.keys(key).sort(); 4358 var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value. 4359 4360 var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap; 4361 4362 for (var i = 0; i < properties.length; i++) { 4363 var property = properties[i]; 4364 4365 if (!map.has(property)) { 4366 map.set(property, new EquivalentKeyMap()); 4367 } 4368 4369 map = map.get(property); 4370 var propertyValue = key[property]; 4371 4372 if (!map.has(propertyValue)) { 4373 map.set(propertyValue, new EquivalentKeyMap()); 4374 } 4375 4376 map = map.get(propertyValue); 4377 } // If an _ekm_value exists, there was already an equivalent key. Before 4378 // overriding, ensure that the old key reference is removed from map to 4379 // avoid memory leak of accumulating equivalent keys. This is, in a 4380 // sense, a poor man's WeakMap, while still enabling iterability. 4381 4382 4383 var previousValuePair = map.get('_ekm_value'); 4384 4385 if (previousValuePair) { 4386 this._map.delete(previousValuePair[0]); 4387 } 4388 4389 map.set('_ekm_value', valuePair); 4390 4391 this._map.set(key, valuePair); 4392 4393 return this; 4394 } 4395 /** 4396 * Returns a specified element. 4397 * 4398 * @param {*} key The key of the element to return. 4399 * 4400 * @return {?*} The element associated with the specified key or undefined 4401 * if the key can't be found. 4402 */ 4403 4404 }, { 4405 key: "get", 4406 value: function get(key) { 4407 // Shortcut non-object-like to get from internal Map. 4408 if (key === null || _typeof(key) !== 'object') { 4409 return this._map.get(key); 4410 } 4411 4412 var valuePair = getValuePair(this, key); 4413 4414 if (valuePair) { 4415 return valuePair[1]; 4416 } 4417 } 4418 /** 4419 * Returns a boolean indicating whether an element with the specified key 4420 * exists or not. 4421 * 4422 * @param {*} key The key of the element to test for presence. 4423 * 4424 * @return {boolean} Whether an element with the specified key exists. 4425 */ 4426 4427 }, { 4428 key: "has", 4429 value: function has(key) { 4430 if (key === null || _typeof(key) !== 'object') { 4431 return this._map.has(key); 4432 } // Test on the _presence_ of the pair, not its value, as even undefined 4433 // can be a valid member value for a key. 4434 4435 4436 return getValuePair(this, key) !== undefined; 4437 } 4438 /** 4439 * Removes the specified element. 4440 * 4441 * @param {*} key The key of the element to remove. 4442 * 4443 * @return {boolean} Returns true if an element existed and has been 4444 * removed, or false if the element does not exist. 4445 */ 4446 4447 }, { 4448 key: "delete", 4449 value: function _delete(key) { 4450 if (!this.has(key)) { 4451 return false; 4452 } // This naive implementation will leave orphaned child trees. A better 4453 // implementation should traverse and remove orphans. 4454 4455 4456 this.set(key, undefined); 4457 return true; 4458 } 4459 /** 4460 * Executes a provided function once per each key/value pair, in insertion 4461 * order. 4462 * 4463 * @param {Function} callback Function to execute for each element. 4464 * @param {*} thisArg Value to use as `this` when executing 4465 * `callback`. 4466 */ 4467 4468 }, { 4469 key: "forEach", 4470 value: function forEach(callback) { 4471 var _this = this; 4472 4473 var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this; 4474 4475 this._map.forEach(function (value, key) { 4476 // Unwrap value from object-like value pair. 4477 if (key !== null && _typeof(key) === 'object') { 4478 value = value[1]; 4479 } 4480 4481 callback.call(thisArg, value, key, _this); 4482 }); 4483 } 4484 /** 4485 * Removes all elements. 4486 */ 4487 4488 }, { 4489 key: "clear", 4490 value: function clear() { 4491 this._map = new Map(); 4492 this._arrayTreeMap = new Map(); 4493 this._objectTreeMap = new Map(); 4494 } 4495 }, { 4496 key: "size", 4497 get: function get() { 4498 return this._map.size; 4499 } 4500 }]); 4501 4502 return EquivalentKeyMap; 4503 }(); 4504 4505 module.exports = EquivalentKeyMap; 4506 4507 4508 /***/ }), 4509 4510 /***/ 8: 4511 /***/ (function(module, exports) { 4512 4513 (function() { module.exports = this["wp"]["compose"]; }()); 4514 4515 /***/ }), 4516 4517 /***/ 98: 4518 /***/ (function(module, exports) { 4519 4520 module.exports = isPromise; 4521 4522 function isPromise(obj) { 4523 return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; 4524 } 4525 4526 4527 /***/ }) 4528 4529 /******/ });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Nov 23 20:47:33 2019 | Cross-referenced by PHPXref 0.7 |