1import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{l as n}from"./useRouter-BnPYK13y.js";import{F as r,N as i,P as a,R as o,V as s,q as c,z as l}from"./index-qYtQbyiG.js";import{t as u}from"./createLucideIcon-D9PJalJX.js";var d=u(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),f=e(n(),1),p=t();function m({wineIds:e,wineId:t,blissUrl:n}){let{user:u}=c(),{sightings:m,refetch:h}=s(e),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(a),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(!1);async function E(e){if(e.preventDefault(),!v.purchase_type)return C(`Please pick where you found it.`);x(!0),C(null);try{let e=parseFloat(v.price);await r(t,u?.id??null,{purchase_type:v.purchase_type,place_name:v.place_name,url:v.url,state:v.state,price:Number.isFinite(e)?e:null}),y(a),_(!1),T(!0),h()}catch(e){C(e instanceof Error?e.message:`Something went wrong.`)}finally{x(!1)}}return(0,p.jsxs)(`section`,{"aria-labelledby":`where-to-find`,className:`rounded-3xl border border-border bg-card p-6`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{id:`where-to-find`,className:`font-serif text-xl text-[color:var(--maroon)]`,children:`Where to Find It`}),(0,p.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Know where to buy this bottle? Help the community find it.`})]}),g?null:(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{_(!0),T(!1)},className:`inline-flex shrink-0 min-h-11 items-center gap-2 rounded-full bg-[color:var(--maroon)] px-5 text-sm font-medium text-white transition hover:opacity-90`,children:[(0,p.jsx)(d,{className:`h-4 w-4`}),`Found this wine? Let us know where`]})]}),n||m.length>0?(0,p.jsxs)(`ul`,{className:`mt-4 space-y-3`,children:[n&&(0,p.jsxs)(`li`,{className:`rounded-2xl border border-[color:var(--amber)]/40 bg-[color:var(--amber)]/5 p-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,p.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Bliss Wine Concierge`}),(0,p.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-[color:var(--amber)]`,children:`Available at Bliss`})]}),(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Online retailer`}),(0,p.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 inline-block text-xs font-medium text-[color:var(--rose)] hover:underline`,children:`Visit site â`})]}),m.map(e=>(0,p.jsxs)(`li`,{className:`rounded-2xl border border-border bg-background p-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,p.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e.place_name}),e.price!=null&&(0,p.jsxs)(`span`,{className:`font-mono text-xs font-semibold text-[color:var(--amber)]`,children:[`$`,Number(e.price).toFixed(2).replace(/\.00$/,``)]})]}),(0,p.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[l(e.purchase_type),e.state?` · ${e.state}`:``]}),e.url&&o(e.purchase_type)&&(0,p.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 inline-block text-xs font-medium text-[color:var(--rose)] hover:underline`,children:`Visit site â`})]},e.id))]}):(0,p.jsx)(`p`,{className:`mt-4 rounded-2xl border border-dashed border-border bg-background p-4 text-sm text-muted-foreground`,children:`No locations shared yet. Be the first to say where you found this bottle.`}),(0,p.jsx)(`p`,{className:`mt-3 text-xs italic text-muted-foreground`,children:`Availability is crowdsourced and may have changed. We recommend confirming with the retailer.`}),w&&(0,p.jsx)(`p`,{className:`mt-3 rounded-xl bg-[color:var(--maroon)]/5 px-3 py-2 text-xs text-[color:var(--maroon)]`,children:`Thanks! Your location is pending review and will appear once approved.`}),g&&(0,p.jsxs)(`form`,{onSubmit:E,className:`mt-4 space-y-3 border-t border-border pt-4`,children:[(0,p.jsx)(i,{value:v,onCh
1ange:y}),S&&(0,p.jsx)(`p`,{className:`text-xs text-destructive`,children:S}),(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,p.jsx)(`button`,{type:`submit`,disabled:b,className:`inline-flex min-h-11 items-center rounded-full bg-[color:var(--maroon)] px-5 text-sm font-medium text-white disabled:opacity-60`,children:b?`Sendingâ¦`:`Submit location`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>_(!1),className:`inline-flex min-h-11 items-center rounded-full border border-border px-5 text-sm text-muted-foreground`,children:`Cancel`})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Submissions are reviewed before they appear.`})]})]})}export{m as t};
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.