import{_ as te}from"./lZjBw0yj.js";import{a as se,w as oe}from"./AHiYuuv4.js";import{_ as ae}from"./DNLPUXkS.js";import{_ as ne}from"./COjOF0os.js";import{l as le,k as x,b as m,w as re,u as s,E as l,P as i,V as t,J as V,Z as B,L as c,N as k,a2 as z,a5 as ie,q as ce,O as T,a3 as I,Q as n,U as H,F as j,H as $}from"./DEIzhR9A.js";import{g as J}from"./BXBuiWbS.js";import{u as de}from"./_Fx3VLSE.js";import{u as ue}from"./D0Qws29C.js";import{u as E}from"./BQkHUO2l.js";import{d as me}from"./DW-wVgF4.js";import{a as D,u as pe}from"./DrWK9Uaw.js";import"./McvZN_Cb.js";import"./VCQnWH0d.js";import"./B8i0axnd.js";import"./BNS08PCs.js";import"./CXSUenga.js";import"./BZRkhowF.js";import"./D8sTzVSg.js";import"./C4LJZt9n.js";import"./aaK5HZ8-.js";import"./nLZJejse.js";const fe={key:0,class:"w-full sm:px-5"},he={class:"w-full"},_e={class:"mb-3 mt-8 hidden justify-start space-x-2 font-bold sm:block"},ve={class:"container my-2 flex justify-start sm:hidden"},ge={class:"relative flex w-full items-center"},be={class:"absolute top-0 mt-1 flex translate-y-2"},ye={key:0,class:"grid gap-2 sm:grid-cols-2 md:grid-cols-3"},xe={class:"mb-3 mt-8 hidden justify-start space-x-2 font-bold sm:block"},ke={class:"hidden sm:block"},$e={class:"grid grid-cols-2 place-items-stretch gap-2 px-5 sm:px-0"},we={class:"sticky inset-x-0 top-0 z-50 bg-white py-3"},Se={class:"relative flex w-full items-center"},Ce={class:"absolute top-0 mt-1 flex translate-y-2"},Ve=["placeholder"],Be={class:"col-span-2 sm:col-end-7"},De={class:"my-3 w-64 border border-black object-right p-3 text-center text-xs font-bold"},Re=["href"],Ne={class:"my-8 ml-2"},ze={class:"mx-4 my-8 block md:hidden"},Te={class:"my-3 w-64 border border-black object-right p-3 text-center text-xs font-bold"},je=["href"],Ee={class:"px-5 sm:px-0"},Pe={class:"grid grid-cols-1 gap-2 sm:grid-cols-3 lg:grid-cols-4"},nt=le({name:"StoresPage",__name:"index",setup(qe){const{fetchBySlug:O,fetchByFolder:P}=de(),p=ue(),{data:f,pending:Q}=E("StorePage",()=>O("stores")),{data:w,pending:Z}=E("stores/stores",()=>P("stores/stores")),{data:S,pending:G}=E("stores/retailers",()=>P("stores/retailers",{per_page:100})),R=x(()=>S.value?D(S.value,e=>e.name):[]),N=x(()=>w.value?D(w.value,e=>e.name):[]),h=m(R.value),C=m(N.value);re(()=>{S.value&&(h.value=D(S.value,e=>e.name)),w.value&&(C.value=D(w.value,e=>e.name))});const _=m(""),d=m(!1),v=m(!0),g=m(!1),q=x(()=>{const e=h.value.map(o=>o.name.charAt(0));return pe(e)}),K=x(()=>{const e={};return q.value.forEach(o=>{e[o]=h.value.filter(r=>r.name.charAt(0)===o)}),e}),A=(e,o,r)=>{d.value=!1,e.value=[...o].filter(b=>b.name.toLowerCase().includes(r.toLowerCase())),e.value.length===0&&(d.value=!0)},F=me({delay:300},(e,o)=>{const r=o.target.value;return v.value&&e?A(C,N.value,r):A(h,R.value,r)}),W=()=>{_.value="",h.value=R.value,d.value=!1,v.value=!0,g.value=!1},X=()=>{_.value="",C.value=N.value,d.value=!1,v.value=!1,g.value=!0},Y=x(()=>Z.value||G.value||Q.value);return(e,o)=>{const r=te,b=se,L=oe,M=ae,U=ne;return s(Y)?H("",!0):(l(),i("div",fe,[t("div",he,[(l(!0),i(V,null,B(s(f).content.teaser_image,(a,y)=>(l(),j(r,{key:`store-${y}`,provider:"storyblok",class:"picture picture-contain h-6 bg-gray-200",src:a.desktop_image.filename,height:"486",loading:"lazy"},null,8,["src"]))),128))]),t("div",_e,[c(b,{size:"xs",type:"loud"},{default:k(()=>[$(n(e.$t("stores.stores_title")),1)]),_:1})]),t("div",ve,[t("label",ge,[t("span",be,[c(L,{icon:"UiSearch"})]),z(t("input",{id:"search","onUpdate:modelValue":o[0]||(o[0]=a=>ce(_)?_.value=a:null),class:"w-full border-0 border-b border-gray-500 px-5 pl-6 text-xl outline-0 ring-0 transition-colors duration-200 ease-linear focus:border-primary-500 focus:outline-none focus:ring-0 md:border-none",placeholder:"Stadt suchen",type:"text",onInput:o[1]||(o[1]=a=>s(F)(s(p).isMobile,a))},null,544),[[ie,s(_)]])]),c(M,{class:T(["px-1",{"font-bold":s(v)}]),type:"ghost",onClick:o[2]||(o[2]=a=>W())},{default:k(()=>[$(n(e.$t("stores.stores_title")),1)]),_:1},8,["class"]),c(M,{class:T(["px-1",{"font-bold":s(g)}]),type:"ghost",onClick:o[3]||(o[3]=a=>X())},{default:k(()=>[$(n(e.$t("stores.retailers_title")),1)]),_:1},8,["class"])]),z(t("div",{class:"container my-8 text-center"},n(e.$t("stores.no_result")),513),[[I,s(d)&&s(p).isMobile]]),s(v)||s(p).isDesktop?(l(),i("div",ye,[(l(!0),i(V,null,B(s(C),(a,y)=>(l(),j(U,{id:a.id,key:`store-${y}`,link:e.$helpers.route.getStoreDetailRoute(a.name),"city-name":a.content.city,address:a.content.address,"opening-hours":a.content.opening_hours,email:a.content.email,phone:a.content.phone,name:s(J)(a.content.name)||"",image:a.content.image.filename,alt:a.content.image.alt},null,8,["id","link","city-name","address","opening-hours","email","phone","name","image","alt"]))),128))])):H("",!0),o[6]||(o[6]=t("hr",{class:"hidden sm:block"},null,-1)),t("div",xe,[c(b,{size:"xs",type:"loud"},{default:k(()=>[$(n(e.$t("stores.all_retailers")),1)]),_:1})]),t("div",ke,[t("div",$e,[t("div",we,[t("label",Se,[t("span",Ce,[c(L,{icon:"UiSearch"})]),t("input",{id:"searchRetailers",class:"w-full border-0 border-b border-gray-500 px-5 pl-6 text-xl outline-0 ring-0 transition-colors duration-200 ease-linear focus:border-primary-500 focus:outline-none focus:ring-0",placeholder:e.$t("stores.search_city"),type:"text",onInput:o[4]||(o[4]=a=>s(F)(s(p).isMobile,a))},null,40,Ve)])]),t("div",Be,[t("div",De,[t("a",{href:`mailto:${s(f).content.contact_email}`},n(e.$t("stores.requests_to"))+" "+n(s(f).content.contact_email),9,Re)])])])]),z(t("div",Ne,[t("p",null,n(e.$t("stores.no_result")),1)],512),[[I,s(d)&&s(p).isDesktop]]),t("div",{class:T(["md:block",{block:s(g),hidden:!s(g)}])},[t("div",ze,[t("div",Te,[t("a",{href:`mailto:${s(f).content.contact_email}`},n(e.$t("stores.requests_to"))+" "+n(s(f).content.contact_email),9,je)])]),(l(!0),i(V,null,B(s(q),(a,y)=>(l(),i("div",{key:`alphabet-${y}`,class:"my-4"},[t("div",Ee,[c(b,{size:"md",type:"loud"},{default:k(()=>[$(n(a),1)]),_:2},1024)]),t("div",Pe,[(l(!0),i(V,null,B(s(K)[a],(u,ee)=>(l(),j(U,{key:`retailer-${ee}`,id:u.id,"city-name":u.name,address:u.content.address,"opening-hours":u.content.opening_hours,phone:u.content.phone,name:s(J)(u.content.name)||""},null,8,["id","city-name","address","opening-hours","phone","name"]))),128))]),o[5]||(o[5]=t("hr",{class:"my-8"},null,-1))]))),128))],2)]))}}});export{nt as default};