File "featured-category.js"

Full Path: /home/vantageo/public_html/wp-admin-20240915120854/wp-includes-20240915121038/IXR/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/featured-category.js
File size: 23.6 KB
MIME-type: text/plain
Charset: utf-8

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-category"]=function(e){function t(t){for(var n,a,i=t[0],u=t[1],s=t[2],d=0,p=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,i=1;i<r.length;i++){var u=r[i];0!==o[u]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={23:0},c=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var l=u;return c.push([840,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},106:function(e,t){},107:function(e,t){},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},12:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},126:function(e,t){},14:function(e,t,r){"use strict";r.d(t,"m",(function(){return c})),r.d(t,"k",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"h",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"d",(function(){return d})),r.d(t,"g",(function(){return p})),r.d(t,"f",(function(){return g})),r.d(t,"j",(function(){return b})),r.d(t,"i",(function(){return f})),r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return h})),r.d(t,"e",(function(){return O})),r.d(t,"p",(function(){return w})),r.d(t,"q",(function(){return j})),r.d(t,"n",(function(){return v})),r.d(t,"o",(function(){return _}));var n,o=r(5),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"assets/",i=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,p=o.STORE_PAGES.privacy.permalink,g=o.STORE_PAGES.privacy.title,b=o.STORE_PAGES.terms.permalink,f=o.STORE_PAGES.terms.title,m=o.STORE_PAGES.cart.id,h=o.STORE_PAGES.cart.permalink,O=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),y=r(25),w=function(e,t){if(u>2)return Object(y.registerBlockType)(e,t)},j=function(e,t){if(u>1)return Object(y.registerBlockType)(e,t)},v=function(){return u>2},_=function(){return u>1}},141:function(e,t,r){"use strict";var n=r(0),o=r(31),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},144:function(e,t){},19:function(e,t){!function(){e.exports=this.wp.apiFetch}()},20:function(e,t){!function(){e.exports=this.wp.url}()},21:function(e,t){!function(){e.exports=this.wp.data}()},22:function(e,t){!function(){e.exports=this.wp.blockEditor}()},25:function(e,t){!function(){e.exports=this.wp.blocks}()},26:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},27:function(e,t){!function(){e.exports=this.moment}()},3:function(e,t){!function(){e.exports=this.wp.components}()},31:function(e,t){!function(){e.exports=this.wp.primitives}()},34:function(e,t){!function(){e.exports=this.wp.dataControls}()},35:function(e,t,r){"use strict";r.d(t,"h",(function(){return g})),r.d(t,"e",(function(){return b})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return m})),r.d(t,"f",(function(){return h})),r.d(t,"c",(function(){return O})),r.d(t,"d",(function(){return y})),r.d(t,"g",(function(){return w})),r.d(t,"a",(function(){return j}));var n=r(4),o=r.n(n),c=r(20),a=r(19),i=r.n(a),u=r(6),s=r(5),l=r(14);function d(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,s=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,i=void 0===a?[]:a,u=l.m.productCount>100,s={per_page:u?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},d=[Object(c.addQueryArgs)("/wc/store/products",p(p({},s),i))];return u&&r.length&&d.push(Object(c.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r})),d}({selected:r,search:o,queryArgs:void 0===a?[]:a});return Promise.all(s.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id").map((function(e){return p(p({},e),{},{parent:0})}))})).catch((function(e){throw e}))},b=function(e){return i()({path:"/wc/store/products/".concat(e)})},f=function(){return i()({path:"wc/store/products/attributes"})},m=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},h=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=Object(s.getSetting)("limitTags",!1),a=[Object(c.addQueryArgs)("wc/store/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:n})];return o&&r.length&&a.push(Object(c.addQueryArgs)("wc/store/products/tags",{include:r})),a}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id")}))},O=function(e){return i()({path:Object(c.addQueryArgs)("wc/store/products/categories",p({per_page:0},e))})},y=function(e){return i()({path:"wc/store/products/categories/".concat(e)})},w=function(e){return i()({path:Object(c.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})})},j=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return s}));var n=r(28),o=r.n(n),c=r(12),a=r.n(c),i=r(1),u=function(){var e=o()(a.a.mark((function e(t){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}(),s=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},42:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},43:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(42));t.a=function(e){var t,r,a,i=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=i).message,a=t.type,r?"general"===a?Object(n.createElement)("span",null,Object(o.__)("The following error was returned",'woocommerce'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===a?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API",'woocommerce'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'woocommerce')))}},48:function(e,t){!function(){e.exports=this.wp.keycodes}()},5:function(e,t){!function(){e.exports=this.wc.wcSettings}()},54:function(e,t){!function(){e.exports=this.wp.hooks}()},57:function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(23),a=r.n(c),i=r(0);function u(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.srcElement,r=e.size,n=void 0===r?24:r,c=a()(e,["srcElement","size"]);return Object(i.isValidElement)(t)?Object(i.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c)):null}},6:function(e,t){!function(){e.exports=this.lodash}()},66:function(e,t){!function(){e.exports=this.wp.deprecated}()},70:function(e,t){!function(){e.exports=this.wp.dom}()},78:function(e,t){!function(){e.exports=this.ReactDOM}()},8:function(e,t){!function(){e.exports=this.React}()},83:function(e,t){!function(){e.exports=this.wp.viewport}()},84:function(e,t){!function(){e.exports=this.wp.date}()},840:function(e,t,r){e.exports=r(901)},841:function(e,t){},842:function(e,t){},86:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),a=r(1),i=r(6),u=(r(2),r(45)),s=r(3),l=r(28),d=r.n(l),p=r(15),g=r.n(p),b=r(16),f=r.n(b),m=r(11),h=r.n(m),O=r(17),y=r.n(O),w=r(18),j=r.n(w),v=r(9),_=r.n(v),k=r(12),E=r.n(k),S=r(142),C=r(35),P=r(37);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var o=_()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var R=Object(S.a)((function(e){return function(t){y()(n,t);var r=x(n);function n(){var e;return g()(this,n),(e=r.apply(this,arguments)).state={error:null,loading:!1,categories:null},e.loadCategories=e.loadCategories.bind(h()(e)),e}return f()(n,[{key:"componentDidMount",value:function(){this.loadCategories()}},{key:"loadCategories",value:function(){var e=this;this.setState({loading:!0}),Object(C.c)().then((function(t){e.setState({categories:t,loading:!1,error:null})})).catch(function(){var t=d()(E.a.mark((function t(r){var n;return E.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(P.a)(r);case 2:n=t.sent,e.setState({categories:null,loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,a=t.categories;return Object(c.createElement)(e,o()({},this.props,{error:r,isLoading:n,categories:a}))}}]),n}(c.Component)}),"withCategories"),T=r(43),A=(r(126),function(e){var t=e.categories,r=e.error,n=e.isLoading,l=e.onChange,d=e.onOperatorChange,p=e.operator,g=e.selected,b=e.isSingle,f=e.showReviewCount,m={clear:Object(a.__)("Clear all product categories",'woocommerce'),list:Object(a.__)("Product Categories",'woocommerce'),noItems:Object(a.__)("Your store doesn't have any product categories.",'woocommerce'),search:Object(a.__)("Search for product categories",'woocommerce'),selected:function(e){return Object(a.sprintf)(Object(a._n)("%d category selected","%d categories selected",e,'woocommerce'),e)},updated:Object(a.__)("Category search results updated.",'woocommerce')};return r?Object(c.createElement)(T.a,{error:r}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.a,{className:"woocommerce-product-categories",list:t,isLoading:n,selected:g.map((function(e){return Object(i.find)(t,{id:e})})).filter(Boolean),onChange:l,renderItem:function(e){var t=e.item,r=e.search,n=e.depth,i=void 0===n?0:n,s=["woocommerce-product-categories__item"];r.length&&s.push("is-searching"),0===i&&0!==t.parent&&s.push("is-skip-level");var l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name,d=f?Object(a.sprintf)(Object(a._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,'woocommerce'),l,t.review_count):Object(a.sprintf)(Object(a._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,'woocommerce'),l,t.count),p=f?Object(a.sprintf)(Object(a._n)("%d Review","%d Reviews",t.review_count,'woocommerce'),t.review_count):Object(a.sprintf)(Object(a._n)("%d Product","%d Products",t.count,'woocommerce'),t.count);return Object(c.createElement)(u.b,o()({className:s.join(" ")},e,{showCount:!0,countLabel:p,"aria-label":d}))},messages:m,isHierarchical:!0,isSingle:b}),!!d&&Object(c.createElement)("div",{className:g.length<2?"screen-reader-text":""},Object(c.createElement)(s.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(a.__)("Display products matching",'woocommerce'),help:Object(a.__)("Pick at least two categories to use this setting.",'woocommerce'),value:p,onChange:d,options:[{label:Object(a.__)("Any selected categories",'woocommerce'),value:"any"},{label:Object(a.__)("All selected categories",'woocommerce'),value:"all"}]})))});A.defaultProps={operator:"any",isSingle:!1};t.a=R(A)},901:function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(1),c=r(22),a=r(25),i=r(5),u=r(57),s=r(31),l=Object(n.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-6.92-3.96L12.39 17 15 15.47 17.61 17l-.69-2.96 2.3-1.99-3.03-.26L15 9l-1.19 2.79-3.03.26z"})),d=(r(841),r(842),r(3)),p=r(7),g=r.n(p),b=r(934),f=(r(2),r(86)),m=r(94),h=r(6);function O(e){return e&&Object(h.isObject)(e.image)?e.image.src:""}var y=r(10),w=r.n(y),j=r(28),v=r.n(j),_=r(15),k=r.n(_),E=r(16),S=r.n(E),C=r(11),P=r.n(C),x=r(17),R=r.n(x),T=r(18),A=r.n(T),I=r(9),B=r.n(I),M=r(12),N=r.n(M),D=r(142),L=r(35),G=r(37);function F(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B()(e);if(t){var o=B()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return A()(this,r)}}var z=Object(D.a)((function(e){return function(t){R()(o,t);var r=F(o);function o(){var e;return k()(this,o),(e=r.apply(this,arguments)).state={error:null,loading:!1,category:"preview"===e.props.attributes.categoryId?e.props.attributes.previewCategory:null},e.loadCategory=e.loadCategory.bind(P()(e)),e}return S()(o,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;"preview"!==t&&(t?(this.setState({loading:!0}),Object(L.d)(t).then((function(t){e.setState({category:t,loading:!1,error:null})})).catch(function(){var t=v()(N.a.mark((function t(r){var n;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(G.a)(r);case 2:n=t.sent,e.setState({category:null,loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):this.setState({category:null,loading:!1,error:null}))}},{key:"render",value:function(){var t=this.state,r=t.error,o=t.loading,c=t.category;return Object(n.createElement)(e,w()({},this.props,{error:r,getCategory:this.loadCategory,isLoading:o,category:c}))}}]),o}(n.Component)}),"withCategory"),H=Object(b.a)([z,Object(c.withColors)({overlayColor:"background-color"}),d.withSpokenMessages])((function(e){var t,r,a,s,p,b,y,w=e.attributes,j=e.isSelected,v=e.setAttributes,_=e.error,k=e.getCategory,E=e.isLoading,S=e.category,C=e.overlayColor,P=e.setOverlayColor,x=e.debouncedSpeak,R=w.editMode;return _?Object(n.createElement)(m.a,{className:"wc-block-featured-category-error",error:_,isLoading:E,onRetry:k}):R?Object(n.createElement)(d.Placeholder,{icon:Object(n.createElement)(u.a,{srcElement:l}),label:Object(o.__)("Featured Category",'woocommerce'),className:"wc-block-featured-category"},Object(o.__)("Visually highlight a product category and encourage prompt action.",'woocommerce'),Object(n.createElement)("div",{className:"wc-block-featured-category__selection"},Object(n.createElement)(f.a,{selected:[w.categoryId],onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;v({categoryId:t,mediaId:0,mediaSrc:""})},isSingle:!0}),Object(n.createElement)(d.Button,{isPrimary:!0,onClick:function(){v({editMode:!1}),x(Object(o.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce')))):Object(n.createElement)(n.Fragment,null,(p=w.contentAlign,b=w.mediaSrc,y=w.mediaId||function(e){return e&&Object(h.isObject)(e.image)?e.image.id:0}(S),Object(n.createElement)(c.BlockControls,null,Object(n.createElement)(c.AlignmentToolbar,{value:p,onChange:function(e){v({contentAlign:e})}}),Object(n.createElement)(c.MediaReplaceFlow,{mediaId:y,mediaURL:b,accept:"image/*",onSelect:function(e){v({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"]}))),(t=w.mediaSrc||O(S),r=w.focalPoint,a=void 0===r?{x:.5,y:.5}:r,s="function"==typeof d.FocalPointPicker,Object(n.createElement)(c.InspectorControls,{key:"inspector"},Object(n.createElement)(d.PanelBody,{title:Object(o.__)("Content",'woocommerce')},Object(n.createElement)(d.ToggleControl,{label:Object(o.__)("Show description",'woocommerce'),checked:w.showDesc,onChange:function(){return v({showDesc:!w.showDesc})}})),Object(n.createElement)(c.PanelColorSettings,{title:Object(o.__)("Overlay",'woocommerce'),colorSettings:[{value:C.color,onChange:P,label:Object(o.__)("Overlay Color",'woocommerce')}]},!!t&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(d.RangeControl,{label:Object(o.__)("Background Opacity",'woocommerce'),value:w.dimRatio,onChange:function(e){return v({dimRatio:e})},min:0,max:100,step:10}),s&&Object(n.createElement)(d.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:t,value:a,onChange:function(e){return v({focalPoint:e})}}))))),S?function(){var e,t,r=w.className,a=w.contentAlign,u=w.dimRatio,s=w.focalPoint,l=w.height,p=w.showDesc,b=g()("wc-block-featured-category",{"is-selected":j&&"preview"!==w.productId,"is-loading":!S&&E,"is-not-found":!S&&!E,"has-background-dim":0!==u},0===(e=u)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==a&&"has-".concat(a,"-content"),r),f=w.mediaSrc||O(S),m=S?(t=f)?{backgroundImage:"url(".concat(t,")")}:{}:{};if(C.color&&(m.backgroundColor=C.color),s){var h=100*s.x,y=100*s.y;m.backgroundPosition="".concat(h,"% ").concat(y,"%")}var _;return Object(n.createElement)(d.ResizableBox,{className:b,size:{height:l},minHeight:Object(i.getSetting)("min_height",500),enable:{bottom:!0},onResizeStop:function(e,t,r){v({height:parseInt(r.style.height,10)})},style:m},Object(n.createElement)("div",{className:"wc-block-featured-category__wrapper"},Object(n.createElement)("h2",{className:"wc-block-featured-category__title",dangerouslySetInnerHTML:{__html:S.name}}),p&&Object(n.createElement)("div",{className:"wc-block-featured-category__description",dangerouslySetInnerHTML:{__html:S.description}}),Object(n.createElement)("div",{className:"wc-block-featured-category__link"},(_=g()("wp-block-button__link","is-style-fill"),"preview"===w.categoryId?Object(n.createElement)("div",{className:"wp-block-button aligncenter",style:{width:"100%"}},Object(n.createElement)(c.RichText.Content,{tagName:"a",className:_,href:S.permalink,title:w.linkText,style:{backgroundColor:"vivid-green-cyan",borderRadius:"5px"},value:w.linkText,target:S.permalink})):Object(n.createElement)(c.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now",'woocommerce'),url:S.permalink,align:"center"}]],templateLock:"all"})))))}():Object(n.createElement)(d.Placeholder,{className:"wc-block-featured-category",icon:Object(n.createElement)(u.a,{srcElement:l}),label:Object(o.__)("Featured Category",'woocommerce')},E?Object(n.createElement)(d.Spinner,null):Object(o.__)("No product category is selected.",'woocommerce')))})),V=r(14),$=[{id:1,name:Object(o.__)("Clothing",'woocommerce'),slug:"clothing",parent:0,count:10,description:"<p>".concat(Object(o.__)("Branded t-shirts, jumpers, pants and more!",'woocommerce'),"</p>\n"),image:{id:1,date_created:"2019-07-15T17:05:04",date_created_gmt:"2019-07-15T17:05:04",date_modified:"2019-07-15T17:05:04",date_modified_gmt:"2019-07-15T17:05:04",src:V.k+"img/collection.jpg",name:"",alt:""},permalink:"#"}],q={attributes:{contentAlign:"center",dimRatio:50,editMode:!1,height:Object(i.getSetting)("default_height",500),mediaSrc:"",showDesc:!0,categoryId:"preview",previewCategory:$[0]}};Object(a.registerBlockType)("woocommerce/featured-category",{title:Object(o.__)("Featured Category",'woocommerce'),icon:{src:Object(n.createElement)(u.a,{srcElement:l}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Visually highlight a product category and encourage prompt action.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:q,attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:Object(i.getSetting)("default_height",500)},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(o.__)("Shop now",'woocommerce')},categoryId:{type:"number"},showDesc:{type:"boolean",default:!0},previewCategory:{type:"object",default:null}},edit:function(e){return Object(n.createElement)(H,e)},save:function(){return Object(n.createElement)(c.InnerBlocks.Content,null)}})},94:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(57)),a=r(141),i=r(7),u=r.n(i),s=r(3),l=r(43);r(144);t.a=function(e){var t=e.className,r=e.error,i=e.isLoading,d=e.onRetry;return Object(n.createElement)(s.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:a.a}),label:Object(o.__)("Sorry, an error occurred",'woocommerce'),className:u()("wc-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),d&&Object(n.createElement)(n.Fragment,null,i?Object(n.createElement)(s.Spinner,null):Object(n.createElement)(s.Button,{isSecondary:!0,onClick:d},Object(o.__)("Retry",'woocommerce'))))}}});