File "product-category.js"

Full Path: /home/warrior1/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/product-category.js
File size: 32.76 KB
MIME-type: text/plain
Charset: utf-8

this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-category"]=function(e){function t(t){for(var r,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&d.push(o[l][0]),o[l]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);d.length;)d.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,a=1;a<c.length;a++){var s=c[a];0!==o[s]&&(r=!1)}r&&(n.splice(t--,1),e=l(l.s=c[0]))}return e}var r={},o={22:0},n=[];function l(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=r,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(c,r,function(t){return e[t]}.bind(null,r));return c},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return n.push([357,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},11:function(e,t){e.exports=window.wp.primitives},13:function(e,t){e.exports=window.wp.apiFetch},14:function(e,t){e.exports=window.wp.htmlEntities},143:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},15:function(e,t){e.exports=window.wp.url},19:function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"c",(function(){return s})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(7),n=c(1);const l={clear:Object(n.__)("Clear all selected items","woocommerce"),noItems:Object(n.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:Object(n.__)("No results for %s","woocommerce"),search:Object(n.__)("Search for items","woocommerce"),selected:e=>Object(n.sprintf)(
/* translators: Number of items selected from list. */
Object(n._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:Object(n.__)("Search results updated.","woocommerce")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(r[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:l(r[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||s.push(...a(c||[]))}),s},s=(e,t,c)=>{if(!t)return c?a(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?a(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},2:function(e,t){e.exports=window.wc.wcSettings},23:function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return l})),c.d(t,"l",(function(){return a})),c.d(t,"n",(function(){return s})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return b})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return g})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return p})),c.d(t,"h",(function(){return h})),c.d(t,"a",(function(){return E})),c.d(t,"i",(function(){return O})),c.d(t,"b",(function(){return j}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=n.pluginUrl+"images/",a=n.pluginUrl+"build/",s=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,b=o.STORE_PAGES.checkout.permalink,d=o.STORE_PAGES.privacy.permalink,g=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),p=o.STORE_PAGES.cart.permalink,h=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),E=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{})},25:function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return b})),c.d(t,"i",(function(){return d})),c.d(t,"f",(function(){return g})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return p})),c.d(t,"g",(function(){return h})),c.d(t,"a",(function(){return E}));var r=c(15),o=c(13),n=c.n(o),l=c(7),a=c(2),s=c(23);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const a=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=s.o.productCount>100,l={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},a=[Object(r.addQueryArgs)("/wc/store/v1/products",{...l,...o})];return n&&t.length&&a.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),a})({selected:t,search:c,queryArgs:o});return Promise.all(a.map(e=>n()({path:e}))).then(e=>Object(l.uniqBy)(Object(l.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),b=()=>n()({path:"wc/store/v1/products/attributes"}),d=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),g=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(a.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(l.uniqBy)(Object(l.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),p=e=>n()({path:"wc/store/v1/products/categories/"+e}),h=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),E=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},27:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return l}));var r=c(1),o=c(14);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},l=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(o.decodeEntities)(e.message):Object(r.__)("Something went wrong. Please contact us to get assistance.","woocommerce")}},278:function(e){e.exports=JSON.parse('{"name":"woocommerce/product-category","title":"Products by Category","category":"woocommerce","keywords":["WooCommerce"],"description":"Display a grid of products from your selected categories.","supports":{"align":["wide","full"],"html":false},"example":{"attributes":{"isPreview":true}},"attributes":{"columns":{"type":"number","default":3},"rows":{"type":"number","default":3},"alignButtons":{"type":"boolean","default":false},"contentVisibility":{"type":"object","default":{"image":true,"title":true,"price":true,"rating":true,"button":true},"properties":{"image":{"type":"boolean","default":true},"title":{"type":"boolean","default":true},"price":{"type":"boolean","default":true},"rating":{"type":"boolean","default":true},"button":{"type":"boolean","default":true}}},"categories":{"type":"array","default":[]},"catOperator":{"type":"string","default":"any"},"isPreview":{"type":"boolean","default":false},"stockStatus":{"type":"array"},"editMode":{"type":"boolean","default":true},"orderby":{"type":"string","enum":["date","popularity","price_asc","price_desc","rating","title","menu_order"],"default":"date"}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},3:function(e,t){e.exports=window.wp.components},32:function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(33);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woocommerce"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woocommerce"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An error has prevented the block from being updated.","woocommerce")})(t))}},33:function(e,t){e.exports=window.wp.escapeHtml},35:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(6),o=c.n(r),n=c(0),l=c(19);const a=e=>{let{countLabel:t,className:c,depth:r=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...g}=e;const m=null!=t&&void 0!==s.count&&null!==s.count,p=[c,"woocommerce-search-list__item"];p.push("depth-"+r),u&&p.push("is-radio-button"),m&&p.push("has-count");const h=s.breadcrumbs&&s.breadcrumbs.length,E=g.name||"search-list-item-"+a,O=`${E}-${s.id}`;return Object(n.createElement)("label",{htmlFor:O,className:p.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:O,name:E,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},g)):Object(n.createElement)("input",o()({type:"checkbox",id:O,name:E,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},g)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},h?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},357:function(e,t,c){e.exports=c(474)},358:function(e,t){},474:function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(8),n=c(7),l=c(113),a=c(510),s=(c(358),c(278)),i=c(74),u=c(6),b=c.n(u),d=c(5),g=c(3),m=c(1),p=c(55),h=c.n(p),E=c(143);const O=()=>Object(r.createElement)(g.Placeholder,{icon:Object(r.createElement)(l.a,{icon:a.a}),label:Object(m.__)("Products by Category","woocommerce"),className:"wc-block-products-grid wc-block-products-category"},Object(m.__)("No products were found that matched your selection.","woocommerce")),j=e=>{const{name:t,attributes:c}=e,o=c.categories.length;return c.isPreview?E.a:o?Object(r.createElement)(h.a,{block:t,attributes:c,EmptyResponsePlaceholder:O}):Object(r.createElement)(r.Fragment,null,Object(m.__)("Select at least one category to display its products.","woocommerce"))};var w=c(56),f=c(63),_=c(2),y=c(62),k=c(98),x=c(81);const v=e=>{const{isEditing:t,attributes:c,setAttributes:o,setChangedAttributes:n}=e,{columns:l,catOperator:a,contentVisibility:s,orderby:i,rows:u,alignButtons:b,stockStatus:p}=c;return Object(r.createElement)(d.InspectorControls,{key:"inspector"},Object(r.createElement)(g.PanelBody,{title:Object(m.__)("Product Category","woocommerce"),initialOpen:!c.categories.length&&!t},Object(r.createElement)(w.a,{selected:c.categories,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=e.map(e=>{let{id:t}=e;return t}),c={categories:t};o(c),n(c)},operator:a,onOperatorChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";const t={catOperator:e};o(t),n(t)},isCompact:!0})),Object(r.createElement)(g.PanelBody,{title:Object(m.__)("Layout","woocommerce"),initialOpen:!0},Object(r.createElement)(f.a,{columns:l,rows:u,alignButtons:b,setAttributes:o,minColumns:Object(_.getSetting)("min_columns",1),maxColumns:Object(_.getSetting)("max_columns",6),minRows:Object(_.getSetting)("min_rows",1),maxRows:Object(_.getSetting)("max_rows",6)})),Object(r.createElement)(g.PanelBody,{title:Object(m.__)("Content","woocommerce"),initialOpen:!0},Object(r.createElement)(y.a,{settings:s,onChange:e=>o({contentVisibility:e})})),Object(r.createElement)(g.PanelBody,{title:Object(m.__)("Order By","woocommerce"),initialOpen:!1},Object(r.createElement)(k.a,{setAttributes:o,value:i})),Object(r.createElement)(g.PanelBody,{title:Object(m.__)("Filter by stock status","woocommerce"),initialOpen:!1},Object(r.createElement)(x.a,{setAttributes:o,value:p})))},S=e=>{const{debouncedSpeak:t,setIsEditing:c,changedAttributes:o,setChangedAttributes:n,attributes:s}=e,i={...s,...o},u=()=>{c(!1),n({})};return Object(r.createElement)(g.Placeholder,{icon:Object(r.createElement)(l.a,{icon:a.a}),label:Object(m.__)("Products by Category","woocommerce"),className:"wc-block-products-grid wc-block-products-category"},Object(m.__)("Display a grid of products from your selected categories.","woocommerce"),Object(r.createElement)("div",{className:"wc-block-products-category__selection"},Object(r.createElement)(w.a,{selected:i.categories,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=e.map(e=>{let{id:t}=e;return t});n({categories:t})},operator:i.catOperator,onOperatorChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return n({catOperator:e})}}),Object(r.createElement)(g.Button,{isPrimary:!0,onClick:()=>{(()=>{const{setAttributes:t}=e;t(o),u()})(),t(Object(m.__)("Now displaying a preview of the reviews for the products in the selected categories.","woocommerce"))}},Object(m.__)("Done","woocommerce")),Object(r.createElement)(g.Button,{className:"wc-block-products-category__cancel-button",isTertiary:!0,onClick:()=>{u(),t(Object(m.__)("Now displaying a preview of the reviews for the products in the selected categories.","woocommerce"))}},Object(m.__)("Cancel","woocommerce"))))},C=Object(g.withSpokenMessages)(e=>{const t=Object(d.useBlockProps)(),{attributes:c}=e,[o,n]=Object(r.useState)(!c.categories.length),[l,a]=Object(r.useState)({});return Object(r.createElement)("div",t,Object(r.createElement)(d.BlockControls,null,Object(r.createElement)(g.ToolbarGroup,{controls:[{icon:"edit",title:Object(m.__)("Edit selected categories","woocommerce"),onClick:()=>n(!o),isActive:o}]})),Object(r.createElement)(v,b()({isEditing:o,setChangedAttributes:a},e)),o?Object(r.createElement)(S,b()({isEditing:o,setIsEditing:n,changedAttributes:l,setChangedAttributes:a},e)):Object(r.createElement)(g.Disabled,null,Object(r.createElement)(j,e)))});Object(o.registerBlockType)(s,{icon:{src:Object(r.createElement)(l.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},attributes:{...s.attributes,...i.a},transforms:{from:[{type:"block",blocks:Object(n.without)(i.b,"woocommerce/product-category"),transform:e=>Object(o.createBlock)("woocommerce/product-category",{...e,editMode:!1})}]},edit:C,save:()=>null})},5:function(e,t){e.exports=window.wp.blockEditor},55:function(e,t){e.exports=window.wp.serverSideRender},56:function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),l=c(1),a=c(35),s=c(97),i=c(3),u=c(10),b=c(25),d=c(27),g=Object(u.createHigherOrderComponent)(e=>class extends n.Component{constructor(){super(...arguments),this.state={error:null,loading:!1,categories:[]},this.loadCategories=this.loadCategories.bind(this)}componentDidMount(){this.loadCategories()}loadCategories(){this.setState({loading:!0}),Object(b.c)().then(e=>{this.setState({categories:e,loading:!1,error:null})}).catch(async e=>{const t=await Object(d.a)(e);this.setState({categories:[],loading:!1,error:t})})}render(){const{error:t,loading:c,categories:r}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:t,isLoading:c,categories:r}))}},"withCategories"),m=c(32),p=c(4),h=c.n(p);c(89);const E=e=>{let{categories:t,error:c,isLoading:r,onChange:u,onOperatorChange:b,operator:d,selected:g,isCompact:p,isSingle:E,showReviewCount:O}=e;const j={clear:Object(l.__)("Clear all product categories","woocommerce"),list:Object(l.__)("Product Categories","woocommerce"),noItems:Object(l.__)("Your store doesn't have any product categories.","woocommerce"),search:Object(l.__)("Search for product categories","woocommerce"),selected:e=>Object(l.sprintf)(
/* translators: %d is the count of selected categories. */
Object(l._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:Object(l.__)("Category search results updated.","woocommerce")};return c?Object(n.createElement)(m.a,{error:c}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.a,{className:"woocommerce-product-categories",list:t,isLoading:r,selected:g.map(e=>t.find(t=>t.id===e)).filter(Boolean),onChange:u,renderItem:e=>{const{item:t,search:c,depth:r=0}=e,s=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,i=O?Object(l.sprintf)(
/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */
Object(l._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,"woocommerce"),s,t.review_count):Object(l.sprintf)(
/* translators: %1$s is the item name, %2$d is the count of products for the item. */
Object(l._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,"woocommerce"),s,t.count),u=O?Object(l.sprintf)(
/* translators: %d is the count of reviews. */
Object(l._n)("%d review","%d reviews",t.review_count,"woocommerce"),t.review_count):Object(l.sprintf)(
/* translators: %d is the count of products. */
Object(l._n)("%d product","%d products",t.count,"woocommerce"),t.count);return Object(n.createElement)(a.a,o()({className:h()("woocommerce-product-categories__item","has-count",{"is-searching":c.length>0,"is-skip-level":0===r&&0!==t.parent})},e,{countLabel:u,"aria-label":i}))},messages:j,isCompact:p,isHierarchical:!0,isSingle:E}),!!b&&Object(n.createElement)("div",{hidden:g.length<2},Object(n.createElement)(i.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(l.__)("Display products matching","woocommerce"),help:Object(l.__)("Pick at least two categories to use this setting.","woocommerce"),value:d,onChange:b,options:[{label:Object(l.__)("Any selected categories","woocommerce"),value:"any"},{label:Object(l.__)("All selected categories","woocommerce"),value:"all"}]})))};E.defaultProps={operator:"any",isCompact:!1,isSingle:!1},t.a=g(E)},62:function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(3);t.a=e=>{let{onChange:t,settings:c}=e;const{image:l,button:a,price:s,rating:i,title:u}=c,b=!1!==l;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(n.ToggleControl,{label:Object(o.__)("Product image","woocommerce"),checked:b,onChange:()=>t({...c,image:!b})}),Object(r.createElement)(n.ToggleControl,{label:Object(o.__)("Product title","woocommerce"),checked:u,onChange:()=>t({...c,title:!u})}),Object(r.createElement)(n.ToggleControl,{label:Object(o.__)("Product price","woocommerce"),checked:s,onChange:()=>t({...c,price:!s})}),Object(r.createElement)(n.ToggleControl,{label:Object(o.__)("Product rating","woocommerce"),checked:i,onChange:()=>t({...c,rating:!i})}),Object(r.createElement)(n.ToggleControl,{label:Object(o.__)("Add to Cart button","woocommerce"),checked:a,onChange:()=>t({...c,button:!a})}))}},63:function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(7),l=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:a,alignButtons:s,minColumns:i=1,maxColumns:u=6,minRows:b=1,maxRows:d=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(l.RangeControl,{label:Object(o.__)("Columns","woocommerce"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);a({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(l.RangeControl,{label:Object(o.__)("Rows","woocommerce"),value:c,onChange:e=>{const t=Object(n.clamp)(e,b,d);a({rows:Number.isNaN(t)?"":t})},min:b,max:d}),Object(r.createElement)(l.ToggleControl,{label:Object(o.__)("Align the last block to the bottom","woocommerce"),help:s?Object(o.__)("Align the last block to the bottom.","woocommerce"):Object(o.__)("The last inner block will follow other content.","woocommerce"),checked:s,onChange:()=>a({alignButtons:!s})}))}},7:function(e,t){e.exports=window.lodash},74:function(e,t,c){"use strict";c.d(t,"b",(function(){return o}));var r=c(2);const o=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:Object(r.getSetting)("default_columns",3)},rows:{type:"number",default:Object(r.getSetting)("default_rows",3)},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{image:!0,title:!0,price:!0,rating:!0,button:!0}},isPreview:{type:"boolean",default:!1},stockStatus:{type:"array",default:Object.keys(Object(r.getSetting)("stockStatusOptions",[]))}}},8:function(e,t){e.exports=window.wp.blocks},81:function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(2),l=c(3);const a=Object(n.getSetting)("hideOutOfStockItems",!1),s=Object(n.getSetting)("stockStatusOptions",{});t.a=e=>{let{value:t,setAttributes:c}=e;const{outofstock:n,...i}=s,u=a?i:s,b=Object.entries(u).map(e=>{let[t,c]=e;return{value:t,label:c}}).filter(e=>!!e.label),[d,g]=Object(r.useState)(t);Object(r.useEffect)(()=>{c({stockStatus:["",...d]})},[d,c]);const m=Object(r.useCallback)(e=>{const t=d.includes(e),c=d.filter(t=>t!==e);t||(c.push(e),c.sort()),g(c)},[d]);return Object(r.createElement)(r.Fragment,null,b.map(e=>{const t=d.includes(e.value)?
/* translators: %s stock status. */
Object(o.__)('Stock status "%s" visible.',"woocommerce"):
/* translators: %s stock status. */
Object(o.__)('Stock status "%s" hidden.',"woocommerce");return Object(r.createElement)(l.ToggleControl,{label:e.label,key:e.value,help:Object(o.sprintf)(t,e.label),checked:d.includes(e.value),onChange:()=>m(e.value)})}))}},89:function(e,t){},97:function(e,t,c){"use strict";c.d(t,"a",(function(){return y}));var r=c(6),o=c.n(r),n=c(0),l=c(1),a=c(3),s=c(113),i=c(508),u=c(4),b=c.n(u),d=c(10),g=c(19),m=c(35),p=c(507),h=c(14);const E=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[g,m]=Object(n.useState)(!1),O=Object(d.useInstanceId)(E);if(i=i||c,!c)return null;c=Object(h.decodeEntities)(c);const j=b()("woocommerce-tag",u,{"has-remove":!!o}),w="woocommerce-tag__label-"+O,f=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:j},r?Object(n.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>m(!0)},f):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:w},f),r&&g&&Object(n.createElement)(a.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(l.sprintf)(// Translators: %s label.
Object(l.__)("Remove %s","woocommerce"),c),"aria-describedby":w},Object(n.createElement)(s.a,{icon:p.a,size:20,className:"clear-icon"})))};var O=E;const j=e=>Object(n.createElement)(m.b,e),w=e=>{const{list:t,selected:c,renderItem:r,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(n.createElement)(w,o()({},e,{list:t.children,depth:l+1})))})):null},f=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:s,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear},Object(l.__)("Clear all","woocommerce")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(O,{label:e.name,id:e.id,remove:i})))):null)},_=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:g}=a,m=b||j;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(s.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(w,{list:t,selected:d,renderItem:m,onSelect:r,instanceId:o,isSingle:g,search:c}))},y=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:l,isSingle:s,list:i,messages:u=g.a,onChange:m,onSearch:p,selected:h,debouncedSpeak:E}=e,[O,j]=Object(n.useState)(""),w=Object(d.useInstanceId)(y),k=Object(n.useMemo)(()=>({...g.a,...u}),[u]),x=Object(n.useMemo)(()=>Object(g.c)(i,O,r),[i,O,r]);Object(n.useEffect)(()=>{E&&E(k.updated)},[E,k]),Object(n.useEffect)(()=>{"function"==typeof p&&p(O)},[O,p]);const v=Object(n.useCallback)(e=>()=>{s&&m([]);const t=h.findIndex(t=>{let{id:c}=t;return c===e});m([...h.slice(0,t),...h.slice(t+1)])},[s,h,m]),S=Object(n.useCallback)(e=>()=>{-1===h.findIndex(t=>{let{id:c}=t;return c===e.id})?m(s?[e]:[...h,e]):v(e.id)()},[s,v,m,h]);return Object(n.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(f,o()({},e,{onRemove:v,messages:k})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(a.TextControl,{label:k.search,type:"search",value:O,onChange:e=>j(e)})),l?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(a.Spinner,null)):Object(n.createElement)(_,o()({},e,{search:O,filteredList:x,messages:k,onSelect:S,instanceId:w})))};Object(a.withSpokenMessages)(y)},98:function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(3);t.a=e=>{let{value:t,setAttributes:c}=e;return Object(r.createElement)(n.SelectControl,{label:Object(o.__)("Order products by","woocommerce"),value:t,options:[{label:Object(o.__)("Newness - newest first","woocommerce"),value:"date"},{label:Object(o.__)("Price - low to high","woocommerce"),value:"price_asc"},{label:Object(o.__)("Price - high to low","woocommerce"),value:"price_desc"},{label:Object(o.__)("Rating - highest first","woocommerce"),value:"rating"},{label:Object(o.__)("Sales - most first","woocommerce"),value:"popularity"},{label:Object(o.__)("Title - alphabetical","woocommerce"),value:"title"},{label:Object(o.__)("Menu Order","woocommerce"),value:"menu_order"}],onChange:e=>c({orderby:e})})}}});