OwlCyberSecurity - MANAGER
Edit File: product-top-rated.js
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-top-rated"]=function(e){function t(t){for(var c,i,l=t[0],a=t[1],s=t[2],d=0,b=[];d<l.length;d++)i=l[d],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&b.push(o[i][0]),o[i]=0;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,s||[]),r()}function r(){for(var e,t=0;t<n.length;t++){for(var r=n[t],c=!0,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(c=!1)}c&&(n.splice(t--,1),e=i(i.s=r[0]))}return e}var c={},o={35:0},n=[];function i(t){if(c[t])return c[t].exports;var r=c[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=c,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(r,c,function(t){return e[t]}.bind(null,c));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=a;return n.push([754,0]),r()}({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.data},101:function(e,t,r){"use strict";r.d(t,"b",(function(){return o}));var c=r(3);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(c.getSetting)("default_columns",3)},rows:{type:"number",default:Object(c.getSetting)("default_rows",3)},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},isPreview:{type:"boolean",default:!1}}},11:function(e,t){e.exports=window.wp.apiFetch},115:function(e,t){},116:function(e,t){e.exports=window.wp.coreData},12:function(e,t){e.exports=window.wp.compose},124:function(e,t){},13:function(e,t){e.exports=window.wp.url},14:function(e,t){e.exports=window.wp.blocks},172:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var c=r(0);const o=Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(c.createElement)("title",null,"Grid Block Preview"),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(c.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(c.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},18:function(e,t){e.exports=window.wp.primitives},20:function(e,t){e.exports=window.wp.htmlEntities},21:function(e,t){e.exports=window.moment},3:function(e,t){e.exports=window.wc.wcSettings},30:function(e,t){e.exports=window.wp.dataControls},32:function(e,t,r){"use strict";r.d(t,"o",(function(){return n})),r.d(t,"m",(function(){return i})),r.d(t,"l",(function(){return l})),r.d(t,"n",(function(){return a})),r.d(t,"j",(function(){return s})),r.d(t,"e",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return g})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return h})),r.d(t,"h",(function(){return w})),r.d(t,"a",(function(){return E})),r.d(t,"i",(function(){return m})),r.d(t,"b",(function(){return O}));var c,o=r(3);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=n.pluginUrl+"images/",l=n.pluginUrl+"build/",a=n.buildPhase,s=null===(c=o.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,g=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),p=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),h=o.STORE_PAGES.cart.permalink,w=(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",{}),m=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},34:function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return u})),r.d(t,"b",(function(){return d})),r.d(t,"i",(function(){return b})),r.d(t,"f",(function(){return g})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return h})),r.d(t,"g",(function(){return w})),r.d(t,"a",(function(){return E}));var c=r(13),o=r(11),n=r.n(o),i=r(6),l=r(3),a=r(32);const s=e=>{let{selected:t=[],search:r="",queryArgs:o={}}=e;const l=(e=>{let{selected:t=[],search:r="",queryArgs:o={}}=e;const n=a.o.productCount>100,i={per_page:n?100:0,catalog_visibility:"any",search:r,orderby:"title",order:"asc"},l=[Object(c.addQueryArgs)("/wc/store/products",{...i,...o})];return n&&t.length&&l.push(Object(c.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:t,per_page:0})),l})({selected:t,search:r,queryArgs:o});return Promise.all(l.map(e=>n()({path:e}))).then(e=>Object(i.uniqBy)(Object(i.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/products/"+e}),d=()=>n()({path:"wc/store/products/attributes"}),b=e=>n()({path:`wc/store/products/attributes/${e}/terms`}),g=e=>{let{selected:t=[],search:r}=e;const o=(e=>{let{selected:t=[],search:r}=e;const o=Object(l.getSetting)("limitTags",!1),n=[Object(c.addQueryArgs)("wc/store/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:r})];return o&&t.length&&n.push(Object(c.addQueryArgs)("wc/store/products/tags",{include:t})),n})({selected:t,search:r});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(i.uniqBy)(Object(i.flatten)(e),"id"))},p=e=>n()({path:Object(c.addQueryArgs)("wc/store/products/categories",{per_page:0,...e})}),h=e=>n()({path:"wc/store/products/categories/"+e}),w=e=>n()({path:Object(c.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})}),E=(e,t)=>{if(!e.title.raw)return e.slug;const r=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(r?"":" - "+e.slug)}},35:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return n}));var c=r(1);const o=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"}},n=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?void 0:e.message)||Object(c.__)("Something went wrong. Please contact us to get assistance.",'woocommerce')}},38:function(e,t){e.exports=window.wp.keycodes},39:function(e,t){e.exports=window.wp.escapeHtml},4:function(e,t){e.exports=window.wp.components},41:function(e,t,r){"use strict";var c=r(0),o=r(1),n=r(39);t.a=e=>{let{error:t}=e;return Object(c.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(c.createElement)("span",null,Object(o.__)("The following error was returned",'woocommerce'),Object(c.createElement)("br",null),Object(c.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===r?Object(c.createElement)("span",null,Object(o.__)("The following error was returned from the API",'woocommerce'),Object(c.createElement)("br",null),Object(c.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'woocommerce')})(t))}},45:function(e,t){e.exports=window.wp.hooks},51:function(e,t){e.exports=window.wp.deprecated},55:function(e,t,r){"use strict";var c=r(0);t.a=function(e){let{srcElement:t,size:r=24,...o}=e;return Object(c.isValidElement)(t)?Object(c.cloneElement)(t,{width:r,height:r,...o}):null}},6:function(e,t){e.exports=window.lodash},61:function(e,t){e.exports=window.wp.dom},64:function(e,t){e.exports=window.regeneratorRuntime},754:function(e,t,r){e.exports=r(868)},76:function(e,t){e.exports=window.wp.serverSideRender},79:function(e,t){e.exports=window.ReactDOM},8:function(e,t){e.exports=window.React},82:function(e,t){e.exports=window.wp.viewport},84:function(e,t,r){"use strict";var c=r(0),o=r(1),n=(r(2),r(4));t.a=e=>{let{onChange:t,settings:r}=e;const{button:i,price:l,rating:a,title:s}=r;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(n.ToggleControl,{label:Object(o.__)("Product title",'woocommerce'),help:s?Object(o.__)("Product title is visible.",'woocommerce'):Object(o.__)("Product title is hidden.",'woocommerce'),checked:s,onChange:()=>t({...r,title:!s})}),Object(c.createElement)(n.ToggleControl,{label:Object(o.__)("Product price",'woocommerce'),help:l?Object(o.__)("Product price is visible.",'woocommerce'):Object(o.__)("Product price is hidden.",'woocommerce'),checked:l,onChange:()=>t({...r,price:!l})}),Object(c.createElement)(n.ToggleControl,{label:Object(o.__)("Product rating",'woocommerce'),help:a?Object(o.__)("Product rating is visible.",'woocommerce'):Object(o.__)("Product rating is hidden.",'woocommerce'),checked:a,onChange:()=>t({...r,rating:!a})}),Object(c.createElement)(n.ToggleControl,{label:Object(o.__)("Add to Cart button",'woocommerce'),help:i?Object(o.__)("Add to Cart button is visible.",'woocommerce'):Object(o.__)("Add to Cart button is hidden.",'woocommerce'),checked:i,onChange:()=>t({...r,button:!i})}))}},85:function(e,t,r){"use strict";var c=r(0),o=r(1),n=r(6),i=(r(2),r(4));t.a=e=>{let{columns:t,rows:r,setAttributes:l,alignButtons:a,minColumns:s=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(i.RangeControl,{label:Object(o.__)("Columns",'woocommerce'),value:t,onChange:e=>{const t=Object(n.clamp)(e,s,u);l({columns:Number.isNaN(t)?"":t})},min:s,max:u}),Object(c.createElement)(i.RangeControl,{label:Object(o.__)("Rows",'woocommerce'),value:r,onChange:e=>{const t=Object(n.clamp)(e,d,b);l({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(c.createElement)(i.ToggleControl,{label:Object(o.__)("Align Last Block",'woocommerce'),help:a?Object(o.__)("The last inner block will be aligned vertically.",'woocommerce'):Object(o.__)("The last inner block will follow other content.",'woocommerce'),checked:a,onChange:()=>l({alignButtons:!a})}))}},868:function(e,t,r){"use strict";r.r(t);var c=r(0),o=r(1),n=r(14),i=r(55),l=r(18),a=Object(c.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{opacity:".87",fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M21 8h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2zm0 4l-3 7H9V9l4.34-4.34L12.23 10H21v2zM1 9h4v12H1z"})),s=r(6),u=r(4),d=r(9),b=r(76),g=r.n(b),p=(r(2),r(84)),h=r(85),w=r(90),E=r(172),m=r(3);class O extends c.Component{getInspectorControls(){const{attributes:e,setAttributes:t}=this.props,{categories:r,catOperator:n,columns:i,contentVisibility:l,rows:a,alignButtons:s}=e;return Object(c.createElement)(d.InspectorControls,{key:"inspector"},Object(c.createElement)(u.PanelBody,{title:Object(o.__)("Layout",'woocommerce'),initialOpen:!0},Object(c.createElement)(h.a,{columns:i,rows:a,alignButtons:s,setAttributes:t,minColumns:Object(m.getSetting)("min_columns",1),maxColumns:Object(m.getSetting)("max_columns",6),minRows:Object(m.getSetting)("min_rows",1),maxRows:Object(m.getSetting)("max_rows",6)})),Object(c.createElement)(u.PanelBody,{title:Object(o.__)("Content",'woocommerce'),initialOpen:!0},Object(c.createElement)(p.a,{settings:l,onChange:e=>t({contentVisibility:e})})),Object(c.createElement)(u.PanelBody,{title:Object(o.__)("Filter by Product Category",'woocommerce'),initialOpen:!1},Object(c.createElement)(w.a,{selected:r,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const r=e.map(e=>{let{id:t}=e;return t});t({categories:r})},operator:n,onOperatorChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t({catOperator:e})}})))}render(){const{name:e,attributes:t}=this.props;return t.isPreview?E.a:Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(u.Disabled,null,Object(c.createElement)(g.a,{block:e,attributes:t})))}}var f=O,j=r(101);Object(n.registerBlockType)("woocommerce/product-top-rated",{title:Object(o.__)("Top Rated Products",'woocommerce'),icon:{src:Object(c.createElement)(i.a,{srcElement:a}),foreground:"#7f54b3"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Display a grid of your top rated products.",'woocommerce'),supports:{align:["wide","full"],html:!1},example:{attributes:{isPreview:!0}},attributes:{...j.a},transforms:{from:[{type:"block",blocks:Object(s.without)(j.b,"woocommerce/product-top-rated"),transform:e=>Object(n.createBlock)("woocommerce/product-top-rated",e)}]},edit:e=>Object(c.createElement)(f,e),save:()=>null})},89:function(e,t){e.exports=window.wp.date},9:function(e,t){e.exports=window.wp.blockEditor},90:function(e,t,r){"use strict";var c=r(7),o=r.n(c),n=r(0),i=r(1),l=(r(2),r(40)),a=r(4),s=r(12),u=r(34),d=r(35),b=Object(s.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(u.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:r,categories:c}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:t,isLoading:r,categories:c}))}},"withCategories"),g=r(41),p=r(5),h=r.n(p);r(124);const w=e=>{let{categories:t,error:r,isLoading:c,onChange:s,onOperatorChange:u,operator:d,selected:b,isCompact:p,isSingle:w,showReviewCount:E}=e;const m={clear:Object(i.__)("Clear all product categories",'woocommerce'),list:Object(i.__)("Product Categories",'woocommerce'),noItems:Object(i.__)("Your store doesn't have any product categories.",'woocommerce'),search:Object(i.__)("Search for product categories",'woocommerce'),selected:e=>Object(i.sprintf)( /* translators: %d is the count of selected categories. */ Object(i._n)("%d category selected","%d categories selected",e,'woocommerce'),e),updated:Object(i.__)("Category search results updated.",'woocommerce')};return r?Object(n.createElement)(g.a,{error:r}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(l.b,{className:"woocommerce-product-categories",list:t,isLoading:c,selected:b.map(e=>t.find(t=>t.id===e)).filter(Boolean),onChange:s,renderItem:e=>{const{item:t,search:r,depth:c=0}=e,a=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,s=E?Object(i.sprintf)( /* translators: %1$s is the item name, %2$d is the count of reviews for the item. */ Object(i._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,'woocommerce'),a,t.review_count):Object(i.sprintf)( /* translators: %1$s is the item name, %2$d is the count of products for the item. */ Object(i._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,'woocommerce'),a,t.count),u=E?Object(i.sprintf)( /* translators: %d is the count of reviews. */ Object(i._n)("%d review","%d reviews",t.review_count,'woocommerce'),t.review_count):Object(i.sprintf)( /* translators: %d is the count of products. */ Object(i._n)("%d product","%d products",t.count,'woocommerce'),t.count);return Object(n.createElement)(l.c,o()({className:h()("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===c&&0!==t.parent})},e,{countLabel:u,"aria-label":s}))},messages:m,isCompact:p,isHierarchical:!0,isSingle:w}),!!u&&Object(n.createElement)("div",{hidden:b.length<2},Object(n.createElement)(a.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(i.__)("Display products matching",'woocommerce'),help:Object(i.__)("Pick at least two categories to use this setting.",'woocommerce'),value:d,onChange:u,options:[{label:Object(i.__)("Any selected categories",'woocommerce'),value:"any"},{label:Object(i.__)("All selected categories",'woocommerce'),value:"all"}]})))};w.defaultProps={operator:"any",isCompact:!1,isSingle:!1},t.a=b(w)}});