1import{r as a,j as e,v as I,w as W}from"./ui-vendor-qcG6DIg5.js";import{f as Y,e as Z}from"./router-vendor-C6BU_BAd.js";import{c as f,u as Q,b as D,w as N,B as C,h as L}from"./dropdown-menu-Cy6tfpex.js";import{g as ee,t as w,I as te}from"./analytics-D2o6XuYe.js";import{d as se,c as ae,g as re,e as M}from"./index-D9ZZ-GrO.js";import{g as ne,A as R,H as T,h as ie}from"./utils-vendor-BSnEdsAz.js";import"./query-vendor-cKxl6-at.js";const q=a.forwardRef(({className:t,value:x,...r},u)=>e.jsx(I,{ref:u,className:f("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...r,children:e.jsx(W,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(x||0)}%)`}})}));q.displayName=I.displayName;function le(t,x){const{t:r}=Q("quiz"),u=x-t;return t===0?r("progress.start"):u<=3?r("progress.last_few",{count:u}):t>=Math.ceil(x/2)?r("progress.past_half"):r("progress.keep_going")}function pe(){var F;const{t,i18n:x}=Q(["quiz","common"]),{locale:r}=D(),[u]=Y(),p=Z(),g=u.get("pair"),v=a.useRef(null),h=a.useMemo(()=>ee(),[x.language]),l=a.useMemo(()=>{if(!g)return null;const s=se(g);return s&&s.a?s:null},[g]),n=!!l,$=g!==null&&!l,H=(F=l==null?void 0:l.an)==null?void 0:F.trim(),[z,k]=a.useState($?"error":"intro"),[m,y]=a.useState(0),[c,A]=a.useState([]),[B,O]=a.useState(""),[o,_]=a.useState(null);a.useEffect(()=>()=>{v.current&&window.clearTimeout(v.current)},[]);const b=c.length/h.length*100,S=le(c.length,h.length),j=B.trim()||void 0,P=a.useCallback(s=>{const i=[...c,s];if(A(i),w("quiz_step",{step:i.length,mode:n?"partner_b":"partner_a"}),i.length===h.length){const d=ae(i),G=re(d.normalized);if(w("quiz_complete",{mode:n?"partner_b":"partner_a",primary_lang:G.primary}),n&&l){const V={v:1,a:l.a,b:d.normalized,an:l.an,bn:j,l:l.l};p(N(`/results?data=${M(V)}`,r));return}const J={v:1,a:d.normalized,an:j,l:r},K=M(J);p(N(`/results?data=${K}`,r))}else y(i.length)},[c,n,p,l,j,r]),U=a.useCallback(s=>{if(o)return;const i=h[m],d=s==="A"?i.optionA.language:i.optionB.language;_(s),v.current=window.setTimeout(()=>{_(null),P(d)},140)},[P,m,o]),X=a.useCallback(()=>{m>0&&!o&&(y(m-1),A(c.slice(0,-1)))},[c,m,o]);if(z==="error")return e.jsx("div",{className:"min-h-screen bg-[#F5EFE7] px-4 py-8 sm:py-10",children:e.jsxs("div",{className:"mx-auto max-w-xl letter-card p-6 text-center sm:p-10",children:[e.jsx(ne,{className:"mx-auto mb-4 h-12 w-12 text-rose-600 sm:mb-5 sm:h-14 sm:w-14"}),e.jsx("div",{className:"stamp-label mx-auto",children:t("quiz:error.stamp")}),e.jsx("h1",{className:"mt-4 font-romance text-2xl tracking-[-0.03em] text-stone-900 sm:text-4xl",children:t("quiz:error.title")}),e.jsx("p",{className:"mt-3 text-[15px] leading-7 text-stone-600 sm:mt-4 sm:text-base sm:leading-8",children:t("quiz:error.subtitle")}),e.jsxs(C,{onClick:()=>{k("intro"),p(N("/quiz",r))},className:"mt-6 w-full rounded-full bg-stone-900 px-8 py-5 text-base font-semibold text-white hover:bg-stone-800 sm:mt-8 sm:w-auto",children:[t("quiz:error.cta"),e.jsx(R,{className:"ml-2 h-4 w-4"})]})]})});if(z==="intro")return e.jsx("div",{className:"min-h-screen bg-[#F5EFE7] px-4 py-6 sm:px-6 sm:py-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs(L,{to:"/",className:"mb-5 inline-flex items-center gap-2 text-sm font-medium text-stone-500 transition-colors hover:text-stone-900 sm:mb-6",children:[e.jsx("div",{className:"wax-seal !h-6 !w-6",children:e.jsx(T,{className:"h-2.5 w-2.5 fill-white text-white"})}),t("quiz:backToHome")]}),e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[1.05fr_0.95fr] lg:items-start lg:gap-6",children:[e.jsxs("div",{className:"animate-fade-up letter-card p-5 sm:p-9",children:[e.jsx("div",{className:"stamp-label",children:t(n?"quiz:intro.stamp.partnerB":"quiz:intro.stamp.partnerA")}),e.jsx("h1",{className:"mt-5 font-romance text-[1.75rem] leading-[1.05] tracking-[-0.03em] text-stone-900 sm:mt-6 sm:text-5xl lg:text-6xl",children:n?e.jsxs(e.Fragment,{children:[t("quiz:intro.title.partnerB_before")," ",e.jsx("span",{className:"mx-1 font-handwritten text-[1.2em] text-rose-600",children:t("quiz:intro.title.partnerB_highlight")})," ",t("quiz:intro.title.partnerB_after")]}):e.jsxs(e.Fragment,{children:[t("quiz:intro.title.partnerA_before")," ",e.jsx("span",{className:"mx-1 font-handwritten text-[1.2em] text-rose-600",children:t("quiz:intro.title.partnerA_highlight")})," ",t("quiz:intro.title.partnerA_after")]})}),e.jsx("p",{className:"mt-4 max-w-xl border-l-2 border-[#B8976A]/40 pl-4 text-[15px] leading-7 text-stone-600 sm:mt-6 sm:pl-5 sm:text-base sm:leading-8",children:n?t("quiz:intro.subtitle.partnerB",{name:H??t("quiz:intro.subtitle.partnerBFallbackName")}):t("quiz:intro.subtitle.partnerA")}),e.jsxs("p",{className:"mt-6 font-handwritten text-base text-[#B8976A] sm:mt-8 sm:text-lg",children:[t("quiz:intro.chips.questions")," · ",t("quiz:intro.chips.duration")," · ",t("quiz:intro.chips.noSignUp")]}),e.jsxs("div",{className:"mt-5 sm:mt-7",children:[e.jsx("label",{htmlFor:"nickname",className:"mb-2 block text-sm font-medium text-stone-800",children:t(n?"quiz:intro.nicknameLabel.partnerB":"quiz:intro.nicknameLabel.partnerA")}),e.jsx(te,{id:"nickname",value:B,onChange:s=>O(s.target.value),maxLength:24,placeholder:t(n?"quiz:intro.nicknamePlaceholder.partnerB":"quiz:intro.nicknamePlaceholder.partnerA"),className:"h-12 rounded-lg border-stone-200 bg-white"})]}),e.jsxs(C,{onClick:()=>{w("quiz_start",{mode:n?"partner_b":"partner_a"}),k("quiz")},className:"cta-glow mt-6 w-full rounded-full bg-rose-700 px-8 py-6 text-base font-semibold text-white shadow-lg shadow-rose-700/20 transition-all hover:bg-rose-800 hover:shadow-xl hover:shadow-rose-700/25 sm:mt-8 sm:w-auto",children:[t(n?"quiz:intro.cta.partnerB":"quiz:intro.cta.partnerA"),e.jsx(R,{className:"ml-2 h-5 w-5"})]})]}),e.jsxs("div",{className:"hidden letter-card p-5 sm:block sm:p-7",children:[e.jsx("div",{className:"font-handwritten text-xl text-[#B8976A]",children:t("quiz:intro.sidebar.heading")}),e.jsxs("div",{className:"mt-4 space-y-5 text-sm leading-7 text-stone-600",children:[e.jsx("p",{children:t("quiz:intro.sidebar.p1")}),e.jsx("p",{children:t("quiz:intro.sidebar.p2")}),e.jsx("p",{children:t("quiz:intro.sidebar.p3")})]})]})]})]})});const E=h[m];return e.jsx("div",{className:"min-h-screen bg-[#F5EFE7] px-4 pb-8 pt-4 sm:px-6 sm:pb-10 sm:pt-6",children:e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-stone-200/50 pb-3 sm:pb-4",children:[e.jsxs(L,{to:"/",className:"flex items-center gap-2",children:[e.jsx("div",{className:"wax-seal !h-7 !w-7",children:e.jsx(T,{className:"h-3 w-3 fill-white text-white"})}),e.jsx("span",{className:"text-sm font-medium text-stone-900 sm:text-base",children:t("common:brand.name")}
1)]}),e.jsxs("div",{className:"font-handwritten text-lg text-[#B8976A] sm:text-xl",children:[c.length+1," / ",h.length]})]}),e.jsxs("div",{className:"mt-4 sm:mt-6 lg:hidden",children:[e.jsx(q,{value:b,className:"h-1.5 rounded-full bg-stone-200/60 [&>div]:rounded-full [&>div]:bg-gradient-to-r [&>div]:from-rose-500 [&>div]:to-rose-700 [&>div]:transition-all [&>div]:duration-500 [&>div]:ease-out"}),e.jsx("p",{className:"mt-3 text-center font-handwritten text-base text-[#B8976A]",children:S}),e.jsx("div",{className:"mt-1 text-center text-[10px] uppercase tracking-[0.32em] text-stone-400",children:t("quiz:quiz.percentComplete",{value:Math.round(b)})})]}),e.jsxs("div",{className:"mt-4 grid gap-4 sm:mt-6 sm:gap-6 lg:grid-cols-[0.72fr_1.28fr] lg:items-start",children:[e.jsxs("aside",{className:"hidden letter-card p-6 lg:block",children:[e.jsx("div",{className:"stamp-label",children:t(n?"quiz:quiz.partnerBStamp":"quiz:quiz.partnerAStamp")}),e.jsx("h2",{className:"mt-5 font-romance text-2xl leading-tight tracking-[-0.02em] text-stone-700",children:t("quiz:quiz.headline")}),e.jsx("div",{className:"gold-line mt-6"}),e.jsx("p",{className:"mt-6 font-handwritten text-xl leading-snug text-[#B8976A]",children:S}),e.jsx(q,{value:b,className:"mt-6 h-2 rounded-full bg-stone-200/60 [&>div]:rounded-full [&>div]:bg-gradient-to-r [&>div]:from-rose-500 [&>div]:to-rose-700 [&>div]:transition-all [&>div]:duration-500 [&>div]:ease-out"}),e.jsx("div",{className:"mt-3 text-[11px] uppercase tracking-[0.28em] text-stone-400",children:t("quiz:quiz.percentComplete",{value:Math.round(b)})})]}),e.jsxs("section",{className:"letter-card p-5 sm:p-8",children:[e.jsx("div",{className:"font-handwritten text-lg text-[#B8976A] sm:text-xl",children:t("quiz:quiz.questionLabel",{number:m+1})}),e.jsx("h1",{className:"mt-3 font-romance text-2xl leading-tight tracking-[-0.02em] text-stone-900 sm:mt-4 sm:text-4xl lg:text-5xl",children:t("quiz:quiz.prompt")}),e.jsx("div",{className:"mt-6 space-y-3 sm:mt-8 sm:space-y-4",children:[{key:"A",text:E.optionA.text,border:"border-rose-200/70",label:"text-rose-700",accentBg:"bg-rose-500",bg:"bg-rose-50/60"},{key:"B",text:E.optionB.text,border:"border-indigo-200/70",label:"text-indigo-700",accentBg:"bg-indigo-500",bg:"bg-indigo-50/60"}].map(s=>{const i=o===s.key,d=o!==null&&!i;return e.jsxs("button",{onClick:()=>U(s.key),disabled:o!==null,className:f("quiz-pick group relative w-full overflow-hidden rounded-xl border bg-white p-5 text-left sm:p-6",s.border,i&&`quiz-pick-active ${s.bg}`,d&&"opacity-50 scale-[0.98]",!o&&"hover:shadow-md hover:shadow-stone-200/40","focus:outline-none focus:ring-2 focus:ring-[#B8976A]/30 focus:ring-offset-2"),children:[e.jsx("span",{"aria-hidden":!0,className:f("absolute inset-y-0 left-0 w-1 transition-[width] duration-200 group-hover:w-1.5",s.accentBg,"opacity-80")}),e.jsxs("div",{className:"pl-3 sm:pl-4",children:[e.jsx("div",{className:f("font-handwritten text-base sm:text-lg",s.label),children:s.key}),e.jsx("p",{className:"mt-1.5 text-[15px] leading-7 text-stone-800 sm:mt-2 sm:text-lg sm:leading-8",children:s.text})]})]},s.key)})}),m>0&&e.jsxs("button",{onClick:X,disabled:o!==null,className:"mt-5 inline-flex items-center gap-1 text-sm font-medium text-stone-500 transition-colors hover:text-stone-900 disabled:opacity-50 sm:mt-6",children:[e.jsx(ie,{className:"h-4 w-4"}),t("quiz:quiz.previous")]})]})]})]})})}export{pe 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.