import*as e from"@wordpress/interactivity";var t={438:e=>{e.exports=import("@wordpress/interactivity-router")}},r={};function o(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const i=(m={getConfig:()=>e.getConfig,getContext:()=>e.getContext,getServerContext:()=>e.getServerContext,store:()=>e.store},v={},o.d(v,m),v),a=e=>{if("string"!=typeof e)return"";const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,t.body.textContent||""},{getContext:n,store:c,getServerContext:s,getConfig:l}=i,p="woocommerce/product-filters";var m,v;const d={state:{get params(){const{activeFilters:e}=n(),t={};function r(e,r){if(e in t&&t[e].length>0)return t[e]=`${t[e]},${r}`;t[e]=r}const o=l(p),i=o?.taxonomyParamsMap||{};return e.forEach((e=>{const{type:o,value:a}=e;if(a){if("price"===o){const[e,r]=a.split("|");e&&(t.min_price=e),r&&(t.max_price=r)}if("status"===o&&r("filter_stock_status",a),"rating"===o&&r("rating_filter",a),o.includes("attribute")){const[,i]=o.split("/");r(`filter_${i}`,a),t[`query_type_${i}`]=e.attributeQueryType||"or"}if(o.includes("taxonomy")){const[,e]=o.split("/");r(i[e],a)}}})),t},get activeFilters(){const{activeFilters:e}=n();return e.filter((e=>!!e.value)).sort(((e,t)=>e.activeLabel.toLowerCase().localeCompare(t.activeLabel.toLowerCase()))).map((e=>({...e,activeLabel:a(e.activeLabel),uid:`${e.type}/${e.value}`})))},get isFilterSelected(){const{activeFilters:e,item:t}=n();return e.some((e=>e.type===t.type&&e.value===t.value))}},actions:{openOverlay:()=>{if(n().isOverlayOpened=!0,document.getElementById("wpadminbar")){const e=(document.documentElement||document.body.parentNode||document.body).scrollTop;document.body.style.setProperty("--adminbar-mobile-padding",`max(calc(var(--wp-admin--admin-bar--height) - ${e}px), 0px)`)}},closeOverlay:()=>{n().isOverlayOpened=!1},closeOverlayOnEscape:e=>{n().isOverlayOpened&&"Escape"===e.key&&y.closeOverlay()},removeActiveFiltersBy:e=>{const t=n();t.activeFilters=t.activeFilters.filter((t=>!e(t)))},toggleFilter:()=>{u.isFilterSelected?function(){const{item:e}=n();y.removeActiveFiltersBy((t=>t.type===e.type&&t.value===e.value))}():function(){const e=n(),t={value:e.item.value,type:e.item.type,attributeQueryType:e.item.attributeQueryType,activeLabel:e.activeLabelTemplate.replace("{{label}}",e.item?.ariaLabel||e.item.label)},r=e.activeFilters.filter((e=>!(e.value===t.value&&e.type===t.type)));r.push(t),e.activeFilters=r}(),y.navigate()},*navigate(){const e=s?s():n(),t=l(p).canonicalUrl,r=new URL(t),{searchParams:i}=r;for(const t in e.params)i.delete(t);for(const e in u.params){const t=u.params[e];let r=t;try{r=decodeURIComponent(t)}catch(t){t instanceof URIError&&console.warn("woocommerce/product-filters: Failed to decode filter parameter",e,t)}i.set(e,r)}if(window.location.href===r.href)return;const a=l("woocommerce"),c=l(p),m=a?.isBlockTheme||!1,v=c?.isProductArchive||!1;if(a?.needsRefreshForInteractivityAPI||!m&&v)return window.location.href=r.href;const d=yield Promise.resolve().then(o.bind(o,438));yield d.actions.navigate(r.href)}},callbacks:{scrollLimit:()=>{const{isOverlayOpened:e}=n();document.body.style.overflow=e?"hidden":"auto"}}},{state:u,actions:y}=c(p,d);