PageSourceSearch

https://toss-fortune-tells.lovable.app/assets/Wizard-DYR0pREB.js

js toss-fortune-tells.lovable.app collected 2026-10-03 03:50:36 UTC 14,127 bytes, 1 lines download raw bytes

1import{j as e,m as b,A as B}from"./vendor-motion-C_4MFP9N.js";import{u as G,f as Y,r as c}from"./vendor-react-B30Rn3Gh.js";import{t as K,M as _}from"./index-BUFJQBB1.js";import{f as E,s as W,j as q,m as Q,t as X,a as Z,b as ee}from"./fortuneTypes-EaE4Auej.js";import{g as te}from"./vendor-icons-BPgoZ0Mw.js";const se={enter:o=>({x:o>0?300:-300,opacity:0}),center:{x:0,opacity:1},exit:o=>({x:o>0?-300:300,opacity:0})},y="userProfile",F=()=>{try{const o=localStorage.getItem(y);if(!o)return{name:"",birthDate:"",gender:""};const l=JSON.parse(o);return{name:typeof l.name=="string"?l.name:"",birthDate:typeof l.birthDate=="string"?l.birthDate:"",gender:typeof l.gender=="string"?l.gender:""}}catch{return{name:"",birthDate:"",gender:""}}},N=o=>{try{const l=F();localStorage.setItem(y,JSON.stringify({...l,...o}))}catch{}},re=()=>{try{localStorage.removeItem(y)}catch{}},ce=()=>{G();const{type:o}=Y();c.useEffect(()=>{K(`/wizard/${o}`)},[o]);const[l,v]=c.useState(0),[S,w]=c.useState(1),x=c.useMemo(()=>F(),[]),[O,J]=c.useState(!!x.name),[s,n]=c.useState({name:x.name||"",birthDate:x.birthDate||"",birthTime:"",gender:x.gender||"",tarotTopic:"",tarotCards:[],mbtiType:"",job:"",singer:"",photoHash:""}),[D,$]=c.useState(""),[k,T]=c.useState(null),[i,M]=c.useState({}),[U,I]=c.useState(new Set),u=E[o||"saju"]||E.saju,p=u.steps.length,d=u.steps[l],f=u.needsGender!==!1,R=r=>{const t=r.replace(/\D/g,"").slice(0,8);return t.length<=4?t:t.length<=6?`${t.slice(0,4)}-${t.slice(4)}`:`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6)}`},A=r=>r.replace(/\D/g,"").length===8,C=c.useMemo(()=>{if(!d)return!1;switch(d.type){case"basicInfo":const r=s.name.trim().length>0,t=A(s.birthDate),a=!f||s.gender.length>0;return r&&t&&a;case"name":return s.name.trim().length>0;case"birthDate":return s.birthDate.length>0;case"birthTime":return s.birthTime.length>0;case"gender":return s.gender.length>0;case"tarotTopic":return s.tarotTopic.length>0;case"tarotCards":return s.tarotCards.length===3;case"mbtiSelect":return Object.keys(i).length===4;case"jobSelect":return s.job.length>0;case"singerSelect":return s.singer.length>0;case"photoUpload":return s.photoHash.length>0;default:return!1}},[d,s,i,f]),L=()=>
1{if((d==null?void 0:d.type)==="mbtiSelect"){const r=`${i.EI||"E"}${i.SN||"S"}${i.TF||"T"}${i.JP||"J"}`;n(t=>({...t,mbtiType:r}))}if(l<p-1)w(1),v(l+1);else{const r={...s,type:o,mbtiType:(d==null?void 0:d.type)==="mbtiSelect"?`${i.EI||"E"}${i.SN||"S"}${i.TF||"T"}${i.JP||"J"}`:s.mbtiType};sessionStorage.setItem("fortuneResult",JSON.stringify(r)),window.location.href="/result"}},V=()=>{l>0?(w(-1),v(l-1)):window.location.href="/"},z=r=>{I(t=>{const a=new Set(t);return a.has(r)?(a.delete(r),n(m=>({...m,tarotCards:m.tarotCards.filter(g=>g!==r)}))):s.tarotCards.length<3&&(a.add(r),n(m=>({...m,tarotCards:[...m.tarotCards,r]}))),a})},H=r=>{if(!r)return null;switch(r.type){case"basicInfo":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r.description}),O&&e.jsxs("div",{className:"flex items-center justify-between mb-4 px-3 py-2 rounded-xl bg-primary/10 text-xs text-primary",children:[e.jsx("span",{children:"✓ 이전에 입력한 정보를 불러왔어요"}),e.jsx("button",{type:"button",onClick:()=>{re(),n({...s,name:"",birthDate:"",gender:""}),J(!1)},className:"underline font-medium",children:"초기화"})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground mb-2 block",children:"본인 이름"}),e.jsx("input",{type:"text",className:"toss-input",placeholder:"본인 이름 입력",value:s.name,onChange:t=>{const a=t.target.value;n({...s,name:a}),N({name:a})},autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground mb-2 block",children:"본인 생년월일"}),e.jsx("input",{type:"text",className:"toss-input",placeholder:"2000-01-15",inputMode:"numeric",value:s.birthDate,onChange:t=>{const a=R(t.target.value);n({...s,birthDate:a}),N({birthDate:a})}})]}),f&&e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground mb-2 block",children:"성별"}),e.jsx("div",{className:"flex gap-3",children:["남성","여성"].map(t=>e.jsxs("button",{onClick:()=>{n({...s,gender:t}),N({gender:t})},className:`flex-1 h-14 rounded-2xl text-base font-bold transition-all ${s.gender===t?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[t==="남성"?"👨 ":"👩 ",t]},t))})]})]})]});case"name":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-8",children:r.description}),e.jsx("input",{type:"text",className:"toss-input",placeholder:"이름 입력",value:s.name,onChange:t=>n({...s,name:t.target.value}),autoFocus:!0})]});case"birthDate":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-8",children:r.description}),e.jsx("input",{type:"date",className:"toss-input",value:s.birthDate,onChange:t=>n({...s,birthDate:t.target.value})})]});case"birthTime":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),e.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-[50vh] overflow-y-auto",children:ee.map(t=>e.jsx("button",{onClick:()=>n({...s,birthTime:t}),className:`h-12 rounded-2xl text-sm font-medium transition-all ${s.birthTime===t?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:t},t))})]});case"gender":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-8",children:r.description}),e.jsx("div",{className:"flex gap-3",children:["남성","여성"].map(t=>e.jsxs("button",{onClick:()=>n({...s,gender:t}),className:`flex-1 h-20 rounded-2xl text-lg font-bold transition-all ${s.gender===t?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[t==="남성"?"👨 ":"👩 ",t]},t))})]});case"tarotTopic":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Z.map(t=>e.jsxs("button",{onClick:()=>n({...s,tarotTopic:t.id}),className:`h-24 rounded-2xl text-base font-bold transition-all flex flex-col items-center justify-center gap-1 ${s.tarotTopic===t.id?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[e.jsx("span",{className:"text-2xl",children:t.emoji}),t.label]},t.id))})]});case"tarotCards":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:r.description}),e.jsxs("p",{className:"text-xs text-primary font-medium mb-5",children:[s.tarotCards.length,"/3장 선택됨"]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:X.slice(0,6).map(t=>{const a=U.has(t.id);return e.jsx("button",{onClick:()=>z(t.id),className:"perspective-[600px] h-36",disabled:!a&&s.tarotCards.length>=3,children:e.jsxs(b.div,{className:"relative w-full h-full",animate:{rotateY:a?180:0},transition:{duration:.5},style:{transformStyle:"preserve-3d"},children:[e.jsx("div",{className:`absolute inset-0 rounded-2xl flex items-center justify-center backface-hidden ${!a&&s.tarotCards.length>=3?"bg-muted/60 opacity-50":"bg-gradient-to-br from-primary/80 to-primary active:scale-[0.95]"}`,style:{backfaceVisibility:"hidden"},children:e.jsx("span",{className:"text-3xl",children:"🔮"})}),e.jsxs("div",{className:"absolute inset-0 rounded-2xl bg-card border-2 border-primary flex flex-col items-center justify-center gap-1",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:[e.jsx("span",{className:"text-3xl",children:t.emoji}),e.jsx("span",{className:"text-xs font-bold text-foreground",children:t.nameKo})]})]})},t.id)})})]});case"mbtiSelect":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),e.jsxs("div",{className:"space-y-3",children:[Q.map(t=>e.jsx("div",{className:"flex gap-2",children:t.options.map(a=>e.jsxs("button",{onClick:()=>M(m=>({...m,[t.axis]:a.label})),className:`flex-1 h-16 rounded-2xl font-bold transition-all flex flex-col items-center justify-center ${i[t.axis]===a.label?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[e.jsx("span",{className:"text-lg",children:a.label}),e.jsx("span",{className:"text-xs font-normal opacity-80",children:a.desc})]},a.label))},t.axis)),Object.keys(i).length===4&&e.jsx(b.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},className:"text-center mt-4",children:e.jsxs("span",{className:"text-2xl font-bold text-primary",children:[i.EI,i.SN,i.TF,i.JP]})})]})]});case"jobSelect":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:q.map(t=>e.jsxs("button",{onClick:()=>n({...s,job:t.id}),className:`h-20 rounded-2xl text-base font-bold transition-all flex flex-col items-center justify-center gap-1 ${s.job===t.id?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[e.jsx("span",{className:"text-xl",children:t.emoji}),t.label]},t.id))})]});case"singerSelect":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-4 max-h-[40vh] overflow-y-auto",children:W.map(t=>e.jsxs("button",{onClick:()=>{n({...s,singer:t.label}),$("")},className:`h-20 rounded-2xl text-sm font-bold transition-all flex flex-col items-center justify-center gap-1 ${s.singer===t.label?"bg-primary text-primary-foreground":"bg-muted text-secondary-foreground active:scale-[0.97]"}`,children:[e.jsx("span",{className:"text-xl",children:t.emoji}),t.label]},t.id))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"목록에 없나요? 직접 입력하세요"}),e.jsx("input",{type:"text",className:"toss-input",placeholder:"가수 이름 입력",value:D,onChange:t=>{$(t.target.value),n({...s,singer:t.target.value})},onFocus:()=>n({...s,singer:D})})]})]});case"photoUpload":return e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-bold text-foreground mb-2",children:r.title}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:r.description}),k?e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"relative w-48 h-48 mx-auto rounded-2xl overflow-hidden border-2 border-primary",children:e.jsx("img",{src:k,alt:"미리보기",className:"w-full h-full object-cover"})}),e.jsx("button",{className:"mt-3 w-full h-12 rounded-2xl bg-muted text-secondary-foreground font-medium text-sm active:scale-[0.97] transition-transform",onClick:()=>{T(null),n({...s,photoHash:""})},children:"다시 선택하기"})]}):e.jsxs("label",{className:"block cursor-pointer",children:[e.jsxs("div",{className:"w-full h-48 rounded-2xl border-2 border-dashed border-muted-foreground/30 flex flex-col items-center justify-center gap-3 bg-muted active:scale-[0.98] transition-transform",children:[e.jsx("span",{className:"text-5xl",children:"📷"}),e.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:"사진 촬영 또는 갤러리에서 선택"})]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>{var m;const a=(m=t.target.files)==null?void 0:m[0];if(a){const g=URL.createObjectURL(a);T(g);const P=`${a.name}-${a.size}-${a.lastModified}`;let h=0;for(let j=0;j<P.length;j++)h=P.charCodeAt(j)+((h<<5)-h);n({...s,photoHash:String(Math.abs(h))})}}})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-5 p-3 bg-destructive/10 rounded-2xl",children:[e.jsx("span",{className:"text-lg",children:"🔒"}),e.jsx("p",{className:"text-sm text-destructive font-semibold",children:"사진은 절대 저장되지 않습니다"})]})]});default:return null}};return e.jsx(_,{children:e.jsxs("div",{className:"flex flex-col h-[100dvh]",children:[e.jsxs("div",{className:"px-5 pt-4 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("button",{onClick:V,className:"p-1 -ml-1 active:scale-90 transition-transform",children:e.jsx(te,{size:24,className:"text-foreground"})}),e.jsx("span",{className:"text-lg font-bold text-foreground",children:u.label})]}),e.jsx("div",{className:"flex gap-1.5",children:Array.from({length:p}).map((r,t)=>e.jsx("div",{className:"flex-1 h-1 rounded-full overflow-hidden bg-muted",children:e.jsx(b.div,{className:"h-full rounded-full bg-primary",initial:{width:0}
1,animate:{width:t<=l?"100%":"0%"},transition:{duration:.3}})},t))})]}),e.jsx("div",{className:"px-5 pt-4 overflow-y-auto",children:e.jsx(B,{mode:"wait",custom:S,children:e.jsx(b.div,{custom:S,variants:se,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:300,damping:30},children:H(d)},l)})}),e.jsx("div",{className:"shrink-0 px-5 pb-6 pt-3",children:e.jsx("button",{className:`toss-button ${C?"":"opacity-40 pointer-events-none"}`,onClick:L,disabled:!C,children:l===p-1?"결과 보기":"다음"})})]})})};export{ce 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.