var wc;(()=>{"use strict";var t={};(t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})(t);const e=window.wc.__experimentalInteractivity,{state:r,actions:i}=(0,e.store)("woocommerce/product-filter-attribute",{state:{get selectedFilters(){const t=(0,e.getContext)();return((0,e.store)("woocommerce/product-filters").state.activeFilters||[]).filter((e=>{var r;return"attribute"===e.type&&(null===(r=e.attribute)||void 0===r?void 0:r.slug)===t.attributeSlug})).map((t=>t.value)).filter(Boolean)},get hasSelectedFilters(){return r.selectedFilters.length>0},get isItemSelected(){const{props:t}=(0,e.getElement)();return!!t.value&&r.selectedFilters.includes(t.value)}},actions:{getActiveLabel(t){const{activeLabelTemplate:r}=(0,e.getContext)();return r.replace("{{label}}",t)},toggleFilter:()=>{const{props:t}=(0,e.getElement)();let l=t["data-filter-item"];"string"==typeof l&&(l=JSON.parse(l));const{ariaLabel:o,value:a}=l;if(!a||!o)return;const c=(0,e.getContext)(),s=(0,e.store)("woocommerce/product-filters");r.selectedFilters.includes(a)?s.actions.removeActiveFiltersBy((t=>{var e;return t.value===a&&"attribute"===t.type&&(null===(e=t.attribute)||void 0===e?void 0:e.slug)===c.attributeSlug})):s.actions.setActiveFilter({type:"attribute",value:a,label:i.getActiveLabel(o),attribute:{slug:c.attributeSlug,queryType:"or"}}),s.actions.navigate()},clearFilters:()=>{const t=(0,e.getContext)(),r=(0,e.store)("woocommerce/product-filters");r.actions.removeActiveFiltersBy((e=>{var r;return"attribute"===e.type&&(null===(r=e.attribute)||void 0===r?void 0:r.slug)===t.attributeSlug})),r.actions.navigate()}}});(wc=void 0===wc?{}:wc)["product-filter-attribute"]=t})();