1import{j as t,s as k,u as w,i as C}from"./index-BkAxYJYB.js";import{b as g,h as A}from"./react-vendor-iJun6VP1.js";import{S as B}from"./SiteShell-CB3Dwu5z.js";import"./supabase-vendor-o79c1kQX.js";import"./helpers-CddHt4ev.js";const T=[{value:"half_day",label:"Half day",caption:"Morning or afternoon",emoji:"ð
"},{value:"day_trip",label:"Day trip",caption:"Sunrise to sunset",emoji:"âï¸"},{value:"weekend",label:"Weekend",caption:"Two unhurried days",emoji:"ð"},{value:"week",label:"A week",caption:"Settle in and discover",emoji:"ð´"}],z=[{value:"solo",label:"Solo",caption:"Just me",emoji:"ð¶"},{value:"couple",label:"Couple",caption:"Two of us",emoji:"ð"},{value:"family",label:"Family",caption:"Kids in tow",emoji:"ð¨âð©âð§"},{value:"friends",label:"Friends",caption:"A close group",emoji:"ð¥"},{value:"group",label:"Group",caption:"Larger party",emoji:"ð"}],E=[{value:"beach",label:"Beach",emoji:"ð"},{value:"food",label:"Food",emoji:"ð´"},{value:"nature",label:"Nature",emoji:"ð²"},{value:"shopping",label:"Shopping",emoji:"ð"},{value:"arts",label:"Arts",emoji:"ð¨"},{value:"nightlife",label:"Nightlife",emoji:"ð¸"},{value:"hidden-gem",label:"Hidden gems",emoji:"ð®"},{value:"wellness",label:"Wellness",emoji:"ð§"}],F=[{value:1,label:"$",caption:"Mostly free or low-cost"},{value:2,label:"$$",caption:"Comfortable, not extravagant"},{value:3,label:"$$$",caption:"Splurge on a few standouts"},{value:4,label:"$$$$",caption:"No expense spared"}],O=[{value:"spring",label:"Spring",emoji:"ð·"},{value:"summer",label:"Summer",emoji:"âï¸"},{value:"fall",label:"Fall",emoji:"ð"},{value:"winter",label:"Winter",emoji:"âï¸"},{value:"any",label:"Any time"}],b=4,m=6;function W(e=new Date){const o=e.getMonth();return o<=1||o===11?"winter":o<=4?"spring":o<=7?"summer":"fall"}const $=e=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"28px 20px",background:e?"var(--sp-guide-sand, #D4B896)":"#fff",color:e?"#fff":"var(--sp-text-strong)",border:`1px solid ${e?"var(--sp-guide-sand, #D4B896)":"var(--sp-border)"}`,borderRadius:16,cursor:"pointer",fontFamily:"var(--sp-body-font)",textAlign:"center",transition:"transform 0.15s ease, background 0.15s ease",minHeight:140}),N={fontFamily:"var(--sp-heading-font)",fontSize:"clamp(28px, 4vw, 40px)",fontWeight:500,letterSpacing:"-0.01em",margin:"0 0 8px",color:"var(--sp-text-strong)"},P={fontFamily:"var(--sp-body-font)",fontSize:15,color:"var(--sp-text-mid)",margin:"0 0 32px"};function R({initialInputs:e,onComplete:o}){const[n,a]=g.useState(1),[r,i]=g.useState({duration_type:e==null?void 0:e.duration_type,party_type:e==null?void 0:e.party_type,interest_tags:(e==null?void 0:e.interest_tags)??[],budget_tier:e==null?void 0:e.budget_tier,season:(e==null?void 0:e.season)??W(),dog_friendly:(e==null?void 0:e.dog_friendly)??!1,accessibility_needs:(e==null?void 0:e.accessibility_needs)??!1,dietary_restrictions:(e==null?void 0:e.dietary_restrictions)??[]}),p=g.useMemo(()=>{switch(n){case 1:return!!r.duration_type;case 2:return!!r.party_type;case 3:return!!(r.interest_tags&&r.interest_tags.length>=1);case 4:return!!r.budget_tier;case 5:return!!r.season;case 6:return!0;default:return!1}},[n,r]);function l(s){i(c=>({...c,...s}))}function d(s){i(c=>{const y=c.interest_tags??[];return y.includes(s)?{...c,interest_tags:y.filter(S=>S!==s)}:y.length>=b?c:{...c,interest_tags:[...y,s]}})}function j(){n<m?a(s=>s+1):h()}function _(){n>1&&a(s=>s-1)}function h(){!r.duration_type||!r.party_type||!r.budget_tier||!r.season||!r.interest_tags||r.interest_tags.length===0||o({duration_type:r.duration_type,party_type:r.party_type,budget_tier:r.budget_tier,season:r.season,interest_tags:r.interest_tags,dog_friendly:r.dog_friendly,accessibility_needs:r.accessibility_needs,dietary_restrictions:r.dietary_restrictions})}return t.jsxs("div",{style:{maxWidth:840,margin:"0 auto",padding:"40px 24px 80px",fontFamily:"var(--sp-body-font)"},children:[t.jsx(D,{step:n,total:m}),n===1&&t.jsx(u,{heading:"How long are you visiting?",children:t.jsx(f,{options:T,value:r.duration_type,onCh
1ange:s=>l({duration_type:s})})}),n===2&&t.jsx(u,{heading:"Who's coming with you?",children:t.jsx(f,{options:z,value:r.party_type,onChange:s=>l({party_type:s})})}),n===3&&t.jsx(u,{heading:"What sets the tone?",subhead:`Pick up to ${b} that resonate â we'll weave them into your itinerary.`,children:t.jsx(f,{options:E,value:r.interest_tags,multi:!0,onChange:d})}),n===4&&t.jsx(u,{heading:"What's the spending vibe?",children:t.jsx(f,{options:F,value:r.budget_tier,onChange:s=>l({budget_tier:s})})}),n===5&&t.jsx(u,{heading:"When are you here?",subhead:"We default to the current season â switch if you're planning ahead.",children:t.jsx(f,{options:O,value:r.season,onChange:s=>l({season:s})})}),n===6&&t.jsx(u,{heading:"Anything else?",subhead:"Optional â skip if nothing applies.",children:t.jsxs("div",{style:{display:"grid",gap:16,maxWidth:520,margin:"0 auto"},children:[t.jsx(x,{label:"Bringing a dog",checked:r.dog_friendly??!1,onChange:s=>l({dog_friendly:s})}),t.jsx(x,{label:"Accessibility needs",checked:r.accessibility_needs??!1,onChange:s=>l({accessibility_needs:s})}),t.jsx(H,{value:r.dietary_restrictions??[],onChange:s=>l({dietary_restrictions:s})})]})}),t.jsx(U,{step:n,total:m,canAdvance:p,canSkip:n===m,onBack:_,onNext:j,onSkip:h})]})}function u({heading:e,subhead:o,children:n}){return t.jsxs("section",{children:[t.jsx("h2",{style:N,children:e}),o&&t.jsx("p",{style:P,children:o}),n]})}function D({step:e,total:o}){return t.jsxs("div",{style:{marginBottom:32},children:[t.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:o},(n,a)=>a+1).map(n=>t.jsx("span",{style:{flex:1,height:4,borderRadius:2,background:n<=e?"var(--sp-guide-coral, #E8A598)":"var(--sp-border)",transition:"background 0.2s ease"}},n))}),t.jsxs("div",{style:{fontSize:12,color:"var(--sp-text-muted)",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase"},children:["Step ",e," of ",o]})]})}function f({options:e,value:o,multi:n,onChange:a}){function r(i){return n?Array.isArray(o)&&o.includes(i.value):o===i.value}return t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))",gap:12},children:e.map(i=>t.jsxs("button",{type:"button",onClick:()=>a(i.value),style:$(r(i)),children:[i.emoji&&t.jsx("span",{style:{fontSize:32},"aria-hidden":!0,children:i.emoji}),t.jsx("span",{style:{fontFamily:"var(--sp-heading-font)",fontSize:22,fontWeight:500,letterSpacing:"-0.005em"},children:i.label}),i.caption&&t.jsx("span",{style:{fontSize:13,opacity:.85,lineHeight:1.4},children:i.caption})]},String(i.value)))})}function x({label:e,checked:o,onChange:n}){return t.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",background:"#fff",borderRadius:12,border:"1px solid var(--sp-border)",cursor:"pointer",fontSize:15,color:"var(--sp-text-strong)"},children:[t.jsx("span",{children:e}),t.jsx("input",{type:"checkbox",checked:o,onChange:a=>n(a.target.checked),style:{width:20,height:20,accentColor:"var(--sp-guide-coral, #E8A598)"}})]})}const M=["Vegetarian","Vegan","Gluten-free","Kosher","Halal"];function H({value:e,onChange:o}){function n(a){o(e.includes(a)?e.filter(r=>r!==a):[...e,a])}return t.jsxs("div",{style:{padding:"16px 20px",background:"#fff",borderRadius:12,border:"1px solid var(--sp-border)"},children:[t.jsx("div",{style:{marginBottom:10,fontSize:15,color:"var(--sp-text-strong)"},children:"Dietary restrictions"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:M.map(a=>{const r=e.includes(a);return t.jsx("button",{type:"button",onClick:()=>n(a),style:{padding:"6px 12px",borderRadius:999,background:r?"var(--sp-guide-fog, #7A9CAB)":"transparent",color:r?"#fff":"var(--sp-text-strong)",border:`1px solid ${r?"var(--sp-guide-fog, #7A9CAB)":"var(--sp-border)"}`,fontSize:13,cursor:"pointer",fontFamily:"var(--sp-body-font)"},children:a},a)})})]})}function U({step:e,total:o,canAdvance:n,canSkip:a,onBack:r,onNext:i,onSkip:p}){const l=e===o;return t.jsxs("div",{style:{marginTop:40,display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[e>1?t.jsx("button",{type:"button",onClick:r,style:{padding:"12px 20px",background:"transparent",color:"var(--sp-text-mid)",border:"none",cursor:"pointer",fontSize:14,fontFamily:"var(--sp-body-font)"},children:"â Back"}):t.jsx("span",{}),t.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[a&&t.jsx("button",{type:"button",onClick:p,style:{padding:"12px 20px",background:"transparent",color:"var(--sp-text-muted)",border:"none",cursor:"pointer",fontSize:14,fontFamily:"var(--sp-body-font)"},children:"Skip"}),t.jsx("button",{type:"button",onClick:i,disabled:!n,style:{padding:"14px 28px",background:n?"var(--sp-guide-coral, #E8A598)":"var(--sp-border)",color:"#fff",border:"none",borderRadius:8,cursor:n?"pointer":"not-allowed",fontSize:15,fontWeight:600,fontFamily:"var(--sp-body-font)",opacity:n?1:.
16,transition:"opacity 0.2s ease"},children:l?"Curate my itinerary â":"Continue â"})]})]})}const v="wtdim_session_id";function G(){var e,o;try{const n=localStorage.getItem(v);if(n)return n;const a=((e=crypto.randomUUID)==null?void 0:e.call(crypto))??Math.random().toString(36).slice(2);return localStorage.setItem(v,a),a}catch{return((o=crypto.randomUUID)==null?void 0:o.call(crypto))??Math.random().toString(36).slice(2)}}async function V(e,o){const n={inputs:e,session_id:G(),site_id:o},{data:a,error:r}=await k.functions.invoke("generate-itinerary",{body:n});if(r||!a)throw new Error(`Itinerary generation failed: ${(r==null?void 0:r.message)??"unknown error"}`);return a}function X({}){const e=A(),o=w(),[n,a]=g.useState(!1),[r,i]=g.useState(null);g.useEffect(()=>{C({title:`Plan your trip â ${o.name}`,description:"Build a custom Malibu itinerary in under a minute.",siteName:o.name,type:"website"})},[o.name]);async function p(l){a(!0),i(null);try{const d=await V(l,o.id);e(`/plan/result/${d.itinerary_id}`)}catch(d){console.error("[ItineraryQuizPage] generation failed",d),i(d instanceof Error?d.message:"Generation failed"),setTimeout(()=>e("/itineraries"),1500)}}return t.jsx(B,{children:t.jsx("main",{style:{minHeight:"70vh",background:"var(--sp-guide-cream, #FAF6F0)"},children:n?t.jsx(L,{error:r}):t.jsx(R,{onComplete:p})})})}function L({error:e}){return t.jsxs("div",{style:{maxWidth:640,margin:"0 auto",padding:"120px 24px",textAlign:"center",fontFamily:"var(--sp-body-font)"},children:[t.jsx("div",{"aria-hidden":!0,style:{width:56,height:56,margin:"0 auto 24px",borderRadius:"50%",border:"4px solid var(--sp-border)",borderTopColor:"var(--sp-guide-coral, #E8A598)",animation:"sp-quiz-spin 1.1s linear infinite"}}),t.jsx("h2",{style:{fontFamily:"var(--sp-heading-font)",fontSize:28,fontWeight:500,margin:"0 0 8px",color:"var(--sp-text-strong)"},children:e?"One momentâ¦":"Curating your perfect Malibu itineraryâ¦"}),t.jsx("p",{style:{fontSize:15,color:"var(--sp-text-mid)",margin:0},children:e?"We're routing you to our curated picks instead.":"Aligning your priorities, assessing the area, and creating a custom itinerary for a memorable vacation."}),t.jsx("style",{children:` 2 @keyframes sp-quiz-spin { 3 from { transform: rotate(0deg); } 4 to { transform: rotate(360deg); } 5 } 6 `})]})}export{X 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.