[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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


Generated : Tue May 26 08:20:01 2020 Cross-referenced by PHPXref