1import{j as e}from"./framework-CylTApPL.js";import{w as P}from"./platform-admin-B68s7nel.js";import{A as z,m as p}from"./motion-CRJ1cyci.js";import{X as A,aB as O,Z as V,w as M}from"./icons-Co2KhvIg.js";function E({item:t,optionGroups:a,variants:x=[],isOpen:o,onClose:d,onAddToCart:w,initialQuantity:h=1,initialSelectedOptions:N=[]}){const{selectedOptions:m,quantity:c,setQuantity:b,invalidGroupIds:g,hasVariants:f,selectedVariantId:y,effectiveBasePrice:v,visibleGroups:j,selectVariant:k,handleOptionToggle:C,isOptionSelected:$,validateSelections:_,calculateTotal:F,submit:S}=P({basePrice:Number(t.price),optionGroups:a,variants:x,isOpen:o,initialQuantity:h,initialSelectedOptions:N}),I=()=>{S(w)&&d()};return e.jsx(z,{children:o&&e.jsxs(e.Fragment,{children:[e.jsx(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:d,className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-[100]"}),e.jsxs(p.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed inset-x-0 bottom-0 z-[100] bg-[#1a1a1a] rounded-t-3xl border-t border-white/10 shadow-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsx("div",{className:"p-6 border-b border-white/10 flex-shrink-0",children:e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.is_veg?e.jsx("div",{className:"w-5 h-5 border-2 border-green-500 rounded flex items-center justify-center flex-shrink-0",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})}):e.jsx("div",{className:"w-5 h-5 border-2 border-red-500 rounded flex items-center justify-center flex-shrink-0",children:e.jsx("div",{className:"w-2 h-2 bg-red-500 rounded-full"})}),e.jsx("h2",{className:"text-2xl font-bold text-white",children:t.name})]}),t.description&&e.jsx("p",{className:"text-text-secondary text-sm ml-7",children:t.description}),e.jsxs("p",{className:"text-gold-500 font-bold text-lg ml-7 mt-1",children:["â¹",v.toFixed(2)]})]}),e.jsx("button",{onClick:d,className:"w-10 h-10 rounded-full bg-white/10 flex items-center justify-center hover:bg-white/20 transition-all flex-shrink-0",children:e.jsx(A,{className:"w-5 h-5 text-white"})})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[f&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:["Choose Size / Variant",e.jsx("span",{className:"text-red-400 ml-1",children:"*"})]}),e.jsx("span",{className:"text-xs text-text-tertiary",children:"Choose 1"})]}),e.jsx("div",{className:"space-y-1.5",children:x.map(s=>{const l=y===s.id;return e.jsx("button",{onClick:()=>k(s),className:`w-full px-3 py-2.5 rounded-lg border transition-all text-left ${l?"border-gold-500 bg-gold-500/10":"border-white/10 bg-white/5 hover:bg-white/10"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${l?"border-gold-500":"border-white/30"}`,children:l&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-gold-500"})}),e.jsx("span",{className:"text-white text-sm font-medium",children:s.name})]}),e.jsxs("span",{className:"text-xs font-semibold text-gold-500",children:["â¹",Number(s.price).toFixed(2)]})]})},s.id)})})]}),j.length===0?!f&&e.jsx("p",{className:"text-text-secondary text-center py-4",children:"No customization options available"}):j.map(s=>{const l=g.has(s.id);return e.jsxs("div",{id:`option-group-${s.id}`,className:`space-y-2 rounded-xl p-3 transition-all ${l?"bg-red-500/10 ring-2 ring-red-500/60 animate-[shake_0.3s_ease-in-out]":"bg-transparent"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-base font-semibold text-white",children:[s.name,s.is_required&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"})]}),e.jsx("span",{className:"text-xs text-text-tertiary",children:s.selection_type==="single"?"Choose 1":s.max_selections?`Choose up to ${s.max_selections}`:"Choose any"})]}),l&&e.jsxs("p",{className:"text-xs font-medium text-red-400 flex items-center gap-1",children:[e.jsx("span",{children:"â "})," Please make a selection"]}),s.description&&e.jsx("p",{className:"text-sm text-text-tertiary",children:s.description}),e.jsx("div",{className:"space-y-1.5",children:s.options.map(i=>{const n=$(i.id),u=Number(i.price_adjustment)===0;return e.jsx("button",{onClick:()=>C(s,i.id,i.name,i.price_adjustment),className:`w-full px-3 py-2.5 rounded-lg border transition-all text-left ${n?"border-gold-500 bg-gold-500/10":l?"border-red-500/40 bg-white/5 hover:bg-white/10":"border-white/10 bg-white/5 hover:bg-white/10"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[s.selection_type==="single"?e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${n?"border-gold-500":"border-white/30"}`,children:n&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-gold-500"})}):e.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 ${n?"border-gold-500 bg-gold-500":"border-white/30"}`,children:n&&e.jsx("div",{className:"w-2.5 h-2.5 text-black text-[10px] leading-none",children:"â"})}),e.jsx("span",{className:"text-white text-sm font-medium",children:i.name})]}),e.jsx("span",{className:`text-xs font-semibold ${u?"text-green-400":"text-gold-500"}`,children:u?"Free":`+â¹${Number(i.price_adjustment).toFixed(2)}`})]})},i.id)})})]},s.id)})]}),e.jsxs("div",{className:"p-6 border-t border-white/10 bg-[#1a1a1a] flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("span",{className:"text-white font-semibold",children:"Quantity"}),e.jsxs("div",{className:"flex items-center gap-3 bg-white/10 rounded-lg p-1",children:[e.jsx("button",{onClick:()=>b(Math.max(1,c-1)),className:"w-10 h-10 rounded-md bg-white/10 flex items-center justify-center hover:bg-white/20 transition-all",children:e.jsx(O,{className:"w-4 h-4 text-white"})}),e.jsx("span",{className:"text-white font-bold w-12 text-center text-lg",children:c}),e.jsx("button",{onClick:()=>b(c+1),className:"w-10 h-10 rounded-md bg-white/10 flex items-center justify-center hover:bg-white/20 transition-all",children:e.jsx(V,{className:"w-4 h-4 text-white"})})]})]}),m.length>0&&e.jsxs("div",{className:"mb-4 p-3 bg-white/5 rounded-lg",children:[e.jsx("p",{className:"text-xs text-text-tertiary mb-1",children:"Selected:"}),e.jsx("p",{className:"text-sm text-white",children:m.map(s=>s.name).join(", ")})]}),e.jsxs("button",{onClick:I,disabled:!_(),className:"w-full bg-gold-gradient rounded-xl p-4 font-bold text-lg text-black hover:shadow-gold transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-5 h-5"}),e.jsx("span",{children:h>0?"Update Cart":"Add to Cart"})]}),e.jsxs("span",{children:["â¹",F().toFixed(2)]})]})]})]})]})})}let r=null;function K(t,a){return`${t}|${[...a].sort().join(",")}`}function Q(t,a){r={key:t,data:a}}
1function R(t){return!r||r.key!==t?null:r.data}function U(){r=null}export{E as I,K as b,U as c,R as g,Q as s};
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.