2 lines
34 KiB
JavaScript
2 lines
34 KiB
JavaScript
/*! This file is auto-generated */
|
||
this.wp=this.wp||{},this.wp.blockDirectory=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="./node_modules/@wordpress/block-directory/build-module/index.js")}({"./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js":function(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js":function(e,t,r){"use strict";function n(e,t,r,n,o,c,l){try{var a=e[c](l),i=a.value}catch(e){return void r(e)}a.done?t(i):Promise.resolve(i).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(o,c){var l=e.apply(t,r);function a(e){n(l,o,c,a,i,"next",e)}function i(e){n(l,o,c,a,i,"throw",e)}a(void 0)}))}}r.d(t,"a",(function(){return o}))},"./node_modules/@babel/runtime/helpers/esm/defineProperty.js":function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/extends.js":function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/iterableToArray.js":function(e,t,r){"use strict";function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js":function(e,t,r){"use strict";function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js":function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r("./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");function o(e,t){if(null==e)return{};var r,o,c=Object(n.a)(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)r=l[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c}},"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js":function(e,t,r){"use strict";function n(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}r.d(t,"a",(function(){return n}))},"./node_modules/@babel/runtime/helpers/esm/slicedToArray.js":function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r("./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js");var o=r("./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"),c=r("./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js");function l(e,t){return Object(n.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,c=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,c=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw c}}return r}}(e,t)||Object(o.a)(e,t)||Object(c.a)()}},"./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r("./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");var o=r("./node_modules/@babel/runtime/helpers/esm/iterableToArray.js"),c=r("./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");function l(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||Object(o.a)(e)||Object(c.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},"./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r("./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");function o(e,t){if(e){if("string"==typeof e)return Object(n.a)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},"./node_modules/@wordpress/block-directory/build-module/index.js":function(e,t,r){"use strict";r.r(t),r.d(t,"store",(function(){return re}));var n={};r.r(n),r.d(n,"isRequestingDownloadableBlocks",(function(){return y})),r.d(n,"getDownloadableBlocks",(function(){return h})),r.d(n,"getInstalledBlockTypes",(function(){return w})),r.d(n,"getNewBlockTypes",(function(){return k})),r.d(n,"getUnusedBlockTypes",(function(){return v})),r.d(n,"isInstalling",(function(){return g})),r.d(n,"getErrorNotices",(function(){return _})),r.d(n,"getErrorNoticeForBlock",(function(){return E}));var o={};r.r(o),r.d(o,"fetchDownloadableBlocks",(function(){return W})),r.d(o,"receiveDownloadableBlocks",(function(){return U})),r.d(o,"installBlockType",(function(){return K})),r.d(o,"uninstallBlockType",(function(){return G})),r.d(o,"addInstalledBlockType",(function(){return Y})),r.d(o,"removeInstalledBlockType",(function(){return $})),r.d(o,"setIsInstalling",(function(){return q})),r.d(o,"setErrorNotice",(function(){return J})),r.d(o,"clearErrorNotice",(function(){return Q}));var c=r("@wordpress/element"),l=r("@wordpress/plugins"),a=r("@wordpress/hooks"),i=r("@wordpress/blocks"),s=r("@wordpress/data"),u=r("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),d=r("@wordpress/data-controls"),b=r("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"),p=r("lodash");function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){Object(u.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var O=Object(s.combineReducers)({downloadableBlocks:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return f(f({},e),{},Object(u.a)({},t.filterValue,{isRequesting:!0}));case"RECEIVE_DOWNLOADABLE_BLOCKS":return f(f({},e),{},Object(u.a)({},t.filterValue,{results:t.downloadableBlocks,isRequesting:!1}))}return e},blockManagement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{installedBlockTypes:[],isInstalling:{}},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return f(f({},e),{},{installedBlockTypes:[].concat(Object(b.a)(e.installedBlockTypes),[t.item])});case"REMOVE_INSTALLED_BLOCK_TYPE":return f(f({},e),{},{installedBlockTypes:e.installedBlockTypes.filter((function(e){return e.name!==t.item.name}))});case"SET_INSTALLING_BLOCK":return f(f({},e),{},{isInstalling:f(f({},e.isInstalling),{},Object(u.a)({},t.blockId,t.isInstalling))})}return e},errorNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_ERROR_NOTICE":return f(f({},e),{},Object(u.a)({},t.blockId,{message:t.message,isFatal:t.isFatal}));case"CLEAR_ERROR_NOTICE":return Object(p.omit)(e,t.blockId)}return e}});function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return!1;if(t.some((function(t){return t.name===e.name})))return!0;for(var r=0;r<t.length;r++)if(j(e,t[r].innerBlocks))return!0;return!1}function y(e,t){return!(!e.downloadableBlocks[t]||!e.downloadableBlocks[t].isRequesting)&&e.downloadableBlocks[t].isRequesting}function h(e,t){return e.downloadableBlocks[t]&&e.downloadableBlocks[t].results?e.downloadableBlocks[t].results:[]}function w(e){return e.blockManagement.installedBlockTypes}var k=Object(s.createRegistrySelector)((function(e){return function(t){var r=e("core/block-editor").getBlocks();return w(t).filter((function(e){return j(e,r)}))}})),v=Object(s.createRegistrySelector)((function(e){return function(t){var r=e("core/block-editor").getBlocks();return w(t).filter((function(e){return!j(e,r)}))}}));function g(e,t){return e.blockManagement.isInstalling[t]||!1}function _(e){return e.errorNotices}function E(e,t){return e.errorNotices[t]}var B=r("@babel/runtime/regenerator"),x=r.n(B),T=r("@wordpress/i18n"),P=r("@wordpress/notices"),S=r("./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"),N=r("@wordpress/api-fetch"),I=r.n(N);function L(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,l=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return l=e.done,e},e:function(e){a=!0,c=e},f:function(){try{l||null==r.return||r.return()}finally{if(a)throw c}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var C=function(e){return new Promise((function(t,r){var n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((function(t){e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=function(){return t(!0)},n.onerror=function(){return r(new Error("Error loading asset."))},document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}))};function D(e){return{type:"LOAD_ASSETS",assets:e}}var R={LOAD_ASSETS:function(){return Object(S.a)(x.a.mark((function e(){var t,r,n,o,c,l,a;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I()({url:document.location.href,parse:!1});case 2:return t=e.sent,e.next=5,t.text();case 5:r=e.sent,n=(new window.DOMParser).parseFromString(r,"text/html"),o=Array.from(n.querySelectorAll('link[rel="stylesheet"],script')).filter((function(e){return e.id&&!document.getElementById(e.id)})),c=L(o),e.prev=9,c.s();case 11:if((l=c.n()).done){e.next=17;break}return a=l.value,e.next=15,C(a);case 15:e.next=11;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(9),c.e(e.t0);case 22:return e.prev=22,c.f(),e.finish(22);case 25:case"end":return e.stop()}}),e,null,[[9,19,22,25]])})))()}};function M(e){if(!e)return!1;var t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}var F=x.a.mark(K),H=x.a.mark(G);function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){Object(u.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function W(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function U(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}function K(e){var t,r,n,o,c,l,a,u,b;return x.a.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return t=e.id,r=e.assets,n=!1,p.next=4,Q(t);case 4:return p.prev=4,p.next=7,q(e.id,!0);case 7:if(o=M(e),c={},!o){p.next=14;break}return p.next=12,Object(d.apiFetch)({url:o,data:{status:"active"},method:"PUT"});case 12:p.next=18;break;case 14:return p.next=16,Object(d.apiFetch)({path:"wp/v2/plugins",data:{slug:e.id,status:"active"},method:"POST"});case 16:l=p.sent,c=l._links;case 18:return p.next=20,Y(z(z({},e),{},{links:z(z({},e.links),c)}));case 20:return p.next=22,D(r);case 22:return p.next=24,s.controls.select(i.store.name,"getBlockTypes");case 24:if(p.sent.some((function(t){return t.name===e.name}))){p.next=27;break}throw new Error(Object(T.__)("Error registering block. Try reloading the page."));case 27:n=!0,p.next=38;break;case 30:return p.prev=30,p.t0=p.catch(4),a=p.t0.message||Object(T.__)("An error occurred."),u=p.t0 instanceof Error,(b={folder_exists:Object(T.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:Object(T.__)("Error installing block. You can reload the page and try again.")})[p.t0.code]&&(u=!0,a=b[p.t0.code]),p.next=38,J(t,a,u);case 38:return p.next=40,q(e.id,!1);case 40:return p.abrupt("return",n);case 41:case"end":return p.stop()}}),F,null,[[4,30]])}function G(e){return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(d.apiFetch)({url:M(e),data:{status:"inactive"},method:"PUT"});case 3:return t.next=5,Object(d.apiFetch)({url:M(e),method:"DELETE"});case 5:return t.next=7,$(e);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(0),t.next=13,s.controls.dispatch(P.store,"createErrorNotice",t.t0.message||Object(T.__)("An error occurred."));case 13:case"end":return t.stop()}}),H,null,[[0,9]])}function Y(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function $(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function q(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function J(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:r}}function Q(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var X={getDownloadableBlocks:x.a.mark((function e(t){var r,n;return x.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,W(t);case 5:return e.next=7,Object(d.apiFetch)({path:"wp/v2/block-directory/search?term=".concat(t)});case 7:return r=e.sent,n=r.map((function(e){return Object(p.mapKeys)(e,(function(e,t){return Object(p.camelCase)(t)}))})),e.next=11,U(n,t);case 11:e.next=15;break;case 13:e.prev=13,e.t0=e.catch(2);case 15:case"end":return e.stop()}}),e,null,[[2,13]])}))};function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach((function(t){Object(u.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var te={reducer:O,selectors:n,actions:o,controls:ee(ee({},d.controls),R),resolvers:X},re=Object(s.createReduxStore)("core/block-directory",te);function ne(){var e=Object(s.useDispatch)(re).uninstallBlockType,t=Object(s.useSelect)((function(e){var t=e("core/editor"),r=t.isAutosavingPost;return(0,t.isSavingPost)()&&!r()}),[]),r=Object(s.useSelect)((function(e){return e(re).getUnusedBlockTypes()}),[]);return Object(c.useEffect)((function(){t&&r.length&&r.forEach((function(t){e(t),Object(i.unregisterBlockType)(t.name)}))}),[t]),null}Object(s.register)(re);var oe=r("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),ce=r("@wordpress/block-editor"),le=r("@wordpress/compose"),ae=r("@wordpress/components"),ie=r("@wordpress/a11y");var se=function(e){var t=e.author,r=e.authorBlockCount,n=e.authorBlockRating;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"block-directory-downloadable-block-author-info__content-author"},Object(T.sprintf)(Object(T.__)("Authored by %s"),t)),Object(c.createElement)("span",{className:"block-directory-downloadable-block-author-info__content"},n>0?Object(T.sprintf)(Object(T._n)("This author has %1$d block, with an average rating of %2$.1f.","This author has %1$d blocks, with an average rating of %2$.1f.",r),r,n):Object(T.sprintf)(Object(T._n)("This author has %1$d block.","This author has %1$d blocks.",r),r)))},ue=r("@wordpress/html-entities"),de=r("./node_modules/@wordpress/icons/build-module/icon/index.js"),be=r("./node_modules/@wordpress/icons/build-module/library/star-filled.js"),pe=r("@wordpress/primitives"),me=Object(c.createElement)(pe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(pe.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})),fe=r("./node_modules/@wordpress/icons/build-module/library/star-empty.js");var Oe=function(e){var t=e.rating,r=.5*Math.round(t/.5),n=Math.floor(t),o=Math.ceil(t-n),l=5-(n+o);return Object(c.createElement)("div",{"aria-label":Object(T.sprintf)(Object(T.__)("%s out of 5 stars"),r)},Object(p.times)(n,(function(e){return Object(c.createElement)(de.a,{key:"full_stars_".concat(e),icon:be.a,size:16})})),Object(p.times)(o,(function(e){return Object(c.createElement)(de.a,{key:"half_stars_".concat(e),icon:me,size:16})})),Object(p.times)(l,(function(e){return Object(c.createElement)(de.a,{key:"empty_stars_".concat(e),icon:fe.a,size:16})})))},je=function(e){var t=e.rating,r=e.ratingCount;return Object(c.createElement)("div",{className:"block-directory-block-ratings"},Object(c.createElement)(Oe,{rating:t}),Object(c.createElement)("span",{className:"block-directory-block-ratings__rating-count","aria-label":Object(T.sprintf)(Object(T._n)("%d total rating","%d total ratings",r),r)},"(",r,")"))};var ye=function(e){var t=e.icon,r=e.title;return Object(c.createElement)("div",{className:"block-directory-downloadable-block-icon"},null!==t.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?Object(c.createElement)("img",{src:t,alt:Object(T.sprintf)(Object(T.__)("%s block icon"),r)}):Object(c.createElement)(ce.BlockIcon,{icon:t,showColors:!0}))};var he=function(e){var t=e.icon,r=e.title,n=e.rating,o=e.ratingCount,l=e.isLoading,a=void 0!==l&&l,i=e.isInstallable,s=void 0===i||i,u=e.onClick;return Object(c.createElement)("div",{className:"block-directory-downloadable-block-header__row"},Object(c.createElement)(ye,{icon:t,title:r}),Object(c.createElement)("div",{className:"block-directory-downloadable-block-header__column"},Object(c.createElement)("h2",{className:"block-directory-downloadable-block-header__title"},Object(ue.decodeEntities)(r)),Object(c.createElement)(je,{rating:n,ratingCount:o})),Object(c.createElement)(ae.Button,{isSecondary:!0,isBusy:a,disabled:a||!s,onClick:function(e){e.preventDefault(),!a&&s&&u()}},a?Object(T.__)("Adding…"):Object(T.__)("Add block")))},we=Object(c.createElement)(pe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(pe.Path,{d:"M18 3.5c0 .62-.38 1.16-.92 1.38v13.11H1.99l4.22-6.73c-.13-.23-.21-.48-.21-.76C6 9.67 6.67 9 7.5 9S9 9.67 9 10.5c0 .13-.02.25-.05.37l1.44.63c.27-.3.67-.5 1.11-.5.18 0 .35.04.51.09l3.58-6.41c-.36-.27-.59-.7-.59-1.18 0-.83.67-1.5 1.5-1.5.19 0 .36.04.53.1l.05-.09v.11c.54.22.92.76.92 1.38zm-1.92 13.49V5.85l-3.29 5.89c.13.23.21.48.21.76 0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5l.01-.07-1.63-.72c-.25.18-.55.29-.88.29-.18 0-.35-.04-.51-.1l-3.2 5.09h12.29z"})),ke=Object(c.createElement)(pe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(pe.Path,{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"}));var ve=function(e){var t,r=e.activeInstalls,n=e.description,o=e.humanizedUpdated;return t=r>1e6?Object(T.sprintf)(Object(T.__)("%d+ Million active installations"),Math.floor(r/1e6)):0===r?Object(T.__)("Less than 10 active installations"):Object(T.sprintf)(Object(T.__)("%d+ active installations"),r),Object(c.createElement)(c.Fragment,null,Object(c.createElement)("p",{className:"block-directory-downloadable-block-info__content"},Object(ue.decodeEntities)(n)),Object(c.createElement)("div",{className:"block-directory-downloadable-block-info__meta"},Object(c.createElement)(de.a,{className:"block-directory-downloadable-block-info__icon",icon:we}),t),Object(c.createElement)("div",{className:"block-directory-downloadable-block-info__meta"},Object(c.createElement)(de.a,{className:"block-directory-downloadable-block-info__icon",icon:ke}),Object(T.sprintf)(Object(T.__)("Updated %s"),o)))},ge=function(e){var t=e.block,r=e.onClick,n=Object(s.useSelect)((function(e){return e(re).getErrorNoticeForBlock(t.id)}),[t]);return n?Object(c.createElement)(ae.Notice,{status:"error",isDismissible:!1,className:"block-directory-downloadable-block-notice"},Object(c.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},n.message),Object(c.createElement)(ae.Button,{isSmall:!0,isPrimary:!0,onClick:function(){if(n.isFatal)return window.location.reload(),!1;r(t)}},n.isFatal?Object(T.__)("Reload"):Object(T.__)("Retry"))):null};function _e(e){var t=e.item,r=e.onClick,n=Object(s.useSelect)((function(e){var r=e(re),n=r.isInstalling,o=(0,r.getErrorNoticeForBlock)(t.id),c=o&&o.isFatal;return{isLoading:n(t.id),isInstallable:!c}}),[t]),o=n.isLoading,l=n.isInstallable,a=t.icon,i=t.title,u=t.description,d=t.rating,b=t.activeInstalls,p=t.ratingCount,m=t.author,f=t.humanizedUpdated,O=t.authorBlockCount,j=t.authorBlockRating;return Object(c.createElement)("li",{className:"block-directory-downloadable-block-list-item"},Object(c.createElement)("article",{className:"block-directory-downloadable-block-list-item__panel"},Object(c.createElement)("header",{className:"block-directory-downloadable-block-list-item__header"},Object(c.createElement)(he,{icon:a,onClick:r,title:i,rating:d,ratingCount:p,isLoading:o,isInstallable:l})),Object(c.createElement)("section",{className:"block-directory-downloadable-block-list-item__body"},Object(c.createElement)(ge,{onClick:r,block:t}),Object(c.createElement)(ve,{activeInstalls:b,description:u,humanizedUpdated:f})),Object(c.createElement)("footer",{className:"block-directory-downloadable-block-list-item__footer"},Object(c.createElement)(se,{author:m,authorBlockCount:O,authorBlockRating:j}))))}var Ee=function(e){var t=e.items,r=e.onHover,n=void 0===r?p.noop:r,o=e.onSelect,l=Object(s.useDispatch)(re).installBlockType;return t.length?Object(c.createElement)("ul",{role:"list",className:"block-directory-downloadable-blocks-list"},t.map((function(e){return Object(c.createElement)(_e,{key:e.id,onClick:function(){Object(i.getBlockType)(e.name)?o(e):l(e).then((function(t){t&&o(e)})),n(null)},item:e})}))):null};var Be=Object(le.compose)([Object(s.withSelect)((function(e,t){var r=t.filterValue,n=t.rootClientId,o=void 0===n?null:n,c=e(re),l=c.getDownloadableBlocks,a=c.isRequestingDownloadableBlocks,i=e(ce.store).canInsertBlockType,s=e("core").canUser("read","block-directory/search");return{downloadableItems:s?l(r).filter((function(e){return i(e,o,!0)})):[],hasPermission:s,isLoading:a(r)}}))])((function(e){var t=e.downloadableItems,r=e.onSelect,n=e.onHover,o=e.hasPermission,l=e.isLoading,a=e.isWaiting,i=Object(le.useDebounce)(ie.speak,500);return!1===o?(i(Object(T.__)("No blocks found in your library.")),Object(c.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description has-no-results"},Object(T.__)("No blocks found in your library."))):void 0===o||l||a?Object(c.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description has-no-results"},Object(c.createElement)(ae.Spinner,null)):t.length?(i(Object(T.sprintf)(Object(T._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.",t.length),t.length)),Object(c.createElement)(c.Fragment,null,Object(c.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},Object(T.__)("No blocks found in your library. These blocks can be downloaded and installed:")),Object(c.createElement)(Ee,{items:t,onSelect:r,onHover:n}))):Object(c.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description has-no-results"},Object(T.__)("No blocks found in your library."))}));var xe=function(){var e=Object(c.useState)(""),t=Object(oe.a)(e,2),r=t[0],n=t[1],o=Object(p.debounce)(n,400);return Object(c.createElement)(ce.__experimentalInserterMenuExtension,null,(function(e){var t=e.onSelect,n=e.onHover,l=e.filterValue,a=e.hasItems,i=e.rootClientId;return a||!l?null:(r!==l&&o(l),Object(c.createElement)(Be,{onSelect:t,onHover:n,rootClientId:i,filterValue:r,isWaiting:l!==r}))}))},Te=r("@wordpress/edit-post"),Pe=r("./node_modules/@wordpress/icons/build-module/library/block-default.js");function Se(e){var t=e.items;return t.length?Object(c.createElement)("ul",{className:"block-directory-compact-list"},t.map((function(e){var t=e.icon,r=e.id,n=e.title,o=e.author;return Object(c.createElement)("li",{key:r,className:"block-directory-compact-list__item"},Object(c.createElement)(ye,{icon:t,title:n}),Object(c.createElement)("div",{className:"block-directory-compact-list__item-details"},Object(c.createElement)("div",{className:"block-directory-compact-list__item-title"},n),Object(c.createElement)("div",{className:"block-directory-compact-list__item-author"},Object(T.sprintf)(Object(T.__)("By %s"),o))))}))):null}function Ne(){var e=Object(s.useSelect)((function(e){return e(re).getNewBlockTypes()}),[]);return e.length?Object(c.createElement)(Te.PluginPrePublishPanel,{icon:Pe.a,title:Object(T.sprintf)(Object(T._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},Object(c.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},Object(T._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),Object(c.createElement)(Se,{items:e})):null}var Ie=r("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),Le=r("./node_modules/@babel/runtime/helpers/esm/extends.js");function Ae(e){var t=e.attributes,r=e.block,n=e.clientId,o=Object(s.useSelect)((function(e){return e(re).isInstalling(r.id)})),l=Object(s.useDispatch)(re).installBlockType,a=Object(s.useDispatch)("core/block-editor").replaceBlock;return Object(c.createElement)(ae.Button,{onClick:function(){return l(r).then((function(e){if(e){var o=Object(i.getBlockType)(r.name),c=Object(i.parse)(t.originalContent),l=Object(oe.a)(c,1)[0];l&&a(n,Object(i.createBlock)(o.name,l.attributes,l.innerBlocks))}}))},disabled:o,isBusy:o,isPrimary:!0},Object(T.sprintf)(Object(T.__)("Install %s"),r.title))}var Ce=function(e){var t=e.originalBlock,r=Object(Ie.a)(e,["originalBlock"]),n=r.attributes,o=n.originalName,l=n.originalUndelimitedContent,a=Object(s.useDispatch)("core/block-editor").replaceBlock,u=!!l,d=Object(i.getBlockType)("core/html"),b=Object(T.sprintf)(Object(T.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely!"),t.title||o),p=[Object(c.createElement)(Ae,{key:"install",block:t,attributes:r.attributes,clientId:r.clientId})];return u&&d&&(b=Object(T.sprintf)(Object(T.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),t.title||o),p.push(Object(c.createElement)(ae.Button,{key:"convert",onClick:function(){a(r.clientId,Object(i.createBlock)("core/html",{content:l}))},isLink:!0},Object(T.__)("Keep as HTML")))),Object(c.createElement)("div",Object(ce.useBlockProps)(),Object(c.createElement)(ce.Warning,{actions:p},b),Object(c.createElement)(c.RawHTML,null,l))},De=function(e){return function(t){var r=t.attributes.originalName,n=Object(s.useSelect)((function(e){var t=(0,e(re).getDownloadableBlocks)("block:"+r).filter((function(e){var t=e.name;return r===t}));return{hasPermission:e("core").canUser("read","block-directory/search"),block:t.length&&t[0]}}),[r]),o=n.block;return n.hasPermission&&o?Object(c.createElement)(Ce,Object(Le.a)({},t,{originalBlock:o})):Object(c.createElement)(e,t)}};Object(l.registerPlugin)("block-directory",{render:function(){return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(ne,null),Object(c.createElement)(xe,null),Object(c.createElement)(Ne,null))}}),Object(a.addFilter)("blocks.registerBlockType","block-directory/fallback",(function(e,t){return"core/missing"!==t||(e.edit=De(e.edit)),e}))},"./node_modules/@wordpress/icons/build-module/icon/index.js":function(e,t,r){"use strict";var n=r("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=r("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),c=r("@wordpress/element");function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.icon,r=e.size,a=void 0===r?24:r,i=Object(o.a)(e,["icon","size"]);return Object(c.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){Object(n.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:a,height:a},i))}},"./node_modules/@wordpress/icons/build-module/library/block-default.js":function(e,t,r){"use strict";var n=r("@wordpress/element"),o=r("@wordpress/primitives"),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"}));t.a=c},"./node_modules/@wordpress/icons/build-module/library/star-empty.js":function(e,t,r){"use strict";var n=r("@wordpress/element"),o=r("@wordpress/primitives"),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"}));t.a=c},"./node_modules/@wordpress/icons/build-module/library/star-filled.js":function(e,t,r){"use strict";var n=r("@wordpress/element"),o=r("@wordpress/primitives"),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"}));t.a=c},"@babel/runtime/regenerator":function(e,t){e.exports=window.regeneratorRuntime},"@wordpress/a11y":function(e,t){e.exports=window.wp.a11y},"@wordpress/api-fetch":function(e,t){e.exports=window.wp.apiFetch},"@wordpress/block-editor":function(e,t){e.exports=window.wp.blockEditor},"@wordpress/blocks":function(e,t){e.exports=window.wp.blocks},"@wordpress/components":function(e,t){e.exports=window.wp.components},"@wordpress/compose":function(e,t){e.exports=window.wp.compose},"@wordpress/data":function(e,t){e.exports=window.wp.data},"@wordpress/data-controls":function(e,t){e.exports=window.wp.dataControls},"@wordpress/edit-post":function(e,t){e.exports=window.wp.editPost},"@wordpress/element":function(e,t){e.exports=window.wp.element},"@wordpress/hooks":function(e,t){e.exports=window.wp.hooks},"@wordpress/html-entities":function(e,t){e.exports=window.wp.htmlEntities},"@wordpress/i18n":function(e,t){e.exports=window.wp.i18n},"@wordpress/notices":function(e,t){e.exports=window.wp.notices},"@wordpress/plugins":function(e,t){e.exports=window.wp.plugins},"@wordpress/primitives":function(e,t){e.exports=window.wp.primitives},lodash:function(e,t){e.exports=window.lodash}}); |