[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> block-directory.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["blockDirectory"] =
   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 = 429);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 1:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = this["wp"]["i18n"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 10:
 105  /***/ (function(module, exports) {
 106  
 107  (function() { module.exports = this["wp"]["blocks"]; }());
 108  
 109  /***/ }),
 110  
 111  /***/ 18:
 112  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 113  
 114  "use strict";
 115  
 116  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 117  var arrayLikeToArray = __webpack_require__(25);
 118  
 119  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 120  
 121  function _arrayWithoutHoles(arr) {
 122    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 123  }
 124  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 125  var iterableToArray = __webpack_require__(35);
 126  
 127  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 128  var unsupportedIterableToArray = __webpack_require__(27);
 129  
 130  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 131  function _nonIterableSpread() {
 132    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 133  }
 134  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 135  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
 136  
 137  
 138  
 139  
 140  function _toConsumableArray(arr) {
 141    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 142  }
 143  
 144  /***/ }),
 145  
 146  /***/ 2:
 147  /***/ (function(module, exports) {
 148  
 149  (function() { module.exports = this["lodash"]; }());
 150  
 151  /***/ }),
 152  
 153  /***/ 20:
 154  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 155  
 156  "use strict";
 157  
 158  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 159  var arrayWithHoles = __webpack_require__(38);
 160  
 161  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 162  function _iterableToArrayLimit(arr, i) {
 163    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 164    var _arr = [];
 165    var _n = true;
 166    var _d = false;
 167    var _e = undefined;
 168  
 169    try {
 170      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 171        _arr.push(_s.value);
 172  
 173        if (i && _arr.length === i) break;
 174      }
 175    } catch (err) {
 176      _d = true;
 177      _e = err;
 178    } finally {
 179      try {
 180        if (!_n && _i["return"] != null) _i["return"]();
 181      } finally {
 182        if (_d) throw _e;
 183      }
 184    }
 185  
 186    return _arr;
 187  }
 188  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 189  var unsupportedIterableToArray = __webpack_require__(27);
 190  
 191  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 192  var nonIterableRest = __webpack_require__(39);
 193  
 194  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 195  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
 196  
 197  
 198  
 199  
 200  function _slicedToArray(arr, i) {
 201    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 202  }
 203  
 204  /***/ }),
 205  
 206  /***/ 23:
 207  /***/ (function(module, exports) {
 208  
 209  (function() { module.exports = this["regeneratorRuntime"]; }());
 210  
 211  /***/ }),
 212  
 213  /***/ 25:
 214  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 215  
 216  "use strict";
 217  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 218  function _arrayLikeToArray(arr, len) {
 219    if (len == null || len > arr.length) len = arr.length;
 220  
 221    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 222      arr2[i] = arr[i];
 223    }
 224  
 225    return arr2;
 226  }
 227  
 228  /***/ }),
 229  
 230  /***/ 27:
 231  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 232  
 233  "use strict";
 234  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 235  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
 236  
 237  function _unsupportedIterableToArray(o, minLen) {
 238    if (!o) return;
 239    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 240    var n = Object.prototype.toString.call(o).slice(8, -1);
 241    if (n === "Object" && o.constructor) n = o.constructor.name;
 242    if (n === "Map" || n === "Set") return Array.from(n);
 243    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 244  }
 245  
 246  /***/ }),
 247  
 248  /***/ 3:
 249  /***/ (function(module, exports) {
 250  
 251  (function() { module.exports = this["wp"]["components"]; }());
 252  
 253  /***/ }),
 254  
 255  /***/ 35:
 256  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 257  
 258  "use strict";
 259  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 260  function _iterableToArray(iter) {
 261    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 262  }
 263  
 264  /***/ }),
 265  
 266  /***/ 38:
 267  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 268  
 269  "use strict";
 270  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 271  function _arrayWithHoles(arr) {
 272    if (Array.isArray(arr)) return arr;
 273  }
 274  
 275  /***/ }),
 276  
 277  /***/ 39:
 278  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 279  
 280  "use strict";
 281  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 282  function _nonIterableRest() {
 283    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 284  }
 285  
 286  /***/ }),
 287  
 288  /***/ 4:
 289  /***/ (function(module, exports) {
 290  
 291  (function() { module.exports = this["wp"]["data"]; }());
 292  
 293  /***/ }),
 294  
 295  /***/ 42:
 296  /***/ (function(module, exports) {
 297  
 298  (function() { module.exports = this["wp"]["apiFetch"]; }());
 299  
 300  /***/ }),
 301  
 302  /***/ 429:
 303  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 304  
 305  "use strict";
 306  __webpack_require__.r(__webpack_exports__);
 307  var selectors_namespaceObject = {};
 308  __webpack_require__.r(selectors_namespaceObject);
 309  __webpack_require__.d(selectors_namespaceObject, "isRequestingDownloadableBlocks", function() { return isRequestingDownloadableBlocks; });
 310  __webpack_require__.d(selectors_namespaceObject, "getDownloadableBlocks", function() { return selectors_getDownloadableBlocks; });
 311  __webpack_require__.d(selectors_namespaceObject, "hasInstallBlocksPermission", function() { return selectors_hasInstallBlocksPermission; });
 312  __webpack_require__.d(selectors_namespaceObject, "getInstalledBlockTypes", function() { return getInstalledBlockTypes; });
 313  var actions_namespaceObject = {};
 314  __webpack_require__.r(actions_namespaceObject);
 315  __webpack_require__.d(actions_namespaceObject, "fetchDownloadableBlocks", function() { return fetchDownloadableBlocks; });
 316  __webpack_require__.d(actions_namespaceObject, "receiveDownloadableBlocks", function() { return receiveDownloadableBlocks; });
 317  __webpack_require__.d(actions_namespaceObject, "setInstallBlocksPermission", function() { return setInstallBlocksPermission; });
 318  __webpack_require__.d(actions_namespaceObject, "downloadBlock", function() { return actions_downloadBlock; });
 319  __webpack_require__.d(actions_namespaceObject, "installBlock", function() { return actions_installBlock; });
 320  __webpack_require__.d(actions_namespaceObject, "uninstallBlock", function() { return uninstallBlock; });
 321  __webpack_require__.d(actions_namespaceObject, "addInstalledBlockType", function() { return addInstalledBlockType; });
 322  __webpack_require__.d(actions_namespaceObject, "removeInstalledBlockType", function() { return removeInstalledBlockType; });
 323  
 324  // EXTERNAL MODULE: external {"this":["wp","data"]}
 325  var external_this_wp_data_ = __webpack_require__(4);
 326  
 327  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 328  var toConsumableArray = __webpack_require__(18);
 329  
 330  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 331  var defineProperty = __webpack_require__(5);
 332  
 333  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js
 334  
 335  
 336  
 337  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 338  
 339  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 340  
 341  /**
 342   * WordPress dependencies
 343   */
 344  
 345  /**
 346   * Reducer returning an array of downloadable blocks.
 347   *
 348   * @param {Object} state  Current state.
 349   * @param {Object} action Dispatched action.
 350   *
 351   * @return {Object} Updated state.
 352   */
 353  
 354  var reducer_downloadableBlocks = function downloadableBlocks() {
 355    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
 356      results: {},
 357      filterValue: undefined,
 358      isRequestingDownloadableBlocks: true
 359    };
 360    var action = arguments.length > 1 ? arguments[1] : undefined;
 361  
 362    switch (action.type) {
 363      case 'FETCH_DOWNLOADABLE_BLOCKS':
 364        return _objectSpread({}, state, {
 365          isRequestingDownloadableBlocks: true
 366        });
 367  
 368      case 'RECEIVE_DOWNLOADABLE_BLOCKS':
 369        return _objectSpread({}, state, {
 370          results: Object.assign({}, state.results, Object(defineProperty["a" /* default */])({}, action.filterValue, action.downloadableBlocks)),
 371          isRequestingDownloadableBlocks: false
 372        });
 373    }
 374  
 375    return state;
 376  };
 377  /**
 378   * Reducer managing the installation and deletion of blocks.
 379   *
 380   * @param {Object} state  Current state.
 381   * @param {Object} action Dispatched action.
 382   *
 383   * @return {Object} Updated state.
 384   */
 385  
 386  var reducer_blockManagement = function blockManagement() {
 387    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
 388      installedBlockTypes: []
 389    };
 390    var action = arguments.length > 1 ? arguments[1] : undefined;
 391  
 392    switch (action.type) {
 393      case 'ADD_INSTALLED_BLOCK_TYPE':
 394        return _objectSpread({}, state, {
 395          installedBlockTypes: [].concat(Object(toConsumableArray["a" /* default */])(state.installedBlockTypes), [action.item])
 396        });
 397  
 398      case 'REMOVE_INSTALLED_BLOCK_TYPE':
 399        return _objectSpread({}, state, {
 400          installedBlockTypes: state.installedBlockTypes.filter(function (blockType) {
 401            return blockType.name !== action.item.name;
 402          })
 403        });
 404    }
 405  
 406    return state;
 407  };
 408  /**
 409   * Reducer returns whether the user can install blocks.
 410   *
 411   * @param {Object} state  Current state.
 412   * @param {Object} action Dispatched action.
 413   *
 414   * @return {Object} Updated state.
 415   */
 416  
 417  function reducer_hasPermission() {
 418    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
 419    var action = arguments.length > 1 ? arguments[1] : undefined;
 420  
 421    if (action.type === 'SET_INSTALL_BLOCKS_PERMISSION') {
 422      return action.hasPermission;
 423    }
 424  
 425    return state;
 426  }
 427  /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({
 428    downloadableBlocks: reducer_downloadableBlocks,
 429    blockManagement: reducer_blockManagement,
 430    hasPermission: reducer_hasPermission
 431  }));
 432  
 433  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
 434  /**
 435   * Returns true if application is requesting for downloadable blocks.
 436   *
 437   * @param {Object} state       Global application state.
 438   *
 439   * @return {Array} Downloadable blocks
 440   */
 441  function isRequestingDownloadableBlocks(state) {
 442    return state.downloadableBlocks.isRequestingDownloadableBlocks;
 443  }
 444  /**
 445   * Returns the available uninstalled blocks
 446   *
 447   * @param {Object} state       Global application state.
 448   * @param {string} filterValue Search string.
 449   *
 450   * @return {Array} Downloadable blocks
 451   */
 452  
 453  function selectors_getDownloadableBlocks(state, filterValue) {
 454    if (!state.downloadableBlocks.results[filterValue]) {
 455      return [];
 456    }
 457  
 458    return state.downloadableBlocks.results[filterValue];
 459  }
 460  /**
 461   * Returns true if user has permission to install blocks.
 462   *
 463   * @param {Object} state Global application state.
 464   *
 465   * @return {boolean} User has permission to install blocks.
 466   */
 467  
 468  function selectors_hasInstallBlocksPermission(state) {
 469    return state.hasPermission;
 470  }
 471  /**
 472   * Returns the block types that have been installed on the server.
 473   *
 474   * @param {Object} state Global application state.
 475   *
 476   * @return {Array} Block type items.
 477   */
 478  
 479  function getInstalledBlockTypes(state) {
 480    return state.blockManagement.installedBlockTypes;
 481  }
 482  
 483  // EXTERNAL MODULE: external {"this":"regeneratorRuntime"}
 484  var external_this_regeneratorRuntime_ = __webpack_require__(23);
 485  var external_this_regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(external_this_regeneratorRuntime_);
 486  
 487  // EXTERNAL MODULE: external {"this":["wp","blocks"]}
 488  var external_this_wp_blocks_ = __webpack_require__(10);
 489  
 490  // EXTERNAL MODULE: external {"this":"lodash"}
 491  var external_this_lodash_ = __webpack_require__(2);
 492  
 493  // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
 494  var external_this_wp_apiFetch_ = __webpack_require__(42);
 495  var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
 496  
 497  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/controls.js
 498  
 499  
 500  
 501  
 502  function controls_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 503  
 504  function controls_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { controls_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { controls_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 505  
 506  var _marked =
 507  /*#__PURE__*/
 508  external_this_regeneratorRuntime_default.a.mark(loadAssets);
 509  
 510  /**
 511   * External dependencies
 512   */
 513  
 514  /**
 515   * WordPress dependencies
 516   */
 517  
 518  
 519  
 520  /**
 521   * Calls a selector using the current state.
 522   *
 523   * @param {string} storeName    Store name.
 524   * @param {string} selectorName Selector name.
 525   * @param {Array}  args         Selector arguments.
 526   *
 527   * @return {Object} Control descriptor.
 528   */
 529  
 530  function controls_select(storeName, selectorName) {
 531    for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
 532      args[_key - 2] = arguments[_key];
 533    }
 534  
 535    return {
 536      type: 'SELECT',
 537      storeName: storeName,
 538      selectorName: selectorName,
 539      args: args
 540    };
 541  }
 542  /**
 543   * Calls a dispatcher using the current state.
 544   *
 545   * @param {string} storeName      Store name.
 546   * @param {string} dispatcherName Dispatcher name.
 547   * @param {Array}  args           Selector arguments.
 548   *
 549   * @return {Object} Control descriptor.
 550   */
 551  
 552  function controls_dispatch(storeName, dispatcherName) {
 553    for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
 554      args[_key2 - 2] = arguments[_key2];
 555    }
 556  
 557    return {
 558      type: 'DISPATCH',
 559      storeName: storeName,
 560      dispatcherName: dispatcherName,
 561      args: args
 562    };
 563  }
 564  /**
 565   * Trigger an API Fetch request.
 566   *
 567   * @param {Object} request API Fetch Request Object.
 568   *
 569   * @return {Object} Control descriptor.
 570   */
 571  
 572  function apiFetch(request) {
 573    return {
 574      type: 'API_FETCH',
 575      request: request
 576    };
 577  }
 578  /**
 579   * Loads JavaScript
 580   *
 581   * @param {Array}    asset   The url for the JavaScript.
 582   * @param {Function} onLoad  Callback function on success.
 583   * @param {Function} onError Callback function on failure.
 584   */
 585  
 586  var loadScript = function loadScript(asset, onLoad, onError) {
 587    if (!asset) {
 588      return;
 589    }
 590  
 591    var existing = document.querySelector("script[src=\"".concat(asset.src, "\"]"));
 592  
 593    if (existing) {
 594      existing.parentNode.removeChild(existing);
 595    }
 596  
 597    var script = document.createElement('script');
 598    script.src = typeof asset === 'string' ? asset : asset.src;
 599    script.onload = onLoad;
 600    script.onerror = onError;
 601    document.body.appendChild(script);
 602  };
 603  /**
 604   * Loads CSS file.
 605   *
 606   * @param {*} asset the url for the CSS file.
 607   */
 608  
 609  
 610  var loadStyle = function loadStyle(asset) {
 611    if (!asset) {
 612      return;
 613    }
 614  
 615    var link = document.createElement('link');
 616    link.rel = 'stylesheet';
 617    link.href = typeof asset === 'string' ? asset : asset.src;
 618    document.body.appendChild(link);
 619  };
 620  /**
 621   * Load the asset files for a block
 622   *
 623   * @param {Array} assets A collection of URL for the assets.
 624   *
 625   * @return {Object} Control descriptor.
 626   */
 627  
 628  
 629  function loadAssets(assets) {
 630    return external_this_regeneratorRuntime_default.a.wrap(function loadAssets$(_context) {
 631      while (1) {
 632        switch (_context.prev = _context.next) {
 633          case 0:
 634            return _context.abrupt("return", {
 635              type: 'LOAD_ASSETS',
 636              assets: assets
 637            });
 638  
 639          case 1:
 640          case "end":
 641            return _context.stop();
 642        }
 643      }
 644    }, _marked);
 645  }
 646  var controls = {
 647    SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
 648      return function (_ref) {
 649        var _registry$select;
 650  
 651        var storeName = _ref.storeName,
 652            selectorName = _ref.selectorName,
 653            args = _ref.args;
 654        return (_registry$select = registry.select(storeName))[selectorName].apply(_registry$select, Object(toConsumableArray["a" /* default */])(args));
 655      };
 656    }),
 657    DISPATCH: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
 658      return function (_ref2) {
 659        var _registry$dispatch;
 660  
 661        var storeName = _ref2.storeName,
 662            dispatcherName = _ref2.dispatcherName,
 663            args = _ref2.args;
 664        return (_registry$dispatch = registry.dispatch(storeName))[dispatcherName].apply(_registry$dispatch, Object(toConsumableArray["a" /* default */])(args));
 665      };
 666    }),
 667    API_FETCH: function API_FETCH(_ref3) {
 668      var request = _ref3.request;
 669      return external_this_wp_apiFetch_default()(controls_objectSpread({}, request));
 670    },
 671    LOAD_ASSETS: function LOAD_ASSETS(_ref4) {
 672      var assets = _ref4.assets;
 673      return new Promise(function (resolve, reject) {
 674        if (Array.isArray(assets)) {
 675          var scriptsCount = 0;
 676          Object(external_this_lodash_["forEach"])(assets, function (asset) {
 677            if (asset.match(/\.js$/) !== null) {
 678              scriptsCount++;
 679              loadScript(asset, function () {
 680                scriptsCount--;
 681  
 682                if (scriptsCount === 0) {
 683                  return resolve(scriptsCount);
 684                }
 685              }, reject);
 686            } else {
 687              loadStyle(asset);
 688            }
 689          });
 690        } else {
 691          loadScript(assets.editor_script, function () {
 692            return resolve(0);
 693          }, reject);
 694          loadStyle(assets.style);
 695        }
 696      });
 697    }
 698  };
 699  /* harmony default export */ var store_controls = (controls);
 700  
 701  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
 702  
 703  
 704  var actions_marked =
 705  /*#__PURE__*/
 706  external_this_regeneratorRuntime_default.a.mark(actions_downloadBlock),
 707      _marked2 =
 708  /*#__PURE__*/
 709  external_this_regeneratorRuntime_default.a.mark(actions_installBlock),
 710      _marked3 =
 711  /*#__PURE__*/
 712  external_this_regeneratorRuntime_default.a.mark(uninstallBlock);
 713  
 714  /**
 715   * WordPress dependencies
 716   */
 717  
 718  /**
 719   * Internal dependencies
 720   */
 721  
 722  
 723  /**
 724   * Returns an action object used in signalling that the downloadable blocks have been requested and is loading.
 725   *
 726   * @return {Object} Action object.
 727   */
 728  
 729  function fetchDownloadableBlocks() {
 730    return {
 731      type: 'FETCH_DOWNLOADABLE_BLOCKS'
 732    };
 733  }
 734  /**
 735   * Returns an action object used in signalling that the downloadable blocks have been updated.
 736   *
 737   * @param {Array} downloadableBlocks Downloadable blocks.
 738   * @param {string} filterValue Search string.
 739   *
 740   * @return {Object} Action object.
 741   */
 742  
 743  function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
 744    return {
 745      type: 'RECEIVE_DOWNLOADABLE_BLOCKS',
 746      downloadableBlocks: downloadableBlocks,
 747      filterValue: filterValue
 748    };
 749  }
 750  /**
 751   * Returns an action object used in signalling that the user does not have permission to install blocks.
 752   *
 753   @param {boolean} hasPermission User has permission to install blocks.
 754   *
 755   * @return {Object} Action object.
 756   */
 757  
 758  function setInstallBlocksPermission(hasPermission) {
 759    return {
 760      type: 'SET_INSTALL_BLOCKS_PERMISSION',
 761      hasPermission: hasPermission
 762    };
 763  }
 764  /**
 765   * Action triggered to download block assets.
 766   *
 767   * @param {Object} item The selected block item
 768   * @param {Function} onSuccess The callback function when the action has succeeded.
 769   * @param {Function} onError The callback function when the action has failed.
 770   */
 771  
 772  function actions_downloadBlock(item, onSuccess, onError) {
 773    var registeredBlocks;
 774    return external_this_regeneratorRuntime_default.a.wrap(function downloadBlock$(_context) {
 775      while (1) {
 776        switch (_context.prev = _context.next) {
 777          case 0:
 778            _context.prev = 0;
 779  
 780            if (item.assets.length) {
 781              _context.next = 3;
 782              break;
 783            }
 784  
 785            throw new Error('Block has no assets');
 786  
 787          case 3:
 788            _context.next = 5;
 789            return loadAssets(item.assets);
 790  
 791          case 5:
 792            registeredBlocks = Object(external_this_wp_blocks_["getBlockTypes"])();
 793  
 794            if (!registeredBlocks.length) {
 795              _context.next = 10;
 796              break;
 797            }
 798  
 799            onSuccess(item);
 800            _context.next = 11;
 801            break;
 802  
 803          case 10:
 804            throw new Error('Unable to get block types');
 805  
 806          case 11:
 807            _context.next = 17;
 808            break;
 809  
 810          case 13:
 811            _context.prev = 13;
 812            _context.t0 = _context["catch"](0);
 813            _context.next = 17;
 814            return onError(_context.t0);
 815  
 816          case 17:
 817          case "end":
 818            return _context.stop();
 819        }
 820      }
 821    }, actions_marked, null, [[0, 13]]);
 822  }
 823  /**
 824   * Action triggered to install a block plugin.
 825   *
 826   * @param {string} item The block item returned by search.
 827   * @param {Function} onSuccess The callback function when the action has succeeded.
 828   * @param {Function} onError The callback function when the action has failed.
 829   *
 830   */
 831  
 832  function actions_installBlock(_ref, onSuccess, onError) {
 833    var id, name, response;
 834    return external_this_regeneratorRuntime_default.a.wrap(function installBlock$(_context2) {
 835      while (1) {
 836        switch (_context2.prev = _context2.next) {
 837          case 0:
 838            id = _ref.id, name = _ref.name;
 839            _context2.prev = 1;
 840            _context2.next = 4;
 841            return apiFetch({
 842              path: '__experimental/block-directory/install',
 843              data: {
 844                slug: id
 845              },
 846              method: 'POST'
 847            });
 848  
 849          case 4:
 850            response = _context2.sent;
 851  
 852            if (!(response.success === false)) {
 853              _context2.next = 7;
 854              break;
 855            }
 856  
 857            throw new Error(response.errorMessage);
 858  
 859          case 7:
 860            _context2.next = 9;
 861            return addInstalledBlockType({
 862              id: id,
 863              name: name
 864            });
 865  
 866          case 9:
 867            onSuccess();
 868            _context2.next = 15;
 869            break;
 870  
 871          case 12:
 872            _context2.prev = 12;
 873            _context2.t0 = _context2["catch"](1);
 874            onError(_context2.t0);
 875  
 876          case 15:
 877          case "end":
 878            return _context2.stop();
 879        }
 880      }
 881    }, _marked2, null, [[1, 12]]);
 882  }
 883  /**
 884   * Action triggered to uninstall a block plugin.
 885   *
 886   * @param {string} item The block item returned by search.
 887   * @param {Function} onSuccess The callback function when the action has succeeded.
 888   * @param {Function} onError The callback function when the action has failed.
 889   *
 890   */
 891  
 892  function uninstallBlock(_ref2, onSuccess, onError) {
 893    var id, name, response;
 894    return external_this_regeneratorRuntime_default.a.wrap(function uninstallBlock$(_context3) {
 895      while (1) {
 896        switch (_context3.prev = _context3.next) {
 897          case 0:
 898            id = _ref2.id, name = _ref2.name;
 899            _context3.prev = 1;
 900            _context3.next = 4;
 901            return apiFetch({
 902              path: '__experimental/block-directory/uninstall',
 903              data: {
 904                slug: id
 905              },
 906              method: 'DELETE'
 907            });
 908  
 909          case 4:
 910            response = _context3.sent;
 911  
 912            if (!(response.success === false)) {
 913              _context3.next = 7;
 914              break;
 915            }
 916  
 917            throw new Error(response.errorMessage);
 918  
 919          case 7:
 920            _context3.next = 9;
 921            return removeInstalledBlockType({
 922              id: id,
 923              name: name
 924            });
 925  
 926          case 9:
 927            onSuccess();
 928            _context3.next = 15;
 929            break;
 930  
 931          case 12:
 932            _context3.prev = 12;
 933            _context3.t0 = _context3["catch"](1);
 934            onError(_context3.t0);
 935  
 936          case 15:
 937          case "end":
 938            return _context3.stop();
 939        }
 940      }
 941    }, _marked3, null, [[1, 12]]);
 942  }
 943  /**
 944   * Returns an action object used to add a newly installed block type.
 945   *
 946   * @param {string} item The block item with the block id and name.
 947   *
 948   * @return {Object} Action object.
 949   */
 950  
 951  function addInstalledBlockType(item) {
 952    return {
 953      type: 'ADD_INSTALLED_BLOCK_TYPE',
 954      item: item
 955    };
 956  }
 957  /**
 958   * Returns an action object used to remove a newly installed block type.
 959   *
 960   * @param {string} item The block item with the block id and name.
 961   *
 962   * @return {Object} Action object.
 963   */
 964  
 965  function removeInstalledBlockType(item) {
 966    return {
 967      type: 'REMOVE_INSTALLED_BLOCK_TYPE',
 968      item: item
 969    };
 970  }
 971  
 972  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
 973  
 974  
 975  /**
 976   * External dependencies
 977   */
 978  
 979  /**
 980   * Internal dependencies
 981   */
 982  
 983  
 984  
 985  /* harmony default export */ var resolvers = ({
 986    getDownloadableBlocks:
 987    /*#__PURE__*/
 988    external_this_regeneratorRuntime_default.a.mark(function getDownloadableBlocks(filterValue) {
 989      var results, blocks;
 990      return external_this_regeneratorRuntime_default.a.wrap(function getDownloadableBlocks$(_context) {
 991        while (1) {
 992          switch (_context.prev = _context.next) {
 993            case 0:
 994              if (filterValue) {
 995                _context.next = 2;
 996                break;
 997              }
 998  
 999              return _context.abrupt("return");
1000  
1001            case 2:
1002              _context.prev = 2;
1003              _context.next = 5;
1004              return fetchDownloadableBlocks(filterValue);
1005  
1006            case 5:
1007              _context.next = 7;
1008              return apiFetch({
1009                path: "__experimental/block-directory/search?term=".concat(filterValue)
1010              });
1011  
1012            case 7:
1013              results = _context.sent;
1014              blocks = results.map(function (result) {
1015                return Object(external_this_lodash_["mapKeys"])(result, function (value, key) {
1016                  return Object(external_this_lodash_["camelCase"])(key);
1017                });
1018              });
1019              _context.next = 11;
1020              return receiveDownloadableBlocks(blocks, filterValue);
1021  
1022            case 11:
1023              _context.next = 18;
1024              break;
1025  
1026            case 13:
1027              _context.prev = 13;
1028              _context.t0 = _context["catch"](2);
1029  
1030              if (!(_context.t0.code === 'rest_user_cannot_view')) {
1031                _context.next = 18;
1032                break;
1033              }
1034  
1035              _context.next = 18;
1036              return setInstallBlocksPermission(false);
1037  
1038            case 18:
1039            case "end":
1040              return _context.stop();
1041          }
1042        }
1043      }, getDownloadableBlocks, null, [[2, 13]]);
1044    }),
1045    hasInstallBlocksPermission:
1046    /*#__PURE__*/
1047    external_this_regeneratorRuntime_default.a.mark(function hasInstallBlocksPermission() {
1048      return external_this_regeneratorRuntime_default.a.wrap(function hasInstallBlocksPermission$(_context2) {
1049        while (1) {
1050          switch (_context2.prev = _context2.next) {
1051            case 0:
1052              _context2.prev = 0;
1053              _context2.next = 3;
1054              return apiFetch({
1055                path: "__experimental/block-directory/search?term="
1056              });
1057  
1058            case 3:
1059              _context2.next = 5;
1060              return setInstallBlocksPermission(true);
1061  
1062            case 5:
1063              _context2.next = 12;
1064              break;
1065  
1066            case 7:
1067              _context2.prev = 7;
1068              _context2.t0 = _context2["catch"](0);
1069  
1070              if (!(_context2.t0.code === 'rest_user_cannot_view')) {
1071                _context2.next = 12;
1072                break;
1073              }
1074  
1075              _context2.next = 12;
1076              return setInstallBlocksPermission(false);
1077  
1078            case 12:
1079            case "end":
1080              return _context2.stop();
1081          }
1082        }
1083      }, hasInstallBlocksPermission, null, [[0, 7]]);
1084    })
1085  });
1086  
1087  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js
1088  /**
1089   * WordPress dependencies
1090   */
1091  
1092  /**
1093   * Internal dependencies
1094   */
1095  
1096  
1097  
1098  
1099  
1100  
1101  /**
1102   * Module Constants
1103   */
1104  
1105  var MODULE_KEY = 'core/block-directory';
1106  /**
1107   * Block editor data store configuration.
1108   *
1109   * @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore
1110   *
1111   * @type {Object}
1112   */
1113  
1114  var storeConfig = {
1115    reducer: reducer,
1116    selectors: selectors_namespaceObject,
1117    actions: actions_namespaceObject,
1118    controls: store_controls,
1119    resolvers: resolvers
1120  };
1121  var store = Object(external_this_wp_data_["registerStore"])(MODULE_KEY, storeConfig);
1122  /* harmony default export */ var build_module_store = (store);
1123  
1124  // EXTERNAL MODULE: external {"this":["wp","element"]}
1125  var external_this_wp_element_ = __webpack_require__(0);
1126  
1127  // EXTERNAL MODULE: external {"this":["wp","plugins"]}
1128  var external_this_wp_plugins_ = __webpack_require__(55);
1129  
1130  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
1131  var slicedToArray = __webpack_require__(20);
1132  
1133  // EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
1134  var external_this_wp_blockEditor_ = __webpack_require__(6);
1135  
1136  // EXTERNAL MODULE: external {"this":["wp","compose"]}
1137  var external_this_wp_compose_ = __webpack_require__(8);
1138  
1139  // EXTERNAL MODULE: external {"this":["wp","i18n"]}
1140  var external_this_wp_i18n_ = __webpack_require__(1);
1141  
1142  // EXTERNAL MODULE: external {"this":["wp","components"]}
1143  var external_this_wp_components_ = __webpack_require__(3);
1144  
1145  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js
1146  
1147  
1148  /**
1149   * External dependencies
1150   */
1151  
1152  /**
1153   * WordPress dependencies
1154   */
1155  
1156  
1157  
1158  
1159  function Stars(_ref) {
1160    var rating = _ref.rating;
1161    var stars = Math.round(rating / 0.5) * 0.5;
1162    var fullStarCount = Math.floor(rating);
1163    var halfStarCount = Math.ceil(rating - fullStarCount);
1164    var emptyStarCount = 5 - (fullStarCount + halfStarCount);
1165    return Object(external_this_wp_element_["createElement"])("div", {
1166      "aria-label": Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s out of 5 stars'), stars)
1167    }, Object(external_this_lodash_["times"])(fullStarCount, function (i) {
1168      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
1169        key: "full_stars_".concat(i),
1170        icon: "star-filled",
1171        size: 16
1172      });
1173    }), Object(external_this_lodash_["times"])(halfStarCount, function (i) {
1174      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
1175        key: "half_stars_".concat(i),
1176        icon: "star-half",
1177        size: 16
1178      });
1179    }), Object(external_this_lodash_["times"])(emptyStarCount, function (i) {
1180      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
1181        key: "empty_stars_".concat(i),
1182        icon: "star-empty",
1183        size: 16
1184      });
1185    }));
1186  }
1187  
1188  /* harmony default export */ var block_ratings_stars = (Stars);
1189  
1190  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js
1191  
1192  
1193  /**
1194   * WordPress dependencies
1195   */
1196  
1197  /**
1198   * Internal dependencies
1199   */
1200  
1201  
1202  var block_ratings_BlockRatings = function BlockRatings(_ref) {
1203    var rating = _ref.rating,
1204        ratingCount = _ref.ratingCount;
1205    return Object(external_this_wp_element_["createElement"])("div", {
1206      className: "block-directory-block-ratings"
1207    }, Object(external_this_wp_element_["createElement"])(block_ratings_stars, {
1208      rating: rating
1209    }), Object(external_this_wp_element_["createElement"])("span", {
1210      className: "block-directory-block-ratings__rating-count",
1211      "aria-label": // translators: %d: number of ratings (number).
1212      Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d total rating', '%d total ratings', ratingCount), ratingCount)
1213    }, "(", ratingCount, ")"));
1214  };
1215  /* harmony default export */ var block_ratings = (block_ratings_BlockRatings);
1216  
1217  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-header/index.js
1218  
1219  
1220  /**
1221   * WordPress dependencies
1222   */
1223  
1224  
1225  /**
1226   * Internal dependencies
1227   */
1228  
1229  
1230  
1231  
1232  function DownloadableBlockHeader(_ref) {
1233    var icon = _ref.icon,
1234        title = _ref.title,
1235        rating = _ref.rating,
1236        ratingCount = _ref.ratingCount,
1237        _onClick = _ref.onClick;
1238    return Object(external_this_wp_element_["createElement"])("div", {
1239      className: "block-directory-downloadable-block-header__row"
1240    }, icon.match(/\.(jpeg|jpg|gif|png)(?:\?.*)?$/) !== null ? // translators: %s: Name of the plugin e.g: "Akismet".
1241    Object(external_this_wp_element_["createElement"])("img", {
1242      src: icon,
1243      alt: Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s block icon'), title)
1244    }) : Object(external_this_wp_element_["createElement"])("span", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], {
1245      icon: icon,
1246      showColors: true
1247    })), Object(external_this_wp_element_["createElement"])("div", {
1248      className: "block-directory-downloadable-block-header__column"
1249    }, Object(external_this_wp_element_["createElement"])("span", {
1250      role: "heading",
1251      className: "block-directory-downloadable-block-header__title"
1252    }, title), Object(external_this_wp_element_["createElement"])(block_ratings, {
1253      rating: rating,
1254      ratingCount: ratingCount
1255    })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
1256      isDefault: true,
1257      onClick: function onClick(event) {
1258        event.preventDefault();
1259  
1260        _onClick();
1261      }
1262    }, Object(external_this_wp_i18n_["__"])('Add block')));
1263  }
1264  
1265  /* harmony default export */ var downloadable_block_header = (DownloadableBlockHeader);
1266  
1267  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-author-info/index.js
1268  
1269  
1270  /**
1271   * WordPress dependencies
1272   */
1273  
1274  
1275  
1276  function DownloadableBlockAuthorInfo(_ref) {
1277    var author = _ref.author,
1278        authorBlockCount = _ref.authorBlockCount,
1279        authorBlockRating = _ref.authorBlockRating;
1280    return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("span", {
1281      className: "block-directory-downloadable-block-author-info__content-author"
1282    }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Authored by %s'), author)), Object(external_this_wp_element_["createElement"])("span", {
1283      className: "block-directory-downloadable-block-author-info__content"
1284    }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('This author has %d block, with an average rating of %d.', 'This author has %d blocks, with an average rating of %d.', authorBlockCount), authorBlockCount, authorBlockRating)));
1285  }
1286  
1287  /* harmony default export */ var downloadable_block_author_info = (DownloadableBlockAuthorInfo);
1288  
1289  // EXTERNAL MODULE: external {"this":["wp","primitives"]}
1290  var external_this_wp_primitives_ = __webpack_require__(9);
1291  
1292  // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/update.js
1293  
1294  
1295  /**
1296   * WordPress dependencies
1297   */
1298  
1299  var update = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], {
1300    xmlns: "http://www.w3.org/2000/svg",
1301    viewBox: "-2 -2 24 24"
1302  }, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], {
1303    d: "M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"
1304  }));
1305  /* harmony default export */ var library_update = (update);
1306  
1307  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-info/index.js
1308  
1309  
1310  /**
1311   * WordPress dependencies
1312   */
1313  
1314  
1315  
1316  
1317  
1318  function DownloadableBlockInfo(_ref) {
1319    var description = _ref.description,
1320        activeInstalls = _ref.activeInstalls,
1321        humanizedUpdated = _ref.humanizedUpdated;
1322    return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("p", {
1323      className: "block-directory-downloadable-block-info__content"
1324    }, description), Object(external_this_wp_element_["createElement"])("div", {
1325      className: "block-directory-downloadable-block-info__row"
1326    }, Object(external_this_wp_element_["createElement"])("div", {
1327      className: "block-directory-downloadable-block-info__column"
1328    }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
1329      icon: "chart-line"
1330    }), Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d active installation', '%d active installations', activeInstalls), activeInstalls)), Object(external_this_wp_element_["createElement"])("div", {
1331      className: "block-directory-downloadable-block-info__column"
1332    }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], {
1333      icon: library_update
1334    }), // translators: %s: Humanized date of last update e.g: "2 months ago".
1335    Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Updated %s'), humanizedUpdated))));
1336  }
1337  
1338  /* harmony default export */ var downloadable_block_info = (DownloadableBlockInfo);
1339  
1340  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js
1341  
1342  
1343  /**
1344   * Internal dependencies
1345   */
1346  
1347  
1348  
1349  
1350  function DownloadableBlockListItem(_ref) {
1351    var item = _ref.item,
1352        onClick = _ref.onClick;
1353    var icon = item.icon,
1354        title = item.title,
1355        description = item.description,
1356        rating = item.rating,
1357        activeInstalls = item.activeInstalls,
1358        ratingCount = item.ratingCount,
1359        author = item.author,
1360        humanizedUpdated = item.humanizedUpdated,
1361        authorBlockCount = item.authorBlockCount,
1362        authorBlockRating = item.authorBlockRating;
1363    return Object(external_this_wp_element_["createElement"])("li", {
1364      className: "block-directory-downloadable-block-list-item"
1365    }, Object(external_this_wp_element_["createElement"])("article", {
1366      className: "block-directory-downloadable-block-list-item__panel"
1367    }, Object(external_this_wp_element_["createElement"])("header", {
1368      className: "block-directory-downloadable-block-list-item__header"
1369    }, Object(external_this_wp_element_["createElement"])(downloadable_block_header, {
1370      icon: icon,
1371      onClick: onClick,
1372      title: title,
1373      rating: rating,
1374      ratingCount: ratingCount
1375    })), Object(external_this_wp_element_["createElement"])("section", {
1376      className: "block-directory-downloadable-block-list-item__body"
1377    }, Object(external_this_wp_element_["createElement"])(downloadable_block_info, {
1378      activeInstalls: activeInstalls,
1379      description: description,
1380      humanizedUpdated: humanizedUpdated
1381    })), Object(external_this_wp_element_["createElement"])("footer", {
1382      className: "block-directory-downloadable-block-list-item__footer"
1383    }, Object(external_this_wp_element_["createElement"])(downloadable_block_author_info, {
1384      author: author,
1385      authorBlockCount: authorBlockCount,
1386      authorBlockRating: authorBlockRating
1387    }))));
1388  }
1389  
1390  /* harmony default export */ var downloadable_block_list_item = (DownloadableBlockListItem);
1391  
1392  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js
1393  
1394  
1395  /**
1396   * External dependencies
1397   */
1398  
1399  /**
1400   * WordPress dependencies
1401   */
1402  
1403  
1404  
1405  
1406  
1407  /**
1408   * Internal dependencies
1409   */
1410  
1411  
1412  var DOWNLOAD_ERROR_NOTICE_ID = 'block-download-error';
1413  var INSTALL_ERROR_NOTICE_ID = 'block-install-error';
1414  
1415  function DownloadableBlocksList(_ref) {
1416    var items = _ref.items,
1417        _ref$onHover = _ref.onHover,
1418        onHover = _ref$onHover === void 0 ? external_this_lodash_["noop"] : _ref$onHover,
1419        children = _ref.children,
1420        downloadAndInstallBlock = _ref.downloadAndInstallBlock;
1421    return (
1422      /*
1423       * Disable reason: The `list` ARIA role is redundant but
1424       * Safari+VoiceOver won't announce the list otherwise.
1425       */
1426  
1427      /* eslint-disable jsx-a11y/no-redundant-roles */
1428      Object(external_this_wp_element_["createElement"])("ul", {
1429        role: "list",
1430        className: "block-directory-downloadable-blocks-list"
1431      }, items && items.map(function (item) {
1432        return Object(external_this_wp_element_["createElement"])(downloadable_block_list_item, {
1433          key: item.id,
1434          className: Object(external_this_wp_blocks_["getBlockMenuDefaultClassName"])(item.id),
1435          icons: item.icons,
1436          onClick: function onClick() {
1437            downloadAndInstallBlock(item);
1438            onHover(null);
1439          },
1440          onFocus: function onFocus() {
1441            return onHover(item);
1442          },
1443          onMouseEnter: function onMouseEnter() {
1444            return onHover(item);
1445          },
1446          onMouseLeave: function onMouseLeave() {
1447            return onHover(null);
1448          },
1449          onBlur: function onBlur() {
1450            return onHover(null);
1451          },
1452          item: item
1453        });
1454      }), children)
1455      /* eslint-enable jsx-a11y/no-redundant-roles */
1456  
1457    );
1458  }
1459  
1460  /* harmony default export */ var downloadable_blocks_list = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withDispatch"])(function (dispatch, props) {
1461    var _dispatch = dispatch('core/block-directory'),
1462        installBlock = _dispatch.installBlock,
1463        downloadBlock = _dispatch.downloadBlock;
1464  
1465    var _dispatch2 = dispatch('core/notices'),
1466        createErrorNotice = _dispatch2.createErrorNotice,
1467        removeNotice = _dispatch2.removeNotice;
1468  
1469    var _dispatch3 = dispatch('core/block-editor'),
1470        removeBlocks = _dispatch3.removeBlocks;
1471  
1472    var onSelect = props.onSelect;
1473    return {
1474      downloadAndInstallBlock: function downloadAndInstallBlock(item) {
1475        var onDownloadError = function onDownloadError() {
1476          createErrorNotice(Object(external_this_wp_i18n_["__"])('Block previews can’t load.'), {
1477            id: DOWNLOAD_ERROR_NOTICE_ID,
1478            actions: [{
1479              label: Object(external_this_wp_i18n_["__"])('Retry'),
1480              onClick: function onClick() {
1481                removeNotice(DOWNLOAD_ERROR_NOTICE_ID);
1482                downloadBlock(item, onSuccess, onDownloadError);
1483              }
1484            }]
1485          });
1486        };
1487  
1488        var onSuccess = function onSuccess() {
1489          var createdBlock = onSelect(item);
1490  
1491          var onInstallBlockError = function onInstallBlockError() {
1492            createErrorNotice(Object(external_this_wp_i18n_["__"])("Block previews can't install."), {
1493              id: INSTALL_ERROR_NOTICE_ID,
1494              actions: [{
1495                label: Object(external_this_wp_i18n_["__"])('Retry'),
1496                onClick: function onClick() {
1497                  removeNotice(INSTALL_ERROR_NOTICE_ID);
1498                  installBlock(item, external_this_lodash_["noop"], onInstallBlockError);
1499                }
1500              }, {
1501                label: Object(external_this_wp_i18n_["__"])('Remove'),
1502                onClick: function onClick() {
1503                  removeNotice(INSTALL_ERROR_NOTICE_ID);
1504                  removeBlocks(createdBlock.clientId);
1505                  Object(external_this_wp_blocks_["unregisterBlockType"])(item.name);
1506                }
1507              }]
1508            });
1509          };
1510  
1511          installBlock(item, external_this_lodash_["noop"], onInstallBlockError);
1512        };
1513  
1514        downloadBlock(item, onSuccess, onDownloadError);
1515      }
1516    };
1517  }))(DownloadableBlocksList));
1518  
1519  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js
1520  
1521  
1522  /**
1523   * WordPress dependencies
1524   */
1525  
1526  
1527  
1528  
1529  
1530  /**
1531   * Internal dependencies
1532   */
1533  
1534  
1535  
1536  function DownloadableBlocksPanel(_ref) {
1537    var downloadableItems = _ref.downloadableItems,
1538        onSelect = _ref.onSelect,
1539        onHover = _ref.onHover,
1540        hasPermission = _ref.hasPermission,
1541        isLoading = _ref.isLoading,
1542        isWaiting = _ref.isWaiting,
1543        debouncedSpeak = _ref.debouncedSpeak;
1544  
1545    if (!hasPermission) {
1546      debouncedSpeak(Object(external_this_wp_i18n_["__"])('No blocks found in your library. Please contact your site administrator to install new blocks.'));
1547      return Object(external_this_wp_element_["createElement"])("p", {
1548        className: "block-directory-downloadable-blocks-panel__description has-no-results"
1549      }, Object(external_this_wp_i18n_["__"])('No blocks found in your library.'), Object(external_this_wp_element_["createElement"])("br", null), Object(external_this_wp_i18n_["__"])('Please contact your site administrator to install new blocks.'));
1550    }
1551  
1552    if (isLoading || isWaiting) {
1553      return Object(external_this_wp_element_["createElement"])("p", {
1554        className: "block-directory-downloadable-blocks-panel__description has-no-results"
1555      }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null));
1556    }
1557  
1558    if (!downloadableItems.length) {
1559      return Object(external_this_wp_element_["createElement"])("p", {
1560        className: "block-directory-downloadable-blocks-panel__description has-no-results"
1561      }, Object(external_this_wp_i18n_["__"])('No blocks found in your library.'));
1562    }
1563  
1564    var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('No blocks found in your library. We did find %d block available for download.', 'No blocks found in your library. We did find %d blocks available for download.', downloadableItems.length), downloadableItems.length);
1565    debouncedSpeak(resultsFoundMessage);
1566    return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("p", {
1567      className: "block-directory-downloadable-blocks-panel__description"
1568    }, Object(external_this_wp_i18n_["__"])('No blocks found in your library. These blocks can be downloaded and installed:')), Object(external_this_wp_element_["createElement"])(downloadable_blocks_list, {
1569      items: downloadableItems,
1570      onSelect: onSelect,
1571      onHover: onHover
1572    }));
1573  }
1574  
1575  /* harmony default export */ var downloadable_blocks_panel = (Object(external_this_wp_compose_["compose"])([external_this_wp_components_["withSpokenMessages"], Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
1576    var filterValue = _ref2.filterValue;
1577  
1578    var _select = select('core/block-directory'),
1579        getDownloadableBlocks = _select.getDownloadableBlocks,
1580        hasInstallBlocksPermission = _select.hasInstallBlocksPermission,
1581        isRequestingDownloadableBlocks = _select.isRequestingDownloadableBlocks;
1582  
1583    var hasPermission = hasInstallBlocksPermission();
1584    var downloadableItems = hasPermission ? getDownloadableBlocks(filterValue) : [];
1585    var isLoading = isRequestingDownloadableBlocks();
1586    return {
1587      downloadableItems: downloadableItems,
1588      hasPermission: hasPermission,
1589      isLoading: isLoading
1590    };
1591  })])(DownloadableBlocksPanel));
1592  
1593  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js
1594  
1595  
1596  
1597  /**
1598   * External dependencies
1599   */
1600  
1601  /**
1602   * WordPress dependencies
1603   */
1604  
1605  
1606  
1607  /**
1608   * Internal dependencies
1609   */
1610  
1611  
1612  
1613  function InserterMenuDownloadableBlocksPanel() {
1614    var _useState = Object(external_this_wp_element_["useState"])(''),
1615        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
1616        debouncedFilterValue = _useState2[0],
1617        setFilterValue = _useState2[1];
1618  
1619    var debouncedSetFilterValue = Object(external_this_lodash_["debounce"])(setFilterValue, 400);
1620    return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalInserterMenuExtension"], null, function (_ref) {
1621      var onSelect = _ref.onSelect,
1622          onHover = _ref.onHover,
1623          filterValue = _ref.filterValue,
1624          hasItems = _ref.hasItems;
1625  
1626      if (hasItems || !filterValue) {
1627        return null;
1628      }
1629  
1630      if (debouncedFilterValue !== filterValue) {
1631        debouncedSetFilterValue(filterValue);
1632      }
1633  
1634      return Object(external_this_wp_element_["createElement"])(downloadable_blocks_panel, {
1635        onSelect: onSelect,
1636        onHover: onHover,
1637        filterValue: debouncedFilterValue,
1638        isWaiting: filterValue !== debouncedFilterValue
1639      });
1640    });
1641  }
1642  
1643  /* harmony default export */ var inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel);
1644  
1645  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js
1646  
1647  
1648  /**
1649   * WordPress dependencies
1650   */
1651  
1652  /**
1653   * Internal dependencies
1654   */
1655  
1656  
1657  Object(external_this_wp_plugins_["registerPlugin"])('block-directory', {
1658    render: function render() {
1659      return Object(external_this_wp_element_["createElement"])(inserter_menu_downloadable_blocks_panel, null);
1660    }
1661  });
1662  
1663  // CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js
1664  /**
1665   * Internal dependencies
1666   */
1667  
1668  
1669  
1670  
1671  /***/ }),
1672  
1673  /***/ 5:
1674  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1675  
1676  "use strict";
1677  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
1678  function _defineProperty(obj, key, value) {
1679    if (key in obj) {
1680      Object.defineProperty(obj, key, {
1681        value: value,
1682        enumerable: true,
1683        configurable: true,
1684        writable: true
1685      });
1686    } else {
1687      obj[key] = value;
1688    }
1689  
1690    return obj;
1691  }
1692  
1693  /***/ }),
1694  
1695  /***/ 55:
1696  /***/ (function(module, exports) {
1697  
1698  (function() { module.exports = this["wp"]["plugins"]; }());
1699  
1700  /***/ }),
1701  
1702  /***/ 6:
1703  /***/ (function(module, exports) {
1704  
1705  (function() { module.exports = this["wp"]["blockEditor"]; }());
1706  
1707  /***/ }),
1708  
1709  /***/ 8:
1710  /***/ (function(module, exports) {
1711  
1712  (function() { module.exports = this["wp"]["compose"]; }());
1713  
1714  /***/ }),
1715  
1716  /***/ 9:
1717  /***/ (function(module, exports) {
1718  
1719  (function() { module.exports = this["wp"]["primitives"]; }());
1720  
1721  /***/ })
1722  
1723  /******/ });


Generated: Thu Apr 9 01:00:03 2020 Cross-referenced by PHPXref 0.7.1