2018-12-13 23:41:57 -05:00
this [ "wp" ] = this [ "wp" ] || { } ; this [ "wp" ] [ "data" ] =
/******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/
/******/ // Load entry module and return exports
2020-07-07 12:08:28 -04:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 438 ) ;
2018-12-13 23:41:57 -05:00
/******/ } )
/************************************************************************/
/******/ ( {
2018-12-17 22:14:52 -05:00
/***/ 0 :
/***/ ( function ( module , exports ) {
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
( function ( ) { module . exports = this [ "wp" ] [ "element" ] ; } ( ) ) ;
2018-12-13 23:41:57 -05:00
/***/ } ) ,
2020-07-07 10:43:35 -04:00
/***/ 120 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2020-02-06 16:03:31 -05:00
"use strict" ;
2020-06-26 09:33:47 -04:00
function _typeof ( obj ) {
if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) {
_typeof = function ( obj ) {
return typeof obj ;
} ;
} else {
_typeof = function ( obj ) {
return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ;
} ;
}
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
return _typeof ( obj ) ;
2020-02-06 16:03:31 -05:00
}
2020-06-26 09:33:47 -04:00
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) {
throw new TypeError ( "Cannot call a class as a function" ) ;
}
}
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
function _defineProperties ( target , props ) {
for ( var i = 0 ; i < props . length ; i ++ ) {
var descriptor = props [ i ] ;
descriptor . enumerable = descriptor . enumerable || false ;
descriptor . configurable = true ;
if ( "value" in descriptor ) descriptor . writable = true ;
Object . defineProperty ( target , descriptor . key , descriptor ) ;
}
2020-02-06 16:03:31 -05:00
}
2020-06-26 09:33:47 -04:00
function _createClass ( Constructor , protoProps , staticProps ) {
if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ;
if ( staticProps ) _defineProperties ( Constructor , staticProps ) ;
return Constructor ;
}
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
/ * *
* Given an instance of EquivalentKeyMap , returns its internal value pair tuple
* for a key , if one exists . The tuple members consist of the last reference
* value for the key ( used in efficient subsequent lookups ) and the value
* assigned for the key at the leaf node .
*
* @ param { EquivalentKeyMap } instance EquivalentKeyMap instance .
* @ param { * } key The key for which to return value pair .
*
* @ return { ? Array } Value pair , if exists .
* /
function getValuePair ( instance , key ) {
var _map = instance . _map ,
_arrayTreeMap = instance . _arrayTreeMap ,
_objectTreeMap = instance . _objectTreeMap ; // Map keeps a reference to the last object-like key used to set the
// value, which can be used to shortcut immediately to the value.
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
if ( _map . has ( key ) ) {
return _map . get ( key ) ;
} // Sort keys to ensure stable retrieval from tree.
2019-03-21 08:48:00 -04:00
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
var properties = Object . keys ( key ) . sort ( ) ; // Tree by type to avoid conflicts on numeric object keys, empty value.
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
var map = Array . isArray ( key ) ? _arrayTreeMap : _objectTreeMap ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
for ( var i = 0 ; i < properties . length ; i ++ ) {
var property = properties [ i ] ;
map = map . get ( property ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
if ( map === undefined ) {
return ;
}
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
var propertyValue = key [ property ] ;
map = map . get ( propertyValue ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
if ( map === undefined ) {
return ;
}
}
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
var valuePair = map . get ( '_ekm_value' ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
if ( ! valuePair ) {
return ;
} // If reached, it implies that an object-like key was set with another
// reference, so delete the reference and replace with the current.
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
_map . delete ( valuePair [ 0 ] ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
valuePair [ 0 ] = key ;
map . set ( '_ekm_value' , valuePair ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
_map . set ( key , valuePair ) ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
return valuePair ;
}
/ * *
* Variant of a Map object which enables lookup by equivalent ( deeply equal )
* object and array keys .
* /
2020-01-08 06:57:23 -05:00
2020-06-26 09:33:47 -04:00
var EquivalentKeyMap =
/*#__PURE__*/
function ( ) {
/ * *
* Constructs a new instance of EquivalentKeyMap .
*
* @ param { Iterable . < * > } iterable Initial pair of key , value for map .
* /
function EquivalentKeyMap ( iterable ) {
_classCallCheck ( this , EquivalentKeyMap ) ;
2020-03-23 19:40:19 -04:00
2020-06-26 09:33:47 -04:00
this . clear ( ) ;
2020-01-08 06:57:23 -05:00
2020-06-26 09:33:47 -04:00
if ( iterable instanceof EquivalentKeyMap ) {
// Map#forEach is only means of iterating with support for IE11.
var iterablePairs = [ ] ;
iterable . forEach ( function ( value , key ) {
iterablePairs . push ( [ key , value ] ) ;
} ) ;
iterable = iterablePairs ;
}
2020-03-23 19:40:19 -04:00
2020-06-26 09:33:47 -04:00
if ( iterable != null ) {
for ( var i = 0 ; i < iterable . length ; i ++ ) {
this . set ( iterable [ i ] [ 0 ] , iterable [ i ] [ 1 ] ) ;
}
}
}
/ * *
* Accessor property returning the number of elements .
*
* @ return { number } Number of elements .
* /
2020-01-08 06:57:23 -05:00
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
_createClass ( EquivalentKeyMap , [ {
key : "set" ,
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
/ * *
* Add or update an element with a specified key and value .
*
* @ param { * } key The key of the element to add .
* @ param { * } value The value of the element to add .
*
* @ return { EquivalentKeyMap } Map instance .
* /
value : function set ( key , value ) {
// Shortcut non-object-like to set on internal Map.
if ( key === null || _typeof ( key ) !== 'object' ) {
this . _map . set ( key , value ) ;
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
return this ;
} // Sort keys to ensure stable assignment into tree.
2020-03-23 19:40:19 -04:00
2020-01-08 06:57:23 -05:00
2020-06-26 09:33:47 -04:00
var properties = Object . keys ( key ) . sort ( ) ;
var valuePair = [ key , value ] ; // Tree by type to avoid conflicts on numeric object keys, empty value.
2020-01-08 06:57:23 -05:00
2020-06-26 09:33:47 -04:00
var map = Array . isArray ( key ) ? this . _arrayTreeMap : this . _objectTreeMap ;
2018-12-14 06:02:53 -05:00
2020-06-26 09:33:47 -04:00
for ( var i = 0 ; i < properties . length ; i ++ ) {
var property = properties [ i ] ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
if ( ! map . has ( property ) ) {
map . set ( property , new EquivalentKeyMap ( ) ) ;
}
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
map = map . get ( property ) ;
var propertyValue = key [ property ] ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
if ( ! map . has ( propertyValue ) ) {
map . set ( propertyValue , new EquivalentKeyMap ( ) ) ;
}
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
map = map . get ( propertyValue ) ;
} // If an _ekm_value exists, there was already an equivalent key. Before
// overriding, ensure that the old key reference is removed from map to
// avoid memory leak of accumulating equivalent keys. This is, in a
// sense, a poor man's WeakMap, while still enabling iterability.
2019-09-19 11:19:18 -04:00
2018-12-14 06:02:53 -05:00
2020-06-26 09:33:47 -04:00
var previousValuePair = map . get ( '_ekm_value' ) ;
2018-12-14 06:02:53 -05:00
2020-06-26 09:33:47 -04:00
if ( previousValuePair ) {
this . _map . delete ( previousValuePair [ 0 ] ) ;
}
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
map . set ( '_ekm_value' , valuePair ) ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
this . _map . set ( key , valuePair ) ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
return this ;
}
/ * *
* Returns a specified element .
*
* @ param { * } key The key of the element to return .
*
* @ return { ? * } The element associated with the specified key or undefined
* if the key can ' t be found .
* /
} , {
key : "get" ,
value : function get ( key ) {
// Shortcut non-object-like to get from internal Map.
if ( key === null || _typeof ( key ) !== 'object' ) {
return this . _map . get ( key ) ;
}
var valuePair = getValuePair ( this , key ) ;
if ( valuePair ) {
return valuePair [ 1 ] ;
}
}
/ * *
* Returns a boolean indicating whether an element with the specified key
* exists or not .
*
* @ param { * } key The key of the element to test for presence .
*
* @ return { boolean } Whether an element with the specified key exists .
* /
} , {
key : "has" ,
value : function has ( key ) {
if ( key === null || _typeof ( key ) !== 'object' ) {
return this . _map . has ( key ) ;
} // Test on the _presence_ of the pair, not its value, as even undefined
// can be a valid member value for a key.
return getValuePair ( this , key ) !== undefined ;
}
/ * *
* Removes the specified element .
*
* @ param { * } key The key of the element to remove .
*
* @ return { boolean } Returns true if an element existed and has been
* removed , or false if the element does not exist .
* /
} , {
key : "delete" ,
value : function _delete ( key ) {
if ( ! this . has ( key ) ) {
return false ;
} // This naive implementation will leave orphaned child trees. A better
// implementation should traverse and remove orphans.
this . set ( key , undefined ) ;
return true ;
}
/ * *
* Executes a provided function once per each key / value pair , in insertion
* order .
*
* @ param { Function } callback Function to execute for each element .
* @ param { * } thisArg Value to use as ` this ` when executing
* ` callback ` .
* /
} , {
key : "forEach" ,
value : function forEach ( callback ) {
var _this = this ;
var thisArg = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : this ;
this . _map . forEach ( function ( value , key ) {
// Unwrap value from object-like value pair.
if ( key !== null && _typeof ( key ) === 'object' ) {
value = value [ 1 ] ;
}
callback . call ( thisArg , value , key , _this ) ;
} ) ;
}
/ * *
* Removes all elements .
* /
} , {
key : "clear" ,
value : function clear ( ) {
this . _map = new Map ( ) ;
this . _arrayTreeMap = new Map ( ) ;
this . _objectTreeMap = new Map ( ) ;
}
} , {
key : "size" ,
get : function get ( ) {
return this . _map . size ;
}
} ] ) ;
return EquivalentKeyMap ;
} ( ) ;
module . exports = EquivalentKeyMap ;
/***/ } ) ,
2020-07-07 10:43:35 -04:00
/***/ 121 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , exports ) {
var g ;
// This works in non-strict mode
g = ( function ( ) {
return this ;
} ) ( ) ;
try {
// This works if eval is allowed (see CSP)
g = g || new Function ( "return this" ) ( ) ;
} catch ( e ) {
// This works if the window reference is available
if ( typeof window === "object" ) g = window ;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module . exports = g ;
/***/ } ) ,
2020-07-07 10:43:35 -04:00
/***/ 13 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 07:50:29 -04:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return /* binding */ _slicedToArray ; } ) ;
2020-01-08 06:57:23 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
2020-03-23 19:40:19 -04:00
var arrayWithHoles = _ _webpack _require _ _ ( 38 ) ;
2019-09-19 11:19:18 -04:00
2020-01-08 06:57:23 -05:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit ( arr , i ) {
2020-03-23 19:40:19 -04:00
if ( typeof Symbol === "undefined" || ! ( Symbol . iterator in Object ( arr ) ) ) return ;
2020-01-08 06:57:23 -05:00
var _arr = [ ] ;
var _n = true ;
var _d = false ;
var _e = undefined ;
2019-03-07 04:09:59 -05:00
2020-01-08 06:57:23 -05:00
try {
for ( var _i = arr [ Symbol . iterator ] ( ) , _s ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) {
_arr . push ( _s . value ) ;
2019-03-07 04:09:59 -05:00
2020-01-08 06:57:23 -05:00
if ( i && _arr . length === i ) break ;
}
} catch ( err ) {
_d = true ;
_e = err ;
} finally {
try {
if ( ! _n && _i [ "return" ] != null ) _i [ "return" ] ( ) ;
} finally {
if ( _d ) throw _e ;
}
}
2019-03-07 04:09:59 -05:00
2020-01-08 06:57:23 -05:00
return _arr ;
}
2020-03-23 19:40:19 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
2020-07-07 10:43:35 -04:00
var unsupportedIterableToArray = _ _webpack _require _ _ ( 29 ) ;
2020-03-23 19:40:19 -04:00
2020-01-08 06:57:23 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
2020-03-23 19:40:19 -04:00
var nonIterableRest = _ _webpack _require _ _ ( 39 ) ;
2019-03-07 04:09:59 -05:00
2020-01-08 06:57:23 -05:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
2019-03-07 04:09:59 -05:00
2019-10-15 11:37:08 -04:00
2020-01-08 06:57:23 -05:00
2020-03-23 19:40:19 -04:00
2020-01-08 06:57:23 -05:00
function _slicedToArray ( arr , i ) {
2020-03-23 19:40:19 -04:00
return Object ( arrayWithHoles [ "a" /* default */ ] ) ( arr ) || _iterableToArrayLimit ( arr , i ) || Object ( unsupportedIterableToArray [ "a" /* default */ ] ) ( arr , i ) || Object ( nonIterableRest [ "a" /* default */ ] ) ( ) ;
2020-01-08 06:57:23 -05:00
}
2019-10-15 11:37:08 -04:00
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 143 :
2020-07-07 10:43:35 -04:00
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "priorityQueue" ] ; } ( ) ) ;
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 157 :
2020-03-16 18:07:16 -04:00
/***/ ( function ( module , exports ) {
2020-06-26 09:33:47 -04:00
function combineReducers ( reducers ) {
var keys = Object . keys ( reducers ) ,
getNextState ;
2020-03-16 18:07:16 -04:00
2020-06-26 09:33:47 -04:00
getNextState = ( function ( ) {
var fn , i , key ;
2020-03-16 18:07:16 -04:00
2020-06-26 09:33:47 -04:00
fn = 'return {' ;
for ( i = 0 ; i < keys . length ; i ++ ) {
// Rely on Quoted escaping of JSON.stringify with guarantee that
// each member of Object.keys is a string.
//
// "If Type(value) is String, then return the result of calling the
// abstract operation Quote with argument value. [...] The abstract
// operation Quote(value) wraps a String value in double quotes and
// escapes characters within it."
//
// https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3
key = JSON . stringify ( keys [ i ] ) ;
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
fn += key + ':r[' + key + '](s[' + key + '],a),' ;
}
fn += '}' ;
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
return new Function ( 'r,s,a' , fn ) ;
} ) ( ) ;
2020-02-06 16:03:31 -05:00
2020-06-26 09:33:47 -04:00
return function combinedReducer ( state , action ) {
var nextState , i , key ;
2020-03-23 19:40:19 -04:00
2020-06-26 09:33:47 -04:00
// Assumed changed if initial state.
if ( state === undefined ) {
return getNextState ( reducers , { } , action ) ;
}
2020-03-23 19:40:19 -04:00
2020-06-26 09:33:47 -04:00
nextState = getNextState ( reducers , state , action ) ;
2020-03-23 19:40:19 -04:00
2020-06-26 09:33:47 -04:00
// Determine whether state has changed.
i = keys . length ;
while ( i -- ) {
key = keys [ i ] ;
if ( state [ key ] !== nextState [ key ] ) {
// Return immediately if a changed value is encountered.
return nextState ;
}
}
return state ;
} ;
2020-03-23 19:40:19 -04:00
}
2020-06-26 09:33:47 -04:00
module . exports = combineReducers ;
2020-03-23 19:40:19 -04:00
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 16 :
2020-07-07 10:43:35 -04:00
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "React" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 17 :
2020-03-23 19:40:19 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 07:50:29 -04:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return /* binding */ _toConsumableArray ; } ) ;
2020-06-26 09:33:47 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
var arrayLikeToArray = _ _webpack _require _ _ ( 26 ) ;
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles ( arr ) {
if ( Array . isArray ( arr ) ) return Object ( arrayLikeToArray [ "a" /* default */ ] ) ( arr ) ;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
var iterableToArray = _ _webpack _require _ _ ( 35 ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
2020-07-07 10:43:35 -04:00
var unsupportedIterableToArray = _ _webpack _require _ _ ( 29 ) ;
2020-06-26 09:33:47 -04:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread ( ) {
throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray ( arr ) {
return _arrayWithoutHoles ( arr ) || Object ( iterableToArray [ "a" /* default */ ] ) ( arr ) || Object ( unsupportedIterableToArray [ "a" /* default */ ] ) ( arr ) || _nonIterableSpread ( ) ;
2020-03-23 19:40:19 -04:00
}
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 190 :
2019-10-15 11:37:08 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-07-07 12:08:28 -04:00
/* WEBPACK VAR INJECTION */ ( function ( global , module ) { /* harmony import */ var _ponyfill _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 270 ) ;
2020-06-26 09:33:47 -04:00
/* global window */
2019-10-15 11:37:08 -04:00
2020-06-26 09:33:47 -04:00
var root ;
if ( typeof self !== 'undefined' ) {
root = self ;
} else if ( typeof window !== 'undefined' ) {
root = window ;
} else if ( typeof global !== 'undefined' ) {
root = global ;
} else if ( true ) {
root = module ;
} else { }
var result = Object ( _ponyfill _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( root ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "a" ] = ( result ) ;
2020-07-07 12:08:28 -04:00
/* WEBPACK VAR INJECTION */ } . call ( this , _ _webpack _require _ _ ( 121 ) , _ _webpack _require _ _ ( 408 ) ( module ) ) )
2020-06-26 09:33:47 -04:00
/***/ } ) ,
/***/ 2 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "lodash" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 23 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "regeneratorRuntime" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 26 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _arrayLikeToArray ; } ) ;
function _arrayLikeToArray ( arr , len ) {
if ( len == null || len > arr . length ) len = arr . length ;
for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) {
arr2 [ i ] = arr [ i ] ;
}
return arr2 ;
}
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 268 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "reduxRoutine" ] ; } ( ) ) ;
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 269 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , exports ) {
module . exports = isPromise ;
module . exports . default = isPromise ;
function isPromise ( obj ) {
return ! ! obj && ( typeof obj === 'object' || typeof obj === 'function' ) && typeof obj . then === 'function' ;
}
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 270 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return symbolObservablePonyfill ; } ) ;
function symbolObservablePonyfill ( root ) {
var result ;
var Symbol = root . Symbol ;
if ( typeof Symbol === 'function' ) {
if ( Symbol . observable ) {
result = Symbol . observable ;
} else {
result = Symbol ( 'observable' ) ;
Symbol . observable = result ;
}
} else {
result = '@@observable' ;
2019-10-15 11:37:08 -04:00
}
return result ;
} ;
2020-01-03 08:17:24 -05:00
/***/ } ) ,
2020-07-07 10:43:35 -04:00
/***/ 29 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2018-12-13 23:41:57 -05:00
2020-06-26 09:33:47 -04:00
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _unsupportedIterableToArray ; } ) ;
/* harmony import */ var _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 26 ) ;
function _unsupportedIterableToArray ( o , minLen ) {
if ( ! o ) return ;
if ( typeof o === "string" ) return Object ( _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( o , minLen ) ;
var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ;
if ( n === "Object" && o . constructor ) n = o . constructor . name ;
if ( n === "Map" || n === "Set" ) return Array . from ( o ) ;
if ( n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ) return Object ( _arrayLikeToArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( o , minLen ) ;
}
2018-12-13 23:41:57 -05:00
2020-01-08 06:57:23 -05:00
/***/ } ) ,
2018-12-13 23:41:57 -05:00
2020-03-23 19:40:19 -04:00
/***/ 35 :
2020-01-08 06:57:23 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2018-12-14 06:02:53 -05:00
2020-01-08 06:57:23 -05:00
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _iterableToArray ; } ) ;
function _iterableToArray ( iter ) {
2020-03-23 19:40:19 -04:00
if ( typeof Symbol !== "undefined" && Symbol . iterator in Object ( iter ) ) return Array . from ( iter ) ;
2018-12-14 06:02:53 -05:00
}
/***/ } ) ,
2020-03-23 19:40:19 -04:00
/***/ 37 :
2020-01-22 17:06:21 -05:00
/***/ ( function ( module , exports ) {
2019-10-15 12:17:12 -04:00
2020-01-22 17:06:21 -05:00
( function ( ) { module . exports = this [ "wp" ] [ "deprecated" ] ; } ( ) ) ;
2019-10-15 12:17:12 -04:00
/***/ } ) ,
2020-03-23 19:40:19 -04:00
/***/ 38 :
2020-02-06 16:03:31 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _arrayWithHoles ; } ) ;
function _arrayWithHoles ( arr ) {
if ( Array . isArray ( arr ) ) return arr ;
}
/***/ } ) ,
2020-03-23 19:40:19 -04:00
/***/ 39 :
2020-02-06 16:03:31 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _nonIterableRest ; } ) ;
function _nonIterableRest ( ) {
2020-03-23 19:40:19 -04:00
throw new TypeError ( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
2020-02-06 16:03:31 -05:00
}
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 408 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , exports ) {
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
module . exports = function ( originalModule ) {
if ( ! originalModule . webpackPolyfill ) {
var module = Object . create ( originalModule ) ;
// module.parent = undefined by default
if ( ! module . children ) module . children = [ ] ;
Object . defineProperty ( module , "loaded" , {
enumerable : true ,
get : function ( ) {
return module . l ;
}
} ) ;
Object . defineProperty ( module , "id" , {
enumerable : true ,
get : function ( ) {
return module . i ;
}
} ) ;
Object . defineProperty ( module , "exports" , {
enumerable : true
} ) ;
module . webpackPolyfill = 1 ;
}
return module ;
} ;
/***/ } ) ,
2020-07-07 12:08:28 -04:00
/***/ 438 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 07:50:29 -04:00
// ESM COMPAT FLAG
2019-09-19 11:19:18 -04:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2020-06-29 07:50:29 -04:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "withSelect" , function ( ) { return /* reexport */ with _select ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "withDispatch" , function ( ) { return /* reexport */ with _dispatch ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "withRegistry" , function ( ) { return /* reexport */ with _registry ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "RegistryProvider" , function ( ) { return /* reexport */ context ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "RegistryConsumer" , function ( ) { return /* reexport */ RegistryConsumer ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "useRegistry" , function ( ) { return /* reexport */ useRegistry ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "useSelect" , function ( ) { return /* reexport */ useSelect ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "useDispatch" , function ( ) { return /* reexport */ use _dispatch ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "__unstableUseDispatchWithMap" , function ( ) { return /* reexport */ use _dispatch _with _map ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "AsyncModeProvider" , function ( ) { return /* reexport */ async _mode _provider _context ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "createRegistry" , function ( ) { return /* reexport */ createRegistry ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "createRegistrySelector" , function ( ) { return /* reexport */ createRegistrySelector ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "createRegistryControl" , function ( ) { return /* reexport */ createRegistryControl ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "plugins" , function ( ) { return /* reexport */ plugins _namespaceObject ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "combineReducers" , function ( ) { return /* reexport */ turbo _combine _reducers _default . a ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "select" , function ( ) { return /* binding */ build _module _select ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "__experimentalResolveSelect" , function ( ) { return /* binding */ build _module _experimentalResolveSelect ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "dispatch" , function ( ) { return /* binding */ build _module _dispatch ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "subscribe" , function ( ) { return /* binding */ build _module _subscribe ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "registerGenericStore" , function ( ) { return /* binding */ build _module _registerGenericStore ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "registerStore" , function ( ) { return /* binding */ build _module _registerStore ; } ) ;
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "use" , function ( ) { return /* binding */ build _module _use ; } ) ;
// NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/selectors.js
2019-09-19 11:19:18 -04:00
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , "getIsResolving" , function ( ) { return getIsResolving ; } ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , "hasStartedResolution" , function ( ) { return hasStartedResolution ; } ) ;
2018-12-17 22:14:52 -05:00
_ _webpack _require _ _ . d ( selectors _namespaceObject , "hasFinishedResolution" , function ( ) { return hasFinishedResolution ; } ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , "isResolving" , function ( ) { return isResolving ; } ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , "getCachedResolvers" , function ( ) { return getCachedResolvers ; } ) ;
2020-06-29 07:50:29 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/actions.js
2018-12-17 22:14:52 -05:00
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "startResolution" , function ( ) { return startResolution ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "finishResolution" , function ( ) { return finishResolution ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "invalidateResolution" , function ( ) { return invalidateResolution ; } ) ;
2019-03-21 08:48:00 -04:00
_ _webpack _require _ _ . d ( actions _namespaceObject , "invalidateResolutionForStore" , function ( ) { return invalidateResolutionForStore ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "invalidateResolutionForStoreSelector" , function ( ) { return invalidateResolutionForStoreSelector ; } ) ;
2020-06-29 07:50:29 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/plugins/index.js
2018-12-17 22:14:52 -05:00
var plugins _namespaceObject = { } ;
_ _webpack _require _ _ . r ( plugins _namespaceObject ) ;
_ _webpack _require _ _ . d ( plugins _namespaceObject , "controls" , function ( ) { return controls ; } ) ;
_ _webpack _require _ _ . d ( plugins _namespaceObject , "persistence" , function ( ) { return plugins _persistence ; } ) ;
// EXTERNAL MODULE: ./node_modules/turbo-combine-reducers/index.js
2020-07-07 12:08:28 -04:00
var turbo _combine _reducers = _ _webpack _require _ _ ( 157 ) ;
2018-12-17 22:14:52 -05:00
var turbo _combine _reducers _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( turbo _combine _reducers ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
2020-07-07 10:43:35 -04:00
var slicedToArray = _ _webpack _require _ _ ( 13 ) ;
2018-12-17 22:14:52 -05:00
2020-02-06 16:03:31 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = _ _webpack _require _ _ ( 5 ) ;
2018-12-17 22:14:52 -05:00
2020-01-03 08:17:24 -05:00
// EXTERNAL MODULE: external {"this":"lodash"}
var external _this _lodash _ = _ _webpack _require _ _ ( 2 ) ;
2018-12-17 22:14:52 -05:00
2020-01-08 06:57:23 -05:00
// EXTERNAL MODULE: ./node_modules/memize/index.js
2020-06-26 09:33:47 -04:00
var memize = _ _webpack _require _ _ ( 50 ) ;
2020-01-08 06:57:23 -05:00
var memize _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( memize ) ;
2020-01-03 08:17:24 -05:00
// EXTERNAL MODULE: external {"this":"regeneratorRuntime"}
2020-01-08 06:57:23 -05:00
var external _this _regeneratorRuntime _ = _ _webpack _require _ _ ( 23 ) ;
2020-01-03 08:17:24 -05:00
var external _this _regeneratorRuntime _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _regeneratorRuntime _ ) ;
2019-03-21 08:48:00 -04:00
2018-12-17 22:14:52 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
2020-06-26 09:33:47 -04:00
var asyncToGenerator = _ _webpack _require _ _ ( 46 ) ;
2018-12-17 22:14:52 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js
2020-07-07 12:08:28 -04:00
var es = _ _webpack _require _ _ ( 190 ) ;
2018-12-17 22:14:52 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/redux/es/redux.js
2018-12-17 22:14:52 -05:00
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* These are private action types reserved by Redux .
* For any unknown actions , you must return the current state .
* If the current state is undefined , you must return the initial state .
* Do not reference these action types directly in your code .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
var randomString = function randomString ( ) {
return Math . random ( ) . toString ( 36 ) . substring ( 7 ) . split ( '' ) . join ( '.' ) ;
2018-12-17 22:14:52 -05:00
} ;
2019-09-19 11:19:18 -04:00
var ActionTypes = {
INIT : "@@redux/INIT" + randomString ( ) ,
REPLACE : "@@redux/REPLACE" + randomString ( ) ,
PROBE _UNKNOWN _ACTION : function PROBE _UNKNOWN _ACTION ( ) {
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString ( ) ;
}
} ;
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* @ param { any } obj The object to inspect .
* @ returns { boolean } True if the argument appears to be a plain object .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function isPlainObject ( obj ) {
if ( typeof obj !== 'object' || obj === null ) return false ;
var proto = obj ;
while ( Object . getPrototypeOf ( proto ) !== null ) {
proto = Object . getPrototypeOf ( proto ) ;
}
return Object . getPrototypeOf ( obj ) === proto ;
}
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Creates a Redux store that holds the state tree .
* The only way to change the data in the store is to call ` dispatch() ` on it .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* There should only be a single store in your app . To specify how different
* parts of the state tree respond to actions , you may combine several reducers
* into a single reducer function by using ` combineReducers ` .
*
* @ param { Function } reducer A function that returns the next state tree , given
* the current state tree and the action to handle .
*
* @ param { any } [ preloadedState ] The initial state . You may optionally specify it
* to hydrate the state from the server in universal apps , or to restore a
* previously serialized user session .
* If you use ` combineReducers ` to produce the root reducer function , this must be
* an object with the same shape as ` combineReducers ` keys .
*
* @ param { Function } [ enhancer ] The store enhancer . You may optionally specify it
* to enhance the store with third - party capabilities such as middleware ,
* time travel , persistence , etc . The only store enhancer that ships with Redux
* is ` applyMiddleware() ` .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* @ returns { Store } A Redux store that lets you read the state , dispatch actions
* and subscribe to changes .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function createStore ( reducer , preloadedState , enhancer ) {
var _ref2 ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments [ 3 ] === 'function' ) {
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.' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof preloadedState === 'function' && typeof enhancer === 'undefined' ) {
enhancer = preloadedState ;
preloadedState = undefined ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof enhancer !== 'undefined' ) {
if ( typeof enhancer !== 'function' ) {
throw new Error ( 'Expected the enhancer to be a function.' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return enhancer ( createStore ) ( reducer , preloadedState ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof reducer !== 'function' ) {
throw new Error ( 'Expected the reducer to be a function.' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var currentReducer = reducer ;
var currentState = preloadedState ;
var currentListeners = [ ] ;
var nextListeners = currentListeners ;
var isDispatching = false ;
/ * *
* This makes a shallow copy of currentListeners so we can use
* nextListeners as a temporary list while dispatching .
*
* This prevents any bugs around consumers calling
* subscribe / unsubscribe in the middle of a dispatch .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function ensureCanMutateNextListeners ( ) {
if ( nextListeners === currentListeners ) {
nextListeners = currentListeners . slice ( ) ;
}
}
/ * *
* Reads the state tree managed by the store .
*
* @ returns { any } The current state tree of your application .
* /
2018-12-13 23:41:57 -05:00
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
function getState ( ) {
if ( isDispatching ) {
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.' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return currentState ;
}
/ * *
* Adds a change listener . It will be called any time an action is dispatched ,
* and some part of the state tree may potentially have changed . You may then
* call ` getState() ` to read the current state tree inside the callback .
*
* You may call ` dispatch() ` from a change listener , with the following
* caveats :
*
* 1. The subscriptions are snapshotted just before every ` dispatch() ` call .
* If you subscribe or unsubscribe while the listeners are being invoked , this
* will not have any effect on the ` dispatch() ` that is currently in progress .
* However , the next ` dispatch() ` call , whether nested or not , will use a more
* recent snapshot of the subscription list .
*
* 2. The listener should not expect to see all state changes , as the state
* might have been updated multiple times during a nested ` dispatch() ` before
* the listener is called . It is , however , guaranteed that all subscribers
* registered before the ` dispatch() ` started will be called with the latest
* state by the time it exits .
*
* @ param { Function } listener A callback to be invoked on every dispatch .
* @ returns { Function } A function to remove this change listener .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function subscribe ( listener ) {
if ( typeof listener !== 'function' ) {
throw new Error ( 'Expected the listener to be a function.' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( isDispatching ) {
2020-01-08 06:57:23 -05:00
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#subscribelistener for more details.' ) ;
2019-09-19 11:19:18 -04:00
}
2018-12-17 22:14:52 -05:00
2019-09-19 11:19:18 -04:00
var isSubscribed = true ;
ensureCanMutateNextListeners ( ) ;
nextListeners . push ( listener ) ;
return function unsubscribe ( ) {
if ( ! isSubscribed ) {
return ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( isDispatching ) {
2020-01-08 06:57:23 -05:00
throw new Error ( 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.' ) ;
2019-09-19 11:19:18 -04:00
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
isSubscribed = false ;
ensureCanMutateNextListeners ( ) ;
var index = nextListeners . indexOf ( listener ) ;
nextListeners . splice ( index , 1 ) ;
2020-01-08 06:57:23 -05:00
currentListeners = null ;
2019-09-19 11:19:18 -04:00
} ;
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
/ * *
* Dispatches an action . It is the only way to trigger a state change .
*
* The ` reducer ` function , used to create the store , will be called with the
* current state tree and the given ` action ` . Its return value will
* be considered the * * next * * state of the tree , and the change listeners
* will be notified .
*
* The base implementation only supports plain object actions . If you want to
* dispatch a Promise , an Observable , a thunk , or something else , you need to
* wrap your store creating function into the corresponding middleware . For
* example , see the documentation for the ` redux-thunk ` package . Even the
* middleware will eventually dispatch plain object actions using this method .
*
* @ param { Object } action A plain object representing “ what changed ” . It is
* a good idea to keep actions serializable so you can record and replay user
* sessions , or use the time travelling ` redux-devtools ` . An action must have
* a ` type ` property which may not be ` undefined ` . It is a good idea to use
* string constants for action types .
*
* @ returns { Object } For convenience , the same action object you dispatched .
*
* Note that , if you use a custom middleware , it may wrap ` dispatch() ` to
* return something else ( for example , a Promise you can await ) .
* /
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
function dispatch ( action ) {
if ( ! isPlainObject ( action ) ) {
throw new Error ( 'Actions must be plain objects. ' + 'Use custom middleware for async actions.' ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof action . type === 'undefined' ) {
throw new Error ( 'Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?' ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( isDispatching ) {
throw new Error ( 'Reducers may not dispatch actions.' ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
try {
isDispatching = true ;
currentState = currentReducer ( currentState , action ) ;
} finally {
isDispatching = false ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var listeners = currentListeners = nextListeners ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
for ( var i = 0 ; i < listeners . length ; i ++ ) {
var listener = listeners [ i ] ;
listener ( ) ;
}
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 10:37:00 -05:00
2019-09-19 11:19:18 -04:00
return action ;
}
/ * *
* Replaces the reducer currently used by the store to calculate the state .
*
* You might need this if your app implements code splitting and you want to
* load some of the reducers dynamically . You might also need this if you
* implement a hot reloading mechanism for Redux .
*
* @ param { Function } nextReducer The reducer for the store to use instead .
* @ returns { void }
* /
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
function replaceReducer ( nextReducer ) {
if ( typeof nextReducer !== 'function' ) {
throw new Error ( 'Expected the nextReducer to be a function.' ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
currentReducer = nextReducer ; // This action has a similiar effect to ActionTypes.INIT.
// Any reducers that existed in both the new and old rootReducer
// will receive the previous state. This effectively populates
// the new state tree with any relevant data from the old one.
dispatch ( {
type : ActionTypes . REPLACE
} ) ;
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
/ * *
* Interoperability point for observable / reactive libraries .
* @ returns { observable } A minimal observable of state changes .
* For more information , see the observable proposal :
* https : //github.com/tc39/proposal-observable
* /
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
function observable ( ) {
var _ref ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var outerSubscribe = subscribe ;
return _ref = {
/ * *
* The minimal observable subscription method .
* @ param { Object } observer Any object that can be used as an observer .
* The observer object should have a ` next ` method .
* @ returns { subscription } An object with an ` unsubscribe ` method that can
* be used to unsubscribe the observable from the store , and prevent further
* emission of values from the observable .
* /
subscribe : function subscribe ( observer ) {
if ( typeof observer !== 'object' || observer === null ) {
throw new TypeError ( 'Expected the observer to be an object.' ) ;
}
2019-01-04 14:38:57 -05:00
2019-09-19 11:19:18 -04:00
function observeState ( ) {
if ( observer . next ) {
observer . next ( getState ( ) ) ;
}
}
observeState ( ) ;
var unsubscribe = outerSubscribe ( observeState ) ;
return {
unsubscribe : unsubscribe
} ;
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
} , _ref [ es [ "a" /* default */ ] ] = function ( ) {
return this ;
} , _ref ;
} // When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
dispatch ( {
type : ActionTypes . INIT
} ) ;
return _ref2 = {
dispatch : dispatch ,
subscribe : subscribe ,
getState : getState ,
replaceReducer : replaceReducer
} , _ref2 [ es [ "a" /* default */ ] ] = observable , _ref2 ;
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
2018-12-16 23:52:00 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Prints a warning in the console if it exists .
2018-12-16 23:52:00 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { String } message The warning message .
* @ returns { void }
2018-12-16 23:52:00 -05:00
* /
2019-09-19 11:19:18 -04:00
function warning ( message ) {
/* eslint-disable no-console */
if ( typeof console !== 'undefined' && typeof console . error === 'function' ) {
console . error ( message ) ;
}
/* eslint-enable no-console */
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error ( message ) ;
} catch ( e ) { } // eslint-disable-line no-empty
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
function getUndefinedStateErrorMessage ( key , action ) {
var actionType = action && action . type ;
var actionDescription = actionType && "action \"" + String ( actionType ) + "\"" || 'an action' ;
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." ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
function getUnexpectedStateShapeWarningMessage ( inputState , reducers , action , unexpectedKeyCache ) {
var reducerKeys = Object . keys ( reducers ) ;
var argumentName = action && action . type === ActionTypes . INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer' ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( reducerKeys . length === 0 ) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.' ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( ! isPlainObject ( inputState ) ) {
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 ( '", "' ) + "\"" ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var unexpectedKeys = Object . keys ( inputState ) . filter ( function ( key ) {
return ! reducers . hasOwnProperty ( key ) && ! unexpectedKeyCache [ key ] ;
} ) ;
unexpectedKeys . forEach ( function ( key ) {
unexpectedKeyCache [ key ] = true ;
} ) ;
if ( action && action . type === ActionTypes . REPLACE ) return ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( unexpectedKeys . length > 0 ) {
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." ) ;
}
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
function assertReducerShape ( reducers ) {
Object . keys ( reducers ) . forEach ( function ( key ) {
var reducer = reducers [ key ] ;
var initialState = reducer ( undefined , {
type : ActionTypes . INIT
} ) ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof initialState === 'undefined' ) {
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." ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof reducer ( undefined , {
type : ActionTypes . PROBE _UNKNOWN _ACTION ( )
} ) === 'undefined' ) {
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." ) ;
}
2018-12-16 23:52:00 -05:00
} ) ;
}
/ * *
2019-09-19 11:19:18 -04:00
* Turns an object whose values are different reducer functions , into a single
* reducer function . It will call every child reducer , and gather their results
* into a single state object , whose keys correspond to the keys of the passed
* reducer functions .
*
* @ param { Object } reducers An object whose values correspond to different
* reducer functions that need to be combined into one . One handy way to obtain
* it is to use ES6 ` import * as reducers ` syntax . The reducers may never return
* undefined for any action . Instead , they should return their initial state
* if the state passed to them was undefined , and the current state for any
* unrecognized action .
*
* @ returns { Function } A reducer function that invokes every reducer inside the
* passed object , and builds a state object with the same shape .
2018-12-16 23:52:00 -05:00
* /
2019-09-19 11:19:18 -04:00
function combineReducers ( reducers ) {
var reducerKeys = Object . keys ( reducers ) ;
var finalReducers = { } ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
for ( var i = 0 ; i < reducerKeys . length ; i ++ ) {
var key = reducerKeys [ i ] ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( false ) { }
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof reducers [ key ] === 'function' ) {
finalReducers [ key ] = reducers [ key ] ;
2018-12-16 23:52:00 -05:00
}
2019-09-19 11:19:18 -04:00
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var finalReducerKeys = Object . keys ( finalReducers ) ; // This is used to make sure we don't warn about the same
// keys multiple times.
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var unexpectedKeyCache ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( false ) { }
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var shapeAssertionError ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
try {
assertReducerShape ( finalReducers ) ;
} catch ( e ) {
shapeAssertionError = e ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
return function combination ( state , action ) {
if ( state === void 0 ) {
state = { } ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( shapeAssertionError ) {
throw shapeAssertionError ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( false ) { var warningMessage ; }
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var hasChanged = false ;
var nextState = { } ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
for ( var _i = 0 ; _i < finalReducerKeys . length ; _i ++ ) {
var _key = finalReducerKeys [ _i ] ;
var reducer = finalReducers [ _key ] ;
var previousStateForKey = state [ _key ] ;
var nextStateForKey = reducer ( previousStateForKey , action ) ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof nextStateForKey === 'undefined' ) {
var errorMessage = getUndefinedStateErrorMessage ( _key , action ) ;
throw new Error ( errorMessage ) ;
2018-12-16 23:52:00 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
nextState [ _key ] = nextStateForKey ;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey ;
}
2018-12-13 23:41:57 -05:00
2020-01-08 06:57:23 -05:00
hasChanged = hasChanged || finalReducerKeys . length !== Object . keys ( state ) . length ;
2019-09-19 11:19:18 -04:00
return hasChanged ? nextState : state ;
} ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function bindActionCreator ( actionCreator , dispatch ) {
return function ( ) {
return dispatch ( actionCreator . apply ( this , arguments ) ) ;
} ;
}
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Turns an object whose values are action creators , into an object with the
* same keys , but with every function wrapped into a ` dispatch ` call so they
* may be invoked directly . This is just a convenience method , as you can call
* ` store.dispatch(MyActionCreators.doSomething()) ` yourself just fine .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* For convenience , you can also pass an action creator as the first argument ,
* and get a dispatch wrapped function in return .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { Function | Object } actionCreators An object whose values are action
* creator functions . One handy way to obtain it is to use ES6 ` import * as `
* syntax . You may also pass a single function .
*
* @ param { Function } dispatch The ` dispatch ` function available on your Redux
* store .
*
* @ returns { Function | Object } The object mimicking the original object , but with
* every action creator wrapped into the ` dispatch ` call . If you passed a
* function as ` actionCreators ` , the return value will also be a single
* function .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function bindActionCreators ( actionCreators , dispatch ) {
if ( typeof actionCreators === 'function' ) {
return bindActionCreator ( actionCreators , dispatch ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof actionCreators !== 'object' || actionCreators === null ) {
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\"?" ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var boundActionCreators = { } ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
for ( var key in actionCreators ) {
var actionCreator = actionCreators [ key ] ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof actionCreator === 'function' ) {
boundActionCreators [ key ] = bindActionCreator ( actionCreator , dispatch ) ;
}
}
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
return boundActionCreators ;
}
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
return obj ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function ownKeys ( object , enumerableOnly ) {
var keys = Object . keys ( object ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( Object . getOwnPropertySymbols ) {
keys . push . apply ( keys , Object . getOwnPropertySymbols ( object ) ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( enumerableOnly ) keys = keys . filter ( function ( sym ) {
return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ;
} ) ;
return keys ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function _objectSpread2 ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] != null ? arguments [ i ] : { } ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( i % 2 ) {
ownKeys ( source , true ) . forEach ( function ( key ) {
_defineProperty ( target , key , source [ key ] ) ;
} ) ;
} else if ( Object . getOwnPropertyDescriptors ) {
Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ;
} else {
ownKeys ( source ) . forEach ( function ( key ) {
Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ;
} ) ;
}
}
return target ;
}
/ * *
* Composes single - argument functions from right to left . The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function .
*
* @ param { ... Function } funcs The functions to compose .
* @ returns { Function } A function obtained by composing the argument functions
* from right to left . For example , compose ( f , g , h ) is identical to doing
* ( ... args ) => f ( g ( h ( ... args ) ) ) .
* /
function compose ( ) {
for ( var _len = arguments . length , funcs = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
funcs [ _key ] = arguments [ _key ] ;
}
if ( funcs . length === 0 ) {
return function ( arg ) {
return arg ;
} ;
}
if ( funcs . length === 1 ) {
return funcs [ 0 ] ;
}
return funcs . reduce ( function ( a , b ) {
return function ( ) {
return a ( b . apply ( void 0 , arguments ) ) ;
} ;
} ) ;
}
/ * *
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store . This is handy for a variety of tasks , such as expressing
* asynchronous actions in a concise manner , or logging every action payload .
*
* See ` redux-thunk ` package as an example of the Redux middleware .
*
* Because middleware is potentially asynchronous , this should be the first
* store enhancer in the composition chain .
*
* Note that each middleware will be given the ` dispatch ` and ` getState ` functions
* as named arguments .
*
* @ param { ... Function } middlewares The middleware chain to be applied .
* @ returns { Function } A store enhancer applying the middleware .
* /
function applyMiddleware ( ) {
for ( var _len = arguments . length , middlewares = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
middlewares [ _key ] = arguments [ _key ] ;
}
return function ( createStore ) {
return function ( ) {
var store = createStore . apply ( void 0 , arguments ) ;
var _dispatch = function dispatch ( ) {
throw new Error ( 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.' ) ;
} ;
var middlewareAPI = {
getState : store . getState ,
dispatch : function dispatch ( ) {
return _dispatch . apply ( void 0 , arguments ) ;
}
} ;
var chain = middlewares . map ( function ( middleware ) {
return middleware ( middlewareAPI ) ;
} ) ;
_dispatch = compose . apply ( void 0 , chain ) ( store . dispatch ) ;
return _objectSpread2 ( { } , store , {
dispatch : _dispatch
} ) ;
} ;
} ;
}
/ *
* This is a dummy function to check if the function name has been altered by minification .
* If the function has been minified and NODE _ENV !== 'production' , warn the user .
* /
function isCrushed ( ) { }
if ( false ) { }
// EXTERNAL MODULE: external {"this":["wp","reduxRoutine"]}
2020-07-07 12:08:28 -04:00
var external _this _wp _reduxRoutine _ = _ _webpack _require _ _ ( 268 ) ;
2019-09-19 11:19:18 -04:00
var external _this _wp _reduxRoutine _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _wp _reduxRoutine _ ) ;
2020-06-26 09:33:47 -04:00
// EXTERNAL MODULE: ./node_modules/@wordpress/data/node_modules/is-promise/index.js
2020-07-07 12:08:28 -04:00
var is _promise = _ _webpack _require _ _ ( 269 ) ;
2019-09-19 11:19:18 -04:00
var is _promise _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( is _promise ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/promise-middleware.js
/ * *
* External dependencies
* /
/ * *
* Simplest possible promise redux middleware .
*
* @ return { Function } middleware .
* /
var promise _middleware _promiseMiddleware = function promiseMiddleware ( ) {
return function ( next ) {
return function ( action ) {
if ( is _promise _default ( ) ( action ) ) {
return action . then ( function ( resolvedAction ) {
if ( resolvedAction ) {
return next ( resolvedAction ) ;
}
} ) ;
}
return next ( action ) ;
} ;
} ;
} ;
/* harmony default export */ var promise _middleware = ( promise _middleware _promiseMiddleware ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
2020-07-07 10:43:35 -04:00
var toConsumableArray = _ _webpack _require _ _ ( 17 ) ;
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js
/ * *
* External dependencies
* /
2020-01-08 06:57:23 -05:00
/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
2019-09-19 11:19:18 -04:00
/ * *
* Creates a middleware handling resolvers cache invalidation .
*
* @ param { WPDataRegistry } registry The registry reference for which to create
* the middleware .
* @ param { string } reducerKey The namespace for which to create the
* middleware .
*
* @ return { Function } Middleware function .
* /
var resolvers _cache _middleware _createResolversCacheMiddleware = function createResolversCacheMiddleware ( registry , reducerKey ) {
return function ( ) {
return function ( next ) {
return function ( action ) {
var resolvers = registry . select ( 'core/data' ) . getCachedResolvers ( reducerKey ) ;
Object . entries ( resolvers ) . forEach ( function ( _ref ) {
var _ref2 = Object ( slicedToArray [ "a" /* default */ ] ) ( _ref , 2 ) ,
selectorName = _ref2 [ 0 ] ,
resolversByArgs = _ref2 [ 1 ] ;
2020-01-03 08:17:24 -05:00
var resolver = Object ( external _this _lodash _ [ "get" ] ) ( registry . stores , [ reducerKey , 'resolvers' , selectorName ] ) ;
2019-09-19 11:19:18 -04:00
if ( ! resolver || ! resolver . shouldInvalidate ) {
return ;
}
resolversByArgs . forEach ( function ( value , args ) {
// resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.
// If the value is false it means this resolver has finished its resolution which means we need to invalidate it,
// if it's true it means it's inflight and the invalidation is not necessary.
if ( value !== false || ! resolver . shouldInvalidate . apply ( resolver , [ action ] . concat ( Object ( toConsumableArray [ "a" /* default */ ] ) ( args ) ) ) ) {
return ;
} // Trigger cache invalidation
registry . dispatch ( 'core/data' ) . invalidateResolution ( reducerKey , selectorName , args ) ;
} ) ;
} ) ;
return next ( action ) ;
} ;
} ;
} ;
} ;
/* harmony default export */ var resolvers _cache _middleware = ( resolvers _cache _middleware _createResolversCacheMiddleware ) ;
// EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
2020-07-07 10:43:35 -04:00
var equivalent _key _map = _ _webpack _require _ _ ( 120 ) ;
2019-09-19 11:19:18 -04:00
var equivalent _key _map _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( equivalent _key _map ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/utils.js
2020-02-06 16:03:31 -05:00
function utils _ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { utils _ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { utils _ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
2019-09-19 11:19:18 -04:00
/ * *
* Higher - order reducer creator which creates a combined reducer object , keyed
* by a property on the action object .
*
* @ param { string } actionProperty Action property by which to key object .
*
* @ return { Function } Higher - order reducer .
* /
var utils _onSubKey = function onSubKey ( actionProperty ) {
return function ( reducer ) {
return function ( ) {
var state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
// Retrieve subkey from action. Do not track if undefined; useful for cases
// where reducer is scoped by action shape.
var key = action [ actionProperty ] ;
if ( key === undefined ) {
return state ;
} // Avoid updating state if unchanged. Note that this also accounts for a
// reducer which returns undefined on a key which is not yet tracked.
var nextKeyState = reducer ( state [ key ] , action ) ;
if ( nextKeyState === state [ key ] ) {
return state ;
}
2020-02-06 16:03:31 -05:00
return _objectSpread ( { } , state , Object ( defineProperty [ "a" /* default */ ] ) ( { } , key , nextKeyState ) ) ;
2019-09-19 11:19:18 -04:00
} ;
} ;
} ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/reducer.js
/ * *
* External dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Reducer function returning next state for selector resolution of
* subkeys , object form :
*
* selectorName - > EquivalentKeyMap < Array , boolean >
*
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { Object } Next state .
* /
2020-01-03 08:17:24 -05:00
var subKeysIsResolved = Object ( external _this _lodash _ [ "flowRight" ] ) ( [ utils _onSubKey ( 'selectorName' ) ] ) ( function ( ) {
2019-09-19 11:19:18 -04:00
var state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : new equivalent _key _map _default . a ( ) ;
2018-12-17 22:14:52 -05:00
var action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
switch ( action . type ) {
case 'START_RESOLUTION' :
case 'FINISH_RESOLUTION' :
{
var isStarting = action . type === 'START_RESOLUTION' ;
var nextState = new equivalent _key _map _default . a ( state ) ;
nextState . set ( action . args , isStarting ) ;
return nextState ;
}
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
case 'INVALIDATE_RESOLUTION' :
{
var _nextState = new equivalent _key _map _default . a ( state ) ;
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
_nextState . delete ( action . args ) ;
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
return _nextState ;
}
}
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
return state ;
} ) ;
2019-03-21 08:48:00 -04:00
/ * *
* Reducer function returning next state for selector resolution , object form :
*
2019-09-19 11:19:18 -04:00
* selectorName - > EquivalentKeyMap < Array , boolean >
2019-03-21 08:48:00 -04:00
*
* @ param { Object } state Current state .
* @ param { Object } action Dispatched action .
*
* @ return { Object } Next state .
* /
var reducer _isResolved = function isResolved ( ) {
var state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
switch ( action . type ) {
case 'INVALIDATE_RESOLUTION_FOR_STORE' :
2019-09-19 11:19:18 -04:00
return { } ;
2019-03-21 08:48:00 -04:00
case 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR' :
2020-01-03 08:17:24 -05:00
return Object ( external _this _lodash _ [ "has" ] ) ( state , [ action . selectorName ] ) ? Object ( external _this _lodash _ [ "omit" ] ) ( state , [ action . selectorName ] ) : state ;
2019-03-21 08:48:00 -04:00
case 'START_RESOLUTION' :
case 'FINISH_RESOLUTION' :
case 'INVALIDATE_RESOLUTION' :
return subKeysIsResolved ( state , action ) ;
}
return state ;
} ;
2019-09-19 11:19:18 -04:00
/* harmony default export */ var metadata _reducer = ( reducer _isResolved ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/selectors.js
2018-12-13 23:41:57 -05:00
/ * *
* External dependencies
* /
/ * *
2019-09-19 11:19:18 -04:00
* Returns the raw ` isResolving ` value for a given selector name ,
2018-12-17 22:14:52 -05:00
* and arguments set . May be undefined if the selector has never been resolved
* or not resolved for the given set of arguments , otherwise true or false for
* resolution started and completed respectively .
*
* @ param { Object } state Data state .
* @ param { string } selectorName Selector name .
* @ param { Array } args Arguments passed to selector .
*
* @ return { ? boolean } isResolving value .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function getIsResolving ( state , selectorName , args ) {
2020-01-03 08:17:24 -05:00
var map = Object ( external _this _lodash _ [ "get" ] ) ( state , [ selectorName ] ) ;
2018-12-17 22:14:52 -05:00
if ( ! map ) {
return ;
}
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
return map . get ( args ) ;
}
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Returns true if resolution has already been triggered for a given
* selector name , and arguments set .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { Object } state Data state .
* @ param { string } selectorName Selector name .
* @ param { ? Array } args Arguments passed to selector ( default ` [] ` ) .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ return { boolean } Whether resolution has been triggered .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function hasStartedResolution ( state , selectorName ) {
var args = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : [ ] ;
return getIsResolving ( state , selectorName , args ) !== undefined ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Returns true if resolution has completed for a given selector
2018-12-17 22:14:52 -05:00
* name , and arguments set .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { Object } state Data state .
* @ param { string } selectorName Selector name .
* @ param { ? Array } args Arguments passed to selector .
*
* @ return { boolean } Whether resolution has completed .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function hasFinishedResolution ( state , selectorName ) {
var args = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : [ ] ;
return getIsResolving ( state , selectorName , args ) === false ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
/ * *
2018-12-17 22:14:52 -05:00
* Returns true if resolution has been triggered but has not yet completed for
2019-09-19 11:19:18 -04:00
* a given selector name , and arguments set .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { Object } state Data state .
* @ param { string } selectorName Selector name .
* @ param { ? Array } args Arguments passed to selector .
*
* @ return { boolean } Whether resolution is in progress .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function isResolving ( state , selectorName ) {
var args = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : [ ] ;
return getIsResolving ( state , selectorName , args ) === true ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
/ * *
2018-12-17 22:14:52 -05:00
* Returns the list of the cached resolvers .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { Object } state Data state .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ return { Object } Resolvers mapped by args and selectorName .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function getCachedResolvers ( state ) {
return state ;
2018-12-17 22:14:52 -05:00
}
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/metadata/actions.js
2018-12-17 22:14:52 -05:00
/ * *
* Returns an action object used in signalling that selector resolution has
* started .
*
* @ param { string } selectorName Name of selector for which resolver triggered .
* @ param { ... * } args Arguments to associate for uniqueness .
*
* @ return { Object } Action object .
* /
2019-09-19 11:19:18 -04:00
function startResolution ( selectorName , args ) {
2018-12-17 22:14:52 -05:00
return {
type : 'START_RESOLUTION' ,
selectorName : selectorName ,
args : args
2018-12-13 23:41:57 -05:00
} ;
}
/ * *
2018-12-17 22:14:52 -05:00
* Returns an action object used in signalling that selector resolution has
* completed .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { string } selectorName Name of selector for which resolver triggered .
* @ param { ... * } args Arguments to associate for uniqueness .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ return { Object } Action object .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function finishResolution ( selectorName , args ) {
2018-12-13 23:41:57 -05:00
return {
2018-12-17 22:14:52 -05:00
type : 'FINISH_RESOLUTION' ,
selectorName : selectorName ,
args : args
2018-12-13 23:41:57 -05:00
} ;
}
/ * *
2018-12-17 22:14:52 -05:00
* Returns an action object used in signalling that we should invalidate the resolution cache .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ param { string } selectorName Name of selector for which resolver should be invalidated .
* @ param { Array } args Arguments to associate for uniqueness .
2018-12-13 23:41:57 -05:00
*
2018-12-17 22:14:52 -05:00
* @ return { Object } Action object .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function invalidateResolution ( selectorName , args ) {
2018-12-17 22:14:52 -05:00
return {
type : 'INVALIDATE_RESOLUTION' ,
selectorName : selectorName ,
args : args
} ;
}
/ * *
2019-09-19 11:19:18 -04:00
* Returns an action object used in signalling that the resolution
* should be invalidated .
2019-03-21 08:48:00 -04:00
*
* @ return { Object } Action object .
2018-12-17 22:14:52 -05:00
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function invalidateResolutionForStore ( ) {
2019-03-21 08:48:00 -04:00
return {
2019-09-19 11:19:18 -04:00
type : 'INVALIDATE_RESOLUTION_FOR_STORE'
2019-03-21 08:48:00 -04:00
} ;
}
/ * *
* Returns an action object used in signalling that the resolution cache for a
2019-09-19 11:19:18 -04:00
* given selectorName should be invalidated .
2019-03-21 08:48:00 -04:00
*
* @ param { string } selectorName Name of selector for which all resolvers should
* be invalidated .
*
* @ return { Object } Action object .
* /
2019-09-19 11:19:18 -04:00
function invalidateResolutionForStoreSelector ( selectorName ) {
2019-03-21 08:48:00 -04:00
return {
type : 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR' ,
selectorName : selectorName
} ;
}
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/namespace-store/index.js
2020-02-06 16:03:31 -05:00
function namespace _store _ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function namespace _store _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { namespace _store _ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { namespace _store _ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
2019-03-21 08:48:00 -04:00
/ * *
2019-09-19 11:19:18 -04:00
* External dependencies
2019-03-21 08:48:00 -04:00
* /
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* WordPress dependencies
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
2018-12-13 23:41:57 -05:00
/ * *
* Internal dependencies
* /
2019-09-19 11:19:18 -04:00
2018-12-13 23:41:57 -05:00
/ * *
2020-01-08 06:57:23 -05:00
* @ typedef { WPDataRegistry } WPDataRegistry
2018-12-13 23:41:57 -05:00
* /
/ * *
2019-09-19 11:19:18 -04:00
* Creates a namespace object with a store derived from the reducer given .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { string } key Unique namespace identifier .
* @ param { Object } options Registered store options , with properties
* describing reducer , actions , selectors , and
* resolvers .
* @ param { WPDataRegistry } registry Registry reference .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* @ return { Object } Store Object .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function createNamespace ( key , options , registry ) {
var reducer = options . reducer ;
var store = createReduxStore ( key , options , registry ) ;
var resolvers ;
2020-02-06 16:03:31 -05:00
var actions = mapActions ( namespace _store _objectSpread ( { } , actions _namespaceObject , { } , options . actions ) , store ) ;
var selectors = mapSelectors ( namespace _store _objectSpread ( { } , Object ( external _this _lodash _ [ "mapValues" ] ) ( selectors _namespaceObject , function ( selector ) {
2019-09-19 11:19:18 -04:00
return function ( state ) {
for ( var _len = arguments . length , args = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
args [ _key - 1 ] = arguments [ _key ] ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return selector . apply ( void 0 , [ state . metadata ] . concat ( args ) ) ;
} ;
2020-02-06 16:03:31 -05:00
} ) , { } , Object ( external _this _lodash _ [ "mapValues" ] ) ( options . selectors , function ( selector ) {
2019-09-19 11:19:18 -04:00
if ( selector . isRegistrySelector ) {
selector . registry = registry ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return function ( state ) {
for ( var _len2 = arguments . length , args = new Array ( _len2 > 1 ? _len2 - 1 : 0 ) , _key2 = 1 ; _key2 < _len2 ; _key2 ++ ) {
args [ _key2 - 1 ] = arguments [ _key2 ] ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return selector . apply ( void 0 , [ state . root ] . concat ( args ) ) ;
2018-12-13 23:41:57 -05:00
} ;
2019-09-19 11:19:18 -04:00
} ) ) , store ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( options . resolvers ) {
var result = mapResolvers ( options . resolvers , selectors , store ) ;
resolvers = result . resolvers ;
selectors = result . selectors ;
2018-12-13 23:41:57 -05:00
}
2019-09-19 11:19:18 -04:00
var getSelectors = function getSelectors ( ) {
return selectors ;
} ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var getActions = function getActions ( ) {
return actions ;
} ; // We have some modules monkey-patching the store object
// It's wrong to do so but until we refactor all of our effects to controls
// We need to keep the same "store" instance here.
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
store . _ _unstableOriginalGetState = store . getState ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
store . getState = function ( ) {
return store . _ _unstableOriginalGetState ( ) . root ;
} ; // Customize subscribe behavior to call listeners only on effective change,
// not on every dispatch.
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var subscribe = store && function ( listener ) {
var lastState = store . _ _unstableOriginalGetState ( ) ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
store . subscribe ( function ( ) {
var state = store . _ _unstableOriginalGetState ( ) ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var hasChanged = state !== lastState ;
lastState = state ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( hasChanged ) {
listener ( ) ;
}
} ) ;
} ; // This can be simplified to just { subscribe, getSelectors, getActions }
// Once we remove the use function.
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return {
reducer : reducer ,
store : store ,
actions : actions ,
selectors : selectors ,
resolvers : resolvers ,
getSelectors : getSelectors ,
getActions : getActions ,
subscribe : subscribe
2018-12-13 23:41:57 -05:00
} ;
2019-09-19 11:19:18 -04:00
}
/ * *
* Creates a redux store for a namespace .
*
* @ param { string } key Unique namespace identifier .
* @ param { Object } options Registered store options , with properties
* describing reducer , actions , selectors , and
* resolvers .
* @ param { WPDataRegistry } registry Registry reference .
*
* @ return { Object } Newly created redux store .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function createReduxStore ( key , options , registry ) {
var middlewares = [ resolvers _cache _middleware ( registry , key ) , promise _middleware ] ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( options . controls ) {
2020-01-03 08:17:24 -05:00
var normalizedControls = Object ( external _this _lodash _ [ "mapValues" ] ) ( options . controls , function ( control ) {
2019-09-19 11:19:18 -04:00
return control . isRegistryControl ? control ( registry ) : control ;
} ) ;
middlewares . push ( external _this _wp _reduxRoutine _default ( ) ( normalizedControls ) ) ;
}
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
var enhancers = [ applyMiddleware . apply ( void 0 , middlewares ) ] ;
2018-12-16 23:52:00 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof window !== 'undefined' && window . _ _REDUX _DEVTOOLS _EXTENSION _ _ ) {
enhancers . push ( window . _ _REDUX _DEVTOOLS _EXTENSION _ _ ( {
name : key ,
instanceId : key
} ) ) ;
2018-12-13 23:41:57 -05:00
}
2019-09-19 11:19:18 -04:00
var reducer = options . reducer ,
initialState = options . initialState ;
var enhancedReducer = turbo _combine _reducers _default ( ) ( {
metadata : metadata _reducer ,
root : reducer
2018-12-13 23:41:57 -05:00
} ) ;
2019-09-19 11:19:18 -04:00
return createStore ( enhancedReducer , {
root : initialState
2020-01-03 08:17:24 -05:00
} , Object ( external _this _lodash _ [ "flowRight" ] ) ( enhancers ) ) ;
2018-12-13 23:41:57 -05:00
}
2019-03-07 04:09:59 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Maps selectors to a store .
*
* @ param { Object } selectors Selectors to register . Keys will be used as the
* public facing API . Selectors will get passed the
* state as first argument .
* @ param { Object } store The store to which the selectors should be mapped .
*
* @ return { Object } Selectors mapped to the provided store .
2019-03-07 04:09:59 -05:00
* /
2018-12-13 23:41:57 -05:00
2018-12-14 06:02:53 -05:00
2019-09-19 11:19:18 -04:00
function mapSelectors ( selectors , store ) {
var createStateSelector = function createStateSelector ( registrySelector ) {
var selector = function runSelector ( ) {
// This function is an optimized implementation of:
//
// selector( store.getState(), ...arguments )
//
// Where the above would incur an `Array#concat` in its application,
// the logic here instead efficiently constructs an arguments array via
// direct assignment.
var argsLength = arguments . length ;
var args = new Array ( argsLength + 1 ) ;
args [ 0 ] = store . _ _unstableOriginalGetState ( ) ;
2018-12-14 06:02:53 -05:00
2019-09-19 11:19:18 -04:00
for ( var i = 0 ; i < argsLength ; i ++ ) {
args [ i + 1 ] = arguments [ i ] ;
}
return registrySelector . apply ( void 0 , args ) ;
} ;
2018-12-14 06:02:53 -05:00
2019-09-19 11:19:18 -04:00
selector . hasResolver = false ;
return selector ;
} ;
2019-03-07 04:09:59 -05:00
2020-01-03 08:17:24 -05:00
return Object ( external _this _lodash _ [ "mapValues" ] ) ( selectors , createStateSelector ) ;
2019-09-19 11:19:18 -04:00
}
2018-12-14 06:02:53 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Maps actions to dispatch from a given store .
*
* @ param { Object } actions Actions to register .
* @ param { Object } store The redux store to which the actions should be mapped .
* @ return { Object } Actions mapped to the redux store provided .
2018-12-14 06:02:53 -05:00
* /
2019-09-19 11:19:18 -04:00
function mapActions ( actions , store ) {
var createBoundAction = function createBoundAction ( action ) {
return function ( ) {
return Promise . resolve ( store . dispatch ( action . apply ( void 0 , arguments ) ) ) ;
} ;
} ;
2018-12-14 06:02:53 -05:00
2020-01-03 08:17:24 -05:00
return Object ( external _this _lodash _ [ "mapValues" ] ) ( actions , createBoundAction ) ;
2019-09-19 11:19:18 -04:00
}
/ * *
* Returns resolvers with matched selectors for a given namespace .
* Resolvers are side effects invoked once per argument set of a given selector call ,
* used in ensuring that the data needs for the selector are satisfied .
*
* @ param { Object } resolvers Resolvers to register .
* @ param { Object } selectors The current selectors to be modified .
* @ param { Object } store The redux store to which the resolvers should be mapped .
* @ return { Object } An object containing updated selectors and resolvers .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function mapResolvers ( resolvers , selectors , store ) {
2020-01-03 08:17:24 -05:00
var mappedResolvers = Object ( external _this _lodash _ [ "mapValues" ] ) ( resolvers , function ( resolver ) {
2019-09-19 11:19:18 -04:00
var _resolver$fulfill = resolver . fulfill ,
resolverFulfill = _resolver$fulfill === void 0 ? resolver : _resolver$fulfill ;
2020-02-06 16:03:31 -05:00
return namespace _store _objectSpread ( { } , resolver , {
2019-09-19 11:19:18 -04:00
fulfill : resolverFulfill
} ) ;
} ) ;
2018-12-14 06:02:53 -05:00
2019-09-19 11:19:18 -04:00
var mapSelector = function mapSelector ( selector , selectorName ) {
var resolver = resolvers [ selectorName ] ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( ! resolver ) {
selector . hasResolver = false ;
return selector ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var selectorResolver = function selectorResolver ( ) {
for ( var _len3 = arguments . length , args = new Array ( _len3 ) , _key3 = 0 ; _key3 < _len3 ; _key3 ++ ) {
args [ _key3 ] = arguments [ _key3 ] ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function fulfillSelector ( ) {
return _fulfillSelector . apply ( this , arguments ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function _fulfillSelector ( ) {
2020-06-26 09:33:47 -04:00
_fulfillSelector = Object ( asyncToGenerator [ "a" /* default */ ] ) ( /*#__PURE__*/ external _this _regeneratorRuntime _default . a . mark ( function _callee ( ) {
2019-09-19 11:19:18 -04:00
var state , _store$ _ _unstableOrig , metadata ;
2020-01-03 08:17:24 -05:00
return external _this _regeneratorRuntime _default . a . wrap ( function _callee$ ( _context ) {
2019-09-19 11:19:18 -04:00
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
state = store . getState ( ) ;
if ( ! ( typeof resolver . isFulfilled === 'function' && resolver . isFulfilled . apply ( resolver , [ state ] . concat ( args ) ) ) ) {
_context . next = 3 ;
break ;
}
return _context . abrupt ( "return" ) ;
case 3 :
_store$ _ _unstableOrig = store . _ _unstableOriginalGetState ( ) , metadata = _store$ _ _unstableOrig . metadata ;
if ( ! hasStartedResolution ( metadata , selectorName , args ) ) {
_context . next = 6 ;
break ;
}
return _context . abrupt ( "return" ) ;
case 6 :
store . dispatch ( startResolution ( selectorName , args ) ) ;
_context . next = 9 ;
return fulfillResolver . apply ( void 0 , [ store , mappedResolvers , selectorName ] . concat ( args ) ) ;
case 9 :
store . dispatch ( finishResolution ( selectorName , args ) ) ;
case 10 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee ) ;
} ) ) ;
return _fulfillSelector . apply ( this , arguments ) ;
}
fulfillSelector . apply ( void 0 , args ) ;
return selector . apply ( void 0 , args ) ;
} ;
selectorResolver . hasResolver = true ;
return selectorResolver ;
} ;
return {
resolvers : mappedResolvers ,
2020-01-03 08:17:24 -05:00
selectors : Object ( external _this _lodash _ [ "mapValues" ] ) ( selectors , mapSelector )
2019-09-19 11:19:18 -04:00
} ;
}
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Calls a resolver given arguments
*
* @ param { Object } store Store reference , for fulfilling via resolvers
* @ param { Object } resolvers Store Resolvers
* @ param { string } selectorName Selector name to fulfill .
* @ param { Array } args Selector Arguments .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function fulfillResolver ( _x , _x2 , _x3 ) {
return _fulfillResolver . apply ( this , arguments ) ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function _fulfillResolver ( ) {
2020-06-26 09:33:47 -04:00
_fulfillResolver = Object ( asyncToGenerator [ "a" /* default */ ] ) ( /*#__PURE__*/ external _this _regeneratorRuntime _default . a . mark ( function _callee2 ( store , resolvers , selectorName ) {
2019-09-19 11:19:18 -04:00
var resolver ,
_len4 ,
args ,
_key4 ,
action ,
_args2 = arguments ;
2018-12-13 23:41:57 -05:00
2020-01-03 08:17:24 -05:00
return external _this _regeneratorRuntime _default . a . wrap ( function _callee2$ ( _context2 ) {
2019-09-19 11:19:18 -04:00
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
2020-01-03 08:17:24 -05:00
resolver = Object ( external _this _lodash _ [ "get" ] ) ( resolvers , [ selectorName ] ) ;
2019-09-19 11:19:18 -04:00
if ( resolver ) {
_context2 . next = 3 ;
break ;
}
return _context2 . abrupt ( "return" ) ;
case 3 :
for ( _len4 = _args2 . length , args = new Array ( _len4 > 3 ? _len4 - 3 : 0 ) , _key4 = 3 ; _key4 < _len4 ; _key4 ++ ) {
args [ _key4 - 3 ] = _args2 [ _key4 ] ;
}
action = resolver . fulfill . apply ( resolver , args ) ;
if ( ! action ) {
_context2 . next = 8 ;
break ;
}
_context2 . next = 8 ;
return store . dispatch ( action ) ;
case 8 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 ) ;
} ) ) ;
return _fulfillResolver . apply ( this , arguments ) ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/store/index.js
2020-02-06 16:03:31 -05:00
function store _ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function store _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { store _ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { store _ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
2019-09-19 11:19:18 -04:00
function createCoreDataStore ( registry ) {
var getCoreDataSelector = function getCoreDataSelector ( selectorName ) {
return function ( reducerKey ) {
var _registry$select ;
for ( var _len = arguments . length , args = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
args [ _key - 1 ] = arguments [ _key ] ;
}
return ( _registry$select = registry . select ( reducerKey ) ) [ selectorName ] . apply ( _registry$select , args ) ;
} ;
} ;
var getCoreDataAction = function getCoreDataAction ( actionName ) {
return function ( reducerKey ) {
var _registry$dispatch ;
for ( var _len2 = arguments . length , args = new Array ( _len2 > 1 ? _len2 - 1 : 0 ) , _key2 = 1 ; _key2 < _len2 ; _key2 ++ ) {
args [ _key2 - 1 ] = arguments [ _key2 ] ;
}
return ( _registry$dispatch = registry . dispatch ( reducerKey ) ) [ actionName ] . apply ( _registry$dispatch , args ) ;
} ;
} ;
return {
getSelectors : function getSelectors ( ) {
return [ 'getIsResolving' , 'hasStartedResolution' , 'hasFinishedResolution' , 'isResolving' , 'getCachedResolvers' ] . reduce ( function ( memo , selectorName ) {
2020-02-06 16:03:31 -05:00
return store _objectSpread ( { } , memo , Object ( defineProperty [ "a" /* default */ ] ) ( { } , selectorName , getCoreDataSelector ( selectorName ) ) ) ;
2019-09-19 11:19:18 -04:00
} , { } ) ;
} ,
getActions : function getActions ( ) {
return [ 'startResolution' , 'finishResolution' , 'invalidateResolution' , 'invalidateResolutionForStore' , 'invalidateResolutionForStoreSelector' ] . reduce ( function ( memo , actionName ) {
2020-02-06 16:03:31 -05:00
return store _objectSpread ( { } , memo , Object ( defineProperty [ "a" /* default */ ] ) ( { } , actionName , getCoreDataAction ( actionName ) ) ) ;
2019-09-19 11:19:18 -04:00
} , { } ) ;
} ,
subscribe : function subscribe ( ) {
// There's no reasons to trigger any listener when we subscribe to this store
// because there's no state stored in this store that need to retrigger selectors
// if a change happens, the corresponding store where the tracking stated live
// would have already triggered a "subscribe" call.
return function ( ) { } ;
}
} ;
}
/* harmony default export */ var build _module _store = ( createCoreDataStore ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/registry.js
2018-12-13 23:41:57 -05:00
2020-02-06 16:03:31 -05:00
function registry _ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function registry _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { registry _ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { registry _ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
2018-12-13 23:41:57 -05:00
/ * *
* External dependencies
* /
2020-01-08 06:57:23 -05:00
2018-12-13 23:41:57 -05:00
/ * *
* Internal dependencies
* /
2019-03-07 04:09:59 -05:00
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* @ typedef { Object } WPDataRegistry An isolated orchestrator of store registrations .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* @ property { Function } registerGenericStore Given a namespace key and settings
* object , registers a new generic
* store .
* @ property { Function } registerStore Given a namespace key and settings
* object , registers a new namespace
* store .
* @ property { Function } subscribe Given a function callback , invokes
* the callback on any change to state
* within any registered store .
* @ property { Function } select Given a namespace key , returns an
* object of the store ' s registered
* selectors .
* @ property { Function } dispatch Given a namespace key , returns an
* object of the store ' s registered
* action dispatchers .
2018-12-13 23:41:57 -05:00
* /
2018-12-17 22:14:52 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* @ typedef { Object } WPDataPlugin An object of registry function overrides .
2020-06-26 09:33:47 -04:00
*
* @ property { Function } registerStore registers store .
2018-12-17 22:14:52 -05:00
* /
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Creates a new store registry , given an optional object of initial store
* configurations .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { Object } storeConfigs Initial store configurations .
* @ param { Object ? } parent Parent registry .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ return { WPDataRegistry } Data registry .
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
function createRegistry ( ) {
var storeConfigs = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var parent = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ;
var stores = { } ;
var listeners = [ ] ;
/ * *
* Global listener called for each store ' s update .
* /
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
function globalListener ( ) {
listeners . forEach ( function ( listener ) {
return listener ( ) ;
} ) ;
}
/ * *
* Subscribe to changes to any data .
*
* @ param { Function } listener Listener function .
*
* @ return { Function } Unsubscribe function .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var subscribe = function subscribe ( listener ) {
listeners . push ( listener ) ;
return function ( ) {
2020-01-03 08:17:24 -05:00
listeners = Object ( external _this _lodash _ [ "without" ] ) ( listeners , listener ) ;
2019-09-19 11:19:18 -04:00
} ;
} ;
2018-12-17 22:14:52 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Calls a selector given the current state and extra arguments .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { string } reducerKey Part of the state shape to register the
* selectors for .
*
* @ return { * } The selector ' s returned value .
2018-12-17 22:14:52 -05:00
* /
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
2019-09-19 11:19:18 -04:00
function select ( reducerKey ) {
var store = stores [ reducerKey ] ;
if ( store ) {
return store . getSelectors ( ) ;
2018-12-17 22:14:52 -05:00
}
2019-09-19 11:19:18 -04:00
return parent && parent . select ( reducerKey ) ;
2018-12-13 23:41:57 -05:00
}
2020-01-08 06:57:23 -05:00
var getResolveSelectors = memize _default ( ) ( function ( selectors ) {
return Object ( external _this _lodash _ [ "mapValues" ] ) ( Object ( external _this _lodash _ [ "omit" ] ) ( selectors , [ 'getIsResolving' , 'hasStartedResolution' , 'hasFinishedResolution' , 'isResolving' , 'getCachedResolvers' ] ) , function ( selector , selectorName ) {
return function ( ) {
for ( var _len = arguments . length , args = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
args [ _key ] = arguments [ _key ] ;
}
return new Promise ( function ( resolve ) {
var hasFinished = function hasFinished ( ) {
return selectors . hasFinishedResolution ( selectorName , args ) ;
} ;
var getResult = function getResult ( ) {
return selector . apply ( null , args ) ;
} ; // trigger the selector (to trigger the resolver)
var result = getResult ( ) ;
if ( hasFinished ( ) ) {
return resolve ( result ) ;
}
var unsubscribe = subscribe ( function ( ) {
if ( hasFinished ( ) ) {
unsubscribe ( ) ;
resolve ( getResult ( ) ) ;
}
} ) ;
} ) ;
} ;
} ) ;
} , {
maxSize : 1
} ) ;
/ * *
2020-01-22 17:06:21 -05:00
* Given the name of a registered store , returns an object containing the store ' s
* selectors pre - bound to state so that you only need to supply additional arguments ,
* and modified so that they return promises that resolve to their eventual values ,
* after any resolvers have ran .
2020-01-08 06:57:23 -05:00
*
* @ param { string } reducerKey Part of the state shape to register the
* selectors for .
*
* @ return { Object } Each key of the object matches the name of a selector .
* /
function _ _experimentalResolveSelect ( reducerKey ) {
return getResolveSelectors ( select ( reducerKey ) ) ;
}
2018-12-17 22:14:52 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* Returns the available actions for a part of the state .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ param { string } reducerKey Part of the state shape to dispatch the
* action for .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ return { * } The action ' s returned value .
2018-12-17 22:14:52 -05:00
* /
2018-12-14 06:02:53 -05:00
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
function dispatch ( reducerKey ) {
var store = stores [ reducerKey ] ;
if ( store ) {
return store . getActions ( ) ;
2019-03-07 04:09:59 -05:00
}
2019-09-19 11:19:18 -04:00
return parent && parent . dispatch ( reducerKey ) ;
} //
// Deprecated
// TODO: Remove this after `use()` is removed.
//
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function withPlugins ( attributes ) {
2020-01-03 08:17:24 -05:00
return Object ( external _this _lodash _ [ "mapValues" ] ) ( attributes , function ( attribute , key ) {
2019-09-19 11:19:18 -04:00
if ( typeof attribute !== 'function' ) {
return attribute ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return function ( ) {
return registry [ key ] . apply ( null , arguments ) ;
} ;
} ) ;
2018-12-17 22:14:52 -05:00
}
2019-09-19 11:19:18 -04:00
/ * *
* Registers a generic store .
*
* @ param { string } key Store registry key .
* @ param { Object } config Configuration ( getSelectors , getActions , subscribe ) .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function registerGenericStore ( key , config ) {
if ( typeof config . getSelectors !== 'function' ) {
throw new TypeError ( 'config.getSelectors must be a function' ) ;
2018-12-17 22:14:52 -05:00
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof config . getActions !== 'function' ) {
throw new TypeError ( 'config.getActions must be a function' ) ;
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
if ( typeof config . subscribe !== 'function' ) {
throw new TypeError ( 'config.subscribe must be a function' ) ;
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
stores [ key ] = config ;
config . subscribe ( globalListener ) ;
2019-03-07 04:09:59 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var registry = {
registerGenericStore : registerGenericStore ,
stores : stores ,
namespaces : stores ,
// TODO: Deprecate/remove this.
subscribe : subscribe ,
select : select ,
2020-01-08 06:57:23 -05:00
_ _experimentalResolveSelect : _ _experimentalResolveSelect ,
2019-09-19 11:19:18 -04:00
dispatch : dispatch ,
use : use
} ;
/ * *
* Registers a standard ` @wordpress/data ` store .
*
* @ param { string } reducerKey Reducer key .
* @ param { Object } options Store description ( reducer , actions , selectors , resolvers ) .
*
* @ return { Object } Registered store object .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
registry . registerStore = function ( reducerKey , options ) {
if ( ! options . reducer ) {
throw new TypeError ( 'Must specify store reducer' ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var namespace = createNamespace ( reducerKey , options , registry ) ;
registerGenericStore ( reducerKey , namespace ) ;
return namespace . store ;
} ; //
// TODO:
// This function will be deprecated as soon as it is no longer internally referenced.
//
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function use ( plugin , options ) {
2020-02-06 16:03:31 -05:00
registry = registry _objectSpread ( { } , registry , { } , plugin ( registry , options ) ) ;
2019-09-19 11:19:18 -04:00
return registry ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
registerGenericStore ( 'core/data' , build _module _store ( registry ) ) ;
Object . entries ( storeConfigs ) . forEach ( function ( _ref ) {
var _ref2 = Object ( slicedToArray [ "a" /* default */ ] ) ( _ref , 2 ) ,
name = _ref2 [ 0 ] ,
config = _ref2 [ 1 ] ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return registry . registerStore ( name , config ) ;
} ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( parent ) {
parent . subscribe ( globalListener ) ;
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
return withPlugins ( registry ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/default-registry.js
2018-12-17 22:14:52 -05:00
/ * *
* Internal dependencies
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/* harmony default export */ var default _registry = ( createRegistry ( ) ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","deprecated"]}
2020-03-23 19:40:19 -04:00
var external _this _wp _deprecated _ = _ _webpack _require _ _ ( 37 ) ;
2019-09-19 11:19:18 -04:00
var external _this _wp _deprecated _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _wp _deprecated _ ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/controls/index.js
2019-03-07 04:09:59 -05:00
/ * *
* WordPress dependencies
* /
2019-09-19 11:19:18 -04:00
/* harmony default export */ var controls = ( function ( registry ) {
external _this _wp _deprecated _default ( ) ( 'wp.data.plugins.controls' , {
hint : 'The controls plugins is now baked-in.'
} ) ;
return registry ;
} ) ;
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/object.js
var objectStorage ;
var object _storage = {
getItem : function getItem ( key ) {
if ( ! objectStorage || ! objectStorage [ key ] ) {
return null ;
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
return objectStorage [ key ] ;
} ,
setItem : function setItem ( key , value ) {
if ( ! objectStorage ) {
object _storage . clear ( ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
objectStorage [ key ] = String ( value ) ;
} ,
clear : function clear ( ) {
objectStorage = Object . create ( null ) ;
}
} ;
/* harmony default export */ var object = ( object _storage ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/default.js
/ * *
* Internal dependencies
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var default _storage ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
try {
// Private Browsing in Safari 10 and earlier will throw an error when
// attempting to set into localStorage. The test here is intentional in
// causing a thrown error as condition for using fallback object storage.
default _storage = window . localStorage ;
default _storage . setItem ( '__wpDataTestLocalStorage' , '' ) ;
default _storage . removeItem ( '__wpDataTestLocalStorage' ) ;
} catch ( error ) {
default _storage = object ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/* harmony default export */ var storage _default = ( default _storage ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/index.js
2018-12-13 23:41:57 -05:00
2020-02-06 16:03:31 -05:00
function persistence _ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function persistence _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { persistence _ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { persistence _ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* External dependencies
2018-12-13 23:41:57 -05:00
* /
2018-12-17 22:14:52 -05:00
/ * *
* Internal dependencies
* /
2018-12-13 23:41:57 -05:00
2019-03-07 04:09:59 -05:00
2020-01-08 06:57:23 -05:00
/** @typedef {import('../../registry').WPDataRegistry} WPDataRegistry */
/** @typedef {import('../../registry').WPDataPlugin} WPDataPlugin */
2018-12-17 22:14:52 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* @ typedef { Object } WPDataPersistencePluginOptions Persistence plugin options .
2018-12-17 22:14:52 -05:00
*
2019-09-19 11:19:18 -04:00
* @ property { Storage } storage Persistent storage implementation . This must
* at least implement ` getItem ` and ` setItem ` of
* the Web Storage API .
* @ property { string } storageKey Key on which to set in persistent storage .
2018-12-17 22:14:52 -05:00
*
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/ * *
* Default plugin storage .
*
* @ type { Storage }
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var DEFAULT _STORAGE = storage _default ;
/ * *
* Default plugin storage key .
*
* @ type { string }
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var DEFAULT _STORAGE _KEY = 'WP_DATA' ;
/ * *
* Higher - order reducer which invokes the original reducer only if state is
* inequal from that of the action ' s ` nextState ` property , otherwise returning
* the original state reference .
*
* @ param { Function } reducer Original reducer .
*
* @ return { Function } Enhanced reducer .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var withLazySameState = function withLazySameState ( reducer ) {
return function ( state , action ) {
if ( action . nextState === state ) {
return state ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return reducer ( state , action ) ;
} ;
} ;
/ * *
* Creates a persistence interface , exposing getter and setter methods ( ` get `
* and ` set ` respectively ) .
*
* @ param { WPDataPersistencePluginOptions } options Plugin options .
*
* @ return { Object } Persistence interface .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function createPersistenceInterface ( options ) {
var _options$storage = options . storage ,
storage = _options$storage === void 0 ? DEFAULT _STORAGE : _options$storage ,
_options$storageKey = options . storageKey ,
storageKey = _options$storageKey === void 0 ? DEFAULT _STORAGE _KEY : _options$storageKey ;
var data ;
/ * *
* Returns the persisted data as an object , defaulting to an empty object .
*
* @ return { Object } Persisted data .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function getData ( ) {
if ( data === undefined ) {
// If unset, getItem is expected to return null. Fall back to
// empty object.
var persisted = storage . getItem ( storageKey ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( persisted === null ) {
data = { } ;
} else {
try {
data = JSON . parse ( persisted ) ;
} catch ( error ) {
// Similarly, should any error be thrown during parse of
// the string (malformed JSON), fall back to empty object.
data = { } ;
}
2018-12-17 22:14:52 -05:00
}
2019-09-19 11:19:18 -04:00
}
return data ;
}
/ * *
* Merges an updated reducer state into the persisted data .
*
* @ param { string } key Key to update .
* @ param { * } value Updated value .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function setData ( key , value ) {
2020-02-06 16:03:31 -05:00
data = persistence _objectSpread ( { } , data , Object ( defineProperty [ "a" /* default */ ] ) ( { } , key , value ) ) ;
2019-09-19 11:19:18 -04:00
storage . setItem ( storageKey , JSON . stringify ( data ) ) ;
}
2019-03-07 04:09:59 -05:00
2019-09-19 11:19:18 -04:00
return {
get : getData ,
set : setData
} ;
}
/ * *
* Data plugin to persist store state into a single storage key .
*
* @ param { WPDataRegistry } registry Data registry .
* @ param { ? WPDataPersistencePluginOptions } pluginOptions Plugin options .
*
* @ return { WPDataPlugin } Data plugin .
* /
2018-12-13 23:41:57 -05:00
2020-06-26 09:33:47 -04:00
function persistencePlugin ( registry , pluginOptions ) {
2019-09-19 11:19:18 -04:00
var persistence = createPersistenceInterface ( pluginOptions ) ;
/ * *
* Creates an enhanced store dispatch function , triggering the state of the
* given reducer key to be persisted when changed .
*
* @ param { Function } getState Function which returns current state .
* @ param { string } reducerKey Reducer key .
* @ param { ? Array < string > } keys Optional subset of keys to save .
*
* @ return { Function } Enhanced dispatch function .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function createPersistOnChange ( getState , reducerKey , keys ) {
var getPersistedState ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( Array . isArray ( keys ) ) {
// Given keys, the persisted state should by produced as an object
// of the subset of keys. This implementation uses combineReducers
// to leverage its behavior of returning the same object when none
// of the property values changes. This allows a strict reference
// equality to bypass a persistence set on an unchanging state.
2020-01-08 06:57:23 -05:00
var reducers = keys . reduce ( function ( accumulator , key ) {
return Object . assign ( accumulator , Object ( defineProperty [ "a" /* default */ ] ) ( { } , key , function ( state , action ) {
2019-09-19 11:19:18 -04:00
return action . nextState [ key ] ;
} ) ) ;
} , { } ) ;
getPersistedState = withLazySameState ( turbo _combine _reducers _default ( ) ( reducers ) ) ;
} else {
getPersistedState = function getPersistedState ( state , action ) {
return action . nextState ;
} ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var lastState = getPersistedState ( undefined , {
nextState : getState ( )
} ) ;
return function ( ) {
var state = getPersistedState ( lastState , {
nextState : getState ( )
} ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( state !== lastState ) {
persistence . set ( reducerKey , state ) ;
lastState = state ;
}
} ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
return {
registerStore : function registerStore ( reducerKey , options ) {
if ( ! options . persist ) {
return registry . registerStore ( reducerKey , options ) ;
} // Load from persistence to use as initial state.
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var persistedState = persistence . get ( ) [ reducerKey ] ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
if ( persistedState !== undefined ) {
2020-06-26 09:33:47 -04:00
var initialState = options . reducer ( options . initialState , {
2019-09-19 11:19:18 -04:00
type : '@@WP/PERSISTENCE_RESTORE'
} ) ;
2018-12-13 23:41:57 -05:00
2020-01-03 08:17:24 -05:00
if ( Object ( external _this _lodash _ [ "isPlainObject" ] ) ( initialState ) && Object ( external _this _lodash _ [ "isPlainObject" ] ) ( persistedState ) ) {
2019-09-19 11:19:18 -04:00
// If state is an object, ensure that:
// - Other keys are left intact when persisting only a
// subset of keys.
// - New keys in what would otherwise be used as initial
// state are deeply merged as base for persisted value.
2020-01-03 08:17:24 -05:00
initialState = Object ( external _this _lodash _ [ "merge" ] ) ( { } , initialState , persistedState ) ;
2019-09-19 11:19:18 -04:00
} else {
// If there is a mismatch in object-likeness of default
// initial or persisted state, defer to persisted value.
initialState = persistedState ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2020-02-06 16:03:31 -05:00
options = persistence _objectSpread ( { } , options , {
2019-09-19 11:19:18 -04:00
initialState : initialState
2018-12-17 22:14:52 -05:00
} ) ;
2019-09-19 11:19:18 -04:00
}
var store = registry . registerStore ( reducerKey , options ) ;
store . subscribe ( createPersistOnChange ( store . getState , reducerKey , options . persist ) ) ;
return store ;
}
} ;
2020-06-26 09:33:47 -04:00
}
2019-09-19 11:19:18 -04:00
/ * *
2020-01-22 17:06:21 -05:00
* Deprecated : Remove this function and the code in WordPress Core that calls
* it once WordPress 5.4 is released .
2019-09-19 11:19:18 -04:00
* /
2018-12-13 23:41:57 -05:00
2020-06-26 09:33:47 -04:00
persistencePlugin . _ _unstableMigrate = function ( pluginOptions ) {
2020-01-22 17:06:21 -05:00
var persistence = createPersistenceInterface ( pluginOptions ) ;
var state = persistence . get ( ) ; // Migrate 'insertUsage' from 'core/editor' to 'core/block-editor'
2019-09-19 11:19:18 -04:00
2020-01-22 17:06:21 -05:00
var insertUsage = Object ( external _this _lodash _ [ "get" ] ) ( state , [ 'core/editor' , 'preferences' , 'insertUsage' ] ) ;
2019-09-19 11:19:18 -04:00
if ( insertUsage ) {
persistence . set ( 'core/block-editor' , {
preferences : {
insertUsage : insertUsage
}
} ) ;
2020-03-23 19:40:19 -04:00
}
var editPostState = state [ 'core/edit-post' ] ; // Default `fullscreenMode` to `false` if any persisted state had existed
// and the user hadn't made an explicit choice about fullscreen mode. This
// is needed since `fullscreenMode` previously did not have a default value
// and was implicitly false by its absence. It is now `true` by default, but
// this change is not intended to affect upgrades from earlier versions.
var hadPersistedState = Object . keys ( state ) . length > 0 ;
var hadFullscreenModePreference = Object ( external _this _lodash _ [ "has" ] ) ( state , [ 'core/edit-post' , 'preferences' , 'features' , 'fullscreenMode' ] ) ;
if ( hadPersistedState && ! hadFullscreenModePreference ) {
editPostState = Object ( external _this _lodash _ [ "merge" ] ) ( { } , editPostState , {
preferences : {
features : {
fullscreenMode : false
}
}
} ) ;
2020-01-22 17:06:21 -05:00
} // Migrate 'areTipsEnabled' from 'core/nux' to 'showWelcomeGuide' in 'core/edit-post'
var areTipsEnabled = Object ( external _this _lodash _ [ "get" ] ) ( state , [ 'core/nux' , 'preferences' , 'areTipsEnabled' ] ) ;
var hasWelcomeGuide = Object ( external _this _lodash _ [ "has" ] ) ( state , [ 'core/edit-post' , 'preferences' , 'features' , 'welcomeGuide' ] ) ;
if ( areTipsEnabled !== undefined && ! hasWelcomeGuide ) {
2020-03-23 19:40:19 -04:00
editPostState = Object ( external _this _lodash _ [ "merge" ] ) ( { } , editPostState , {
2020-01-22 17:06:21 -05:00
preferences : {
features : {
welcomeGuide : areTipsEnabled
}
}
2020-03-23 19:40:19 -04:00
} ) ;
}
if ( editPostState !== state [ 'core/edit-post' ] ) {
persistence . set ( 'core/edit-post' , editPostState ) ;
2019-09-19 11:19:18 -04:00
}
} ;
2018-12-13 23:41:57 -05:00
2020-06-26 09:33:47 -04:00
/* harmony default export */ var plugins _persistence = ( persistencePlugin ) ;
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/index.js
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
2020-06-26 09:33:47 -04:00
var esm _extends = _ _webpack _require _ _ ( 8 ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external _this _wp _element _ = _ _webpack _require _ _ ( 0 ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","compose"]}
2020-06-26 09:33:47 -04:00
var external _this _wp _compose _ = _ _webpack _require _ _ ( 9 ) ;
2018-12-13 23:41:57 -05:00
2020-02-06 16:03:31 -05:00
// EXTERNAL MODULE: external {"this":"React"}
2020-07-07 10:43:35 -04:00
var external _this _React _ = _ _webpack _require _ _ ( 16 ) ;
2020-02-06 16:03:31 -05:00
// CONCATENATED MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
function areInputsEqual ( newInputs , lastInputs ) {
if ( newInputs . length !== lastInputs . length ) {
return false ;
}
for ( var i = 0 ; i < newInputs . length ; i ++ ) {
if ( newInputs [ i ] !== lastInputs [ i ] ) {
return false ;
}
}
return true ;
}
function useMemoOne ( getResult , inputs ) {
var initial = Object ( external _this _React _ [ "useState" ] ) ( function ( ) {
return {
inputs : inputs ,
result : getResult ( )
} ;
} ) [ 0 ] ;
var committed = Object ( external _this _React _ [ "useRef" ] ) ( initial ) ;
var isInputMatch = Boolean ( inputs && committed . current . inputs && areInputsEqual ( inputs , committed . current . inputs ) ) ;
var cache = isInputMatch ? committed . current : {
inputs : inputs ,
result : getResult ( )
} ;
Object ( external _this _React _ [ "useEffect" ] ) ( function ( ) {
committed . current = cache ;
} , [ cache ] ) ;
return cache . result ;
}
function useCallbackOne ( callback , inputs ) {
return useMemoOne ( function ( ) {
return callback ;
} , inputs ) ;
}
var useMemo = useMemoOne ;
var useCallback = useCallbackOne ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","priorityQueue"]}
2020-07-07 12:08:28 -04:00
var external _this _wp _priorityQueue _ = _ _webpack _require _ _ ( 143 ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
2020-06-26 09:33:47 -04:00
var external _this _wp _isShallowEqual _ = _ _webpack _require _ _ ( 55 ) ;
2019-09-19 11:19:18 -04:00
var external _this _wp _isShallowEqual _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _wp _isShallowEqual _ ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/context.js
2018-12-13 23:41:57 -05:00
/ * *
2018-12-17 22:14:52 -05:00
* WordPress dependencies
2018-12-13 23:41:57 -05:00
* /
/ * *
2018-12-17 22:14:52 -05:00
* Internal dependencies
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
var Context = Object ( external _this _wp _element _ [ "createContext" ] ) ( default _registry ) ;
var Consumer = Context . Consumer ,
Provider = Context . Provider ;
2018-12-13 23:41:57 -05:00
/ * *
2019-09-19 11:19:18 -04:00
* A custom react Context consumer exposing the provided ` registry ` to
* children components . Used along with the RegistryProvider .
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* You can read more about the react context api here :
* https : //reactjs.org/docs/context.html#contextprovider
2018-12-13 23:41:57 -05:00
*
2019-09-19 11:19:18 -04:00
* @ example
* ` ` ` js
* const {
* RegistryProvider ,
* RegistryConsumer ,
* createRegistry
* } = wp . data ;
*
* const registry = createRegistry ( { } ) ;
*
* const App = ( { props } ) => {
* return < RegistryProvider value = { registry } >
* < div > Hello There < / d i v >
* < RegistryConsumer >
* { ( registry ) => (
* < ComponentUsingRegistry
* { ... props }
* registry = { registry }
* ) }
* < / R e g i s t r y C o n s u m e r >
* < / R e g i s t r y P r o v i d e r >
* }
* ` ` `
2018-12-13 23:41:57 -05:00
* /
2019-09-19 11:19:18 -04:00
var RegistryConsumer = Consumer ;
/ * *
* A custom Context provider for exposing the provided ` registry ` to children
* components via a consumer .
*
* See < a name = "#RegistryConsumer" > RegistryConsumer < / a > d o c u m e n t a t i o n f o r
* example .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/* harmony default export */ var context = ( Provider ) ;
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/use-registry.js
/ * *
* WordPress dependencies
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/ * *
* Internal dependencies
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
/ * *
* A custom react hook exposing the registry context for use .
*
* This exposes the ` registry ` value provided via the
* < a href = "#RegistryProvider" > Registry Provider < / a > t o a c o m p o n e n t i m p l e m e n t i n g
* this hook .
*
* It acts similarly to the ` useContext ` react hook .
*
* Note : Generally speaking , ` useRegistry ` is a low level hook that in most cases
* won ' t be needed for implementation . Most interactions with the wp . data api
* can be performed via the ` useSelect ` hook , or the ` withSelect ` and
* ` withDispatch ` higher order components .
*
* @ example
* ` ` ` js
* const {
* RegistryProvider ,
* createRegistry ,
* useRegistry ,
* } = wp . data
*
* const registry = createRegistry ( { } ) ;
*
* const SomeChildUsingRegistry = ( props ) => {
* const registry = useRegistry ( registry ) ;
* // ...logic implementing the registry in other react hooks.
* } ;
*
*
* const ParentProvidingRegistry = ( props ) => {
* return < RegistryProvider value = { registry } >
* < SomeChildUsingRegistry { ... props } / >
* < / R e g i s t r y P r o v i d e r >
* } ;
* ` ` `
*
* @ return { Function } A custom react hook exposing the registry context value .
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
function useRegistry ( ) {
return Object ( external _this _wp _element _ [ "useContext" ] ) ( Context ) ;
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/context.js
/ * *
* WordPress dependencies
* /
var context _Context = Object ( external _this _wp _element _ [ "createContext" ] ) ( false ) ;
var context _Consumer = context _Context . Consumer ,
context _Provider = context _Context . Provider ;
var AsyncModeConsumer = context _Consumer ;
2020-01-08 06:57:23 -05:00
/ * *
* Context Provider Component used to switch the data module component rerendering
* between Sync and Async modes .
*
* @ example
*
* ` ` ` js
* import { useSelect , AsyncModeProvider } from '@wordpress/data' ;
*
* function BlockCount ( ) {
* const count = useSelect ( ( select ) => {
* return select ( 'core/block-editor' ) . getBlockCount ( )
2020-01-22 17:06:21 -05:00
* } , [ ] ) ;
2020-01-08 06:57:23 -05:00
*
* return count ;
* }
*
* function App ( ) {
* return (
* < AsyncModeProvider value = { true } >
* < BlockCount / >
* < / A s y n c M o d e P r o v i d e r >
* ) ;
* }
* ` ` `
*
* In this example , the BlockCount component is rerendered asynchronously .
* It means if a more critical task is being performed ( like typing in an input ) ,
* the rerendering is delayed until the browser becomes IDLE .
* It is possible to nest multiple levels of AsyncModeProvider to fine - tune the rendering behavior .
*
* @ param { boolean } props . value Enable Async Mode .
* @ return { WPComponent } The component to be rendered .
* /
2019-09-19 11:19:18 -04:00
/* harmony default export */ var async _mode _provider _context = ( context _Provider ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/use-async-mode.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function useAsyncMode ( ) {
return Object ( external _this _wp _element _ [ "useContext" ] ) ( context _Context ) ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-select/index.js
2020-02-06 16:03:31 -05:00
/ * *
* External dependencies
* /
2019-09-19 11:19:18 -04:00
/ * *
* WordPress dependencies
* /
2020-02-06 16:03:31 -05:00
2019-09-19 11:19:18 -04:00
/ * *
* Internal dependencies
* /
/ * *
* Favor useLayoutEffect to ensure the store subscription callback always has
* the selector from the latest render . If a store update happens between render
* and the effect , this could cause missed / stale updates or inconsistent state .
*
* Fallback to useEffect for server rendered components because currently React
* throws a warning when using useLayoutEffect in that environment .
* /
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external _this _wp _element _ [ "useLayoutEffect" ] : external _this _wp _element _ [ "useEffect" ] ;
var renderQueue = Object ( external _this _wp _priorityQueue _ [ "createQueue" ] ) ( ) ;
/ * *
* Custom react hook for retrieving props from registered selectors .
*
* In general , this custom React hook follows the
* [ rules of hooks ] ( https : //reactjs.org/docs/hooks-rules.html).
*
* @ param { Function } _mapSelect Function called on every state change . The
* returned value is exposed to the component
* implementing this hook . The function receives
* the ` registry.select ` method on the first
* argument and the ` registry ` on the second
* argument .
* @ param { Array } deps If provided , this memoizes the mapSelect so the
* same ` mapSelect ` is invoked on every state
* change unless the dependencies change .
*
* @ example
* ` ` ` js
* const { useSelect } = wp . data ;
*
* function HammerPriceDisplay ( { currency } ) {
* const price = useSelect ( ( select ) => {
* return select ( 'my-shop' ) . getPrice ( 'hammer' , currency )
* } , [ currency ] ) ;
* return new Intl . NumberFormat ( 'en-US' , {
* style : 'currency' ,
* currency ,
* } ) . format ( price ) ;
* }
*
* // Rendered in the application:
* // <HammerPriceDisplay currency="USD" />
* ` ` `
*
* In the above example , when ` HammerPriceDisplay ` is rendered into an
* application , the price will be retrieved from the store state using the
* ` mapSelect ` callback on ` useSelect ` . If the currency prop changes then
* any price in the state for that currency is retrieved . If the currency prop
* doesn ' t change and other props are passed in that do change , the price will
* not change because the dependency is just the currency .
*
* @ return { Function } A custom react hook .
* /
function useSelect ( _mapSelect , deps ) {
var mapSelect = Object ( external _this _wp _element _ [ "useCallback" ] ) ( _mapSelect , deps ) ;
var registry = useRegistry ( ) ;
2020-02-06 16:03:31 -05:00
var isAsync = useAsyncMode ( ) ; // React can sometimes clear the `useMemo` cache.
// We use the cache-stable `useMemoOne` to avoid
// losing queues.
var queueContext = useMemoOne ( function ( ) {
2019-09-19 11:19:18 -04:00
return {
queue : true
} ;
} , [ registry ] ) ;
var _useReducer = Object ( external _this _wp _element _ [ "useReducer" ] ) ( function ( s ) {
return s + 1 ;
} , 0 ) ,
_useReducer2 = Object ( slicedToArray [ "a" /* default */ ] ) ( _useReducer , 2 ) ,
forceRender = _useReducer2 [ 1 ] ;
var latestMapSelect = Object ( external _this _wp _element _ [ "useRef" ] ) ( ) ;
var latestIsAsync = Object ( external _this _wp _element _ [ "useRef" ] ) ( isAsync ) ;
var latestMapOutput = Object ( external _this _wp _element _ [ "useRef" ] ) ( ) ;
var latestMapOutputError = Object ( external _this _wp _element _ [ "useRef" ] ) ( ) ;
2020-02-06 16:03:31 -05:00
var isMountedAndNotUnsubscribing = Object ( external _this _wp _element _ [ "useRef" ] ) ( ) ;
2019-09-19 11:19:18 -04:00
var mapOutput ;
try {
if ( latestMapSelect . current !== mapSelect || latestMapOutputError . current ) {
mapOutput = mapSelect ( registry . select , registry ) ;
} else {
mapOutput = latestMapOutput . current ;
}
} catch ( error ) {
var errorMessage = "An error occurred while running 'mapSelect': " . concat ( error . message ) ;
if ( latestMapOutputError . current ) {
errorMessage += "\nThe error may be correlated with this previous error:\n" ;
errorMessage += "" . concat ( latestMapOutputError . current . stack , "\n\n" ) ;
errorMessage += 'Original stack trace:' ;
throw new Error ( errorMessage ) ;
2020-02-10 17:33:27 -05:00
} else {
// eslint-disable-next-line no-console
console . error ( errorMessage ) ;
2019-09-19 11:19:18 -04:00
}
}
useIsomorphicLayoutEffect ( function ( ) {
latestMapSelect . current = mapSelect ;
2020-02-06 16:03:31 -05:00
latestMapOutput . current = mapOutput ;
latestMapOutputError . current = undefined ;
isMountedAndNotUnsubscribing . current = true ; // This has to run after the other ref updates
// to avoid using stale values in the flushed
// callbacks or potentially overwriting a
// changed `latestMapOutput.current`.
2019-09-19 11:19:18 -04:00
if ( latestIsAsync . current !== isAsync ) {
latestIsAsync . current = isAsync ;
renderQueue . flush ( queueContext ) ;
}
} ) ;
useIsomorphicLayoutEffect ( function ( ) {
var onStoreChange = function onStoreChange ( ) {
2020-02-06 16:03:31 -05:00
if ( isMountedAndNotUnsubscribing . current ) {
2019-09-19 11:19:18 -04:00
try {
var newMapOutput = latestMapSelect . current ( registry . select , registry ) ;
if ( external _this _wp _isShallowEqual _default ( ) ( latestMapOutput . current , newMapOutput ) ) {
return ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
latestMapOutput . current = newMapOutput ;
} catch ( error ) {
latestMapOutputError . current = error ;
2018-12-17 22:14:52 -05:00
}
2018-12-13 23:41:57 -05:00
2020-01-22 17:06:21 -05:00
forceRender ( ) ;
2019-09-19 11:19:18 -04:00
}
} ; // catch any possible state changes during mount before the subscription
// could be set.
if ( latestIsAsync . current ) {
renderQueue . add ( queueContext , onStoreChange ) ;
} else {
onStoreChange ( ) ;
}
var unsubscribe = registry . subscribe ( function ( ) {
if ( latestIsAsync . current ) {
renderQueue . add ( queueContext , onStoreChange ) ;
} else {
onStoreChange ( ) ;
}
} ) ;
return function ( ) {
2020-02-06 16:03:31 -05:00
isMountedAndNotUnsubscribing . current = false ;
2019-09-19 11:19:18 -04:00
unsubscribe ( ) ;
renderQueue . flush ( queueContext ) ;
} ;
} , [ registry ] ) ;
return mapOutput ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-select/index.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Higher - order component used to inject state - derived props using registered
* selectors .
*
* @ param { Function } mapSelectToProps Function called on every state change ,
* expected to return object of props to
* merge with the component ' s own props .
*
* @ example
* ` ` ` js
* function PriceDisplay ( { price , currency } ) {
* return new Intl . NumberFormat ( 'en-US' , {
* style : 'currency' ,
* currency ,
* } ) . format ( price ) ;
* }
*
* const { withSelect } = wp . data ;
*
* const HammerPriceDisplay = withSelect ( ( select , ownProps ) => {
* const { getPrice } = select ( 'my-shop' ) ;
* const { currency } = ownProps ;
*
* return {
* price : getPrice ( 'hammer' , currency ) ,
* } ;
* } ) ( PriceDisplay ) ;
*
* // Rendered in the application:
* //
* // <HammerPriceDisplay currency="USD" />
* ` ` `
* In the above example , when ` HammerPriceDisplay ` is rendered into an
* application , it will pass the price into the underlying ` PriceDisplay `
* component and update automatically if the price of a hammer ever changes in
* the store .
*
2020-01-08 06:57:23 -05:00
* @ return { WPComponent } Enhanced component with merged state data props .
2019-09-19 11:19:18 -04:00
* /
var with _select _withSelect = function withSelect ( mapSelectToProps ) {
return Object ( external _this _wp _compose _ [ "createHigherOrderComponent" ] ) ( function ( WrappedComponent ) {
return Object ( external _this _wp _compose _ [ "pure" ] ) ( function ( ownProps ) {
var mapSelect = function mapSelect ( select , registry ) {
return mapSelectToProps ( select , ownProps , registry ) ;
} ;
var mergeProps = useSelect ( mapSelect ) ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( WrappedComponent , Object ( esm _extends [ "a" /* default */ ] ) ( { } , ownProps , mergeProps ) ) ;
} ) ;
} , 'withSelect' ) ;
} ;
/* harmony default export */ var with _select = ( with _select _withSelect ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch-with-map.js
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Favor useLayoutEffect to ensure the store subscription callback always has
* the dispatchMap from the latest render . If a store update happens between
* render and the effect , this could cause missed / stale updates or
* inconsistent state .
*
* Fallback to useEffect for server rendered components because currently React
* throws a warning when using useLayoutEffect in that environment .
* /
var use _dispatch _with _map _useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external _this _wp _element _ [ "useLayoutEffect" ] : external _this _wp _element _ [ "useEffect" ] ;
/ * *
* Custom react hook for returning aggregate dispatch actions using the provided
* dispatchMap .
*
* Currently this is an internal api only and is implemented by ` withDispatch `
*
* @ param { Function } dispatchMap Receives the ` registry.dispatch ` function as
* the first argument and the ` registry ` object
* as the second argument . Should return an
* object mapping props to functions .
* @ param { Array } deps An array of dependencies for the hook .
* @ return { Object } An object mapping props to functions created by the passed
* in dispatchMap .
* /
var use _dispatch _with _map _useDispatchWithMap = function useDispatchWithMap ( dispatchMap , deps ) {
var registry = useRegistry ( ) ;
var currentDispatchMap = Object ( external _this _wp _element _ [ "useRef" ] ) ( dispatchMap ) ;
use _dispatch _with _map _useIsomorphicLayoutEffect ( function ( ) {
currentDispatchMap . current = dispatchMap ;
} ) ;
return Object ( external _this _wp _element _ [ "useMemo" ] ) ( function ( ) {
var currentDispatchProps = currentDispatchMap . current ( registry . dispatch , registry ) ;
2020-01-03 08:17:24 -05:00
return Object ( external _this _lodash _ [ "mapValues" ] ) ( currentDispatchProps , function ( dispatcher , propName ) {
2019-09-19 11:19:18 -04:00
if ( typeof dispatcher !== 'function' ) {
// eslint-disable-next-line no-console
console . warn ( "Property " . concat ( propName , " returned from dispatchMap in useDispatchWithMap must be a function." ) ) ;
}
return function ( ) {
var _currentDispatchMap$c ;
return ( _currentDispatchMap$c = currentDispatchMap . current ( registry . dispatch , registry ) ) [ propName ] . apply ( _currentDispatchMap$c , arguments ) ;
} ;
} ) ;
} , [ registry ] . concat ( Object ( toConsumableArray [ "a" /* default */ ] ) ( deps ) ) ) ;
} ;
/* harmony default export */ var use _dispatch _with _map = ( use _dispatch _with _map _useDispatchWithMap ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-dispatch/index.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Higher - order component used to add dispatch props using registered action
* creators .
*
* @ param { Function } mapDispatchToProps A function of returning an object of
* prop names where value is a
* dispatch - bound action creator , or a
* function to be called with the
* component ' s props and returning an
* action creator .
*
* @ example
* ` ` ` jsx
* function Button ( { onClick , children } ) {
* return < button type = "button" onClick = { onClick } > { children } < / b u t t o n > ;
* }
*
* const { withDispatch } = wp . data ;
*
* const SaleButton = withDispatch ( ( dispatch , ownProps ) => {
* const { startSale } = dispatch ( 'my-shop' ) ;
* const { discountPercent } = ownProps ;
*
* return {
* onClick ( ) {
* startSale ( discountPercent ) ;
* } ,
* } ;
* } ) ( Button ) ;
*
* // Rendered in the application:
* //
* // <SaleButton discountPercent="20">Start Sale!</SaleButton>
* ` ` `
*
* @ example
* In the majority of cases , it will be sufficient to use only two first params
* passed to ` mapDispatchToProps ` as illustrated in the previous example .
* However , there might be some very advanced use cases where using the
* ` registry ` object might be used as a tool to optimize the performance of
* your component . Using ` select ` function from the registry might be useful
* when you need to fetch some dynamic data from the store at the time when the
* event is fired , but at the same time , you never use it to render your
* component . In such scenario , you can avoid using the ` withSelect ` higher
* order component to compute such prop , which might lead to unnecessary
* re - renders of your component caused by its frequent value change .
* Keep in mind , that ` mapDispatchToProps ` must return an object with functions
* only .
*
* ` ` ` jsx
* function Button ( { onClick , children } ) {
* return < button type = "button" onClick = { onClick } > { children } < / b u t t o n > ;
* }
*
* const { withDispatch } = wp . data ;
*
* const SaleButton = withDispatch ( ( dispatch , ownProps , { select } ) => {
* // Stock number changes frequently.
* const { getStockNumber } = select ( 'my-shop' ) ;
* const { startSale } = dispatch ( 'my-shop' ) ;
* return {
* onClick ( ) {
* const discountPercent = getStockNumber ( ) > 50 ? 10 : 20 ;
* startSale ( discountPercent ) ;
* } ,
* } ;
* } ) ( Button ) ;
*
* // Rendered in the application:
* //
* // <SaleButton>Start Sale!</SaleButton>
* ` ` `
*
* _Note : _ It is important that the ` mapDispatchToProps ` function always
* returns an object with the same keys . For example , it should not contain
* conditions under which a different value would be returned .
*
2020-01-08 06:57:23 -05:00
* @ return { WPComponent } Enhanced component with merged dispatcher props .
2019-09-19 11:19:18 -04:00
* /
2018-12-13 23:41:57 -05:00
2019-09-19 11:19:18 -04:00
var with _dispatch _withDispatch = function withDispatch ( mapDispatchToProps ) {
return Object ( external _this _wp _compose _ [ "createHigherOrderComponent" ] ) ( function ( WrappedComponent ) {
2018-12-17 22:14:52 -05:00
return function ( ownProps ) {
2019-09-19 11:19:18 -04:00
var mapDispatch = function mapDispatch ( dispatch , registry ) {
return mapDispatchToProps ( dispatch , ownProps , registry ) ;
} ;
var dispatchProps = use _dispatch _with _map ( mapDispatch , [ ] ) ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( WrappedComponent , Object ( esm _extends [ "a" /* default */ ] ) ( { } , ownProps , dispatchProps ) ) ;
2018-12-17 22:14:52 -05:00
} ;
} , 'withDispatch' ) ;
} ;
2018-12-13 23:41:57 -05:00
2018-12-17 22:14:52 -05:00
/* harmony default export */ var with _dispatch = ( with _dispatch _withDispatch ) ;
2019-03-21 08:48:00 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-registry/index.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Higher - order component which renders the original component with the current
* registry context passed as its ` registry ` prop .
*
* @ param { WPComponent } OriginalComponent Original component .
*
* @ return { WPComponent } Enhanced component .
* /
var withRegistry = Object ( external _this _wp _compose _ [ "createHigherOrderComponent" ] ) ( function ( OriginalComponent ) {
return function ( props ) {
return Object ( external _this _wp _element _ [ "createElement" ] ) ( RegistryConsumer , null , function ( registry ) {
return Object ( external _this _wp _element _ [ "createElement" ] ) ( OriginalComponent , Object ( esm _extends [ "a" /* default */ ] ) ( { } , props , {
registry : registry
} ) ) ;
} ) ;
} ;
} , 'withRegistry' ) ;
/* harmony default export */ var with _registry = ( withRegistry ) ;
2020-06-26 09:33:47 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch.js
/ * *
* Internal dependencies
* /
/ * *
* A custom react hook returning the current registry dispatch actions creators .
*
* Note : The component using this hook must be within the context of a
* RegistryProvider .
*
* @ param { string } [ storeName ] Optionally provide the name of the store from
* which to retrieve action creators . If not
* provided , the registry . dispatch function is
* returned instead .
*
* @ example
* This illustrates a pattern where you may need to retrieve dynamic data from
* the server via the ` useSelect ` hook to use in combination with the dispatch
* action .
*
* ` ` ` jsx
* const { useDispatch , useSelect } = wp . data ;
* const { useCallback } = wp . element ;
*
* function Button ( { onClick , children } ) {
* return < button type = "button" onClick = { onClick } > { children } < / b u t t o n >
* }
*
* const SaleButton = ( { children } ) => {
* const { stockNumber } = useSelect (
* ( select ) => select ( 'my-shop' ) . getStockNumber ( ) ,
* [ ]
* ) ;
* const { startSale } = useDispatch ( 'my-shop' ) ;
* const onClick = useCallback ( ( ) => {
* const discountPercent = stockNumber > 50 ? 10 : 20 ;
* startSale ( discountPercent ) ;
* } , [ stockNumber ] ) ;
* return < Button onClick = { onClick } > { children } < / B u t t o n >
* }
*
* // Rendered somewhere in the application:
* //
* // <SaleButton>Start Sale!</SaleButton>
* ` ` `
* @ return { Function } A custom react hook .
* /
var use _dispatch _useDispatch = function useDispatch ( storeName ) {
var _useRegistry = useRegistry ( ) ,
dispatch = _useRegistry . dispatch ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
return storeName === void 0 ? dispatch : dispatch ( storeName ) ;
} ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
/* harmony default export */ var use _dispatch = ( use _dispatch _useDispatch ) ;
2019-09-19 11:19:18 -04:00
2019-03-07 04:09:59 -05:00
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/factory.js
2019-09-19 11:19:18 -04:00
/ * *
* Internal dependencies
* /
2020-01-08 06:57:23 -05:00
/** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
2019-09-19 11:19:18 -04:00
2019-03-07 04:09:59 -05:00
/ * *
* Mark a selector as a registry selector .
*
2019-09-19 11:19:18 -04:00
* @ param { Function } registrySelector Function receiving a registry object and returning a state selector .
2019-03-07 04:09:59 -05:00
*
2019-09-19 11:19:18 -04:00
* @ return { Function } marked registry selector .
2019-03-07 04:09:59 -05:00
* /
2019-09-19 11:19:18 -04:00
2019-03-07 04:09:59 -05:00
function createRegistrySelector ( registrySelector ) {
2019-09-19 11:19:18 -04:00
var selector = function selector ( ) {
return registrySelector ( selector . registry . select ) . apply ( void 0 , arguments ) ;
} ;
/ * *
* Flag indicating to selector registration mapping that the selector should
* be mapped as a registry selector .
*
* @ type { boolean }
* /
selector . isRegistrySelector = true ;
/ * *
* Registry on which to call ` select ` , stubbed for non - standard usage to
* use the default registry .
*
* @ type { WPDataRegistry }
* /
selector . registry = default _registry ;
return selector ;
2019-03-07 04:09:59 -05:00
}
/ * *
* Mark a control as a registry control .
*
2019-09-19 11:19:18 -04:00
* @ param { Function } registryControl Function receiving a registry object and returning a control .
2019-03-07 04:09:59 -05:00
*
2019-09-19 11:19:18 -04:00
* @ return { Function } marked registry control .
2019-03-07 04:09:59 -05:00
* /
2019-03-21 08:48:00 -04:00
function createRegistryControl ( registryControl ) {
registryControl . isRegistryControl = true ;
return registryControl ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/index.js
/ * *
* External dependencies
* /
/ * *
* Internal dependencies
* /
2019-09-19 11:19:18 -04:00
/ * *
* Object of available plugins to use with a registry .
*
* @ see [ use ] ( # use )
*
* @ type { Object }
* /
2019-03-21 08:48:00 -04:00
/ * *
* The combineReducers helper function turns an object whose values are different
* reducing functions into a single reducing function you can pass to registerReducer .
*
* @ param { Object } reducers An object whose values correspond to different reducing
* functions that need to be combined into one .
*
2019-09-19 11:19:18 -04:00
* @ example
* ` ` ` js
* const { combineReducers , registerStore } = wp . data ;
*
* const prices = ( state = { } , action ) => {
* return action . type === 'SET_PRICE' ?
* {
* ... state ,
* [ action . item ] : action . price ,
* } :
* state ;
* } ;
*
* const discountPercent = ( state = 0 , action ) => {
* return action . type === 'START_SALE' ?
* action . discountPercent :
* state ;
* } ;
*
* registerStore ( 'my-shop' , {
* reducer : combineReducers ( {
* prices ,
* discountPercent ,
* } ) ,
* } ) ;
* ` ` `
*
2019-03-21 08:48:00 -04:00
* @ return { Function } A reducer that invokes every reducer inside the reducers
* object , and constructs a state object with the same shape .
* /
2019-09-19 11:19:18 -04:00
/ * *
* Given the name of a registered store , returns an object of the store ' s selectors .
* The selector functions are been pre - bound to pass the current state automatically .
* As a consumer , you need only pass arguments of the selector , if applicable .
*
2020-01-08 06:57:23 -05:00
* @ param { string } name Store name .
2019-09-19 11:19:18 -04:00
*
* @ example
* ` ` ` js
* const { select } = wp . data ;
*
* select ( 'my-shop' ) . getPrice ( 'hammer' ) ;
* ` ` `
*
* @ return { Object } Object containing the store ' s selectors .
* /
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
var build _module _select = default _registry . select ;
2020-01-08 06:57:23 -05:00
/ * *
* Given the name of a registered store , returns an object containing the store ' s
* selectors pre - bound to state so that you only need to supply additional arguments ,
* and modified so that they return promises that resolve to their eventual values ,
* after any resolvers have ran .
*
* @ param { string } name Store name .
*
* @ example
* ` ` ` js
* const { _ _experimentalResolveSelect } = wp . data ;
*
* _ _experimentalResolveSelect ( 'my-shop' ) . getPrice ( 'hammer' ) . then ( console . log )
* ` ` `
*
* @ return { Object } Object containing the store ' s promise - wrapped selectors .
* /
var build _module _experimentalResolveSelect = default _registry . _ _experimentalResolveSelect ;
2019-09-19 11:19:18 -04:00
/ * *
* Given the name of a registered store , returns an object of the store ' s action creators .
* Calling an action creator will cause it to be dispatched , updating the state value accordingly .
*
* Note : Action creators returned by the dispatch will return a promise when
* they are called .
*
2020-01-08 06:57:23 -05:00
* @ param { string } name Store name .
2019-09-19 11:19:18 -04:00
*
* @ example
* ` ` ` js
* const { dispatch } = wp . data ;
*
* dispatch ( 'my-shop' ) . setPrice ( 'hammer' , 9.75 ) ;
* ` ` `
* @ return { Object } Object containing the action creators .
* /
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
var build _module _dispatch = default _registry . dispatch ;
/ * *
* Given a listener function , the function will be called any time the state value
* of one of the registered stores has changed . This function returns a ` unsubscribe `
* function used to stop the subscription .
*
* @ param { Function } listener Callback function .
*
* @ example
* ` ` ` js
* const { subscribe } = wp . data ;
*
* const unsubscribe = subscribe ( ( ) => {
* // You could use this opportunity to test whether the derived result of a
* // selector has subsequently changed as the result of a state update.
* } ) ;
*
* // Later, if necessary...
* unsubscribe ( ) ;
* ` ` `
* /
2019-03-21 08:48:00 -04:00
2019-09-19 11:19:18 -04:00
var build _module _subscribe = default _registry . subscribe ;
/ * *
* Registers a generic store .
*
* @ param { string } key Store registry key .
* @ param { Object } config Configuration ( getSelectors , getActions , subscribe ) .
* /
var build _module _registerGenericStore = default _registry . registerGenericStore ;
/ * *
* Registers a standard ` @wordpress/data ` store .
*
* @ param { string } reducerKey Reducer key .
* @ param { Object } options Store description ( reducer , actions , selectors , resolvers ) .
*
* @ return { Object } Registered store object .
* /
var build _module _registerStore = default _registry . registerStore ;
/ * *
* Extends a registry to inherit functionality provided by a given plugin . A
* plugin is an object with properties aligning to that of a registry , merged
* to extend the default registry behavior .
*
* @ param { Object } plugin Plugin object .
* /
var build _module _use = default _registry . use ;
2019-03-21 08:48:00 -04:00
2019-10-15 11:37:08 -04:00
/***/ } ) ,
2020-03-23 19:40:19 -04:00
/***/ 46 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2019-10-15 11:37:08 -04:00
2020-06-26 09:33:47 -04:00
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _asyncToGenerator ; } ) ;
function asyncGeneratorStep ( gen , resolve , reject , _next , _throw , key , arg ) {
try {
var info = gen [ key ] ( arg ) ;
var value = info . value ;
} catch ( error ) {
reject ( error ) ;
return ;
}
2019-10-15 11:37:08 -04:00
2020-06-26 09:33:47 -04:00
if ( info . done ) {
resolve ( value ) ;
} else {
Promise . resolve ( value ) . then ( _next , _throw ) ;
}
}
2020-03-10 10:53:18 -04:00
2020-06-26 09:33:47 -04:00
function _asyncToGenerator ( fn ) {
return function ( ) {
var self = this ,
args = arguments ;
return new Promise ( function ( resolve , reject ) {
var gen = fn . apply ( self , args ) ;
function _next ( value ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "next" , value ) ;
}
function _throw ( err ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "throw" , err ) ;
}
_next ( undefined ) ;
} ) ;
} ;
}
/***/ } ) ,
/***/ 5 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _defineProperty ; } ) ;
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
return obj ;
}
/***/ } ) ,
/***/ 50 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/ * *
* Memize options object .
*
* @ typedef MemizeOptions
*
* @ property { number } [ maxSize ] Maximum size of the cache .
* /
/ * *
* Internal cache entry .
*
* @ typedef MemizeCacheNode
*
* @ property { ? MemizeCacheNode | undefined } [ prev ] Previous node .
* @ property { ? MemizeCacheNode | undefined } [ next ] Next node .
* @ property { Array < * > } args Function arguments for cache
* entry .
* @ property { * } val Function result .
* /
/ * *
* Properties of the enhanced function for controlling cache .
2020-03-10 10:53:18 -04:00
*
* @ typedef MemizeMemoizedFunction
*
* @ property { ( ) => void } clear Clear the cache .
* /
/ * *
* Accepts a function to be memoized , and returns a new memoized function , with
* optional options .
*
* @ template { Function } F
*
* @ param { F } fn Function to memoize .
* @ param { MemizeOptions } [ options ] Options object .
*
* @ return { F & MemizeMemoizedFunction } Memoized function .
* /
function memize ( fn , options ) {
var size = 0 ;
/** @type {?MemizeCacheNode|undefined} */
var head ;
/** @type {?MemizeCacheNode|undefined} */
var tail ;
options = options || { } ;
2019-10-15 11:37:08 -04:00
2020-01-08 06:57:23 -05:00
function memoized ( /* ...args */ ) {
var node = head ,
len = arguments . length ,
args , i ;
searchCache : while ( node ) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if ( node . args . length !== arguments . length ) {
node = node . next ;
continue ;
}
2019-10-15 11:37:08 -04:00
2020-01-08 06:57:23 -05:00
// Check whether node arguments match arguments values
for ( i = 0 ; i < len ; i ++ ) {
if ( node . args [ i ] !== arguments [ i ] ) {
node = node . next ;
continue searchCache ;
}
}
2019-10-15 11:37:08 -04:00
2020-01-08 06:57:23 -05:00
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== head ) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if ( node === tail ) {
tail = node . prev ;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
2020-03-10 10:53:18 -04:00
/** @type {MemizeCacheNode} */ ( node . prev ) . next = node . next ;
2020-01-08 06:57:23 -05:00
if ( node . next ) {
node . next . prev = node . prev ;
}
node . next = head ;
node . prev = null ;
2020-03-10 10:53:18 -04:00
/** @type {MemizeCacheNode} */ ( head ) . prev = node ;
2020-01-08 06:57:23 -05:00
head = node ;
}
2019-03-21 08:48:00 -04:00
2020-01-08 06:57:23 -05:00
// Return immediately
return node . val ;
}
2019-03-21 08:48:00 -04:00
2020-01-08 06:57:23 -05:00
// No cached value found. Continue to insertion phase:
2019-03-21 08:48:00 -04:00
2020-01-08 06:57:23 -05:00
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array ( len ) ;
for ( i = 0 ; i < len ; i ++ ) {
args [ i ] = arguments [ i ] ;
}
2019-03-21 08:48:00 -04:00
2020-01-08 06:57:23 -05:00
node = {
args : args ,
// Generate the result from original function
2020-03-10 10:53:18 -04:00
val : fn . apply ( null , args ) ,
2020-01-08 06:57:23 -05:00
} ;
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( head ) {
head . prev = node ;
node . next = head ;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node ;
}
// Trim tail if we're reached max size and are pending cache insertion
2020-03-10 10:53:18 -04:00
if ( size === /** @type {MemizeOptions} */ ( options ) . maxSize ) {
tail = /** @type {MemizeCacheNode} */ ( tail ) . prev ;
/** @type {MemizeCacheNode} */ ( tail ) . next = null ;
2020-01-08 06:57:23 -05:00
} else {
size ++ ;
}
head = node ;
return node . val ;
}
memoized . clear = function ( ) {
head = null ;
tail = null ;
size = 0 ;
} ;
if ( false ) { }
2020-03-10 10:53:18 -04:00
// Ignore reason: There's not a clear solution to create an intersection of
// the function with additional properties, where the goal is to retain the
// function signature of the incoming argument and add control properties
// on the return value.
// @ts-ignore
2020-01-08 06:57:23 -05:00
return memoized ;
2020-03-10 10:53:18 -04:00
}
module . exports = memize ;
2019-03-21 08:48:00 -04:00
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 55 :
2020-03-23 19:40:19 -04:00
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "isShallowEqual" ] ; } ( ) ) ;
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 8 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2018-12-17 22:14:52 -05:00
"use strict" ;
2020-06-26 09:33:47 -04:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _extends ; } ) ;
function _extends ( ) {
_extends = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
2018-12-17 22:14:52 -05:00
2020-06-26 09:33:47 -04:00
for ( var key in source ) {
if ( Object . prototype . hasOwnProperty . call ( source , key ) ) {
target [ key ] = source [ key ] ;
2018-12-17 22:14:52 -05:00
}
}
}
2020-06-26 09:33:47 -04:00
return target ;
} ;
2020-01-22 17:06:21 -05:00
2020-06-26 09:33:47 -04:00
return _extends . apply ( this , arguments ) ;
2020-01-22 17:06:21 -05:00
}
2018-12-13 23:41:57 -05:00
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 9 :
2019-06-27 07:28:19 -04:00
/***/ ( function ( module , exports ) {
2019-09-19 11:19:18 -04:00
( function ( ) { module . exports = this [ "wp" ] [ "compose" ] ; } ( ) ) ;
2019-06-27 07:28:19 -04:00
2018-12-13 23:41:57 -05:00
/***/ } )
2018-12-17 22:14:52 -05:00
/******/ } ) ;