1import{r as l,m as p,b as B,j as e,k as R,at as _,R as M,f as P}from"./index-u0HMC9Vb.js";const C={SORA:"Stillness, precision, restraint",AERO:"Warmth, craft, materiality",ONYX:"Drama, tension, contrast",NOVA:"Energy, growth, optimism"},O={SORA:"#7F8FA6",AERO:"#D6B46A",ONYX:"#C06A6A",NOVA:"#8FA77A"};function K({onComplete:S,onSkip:q}){var N,w;const[n,g]=l.useState(0),[d,b]=l.useState({}),[T]=l.useState(()=>Math.random().toString(36).substr(2,9)),[f,k]=l.useState(!1),[j,E]=l.useState(null),[o,I]=l.useState(null);l.useEffect(()=>{p.auth.me().then(E).catch(()=>{})},[]);const{data:a=[],isLoading:Q}=B({queryKey:["traQuestions"],queryFn:()=>p.entities.TRAQuestion.list("order",50)});if(Q)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-stone-50 to-stone-100 dark:from-stone-950 dark:to-stone-900 flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 animate-spin text-stone-400"})});if(a.length===0)return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-stone-50 to-stone-100 dark:from-stone-950 dark:to-stone-900 flex flex-col items-center justify-center px-6",children:[e.jsx("p",{className:"text-center text-stone-600",children:"No test questions available yet."}),e.jsx("button",{onClick:q,className:"mt-6 px-6 py-3 bg-stone-900 text-white rounded-lg hover:bg-stone-700 transition-colors",children:"Continue"})]});const s=a[n],D=d[s.id]!==void 0;(n+1)/a.length*100;const y=t=>{b(r=>({...r,[s.id]:t}))},L=t=>{b(r=>({...r,[s.id]:t}))},F=()=>{n<a.length-1&&g(t=>t+1)},Y=()=>{n>0&&g(t=>t-1)},V=async()=>{var t,r,v;if(j){k(!0);try{const h={SORA:0,AERO:0,ONYX:0,NOVA:0};for(const[x,i]of Object.entries(d)){const u=a.find(c=>c.id===x);if(u&&(await p.entities.TRAResponse.create({user_id:j.id,question_id:x,selected_option_id:typeof i=="string"&&i.length>100?null:i,open_ended_response:typeof i=="string"&&i.length>100?i:null,test_session_id:T}),u.question_type!=="open_ended")){const c=(t=u.options)==null?void 0:t.find(m=>m.id===i);c!=null&&c.score_impact&&Object.keys(h).forEach(m=>{h[m]+=c.score_impact[m]||0})}}const A=Object.entries(h).sort((x,i)=>i[1]-x[1]),X=((r=A[0])==null?void 0:r[0])||"SORA",$=((v=A[1])==null?void 0:v[0])||"AERO";I({primary:X,secondary:$})}finally{k(!1)}}};if(o){const t=O[o.primary],r=O[o.secondary];return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-stone-50 to-stone-100 dark:from-stone-950 dark:to-stone-900 flex flex-col items-center justify-center px-6 py-12",children:e.jsxs("div",{className:"max-w-2xl text-center",children:[e.jsx("p",{className:"text-[9px] font-meta uppercase tracking-[0.35em] text-stone-400 mb-8",children:"Your Result"}),e.jsxs("div",{className:"mb-16",children:[e.jsx("div",{className:"w-24 h-24 rounded-full mx-auto mb-8",style:{backgroundColor:t,opacity:.15}}),e.jsx("h2",{className:"text-6xl lg:text-7xl font-light text-stone-900 dark:text-white mb-4",children:o.primary}
1),e.jsx("p",{className:"text-lg text-stone-600 dark:text-stone-400",children:C[o.primary]})]}),e.jsxs("div",{className:"my-16 p-8 bg-white dark:bg-stone-900 border-2 border-stone-200 dark:border-stone-800",children:[e.jsx("p",{className:"text-[9px] font-meta uppercase tracking-[0.35em] text-stone-400 mb-4",children:"Secondary Influence"}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx("div",{className:"w-6 h-6 rounded-full",style:{backgroundColor:r}}),e.jsx("p",{className:"text-3xl font-light text-stone-900 dark:text-white",children:o.secondary})]}),e.jsx("p",{className:"text-sm text-stone-600 dark:text-stone-400",children:C[o.secondary]})]}),e.jsxs("p",{className:"text-base text-stone-600 dark:text-stone-400 mb-12 leading-relaxed",children:["This is how you perceive and respond to space.",e.jsx("br",{}),"At TRESDA, you learn to design with it."]}),e.jsxs("button",{onClick:()=>S(o.primary,o.secondary),className:"px-10 py-4 bg-stone-900 dark:bg-white text-white dark:text-stone-900 hover:shadow-lg dark:hover:shadow-xl transition-all font-medium flex items-center gap-3 mx-auto group",children:["Continue to Studio",e.jsx(_,{className:"w-4 h-4 group-hover:translate-x-0.5 transition-transform"})]})]})})}return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-stone-50 to-stone-100 dark:from-stone-950 dark:to-stone-900 flex flex-col",children:[e.jsx("div",{className:"border-b border-stone-200 dark:border-stone-800 px-6 lg:px-10 py-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx("p",{className:"text-[9px] font-meta uppercase tracking-[0.35em] text-stone-400 mb-2",children:"TRA Discovery"}
1),e.jsxs("p",{className:"text-xs text-stone-600 dark:text-stone-400",children:["Question ",n+1," of ",a.length]}),e.jsx("div",{className:"mt-6 flex gap-1",children:a.map((t,r)=>e.jsx("div",{className:`flex-1 h-1 rounded-full transition-all duration-500 ${r<n||r===n?"bg-stone-900 dark:bg-white":"bg-stone-200 dark:bg-stone-800"}`},r))})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center px-6 lg:px-10 py-16",children:e.jsxs("div",{className:"max-w-3xl w-full",children:[e.jsx("h2",{className:"text-4xl lg:text-5xl font-light text-stone-900 dark:text-stone-100 mb-12 leading-tight",children:s.question_text}),s.question_type==="multiple_choice"&&e.jsx("div",{className:"space-y-3.5",children:(N=s.options)==null?void 0:N.map(t=>e.jsx("button",{onClick:()=>y(t.id),className:`w-full group px-6 py-5 border-2 transition-all duration-300 ${d[s.id]===t.id?"border-stone-900 bg-stone-900 text-white dark:border-white dark:bg-white dark:text-stone-900":"border-stone-300 dark:border-stone-700 hover:border-stone-900 dark:hover:border-white hover:bg-stone-50 dark:hover:bg-stone-900"}`,children:e.jsx("p",{className:"text-lg text-left group-hover:tracking-wide transition-all",children:t.text})},t.id))}),s.question_type==="image_select"&&e.jsx("div",{className:"grid grid-cols-2 gap-4",children:(w=s.options)==null?void 0:w.map(t=>e.jsxs("button",{onClick:()=>y(t.id),className:`group relative overflow-hidden border-3 transition-all duration-300 aspect-square ${d[s.id]===t.id?"border-stone-900 dark:border-white":"border-stone-300 dark:border-stone-700 hover:border-stone-900 dark:hover:border-white"}`,children:[t.image_url&&e.jsx("img",{src:t.image_url,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),t.text&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 to-transparent flex items-end justify-center p-3",children:e.jsx("p",{className:"text-xs font-medium text-white text-center",children:t.text})})]},t.id))}),s.question_type==="open_ended"&&e.jsx("textarea",{value:d[s.id]||"",onChange:t=>L(t.target.value),placeholder:"Take your time with your response...",className:"w-full h-40 p-6 border-2 border-stone-300 dark:border-stone-700 bg-white dark:bg-stone-800 dark:text-white text-base focus:outline-none focus:border-stone-900 dark:focus:border-white resize-none"})]})}),e.jsx("div",{className:"border-t border-stone-200 dark:border-stone-800 px-6 lg:px-10 py-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto flex items-center justify-between gap-6",children:[e.jsxs("button",{onClick:Y,disabled:n===0,className:"flex items-center gap-2 px-5 py-2.5 text-stone-600 dar
1k:text-stone-400 hover:text-stone-900 dark:hover:text-white disabled:opacity-30 transition-colors text-sm font-medium",children:[e.jsx(M,{className:"w-4 h-4"}),"Back"]}),n===a.length-1?e.jsxs("button",{onClick:V,disabled:f||Object.keys(d).length<a.length,className:"ml-auto px-8 py-3 bg-stone-900 dark:bg-white text-white dark:text-stone-900 hover:shadow-lg dark:hover:shadow-xl disabled:opacity-40 transition-all font-medium flex items-center gap-2.5 group",children:[f?e.jsx(R,{className:"w-4 h-4 animate-spin"}):"See Results",e.jsx(_,{className:"w-4 h-4 group-hover:translate-x-0.5 transition-transform"})]}):e.jsxs("button",{onClick:F,disabled:!D,className:"ml-auto px-8 py-3 bg-stone-900 dark:bg-white text-white dark:text-stone-900 hover:shadow-lg dark:hover:shadow-xl disabled:opacity-40 transition-all font-medium flex items-center gap-2.5 group",children:["Continue",e.jsx(P,{className:"w-4 h-4 group-hover:translate-x-0.5 transition-transform"})]})]})})]})}export{K 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.