import{_ as $e}from"./Cmn_vM4N.js";import{L as O,M as Me,k as Ie,P as ie,_ as De,a as me,d as pe,m as xe,l as Ve,o as He,N as q}from"./Cfh3kXIQ.js";import{l as z,E as _,P,J as ee,Z as te,L as f,N as c,H as w,Q as S,O as R,u as i,b as le,R as $,_ as B,$ as M,U as V,F as H,V as v,c as Pe,a2 as ce,a3 as ue,t as Ke,G as We,M as Oe,a1 as Re,k as h,r as Ge}from"./DEIzhR9A.js";import{_ as Qe}from"./C5qvglTP.js";import{o as Je}from"./ArJcqVXA.js";import{u as ze}from"./wx5q-daT.js";import{u as Ye}from"./CZbE8ko0.js";import{_ as Ze}from"./DdY_a9Gh.js";import Xe from"./B_tyb2-9.js";import{u as Te}from"./DHW4fqPo.js";import{u as et}from"./DObx2S2v.js";import{b as ke}from"./BNS08PCs.js";import{o as Ee}from"./B8i0axnd.js";import tt from"./Dqvtgzyr.js";import st from"./BJFSaJwp.js";import{u as rt}from"./C_YNEQWT.js";import{u as Le}from"./AQgvJZua.js";import{u as nt}from"./-3Z1Icp3.js";const X={TOPSELLER:"topseller",DATE_NEWEST:"date_newest",PRICE_DESC:"price_desc",PRICE_ASC:"price_asc",REDUCTION_DESC:"reduction_desc",REDUCTION_ASC:"reduction_asc"},A={TOPSELLER:"topseller",DATE_NEWEST:"date-newest",PRICE_DESC:"price-desc",PRICE_ASC:"price-asc",REDUCTION_DESC:"reduction-desc",REDUCTION_ASC:"reduction-asc"},ot=e=>!!e&&e.constructor===Symbol,at=e=>!!(e&&e.constructor&&e.call&&e.apply),Se=e=>{try{return Number(e)===e}catch{return!1}},it=e=>Object.prototype.toString.call(e)==="[object Date]",lt=e=>{if(e===!0||e===!1||e==null)return!0;if(Se(e))return e===0;if(it(e))return isNaN(e.getTime());if(at(e)||ot(e))return!1;const s=e.length;if(Se(s))return s===0;const t=e.size;return Se(t)?t===0:Object.keys(e).length===0},ct=(e,s)=>e?s.reduce((t,r)=>(Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]),t),{}):{},U={topSeller:{by:O.APISortOption.Price,direction:O.APISortOrder.Descending,name:X.TOPSELLER,query:A.TOPSELLER},dateNewest:{by:O.APISortOption.DateAdded,name:X.DATE_NEWEST,query:A.DATE_NEWEST},priceDesc:{by:O.APISortOption.Price,direction:O.APISortOrder.Descending,name:X.PRICE_DESC,query:A.PRICE_DESC},priceAsc:{by:O.APISortOption.Price,direction:O.APISortOrder.Ascending,name:X.PRICE_ASC,query:A.PRICE_ASC},reductionDesc:{by:O.APISortOption.Reduction,direction:O.APISortOrder.Descending,name:X.REDUCTION_DESC,query:A.REDUCTION_DESC},reductionAsc:{by:O.APISortOption.Reduction,direction:O.APISortOrder.Ascending,name:X.REDUCTION_ASC,query:A.REDUCTION_ASC}},ut=(e=["topSeller","dateNewest","priceDesc","priceAsc","reductionDesc","reductionAsc"])=>ct(U,e),de=(e,s)=>{switch(e){case A.PRICE_DESC:return U.priceDesc;case A.PRICE_ASC:return U.priceAsc;case A.REDUCTION_DESC:return U.reductionDesc;case A.REDUCTION_ASC:return U.reductionAsc;case A.TOPSELLER:return U.topSeller;case A.DATE_NEWEST:return U.dateNewest;default:return U[s||"dateNewest"]}},dt=e=>{const s={attributes:[]};return Object.keys(e).forEach(t=>{const r=e[t];if(["sort","term"].includes(t))return;if(t==="minPrice"||t==="maxPrice"){s[t]=r;return}const o=["true","false"].includes(r)?{key:t,type:"boolean",value:r==="true"}:{key:t,type:"attributes",values:Array.isArray(e[t])?e[t]:[e[t]]};s.attributes.push(o)}),s},mt=(e,s)=>{switch(s){case O.FilterTypes.BOOLEAN:return e.name;case O.FilterTypes.RANGE:return{min:e.min,max:e.max};default:return e.id}},pt=(e,s,{sortable:t}={sortable:!0})=>{const o=(s?e.filter(n=>s.includes(n.slug)):e).reduce((n,u)=>(u.values.forEach(a=>{const l=u.type===O.FilterTypes.BOOLEAN,d="name"in a;if(l&&d&&a.name===!1)return;const b=mt(a,u.type),I=d?String(a.name):"";n.push({key:u.slug,displayName:l?u.name:I,count:a.productCount,value:b,whereCondition:{[u.slug]:b}})}),n),[]);return t?o.sort((n,u)=>n.displayName.localeCompare(u.displayName)):o},ft=e=>e.reduce((s,t)=>Object.assign(s,s[t.key]?s[t.key].push(t.value):{[t.key]:[t.value]}),{}),Ae=e=>Object.values(e).reduce((s,t)=>Object.assign(s,ft(t)),{}),qe=(e,s)=>{const t=s.key;return e[t]&&(e[t].toString()===s.value.toString()||Array.isArray(e[t])&&e[t].includes(s.value))},gt=(e,s)=>[].concat(...Object.values(e)).filter(t=>qe(s,t))||[],yt=e=>Object.entries(Me(e,s=>s.key)),Ne=e=>{const[s=0,t=1e5]=e;return{minPrice:s,maxPrice:t}},vt=(e,s,{sortable:t}={sortable:!0})=>e.reduce((r,o)=>(r[o]=pt(s,[o],{sortable:t}),r),{}),ht=e=>{if(!lt(e))return Object.assign({},...Object.entries(e).map(([s,t])=>Array.isArray(t)?{[s]:t.join(",")}:t==null?{}:{[s]:String(t)}))},_t=e=>{const s=t=>{const r=+t;return isNaN(r)?t:r};return Object.assign({},...Object.entries(e).map(([t,r])=>({[t]:typeof r=="string"&&r.includes(",")?r.split(",").map(s):s(r)})))},bt=z({__name:"SortingItemsList",props:{items:{type:Object,required:!0},selected:{type:String,default:""}},emits:["click:item"],setup(e){const s=Ie();return(t,r)=>{const o=De;return _(),P("ul",null,[(_(!0),P(ee,null,te(e.items,n=>(_(),P("li",{key:n.name},[f(o,{type:"whisper",class:R(["shrink-0 whitespace-nowrap",{"text-black":!0,"font-bold":n.name===e.selected}]),"only-exact-active":!0,to:i(s)({params:{...(t._.provides[ie]||t.$route).params},query:{...(t._.provides[ie]||t.$route).query,sort:n.query}}),onClick:u=>t.$emit("click:item",n)},{default:c(()=>[w(S(t.$t(`sorting_select.${n.name}`)),1)]),_:2},1032,["class","to","onClick"])]))),128))])}}}),St={key:0,class:"absolute z-30 w-full"},Ct=z({__name:"Menu",setup(e){const s=le(),t=le(!1),r=()=>t.value=!1,o=()=>t.value=!t.value;return Je(s,()=>r()),(n,u)=>(_(),P("div",{ref_key:"rootElement",ref:s,class:"relative"},[$(n.$slots,"default",{},()=>[$(n.$slots,"label",B(M({toggle:o}))),i(t)?(_(),P("div",St,[$(n.$slots,"menu-content",B(M({toggle:o,close:r})))])):V("",!0)])],512))}}),$t={class:"mr-7 flex w-48 items-center justify-end"},Pt=["onClick"],wt={class:"-ml-8 mt-5 min-w-48 bg-white px-8 pb-5 pt-3 shadow"},Ft=z({__name:"SortingMenu",props:{values:{type:Array,required:!0},selected:{type:String,default:""}},setup(e){const{trackFilterApply:s}=ze(),t=r=>{s("sort",r.name)};return(r,o)=>{const n=me,u=bt,a=Qe,l=Ct;return _(),H(l,null,{label:c(({toggle:d})=>[v("div",$t,[v("button",{class:"flex items-start justify-start space-x-2 whitespace-nowrap focus:outline-none",onClick:d},[f(n,{tag:"p",size:"sm","is-wide":""},{default:c(()=>[w(S(r.$t("sorting")),1)]),_:1}),f(n,{tag:"p",size:"sm",type:"loud","is-wide":""},{default:c(()=>[w(S(r.$t(`sorting_select.${e.selected}`)),1)]),_:1})],8,Pt)])]),"menu-content":c(({close:d})=>[f(a,null,{default:c(()=>[v("div",wt,[f(u,{items:e.values,selected:e.selected,class:"w-full space-y-2","onClick:item":b=>{t(b),d()}},null,8,["items","selected","onClick:item"])])]),_:2},1024)]),_:1})}}}),Ot=["topSeller","dateNewest","priceDesc","priceAsc"],kt={class:"flex w-full justify-between sm:w-auto"},Et={class:"hidden items-center justify-center sm:flex"},At={class:"order-2 flex space-x-4 sm:order-1 sm:ml-7 sm:space-x-3"},As=z({__name:"ProductListActions",emits:["click:filter","click:selected-column"],setup(e){const s=pe(),{isColumn:t}=Ye(),r=Object.values(ut(Ot)),o=le(de(s.query.sort||"").name);return Pe(()=>s.query.sort,n=>{o.value=de(n||"").name}),(n,u)=>{const a=$e,l=Ft,d=me;return _(),P("div",kt,[f(a,{class:"order-1 h-3 sm:order-2 sm:ml-7",type:"ghost",size:"sm","no-padding":"","data-test-id":"filter-toggle-button",onClick:u[0]||(u[0]=b=>n.$emit("click:filter"))},{default:c(()=>[w(S(n.$t("filter.filter")),1)]),_:1}),v("section",Et,[f(l,{values:i(r),selected:i(o)},null,8,["values","selected"])]),v("section",At,[f(d,{tag:"p",size:"sm","is-wide":""},{default:c(()=>[w(S(n.$t("view")),1)]),_:1}),(_(),P(ee,null,te(3,b=>f(a,{id:"listing-alignment",key:`columns-button-${b}`,class:R({"font-bold":i(t)(b),"h-3":!0}),size:"sm",type:"ghost","no-padding":"",onClick:I=>n.$emit("click:selected-column",b)},{default:c(()=>[v("span",{class:R({"md:hidden":b===1,"hidden md:inline":b>2})},S(b),3)]),_:2},1032,["class","onClick"])),64))])])}}}),Nt={class:"flex items-center justify-between"},It={key:0,class:"ml-6 rounded-full bg-black px-2 py-1 text-xs leading-3 text-white"},Dt={class:"mt-6"},xt=z({__name:"FilterGroup",props:{label:{type:String,default:""},resetLabel:{type:String,default:"Zurücksetzen"},badge:{type:Number,default:0},showAction:{type:Boolean,default:!1}},emits:["click:reset"],setup(e){return(s,t)=>{const r=me,o=$e;return _(),P("section",null,[v("div",Nt,[$(s.$slots,"label",{},()=>[f(r,{tag:"h4",size:"md",badge:e.badge},{badge:c(({badge:n})=>[n&&n>0?(_(),P("span",It,S(n),1)):V("",!0)]),default:c(()=>[w(S(e.label)+" ",1)]),_:1},8,["badge"])]),$(s.$slots,"action",{},()=>[ce(f(o,{size:"sm",type:"ghost",class:R(["py-0",{"opacity-0":e.badge===0}]),onClick:t[0]||(t[0]=n=>s.$emit("click:reset"))},{default:c(()=>[w(S(e.resetLabel),1)]),_:1},8,["class"]),[[ue,e.badge>0||e.showAction]])])]),v("div",Dt,[$(s.$slots,"default")])])}}}),Rt=z({__name:"MultipleSelectionList",props:{items:{type:Array,default:()=>[]},name:{type:String,required:!0},selected:{type:Array,default:()=>[]}},setup(e){const t=Ke(e,"selected"),r=a=>{o(a)?u(a):n(a)},o=a=>{var l;return(l=t.value)==null?void 0:l.some(d=>d.value===a.value)},n=a=>{t.value.push(a)},u=a=>{const l=t.value.findIndex(d=>d.value===a.value);l!==-1&&t.value.splice(l,1)};return(a,l)=>(_(),P("div",null,[$(a.$slots,"items",B(M({items:e.items,toggleItem:r,selectItem:n,deselectItem:u})),()=>[(_(!0),P(ee,null,te(e.items,d=>$(a.$slots,"item",We({ref_for:!0},{items:e.items,item:d,toggleItem:r,selectItem:n,deselectItem:u,isActive:o(d)}))),256))])]))}}),zt={class:"fixed inset-0 z-50 mt-44 overflow-hidden md:z-10 md:size-full"},Tt={key:0,class:"fixed bottom-0 z-50 size-full overflow-x-hidden overscroll-none bg-white pb-0 shadow-sm md:absolute md:bottom-auto md:right-0 md:top-0 md:h-auto md:w-1/2"},Lt={class:"sticky top-0 bg-white md:z-50"},qt={class:"sticky bottom-0 z-20 bg-white px-4 py-2 pb-10 md:z-0 md:pl-8 md:pr-5"},jt=z({__name:"SlideIn",props:{name:{type:String,required:!0}},emits:["open","close"],setup(e,{emit:s}){const t=e,r=s,{isOpen:o,toggle:n}=Te(t.name),u=xe();return Pe(o,a=>{r(a?"open":"close")}),u.beforeEach((a,l,d)=>{o.value=!1,r("close"),d()}),(a,l)=>(_(),H(Oe,{"enter-class":"opacity-0","enter-to-class":"opacity-100","enter-active-class":"transition ease-linear duration-200","leave-active-class":"transition ease-linear duration-200 delay-100","leave-class":"opacity-100","leave-to-class":"opacity-0"},{default:c(()=>[ce(v("div",zt,[v("div",{class:"fixed inset-0 z-50 inline-block opacity-50",onClick:l[0]||(l[0]=(...d)=>i(n)&&i(n)(...d))}),f(Oe,{"enter-class":"translate-y-full md:translate-y-0 md:translate-x-full","enter-to-class":"translate-y-0 md:translate-x-0","enter-active-class":"transform transition-all duration-200 delay-75","leave-active-class":"transform transition-all duration-200","leave-class":"translate-y-0 md:translate-x-0","leave-to-class":"translate-y-full md:translate-y-0 md:translate-x-full"},{default:c(()=>[i(o)?(_(),P("div",Tt,[$(a.$slots,"slideInContent",{toggle:i(n)},()=>[v("div",Lt,[$(a.$slots,"slideInHeader",{toggle:i(n)})]),$(a.$slots,"slideInBody"),v("div",qt,[$(a.$slots,"slideInActions")])])])):V("",!0)]),_:3})],512),[[ue,i(o)]])]),_:3}))}}),Ut={class:"flex w-full items-center justify-around border-b px-4 py-3 md:hidden"},Bt={class:"w-1/4"},Mt={class:"flex w-1/2 items-center justify-center"},Vt={class:"w-1/4 text-right text-xs"},Ht={class:"mt-10 grid gap-8 gap-y-10 px-5 md:grid-cols-5 md:px-8"},Kt={class:"w-full overflow-hidden"},Wt={class:"mt-2 grid grid-cols-2 gap-2 gap-y-5 md:grid-cols-1"},Gt={key:0},Qt={key:1},Jt={class:"mt-8 flex items-center justify-between space-x-4 md:hidden"},Yt={class:"mt-8 hidden space-x-4 md:block"},Ns=z({__name:"FilterSlideIn",props:{filters:{type:Array,default:()=>[]},sorting:{type:Array,default:()=>{}},activeFilters:{type:Object,default:()=>{}},isActiveFilter:{type:Function,default:()=>!1},productCount:{type:Number,default:null}},emits:["click:item","filter-state-changed","filter","reset"],setup(e,{emit:s}){function t(m){return JSON.parse(JSON.stringify(m))}const r=e,o=s,n=pe(),{filters:u,activeFilters:a}=Re(r),{toggle:l}=Te("FilterSlideIn"),d=le(!1),{trackFilterFlyout:b}=ze(),{formatCurrency:I}=et(),J=Ie(),K={brand:"selectedBrands",categoryShopFilterSizes:"selectedSizes",color:"selectedColors",prices:"selectedPrices",sale:"selectedOnlySale"},N=h(()=>vt(Object.keys(K),u.value)),D=h(()=>N.value.prices[0].value.min),F=h(()=>N.value.prices[0].value.max),x=h(()=>a.value.minPrice!==void 0&&a.value.maxPrice!==void 0?[a.value.minPrice,a.value.maxPrice]:[D.value,F.value]),Y=h(()=>de(n.query.sort||"").name),k=()=>({selectedSizes:[],selectedBrands:[],selectedColors:[],selectedPrices:x.value,selectedOnlySale:!1}),y=Ge(t(k())),T=()=>{o("filter-state-changed",{...Ae(Ee(y,["selectedPrices","selectedOnlySale"])),...oe.value&&Ne(y.selectedPrices),...y.selectedOnlySale&&{sale:!0}}),d.value=!ke(k(),t(y))};Pe(y,()=>{T()});const fe=m=>{yt(m).forEach(([E,G])=>{y[K[E]]=typeof G[0].value=="boolean"?G[0].value===!0:G})},ne=(m,C)=>{m!==void 0&&D.value&&D.value!==m&&(y.selectedPrices[0]=m),C!==void 0&&F.value&&F.value!==C&&(y.selectedPrices[1]=C)},ge=()=>{fe(gt(N.value,a.value)),ne(a.value.minPrice,a.value.maxPrice),T()},oe=h(()=>!ke(k().selectedPrices,t(y.selectedPrices))),se=()=>{o("filter",{...Ae(Ee(y,["selectedPrices","selectedOnlySale"])),...oe.value&&Ne(y.selectedPrices),...y.selectedOnlySale&&{sale:!0}}),l()},ye=[{min:0,max:3e3},{min:3e3,max:5e3},{min:5e3,max:1e4},{min:1e4,max:15e3},{min:15e3}],Z=m=>y.selectedPrices[0]===m.min,W=m=>{m==="selectedPrices"?y.selectedPrices=[D.value,F.value]:y[m]=[...k()[m]]},ae=()=>{Object.assign(y,k()),y.selectedPrices=[D.value,F.value],o("reset")},ve=m=>{Z(m)?W("selectedPrices"):(y.selectedPrices=[m.min,m.max],y.selectedOnlySale=!1)},he=()=>{ge(),b("open","true")};return(m,C)=>{const E=$e,G=me,we=De,Fe=Ze,re=xt,_e=Rt,g=Xe,j=jt;return _(),H(j,{name:"FilterSlideIn",onOpen:C[4]||(C[4]=p=>he()),onClose:C[5]||(C[5]=p=>i(b)("close","true"))},{slideInHeader:c(()=>[v("div",Ut,[v("div",Bt,[f(E,{"aria-label":"FilterSlide schließen",icon:"UiArrowLeft",type:"ghost","no-padding":"",size:"sm",onClick:i(l)},null,8,["onClick"])]),v("div",Mt,[f(G,{tag:"p",size:"md",type:"loud"},{default:c(()=>C[6]||(C[6]=[w("Filter")])),_:1})]),v("div",Vt,[f(E,{type:"ghost",size:"sm","no-padding":"",onClick:ae},{default:c(()=>[w(S(m.$t("reset")),1)]),_:1})])])]),slideInBody:c(()=>[v("div",Ht,[f(re,{label:m.$t("filter.sortBy"),class:"-mr-5 overflow-x-auto md:-mr-8 md:hidden"},{default:c(()=>[v("div",Kt,[f(Fe,{class:"pr-10"},{default:c(()=>[(_(!0),P(ee,null,te(e.sorting,p=>(_(),H(we,{key:p.name,type:"whisper",class:R(["shrink-0 whitespace-nowrap",{"mr-5 text-black":!0,"font-bold":p.name===i(Y),"order-first ml-0 ":p.by==="new"}]),"only-exact-active":!0,to:i(J)({params:{...(m._.provides[ie]||m.$route).params},query:{...(m._.provides[ie]||m.$route).query,sort:p.query}}),onClick:L=>o("click:item",p)},{default:c(()=>[w(S(m.$t("sorting_select."+p.name)),1)]),_:2},1032,["class","to","onClick"]))),128))]),_:1})])]),_:1},8,["label"]),f(re,{class:"md:col-span-2",label:m.$t("filter.colors"),"onClick:reset":C[0]||(C[0]=p=>W("selectedColors"))},{default:c(()=>[f(_e,{selected:i(y).selectedColors,items:i(N).color,class:"grid grid-cols-2 gap-4 gap-y-5",name:"FilterSelectColors"},{item:c(({item:p,toggleItem:L,isActive:Q})=>[f(E,{"text-alignment":"left","aria-label":`select color ${p.displayName}`,class:R(["items-start justify-start",{"font-bold":Q}]),"no-padding":"",type:"ghost",icon:Q?"UiCheckmark":"","icon-position":"right","icon-size":"xs",onClick:be=>L(p)},{default:c(()=>[w(S(p.displayName),1)]),_:2},1032,["aria-label","class","icon","onClick"])]),_:1},8,["selected","items"])]),_:1},8,["label"]),f(re,{class:"md:col-span-2",label:m.$t("filter.size"),"onClick:reset":C[1]||(C[1]=p=>W("selectedSizes"))},{default:c(()=>[f(_e,{selected:i(y).selectedSizes,items:i(N).categoryShopFilterSizes.slice(0,10),class:"grid grid-cols-2 gap-2 gap-y-5 md:grid-cols-3",name:"FilterSelectSize"},{item:c(({item:p,toggleItem:L,isActive:Q})=>[f(E,{"text-alignment":"left",class:R({"font-bold":Q}),"no-padding":"",type:"ghost",icon:Q?"UiCheckmark":"","icon-position":"right","icon-size":"xs",onClick:be=>L(p)},{default:c(()=>[w(S(p.displayName),1)]),_:2},1032,["class","icon","onClick"])]),_:1},8,["selected","items"])]),_:1},8,["label"]),f(re,{label:m.$t("filter.price"),"onClick:reset":C[3]||(C[3]=p=>W("selectedPrices"))},{default:c(()=>[v("div",Wt,[(_(),P(ee,null,te(ye,p=>f(E,{key:`price-range-button-${p.min}-${p.max}`,"text-alignment":"left",class:R({"font-bold":Z(p)}),"no-padding":"",type:"ghost",icon:Z(p)?"UiCheckmark":"","icon-position":"right","icon-size":"xs",onClick:L=>ve(p)},{default:c(()=>[p.min!==void 0&&p.max?(_(),P("span",Gt,S(p.min/100)+" - "+S(i(I)(p.max)),1)):p.min?(_(),P("span",Qt,S(i(I)(p.min))+" +",1)):V("",!0)]),_:2},1032,["class","icon","onClick"])),64)),f(E,{"text-alignment":"left",class:R({"font-bold":i(y).selectedOnlySale}),"no-padding":"",type:"ghost",icon:i(y).selectedOnlySale?"UiCheckmark":"","icon-position":"right","icon-size":"xs",onClick:C[2]||(C[2]=()=>{i(y).selectedOnlySale=!i(y).selectedOnlySale,W("selectedPrices")})},{default:c(()=>[w(S(m.$t("sale_only")),1)]),_:1},8,["class","icon"])])]),_:1},8,["label"])])]),slideInActions:c(()=>[v("div",Jt,[f(E,{class:"w-auto",type:"outline","data-test-id":"cancel-filter-button-slideIn",onClick:i(l)},{default:c(()=>[w(S(m.$t("cancel")),1)]),_:1},8,["onClick"]),f(E,{disabled:e.productCount===0,type:e.productCount===0?"outline":"primary","is-full-width":"","data-test-id":"apply-filter-button-slideIn",onClick:se},{default:c(()=>[v("span",null,S(e.productCount!==null&&i(d)?m.$t("show_hits",{productCount:e.productCount}):m.$t("show_result")),1)]),_:1},8,["disabled","type"])]),v("div",Yt,[f(E,{type:e.productCount===0?"outline":"primary",disabled:e.productCount===0,"data-test-id":"apply-filter-button",onClick:se},{default:c(()=>[v("span",null,S(e.productCount!==null&&i(d)?m.$t("show_hits",{productCount:e.productCount}):m.$t("show_result")),1)]),_:1},8,["type","disabled"]),v("button",{class:"inline-flex items-center space-x-1 text-sm text-gray-700","data-test-id":"cancel-filter-button",onClick:ae},[f(g,{class:"inline size-3 text-gray-700 hover:text-gray-800"}),v("span",null,S(m.$t("reset_all")),1)])])]),_:1})}}}),Zt=z({__name:"PaginationButton",props:{disabled:{type:Boolean,default:!1},isActive:{type:Boolean,default:!1},page:{type:Number,required:!0}},setup(e){const s=e,t=pe(),r=h(()=>({path:t.path,query:{...t.query,page:s.page}})),o=()=>{window.scroll({behavior:"smooth",top:0})};return(n,u)=>{const a=Ve;return _(),H(a,{to:i(r),class:R(["inline-flex items-center px-1 py-3 text-sm transition duration-200 ease-linear hover:text-shadow",{"font-bold text-black":e.isActive}]),onClick:o},{default:c(()=>[$(n.$slots,"default")]),_:3},8,["to","class"])}}}),Xt=({visiblePages:e,firstPage:s,currentPage:t,lastPage:r})=>{const o=h(()=>Array.from(Array(r.value),(l,d)=>d+1)),n=h(()=>r.value<e.value?o.value:t.value<e.value-Math.floor(e.value/2)+1?o.value.slice(0,e.value):t.value>r.value-Math.floor(e.value/2)?o.value.slice(r.value-e.value):o.value.slice(t.value-Math.ceil(e.value/2),t.value+Math.floor(e.value/2))),u=h(()=>n.value[0]),a=h(()=>n.value[n.value.length-1]);return{limitedPageNumbers:n,pageNumbersList:o,previousPage:h(()=>Math.max(t.value-1,1)),nextPage:h(()=>Math.min(t.value+1,r.value)),showFirst:h(()=>u.value>s.value),showFirstDots:h(()=>u.value>s.value+1),showLast:h(()=>a.value<r.value),showLastDots:h(()=>a.value<r.value-1),canNavigateLeft:h(()=>t.value!==s.value),canNavigateRight:h(()=>t.value!==r.value)}},es={class:"flex flex-row items-stretch justify-center space-x-2"},Is=z({__name:"Pagination",props:{firstPage:{type:Number,required:!0},currentPage:{type:Number,required:!0},lastPage:{type:Number,required:!0},visible:{type:Number,default:3}},setup(e){const s=e,{visible:t,firstPage:r,currentPage:o,lastPage:n}=Re(s),u=Xt({firstPage:r,currentPage:o,lastPage:n,visiblePages:t}),{limitedPageNumbers:a,previousPage:l,nextPage:d,showFirst:b,showFirstDots:I,showLast:J,showLastDots:K,canNavigateLeft:N,canNavigateRight:D}=u;return(F,x)=>{const Y=tt,k=Zt,y=st;return _(),P("div",es,[$(F.$slots,"previous-button",B(M({canNavigateLeft:i(N),previousPage:i(l)})),()=>[ce(f(k,{page:i(l)},{default:c(()=>[f(Y,{class:"inline-block size-2.5"})]),_:1},8,["page"]),[[ue,i(N)]])]),$(F.$slots,"first-page-button",B(M({canNavigateLeft:i(N),previousPage:i(l),showFirst:i(b)})),()=>[i(b)?(_(),H(k,{key:0,page:i(r)},{default:c(()=>[w(S(i(r)),1)]),_:1},8,["page"])):V("",!0)]),i(I)?$(F.$slots,"page-dots",{key:0},()=>[x[0]||(x[0]=v("div",{class:"p-3"},"...",-1))]):V("",!0),$(F.$slots,"page-buttons",B(M({limitedPageNumbers:i(a),currentPage:i(o)})),()=>[(_(!0),P(ee,null,te(i(a),T=>(_(),H(k,{key:T,"is-active":i(o)===T,page:T},{default:c(()=>[w(S(T),1)]),_:2},1032,["is-active","page"]))),128))]),i(K)?$(F.$slots,"page-dots",{key:1},()=>[x[1]||(x[1]=v("div",{class:"p-3"},"...",-1))]):V("",!0),$(F.$slots,"last-page-button",B(M({lastPage:i(n),showLast:i(J)})),()=>[i(J)?(_(),H(k,{key:0,page:i(n)},{default:c(()=>[w(S(i(n)),1)]),_:1},8,["page"])):V("",!0)]),$(F.$slots,"next-button",B(M({canNavigateRight:i(D),nextPage:i(d)})),()=>[ce(f(k,{page:i(d)},{default:c(()=>[f(y,{class:"inline-block size-2.5"})]),_:1},8,["page"]),[[ue,i(D)]])])])}}}),ts={},ss={class:"container mt-4 md:mt-8"};function rs(e,s){return _(),P("main",ss,[$(e.$slots,"default")])}const Ds=He(ts,[["render",rs]]);async function ns({params:e,options:s,key:t="useFilters"}={}){const{data:r,fetching:o,fetch:n,error:u,status:a}=await Le("getFilters",t,e,s);return{data:r,fetching:o,fetch:n,error:u,status:a}}async function os({params:e,options:s,key:t="useProductsCount"}={}){const{data:r,fetching:o,fetch:n,error:u,status:a}=await Le("getProductsCount",t,e,s);return{data:r,fetching:o,fetch:n,error:u,status:a}}async function xs({key:e="useFacet",params:s={initialPath:"/"}}={}){const t=q(`${e}-path`,()=>s.initialPath),r=q(`${e}-currentPage`,()=>1),o=q(`${e}-itemsPerPage`,()=>20),n=q(`${e}-whereCondition`),u=q(`${e}-sorting`),a=q(`${e}-pricePromotionKey`),l=q(`${e}-currentCacheParams`),d=q(`${e}-orFilterOperator`),b=q(`${e}-productCountWhereCondition`),[{data:I,fetch:J,fetching:K,error:N,status:D},{data:F,fetch:x,fetching:Y,error:k,status:y},{data:T,fetch:fe,fetching:ne,error:ge,status:oe},{data:se,fetch:ye,fetching:Z,error:W,status:ae}]=await Promise.all([rt({params:()=>{var g,j,p;return{path:t.value,includeHidden:((p=(j=(g=s.with)==null?void 0:g.product)==null?void 0:j.categories)==null?void 0:p.includeHidden)||void 0}},options:{autoFetch:!1},key:`${e}-categories`}),nt({params:()=>{var g;return{page:r.value,perPage:o.value,with:(g=s.with)==null?void 0:g.product,category:t.value,includeSoldOut:s.includeSoldOut,includeSellableForFree:s.includeSellableForFree,where:n.value,sort:u.value,pricePromotionKey:a.value,cache:l.value,orFiltersOperator:d.value}},options:{autoFetch:!1},key:`${e}-products`}),os({params:()=>({category:t.value,includedFilters:s.includedFilters,includeSoldOut:s.includeSoldOut,includeSellableForFree:s.includeSellableForFree,where:b.value,orFiltersOperator:d.value}),options:{autoFetch:!1},key:`${e}-productCount`}),ns({params:()=>({category:t.value,includedFilters:s.includedFilters,includeSoldOut:s.includeSoldOut,includeSellableForFree:s.includeSellableForFree,where:n.value,orFiltersOperator:d.value}),options:{autoFetch:!1},key:`${e}-filters`})]),ve=h(()=>{var g;return(g=I.value)==null?void 0:g.categories}),he=h(()=>{var g;return(g=I.value)==null?void 0:g.activeNode}),m=h(()=>{var g;return(g=F.value)==null?void 0:g.pagination}),C=h(()=>{var g;return(g=F.value)==null?void 0:g.products}),E=h(()=>{var g;return(g=se.value)==null?void 0:g.filters}),G=h(()=>{var g;return(g=se.value)==null?void 0:g.unfilteredCount});return{filters:E,filtersFetching:Z,unfilteredCount:G,filterStatus:ae,filterError:W,productCountData:T,refreshProductCount:async({where:g=void 0}={})=>{b.value=g,!ne.value&&await fe()},productCountFetching:ne,productCountError:ge,productCountStatus:oe,products:C,pagination:m,productsFetching:Y,filterProducts:async({where:g=void 0,page:j,sort:p=void 0,orFiltersOperator:L=void 0})=>{n.value=g,r.value=j,u.value=p,d.value=L,await x()},productError:k,productStatus:y,categories:ve,selectedCategory:he,categoriesFetching:K,categoriesError:N,categoriesStatus:D,fetchProducts:async({path:g,page:j=1,perPage:p=20,where:L=void 0,sort:Q=void 0,pricePromotionKey:be="",cache:Ue,orFiltersOperator:Be=void 0})=>{if(t.value=g,r.value=j,o.value=p,n.value=L,u.value=Q,a.value=be,l.value=Ue,d.value=Be,!(K.value||Y.value||Z.value))return await Promise.all([J(),x(),ye()]),!0},fetchPage:async g=>{r.value=g,await x()}}}const as=e=>!!e&&e.constructor===Symbol,is=e=>!!(e&&e.constructor&&e.call&&e.apply),Ce=e=>{try{return Number(e)===e}catch{return!1}},ls=e=>Object.prototype.toString.call(e)==="[object Date]",cs=e=>{if(e===!0||e===!1||e==null)return!0;if(Ce(e))return e===0;if(ls(e))return isNaN(e.getTime());if(is(e)||as(e))return!1;const s=e.length;if(Ce(s))return s===0;const t=e.size;return Ce(t)?t===0:Object.keys(e).length===0},je=(e,s)=>{if(Object.is(e,s))return!0;if(e instanceof Date&&s instanceof Date)return e.getTime()===s.getTime();if(e instanceof RegExp&&s instanceof RegExp)return e.toString()===s.toString();if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;const t=Reflect.ownKeys(e),r=Reflect.ownKeys(s);if(t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(!Reflect.has(s,t[o])||!je(e[t[o]],s[t[o]]))return!1;return!0},us=e=>typeof e.page=="string"?parseInt(e.page,10):void 0,ds=["page","sort","term"],Rs=(e={})=>{const s=xe(),t=pe(),r=h(()=>{const l=Object.fromEntries(Object.entries(t.query).filter(([d])=>!ds.includes(d)));return _t(l)}),o=l=>l?qe(r.value,l):cs(r.value),n=async(l,d=!0)=>{const b={sort:t.query.sort,term:t.query.term,...l?ht(l):{}};je(t.query,b)||(await s.push({query:{...b}}),d&&window.scroll({behavior:"smooth",top:0}))},u=async()=>{await s.replace({query:{term:t.query.term}})},a=()=>{var l;return{where:{...dt(r.value)},page:us(t.query),sort:de(((l=t.query)==null?void 0:l.sort)||"",e==null?void 0:e.defaultSort)}};return{activeFilters:r,applyFilters:n,isActiveFilter:o,resetFilterUrl:u,productConditions:h(()=>a())}};export{Ds as _,Rs as a,As as b,Ns as c,Is as d,ut as g,Ot as s,dt as t,xs as u};