this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(r,l)&&r[l]&&d.push(r[l][0]),r[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,i||[]),c()}function c(){for(var e,t=0;t<o.length;t++){for(var c=o[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==r[s]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},r={9:0,1:0,2:0},o=[];function l(t){if(n[t])return n[t].exports;var c=n[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=n,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 n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));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 o.push([406,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},104:function(e,t,c){"use strict";var n=c(0),r=c(1),o=c(30);c(236),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,Number.isFinite(c)&&Object(n.createElement)(o.a,{label:c.toString(),screenReaderLabel:Object(r.sprintf)(
/* translators: %s number of products. */
Object(r._n)("%s product","%s products",c,"woocommerce"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},106:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(8);function r(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},11:function(e,t){e.exports=window.wp.primitives},118:function(e,t,c){"use strict";var n=c(0),r=c(5),o=c(10),l=c(1);c(153),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:o,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woocommerce")),Object(n.createElement)(r.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},119:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},121:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const r=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},122:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(18),r=c(9),o=c(0),l=c(48),a=c(121);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(r.useSelect)(e=>{if(!u)return null;const r=e(n.COLLECTIONS_STORE_KEY),o=[t,c,d,m],l=r.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},13:function(e,t){e.exports=window.wp.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},142:function(e,t,c){"use strict";var n=c(0),r=c(1),o=c(4),l=c.n(o),a=c(30);c(183),t.a=e=>{let{className:t,disabled:c,label:
/* translators: Submit button text for filters. */
o=Object(r.__)("Go","woocommerce"),onClick:s,screenReaderLabel:i=Object(r.__)("Apply filter","woocommerce")}=e;return Object(n.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:c,onClick:s},Object(n.createElement)(a.a,{label:o,screenReaderLabel:i}))}},153:function(e,t){},154:function(e,t){},16:function(e,t){e.exports=window.wp.url},163:function(e,t,c){"use strict";c.d(t,"b",(function(){return r})),c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return l}));var n=c(16);const r="query_type_",o="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}},167:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));var n=c(7);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===c.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(r)))return;const a=l.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const l=e.filter(e=>e.attribute!==c.taxonomy);return 0===r.length?t(l):(l.push({attribute:c.taxonomy,operator:o,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wc.wcBlocksData},183:function(e,t){},192:function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return l}));var n=c(2);const r=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return c.id&&e.push(c),e},[]),o=e=>{if(e)return r.find(t=>t.id===e)},l=e=>{if(e)return r.find(t=>t.taxonomy===e)}},193:function(e,t,c){"use strict";var n=c(0),r=c(1),o=c(4),l=c.n(o);c(237),t.a=e=>{let{className:t,onChange:c=(()=>{}),options:o=[],checked:a=[],isLoading:s=!1,isDisabled:i=!1,limit:u=10}=e;const[b,d]=Object(n.useState)(!1),m=Object(n.useMemo)(()=>[...Array(5)].map((e,t)=>Object(n.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),p=Object(n.useMemo)(()=>{const e=o.length-u;return!b&&Object(n.createElement)("li",{key:"show-more",className:"show-more"},Object(n.createElement)("button",{onClick:()=>{d(!0)},"aria-expanded":!1,"aria-label":Object(r.sprintf)(
/* translators: %s is referring the remaining count of options */
Object(r._n)("Show %s more option","Show %s more options",e,"woocommerce"),e)},Object(r.sprintf)(
/* translators: %s number of options to reveal. */
Object(r._n)("Show %s more","Show %s more",e,"woocommerce"),e)))},[o,u,b]),g=Object(n.useMemo)(()=>b&&Object(n.createElement)("li",{key:"show-less",className:"show-less"},Object(n.createElement)("button",{onClick:()=>{d(!1)},"aria-expanded":!0,"aria-label":Object(r.__)("Show less options","woocommerce")},Object(r.__)("Show less","woocommerce"))),[b]),O=Object(n.useMemo)(()=>{const e=o.length>u+5;return Object(n.createElement)(n.Fragment,null,o.map((t,r)=>Object(n.createElement)(n.Fragment,{key:t.value},Object(n.createElement)("li",e&&!b&&r>=u&&{hidden:!0},Object(n.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{c(e.target.value)},checked:a.includes(t.value),disabled:i}),Object(n.createElement)("label",{htmlFor:t.value},t.label)),e&&r===u-1&&p)),e&&g)},[o,c,a,b,u,g,p,i]),j=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(n.createElement)("ul",{className:j},s?m:O)}},2:function(e,t){e.exports=window.wc.wcSettings},202:function(e,t,c){"use strict";var n=c(6),r=c.n(n),o=c(0),l=c(4),a=c.n(l),s=c(1),i=c(110),u=c(541);c(154);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=n,d=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(o.createElement)(b,r()({className:d},u),Object(o.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(o.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:d=!1,text:m,screenReaderText:p="",...g}=e;const O=d?"span":"button";if(!t){const e=p&&"string"==typeof p?p:m;t="string"!=typeof e?
/* translators: Remove chip. */
Object(s.__)("Remove","woocommerce"):Object(s.sprintf)(
/* translators: %s text of the chip to remove. */
Object(s.__)('Remove "%s"',"woocommerce"),e)}const j={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},h=d?j:{},f=d?{"aria-hidden":!0}:j;return Object(o.createElement)(b,r()({},g,h,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},f),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},21: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 n=c(0),r=c(7),o=c(1);const l={clear:Object(o.__)("Clear all selected items","woocommerce"),noItems:Object(o.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:Object(o.__)("No results for %s","woocommerce"),search:Object(o.__)("Search for items","woocommerce"),selected:e=>Object(o.sprintf)(
/* translators: Number of items selected from list. */
Object(o._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:Object(o.__)("Search results updated.","woocommerce")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(r.groupBy)(e,"parent"),n=Object(r.keyBy)(t,"id"),o=["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(n[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(n[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;o.includes(t)||s.push(...a(c||[]))}),s},s=(e,t,c)=>{if(!t)return c?a(e):e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(r,e):r},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(n.createElement)(n.Fragment,{key:c},Object(n.createElement)("strong",null,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()},235:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},236:function(e,t){},237:function(e,t){},24:function(e,t,c){"use strict";c.d(t,"o",(function(){return o})),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 m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return f}));var n,r=c(2);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(n=r.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,m=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),p=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),j=Object(r.getSetting)("allowedCountries",{}),h=Object(r.getSetting)("shippingStates",{}),f=Object(r.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},285:function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var n=c(0),r=c(265),o=c(7),l=c(48),a=c(76),s=c(122),i=c(49);const u=e=>{let{queryAttribute:t,queryPrices:c,queryStock:u,queryState:b}=e,d=Object(i.a)();d+="-collection-data";const[m]=Object(a.a)(d),[p,g]=Object(a.b)("calculate_attribute_counts",[],d),[O,j]=Object(a.b)("calculate_price_range",null,d),[h,f]=Object(a.b)("calculate_stock_status_counts",null,d),w=Object(l.a)(t||{}),_=Object(l.a)(c),v=Object(l.a)(u);Object(n.useEffect)(()=>{"object"==typeof w&&Object.keys(w).length&&(p.find(e=>e.taxonomy===w.taxonomy)||g([...p,w]))},[w,p,g]),Object(n.useEffect)(()=>{O!==_&&void 0!==_&&j(_)},[_,j,O]),Object(n.useEffect)(()=>{h!==v&&void 0!==v&&f(v)},[v,f,h]);const[y,k]=Object(n.useState)(!1),[E]=Object(r.a)(y,200);y||k(!0);const S=Object(n.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:c}=e;return{taxonomy:t,query_type:c}}),["taxonomy","query_type"])),t})(m),[m]);return Object(s.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...b,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...S},shouldSelect:E})}},3:function(e,t){e.exports=window.wp.components},30:function(e,t,c){"use strict";var n=c(0),r=c(4),o=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=r;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,r)):(t=l||n.Fragment,s&&i&&c!==r?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},r)):Object(n.createElement)(t,a,c))}},34:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var n=c(6),r=c.n(n),o=c(0),l=c(21);const a=e=>{let{countLabel:t,className:c,depth:n=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+n),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=m.name||"search-list-item-"+a,h=`${j}-${s.id}`;return Object(o.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(o.createElement)("input",r()({type:"radio",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",r()({type:"checkbox",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},406:function(e,t,c){e.exports=c(477)},407:function(e,t){},408:function(e,t){},409:function(e,t){},43:function(e,t,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return b})),c.d(t,"a",(function(){return d}));var n=c(5),r=c(71),o=c(119),l=c(57),a=c(91);const s=e=>Object(o.a)(e)?JSON.parse(e)||{}:Object(l.a)(e)?e:{},i=e=>{if(!Object(r.b)()||!Object(a.a)())return{style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(l.a)(e)?e:{},c=s(t.style),n=Object(l.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}},b=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalUseColorProps)({...t,style:c})},d=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalUseBorderProps)({...t,style:c})}},44:function(e,t){e.exports=window.wp.a11y},477:function(e,t,c){"use strict";c.r(t);var n=c(6),r=c.n(n),o=c(0),l=c(1),a=c(13),s=c(5),i=c(71),u=c(110),b=c(524),d=c(4),m=c.n(d),p=c(223),g=c(96),O=c(7),j=c(2),h=c(99),f=c(118),w=c(3),_=c(44),v=c(48),y=c(106),k=c(76),E=c(122),S=c(285),C=c(193),x=c(170),N=e=>{let{checked:t,getInputProps:c,inputRef:n,isDisabled:r,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(o.createElement)("input",c({ref:n,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:r,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},P=e=>{let{children:t,onClick:c}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:c},t)},T=e=>{let{checked:t,getItemProps:c,getMenuProps:n,highlightedIndex:r,options:a}=e;return Object(o.createElement)("ul",n({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,n)=>{const a=t.includes(e.value);return Object(o.createElement)("li",c({key:e.value,className:m()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":r===n}),index:n,item:e.value,"aria-label":a?Object(l.sprintf)(
/* translators: %s is referring to the filter option being removed. */
Object(l.__)("Remove %s filter","woocommerce"),e.name):null}),e.label)}))},R=c(202),I=e=>{let{onRemoveItem:t,option:c}=e;return Object(o.createElement)(R.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(c.value)},ariaLabel:Object(l.sprintf)(
/* translators: %s is referring to the filter option being removed. */
Object(l.__)("Remove %s filter","woocommerce"),c.name),text:c.label,radius:"large"})},A=c(541),L=e=>{let{onClick:t,onRemoveItem:c,option:n}=e;const r=Object(o.useRef)(null);return Object(o.useEffect)(()=>{r.current.focus()},[r]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:r,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(n.value)},"aria-label":Object(l.sprintf)(
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
Object(l.__)("Replace current %s filter","woocommerce"),n.name)},n.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{c(n.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c(n.value)},"aria-label":Object(l.sprintf)(
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
Object(l.__)("Remove %s filter","woocommerce"),n.name)},Object(o.createElement)(u.a,{icon:A.a,size:16})))};c(409);var B=e=>{let{attributeLabel:t="",className:c,style:n={},checked:r=[],inputLabel:a="",isDisabled:s=!1,isLoading:i=!1,multiple:u=!1,onChange:b=(()=>{}),options:d=[],isCaseSensitive:p=!1}=e;const g=Object(o.useRef)(null),O=m()(c,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":i}),j=Object(o.useCallback)((e,t)=>{switch(t.type){case x.a.stateChangeTypes.keyDownEnter:case x.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case x.a.stateChangeTypes.blurInput:case x.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(x.a,{onChange:b,selectedItem:null,stateReducer:j},e=>{let{getInputProps:c,getItemProps:i,getLabelProps:j,getMenuProps:h,highlightedIndex:f,inputValue:w,isOpen:_,openMenu:v}=e;return Object(o.createElement)("div",{className:m()(O,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":_}),style:n},Object(o.createElement)("label",j({className:"screen-reader-text"}),a),Object(o.createElement)(P,{isOpen:_,onClick:()=>g.current.focus()},r.map(e=>{const t=d.find(t=>t.value===e);if(!t)return null;const c=e=>{b(e),g.current.focus()};return u?Object(o.createElement)(I,{key:e,onRemoveItem:c,option:t}):Object(o.createElement)(L,{key:e,onClick:()=>g.current.focus(),onRemoveItem:c,option:t})}),Object(o.createElement)(N,{checked:r,getInputProps:c,inputRef:g,isDisabled:s,onFocus:v,onRemoveItem:e=>{b(e),g.current.focus()},placeholder:r.length>0&&u?null:Object(l.sprintf)(
/* translators: %s attribute name. */
Object(l.__)("Any %s","woocommerce"),t),tabIndex:!u&&r.length>0?"-1":"0",value:w})),_&&!s&&Object(o.createElement)(T,{checked:r,getItemProps:i,getMenuProps:h,highlightedIndex:f,options:d.filter(e=>{let t=e.name,c=null==w?void 0:w.trim();var n;return p||(t=t.toLowerCase(),c=null===(n=c)||void 0===n?void 0:n.toLowerCase()),!c||t.includes(c)})}))})},F=c(104),M=c(142),V=c(25),q=c.n(V),H=c(14),D=c(16),G=c(235),z=c(119),Q=c(163),$=c(192),U=c(167);const Y=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(F.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(F.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(F.a,{name:"Red",count:2})}],K={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var W=c(43);c(408);const J=e=>e.replace("pa_",""),X=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const c={};t.forEach(e=>{const{attribute:t,slug:n,operator:r}=e,o=J(t),l=n.join(","),a=`${Q.b}${o}`,s="in"===r?"or":"and";c[`${Q.a}${o}`]=l,c[a]=s});const n=Object(D.removeQueryArgs)(e,...Object.keys(c));return Object(D.addQueryArgs)(n,c)},Z=(e,t)=>{if(e&&t){const e=Object(Q.c)("filter_"+t.name);return"string"==typeof e?e.split(","):[]}return[]},ee=(e,t)=>{const c=Object.entries(t).reduce((e,t)=>{let[c,n]=t;return c.includes("query_type")?e:{...e,[c]:n}},{});return Object.entries(c).reduce((t,c)=>{let[n,r]=c;return e[n]===r&&t},!0)};var te=e=>{let{attributes:t,isEditor:c=!1}=e;const n=Object(j.getSettingWithCoercion)("has_filterable_products",!1,G.a),r=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,G.a),a=Object(j.getSettingWithCoercion)("page_url",window.location.href,z.a),[s,i]=Object(o.useState)(!1),u=t.isPreview&&!t.attributeId?K:Object($.a)(t.attributeId),[b,d]=Object(o.useState)(Z(r,u)),[p,g]=Object(o.useState)(t.isPreview&&!t.attributeId?Y:[]),O=Object(W.a)(t),[h]=Object(k.a)(),[f,x]=Object(k.b)("attributes",[]),{results:N,isLoading:P}=Object(E.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==u?void 0:u.id)||0],shouldSelect:t.attributeId>0}),T="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:R,isLoading:I}=Object(S.a)({queryAttribute:{taxonomy:null==u?void 0:u.taxonomy,queryType:t.queryType},queryState:{...h,attributes:T?h.attributes:null}}),A=Object(o.useCallback)(e=>R.attribute_counts?R.attribute_counts.find(t=>{let{term:c}=t;return c===e}):null,[R]);Object(o.useEffect)(()=>{if(P||I)return;const e=N.map(e=>{const c=A(e.id);if(!(c||b.includes(e.slug)||(n=e.slug,null!=h&&h.attributes&&h.attributes.some(e=>{let{attribute:t,slug:c=[]}=e;return t===u.taxonomy&&c.includes(n)}))))return null;var n;const r=c?c.count:0;return{value:e.slug,name:Object(H.decodeEntities)(e.name),label:Object(o.createElement)(F.a,{name:Object(H.decodeEntities)(e.name),count:t.showCounts?r:null})}}).filter(Boolean);g(e)},[null==u?void 0:u.taxonomy,N,P,t.showCounts,I,A,b,h.attributes]);const L=Object(o.useCallback)(e=>N.reduce((t,c)=>(e.includes(c.slug)&&t.push(c),t),[]),[N]),V=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){const t=Object.keys(Object(D.getQueryArgs)(window.location.href)),c=J(null==u?void 0:u.taxonomy),n=t.reduce((e,t)=>t.includes(Q.b+c)||t.includes(Q.a+c)?Object(D.removeQueryArgs)(e,t):e,window.location.href),r=X(n,e);window.location.href=r}else{const t=X(a,e),c=Object(D.getQueryArgs)(window.location.href),n=Object(D.getQueryArgs)(t);ee(c,n)||(window.location.href=t)}}),[a,null==u?void 0:u.taxonomy]),te=Object(o.useCallback)(e=>{c||(d(e),t.showFilterButton||Object(U.b)(f,x,u,L(e),"or"===t.queryType?"in":"and"))},[c,d,f,x,u,L,t.queryType,t.showFilterButton]),ce=Object(o.useMemo)(()=>f.filter(e=>{let{attribute:t}=e;return t===(null==u?void 0:u.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[f,null==u?void 0:u.taxonomy]),ne=Object(v.a)(ce),re=Object(y.a)(ne);Object(o.useEffect)(()=>{q()(re,ne)||q()(b,ne)||te(ne)},[b,ne,re,te]);const oe="dropdown"!==t.displayStyle||"or"===t.queryType,le=Object(o.useCallback)(e=>{const t=e=>{const{name:t}=p.find(t=>t.value===e);return t},c=e=>{let{filterAdded:c,filterRemoved:n}=e;const r=c?t(c):null,o=n?t(n):null;r&&o?Object(_.speak)(Object(l.sprintf)(
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
Object(l.__)("%1$s filter replaced with %2$s.","woocommerce"),r,o)):r?Object(_.speak)(Object(l.sprintf)(
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
Object(l.__)("%s filter added.","woocommerce"),r)):o&&Object(_.speak)(Object(l.sprintf)(
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
Object(l.__)("%s filter removed.","woocommerce"),o))},n=b.includes(e);let r;oe?(r=b.filter(t=>t!==e),n?c({filterRemoved:e}):(r.push(e),r.sort(),c({filterAdded:e}))):(r=n?[]:[e],c({filterAdded:n?null:e,filterRemoved:1===b.length?b[0]:null})),te(r)},[b,p,oe,te]);if(Object(o.useEffect)(()=>{r&&u&&((e=>{let{currentCheckedFilters:t,hasSetPhpFilterDefaults:c}=e;return c&&0===t.length})({currentCheckedFilters:b,hasSetPhpFilterDefaults:s})&&(t.showFilterButton||(d([]),V(f,!0))),t.showFilterButton||(d(b),V(f,!1)))},[s,V,r,f,u,b,t.showFilterButton]),Object(o.useEffect)(()=>{if(r){const e=Z(r,u);e.length>0&&!s&&!P&&(i(!0),te(e))}},[u,r,s,P,te]),!n)return null;if(!u)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woocommerce"))):null;if(0===p.length&&!P)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woocommerce"))):null;const ae="h"+t.headingLevel,se=!t.isPreview&&P,ie=!t.isPreview&&I;return Object(o.createElement)(o.Fragment,null,!c&&t.heading&&p.length>0&&Object(o.createElement)(ae,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(B,{attributeLabel:u.label,checked:b,className:m()("wc-block-attribute-filter-dropdown",O.className),style:{...O.style,borderStyle:"none"},inputLabel:t.heading,isLoading:se,multiple:oe,onChange:le,options:p}):Object(o.createElement)(C.a,{className:"wc-block-attribute-filter-list",options:p,checked:b,onChange:le,isLoading:se,isDisabled:ie}),t.showFilterButton&&Object(o.createElement)(M.a,{className:"wc-block-attribute-filter__button",disabled:se||ie,onClick:()=>(e=>{const c=Object(U.b)(f,x,u,L(e),"or"===t.queryType?"in":"and");r&&V(c,0===e.length)})(b)})))};c(407);const ce=Object(j.getSetting)("attributes",[]);var ne=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c,debouncedSpeak:n}=e;const{attributeId:r,className:a,displayStyle:i,heading:d,headingLevel:_,isPreview:v,queryType:y,showCounts:k,showFilterButton:E}=t,[S,C]=Object(o.useState)(!r&&!v),x=Object(s.useBlockProps)(),N=e=>{if(!e||!e.length)return;const t=e[0].id,n=ce.find(e=>e.attribute_id===t.toString());if(!n||r===t)return;const o=n.attribute_label;c({attributeId:t,heading:Object(l.sprintf)(
/* translators: %s attribute name. */
Object(l.__)("Filter by %s","woocommerce"),o)})},P=e=>{let{isCompact:t}=e;const c={clear:Object(l.__)("Clear selected attribute","woocommerce"),list:Object(l.__)("Product Attributes","woocommerce"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woocommerce"),search:Object(l.__)("Search for a product attribute:","woocommerce"),selected:e=>Object(l.sprintf)(
/* translators: %d is the number of attributes selected. */
Object(l._n)("%d attribute selected","%d attributes selected",e,"woocommerce"),e),updated:Object(l.__)("Product attribute search results updated.","woocommerce")},n=Object(O.sortBy)(Object(O.toArray)(Object(O.mapValues)(ce,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===r}),onChange:N,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(ce).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woocommerce"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woocommerce")},Object(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woocommerce")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woocommerce")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woocommerce"))):Object(o.createElement)("div",x,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woocommerce"),onClick:()=>C(!S),isActive:S}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content","woocommerce")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Product count","woocommerce"),help:k?Object(l.__)("Product count is visible.","woocommerce"):Object(l.__)("Product count is hidden.","woocommerce"),checked:k,onChange:()=>c({showCounts:!k})}),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woocommerce")),Object(o.createElement)(h.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:_,onChange:e=>c({headingLevel:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Block Settings","woocommerce")},Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Query Type","woocommerce"),help:"and"===y?Object(l.__)("Products that have all of the selected attributes will be shown.","woocommerce"):Object(l.__)("Products that have any of the selected attributes will be shown.","woocommerce"),value:y,onChange:e=>c({queryType:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("And","woocommerce")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Or","woocommerce")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woocommerce"),value:i,onChange:e=>c({displayStyle:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woocommerce")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woocommerce")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Filter button","woocommerce"),help:E?Object(l.__)("Products will only update when the button is pressed.","woocommerce"):Object(l.__)("Products will update as options are selected.","woocommerce"),checked:E,onChange:e=>c({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woocommerce"),initialOpen:!1},P({isCompact:!0}))),S?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woocommerce"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woocommerce")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},P({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{C(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woocommerce"))}},Object(l.__)("Done","woocommerce")))):Object(o.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(o.createElement)(f.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:d,onChange:e=>c({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(te,{attributes:t,isEditor:!0}))))});Object(a.registerBlockType)("woocommerce/attribute-filter",{apiVersion:2,title:Object(l.__)("Filter Products by Attribute","woocommerce"),icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woocommerce")],description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woocommerce"),supports:{html:!1,color:{text:!0,background:!1},...Object(i.b)()&&{__experimentalBorder:{radius:!0,color:!0,width:!1}}},example:{attributes:{isPreview:!0}},attributes:{attributeId:{type:"number",default:0},showCounts:{type:"boolean",default:!0},queryType:{type:"string",default:"or"},heading:{type:"string",default:Object(l.__)("Filter by attribute","woocommerce")},headingLevel:{type:"number",default:3},displayStyle:{type:"string",default:"list"},showFilterButton:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:c}=e;return"woocommerce_layered_nav"===t&&!(null==c||!c.raw)},transform:e=>{var t,c,n;let{instance:r}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==r||null===(t=r.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==r||null===(c=r.raw)||void 0===c?void 0:c.title)||Object(l.__)("Filter by attribute","woocommerce"),headingLevel:3,displayStyle:(null==r||null===(n=r.raw)||void 0===n?void 0:n.display_type)||"list",showFilterButton:!1,isPreview:!1})}}]},edit:ne,save(e){let{attributes:t}=e;const{className:c,showCounts:n,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d}=t,p={"data-attribute-id":a,"data-show-counts":n,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(p["data-display-style"]=b),d&&(p["data-show-filter-button"]=d),Object(o.createElement)("div",r()({},s.useBlockProps.save({className:m()("is-loading",c)}),p),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),r=c(25),o=c.n(r);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},49:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);const r=Object(n.createContext)("page"),o=()=>Object(n.useContext)(r);r.Provider},5:function(e,t){e.exports=window.wp.blockEditor},57:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return r}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function r(e,t){return n(e)&&t in e}},7:function(e,t){e.exports=window.lodash},71:function(e,t,c){"use strict";c.d(t,"c",(function(){return o})),c.d(t,"d",(function(){return l})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var n=c(13),r=c(24);const o=(e,t)=>{if(r.n>2)return Object(n.registerBlockType)(e,t)},l=(e,t)=>{if(r.n>1)return Object(n.registerBlockType)(e,t)},a=()=>r.n>2,s=()=>r.n>1},76:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var n=c(18),r=c(9),o=c(0),l=c(25),a=c.n(l),s=c(48),i=c(106),u=c(49);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(r.useSelect)(r=>r(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,r]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(r(Object.assign({},l,d)),p.current=!0)},[l,d,m,r]),p.current?[n,r]:[e,r]}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.data},91:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(5);const r=()=>"function"==typeof n.__experimentalGetSpacingClassesAndStyles},96:function(e,t,c){"use strict";c.d(t,"a",(function(){return y}));var n=c(6),r=c.n(n),o=c(0),l=c(1),a=c(3),s=c(110),i=c(518),u=c(4),b=c.n(u),d=c(10),m=c(21),p=c(34),g=c(517),O=c(14);const j=e=>{let{id:t,label:c,popoverContents:n,remove:r,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),h=Object(d.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const f=b()("woocommerce-tag",u,{"has-remove":!!r}),w="woocommerce-tag__label-"+h,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},c));return Object(o.createElement)("span",{className:f},n?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),n&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},n),r&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(l.sprintf)(// Translators: %s label.
Object(l.__)("Remove %s","woocommerce"),c),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const f=e=>Object(o.createElement)(p.b,e),w=e=>{const{list:t,selected:c,renderItem:n,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:c,selected:n,messages:r,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woocommerce")):null),u>0?Object(o.createElement)("ul",null,n.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||f;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:r,isSingle:m,search:c}))},y=e=>{const{className:t="",isCompact:c,isHierarchical:n,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,f]=Object(o.useState)(""),w=Object(d.useInstanceId)(y),k=Object(o.useMemo)(()=>({...m.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(m.c)(i,h,n),[i,h,n]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.search,type:"search",value:h,onChange:e=>f(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(v,r()({},e,{search:h,filteredList:E,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(y)},99:function(e,t,c){"use strict";var n=c(0),r=c(7),o=c(1),l=c(3),a=c(11);function s(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(n.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(a.Path,{d:c[t]})):null}class i extends n.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(n.createElement)(s,{level:e}),title:Object(o.sprintf)(
/* translators: %s: heading level e.g: "2", "3", "4" */
Object(o.__)("Heading %d","woocommerce"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:o}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,o,a))})}}t.a=i}});