1import{c as he,r as d,j as e,u as H,p as le,q as ie,L as F,v as xe,w as fe,x as J,y as E,z as Q,G as ce,I as de,J as be,M as te,l as ae,T as pe,C as ge,K as we,Q as ve,R as je,U as Ne,V as ye,X as ke,W as Ce,Y as Se,Z as ze,_ as Pe,$ as _e,a0 as Te,P as Me,a1 as Ee}from"./index-FR1rPNJ-.js";import{S as Ie,R as Le}from"./RozvozProgress-B3Dd26sp.js";import{h as $e,g as De,a as Re,b as Oe,c as Ae,f as re,d as Ke}from"./formatPrice-DuE3TaGz.js";import{S as Fe}from"./shopping-bag-t_QGfwwk.js";import{L as Be,P as Ue}from"./plus-cL9z8Kw5.js";import{C as ne}from"./calendar-days-BLaihbSb.js";import{C as Ve}from"./chevron-down-nN0wqDww.js";import{R as Ge}from"./RetryableError-BeNCxKO5.js";import{S as We}from"./sprout-D0KYms1v.js";/** 2 * @license lucide-react v0.563.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ze=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Ye=he("gift",Ze);function qe(s){const r=new Map;s.forEach(t=>r.set(t.id,{...t,children:[]}));const a=[];return r.forEach(t=>{const o=t.parent_category_id??null,l=o?r.get(o):null;l?l.children.push(t):a.push(t)}),a}const He=({categories:s,activeCategory:r,onSelect:a,allLabel:t})=>{const o=d.useMemo(()=>qe(s),[s]),l=d.useMemo(()=>r?o.find(n=>n.handle===r||n.children.some(h=>h.handle===r))??null:null,[o,r]),b=(l==null?void 0:l.children)??[],i=n=>`shrink-0 px-4 py-2 rounded-full text-sm transition-colors ${n?"bg-warm-900 text-white":"bg-warm-200 text-warm-700 hover:bg-warm-300"}`,m=n=>`shrink-0 px-3 py-1.5 rounded-full text-xs transition-colors ${n?"bg-warm-900 text-white":"bg-white border border-warm-300 text-warm-700 hover:border-warm-900"}`;return e.jsxs("div",{className:"lg:hidden mb-6 -mx-6",children:[e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2 px-6 scroll-px-6 scrollbar-hide",children:[e.jsx("button",{type:"button",onClick:()=>a(null),className:i(r===null),children:t}),o.map(n=>{const h=r===n.handle||n.children.some(x=>x.handle===r);return e.jsx("button",{type:"button",onClick:()=>a(n.handle),className:i(h),children:n.name},n.id)})]}),b.length>0?e.jsx("div",{className:"flex gap-2 overflow-x-auto pt-1 pb-2 px-6 scroll-px-6 scrollbar-hide",children:b.map(n=>e.jsx("button",{type:"button",onClick:()=>a(n.handle),className:m(r===n.handle),children:n.name},n.id))}):null]})};function oe(s,r){return s.filter(a=>{var t;return(t=a.categories)==null?void 0:t.some(o=>o.handle===r)}).length}function Xe(s){const r=new Map;s.forEach(t=>r.set(t.id,{...t,children:[]}));const a=[];return r.forEach(t=>{const o=t.parent_category_id??null,l=o?r.get(o):null;l?l.children.push(t):a.push(t)}),a}const Je=({categories:s,products:r,activeCategory:a,onSelect:t,allLabel:o,title:l})=>{const{t:b}=H(),i=d.useMemo(()=>Xe(s),[s]),m=n=>{const h=oe(r,n.handle),x=a===n.handle,w=n.children.some(v=>v.handle===a),f=!x&&w;return e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>t(n.handle),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${x?"bg-warm-900 text-white font-medium":f?"text-warm-900 font-medium bg-warm-50":"text-warm-700 hover:bg-warm-100"}`,children:[n.name," (",h,")"]}),n.children.length>0&&e.jsx("ul",{className:"space-y-0.5 mt-1 ml-3 pl-3 border-l border-warm-200",children:n.children.map(v=>{const C=oe(r,v.handle),z=a===v.handle;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>t(v.handle),className:`w-full text-left px-2.5 py-1.5 rounded-md text-xs transition-colors ${z?"bg-warm-900 text-white font-medium":"text-warm-600 hover:bg-warm-100 hover:text-warm-900"}`,children:[v.name," (",C,")"]})},v.id)})})]},n.id)};return e.jsxs("aside",{className:"hidden lg:block w-56 shrink-0",children:[e.jsx("h3",{className:"font-display text-lg text-warm-900 mb-4",children:l}),e.jsx("nav",{"aria-label":b.a11y.shopCategoriesNav,children:e.jsxs("ul",{className:"space-y-1",children:[e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>t(null),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${a===null?"bg-warm-900 text-white font-medium":"text-warm-700 hover:bg-warm-100"}`,children:[o," (",r.length,")"]})}),i.map(n=>m(n))]})})]})},Qe=(s,r)=>
6s.toLocaleString(r==="cs"?"cs-CZ":"en-US",{maximumFractionDigits:3}),es=({product:s,language:r,isAdding:a,addToCartLabel:t,addingLabel:o,chooseLabel:l,priceFromLabel:b,weightInCartKg:i=0,shortage:m=!1,onAddToCart:n,onPrewarm:h})=>{var p,I,$,M,B,D,U,R,O,V,G,W;const x=le(s)||m&&ie(s),w=$e(s),f=w?De(s):null,v=((I=(p=s.variants)==null?void 0:p[0])==null?void 0:I.weight)??s.weight,C=Re(s,r),z=Oe(s,r),P=Ae(s,r),S=((B=(M=($=s.variants)==null?void 0:$[0])==null?void 0:M.metadata)==null?void 0:B.pos_unit)==="kg",_=S?`${P.current}/kg`:P.current,T=Number((R=(U=(D=s.variants)==null?void 0:D[0])==null?void 0:U.metadata)==null?void 0:R.weight_max_kg)||10,L=S&&i>0,g=S&&i>=T,j=!((V=(O=s.variants)==null?void 0:O[0])!=null&&V.id)||a||g;return e.jsxs("article",{className:"group",children:[e.jsxs("div",{className:"relative mb-3",children:[e.jsx(F,{to:`/shop/${s.handle}`,className:"block aspect-square bg-warm-100 rounded-2xl overflow-hidden",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.title,className:`w-full h-full object-cover transition-transform duration-700 group-hover:scale-105 ${x?"grayscale opacity-[0.55]":""}`,loading:"lazy"}):e.jsx("div",{className:`w-full h-full flex items-center justify-center text-warm-500 ${x?"opacity-[0.55]":""}`,children:e.jsx(Fe,{size:32})})}),e.jsx(xe,{product:s,language:r,shortage:m}),L?e.jsxs("span",{className:"absolute bottom-3 left-3 rounded-full bg-warm-900/90 text-white text-xs font-semibold px-3 py-1.5 shadow-md",children:[Qe(i,r)," kg"]}):null,x?null:w?e.jsx(F,{to:`/shop/${s.handle}`,"aria-label":`${l}: ${((W=(G=s.options)==null?void 0:G[0])==null?void 0:W.title)??""}`,className:"absolute bottom-3 right-3 w-11 h-11 rounded-full bg-warm-900 text-white shadow-md hover:bg-berry-red transition-colors flex items-center justify-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-warm-900",children:e.jsx(fe,{className:"w-5 h-5","aria-hidden":"true"})}):e.jsx("button",{type:"button",onClick:()=>n(s),onMouseEnter:h,onFocus:h,onPointerDown:h,disabled:j,"aria-label":a?o:t,className:"absolute bottom-3 right-3 w-11 h-11 rounded-full bg-berry-red text-white shadow-md hover:bg-warm-900 transition-colors flex items-center justify-center focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-berry-red disabled:opacity-60 disabled:cursor-not-allowed",children:a?e.jsx(Be,{className:"w-5 h-5 animate-spin","aria-hidden":"true"}):e.jsx(Ue,{className:"w-5 h-5","aria-hidden":"true"})})]}),e.jsxs(F,{to:`/shop/${s.handle}`,className:"block px-1 space-y-1",children:[e.jsx("p",{className:"font-display text-lg font-semibold flex items-baseline gap-2",children:x?e.jsx("span",{className:"text-warm-500",children:_}):w&&f?e.jsx("span",{className:"text-warm-900",children:f.sameForAll?re(f.min,f.currency,r):`${b} ${re(f.min,f.currency,r)}`}):P.isOnSale?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-berry-red",children:_}),e.jsx("span",{className:"text-sm text-warm-500 font-normal line-through",children:P.original})]}):e.jsx("span",{className:"text-warm-900",children:_})}),e.jsx("h2",{className:`text-sm leading-snug line-clamp-2 ${x?"text-warm-500":"text-warm-900"}`,children:s.title}),(()=>{var y;if(S)return null;const c=Ke(s,(y=s.variants)==null?void 0:y[0])??(!w&&v?`${v} g`:""),N=z??(w?null:C);return!c&&!N?null:e.jsxs("div",{className:"flex items-baseline justify-between text-xs text-warm-500",children:[e.jsx("span",{children:c}),e.jsx("span",{children:N??""})]})})()]})]})},ee="bs_rozvoz_psc",ss=()=>{try{const s=window.localStorage.getItem(ee);return s&&/^\d{5}$/.test(s)?s:""}catch{return""}},ts=s=>{try{window.localStorage.setItem(ee,s)}catch{}},as=()=>{try{window.localStorage.removeItem(ee)}catch{}},rs=s=>s.length===5?`${s.slice(0,3)} ${s.slice(3)}`:s,Y=({icon:s,title:r,sub:a,iconClassName:t})=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:`shrink-0 w-9 h-9 rounded-full grid place-items-center ${t??"bg-white text-success-700"}`,children:s}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-sm text-warm-900",children:r}),e.jsx("div",{className:"text-xs text-warm-600",children:a})]})]}),ns=()=>{const{t:s,language:r}=H(),a=s.rozvozBand,[t,o]=d.useState(null),[l,b]=d.useState(""),[i,m]=d.useState("idle"),[n,h]=d.useState(()=>
6ss()),[x,w]=d.useState(!1),f=(t==null?void 0:t.off_season)??!1,v=J(t);d.useEffect(()=>{if(!E)return;let g=!1;return Q().then(j=>{g||o(j)}).catch(j=>{ce(j)&&j.code==="network"||de(j,{source:"RozvozInfoBand",extra:{fallback:"static_zone"}})}),()=>{g=!0}},[]);const C=t&&t.area_postal_codes.length>0?t.area_postal_codes:void 0,z=d.useMemo(()=>{const g=(t==null?void 0:t.threshold_czk)??1e3;return new Intl.NumberFormat(r==="cs"?"cs-CZ":"en-US",{style:"currency",currency:"CZK",maximumFractionDigits:0}).format(g)},[t==null?void 0:t.threshold_czk,r]),P=d.useMemo(()=>{const g=(t==null?void 0:t.delivery_dates)??[];if(g.length===0)return"";const j=be(new Date,30,g).slice(0,3);if(j.length===0)return"";const p=new Intl.DateTimeFormat(r==="cs"?"cs-CZ":"en-US",{weekday:"short",day:"numeric",month:"numeric"});return j.map(I=>p.format(I)).join(" · ")},[t==null?void 0:t.delivery_dates,r]),S=a.summaryLine.replace("{amount}",z);if(f)return e.jsxs("div",{className:"bg-success-50 border border-success-100 rounded-xl px-4 py-3 mb-6 flex items-center gap-2 text-sm text-warm-700",children:[e.jsx(ne,{className:"w-4 h-4 shrink-0 text-success-700","aria-hidden":"true"}),e.jsx("span",{children:s.rozvozOffSeason.bandLine})]});const _=g=>{if(g.preventDefault(),!ve(l)){m("invalid");return}je(l,C)?(ts(Ne(l)),m("ok")):m("no")},T=()=>{as(),h(""),m("idle"),b("")},L=i==="ok"?a.checkOk:i==="no"?a.checkNo:i==="invalid"?a.checkInvalid:"";return n?e.jsxs("div",{className:"bg-success-50 border border-success-100 rounded-xl px-4 py-3 mb-6 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 font-semibold text-success-800",children:[e.jsx(te,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}),a.confirmedPrefix," (",rs(n),")",e.jsx(ae,{className:"w-4 h-4 shrink-0 text-success-700","aria-hidden":"true"})]}),e.jsx("span",{className:"text-warm-600",children:S}),e.jsx("button",{type:"button",onClick:T,className:"ml-auto underline text-warm-600 hover:text-warm-900 transition-colors",children:a.change})]}):e.jsxs("div",{className:"bg-success-50 border border-success-100 rounded-xl p-4 mb-6",children:[e.jsxs("button",{type:"button",onClick:()=>w(g=>!g),"aria-expanded":x,"aria-controls":"rozvoz-band-details",className:"sm:hidden w-full flex items-center justify-between text-left text-sm font-medium text-success-800",children:[e.jsx("span",{children:S}),e.jsx(Ve,{className:`w-4 h-4 shrink-0 transition-transform ${x?"rotate-180":""}`,"aria-hidden":"true"})]}),e.jsxs("div",{id:"rozvoz-band-details",className:`${x?"block":"hidden"} sm:block mt-4 sm:mt-0`,children:[e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(Y,{icon:e.jsx(te,{className:"w-4 h-4","aria-hidden":"true"}),title:a.fact1Title,sub:a.fact1Sub}),e.jsx(Y,{icon:e.jsx(ne,{className:"w-4 h-4","aria-hidden":"true"}),title:a.fact2Title,sub:P||(v?a.fact2SubShortage:a.fact2Sub)}),e.jsx(Y,{icon:e.jsx(Ye,{className:"w-4 h-4","aria-hidden":"true"}),title:a.fact3Title.replace("{amount}",z),sub:a.fact3Sub}),e.jsx(Y,{icon:e.jsx(pe,{className:"w-4 h-4","aria-hidden":"true"}),iconClassName:"bg-berry-red text-white",title:a.fact4Title,sub:a.fact4Sub})]}),e.jsxs("p",{className:"mt-4 flex items-start gap-2 text-xs text-warm-600",children:[e.jsx(ge,{className:"w-3.5 h-3.5 shrink-0 mt-0.5 text-berry-red","aria-hidden":"true"}),e.jsx("span",{children:a.timeNote})]}),e.jsxs("form",{onSubmit:_,className:"mt-4 pt-4 border-t border-success-100 flex flex-wrap items-center gap-3",children:[e.jsx("label",{htmlFor:"rozvoz-band-psc",className:"text-sm font-semibold text-warm-900",children:a.checkerLabel}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:"rozvoz-band-psc",type:"text",inputMode:"numeric",autoComplete:"postal-code",value:l,onChange:g=>{b(g.target.value),m("idle")},placeholder:a.placeholder,className:"w-32 px-3 py-1.5 rounded-md border border-warm-300 text-sm focus:outline-none focus:border-success-500 transition"}),e.jsx("button",{type:"submit",className:"px-4 py-1.5 rounded-md bg-berry-red text-white text-sm font-semibold hover:bg-danger-700 transition focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-berry-red",children:a.checkButton})]}),e.jsx("span",{"aria-live":"polite",className:"text-sm font-medium min-h-[1.25rem]",children:i!=="idle"?e.jsxs("span",{className:`inline-flex items-center gap-1.5 ${i==="ok"?"text-success-700":i==="no"?"text-danger-700":"text-warning-700"}`,children:[i==="ok"?e.jsx(ae,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):i==="no"?e.jsx(we,{className:"w-4 h-4 shrink-0","aria-hidden":"true"}):null,L]}):null}),e.jsx(F,{to:"/#rozvoz",className:"ml-auto inline-flex items-center gap-1 text-sm text-success-700 hover:text-success-800 underline",children:a.moreLink})]})]})]})},me={shortage:"bs_rozvoz_nodates_dismissed",offseason:"bs_rozvoz_offseason_dismissed"},os=s=>{try{return window.sessionStorage.getItem(me[s])==="1"}catch{return!1}},ls=s=>{try{window.sessionStorage.setItem(me[s],"1")}catch{}},is=()=>{const{t:s}=H(),[r,a]=d.useState(null),t=d.useRef(null);d.useEffect(()=>{if(!E)return;let m=!1;return Q().then(n=>{if(m)return;let h=null;n.off_season?h="offseason":J(n)&&(h="shortage"),h&&!os(h)&&a(h)}).catch(()=>{}),()=>{m=!0}},[]);const o=r!==null;d.useEffect(()=>{const m=t.current;m&&(o?m.open||m.showModal():m.open&&m.close())},[o]);const l=()=>{r&&ls(r),a(null)},b=m=>{m.target===t.current&&l()},i=r==="offseason"?{title:s.rozvozOffSeason.popupTitle,body:s.rozvozOffSeason.popupBody,note:s.rozvozOffSeason.popupNote,close:s.rozvozOffSeason.popupClose}:{title:s.rozvozNoDates.title,body:s.rozvozNoDates.body,note:s.rozvozNoDates.note,close:s.rozvozNoDates.close};return o?e.jsx("dialog",{ref:t,onClick:b,onClose:l,className:"backdrop:bg-warm-900/40 backdrop:backdrop-blur-sm p-0 rounded-2xl shadow-xl border-0 max-w-md w-full mx-auto overflow-hidden bg-berry-red text-cream","aria-labelledby":"rozvoz-nodates-title",children:e.jsxs("div",{className:"relative p-6 sm:p-8",children:[e.jsx("img",{src:"/photos/jahoda_black.svg",alt:"","aria-hidden":"true",draggable:!1,style:{transform:"rotate(-14deg)"},className:"pointer-events-none select-none absolute -right-12 -top-10 w-52 max-w-none opacity-[0.12] invert"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-cream text-berry-red shrink-0",children:e.jsx(ye,{className:"w-5 h-5","aria-hidden":"true"})}),e.jsx("button",{type:"button",onClick:l,"aria-label":i.close,className:"shrink-0 w-8 h-8 flex items-center justify-center rounded-full text-cream/70 hover:text-cream hover:bg-cream/10 transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cream focus:outline-none",children:e.jsx(ke,{className:"w-4 h-4","aria-hidden":"true"})})]}),e.jsx("h2",{id:"rozvoz-nodates-title",className:"font-display font-bold uppercase text-2xl sm:text-3xl leading-[0.95] tracking-tight mb-4",children:i.title}),e.jsx("p",{className:"text-cream/85 font-light leading-relaxed mb-3",children:i.body}),e.jsx("p",{className:"text-cream/70 text-sm leading-relaxed mb-6",children:i.note}),e.jsx("button",{type:"button",onClick:l,className:"w-full inline-flex items-center justify-center px-8 py-3.5 rounded-full bg-cream text-berry-red text-sm font-medium tracking-wide hover:bg-white transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cream",children:i.close})]})]})}):null}
6,cs=[{value:"name-asc",labelKey:"sortNameAsc"},{value:"name-desc",labelKey:"sortNameDesc"},{value:"price-asc",labelKey:"sortPriceAsc"},{value:"price-desc",labelKey:"sortPriceDesc"},{value:"newest",labelKey:"sortNewest"}],ds=({value:s,onChange:r,labels:a})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{htmlFor:"shop-sort",className:"text-sm text-warm-600 shrink-0",children:[a.sortBy,":"]}),e.jsxs("select",{id:"shop-sort",value:s??"",onChange:t=>r(t.target.value||null),className:"text-sm border border-warm-200 rounded-lg px-3 py-2 bg-white text-warm-800 focus:outline-none focus:ring-2 focus:ring-warm-400",children:[e.jsx("option",{value:"",children:"-"}),cs.map(t=>e.jsx("option",{value:t.value,children:a[t.labelKey]},t.value))]})]}),ms=["name-asc","name-desc","price-asc","price-desc","newest"];function us(s){return s!==null&&ms.includes(s)}function q(s){var r,a,t;return((t=(a=(r=s.variants)==null?void 0:r[0])==null?void 0:a.calculated_price)==null?void 0:t.calculated_amount)??0}function hs(s,r){return r?s.filter(a=>{var t;return(t=a.categories)==null?void 0:t.some(o=>o.handle===r)}):s}function xs(s,r){if(!r)return s;const a=[...s];switch(r){case"name-asc":return a.sort((t,o)=>t.title.localeCompare(o.title,"cs"));case"name-desc":return a.sort((t,o)=>o.title.localeCompare(t.title,"cs"));case"price-asc":return a.sort((t,o)=>q(t)-q(o));case"price-desc":return a.sort((t,o)=>q(o)-q(t));case"newest":return a.sort((t,o)=>{const l=t.created_at??"";return(o.created_at??"").localeCompare(l)});default:return a}}function fs(s,r=!1){const a=t=>le(t)||r&&ie(t);return[...s.filter(t=>!a(t)),...s.filter(a)]}function bs(s,r=!1){const[a,t]=Ce(),o=a.get("category"),l=a.get("sort"),b=us(l)?l:null,i=d.useCallback(x=>{t(w=>{const f=new URLSearchParams(w);return x?f.set("category",x):f.delete("category"),f})},[t]),m=d.useCallback(x=>{t(w=>{const f=new URLSearchParams(w);return x?f.set("sort",x):f.delete("sort"),f})},[t]),n=d.useMemo(()=>hs(s,o),[s,o]),h=d.useMemo(()=>fs(xs(n,b),r),[n,b,r]);return{category:o,sort:b,setCategory:i,setSort:m,products:h}}const ps=.5,zs=()=>{const{language:s,t:r}=H(),{cart:a,addToCart:t,addWeightToCart:o,updateWeightInCart:l,ensureCart:b}=Se(),{showToast:i}
6=ze(),[m,n]=d.useState([]),[h,x]=d.useState([]),[w,f]=d.useState(E),[v,C]=d.useState(null),[z,P]=d.useState(0),[S,_]=d.useState(null),[T,L]=d.useState(null),g=(T==null?void 0:T.off_season)??!1,j=J(T),p=r.shopPage,I=r.seo.shop,$=Pe(m,g),{category:M,sort:B,setCategory:D,setSort:U,products:R}=bs($,j),O=u=>{var N,y,A;const c=(y=(N=u.variants)==null?void 0:N[0])==null?void 0:y.id;if(c)return(A=a==null?void 0:a.items)==null?void 0:A.find(K=>{var k;return K.variant_id===c&&((k=K.metadata)==null?void 0:k.pos_unit)==="kg"})},V=u=>{const c=O(u);return c&&Number(c.metadata.weight_kg)||0},G=async u=>{var N,y,A,K;const c=(y=(N=u.variants)==null?void 0:N[0])==null?void 0:y.id;if(!c){i(p.unavailable,"error");return}_(c);try{const k=(K=(A=u.variants)==null?void 0:A[0])==null?void 0:K.metadata;if((k==null?void 0:k.pos_unit)==="kg"){const ue=Number(k.weight_max_kg)>0?Number(k.weight_max_kg):10,Z=O(u),se=Z&&Number(Z.metadata.weight_kg)||0,X=Math.round(Math.min(ue,se+ps)*1e3)/1e3;X>se&&(Z?await l(Z.id,c,X):await o(c,X))}else await t(c,1);i(p.added,"success")}catch(k){i(Ee(k),"error")}finally{_(null)}},W=()=>{b({tolerateNetworkErrors:!0}).catch(()=>{})};return d.useEffect(()=>{if(!E)return;let u=!0;return Promise.all([_e({tolerateNetworkErrors:!0}),Te({tolerateNetworkErrors:!0})]).then(([c,N])=>{u&&(n(c),x(N),C(null))}).catch(c=>{u&&C(c)}).finally(()=>{u&&f(!1)}),()=>{u=!1}},[z]),d.useEffect(()=>{if(!E)return;let u=!1;return Q().then(c=>{u||L(c)}).catch(c=>{ce(c)&&c.code==="network"||de(c,{source:"ShopPage",extra:{fallback:"in_season"}})}),()=>{u=!0}},[]),d.useEffect(()=>{if(!E)return;const u=window.setTimeout(()=>{b({tolerateNetworkErrors:!0}).catch(()=>{})},200);return()=>{window.clearTimeout(u)}},[b]),e.jsxs("div",{className:"bg-warm-50 min-h-screen",children:[e.jsx(Me,{title:I.title,de
6scription:I.description}),e.jsxs("section",{className:"max-w-7xl mx-auto px-6 md:px-10 pt-24 md:pt-28 pb-12",children:[e.jsx(ns,{}),e.jsx(is,{}),E?null:e.jsx("div",{className:"border border-warm-200 bg-white p-8 text-warm-700 rounded-xl",children:p.notConfigured}),v?e.jsx(Ge,{error:v,onRetry:()=>{C(null),f(!0),P(u=>u+1)},className:"mb-8"}):null,w?e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 md:gap-8",children:Array.from({length:6},(u,c)=>e.jsx(Ie,{},c))}):null,!w&&E&&!v?e.jsxs(e.Fragment,{children:[e.jsx(Le,{variant:"floating"}),e.jsx(He,{categories:h,activeCategory:M,onSelect:D,allLabel:p.allCategories}),e.jsxs("div",{className:"flex gap-4 md:gap-10",children:[e.jsx(Je,{categories:h,products:$,activeCategory:M,onSelect:D,allLabel:p.allCategories,title:p.categories}),e.jsxs("div",{className:"flex-1 min-w-0",children:[M&&(M==="sazenice"||M.startsWith("sazenice-"))?e.jsxs(F,{to:"/sazenice#journey",className:"flex items-start gap-4 mb-6 p-5 rounded-2xl bg-warm-100 hover:bg-warm-200 border border-warm-200 transition-colors",children:[e.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-warm-900 text-white flex items-center justify-center",children:e.jsx(We,{className:"w-5 h-5","aria-hidden":"true"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-display text-lg text-warm-900 mb-1",children:p.sazeniceGuideTitle}),e.jsx("p",{className:"text-sm text-warm-700 mb-2",children:p.sazeniceGuideDesc}),e.jsx("span",{className:"text-sm font-semibold text-berry-red",children:p.sazeniceGuideCta})]})]}):null,e.jsx("div",{className:"flex justify-end mb-6",children:e.jsx(ds,{value:B,onChange:U,labels:p})}),R.length===0?e.jsx("p",{className:"text-warm-600 text-center py-12",children:p.noProducts}):e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 md:gap-8",children:R.map(u=>{var c,N;return e.jsx(es,{product:u,language:s,isAdding:S===((N=(c=u.variants)==null?void 0:c[0])==null?void 0:N.id),addToCartLabel:p.addToCart,addingLabel:p.adding,chooseLabel:p.chooseVariant,priceFromLabel:p.priceFrom,weightInCartKg:V(u),shortage:j,onAddToCart:y=>void G(y),onPrewarm:W},u.id)})})]})]})]}):null]})]})};export{zs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.