(()=>{"use strict";const e=window.wc.__experimentalInteractivity;function t(e,t,r){const a=new URL(window.location.href),{searchParams:l}=a;return e.length>0?(l.set(`filter_${t}`,e.join(",")),l.set(`query_type_${t}`,r)):(l.delete(`filter_${t}`),l.delete(`query_type_${t}`)),a.href}function r(e){return(new URL(window.location.href).searchParams.get(`filter_${e}`)||"").split(",").filter(Boolean)}(0,e.store)("woocommerce/collection-attribute-filter",{actions:{navigate:()=>{const r=(0,e.getContext)("woocommerce/interactivity-dropdown"),a=(0,e.getContext)();r.selectedItem.value&&(0,e.navigate)(t([r.selectedItem.value],a.attributeSlug,a.queryType))},updateProducts:a=>{if(!a.target.value)return;const l=(0,e.getContext)();let i=r(l.attributeSlug);a.target.checked&&!i.includes(a.target.value)?("multiple"===l.selectType&&i.push(a.target.value),"single"===l.selectType&&(i=[a.target.value])):i=i.filter((e=>e!==a.target.value)),(0,e.navigate)(t(i,l.attributeSlug,l.queryType))},removeFilter:()=>{const{attributeSlug:a,queryType:l,value:i}=(0,e.getContext)();let n=r(a);n=n.filter((e=>e!==i)),(0,e.navigate)(t(n,a,l))}}})})();