Sin descripción

data.js 124KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018
  1. this["wp"] = this["wp"] || {}; this["wp"]["data"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "pfJ3");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "8mpt":
  90. /***/ (function(module, exports) {
  91. function combineReducers( reducers ) {
  92. var keys = Object.keys( reducers ),
  93. getNextState;
  94. getNextState = ( function() {
  95. var fn, i, key;
  96. fn = 'return {';
  97. for ( i = 0; i < keys.length; i++ ) {
  98. // Rely on Quoted escaping of JSON.stringify with guarantee that
  99. // each member of Object.keys is a string.
  100. //
  101. // "If Type(value) is String, then return the result of calling the
  102. // abstract operation Quote with argument value. [...] The abstract
  103. // operation Quote(value) wraps a String value in double quotes and
  104. // escapes characters within it."
  105. //
  106. // https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3
  107. key = JSON.stringify( keys[ i ] );
  108. fn += key + ':r[' + key + '](s[' + key + '],a),';
  109. }
  110. fn += '}';
  111. return new Function( 'r,s,a', fn );
  112. } )();
  113. return function combinedReducer( state, action ) {
  114. var nextState, i, key;
  115. // Assumed changed if initial state.
  116. if ( state === undefined ) {
  117. return getNextState( reducers, {}, action );
  118. }
  119. nextState = getNextState( reducers, state, action );
  120. // Determine whether state has changed.
  121. i = keys.length;
  122. while ( i-- ) {
  123. key = keys[ i ];
  124. if ( state[ key ] !== nextState[ key ] ) {
  125. // Return immediately if a changed value is encountered.
  126. return nextState;
  127. }
  128. }
  129. return state;
  130. };
  131. }
  132. module.exports = combineReducers;
  133. /***/ }),
  134. /***/ "FtRg":
  135. /***/ (function(module, exports, __webpack_require__) {
  136. "use strict";
  137. function _typeof(obj) {
  138. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  139. _typeof = function (obj) {
  140. return typeof obj;
  141. };
  142. } else {
  143. _typeof = function (obj) {
  144. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  145. };
  146. }
  147. return _typeof(obj);
  148. }
  149. function _classCallCheck(instance, Constructor) {
  150. if (!(instance instanceof Constructor)) {
  151. throw new TypeError("Cannot call a class as a function");
  152. }
  153. }
  154. function _defineProperties(target, props) {
  155. for (var i = 0; i < props.length; i++) {
  156. var descriptor = props[i];
  157. descriptor.enumerable = descriptor.enumerable || false;
  158. descriptor.configurable = true;
  159. if ("value" in descriptor) descriptor.writable = true;
  160. Object.defineProperty(target, descriptor.key, descriptor);
  161. }
  162. }
  163. function _createClass(Constructor, protoProps, staticProps) {
  164. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  165. if (staticProps) _defineProperties(Constructor, staticProps);
  166. return Constructor;
  167. }
  168. /**
  169. * Given an instance of EquivalentKeyMap, returns its internal value pair tuple
  170. * for a key, if one exists. The tuple members consist of the last reference
  171. * value for the key (used in efficient subsequent lookups) and the value
  172. * assigned for the key at the leaf node.
  173. *
  174. * @param {EquivalentKeyMap} instance EquivalentKeyMap instance.
  175. * @param {*} key The key for which to return value pair.
  176. *
  177. * @return {?Array} Value pair, if exists.
  178. */
  179. function getValuePair(instance, key) {
  180. var _map = instance._map,
  181. _arrayTreeMap = instance._arrayTreeMap,
  182. _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the
  183. // value, which can be used to shortcut immediately to the value.
  184. if (_map.has(key)) {
  185. return _map.get(key);
  186. } // Sort keys to ensure stable retrieval from tree.
  187. var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value.
  188. var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
  189. for (var i = 0; i < properties.length; i++) {
  190. var property = properties[i];
  191. map = map.get(property);
  192. if (map === undefined) {
  193. return;
  194. }
  195. var propertyValue = key[property];
  196. map = map.get(propertyValue);
  197. if (map === undefined) {
  198. return;
  199. }
  200. }
  201. var valuePair = map.get('_ekm_value');
  202. if (!valuePair) {
  203. return;
  204. } // If reached, it implies that an object-like key was set with another
  205. // reference, so delete the reference and replace with the current.
  206. _map.delete(valuePair[0]);
  207. valuePair[0] = key;
  208. map.set('_ekm_value', valuePair);
  209. _map.set(key, valuePair);
  210. return valuePair;
  211. }
  212. /**
  213. * Variant of a Map object which enables lookup by equivalent (deeply equal)
  214. * object and array keys.
  215. */
  216. var EquivalentKeyMap =
  217. /*#__PURE__*/
  218. function () {
  219. /**
  220. * Constructs a new instance of EquivalentKeyMap.
  221. *
  222. * @param {Iterable.<*>} iterable Initial pair of key, value for map.
  223. */
  224. function EquivalentKeyMap(iterable) {
  225. _classCallCheck(this, EquivalentKeyMap);
  226. this.clear();
  227. if (iterable instanceof EquivalentKeyMap) {
  228. // Map#forEach is only means of iterating with support for IE11.
  229. var iterablePairs = [];
  230. iterable.forEach(function (value, key) {
  231. iterablePairs.push([key, value]);
  232. });
  233. iterable = iterablePairs;
  234. }
  235. if (iterable != null) {
  236. for (var i = 0; i < iterable.length; i++) {
  237. this.set(iterable[i][0], iterable[i][1]);
  238. }
  239. }
  240. }
  241. /**
  242. * Accessor property returning the number of elements.
  243. *
  244. * @return {number} Number of elements.
  245. */
  246. _createClass(EquivalentKeyMap, [{
  247. key: "set",
  248. /**
  249. * Add or update an element with a specified key and value.
  250. *
  251. * @param {*} key The key of the element to add.
  252. * @param {*} value The value of the element to add.
  253. *
  254. * @return {EquivalentKeyMap} Map instance.
  255. */
  256. value: function set(key, value) {
  257. // Shortcut non-object-like to set on internal Map.
  258. if (key === null || _typeof(key) !== 'object') {
  259. this._map.set(key, value);
  260. return this;
  261. } // Sort keys to ensure stable assignment into tree.
  262. var properties = Object.keys(key).sort();
  263. var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value.
  264. var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
  265. for (var i = 0; i < properties.length; i++) {
  266. var property = properties[i];
  267. if (!map.has(property)) {
  268. map.set(property, new EquivalentKeyMap());
  269. }
  270. map = map.get(property);
  271. var propertyValue = key[property];
  272. if (!map.has(propertyValue)) {
  273. map.set(propertyValue, new EquivalentKeyMap());
  274. }
  275. map = map.get(propertyValue);
  276. } // If an _ekm_value exists, there was already an equivalent key. Before
  277. // overriding, ensure that the old key reference is removed from map to
  278. // avoid memory leak of accumulating equivalent keys. This is, in a
  279. // sense, a poor man's WeakMap, while still enabling iterability.
  280. var previousValuePair = map.get('_ekm_value');
  281. if (previousValuePair) {
  282. this._map.delete(previousValuePair[0]);
  283. }
  284. map.set('_ekm_value', valuePair);
  285. this._map.set(key, valuePair);
  286. return this;
  287. }
  288. /**
  289. * Returns a specified element.
  290. *
  291. * @param {*} key The key of the element to return.
  292. *
  293. * @return {?*} The element associated with the specified key or undefined
  294. * if the key can't be found.
  295. */
  296. }, {
  297. key: "get",
  298. value: function get(key) {
  299. // Shortcut non-object-like to get from internal Map.
  300. if (key === null || _typeof(key) !== 'object') {
  301. return this._map.get(key);
  302. }
  303. var valuePair = getValuePair(this, key);
  304. if (valuePair) {
  305. return valuePair[1];
  306. }
  307. }
  308. /**
  309. * Returns a boolean indicating whether an element with the specified key
  310. * exists or not.
  311. *
  312. * @param {*} key The key of the element to test for presence.
  313. *
  314. * @return {boolean} Whether an element with the specified key exists.
  315. */
  316. }, {
  317. key: "has",
  318. value: function has(key) {
  319. if (key === null || _typeof(key) !== 'object') {
  320. return this._map.has(key);
  321. } // Test on the _presence_ of the pair, not its value, as even undefined
  322. // can be a valid member value for a key.
  323. return getValuePair(this, key) !== undefined;
  324. }
  325. /**
  326. * Removes the specified element.
  327. *
  328. * @param {*} key The key of the element to remove.
  329. *
  330. * @return {boolean} Returns true if an element existed and has been
  331. * removed, or false if the element does not exist.
  332. */
  333. }, {
  334. key: "delete",
  335. value: function _delete(key) {
  336. if (!this.has(key)) {
  337. return false;
  338. } // This naive implementation will leave orphaned child trees. A better
  339. // implementation should traverse and remove orphans.
  340. this.set(key, undefined);
  341. return true;
  342. }
  343. /**
  344. * Executes a provided function once per each key/value pair, in insertion
  345. * order.
  346. *
  347. * @param {Function} callback Function to execute for each element.
  348. * @param {*} thisArg Value to use as `this` when executing
  349. * `callback`.
  350. */
  351. }, {
  352. key: "forEach",
  353. value: function forEach(callback) {
  354. var _this = this;
  355. var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
  356. this._map.forEach(function (value, key) {
  357. // Unwrap value from object-like value pair.
  358. if (key !== null && _typeof(key) === 'object') {
  359. value = value[1];
  360. }
  361. callback.call(thisArg, value, key, _this);
  362. });
  363. }
  364. /**
  365. * Removes all elements.
  366. */
  367. }, {
  368. key: "clear",
  369. value: function clear() {
  370. this._map = new Map();
  371. this._arrayTreeMap = new Map();
  372. this._objectTreeMap = new Map();
  373. }
  374. }, {
  375. key: "size",
  376. get: function get() {
  377. return this._map.size;
  378. }
  379. }]);
  380. return EquivalentKeyMap;
  381. }();
  382. module.exports = EquivalentKeyMap;
  383. /***/ }),
  384. /***/ "GRId":
  385. /***/ (function(module, exports) {
  386. (function() { module.exports = window["wp"]["element"]; }());
  387. /***/ }),
  388. /***/ "JlUD":
  389. /***/ (function(module, exports) {
  390. module.exports = isPromise;
  391. module.exports.default = isPromise;
  392. function isPromise(obj) {
  393. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  394. }
  395. /***/ }),
  396. /***/ "K9lf":
  397. /***/ (function(module, exports) {
  398. (function() { module.exports = window["wp"]["compose"]; }());
  399. /***/ }),
  400. /***/ "NMb1":
  401. /***/ (function(module, exports) {
  402. (function() { module.exports = window["wp"]["deprecated"]; }());
  403. /***/ }),
  404. /***/ "XI5e":
  405. /***/ (function(module, exports) {
  406. (function() { module.exports = window["wp"]["priorityQueue"]; }());
  407. /***/ }),
  408. /***/ "XIDh":
  409. /***/ (function(module, exports) {
  410. (function() { module.exports = window["wp"]["reduxRoutine"]; }());
  411. /***/ }),
  412. /***/ "YLtl":
  413. /***/ (function(module, exports) {
  414. (function() { module.exports = window["lodash"]; }());
  415. /***/ }),
  416. /***/ "cDcd":
  417. /***/ (function(module, exports) {
  418. (function() { module.exports = window["React"]; }());
  419. /***/ }),
  420. /***/ "mHlH":
  421. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  422. "use strict";
  423. /* unused harmony export useCallback */
  424. /* unused harmony export useCallbackOne */
  425. /* unused harmony export useMemo */
  426. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useMemoOne; });
  427. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
  428. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  429. function areInputsEqual(newInputs, lastInputs) {
  430. if (newInputs.length !== lastInputs.length) {
  431. return false;
  432. }
  433. for (var i = 0; i < newInputs.length; i++) {
  434. if (newInputs[i] !== lastInputs[i]) {
  435. return false;
  436. }
  437. }
  438. return true;
  439. }
  440. function useMemoOne(getResult, inputs) {
  441. var initial = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(function () {
  442. return {
  443. inputs: inputs,
  444. result: getResult()
  445. };
  446. })[0];
  447. var isFirstRun = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(true);
  448. var committed = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(initial);
  449. var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs));
  450. var cache = useCache ? committed.current : {
  451. inputs: inputs,
  452. result: getResult()
  453. };
  454. Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
  455. isFirstRun.current = false;
  456. committed.current = cache;
  457. }, [cache]);
  458. return cache.result;
  459. }
  460. function useCallbackOne(callback, inputs) {
  461. return useMemoOne(function () {
  462. return callback;
  463. }, inputs);
  464. }
  465. var useMemo = useMemoOne;
  466. var useCallback = useCallbackOne;
  467. /***/ }),
  468. /***/ "pfJ3":
  469. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  470. "use strict";
  471. // ESM COMPAT FLAG
  472. __webpack_require__.r(__webpack_exports__);
  473. // EXPORTS
  474. __webpack_require__.d(__webpack_exports__, "withSelect", function() { return /* reexport */ with_select; });
  475. __webpack_require__.d(__webpack_exports__, "withDispatch", function() { return /* reexport */ with_dispatch; });
  476. __webpack_require__.d(__webpack_exports__, "withRegistry", function() { return /* reexport */ with_registry; });
  477. __webpack_require__.d(__webpack_exports__, "RegistryProvider", function() { return /* reexport */ context; });
  478. __webpack_require__.d(__webpack_exports__, "RegistryConsumer", function() { return /* reexport */ RegistryConsumer; });
  479. __webpack_require__.d(__webpack_exports__, "useRegistry", function() { return /* reexport */ useRegistry; });
  480. __webpack_require__.d(__webpack_exports__, "useSelect", function() { return /* reexport */ useSelect; });
  481. __webpack_require__.d(__webpack_exports__, "useDispatch", function() { return /* reexport */ use_dispatch; });
  482. __webpack_require__.d(__webpack_exports__, "AsyncModeProvider", function() { return /* reexport */ async_mode_provider_context; });
  483. __webpack_require__.d(__webpack_exports__, "createRegistry", function() { return /* reexport */ createRegistry; });
  484. __webpack_require__.d(__webpack_exports__, "createRegistrySelector", function() { return /* reexport */ createRegistrySelector; });
  485. __webpack_require__.d(__webpack_exports__, "createRegistryControl", function() { return /* reexport */ createRegistryControl; });
  486. __webpack_require__.d(__webpack_exports__, "controls", function() { return /* reexport */ controls_controls; });
  487. __webpack_require__.d(__webpack_exports__, "createReduxStore", function() { return /* reexport */ createReduxStore; });
  488. __webpack_require__.d(__webpack_exports__, "plugins", function() { return /* reexport */ plugins_namespaceObject; });
  489. __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return /* reexport */ turbo_combine_reducers_default.a; });
  490. __webpack_require__.d(__webpack_exports__, "select", function() { return /* binding */ build_module_select; });
  491. __webpack_require__.d(__webpack_exports__, "resolveSelect", function() { return /* binding */ build_module_resolveSelect; });
  492. __webpack_require__.d(__webpack_exports__, "dispatch", function() { return /* binding */ build_module_dispatch; });
  493. __webpack_require__.d(__webpack_exports__, "subscribe", function() { return /* binding */ build_module_subscribe; });
  494. __webpack_require__.d(__webpack_exports__, "registerGenericStore", function() { return /* binding */ build_module_registerGenericStore; });
  495. __webpack_require__.d(__webpack_exports__, "registerStore", function() { return /* binding */ registerStore; });
  496. __webpack_require__.d(__webpack_exports__, "use", function() { return /* binding */ build_module_use; });
  497. __webpack_require__.d(__webpack_exports__, "register", function() { return /* binding */ build_module_register; });
  498. // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
  499. var selectors_namespaceObject = {};
  500. __webpack_require__.r(selectors_namespaceObject);
  501. __webpack_require__.d(selectors_namespaceObject, "getIsResolving", function() { return getIsResolving; });
  502. __webpack_require__.d(selectors_namespaceObject, "hasStartedResolution", function() { return hasStartedResolution; });
  503. __webpack_require__.d(selectors_namespaceObject, "hasFinishedResolution", function() { return hasFinishedResolution; });
  504. __webpack_require__.d(selectors_namespaceObject, "isResolving", function() { return isResolving; });
  505. __webpack_require__.d(selectors_namespaceObject, "getCachedResolvers", function() { return getCachedResolvers; });
  506. // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
  507. var actions_namespaceObject = {};
  508. __webpack_require__.r(actions_namespaceObject);
  509. __webpack_require__.d(actions_namespaceObject, "startResolution", function() { return startResolution; });
  510. __webpack_require__.d(actions_namespaceObject, "finishResolution", function() { return finishResolution; });
  511. __webpack_require__.d(actions_namespaceObject, "startResolutions", function() { return startResolutions; });
  512. __webpack_require__.d(actions_namespaceObject, "finishResolutions", function() { return finishResolutions; });
  513. __webpack_require__.d(actions_namespaceObject, "invalidateResolution", function() { return invalidateResolution; });
  514. __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStore", function() { return invalidateResolutionForStore; });
  515. __webpack_require__.d(actions_namespaceObject, "invalidateResolutionForStoreSelector", function() { return invalidateResolutionForStoreSelector; });
  516. // NAMESPACE OBJECT: ./node_modules/@wordpress/data/build-module/plugins/index.js
  517. var plugins_namespaceObject = {};
  518. __webpack_require__.r(plugins_namespaceObject);
  519. __webpack_require__.d(plugins_namespaceObject, "controls", function() { return plugins_controls; });
  520. __webpack_require__.d(plugins_namespaceObject, "persistence", function() { return plugins_persistence; });
  521. // EXTERNAL MODULE: ./node_modules/turbo-combine-reducers/index.js
  522. var turbo_combine_reducers = __webpack_require__("8mpt");
  523. var turbo_combine_reducers_default = /*#__PURE__*/__webpack_require__.n(turbo_combine_reducers);
  524. // EXTERNAL MODULE: external "lodash"
  525. var external_lodash_ = __webpack_require__("YLtl");
  526. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
  527. function _defineProperty(obj, key, value) {
  528. if (key in obj) {
  529. Object.defineProperty(obj, key, {
  530. value: value,
  531. enumerable: true,
  532. configurable: true,
  533. writable: true
  534. });
  535. } else {
  536. obj[key] = value;
  537. }
  538. return obj;
  539. }
  540. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
  541. function ownKeys(object, enumerableOnly) {
  542. var keys = Object.keys(object);
  543. if (Object.getOwnPropertySymbols) {
  544. var symbols = Object.getOwnPropertySymbols(object);
  545. if (enumerableOnly) {
  546. symbols = symbols.filter(function (sym) {
  547. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  548. });
  549. }
  550. keys.push.apply(keys, symbols);
  551. }
  552. return keys;
  553. }
  554. function _objectSpread2(target) {
  555. for (var i = 1; i < arguments.length; i++) {
  556. var source = arguments[i] != null ? arguments[i] : {};
  557. if (i % 2) {
  558. ownKeys(Object(source), true).forEach(function (key) {
  559. _defineProperty(target, key, source[key]);
  560. });
  561. } else if (Object.getOwnPropertyDescriptors) {
  562. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  563. } else {
  564. ownKeys(Object(source)).forEach(function (key) {
  565. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  566. });
  567. }
  568. }
  569. return target;
  570. }
  571. // CONCATENATED MODULE: ./node_modules/redux/es/redux.js
  572. /**
  573. * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
  574. *
  575. * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
  576. * during build.
  577. * @param {number} code
  578. */
  579. function formatProdErrorMessage(code) {
  580. return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
  581. }
  582. // Inlined version of the `symbol-observable` polyfill
  583. var $$observable = (function () {
  584. return typeof Symbol === 'function' && Symbol.observable || '@@observable';
  585. })();
  586. /**
  587. * These are private action types reserved by Redux.
  588. * For any unknown actions, you must return the current state.
  589. * If the current state is undefined, you must return the initial state.
  590. * Do not reference these action types directly in your code.
  591. */
  592. var randomString = function randomString() {
  593. return Math.random().toString(36).substring(7).split('').join('.');
  594. };
  595. var ActionTypes = {
  596. INIT: "@@redux/INIT" + randomString(),
  597. REPLACE: "@@redux/REPLACE" + randomString(),
  598. PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
  599. return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
  600. }
  601. };
  602. /**
  603. * @param {any} obj The object to inspect.
  604. * @returns {boolean} True if the argument appears to be a plain object.
  605. */
  606. function isPlainObject(obj) {
  607. if (typeof obj !== 'object' || obj === null) return false;
  608. var proto = obj;
  609. while (Object.getPrototypeOf(proto) !== null) {
  610. proto = Object.getPrototypeOf(proto);
  611. }
  612. return Object.getPrototypeOf(obj) === proto;
  613. }
  614. // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
  615. function miniKindOf(val) {
  616. if (val === void 0) return 'undefined';
  617. if (val === null) return 'null';
  618. var type = typeof val;
  619. switch (type) {
  620. case 'boolean':
  621. case 'string':
  622. case 'number':
  623. case 'symbol':
  624. case 'function':
  625. {
  626. return type;
  627. }
  628. }
  629. if (Array.isArray(val)) return 'array';
  630. if (isDate(val)) return 'date';
  631. if (isError(val)) return 'error';
  632. var constructorName = ctorName(val);
  633. switch (constructorName) {
  634. case 'Symbol':
  635. case 'Promise':
  636. case 'WeakMap':
  637. case 'WeakSet':
  638. case 'Map':
  639. case 'Set':
  640. return constructorName;
  641. } // other
  642. return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
  643. }
  644. function ctorName(val) {
  645. return typeof val.constructor === 'function' ? val.constructor.name : null;
  646. }
  647. function isError(val) {
  648. return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
  649. }
  650. function isDate(val) {
  651. if (val instanceof Date) return true;
  652. return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
  653. }
  654. function kindOf(val) {
  655. var typeOfVal = typeof val;
  656. if (false) {}
  657. return typeOfVal;
  658. }
  659. /**
  660. * Creates a Redux store that holds the state tree.
  661. * The only way to change the data in the store is to call `dispatch()` on it.
  662. *
  663. * There should only be a single store in your app. To specify how different
  664. * parts of the state tree respond to actions, you may combine several reducers
  665. * into a single reducer function by using `combineReducers`.
  666. *
  667. * @param {Function} reducer A function that returns the next state tree, given
  668. * the current state tree and the action to handle.
  669. *
  670. * @param {any} [preloadedState] The initial state. You may optionally specify it
  671. * to hydrate the state from the server in universal apps, or to restore a
  672. * previously serialized user session.
  673. * If you use `combineReducers` to produce the root reducer function, this must be
  674. * an object with the same shape as `combineReducers` keys.
  675. *
  676. * @param {Function} [enhancer] The store enhancer. You may optionally specify it
  677. * to enhance the store with third-party capabilities such as middleware,
  678. * time travel, persistence, etc. The only store enhancer that ships with Redux
  679. * is `applyMiddleware()`.
  680. *
  681. * @returns {Store} A Redux store that lets you read the state, dispatch actions
  682. * and subscribe to changes.
  683. */
  684. function redux_createStore(reducer, preloadedState, enhancer) {
  685. var _ref2;
  686. if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
  687. throw new Error( true ? formatProdErrorMessage(0) : undefined);
  688. }
  689. if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
  690. enhancer = preloadedState;
  691. preloadedState = undefined;
  692. }
  693. if (typeof enhancer !== 'undefined') {
  694. if (typeof enhancer !== 'function') {
  695. throw new Error( true ? formatProdErrorMessage(1) : undefined);
  696. }
  697. return enhancer(redux_createStore)(reducer, preloadedState);
  698. }
  699. if (typeof reducer !== 'function') {
  700. throw new Error( true ? formatProdErrorMessage(2) : undefined);
  701. }
  702. var currentReducer = reducer;
  703. var currentState = preloadedState;
  704. var currentListeners = [];
  705. var nextListeners = currentListeners;
  706. var isDispatching = false;
  707. /**
  708. * This makes a shallow copy of currentListeners so we can use
  709. * nextListeners as a temporary list while dispatching.
  710. *
  711. * This prevents any bugs around consumers calling
  712. * subscribe/unsubscribe in the middle of a dispatch.
  713. */
  714. function ensureCanMutateNextListeners() {
  715. if (nextListeners === currentListeners) {
  716. nextListeners = currentListeners.slice();
  717. }
  718. }
  719. /**
  720. * Reads the state tree managed by the store.
  721. *
  722. * @returns {any} The current state tree of your application.
  723. */
  724. function getState() {
  725. if (isDispatching) {
  726. throw new Error( true ? formatProdErrorMessage(3) : undefined);
  727. }
  728. return currentState;
  729. }
  730. /**
  731. * Adds a change listener. It will be called any time an action is dispatched,
  732. * and some part of the state tree may potentially have changed. You may then
  733. * call `getState()` to read the current state tree inside the callback.
  734. *
  735. * You may call `dispatch()` from a change listener, with the following
  736. * caveats:
  737. *
  738. * 1. The subscriptions are snapshotted just before every `dispatch()` call.
  739. * If you subscribe or unsubscribe while the listeners are being invoked, this
  740. * will not have any effect on the `dispatch()` that is currently in progress.
  741. * However, the next `dispatch()` call, whether nested or not, will use a more
  742. * recent snapshot of the subscription list.
  743. *
  744. * 2. The listener should not expect to see all state changes, as the state
  745. * might have been updated multiple times during a nested `dispatch()` before
  746. * the listener is called. It is, however, guaranteed that all subscribers
  747. * registered before the `dispatch()` started will be called with the latest
  748. * state by the time it exits.
  749. *
  750. * @param {Function} listener A callback to be invoked on every dispatch.
  751. * @returns {Function} A function to remove this change listener.
  752. */
  753. function subscribe(listener) {
  754. if (typeof listener !== 'function') {
  755. throw new Error( true ? formatProdErrorMessage(4) : undefined);
  756. }
  757. if (isDispatching) {
  758. throw new Error( true ? formatProdErrorMessage(5) : undefined);
  759. }
  760. var isSubscribed = true;
  761. ensureCanMutateNextListeners();
  762. nextListeners.push(listener);
  763. return function unsubscribe() {
  764. if (!isSubscribed) {
  765. return;
  766. }
  767. if (isDispatching) {
  768. throw new Error( true ? formatProdErrorMessage(6) : undefined);
  769. }
  770. isSubscribed = false;
  771. ensureCanMutateNextListeners();
  772. var index = nextListeners.indexOf(listener);
  773. nextListeners.splice(index, 1);
  774. currentListeners = null;
  775. };
  776. }
  777. /**
  778. * Dispatches an action. It is the only way to trigger a state change.
  779. *
  780. * The `reducer` function, used to create the store, will be called with the
  781. * current state tree and the given `action`. Its return value will
  782. * be considered the **next** state of the tree, and the change listeners
  783. * will be notified.
  784. *
  785. * The base implementation only supports plain object actions. If you want to
  786. * dispatch a Promise, an Observable, a thunk, or something else, you need to
  787. * wrap your store creating function into the corresponding middleware. For
  788. * example, see the documentation for the `redux-thunk` package. Even the
  789. * middleware will eventually dispatch plain object actions using this method.
  790. *
  791. * @param {Object} action A plain object representing “what changed”. It is
  792. * a good idea to keep actions serializable so you can record and replay user
  793. * sessions, or use the time travelling `redux-devtools`. An action must have
  794. * a `type` property which may not be `undefined`. It is a good idea to use
  795. * string constants for action types.
  796. *
  797. * @returns {Object} For convenience, the same action object you dispatched.
  798. *
  799. * Note that, if you use a custom middleware, it may wrap `dispatch()` to
  800. * return something else (for example, a Promise you can await).
  801. */
  802. function dispatch(action) {
  803. if (!isPlainObject(action)) {
  804. throw new Error( true ? formatProdErrorMessage(7) : undefined);
  805. }
  806. if (typeof action.type === 'undefined') {
  807. throw new Error( true ? formatProdErrorMessage(8) : undefined);
  808. }
  809. if (isDispatching) {
  810. throw new Error( true ? formatProdErrorMessage(9) : undefined);
  811. }
  812. try {
  813. isDispatching = true;
  814. currentState = currentReducer(currentState, action);
  815. } finally {
  816. isDispatching = false;
  817. }
  818. var listeners = currentListeners = nextListeners;
  819. for (var i = 0; i < listeners.length; i++) {
  820. var listener = listeners[i];
  821. listener();
  822. }
  823. return action;
  824. }
  825. /**
  826. * Replaces the reducer currently used by the store to calculate the state.
  827. *
  828. * You might need this if your app implements code splitting and you want to
  829. * load some of the reducers dynamically. You might also need this if you
  830. * implement a hot reloading mechanism for Redux.
  831. *
  832. * @param {Function} nextReducer The reducer for the store to use instead.
  833. * @returns {void}
  834. */
  835. function replaceReducer(nextReducer) {
  836. if (typeof nextReducer !== 'function') {
  837. throw new Error( true ? formatProdErrorMessage(10) : undefined);
  838. }
  839. currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
  840. // Any reducers that existed in both the new and old rootReducer
  841. // will receive the previous state. This effectively populates
  842. // the new state tree with any relevant data from the old one.
  843. dispatch({
  844. type: ActionTypes.REPLACE
  845. });
  846. }
  847. /**
  848. * Interoperability point for observable/reactive libraries.
  849. * @returns {observable} A minimal observable of state changes.
  850. * For more information, see the observable proposal:
  851. * https://github.com/tc39/proposal-observable
  852. */
  853. function observable() {
  854. var _ref;
  855. var outerSubscribe = subscribe;
  856. return _ref = {
  857. /**
  858. * The minimal observable subscription method.
  859. * @param {Object} observer Any object that can be used as an observer.
  860. * The observer object should have a `next` method.
  861. * @returns {subscription} An object with an `unsubscribe` method that can
  862. * be used to unsubscribe the observable from the store, and prevent further
  863. * emission of values from the observable.
  864. */
  865. subscribe: function subscribe(observer) {
  866. if (typeof observer !== 'object' || observer === null) {
  867. throw new Error( true ? formatProdErrorMessage(11) : undefined);
  868. }
  869. function observeState() {
  870. if (observer.next) {
  871. observer.next(getState());
  872. }
  873. }
  874. observeState();
  875. var unsubscribe = outerSubscribe(observeState);
  876. return {
  877. unsubscribe: unsubscribe
  878. };
  879. }
  880. }, _ref[$$observable] = function () {
  881. return this;
  882. }, _ref;
  883. } // When a store is created, an "INIT" action is dispatched so that every
  884. // reducer returns their initial state. This effectively populates
  885. // the initial state tree.
  886. dispatch({
  887. type: ActionTypes.INIT
  888. });
  889. return _ref2 = {
  890. dispatch: dispatch,
  891. subscribe: subscribe,
  892. getState: getState,
  893. replaceReducer: replaceReducer
  894. }, _ref2[$$observable] = observable, _ref2;
  895. }
  896. /**
  897. * Prints a warning in the console if it exists.
  898. *
  899. * @param {String} message The warning message.
  900. * @returns {void}
  901. */
  902. function warning(message) {
  903. /* eslint-disable no-console */
  904. if (typeof console !== 'undefined' && typeof console.error === 'function') {
  905. console.error(message);
  906. }
  907. /* eslint-enable no-console */
  908. try {
  909. // This error was thrown as a convenience so that if you enable
  910. // "break on all exceptions" in your console,
  911. // it would pause the execution at this line.
  912. throw new Error(message);
  913. } catch (e) {} // eslint-disable-line no-empty
  914. }
  915. function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
  916. var reducerKeys = Object.keys(reducers);
  917. var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
  918. if (reducerKeys.length === 0) {
  919. return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
  920. }
  921. if (!isPlainObject(inputState)) {
  922. return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
  923. }
  924. var unexpectedKeys = Object.keys(inputState).filter(function (key) {
  925. return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
  926. });
  927. unexpectedKeys.forEach(function (key) {
  928. unexpectedKeyCache[key] = true;
  929. });
  930. if (action && action.type === ActionTypes.REPLACE) return;
  931. if (unexpectedKeys.length > 0) {
  932. 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.");
  933. }
  934. }
  935. function assertReducerShape(reducers) {
  936. Object.keys(reducers).forEach(function (key) {
  937. var reducer = reducers[key];
  938. var initialState = reducer(undefined, {
  939. type: ActionTypes.INIT
  940. });
  941. if (typeof initialState === 'undefined') {
  942. throw new Error( true ? formatProdErrorMessage(12) : undefined);
  943. }
  944. if (typeof reducer(undefined, {
  945. type: ActionTypes.PROBE_UNKNOWN_ACTION()
  946. }) === 'undefined') {
  947. throw new Error( true ? formatProdErrorMessage(13) : undefined);
  948. }
  949. });
  950. }
  951. /**
  952. * Turns an object whose values are different reducer functions, into a single
  953. * reducer function. It will call every child reducer, and gather their results
  954. * into a single state object, whose keys correspond to the keys of the passed
  955. * reducer functions.
  956. *
  957. * @param {Object} reducers An object whose values correspond to different
  958. * reducer functions that need to be combined into one. One handy way to obtain
  959. * it is to use ES6 `import * as reducers` syntax. The reducers may never return
  960. * undefined for any action. Instead, they should return their initial state
  961. * if the state passed to them was undefined, and the current state for any
  962. * unrecognized action.
  963. *
  964. * @returns {Function} A reducer function that invokes every reducer inside the
  965. * passed object, and builds a state object with the same shape.
  966. */
  967. function combineReducers(reducers) {
  968. var reducerKeys = Object.keys(reducers);
  969. var finalReducers = {};
  970. for (var i = 0; i < reducerKeys.length; i++) {
  971. var key = reducerKeys[i];
  972. if (false) {}
  973. if (typeof reducers[key] === 'function') {
  974. finalReducers[key] = reducers[key];
  975. }
  976. }
  977. var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
  978. // keys multiple times.
  979. var unexpectedKeyCache;
  980. if (false) {}
  981. var shapeAssertionError;
  982. try {
  983. assertReducerShape(finalReducers);
  984. } catch (e) {
  985. shapeAssertionError = e;
  986. }
  987. return function combination(state, action) {
  988. if (state === void 0) {
  989. state = {};
  990. }
  991. if (shapeAssertionError) {
  992. throw shapeAssertionError;
  993. }
  994. if (false) { var warningMessage; }
  995. var hasChanged = false;
  996. var nextState = {};
  997. for (var _i = 0; _i < finalReducerKeys.length; _i++) {
  998. var _key = finalReducerKeys[_i];
  999. var reducer = finalReducers[_key];
  1000. var previousStateForKey = state[_key];
  1001. var nextStateForKey = reducer(previousStateForKey, action);
  1002. if (typeof nextStateForKey === 'undefined') {
  1003. var actionType = action && action.type;
  1004. throw new Error( true ? formatProdErrorMessage(14) : undefined);
  1005. }
  1006. nextState[_key] = nextStateForKey;
  1007. hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
  1008. }
  1009. hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
  1010. return hasChanged ? nextState : state;
  1011. };
  1012. }
  1013. function bindActionCreator(actionCreator, dispatch) {
  1014. return function () {
  1015. return dispatch(actionCreator.apply(this, arguments));
  1016. };
  1017. }
  1018. /**
  1019. * Turns an object whose values are action creators, into an object with the
  1020. * same keys, but with every function wrapped into a `dispatch` call so they
  1021. * may be invoked directly. This is just a convenience method, as you can call
  1022. * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
  1023. *
  1024. * For convenience, you can also pass an action creator as the first argument,
  1025. * and get a dispatch wrapped function in return.
  1026. *
  1027. * @param {Function|Object} actionCreators An object whose values are action
  1028. * creator functions. One handy way to obtain it is to use ES6 `import * as`
  1029. * syntax. You may also pass a single function.
  1030. *
  1031. * @param {Function} dispatch The `dispatch` function available on your Redux
  1032. * store.
  1033. *
  1034. * @returns {Function|Object} The object mimicking the original object, but with
  1035. * every action creator wrapped into the `dispatch` call. If you passed a
  1036. * function as `actionCreators`, the return value will also be a single
  1037. * function.
  1038. */
  1039. function bindActionCreators(actionCreators, dispatch) {
  1040. if (typeof actionCreators === 'function') {
  1041. return bindActionCreator(actionCreators, dispatch);
  1042. }
  1043. if (typeof actionCreators !== 'object' || actionCreators === null) {
  1044. throw new Error( true ? formatProdErrorMessage(16) : undefined);
  1045. }
  1046. var boundActionCreators = {};
  1047. for (var key in actionCreators) {
  1048. var actionCreator = actionCreators[key];
  1049. if (typeof actionCreator === 'function') {
  1050. boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
  1051. }
  1052. }
  1053. return boundActionCreators;
  1054. }
  1055. /**
  1056. * Composes single-argument functions from right to left. The rightmost
  1057. * function can take multiple arguments as it provides the signature for
  1058. * the resulting composite function.
  1059. *
  1060. * @param {...Function} funcs The functions to compose.
  1061. * @returns {Function} A function obtained by composing the argument functions
  1062. * from right to left. For example, compose(f, g, h) is identical to doing
  1063. * (...args) => f(g(h(...args))).
  1064. */
  1065. function compose() {
  1066. for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
  1067. funcs[_key] = arguments[_key];
  1068. }
  1069. if (funcs.length === 0) {
  1070. return function (arg) {
  1071. return arg;
  1072. };
  1073. }
  1074. if (funcs.length === 1) {
  1075. return funcs[0];
  1076. }
  1077. return funcs.reduce(function (a, b) {
  1078. return function () {
  1079. return a(b.apply(void 0, arguments));
  1080. };
  1081. });
  1082. }
  1083. /**
  1084. * Creates a store enhancer that applies middleware to the dispatch method
  1085. * of the Redux store. This is handy for a variety of tasks, such as expressing
  1086. * asynchronous actions in a concise manner, or logging every action payload.
  1087. *
  1088. * See `redux-thunk` package as an example of the Redux middleware.
  1089. *
  1090. * Because middleware is potentially asynchronous, this should be the first
  1091. * store enhancer in the composition chain.
  1092. *
  1093. * Note that each middleware will be given the `dispatch` and `getState` functions
  1094. * as named arguments.
  1095. *
  1096. * @param {...Function} middlewares The middleware chain to be applied.
  1097. * @returns {Function} A store enhancer applying the middleware.
  1098. */
  1099. function applyMiddleware() {
  1100. for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
  1101. middlewares[_key] = arguments[_key];
  1102. }
  1103. return function (createStore) {
  1104. return function () {
  1105. var store = createStore.apply(void 0, arguments);
  1106. var _dispatch = function dispatch() {
  1107. throw new Error( true ? formatProdErrorMessage(15) : undefined);
  1108. };
  1109. var middlewareAPI = {
  1110. getState: store.getState,
  1111. dispatch: function dispatch() {
  1112. return _dispatch.apply(void 0, arguments);
  1113. }
  1114. };
  1115. var chain = middlewares.map(function (middleware) {
  1116. return middleware(middlewareAPI);
  1117. });
  1118. _dispatch = compose.apply(void 0, chain)(store.dispatch);
  1119. return _objectSpread2(_objectSpread2({}, store), {}, {
  1120. dispatch: _dispatch
  1121. });
  1122. };
  1123. };
  1124. }
  1125. /*
  1126. * This is a dummy function to check if the function name has been altered by minification.
  1127. * If the function has been minified and NODE_ENV !== 'production', warn the user.
  1128. */
  1129. function isCrushed() {}
  1130. if (false) {}
  1131. // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
  1132. var equivalent_key_map = __webpack_require__("FtRg");
  1133. var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
  1134. // EXTERNAL MODULE: external ["wp","reduxRoutine"]
  1135. var external_wp_reduxRoutine_ = __webpack_require__("XIDh");
  1136. var external_wp_reduxRoutine_default = /*#__PURE__*/__webpack_require__.n(external_wp_reduxRoutine_);
  1137. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/factory.js
  1138. /**
  1139. * Creates a selector function that takes additional curried argument with the
  1140. * registry `select` function. While a regular selector has signature
  1141. * ```js
  1142. * ( state, ...selectorArgs ) => ( result )
  1143. * ```
  1144. * that allows to select data from the store's `state`, a registry selector
  1145. * has signature:
  1146. * ```js
  1147. * ( select ) => ( state, ...selectorArgs ) => ( result )
  1148. * ```
  1149. * that supports also selecting from other registered stores.
  1150. *
  1151. * @example
  1152. * ```js
  1153. * const getCurrentPostId = createRegistrySelector( ( select ) => ( state ) => {
  1154. * return select( 'core/editor' ).getCurrentPostId();
  1155. * } );
  1156. *
  1157. * const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
  1158. * // calling another registry selector just like any other function
  1159. * const postType = getCurrentPostType( state );
  1160. * const postId = getCurrentPostId( state );
  1161. * return select( 'core' ).getEntityRecordEdits( 'postType', postType, postId );
  1162. * } );
  1163. * ```
  1164. *
  1165. * Note how the `getCurrentPostId` selector can be called just like any other function,
  1166. * (it works even inside a regular non-registry selector) and we don't need to pass the
  1167. * registry as argument. The registry binding happens automatically when registering the selector
  1168. * with a store.
  1169. *
  1170. * @param {Function} registrySelector Function receiving a registry `select`
  1171. * function and returning a state selector.
  1172. *
  1173. * @return {Function} Registry selector that can be registered with a store.
  1174. */
  1175. function createRegistrySelector(registrySelector) {
  1176. // create a selector function that is bound to the registry referenced by `selector.registry`
  1177. // and that has the same API as a regular selector. Binding it in such a way makes it
  1178. // possible to call the selector directly from another selector.
  1179. const selector = (...args) => registrySelector(selector.registry.select)(...args);
  1180. /**
  1181. * Flag indicating that the selector is a registry selector that needs the correct registry
  1182. * reference to be assigned to `selecto.registry` to make it work correctly.
  1183. * be mapped as a registry selector.
  1184. *
  1185. * @type {boolean}
  1186. */
  1187. selector.isRegistrySelector = true;
  1188. return selector;
  1189. }
  1190. /**
  1191. * Creates a control function that takes additional curried argument with the `registry` object.
  1192. * While a regular control has signature
  1193. * ```js
  1194. * ( action ) => ( iteratorOrPromise )
  1195. * ```
  1196. * where the control works with the `action` that it's bound to, a registry control has signature:
  1197. * ```js
  1198. * ( registry ) => ( action ) => ( iteratorOrPromise )
  1199. * ```
  1200. * A registry control is typically used to select data or dispatch an action to a registered
  1201. * store.
  1202. *
  1203. * When registering a control created with `createRegistryControl` with a store, the store
  1204. * knows which calling convention to use when executing the control.
  1205. *
  1206. * @param {Function} registryControl Function receiving a registry object and returning a control.
  1207. *
  1208. * @return {Function} Registry control that can be registered with a store.
  1209. */
  1210. function createRegistryControl(registryControl) {
  1211. registryControl.isRegistryControl = true;
  1212. return registryControl;
  1213. }
  1214. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/controls.js
  1215. /**
  1216. * Internal dependencies
  1217. */
  1218. const SELECT = '@@data/SELECT';
  1219. const RESOLVE_SELECT = '@@data/RESOLVE_SELECT';
  1220. const DISPATCH = '@@data/DISPATCH';
  1221. /**
  1222. * Dispatches a control action for triggering a synchronous registry select.
  1223. *
  1224. * Note: This control synchronously returns the current selector value, triggering the
  1225. * resolution, but not waiting for it.
  1226. *
  1227. * @param {string} storeKey The key for the store the selector belongs to.
  1228. * @param {string} selectorName The name of the selector.
  1229. * @param {Array} args Arguments for the selector.
  1230. *
  1231. * @example
  1232. * ```js
  1233. * import { controls } from '@wordpress/data';
  1234. *
  1235. * // Action generator using `select`.
  1236. * export function* myAction() {
  1237. * const isEditorSideBarOpened = yield controls.select( 'core/edit-post', 'isEditorSideBarOpened' );
  1238. * // Do stuff with the result from the `select`.
  1239. * }
  1240. * ```
  1241. *
  1242. * @return {Object} The control descriptor.
  1243. */
  1244. function controls_select(storeKey, selectorName, ...args) {
  1245. return {
  1246. type: SELECT,
  1247. storeKey,
  1248. selectorName,
  1249. args
  1250. };
  1251. }
  1252. /**
  1253. * Dispatches a control action for triggering and resolving a registry select.
  1254. *
  1255. * Note: when this control action is handled, it automatically considers
  1256. * selectors that may have a resolver. In such case, it will return a `Promise` that resolves
  1257. * after the selector finishes resolving, with the final result value.
  1258. *
  1259. * @param {string} storeKey The key for the store the selector belongs to
  1260. * @param {string} selectorName The name of the selector
  1261. * @param {Array} args Arguments for the selector.
  1262. *
  1263. * @example
  1264. * ```js
  1265. * import { controls } from '@wordpress/data';
  1266. *
  1267. * // Action generator using resolveSelect
  1268. * export function* myAction() {
  1269. * const isSidebarOpened = yield controls.resolveSelect( 'core/edit-post', 'isEditorSideBarOpened' );
  1270. * // do stuff with the result from the select.
  1271. * }
  1272. * ```
  1273. *
  1274. * @return {Object} The control descriptor.
  1275. */
  1276. function controls_resolveSelect(storeKey, selectorName, ...args) {
  1277. return {
  1278. type: RESOLVE_SELECT,
  1279. storeKey,
  1280. selectorName,
  1281. args
  1282. };
  1283. }
  1284. /**
  1285. * Dispatches a control action for triggering a registry dispatch.
  1286. *
  1287. * @param {string} storeKey The key for the store the action belongs to
  1288. * @param {string} actionName The name of the action to dispatch
  1289. * @param {Array} args Arguments for the dispatch action.
  1290. *
  1291. * @example
  1292. * ```js
  1293. * import { controls } from '@wordpress/data-controls';
  1294. *
  1295. * // Action generator using dispatch
  1296. * export function* myAction() {
  1297. * yield controls.dispatch( 'core/edit-post', 'togglePublishSidebar' );
  1298. * // do some other things.
  1299. * }
  1300. * ```
  1301. *
  1302. * @return {Object} The control descriptor.
  1303. */
  1304. function controls_dispatch(storeKey, actionName, ...args) {
  1305. return {
  1306. type: DISPATCH,
  1307. storeKey,
  1308. actionName,
  1309. args
  1310. };
  1311. }
  1312. const controls_controls = {
  1313. select: controls_select,
  1314. resolveSelect: controls_resolveSelect,
  1315. dispatch: controls_dispatch
  1316. };
  1317. const builtinControls = {
  1318. [SELECT]: createRegistryControl(registry => ({
  1319. storeKey,
  1320. selectorName,
  1321. args
  1322. }) => registry.select(storeKey)[selectorName](...args)),
  1323. [RESOLVE_SELECT]: createRegistryControl(registry => ({
  1324. storeKey,
  1325. selectorName,
  1326. args
  1327. }) => {
  1328. const method = registry.select(storeKey)[selectorName].hasResolver ? 'resolveSelect' : 'select';
  1329. return registry[method](storeKey)[selectorName](...args);
  1330. }),
  1331. [DISPATCH]: createRegistryControl(registry => ({
  1332. storeKey,
  1333. actionName,
  1334. args
  1335. }) => registry.dispatch(storeKey)[actionName](...args))
  1336. };
  1337. // EXTERNAL MODULE: ./node_modules/is-promise/index.js
  1338. var is_promise = __webpack_require__("JlUD");
  1339. var is_promise_default = /*#__PURE__*/__webpack_require__.n(is_promise);
  1340. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/promise-middleware.js
  1341. /**
  1342. * External dependencies
  1343. */
  1344. /**
  1345. * Simplest possible promise redux middleware.
  1346. *
  1347. * @return {Function} middleware.
  1348. */
  1349. const promiseMiddleware = () => next => action => {
  1350. if (is_promise_default()(action)) {
  1351. return action.then(resolvedAction => {
  1352. if (resolvedAction) {
  1353. return next(resolvedAction);
  1354. }
  1355. });
  1356. }
  1357. return next(action);
  1358. };
  1359. /* harmony default export */ var promise_middleware = (promiseMiddleware);
  1360. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js
  1361. /**
  1362. * External dependencies
  1363. */
  1364. /** @typedef {import('./registry').WPDataRegistry} WPDataRegistry */
  1365. /**
  1366. * Creates a middleware handling resolvers cache invalidation.
  1367. *
  1368. * @param {WPDataRegistry} registry The registry reference for which to create
  1369. * the middleware.
  1370. * @param {string} reducerKey The namespace for which to create the
  1371. * middleware.
  1372. *
  1373. * @return {Function} Middleware function.
  1374. */
  1375. const createResolversCacheMiddleware = (registry, reducerKey) => () => next => action => {
  1376. const resolvers = registry.select('core/data').getCachedResolvers(reducerKey);
  1377. Object.entries(resolvers).forEach(([selectorName, resolversByArgs]) => {
  1378. const resolver = Object(external_lodash_["get"])(registry.stores, [reducerKey, 'resolvers', selectorName]);
  1379. if (!resolver || !resolver.shouldInvalidate) {
  1380. return;
  1381. }
  1382. resolversByArgs.forEach((value, args) => {
  1383. // resolversByArgs is the map Map([ args ] => boolean) storing the cache resolution status for a given selector.
  1384. // If the value is false it means this resolver has finished its resolution which means we need to invalidate it,
  1385. // if it's true it means it's inflight and the invalidation is not necessary.
  1386. if (value !== false || !resolver.shouldInvalidate(action, ...args)) {
  1387. return;
  1388. } // Trigger cache invalidation
  1389. registry.dispatch('core/data').invalidateResolution(reducerKey, selectorName, args);
  1390. });
  1391. });
  1392. return next(action);
  1393. };
  1394. /* harmony default export */ var resolvers_cache_middleware = (createResolversCacheMiddleware);
  1395. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/thunk-middleware.js
  1396. function createThunkMiddleware(args) {
  1397. return () => next => action => {
  1398. if (typeof action === 'function') {
  1399. return action(args);
  1400. }
  1401. return next(action);
  1402. };
  1403. }
  1404. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/utils.js
  1405. /**
  1406. * Higher-order reducer creator which creates a combined reducer object, keyed
  1407. * by a property on the action object.
  1408. *
  1409. * @param {string} actionProperty Action property by which to key object.
  1410. *
  1411. * @return {Function} Higher-order reducer.
  1412. */
  1413. const onSubKey = actionProperty => reducer => (state = {}, action) => {
  1414. // Retrieve subkey from action. Do not track if undefined; useful for cases
  1415. // where reducer is scoped by action shape.
  1416. const key = action[actionProperty];
  1417. if (key === undefined) {
  1418. return state;
  1419. } // Avoid updating state if unchanged. Note that this also accounts for a
  1420. // reducer which returns undefined on a key which is not yet tracked.
  1421. const nextKeyState = reducer(state[key], action);
  1422. if (nextKeyState === state[key]) {
  1423. return state;
  1424. }
  1425. return { ...state,
  1426. [key]: nextKeyState
  1427. };
  1428. };
  1429. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/reducer.js
  1430. /**
  1431. * External dependencies
  1432. */
  1433. /**
  1434. * Internal dependencies
  1435. */
  1436. /**
  1437. * Reducer function returning next state for selector resolution of
  1438. * subkeys, object form:
  1439. *
  1440. * selectorName -> EquivalentKeyMap<Array,boolean>
  1441. *
  1442. * @param {Object} state Current state.
  1443. * @param {Object} action Dispatched action.
  1444. *
  1445. * @return {Object} Next state.
  1446. */
  1447. const subKeysIsResolved = onSubKey('selectorName')((state = new equivalent_key_map_default.a(), action) => {
  1448. switch (action.type) {
  1449. case 'START_RESOLUTION':
  1450. case 'FINISH_RESOLUTION':
  1451. {
  1452. const isStarting = action.type === 'START_RESOLUTION';
  1453. const nextState = new equivalent_key_map_default.a(state);
  1454. nextState.set(action.args, isStarting);
  1455. return nextState;
  1456. }
  1457. case 'START_RESOLUTIONS':
  1458. case 'FINISH_RESOLUTIONS':
  1459. {
  1460. const isStarting = action.type === 'START_RESOLUTIONS';
  1461. const nextState = new equivalent_key_map_default.a(state);
  1462. for (const resolutionArgs of action.args) {
  1463. nextState.set(resolutionArgs, isStarting);
  1464. }
  1465. return nextState;
  1466. }
  1467. case 'INVALIDATE_RESOLUTION':
  1468. {
  1469. const nextState = new equivalent_key_map_default.a(state);
  1470. nextState.delete(action.args);
  1471. return nextState;
  1472. }
  1473. }
  1474. return state;
  1475. });
  1476. /**
  1477. * Reducer function returning next state for selector resolution, object form:
  1478. *
  1479. * selectorName -> EquivalentKeyMap<Array, boolean>
  1480. *
  1481. * @param {Object} state Current state.
  1482. * @param {Object} action Dispatched action.
  1483. *
  1484. * @return {Object} Next state.
  1485. */
  1486. const isResolved = (state = {}, action) => {
  1487. switch (action.type) {
  1488. case 'INVALIDATE_RESOLUTION_FOR_STORE':
  1489. return {};
  1490. case 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR':
  1491. return Object(external_lodash_["has"])(state, [action.selectorName]) ? Object(external_lodash_["omit"])(state, [action.selectorName]) : state;
  1492. case 'START_RESOLUTION':
  1493. case 'FINISH_RESOLUTION':
  1494. case 'START_RESOLUTIONS':
  1495. case 'FINISH_RESOLUTIONS':
  1496. case 'INVALIDATE_RESOLUTION':
  1497. return subKeysIsResolved(state, action);
  1498. }
  1499. return state;
  1500. };
  1501. /* harmony default export */ var metadata_reducer = (isResolved);
  1502. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/selectors.js
  1503. /**
  1504. * External dependencies
  1505. */
  1506. /**
  1507. * Returns the raw `isResolving` value for a given selector name,
  1508. * and arguments set. May be undefined if the selector has never been resolved
  1509. * or not resolved for the given set of arguments, otherwise true or false for
  1510. * resolution started and completed respectively.
  1511. *
  1512. * @param {Object} state Data state.
  1513. * @param {string} selectorName Selector name.
  1514. * @param {Array} args Arguments passed to selector.
  1515. *
  1516. * @return {?boolean} isResolving value.
  1517. */
  1518. function getIsResolving(state, selectorName, args) {
  1519. const map = Object(external_lodash_["get"])(state, [selectorName]);
  1520. if (!map) {
  1521. return;
  1522. }
  1523. return map.get(args);
  1524. }
  1525. /**
  1526. * Returns true if resolution has already been triggered for a given
  1527. * selector name, and arguments set.
  1528. *
  1529. * @param {Object} state Data state.
  1530. * @param {string} selectorName Selector name.
  1531. * @param {?Array} args Arguments passed to selector (default `[]`).
  1532. *
  1533. * @return {boolean} Whether resolution has been triggered.
  1534. */
  1535. function hasStartedResolution(state, selectorName, args = []) {
  1536. return getIsResolving(state, selectorName, args) !== undefined;
  1537. }
  1538. /**
  1539. * Returns true if resolution has completed for a given selector
  1540. * name, and arguments set.
  1541. *
  1542. * @param {Object} state Data state.
  1543. * @param {string} selectorName Selector name.
  1544. * @param {?Array} args Arguments passed to selector.
  1545. *
  1546. * @return {boolean} Whether resolution has completed.
  1547. */
  1548. function hasFinishedResolution(state, selectorName, args = []) {
  1549. return getIsResolving(state, selectorName, args) === false;
  1550. }
  1551. /**
  1552. * Returns true if resolution has been triggered but has not yet completed for
  1553. * a given selector name, and arguments set.
  1554. *
  1555. * @param {Object} state Data state.
  1556. * @param {string} selectorName Selector name.
  1557. * @param {?Array} args Arguments passed to selector.
  1558. *
  1559. * @return {boolean} Whether resolution is in progress.
  1560. */
  1561. function isResolving(state, selectorName, args = []) {
  1562. return getIsResolving(state, selectorName, args) === true;
  1563. }
  1564. /**
  1565. * Returns the list of the cached resolvers.
  1566. *
  1567. * @param {Object} state Data state.
  1568. *
  1569. * @return {Object} Resolvers mapped by args and selectorName.
  1570. */
  1571. function getCachedResolvers(state) {
  1572. return state;
  1573. }
  1574. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/metadata/actions.js
  1575. /**
  1576. * Returns an action object used in signalling that selector resolution has
  1577. * started.
  1578. *
  1579. * @param {string} selectorName Name of selector for which resolver triggered.
  1580. * @param {...*} args Arguments to associate for uniqueness.
  1581. *
  1582. * @return {Object} Action object.
  1583. */
  1584. function startResolution(selectorName, args) {
  1585. return {
  1586. type: 'START_RESOLUTION',
  1587. selectorName,
  1588. args
  1589. };
  1590. }
  1591. /**
  1592. * Returns an action object used in signalling that selector resolution has
  1593. * completed.
  1594. *
  1595. * @param {string} selectorName Name of selector for which resolver triggered.
  1596. * @param {...*} args Arguments to associate for uniqueness.
  1597. *
  1598. * @return {Object} Action object.
  1599. */
  1600. function finishResolution(selectorName, args) {
  1601. return {
  1602. type: 'FINISH_RESOLUTION',
  1603. selectorName,
  1604. args
  1605. };
  1606. }
  1607. /**
  1608. * Returns an action object used in signalling that a batch of selector resolutions has
  1609. * started.
  1610. *
  1611. * @param {string} selectorName Name of selector for which resolver triggered.
  1612. * @param {...*} args Array of arguments to associate for uniqueness, each item
  1613. * is associated to a resolution.
  1614. *
  1615. * @return {Object} Action object.
  1616. */
  1617. function startResolutions(selectorName, args) {
  1618. return {
  1619. type: 'START_RESOLUTIONS',
  1620. selectorName,
  1621. args
  1622. };
  1623. }
  1624. /**
  1625. * Returns an action object used in signalling that a batch of selector resolutions has
  1626. * completed.
  1627. *
  1628. * @param {string} selectorName Name of selector for which resolver triggered.
  1629. * @param {...*} args Array of arguments to associate for uniqueness, each item
  1630. * is associated to a resolution.
  1631. *
  1632. * @return {Object} Action object.
  1633. */
  1634. function finishResolutions(selectorName, args) {
  1635. return {
  1636. type: 'FINISH_RESOLUTIONS',
  1637. selectorName,
  1638. args
  1639. };
  1640. }
  1641. /**
  1642. * Returns an action object used in signalling that we should invalidate the resolution cache.
  1643. *
  1644. * @param {string} selectorName Name of selector for which resolver should be invalidated.
  1645. * @param {Array} args Arguments to associate for uniqueness.
  1646. *
  1647. * @return {Object} Action object.
  1648. */
  1649. function invalidateResolution(selectorName, args) {
  1650. return {
  1651. type: 'INVALIDATE_RESOLUTION',
  1652. selectorName,
  1653. args
  1654. };
  1655. }
  1656. /**
  1657. * Returns an action object used in signalling that the resolution
  1658. * should be invalidated.
  1659. *
  1660. * @return {Object} Action object.
  1661. */
  1662. function invalidateResolutionForStore() {
  1663. return {
  1664. type: 'INVALIDATE_RESOLUTION_FOR_STORE'
  1665. };
  1666. }
  1667. /**
  1668. * Returns an action object used in signalling that the resolution cache for a
  1669. * given selectorName should be invalidated.
  1670. *
  1671. * @param {string} selectorName Name of selector for which all resolvers should
  1672. * be invalidated.
  1673. *
  1674. * @return {Object} Action object.
  1675. */
  1676. function invalidateResolutionForStoreSelector(selectorName) {
  1677. return {
  1678. type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR',
  1679. selectorName
  1680. };
  1681. }
  1682. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/redux-store/index.js
  1683. /**
  1684. * External dependencies
  1685. */
  1686. /**
  1687. * WordPress dependencies
  1688. */
  1689. /**
  1690. * Internal dependencies
  1691. */
  1692. /** @typedef {import('../types').WPDataRegistry} WPDataRegistry */
  1693. /** @typedef {import('../types').WPDataStore} WPDataStore */
  1694. /** @typedef {import('../types').WPDataReduxStoreConfig} WPDataReduxStoreConfig */
  1695. /**
  1696. * Create a cache to track whether resolvers started running or not.
  1697. *
  1698. * @return {Object} Resolvers Cache.
  1699. */
  1700. function createResolversCache() {
  1701. const cache = {};
  1702. return {
  1703. isRunning(selectorName, args) {
  1704. return cache[selectorName] && cache[selectorName].get(args);
  1705. },
  1706. clear(selectorName, args) {
  1707. if (cache[selectorName]) {
  1708. cache[selectorName].delete(args);
  1709. }
  1710. },
  1711. markAsRunning(selectorName, args) {
  1712. if (!cache[selectorName]) {
  1713. cache[selectorName] = new equivalent_key_map_default.a();
  1714. }
  1715. cache[selectorName].set(args, true);
  1716. }
  1717. };
  1718. }
  1719. /**
  1720. * Creates a data store definition for the provided Redux store options containing
  1721. * properties describing reducer, actions, selectors, controls and resolvers.
  1722. *
  1723. * @example
  1724. * ```js
  1725. * import { createReduxStore } from '@wordpress/data';
  1726. *
  1727. * const store = createReduxStore( 'demo', {
  1728. * reducer: ( state = 'OK' ) => state,
  1729. * selectors: {
  1730. * getValue: ( state ) => state,
  1731. * },
  1732. * } );
  1733. * ```
  1734. *
  1735. * @param {string} key Unique namespace identifier.
  1736. * @param {WPDataReduxStoreConfig} options Registered store options, with properties
  1737. * describing reducer, actions, selectors,
  1738. * and resolvers.
  1739. *
  1740. * @return {WPDataStore} Store Object.
  1741. */
  1742. function createReduxStore(key, options) {
  1743. return {
  1744. name: key,
  1745. instantiate: registry => {
  1746. const reducer = options.reducer;
  1747. const thunkArgs = {
  1748. registry,
  1749. get dispatch() {
  1750. return Object.assign(action => store.dispatch(action), getActions());
  1751. },
  1752. get select() {
  1753. return Object.assign(selector => selector(store.__unstableOriginalGetState()), getSelectors());
  1754. },
  1755. get resolveSelect() {
  1756. return getResolveSelectors();
  1757. }
  1758. };
  1759. const store = instantiateReduxStore(key, options, registry, thunkArgs);
  1760. const resolversCache = createResolversCache();
  1761. let resolvers;
  1762. const actions = mapActions({ ...actions_namespaceObject,
  1763. ...options.actions
  1764. }, store);
  1765. let selectors = mapSelectors({ ...Object(external_lodash_["mapValues"])(selectors_namespaceObject, selector => (state, ...args) => selector(state.metadata, ...args)),
  1766. ...Object(external_lodash_["mapValues"])(options.selectors, selector => {
  1767. if (selector.isRegistrySelector) {
  1768. selector.registry = registry;
  1769. }
  1770. return (state, ...args) => selector(state.root, ...args);
  1771. })
  1772. }, store);
  1773. if (options.resolvers) {
  1774. const result = mapResolvers(options.resolvers, selectors, store, resolversCache);
  1775. resolvers = result.resolvers;
  1776. selectors = result.selectors;
  1777. }
  1778. const resolveSelectors = mapResolveSelectors(selectors, store);
  1779. const getSelectors = () => selectors;
  1780. const getActions = () => actions;
  1781. const getResolveSelectors = () => resolveSelectors; // We have some modules monkey-patching the store object
  1782. // It's wrong to do so but until we refactor all of our effects to controls
  1783. // We need to keep the same "store" instance here.
  1784. store.__unstableOriginalGetState = store.getState;
  1785. store.getState = () => store.__unstableOriginalGetState().root; // Customize subscribe behavior to call listeners only on effective change,
  1786. // not on every dispatch.
  1787. const subscribe = store && (listener => {
  1788. let lastState = store.__unstableOriginalGetState();
  1789. return store.subscribe(() => {
  1790. const state = store.__unstableOriginalGetState();
  1791. const hasChanged = state !== lastState;
  1792. lastState = state;
  1793. if (hasChanged) {
  1794. listener();
  1795. }
  1796. });
  1797. }); // This can be simplified to just { subscribe, getSelectors, getActions }
  1798. // Once we remove the use function.
  1799. return {
  1800. reducer,
  1801. store,
  1802. actions,
  1803. selectors,
  1804. resolvers,
  1805. getSelectors,
  1806. getResolveSelectors,
  1807. getActions,
  1808. subscribe
  1809. };
  1810. }
  1811. };
  1812. }
  1813. /**
  1814. * Creates a redux store for a namespace.
  1815. *
  1816. * @param {string} key Unique namespace identifier.
  1817. * @param {Object} options Registered store options, with properties
  1818. * describing reducer, actions, selectors,
  1819. * and resolvers.
  1820. * @param {WPDataRegistry} registry Registry reference.
  1821. * @param {Object} thunkArgs Argument object for the thunk middleware.
  1822. * @return {Object} Newly created redux store.
  1823. */
  1824. function instantiateReduxStore(key, options, registry, thunkArgs) {
  1825. const controls = { ...options.controls,
  1826. ...builtinControls
  1827. };
  1828. const normalizedControls = Object(external_lodash_["mapValues"])(controls, control => control.isRegistryControl ? control(registry) : control);
  1829. const middlewares = [resolvers_cache_middleware(registry, key), promise_middleware, external_wp_reduxRoutine_default()(normalizedControls)];
  1830. if (options.__experimentalUseThunks) {
  1831. middlewares.push(createThunkMiddleware(thunkArgs));
  1832. }
  1833. const enhancers = [applyMiddleware(...middlewares)];
  1834. if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
  1835. enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({
  1836. name: key,
  1837. instanceId: key
  1838. }));
  1839. }
  1840. const {
  1841. reducer,
  1842. initialState
  1843. } = options;
  1844. const enhancedReducer = turbo_combine_reducers_default()({
  1845. metadata: metadata_reducer,
  1846. root: reducer
  1847. });
  1848. return redux_createStore(enhancedReducer, {
  1849. root: initialState
  1850. }, Object(external_lodash_["flowRight"])(enhancers));
  1851. }
  1852. /**
  1853. * Maps selectors to a store.
  1854. *
  1855. * @param {Object} selectors Selectors to register. Keys will be used as the
  1856. * public facing API. Selectors will get passed the
  1857. * state as first argument.
  1858. * @param {Object} store The store to which the selectors should be mapped.
  1859. * @return {Object} Selectors mapped to the provided store.
  1860. */
  1861. function mapSelectors(selectors, store) {
  1862. const createStateSelector = registrySelector => {
  1863. const selector = function runSelector() {
  1864. // This function is an optimized implementation of:
  1865. //
  1866. // selector( store.getState(), ...arguments )
  1867. //
  1868. // Where the above would incur an `Array#concat` in its application,
  1869. // the logic here instead efficiently constructs an arguments array via
  1870. // direct assignment.
  1871. const argsLength = arguments.length;
  1872. const args = new Array(argsLength + 1);
  1873. args[0] = store.__unstableOriginalGetState();
  1874. for (let i = 0; i < argsLength; i++) {
  1875. args[i + 1] = arguments[i];
  1876. }
  1877. return registrySelector(...args);
  1878. };
  1879. selector.hasResolver = false;
  1880. return selector;
  1881. };
  1882. return Object(external_lodash_["mapValues"])(selectors, createStateSelector);
  1883. }
  1884. /**
  1885. * Maps actions to dispatch from a given store.
  1886. *
  1887. * @param {Object} actions Actions to register.
  1888. * @param {Object} store The redux store to which the actions should be mapped.
  1889. * @return {Object} Actions mapped to the redux store provided.
  1890. */
  1891. function mapActions(actions, store) {
  1892. const createBoundAction = action => (...args) => {
  1893. return Promise.resolve(store.dispatch(action(...args)));
  1894. };
  1895. return Object(external_lodash_["mapValues"])(actions, createBoundAction);
  1896. }
  1897. /**
  1898. * Maps selectors to functions that return a resolution promise for them
  1899. *
  1900. * @param {Object} selectors Selectors to map.
  1901. * @param {Object} store The redux store the selectors select from.
  1902. * @return {Object} Selectors mapped to their resolution functions.
  1903. */
  1904. function mapResolveSelectors(selectors, store) {
  1905. return Object(external_lodash_["mapValues"])(Object(external_lodash_["omit"])(selectors, ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers']), (selector, selectorName) => (...args) => new Promise(resolve => {
  1906. const hasFinished = () => selectors.hasFinishedResolution(selectorName, args);
  1907. const getResult = () => selector.apply(null, args); // trigger the selector (to trigger the resolver)
  1908. const result = getResult();
  1909. if (hasFinished()) {
  1910. return resolve(result);
  1911. }
  1912. const unsubscribe = store.subscribe(() => {
  1913. if (hasFinished()) {
  1914. unsubscribe();
  1915. resolve(getResult());
  1916. }
  1917. });
  1918. }));
  1919. }
  1920. /**
  1921. * Returns resolvers with matched selectors for a given namespace.
  1922. * Resolvers are side effects invoked once per argument set of a given selector call,
  1923. * used in ensuring that the data needs for the selector are satisfied.
  1924. *
  1925. * @param {Object} resolvers Resolvers to register.
  1926. * @param {Object} selectors The current selectors to be modified.
  1927. * @param {Object} store The redux store to which the resolvers should be mapped.
  1928. * @param {Object} resolversCache Resolvers Cache.
  1929. */
  1930. function mapResolvers(resolvers, selectors, store, resolversCache) {
  1931. // The `resolver` can be either a function that does the resolution, or, in more advanced
  1932. // cases, an object with a `fullfill` method and other optional methods like `isFulfilled`.
  1933. // Here we normalize the `resolver` function to an object with `fulfill` method.
  1934. const mappedResolvers = Object(external_lodash_["mapValues"])(resolvers, resolver => {
  1935. if (resolver.fulfill) {
  1936. return resolver;
  1937. }
  1938. return { ...resolver,
  1939. // copy the enumerable properties of the resolver function
  1940. fulfill: resolver // add the fulfill method
  1941. };
  1942. });
  1943. const mapSelector = (selector, selectorName) => {
  1944. const resolver = resolvers[selectorName];
  1945. if (!resolver) {
  1946. selector.hasResolver = false;
  1947. return selector;
  1948. }
  1949. const selectorResolver = (...args) => {
  1950. async function fulfillSelector() {
  1951. const state = store.getState();
  1952. if (resolversCache.isRunning(selectorName, args) || typeof resolver.isFulfilled === 'function' && resolver.isFulfilled(state, ...args)) {
  1953. return;
  1954. }
  1955. const {
  1956. metadata
  1957. } = store.__unstableOriginalGetState();
  1958. if (hasStartedResolution(metadata, selectorName, args)) {
  1959. return;
  1960. }
  1961. resolversCache.markAsRunning(selectorName, args);
  1962. setTimeout(async () => {
  1963. resolversCache.clear(selectorName, args);
  1964. store.dispatch(startResolution(selectorName, args));
  1965. await fulfillResolver(store, mappedResolvers, selectorName, ...args);
  1966. store.dispatch(finishResolution(selectorName, args));
  1967. });
  1968. }
  1969. fulfillSelector(...args);
  1970. return selector(...args);
  1971. };
  1972. selectorResolver.hasResolver = true;
  1973. return selectorResolver;
  1974. };
  1975. return {
  1976. resolvers: mappedResolvers,
  1977. selectors: Object(external_lodash_["mapValues"])(selectors, mapSelector)
  1978. };
  1979. }
  1980. /**
  1981. * Calls a resolver given arguments
  1982. *
  1983. * @param {Object} store Store reference, for fulfilling via resolvers
  1984. * @param {Object} resolvers Store Resolvers
  1985. * @param {string} selectorName Selector name to fulfill.
  1986. * @param {Array} args Selector Arguments.
  1987. */
  1988. async function fulfillResolver(store, resolvers, selectorName, ...args) {
  1989. const resolver = Object(external_lodash_["get"])(resolvers, [selectorName]);
  1990. if (!resolver) {
  1991. return;
  1992. }
  1993. const action = resolver.fulfill(...args);
  1994. if (action) {
  1995. await store.dispatch(action);
  1996. }
  1997. }
  1998. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/store/index.js
  1999. function createCoreDataStore(registry) {
  2000. const getCoreDataSelector = selectorName => (key, ...args) => {
  2001. return registry.select(key)[selectorName](...args);
  2002. };
  2003. const getCoreDataAction = actionName => (key, ...args) => {
  2004. return registry.dispatch(key)[actionName](...args);
  2005. };
  2006. return {
  2007. getSelectors() {
  2008. return ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'].reduce((memo, selectorName) => ({ ...memo,
  2009. [selectorName]: getCoreDataSelector(selectorName)
  2010. }), {});
  2011. },
  2012. getActions() {
  2013. return ['startResolution', 'finishResolution', 'invalidateResolution', 'invalidateResolutionForStore', 'invalidateResolutionForStoreSelector'].reduce((memo, actionName) => ({ ...memo,
  2014. [actionName]: getCoreDataAction(actionName)
  2015. }), {});
  2016. },
  2017. subscribe() {
  2018. // There's no reasons to trigger any listener when we subscribe to this store
  2019. // because there's no state stored in this store that need to retrigger selectors
  2020. // if a change happens, the corresponding store where the tracking stated live
  2021. // would have already triggered a "subscribe" call.
  2022. return () => {};
  2023. }
  2024. };
  2025. }
  2026. /* harmony default export */ var build_module_store = (createCoreDataStore);
  2027. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/registry.js
  2028. /**
  2029. * External dependencies
  2030. */
  2031. /**
  2032. * Internal dependencies
  2033. */
  2034. /** @typedef {import('./types').WPDataStore} WPDataStore */
  2035. /**
  2036. * @typedef {Object} WPDataRegistry An isolated orchestrator of store registrations.
  2037. *
  2038. * @property {Function} registerGenericStore Given a namespace key and settings
  2039. * object, registers a new generic
  2040. * store.
  2041. * @property {Function} registerStore Given a namespace key and settings
  2042. * object, registers a new namespace
  2043. * store.
  2044. * @property {Function} subscribe Given a function callback, invokes
  2045. * the callback on any change to state
  2046. * within any registered store.
  2047. * @property {Function} select Given a namespace key, returns an
  2048. * object of the store's registered
  2049. * selectors.
  2050. * @property {Function} dispatch Given a namespace key, returns an
  2051. * object of the store's registered
  2052. * action dispatchers.
  2053. */
  2054. /**
  2055. * @typedef {Object} WPDataPlugin An object of registry function overrides.
  2056. *
  2057. * @property {Function} registerStore registers store.
  2058. */
  2059. /**
  2060. * Creates a new store registry, given an optional object of initial store
  2061. * configurations.
  2062. *
  2063. * @param {Object} storeConfigs Initial store configurations.
  2064. * @param {Object?} parent Parent registry.
  2065. *
  2066. * @return {WPDataRegistry} Data registry.
  2067. */
  2068. function createRegistry(storeConfigs = {}, parent = null) {
  2069. const stores = {};
  2070. let listeners = [];
  2071. const __experimentalListeningStores = new Set();
  2072. /**
  2073. * Global listener called for each store's update.
  2074. */
  2075. function globalListener() {
  2076. listeners.forEach(listener => listener());
  2077. }
  2078. /**
  2079. * Subscribe to changes to any data.
  2080. *
  2081. * @param {Function} listener Listener function.
  2082. *
  2083. * @return {Function} Unsubscribe function.
  2084. */
  2085. const subscribe = listener => {
  2086. listeners.push(listener);
  2087. return () => {
  2088. listeners = Object(external_lodash_["without"])(listeners, listener);
  2089. };
  2090. };
  2091. /**
  2092. * Calls a selector given the current state and extra arguments.
  2093. *
  2094. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  2095. * or the store definition.
  2096. *
  2097. * @return {*} The selector's returned value.
  2098. */
  2099. function select(storeNameOrDefinition) {
  2100. const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
  2101. __experimentalListeningStores.add(storeName);
  2102. const store = stores[storeName];
  2103. if (store) {
  2104. return store.getSelectors();
  2105. }
  2106. return parent && parent.select(storeName);
  2107. }
  2108. function __experimentalMarkListeningStores(callback, ref) {
  2109. __experimentalListeningStores.clear();
  2110. const result = callback.call(this);
  2111. ref.current = Array.from(__experimentalListeningStores);
  2112. return result;
  2113. }
  2114. /**
  2115. * Given the name of a registered store, returns an object containing the store's
  2116. * selectors pre-bound to state so that you only need to supply additional arguments,
  2117. * and modified so that they return promises that resolve to their eventual values,
  2118. * after any resolvers have ran.
  2119. *
  2120. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  2121. * or the store definition.
  2122. *
  2123. * @return {Object} Each key of the object matches the name of a selector.
  2124. */
  2125. function resolveSelect(storeNameOrDefinition) {
  2126. const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
  2127. __experimentalListeningStores.add(storeName);
  2128. const store = stores[storeName];
  2129. if (store) {
  2130. return store.getResolveSelectors();
  2131. }
  2132. return parent && parent.resolveSelect(storeName);
  2133. }
  2134. /**
  2135. * Returns the available actions for a part of the state.
  2136. *
  2137. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  2138. * or the store definition.
  2139. *
  2140. * @return {*} The action's returned value.
  2141. */
  2142. function dispatch(storeNameOrDefinition) {
  2143. const storeName = Object(external_lodash_["isObject"])(storeNameOrDefinition) ? storeNameOrDefinition.name : storeNameOrDefinition;
  2144. const store = stores[storeName];
  2145. if (store) {
  2146. return store.getActions();
  2147. }
  2148. return parent && parent.dispatch(storeName);
  2149. } //
  2150. // Deprecated
  2151. // TODO: Remove this after `use()` is removed.
  2152. //
  2153. function withPlugins(attributes) {
  2154. return Object(external_lodash_["mapValues"])(attributes, (attribute, key) => {
  2155. if (typeof attribute !== 'function') {
  2156. return attribute;
  2157. }
  2158. return function () {
  2159. return registry[key].apply(null, arguments);
  2160. };
  2161. });
  2162. }
  2163. /**
  2164. * Registers a generic store.
  2165. *
  2166. * @param {string} key Store registry key.
  2167. * @param {Object} config Configuration (getSelectors, getActions, subscribe).
  2168. */
  2169. function registerGenericStore(key, config) {
  2170. if (typeof config.getSelectors !== 'function') {
  2171. throw new TypeError('config.getSelectors must be a function');
  2172. }
  2173. if (typeof config.getActions !== 'function') {
  2174. throw new TypeError('config.getActions must be a function');
  2175. }
  2176. if (typeof config.subscribe !== 'function') {
  2177. throw new TypeError('config.subscribe must be a function');
  2178. }
  2179. stores[key] = config;
  2180. config.subscribe(globalListener);
  2181. }
  2182. /**
  2183. * Registers a new store definition.
  2184. *
  2185. * @param {WPDataStore} store Store definition.
  2186. */
  2187. function register(store) {
  2188. registerGenericStore(store.name, store.instantiate(registry));
  2189. }
  2190. /**
  2191. * Subscribe handler to a store.
  2192. *
  2193. * @param {string[]} storeName The store name.
  2194. * @param {Function} handler The function subscribed to the store.
  2195. * @return {Function} A function to unsubscribe the handler.
  2196. */
  2197. function __experimentalSubscribeStore(storeName, handler) {
  2198. if (storeName in stores) {
  2199. return stores[storeName].subscribe(handler);
  2200. } // Trying to access a store that hasn't been registered,
  2201. // this is a pattern rarely used but seen in some places.
  2202. // We fallback to regular `subscribe` here for backward-compatibility for now.
  2203. // See https://github.com/WordPress/gutenberg/pull/27466 for more info.
  2204. if (!parent) {
  2205. return subscribe(handler);
  2206. }
  2207. return parent.__experimentalSubscribeStore(storeName, handler);
  2208. }
  2209. let registry = {
  2210. registerGenericStore,
  2211. stores,
  2212. namespaces: stores,
  2213. // TODO: Deprecate/remove this.
  2214. subscribe,
  2215. select,
  2216. resolveSelect,
  2217. dispatch,
  2218. use,
  2219. register,
  2220. __experimentalMarkListeningStores,
  2221. __experimentalSubscribeStore
  2222. };
  2223. /**
  2224. * Registers a standard `@wordpress/data` store.
  2225. *
  2226. * @param {string} storeName Unique namespace identifier.
  2227. * @param {Object} options Store description (reducer, actions, selectors, resolvers).
  2228. *
  2229. * @return {Object} Registered store object.
  2230. */
  2231. registry.registerStore = (storeName, options) => {
  2232. if (!options.reducer) {
  2233. throw new TypeError('Must specify store reducer');
  2234. }
  2235. const store = createReduxStore(storeName, options).instantiate(registry);
  2236. registerGenericStore(storeName, store);
  2237. return store.store;
  2238. }; //
  2239. // TODO:
  2240. // This function will be deprecated as soon as it is no longer internally referenced.
  2241. //
  2242. function use(plugin, options) {
  2243. registry = { ...registry,
  2244. ...plugin(registry, options)
  2245. };
  2246. return registry;
  2247. }
  2248. registerGenericStore('core/data', build_module_store(registry));
  2249. Object.entries(storeConfigs).forEach(([name, config]) => registry.registerStore(name, config));
  2250. if (parent) {
  2251. parent.subscribe(globalListener);
  2252. }
  2253. return withPlugins(registry);
  2254. }
  2255. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/default-registry.js
  2256. /**
  2257. * Internal dependencies
  2258. */
  2259. /* harmony default export */ var default_registry = (createRegistry());
  2260. // EXTERNAL MODULE: external ["wp","deprecated"]
  2261. var external_wp_deprecated_ = __webpack_require__("NMb1");
  2262. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
  2263. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/controls/index.js
  2264. /**
  2265. * WordPress dependencies
  2266. */
  2267. /* harmony default export */ var plugins_controls = (registry => {
  2268. external_wp_deprecated_default()('wp.data.plugins.controls', {
  2269. since: '5.4',
  2270. hint: 'The controls plugins is now baked-in.'
  2271. });
  2272. return registry;
  2273. });
  2274. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/object.js
  2275. let objectStorage;
  2276. const storage = {
  2277. getItem(key) {
  2278. if (!objectStorage || !objectStorage[key]) {
  2279. return null;
  2280. }
  2281. return objectStorage[key];
  2282. },
  2283. setItem(key, value) {
  2284. if (!objectStorage) {
  2285. storage.clear();
  2286. }
  2287. objectStorage[key] = String(value);
  2288. },
  2289. clear() {
  2290. objectStorage = Object.create(null);
  2291. }
  2292. };
  2293. /* harmony default export */ var object = (storage);
  2294. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/storage/default.js
  2295. /**
  2296. * Internal dependencies
  2297. */
  2298. let default_storage;
  2299. try {
  2300. // Private Browsing in Safari 10 and earlier will throw an error when
  2301. // attempting to set into localStorage. The test here is intentional in
  2302. // causing a thrown error as condition for using fallback object storage.
  2303. default_storage = window.localStorage;
  2304. default_storage.setItem('__wpDataTestLocalStorage', '');
  2305. default_storage.removeItem('__wpDataTestLocalStorage');
  2306. } catch (error) {
  2307. default_storage = object;
  2308. }
  2309. /* harmony default export */ var storage_default = (default_storage);
  2310. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/persistence/index.js
  2311. /**
  2312. * External dependencies
  2313. */
  2314. /**
  2315. * Internal dependencies
  2316. */
  2317. /** @typedef {import('../../registry').WPDataRegistry} WPDataRegistry */
  2318. /** @typedef {import('../../registry').WPDataPlugin} WPDataPlugin */
  2319. /**
  2320. * @typedef {Object} WPDataPersistencePluginOptions Persistence plugin options.
  2321. *
  2322. * @property {Storage} storage Persistent storage implementation. This must
  2323. * at least implement `getItem` and `setItem` of
  2324. * the Web Storage API.
  2325. * @property {string} storageKey Key on which to set in persistent storage.
  2326. *
  2327. */
  2328. /**
  2329. * Default plugin storage.
  2330. *
  2331. * @type {Storage}
  2332. */
  2333. const DEFAULT_STORAGE = storage_default;
  2334. /**
  2335. * Default plugin storage key.
  2336. *
  2337. * @type {string}
  2338. */
  2339. const DEFAULT_STORAGE_KEY = 'WP_DATA';
  2340. /**
  2341. * Higher-order reducer which invokes the original reducer only if state is
  2342. * inequal from that of the action's `nextState` property, otherwise returning
  2343. * the original state reference.
  2344. *
  2345. * @param {Function} reducer Original reducer.
  2346. *
  2347. * @return {Function} Enhanced reducer.
  2348. */
  2349. const withLazySameState = reducer => (state, action) => {
  2350. if (action.nextState === state) {
  2351. return state;
  2352. }
  2353. return reducer(state, action);
  2354. };
  2355. /**
  2356. * Creates a persistence interface, exposing getter and setter methods (`get`
  2357. * and `set` respectively).
  2358. *
  2359. * @param {WPDataPersistencePluginOptions} options Plugin options.
  2360. *
  2361. * @return {Object} Persistence interface.
  2362. */
  2363. function createPersistenceInterface(options) {
  2364. const {
  2365. storage = DEFAULT_STORAGE,
  2366. storageKey = DEFAULT_STORAGE_KEY
  2367. } = options;
  2368. let data;
  2369. /**
  2370. * Returns the persisted data as an object, defaulting to an empty object.
  2371. *
  2372. * @return {Object} Persisted data.
  2373. */
  2374. function getData() {
  2375. if (data === undefined) {
  2376. // If unset, getItem is expected to return null. Fall back to
  2377. // empty object.
  2378. const persisted = storage.getItem(storageKey);
  2379. if (persisted === null) {
  2380. data = {};
  2381. } else {
  2382. try {
  2383. data = JSON.parse(persisted);
  2384. } catch (error) {
  2385. // Similarly, should any error be thrown during parse of
  2386. // the string (malformed JSON), fall back to empty object.
  2387. data = {};
  2388. }
  2389. }
  2390. }
  2391. return data;
  2392. }
  2393. /**
  2394. * Merges an updated reducer state into the persisted data.
  2395. *
  2396. * @param {string} key Key to update.
  2397. * @param {*} value Updated value.
  2398. */
  2399. function setData(key, value) {
  2400. data = { ...data,
  2401. [key]: value
  2402. };
  2403. storage.setItem(storageKey, JSON.stringify(data));
  2404. }
  2405. return {
  2406. get: getData,
  2407. set: setData
  2408. };
  2409. }
  2410. /**
  2411. * Data plugin to persist store state into a single storage key.
  2412. *
  2413. * @param {WPDataRegistry} registry Data registry.
  2414. * @param {?WPDataPersistencePluginOptions} pluginOptions Plugin options.
  2415. *
  2416. * @return {WPDataPlugin} Data plugin.
  2417. */
  2418. function persistencePlugin(registry, pluginOptions) {
  2419. const persistence = createPersistenceInterface(pluginOptions);
  2420. /**
  2421. * Creates an enhanced store dispatch function, triggering the state of the
  2422. * given store name to be persisted when changed.
  2423. *
  2424. * @param {Function} getState Function which returns current state.
  2425. * @param {string} storeName Store name.
  2426. * @param {?Array<string>} keys Optional subset of keys to save.
  2427. *
  2428. * @return {Function} Enhanced dispatch function.
  2429. */
  2430. function createPersistOnChange(getState, storeName, keys) {
  2431. let getPersistedState;
  2432. if (Array.isArray(keys)) {
  2433. // Given keys, the persisted state should by produced as an object
  2434. // of the subset of keys. This implementation uses combineReducers
  2435. // to leverage its behavior of returning the same object when none
  2436. // of the property values changes. This allows a strict reference
  2437. // equality to bypass a persistence set on an unchanging state.
  2438. const reducers = keys.reduce((accumulator, key) => Object.assign(accumulator, {
  2439. [key]: (state, action) => action.nextState[key]
  2440. }), {});
  2441. getPersistedState = withLazySameState(turbo_combine_reducers_default()(reducers));
  2442. } else {
  2443. getPersistedState = (state, action) => action.nextState;
  2444. }
  2445. let lastState = getPersistedState(undefined, {
  2446. nextState: getState()
  2447. });
  2448. return () => {
  2449. const state = getPersistedState(lastState, {
  2450. nextState: getState()
  2451. });
  2452. if (state !== lastState) {
  2453. persistence.set(storeName, state);
  2454. lastState = state;
  2455. }
  2456. };
  2457. }
  2458. return {
  2459. registerStore(storeName, options) {
  2460. if (!options.persist) {
  2461. return registry.registerStore(storeName, options);
  2462. } // Load from persistence to use as initial state.
  2463. const persistedState = persistence.get()[storeName];
  2464. if (persistedState !== undefined) {
  2465. let initialState = options.reducer(options.initialState, {
  2466. type: '@@WP/PERSISTENCE_RESTORE'
  2467. });
  2468. if (Object(external_lodash_["isPlainObject"])(initialState) && Object(external_lodash_["isPlainObject"])(persistedState)) {
  2469. // If state is an object, ensure that:
  2470. // - Other keys are left intact when persisting only a
  2471. // subset of keys.
  2472. // - New keys in what would otherwise be used as initial
  2473. // state are deeply merged as base for persisted value.
  2474. initialState = Object(external_lodash_["merge"])({}, initialState, persistedState);
  2475. } else {
  2476. // If there is a mismatch in object-likeness of default
  2477. // initial or persisted state, defer to persisted value.
  2478. initialState = persistedState;
  2479. }
  2480. options = { ...options,
  2481. initialState
  2482. };
  2483. }
  2484. const store = registry.registerStore(storeName, options);
  2485. store.subscribe(createPersistOnChange(store.getState, storeName, options.persist));
  2486. return store;
  2487. }
  2488. };
  2489. }
  2490. /**
  2491. * Deprecated: Remove this function and the code in WordPress Core that calls
  2492. * it once WordPress 5.4 is released.
  2493. */
  2494. persistencePlugin.__unstableMigrate = pluginOptions => {
  2495. var _state$coreEditor, _state$coreEditor$pre;
  2496. const persistence = createPersistenceInterface(pluginOptions);
  2497. const state = persistence.get(); // Migrate 'insertUsage' from 'core/editor' to 'core/block-editor'
  2498. const editorInsertUsage = (_state$coreEditor = state['core/editor']) === null || _state$coreEditor === void 0 ? void 0 : (_state$coreEditor$pre = _state$coreEditor.preferences) === null || _state$coreEditor$pre === void 0 ? void 0 : _state$coreEditor$pre.insertUsage;
  2499. if (editorInsertUsage) {
  2500. var _state$coreBlockEdi, _state$coreBlockEdi$p;
  2501. const blockEditorInsertUsage = (_state$coreBlockEdi = state['core/block-editor']) === null || _state$coreBlockEdi === void 0 ? void 0 : (_state$coreBlockEdi$p = _state$coreBlockEdi.preferences) === null || _state$coreBlockEdi$p === void 0 ? void 0 : _state$coreBlockEdi$p.insertUsage;
  2502. persistence.set('core/block-editor', {
  2503. preferences: {
  2504. insertUsage: { ...editorInsertUsage,
  2505. ...blockEditorInsertUsage
  2506. }
  2507. }
  2508. });
  2509. }
  2510. let editPostState = state['core/edit-post']; // Default `fullscreenMode` to `false` if any persisted state had existed
  2511. // and the user hadn't made an explicit choice about fullscreen mode. This
  2512. // is needed since `fullscreenMode` previously did not have a default value
  2513. // and was implicitly false by its absence. It is now `true` by default, but
  2514. // this change is not intended to affect upgrades from earlier versions.
  2515. const hadPersistedState = Object.keys(state).length > 0;
  2516. const hadFullscreenModePreference = Object(external_lodash_["has"])(state, ['core/edit-post', 'preferences', 'features', 'fullscreenMode']);
  2517. if (hadPersistedState && !hadFullscreenModePreference) {
  2518. editPostState = Object(external_lodash_["merge"])({}, editPostState, {
  2519. preferences: {
  2520. features: {
  2521. fullscreenMode: false
  2522. }
  2523. }
  2524. });
  2525. } // Migrate 'areTipsEnabled' from 'core/nux' to 'showWelcomeGuide' in 'core/edit-post'
  2526. const areTipsEnabled = Object(external_lodash_["get"])(state, ['core/nux', 'preferences', 'areTipsEnabled']);
  2527. const hasWelcomeGuide = Object(external_lodash_["has"])(state, ['core/edit-post', 'preferences', 'features', 'welcomeGuide']);
  2528. if (areTipsEnabled !== undefined && !hasWelcomeGuide) {
  2529. editPostState = Object(external_lodash_["merge"])({}, editPostState, {
  2530. preferences: {
  2531. features: {
  2532. welcomeGuide: areTipsEnabled
  2533. }
  2534. }
  2535. });
  2536. }
  2537. if (editPostState !== state['core/edit-post']) {
  2538. persistence.set('core/edit-post', editPostState);
  2539. }
  2540. };
  2541. /* harmony default export */ var plugins_persistence = (persistencePlugin);
  2542. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/plugins/index.js
  2543. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  2544. var esm_extends = __webpack_require__("wx14");
  2545. // EXTERNAL MODULE: external ["wp","element"]
  2546. var external_wp_element_ = __webpack_require__("GRId");
  2547. // EXTERNAL MODULE: external ["wp","compose"]
  2548. var external_wp_compose_ = __webpack_require__("K9lf");
  2549. // EXTERNAL MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
  2550. var use_memo_one_esm = __webpack_require__("mHlH");
  2551. // EXTERNAL MODULE: external ["wp","priorityQueue"]
  2552. var external_wp_priorityQueue_ = __webpack_require__("XI5e");
  2553. // EXTERNAL MODULE: external ["wp","isShallowEqual"]
  2554. var external_wp_isShallowEqual_ = __webpack_require__("rl8x");
  2555. var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_);
  2556. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/context.js
  2557. /**
  2558. * WordPress dependencies
  2559. */
  2560. /**
  2561. * Internal dependencies
  2562. */
  2563. const Context = Object(external_wp_element_["createContext"])(default_registry);
  2564. const {
  2565. Consumer,
  2566. Provider
  2567. } = Context;
  2568. /**
  2569. * A custom react Context consumer exposing the provided `registry` to
  2570. * children components. Used along with the RegistryProvider.
  2571. *
  2572. * You can read more about the react context api here:
  2573. * https://reactjs.org/docs/context.html#contextprovider
  2574. *
  2575. * @example
  2576. * ```js
  2577. * import {
  2578. * RegistryProvider,
  2579. * RegistryConsumer,
  2580. * createRegistry
  2581. * } from '@wordpress/data';
  2582. *
  2583. * const registry = createRegistry( {} );
  2584. *
  2585. * const App = ( { props } ) => {
  2586. * return <RegistryProvider value={ registry }>
  2587. * <div>Hello There</div>
  2588. * <RegistryConsumer>
  2589. * { ( registry ) => (
  2590. * <ComponentUsingRegistry
  2591. * { ...props }
  2592. * registry={ registry }
  2593. * ) }
  2594. * </RegistryConsumer>
  2595. * </RegistryProvider>
  2596. * }
  2597. * ```
  2598. */
  2599. const RegistryConsumer = Consumer;
  2600. /**
  2601. * A custom Context provider for exposing the provided `registry` to children
  2602. * components via a consumer.
  2603. *
  2604. * See <a name="#RegistryConsumer">RegistryConsumer</a> documentation for
  2605. * example.
  2606. */
  2607. /* harmony default export */ var context = (Provider);
  2608. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/registry-provider/use-registry.js
  2609. /**
  2610. * WordPress dependencies
  2611. */
  2612. /**
  2613. * Internal dependencies
  2614. */
  2615. /**
  2616. * A custom react hook exposing the registry context for use.
  2617. *
  2618. * This exposes the `registry` value provided via the
  2619. * <a href="#RegistryProvider">Registry Provider</a> to a component implementing
  2620. * this hook.
  2621. *
  2622. * It acts similarly to the `useContext` react hook.
  2623. *
  2624. * Note: Generally speaking, `useRegistry` is a low level hook that in most cases
  2625. * won't be needed for implementation. Most interactions with the `@wordpress/data`
  2626. * API can be performed via the `useSelect` hook, or the `withSelect` and
  2627. * `withDispatch` higher order components.
  2628. *
  2629. * @example
  2630. * ```js
  2631. * import {
  2632. * RegistryProvider,
  2633. * createRegistry,
  2634. * useRegistry,
  2635. * } from '@wordpress/data';
  2636. *
  2637. * const registry = createRegistry( {} );
  2638. *
  2639. * const SomeChildUsingRegistry = ( props ) => {
  2640. * const registry = useRegistry( registry );
  2641. * // ...logic implementing the registry in other react hooks.
  2642. * };
  2643. *
  2644. *
  2645. * const ParentProvidingRegistry = ( props ) => {
  2646. * return <RegistryProvider value={ registry }>
  2647. * <SomeChildUsingRegistry { ...props } />
  2648. * </RegistryProvider>
  2649. * };
  2650. * ```
  2651. *
  2652. * @return {Function} A custom react hook exposing the registry context value.
  2653. */
  2654. function useRegistry() {
  2655. return Object(external_wp_element_["useContext"])(Context);
  2656. }
  2657. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/context.js
  2658. /**
  2659. * WordPress dependencies
  2660. */
  2661. const context_Context = Object(external_wp_element_["createContext"])(false);
  2662. const {
  2663. Consumer: context_Consumer,
  2664. Provider: context_Provider
  2665. } = context_Context;
  2666. const AsyncModeConsumer = context_Consumer;
  2667. /**
  2668. * Context Provider Component used to switch the data module component rerendering
  2669. * between Sync and Async modes.
  2670. *
  2671. * @example
  2672. *
  2673. * ```js
  2674. * import { useSelect, AsyncModeProvider } from '@wordpress/data';
  2675. *
  2676. * function BlockCount() {
  2677. * const count = useSelect( ( select ) => {
  2678. * return select( 'core/block-editor' ).getBlockCount()
  2679. * }, [] );
  2680. *
  2681. * return count;
  2682. * }
  2683. *
  2684. * function App() {
  2685. * return (
  2686. * <AsyncModeProvider value={ true }>
  2687. * <BlockCount />
  2688. * </AsyncModeProvider>
  2689. * );
  2690. * }
  2691. * ```
  2692. *
  2693. * In this example, the BlockCount component is rerendered asynchronously.
  2694. * It means if a more critical task is being performed (like typing in an input),
  2695. * the rerendering is delayed until the browser becomes IDLE.
  2696. * It is possible to nest multiple levels of AsyncModeProvider to fine-tune the rendering behavior.
  2697. *
  2698. * @param {boolean} props.value Enable Async Mode.
  2699. * @return {WPComponent} The component to be rendered.
  2700. */
  2701. /* harmony default export */ var async_mode_provider_context = (context_Provider);
  2702. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/async-mode-provider/use-async-mode.js
  2703. /**
  2704. * WordPress dependencies
  2705. */
  2706. /**
  2707. * Internal dependencies
  2708. */
  2709. function useAsyncMode() {
  2710. return Object(external_wp_element_["useContext"])(context_Context);
  2711. }
  2712. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-select/index.js
  2713. /**
  2714. * External dependencies
  2715. */
  2716. /**
  2717. * WordPress dependencies
  2718. */
  2719. /**
  2720. * Internal dependencies
  2721. */
  2722. const renderQueue = Object(external_wp_priorityQueue_["createQueue"])();
  2723. /** @typedef {import('./types').WPDataStore} WPDataStore */
  2724. /**
  2725. * Custom react hook for retrieving props from registered selectors.
  2726. *
  2727. * In general, this custom React hook follows the
  2728. * [rules of hooks](https://reactjs.org/docs/hooks-rules.html).
  2729. *
  2730. * @param {Function|WPDataStore|string} _mapSelect Function called on every state change. The
  2731. * returned value is exposed to the component
  2732. * implementing this hook. The function receives
  2733. * the `registry.select` method on the first
  2734. * argument and the `registry` on the second
  2735. * argument.
  2736. * When a store key is passed, all selectors for
  2737. * the store will be returned. This is only meant
  2738. * for usage of these selectors in event
  2739. * callbacks, not for data needed to create the
  2740. * element tree.
  2741. * @param {Array} deps If provided, this memoizes the mapSelect so the
  2742. * same `mapSelect` is invoked on every state
  2743. * change unless the dependencies change.
  2744. *
  2745. * @example
  2746. * ```js
  2747. * import { useSelect } from '@wordpress/data';
  2748. *
  2749. * function HammerPriceDisplay( { currency } ) {
  2750. * const price = useSelect( ( select ) => {
  2751. * return select( 'my-shop' ).getPrice( 'hammer', currency )
  2752. * }, [ currency ] );
  2753. * return new Intl.NumberFormat( 'en-US', {
  2754. * style: 'currency',
  2755. * currency,
  2756. * } ).format( price );
  2757. * }
  2758. *
  2759. * // Rendered in the application:
  2760. * // <HammerPriceDisplay currency="USD" />
  2761. * ```
  2762. *
  2763. * In the above example, when `HammerPriceDisplay` is rendered into an
  2764. * application, the price will be retrieved from the store state using the
  2765. * `mapSelect` callback on `useSelect`. If the currency prop changes then
  2766. * any price in the state for that currency is retrieved. If the currency prop
  2767. * doesn't change and other props are passed in that do change, the price will
  2768. * not change because the dependency is just the currency.
  2769. *
  2770. * When data is only used in an event callback, the data should not be retrieved
  2771. * on render, so it may be useful to get the selectors function instead.
  2772. *
  2773. * **Don't use `useSelect` this way when calling the selectors in the render
  2774. * function because your component won't re-render on a data change.**
  2775. *
  2776. * ```js
  2777. * import { useSelect } from '@wordpress/data';
  2778. *
  2779. * function Paste( { children } ) {
  2780. * const { getSettings } = useSelect( 'my-shop' );
  2781. * function onPaste() {
  2782. * // Do something with the settings.
  2783. * const settings = getSettings();
  2784. * }
  2785. * return <div onPaste={ onPaste }>{ children }</div>;
  2786. * }
  2787. * ```
  2788. *
  2789. * @return {Function} A custom react hook.
  2790. */
  2791. function useSelect(_mapSelect, deps) {
  2792. const isWithoutMapping = typeof _mapSelect !== 'function';
  2793. if (isWithoutMapping) {
  2794. deps = [];
  2795. }
  2796. const mapSelect = Object(external_wp_element_["useCallback"])(_mapSelect, deps);
  2797. const registry = useRegistry();
  2798. const isAsync = useAsyncMode(); // React can sometimes clear the `useMemo` cache.
  2799. // We use the cache-stable `useMemoOne` to avoid
  2800. // losing queues.
  2801. const queueContext = Object(use_memo_one_esm["a" /* useMemoOne */])(() => ({
  2802. queue: true
  2803. }), [registry]);
  2804. const [, forceRender] = Object(external_wp_element_["useReducer"])(s => s + 1, 0);
  2805. const latestMapSelect = Object(external_wp_element_["useRef"])();
  2806. const latestIsAsync = Object(external_wp_element_["useRef"])(isAsync);
  2807. const latestMapOutput = Object(external_wp_element_["useRef"])();
  2808. const latestMapOutputError = Object(external_wp_element_["useRef"])();
  2809. const isMountedAndNotUnsubscribing = Object(external_wp_element_["useRef"])(); // Keep track of the stores being selected in the mapSelect function,
  2810. // and only subscribe to those stores later.
  2811. const listeningStores = Object(external_wp_element_["useRef"])([]);
  2812. const trapSelect = Object(external_wp_element_["useCallback"])(callback => registry.__experimentalMarkListeningStores(callback, listeningStores), [registry]); // Generate a "flag" for used in the effect dependency array.
  2813. // It's different than just using `mapSelect` since deps could be undefined,
  2814. // in that case, we would still want to memoize it.
  2815. const depsChangedFlag = Object(external_wp_element_["useMemo"])(() => ({}), deps || []);
  2816. let mapOutput;
  2817. if (!isWithoutMapping) {
  2818. try {
  2819. if (latestMapSelect.current !== mapSelect || latestMapOutputError.current) {
  2820. mapOutput = trapSelect(() => mapSelect(registry.select, registry));
  2821. } else {
  2822. mapOutput = latestMapOutput.current;
  2823. }
  2824. } catch (error) {
  2825. let errorMessage = `An error occurred while running 'mapSelect': ${error.message}`;
  2826. if (latestMapOutputError.current) {
  2827. errorMessage += `\nThe error may be correlated with this previous error:\n`;
  2828. errorMessage += `${latestMapOutputError.current.stack}\n\n`;
  2829. errorMessage += 'Original stack trace:';
  2830. } // eslint-disable-next-line no-console
  2831. console.error(errorMessage);
  2832. mapOutput = latestMapOutput.current;
  2833. }
  2834. }
  2835. Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
  2836. if (isWithoutMapping) {
  2837. return;
  2838. }
  2839. latestMapSelect.current = mapSelect;
  2840. latestMapOutput.current = mapOutput;
  2841. latestMapOutputError.current = undefined;
  2842. isMountedAndNotUnsubscribing.current = true; // This has to run after the other ref updates
  2843. // to avoid using stale values in the flushed
  2844. // callbacks or potentially overwriting a
  2845. // changed `latestMapOutput.current`.
  2846. if (latestIsAsync.current !== isAsync) {
  2847. latestIsAsync.current = isAsync;
  2848. renderQueue.flush(queueContext);
  2849. }
  2850. });
  2851. Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
  2852. if (isWithoutMapping) {
  2853. return;
  2854. }
  2855. const onStoreChange = () => {
  2856. if (isMountedAndNotUnsubscribing.current) {
  2857. try {
  2858. const newMapOutput = trapSelect(() => latestMapSelect.current(registry.select, registry));
  2859. if (external_wp_isShallowEqual_default()(latestMapOutput.current, newMapOutput)) {
  2860. return;
  2861. }
  2862. latestMapOutput.current = newMapOutput;
  2863. } catch (error) {
  2864. latestMapOutputError.current = error;
  2865. }
  2866. forceRender();
  2867. }
  2868. }; // catch any possible state changes during mount before the subscription
  2869. // could be set.
  2870. if (latestIsAsync.current) {
  2871. renderQueue.add(queueContext, onStoreChange);
  2872. } else {
  2873. onStoreChange();
  2874. }
  2875. const onChange = () => {
  2876. if (latestIsAsync.current) {
  2877. renderQueue.add(queueContext, onStoreChange);
  2878. } else {
  2879. onStoreChange();
  2880. }
  2881. };
  2882. const unsubscribers = listeningStores.current.map(storeName => registry.__experimentalSubscribeStore(storeName, onChange));
  2883. return () => {
  2884. isMountedAndNotUnsubscribing.current = false; // The return value of the subscribe function could be undefined if the store is a custom generic store.
  2885. unsubscribers.forEach(unsubscribe => unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe());
  2886. renderQueue.flush(queueContext);
  2887. };
  2888. }, [registry, trapSelect, depsChangedFlag, isWithoutMapping]);
  2889. return isWithoutMapping ? registry.select(_mapSelect) : mapOutput;
  2890. }
  2891. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-select/index.js
  2892. /**
  2893. * WordPress dependencies
  2894. */
  2895. /**
  2896. * Internal dependencies
  2897. */
  2898. /**
  2899. * Higher-order component used to inject state-derived props using registered
  2900. * selectors.
  2901. *
  2902. * @param {Function} mapSelectToProps Function called on every state change,
  2903. * expected to return object of props to
  2904. * merge with the component's own props.
  2905. *
  2906. * @example
  2907. * ```js
  2908. * import { withSelect } from '@wordpress/data';
  2909. *
  2910. * function PriceDisplay( { price, currency } ) {
  2911. * return new Intl.NumberFormat( 'en-US', {
  2912. * style: 'currency',
  2913. * currency,
  2914. * } ).format( price );
  2915. * }
  2916. *
  2917. * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {
  2918. * const { getPrice } = select( 'my-shop' );
  2919. * const { currency } = ownProps;
  2920. *
  2921. * return {
  2922. * price: getPrice( 'hammer', currency ),
  2923. * };
  2924. * } )( PriceDisplay );
  2925. *
  2926. * // Rendered in the application:
  2927. * //
  2928. * // <HammerPriceDisplay currency="USD" />
  2929. * ```
  2930. * In the above example, when `HammerPriceDisplay` is rendered into an
  2931. * application, it will pass the price into the underlying `PriceDisplay`
  2932. * component and update automatically if the price of a hammer ever changes in
  2933. * the store.
  2934. *
  2935. * @return {WPComponent} Enhanced component with merged state data props.
  2936. */
  2937. const withSelect = mapSelectToProps => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_compose_["pure"])(ownProps => {
  2938. const mapSelect = (select, registry) => mapSelectToProps(select, ownProps, registry);
  2939. const mergeProps = useSelect(mapSelect);
  2940. return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, mergeProps));
  2941. }), 'withSelect');
  2942. /* harmony default export */ var with_select = (withSelect);
  2943. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch-with-map.js
  2944. /**
  2945. * External dependencies
  2946. */
  2947. /**
  2948. * WordPress dependencies
  2949. */
  2950. /**
  2951. * Internal dependencies
  2952. */
  2953. /**
  2954. * Custom react hook for returning aggregate dispatch actions using the provided
  2955. * dispatchMap.
  2956. *
  2957. * Currently this is an internal api only and is implemented by `withDispatch`
  2958. *
  2959. * @param {Function} dispatchMap Receives the `registry.dispatch` function as
  2960. * the first argument and the `registry` object
  2961. * as the second argument. Should return an
  2962. * object mapping props to functions.
  2963. * @param {Array} deps An array of dependencies for the hook.
  2964. * @return {Object} An object mapping props to functions created by the passed
  2965. * in dispatchMap.
  2966. */
  2967. const useDispatchWithMap = (dispatchMap, deps) => {
  2968. const registry = useRegistry();
  2969. const currentDispatchMap = Object(external_wp_element_["useRef"])(dispatchMap);
  2970. Object(external_wp_compose_["useIsomorphicLayoutEffect"])(() => {
  2971. currentDispatchMap.current = dispatchMap;
  2972. });
  2973. return Object(external_wp_element_["useMemo"])(() => {
  2974. const currentDispatchProps = currentDispatchMap.current(registry.dispatch, registry);
  2975. return Object(external_lodash_["mapValues"])(currentDispatchProps, (dispatcher, propName) => {
  2976. if (typeof dispatcher !== 'function') {
  2977. // eslint-disable-next-line no-console
  2978. console.warn(`Property ${propName} returned from dispatchMap in useDispatchWithMap must be a function.`);
  2979. }
  2980. return (...args) => currentDispatchMap.current(registry.dispatch, registry)[propName](...args);
  2981. });
  2982. }, [registry, ...deps]);
  2983. };
  2984. /* harmony default export */ var use_dispatch_with_map = (useDispatchWithMap);
  2985. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-dispatch/index.js
  2986. /**
  2987. * WordPress dependencies
  2988. */
  2989. /**
  2990. * Internal dependencies
  2991. */
  2992. /**
  2993. * Higher-order component used to add dispatch props using registered action
  2994. * creators.
  2995. *
  2996. * @param {Function} mapDispatchToProps A function of returning an object of
  2997. * prop names where value is a
  2998. * dispatch-bound action creator, or a
  2999. * function to be called with the
  3000. * component's props and returning an
  3001. * action creator.
  3002. *
  3003. * @example
  3004. * ```jsx
  3005. * function Button( { onClick, children } ) {
  3006. * return <button type="button" onClick={ onClick }>{ children }</button>;
  3007. * }
  3008. *
  3009. * import { withDispatch } from '@wordpress/data';
  3010. *
  3011. * const SaleButton = withDispatch( ( dispatch, ownProps ) => {
  3012. * const { startSale } = dispatch( 'my-shop' );
  3013. * const { discountPercent } = ownProps;
  3014. *
  3015. * return {
  3016. * onClick() {
  3017. * startSale( discountPercent );
  3018. * },
  3019. * };
  3020. * } )( Button );
  3021. *
  3022. * // Rendered in the application:
  3023. * //
  3024. * // <SaleButton discountPercent="20">Start Sale!</SaleButton>
  3025. * ```
  3026. *
  3027. * @example
  3028. * In the majority of cases, it will be sufficient to use only two first params
  3029. * passed to `mapDispatchToProps` as illustrated in the previous example.
  3030. * However, there might be some very advanced use cases where using the
  3031. * `registry` object might be used as a tool to optimize the performance of
  3032. * your component. Using `select` function from the registry might be useful
  3033. * when you need to fetch some dynamic data from the store at the time when the
  3034. * event is fired, but at the same time, you never use it to render your
  3035. * component. In such scenario, you can avoid using the `withSelect` higher
  3036. * order component to compute such prop, which might lead to unnecessary
  3037. * re-renders of your component caused by its frequent value change.
  3038. * Keep in mind, that `mapDispatchToProps` must return an object with functions
  3039. * only.
  3040. *
  3041. * ```jsx
  3042. * function Button( { onClick, children } ) {
  3043. * return <button type="button" onClick={ onClick }>{ children }</button>;
  3044. * }
  3045. *
  3046. * import { withDispatch } from '@wordpress/data';
  3047. *
  3048. * const SaleButton = withDispatch( ( dispatch, ownProps, { select } ) => {
  3049. * // Stock number changes frequently.
  3050. * const { getStockNumber } = select( 'my-shop' );
  3051. * const { startSale } = dispatch( 'my-shop' );
  3052. * return {
  3053. * onClick() {
  3054. * const discountPercent = getStockNumber() > 50 ? 10 : 20;
  3055. * startSale( discountPercent );
  3056. * },
  3057. * };
  3058. * } )( Button );
  3059. *
  3060. * // Rendered in the application:
  3061. * //
  3062. * // <SaleButton>Start Sale!</SaleButton>
  3063. * ```
  3064. *
  3065. * _Note:_ It is important that the `mapDispatchToProps` function always
  3066. * returns an object with the same keys. For example, it should not contain
  3067. * conditions under which a different value would be returned.
  3068. *
  3069. * @return {WPComponent} Enhanced component with merged dispatcher props.
  3070. */
  3071. const withDispatch = mapDispatchToProps => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => ownProps => {
  3072. const mapDispatch = (dispatch, registry) => mapDispatchToProps(dispatch, ownProps, registry);
  3073. const dispatchProps = use_dispatch_with_map(mapDispatch, []);
  3074. return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, ownProps, dispatchProps));
  3075. }, 'withDispatch');
  3076. /* harmony default export */ var with_dispatch = (withDispatch);
  3077. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/with-registry/index.js
  3078. /**
  3079. * WordPress dependencies
  3080. */
  3081. /**
  3082. * Internal dependencies
  3083. */
  3084. /**
  3085. * Higher-order component which renders the original component with the current
  3086. * registry context passed as its `registry` prop.
  3087. *
  3088. * @param {WPComponent} OriginalComponent Original component.
  3089. *
  3090. * @return {WPComponent} Enhanced component.
  3091. */
  3092. const withRegistry = Object(external_wp_compose_["createHigherOrderComponent"])(OriginalComponent => props => Object(external_wp_element_["createElement"])(RegistryConsumer, null, registry => Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, {
  3093. registry: registry
  3094. }))), 'withRegistry');
  3095. /* harmony default export */ var with_registry = (withRegistry);
  3096. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/components/use-dispatch/use-dispatch.js
  3097. /**
  3098. * Internal dependencies
  3099. */
  3100. /** @typedef {import('./types').WPDataStore} WPDataStore */
  3101. /**
  3102. * A custom react hook returning the current registry dispatch actions creators.
  3103. *
  3104. * Note: The component using this hook must be within the context of a
  3105. * RegistryProvider.
  3106. *
  3107. * @param {string|WPDataStore} [storeNameOrDefinition] Optionally provide the name of the
  3108. * store or its definition from which to
  3109. * retrieve action creators. If not
  3110. * provided, the registry.dispatch
  3111. * function is returned instead.
  3112. *
  3113. * @example
  3114. * This illustrates a pattern where you may need to retrieve dynamic data from
  3115. * the server via the `useSelect` hook to use in combination with the dispatch
  3116. * action.
  3117. *
  3118. * ```jsx
  3119. * import { useDispatch, useSelect } from '@wordpress/data';
  3120. * import { useCallback } from '@wordpress/element';
  3121. *
  3122. * function Button( { onClick, children } ) {
  3123. * return <button type="button" onClick={ onClick }>{ children }</button>
  3124. * }
  3125. *
  3126. * const SaleButton = ( { children } ) => {
  3127. * const { stockNumber } = useSelect(
  3128. * ( select ) => select( 'my-shop' ).getStockNumber(),
  3129. * []
  3130. * );
  3131. * const { startSale } = useDispatch( 'my-shop' );
  3132. * const onClick = useCallback( () => {
  3133. * const discountPercent = stockNumber > 50 ? 10: 20;
  3134. * startSale( discountPercent );
  3135. * }, [ stockNumber ] );
  3136. * return <Button onClick={ onClick }>{ children }</Button>
  3137. * }
  3138. *
  3139. * // Rendered somewhere in the application:
  3140. * //
  3141. * // <SaleButton>Start Sale!</SaleButton>
  3142. * ```
  3143. * @return {Function} A custom react hook.
  3144. */
  3145. const useDispatch = storeNameOrDefinition => {
  3146. const {
  3147. dispatch
  3148. } = useRegistry();
  3149. return storeNameOrDefinition === void 0 ? dispatch : dispatch(storeNameOrDefinition);
  3150. };
  3151. /* harmony default export */ var use_dispatch = (useDispatch);
  3152. // CONCATENATED MODULE: ./node_modules/@wordpress/data/build-module/index.js
  3153. /**
  3154. * External dependencies
  3155. */
  3156. /**
  3157. * Internal dependencies
  3158. */
  3159. /** @typedef {import('./types').WPDataStore} WPDataStore */
  3160. /**
  3161. * Object of available plugins to use with a registry.
  3162. *
  3163. * @see [use](#use)
  3164. *
  3165. * @type {Object}
  3166. */
  3167. /**
  3168. * The combineReducers helper function turns an object whose values are different
  3169. * reducing functions into a single reducing function you can pass to registerReducer.
  3170. *
  3171. * @param {Object} reducers An object whose values correspond to different reducing
  3172. * functions that need to be combined into one.
  3173. *
  3174. * @example
  3175. * ```js
  3176. * import { combineReducers, createReduxStore, register } from '@wordpress/data';
  3177. *
  3178. * const prices = ( state = {}, action ) => {
  3179. * return action.type === 'SET_PRICE' ?
  3180. * {
  3181. * ...state,
  3182. * [ action.item ]: action.price,
  3183. * } :
  3184. * state;
  3185. * };
  3186. *
  3187. * const discountPercent = ( state = 0, action ) => {
  3188. * return action.type === 'START_SALE' ?
  3189. * action.discountPercent :
  3190. * state;
  3191. * };
  3192. *
  3193. * const store = createReduxStore( 'my-shop', {
  3194. * reducer: combineReducers( {
  3195. * prices,
  3196. * discountPercent,
  3197. * } ),
  3198. * } );
  3199. * register( store );
  3200. * ```
  3201. *
  3202. * @return {Function} A reducer that invokes every reducer inside the reducers
  3203. * object, and constructs a state object with the same shape.
  3204. */
  3205. /**
  3206. * Given the name or definition of a registered store, returns an object of the store's selectors.
  3207. * The selector functions are been pre-bound to pass the current state automatically.
  3208. * As a consumer, you need only pass arguments of the selector, if applicable.
  3209. *
  3210. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  3211. * or the store definition.
  3212. *
  3213. * @example
  3214. * ```js
  3215. * import { select } from '@wordpress/data';
  3216. *
  3217. * select( 'my-shop' ).getPrice( 'hammer' );
  3218. * ```
  3219. *
  3220. * @return {Object} Object containing the store's selectors.
  3221. */
  3222. const build_module_select = default_registry.select;
  3223. /**
  3224. * Given the name of a registered store, returns an object containing the store's
  3225. * selectors pre-bound to state so that you only need to supply additional arguments,
  3226. * and modified so that they return promises that resolve to their eventual values,
  3227. * after any resolvers have ran.
  3228. *
  3229. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  3230. * or the store definition.
  3231. *
  3232. * @example
  3233. * ```js
  3234. * import { resolveSelect } from '@wordpress/data';
  3235. *
  3236. * resolveSelect( 'my-shop' ).getPrice( 'hammer' ).then(console.log)
  3237. * ```
  3238. *
  3239. * @return {Object} Object containing the store's promise-wrapped selectors.
  3240. */
  3241. const build_module_resolveSelect = default_registry.resolveSelect;
  3242. /**
  3243. * Given the name of a registered store, returns an object of the store's action creators.
  3244. * Calling an action creator will cause it to be dispatched, updating the state value accordingly.
  3245. *
  3246. * Note: Action creators returned by the dispatch will return a promise when
  3247. * they are called.
  3248. *
  3249. * @param {string|WPDataStore} storeNameOrDefinition Unique namespace identifier for the store
  3250. * or the store definition.
  3251. *
  3252. * @example
  3253. * ```js
  3254. * import { dispatch } from '@wordpress/data';
  3255. *
  3256. * dispatch( 'my-shop' ).setPrice( 'hammer', 9.75 );
  3257. * ```
  3258. * @return {Object} Object containing the action creators.
  3259. */
  3260. const build_module_dispatch = default_registry.dispatch;
  3261. /**
  3262. * Given a listener function, the function will be called any time the state value
  3263. * of one of the registered stores has changed. This function returns a `unsubscribe`
  3264. * function used to stop the subscription.
  3265. *
  3266. * @param {Function} listener Callback function.
  3267. *
  3268. * @example
  3269. * ```js
  3270. * import { subscribe } from '@wordpress/data';
  3271. *
  3272. * const unsubscribe = subscribe( () => {
  3273. * // You could use this opportunity to test whether the derived result of a
  3274. * // selector has subsequently changed as the result of a state update.
  3275. * } );
  3276. *
  3277. * // Later, if necessary...
  3278. * unsubscribe();
  3279. * ```
  3280. */
  3281. const build_module_subscribe = default_registry.subscribe;
  3282. /**
  3283. * Registers a generic store.
  3284. *
  3285. * @deprecated Use `register` instead.
  3286. *
  3287. * @param {string} key Store registry key.
  3288. * @param {Object} config Configuration (getSelectors, getActions, subscribe).
  3289. */
  3290. const build_module_registerGenericStore = default_registry.registerGenericStore;
  3291. /**
  3292. * Registers a standard `@wordpress/data` store.
  3293. *
  3294. * @deprecated Use `register` instead.
  3295. *
  3296. * @param {string} storeName Unique namespace identifier for the store.
  3297. * @param {Object} options Store description (reducer, actions, selectors, resolvers).
  3298. *
  3299. * @return {Object} Registered store object.
  3300. */
  3301. const registerStore = default_registry.registerStore;
  3302. /**
  3303. * Extends a registry to inherit functionality provided by a given plugin. A
  3304. * plugin is an object with properties aligning to that of a registry, merged
  3305. * to extend the default registry behavior.
  3306. *
  3307. * @param {Object} plugin Plugin object.
  3308. */
  3309. const build_module_use = default_registry.use;
  3310. /**
  3311. * Registers a standard `@wordpress/data` store definition.
  3312. *
  3313. * @example
  3314. * ```js
  3315. * import { createReduxStore, register } from '@wordpress/data';
  3316. *
  3317. * const store = createReduxStore( 'demo', {
  3318. * reducer: ( state = 'OK' ) => state,
  3319. * selectors: {
  3320. * getValue: ( state ) => state,
  3321. * },
  3322. * } );
  3323. * register( store );
  3324. * ```
  3325. *
  3326. * @param {WPDataStore} store Store definition.
  3327. */
  3328. const build_module_register = default_registry.register;
  3329. /***/ }),
  3330. /***/ "rl8x":
  3331. /***/ (function(module, exports) {
  3332. (function() { module.exports = window["wp"]["isShallowEqual"]; }());
  3333. /***/ }),
  3334. /***/ "wx14":
  3335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3336. "use strict";
  3337. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
  3338. function _extends() {
  3339. _extends = Object.assign || function (target) {
  3340. for (var i = 1; i < arguments.length; i++) {
  3341. var source = arguments[i];
  3342. for (var key in source) {
  3343. if (Object.prototype.hasOwnProperty.call(source, key)) {
  3344. target[key] = source[key];
  3345. }
  3346. }
  3347. }
  3348. return target;
  3349. };
  3350. return _extends.apply(this, arguments);
  3351. }
  3352. /***/ })
  3353. /******/ });