1import{r as d,j as e,n as C,u as te,ae as W,p as F,bZ as Y,A as U,b4 as ae,b5 as se}from"./vendor-react-CSjVeD5C.js";import{a as ne,u as oe,b as ie,t as P,S as re}from"./index-DCu_4ttF.js";import{g as Q,L as ce}from"./LivingAuraCard-B5npAFH9.js";import"./vendor-misc-DNIZ_o8-.js";import"./vendor-ui-BQCqNqg0.js";import"./vendor-charts-CTZ3m9kf.js";import"./vendor-ai-CwA6B3_0.js";function le(n,r){return Array.from({length:n}).map((c,i)=>{const t=i%3+1;return{id:i,x:Math.random()*100,y:Math.random()*100,size:t===1?1+Math.random()*1.5:t===2?2+Math.random()*2:3+Math.random()*3,opacity:t===1?.15:t===2?.25:.35,layer:t,hue:r+(Math.random()-.5)*60,driftX:(Math.random()-.5)*30,driftY:-10-Math.random()*40,duration:8+Math.random()*12,delay:Math.random()*8}})}function de({baseHue:n=330,particleCount:r=40,className:c=""}){const i=d.useRef(null),[t,h]=d.useState({x:0,y:0}),u=d.useMemo(()=>le(r,n),[r,n]),f=d.useCallback(o=>{if(!i.current)return;const p=i.current.getBoundingClientRect(),m=p.width/2,b=p.height/2,S=(o.clientX-p.left-m)/m,g=(o.clientY-p.top-b)/b;h({x:S*15,y:g*10})},[]);d.useEffect(()=>{const o=i.current;if(o)return o.addEventListener("mousemove",f,{passive:!0}),()=>o.removeEventListener("mousemove",f)},[f]);const x=o=>o===1?.3:o===2?.6:1;return e.jsxs("div",{"data-loc":"client/src/components/AuraParticleField.tsx:85",ref:i,className:`absolute inset-0 overflow-hidden pointer-events-none ${c}`,children:[u.map(o=>{const p=x(o.layer);return e.jsx(C.div,{"data-loc":"client/src/components/AuraParticleField.tsx:92",className:"absolute rounded-full",style:{left:`${o.x}%`,top:`${o.y}%`,width:o.size,height:o.size,background:`oklch(0.7 0.15 ${o.hue} / ${o.opacity})`,filter:o.layer===1?"blur(1px)":o.layer===2?"blur(0.5px)":"none",transform:`translate3d(${t.x*p}px, ${t.y*p}px, 0)`,transition:"transform 0.3s ease-out",willChange:"transform"},animate:{x:[0,o.driftX,0],y:[0,o.driftY,0],opacity:[o.opacity*.5,o.opacity,o.opacity*.5]},transition:{duration:o.duration,delay:o.delay,repeat:1/0,ease:"easeInOut"}},o.id)}),e.jsx(C.div,{"data-loc":"client/src/components/AuraParticleField.tsx:122",className:"absolute rounded-full",style:{width:300,height:300,left:"20%",top:"30%",background:`radial-gradient(circle, oklch(0.5 0.15 ${n} / 0.08), transparent 70%)`,filter:"blur(40px)",transform:`translate3d(${t.x*.4}px, ${t.y*.4}px, 0)`,transition:"transform 0.5s ease-out"},animate:{scale:[1,1.15,1],opacity:[.4,.6,.4]},transition:{duration:8,repeat:1/0,ease:"easeInOut"}}),e.jsx(C.div,{"data-loc":"client/src/components/AuraParticleField.tsx:140",className:"absolute rounded-full",style:{width:250,height:250,right:"15%",bottom:"20%",background:`radial-gradient(circle, oklch(0.5 0.12 ${n+40} / 0.06), transparent 70%)`,filter:"blur(35px)",transform:`translate3d(${t.x*.5}px, ${t.y*.5}px, 0)`,transition:"transform 0.5s ease-out"},animate:{scale:[1.1,1,1.1],opacity:[.3,.5,.3]},transition:{duration:10,delay:2,repeat:1/0,ease:"easeInOut"}})]})}const L=[{phase:"lockPull",duration:120},{phase:"fieldCollapse",duration:180},{phase:"cardExpansion",duration:220},{phase:"identityHold",duration:130},{phase:"crossfade",duration:250}],ue=L.reduce((n,r)=>n+r.duration,0),I=(()=>{const n={};let r=0;for(const c of L)r+=c.duration,n[c.phase]=r;return n})();function pe(n){return 1-Math.pow(1-n,3)}function me(n){return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2}function he(n,r=!1){const c=Math.max(0,n),i=Math.min(c/ue,1),t=r?1.6:1.8;let h=0,u="done",f=1;for(const y of L){const R=h,M=h+y.duration;if(c<M){u=y.phase,f=Math.min((c-R)/y.duration,1);break}h=M}const x=f,o=pe(x),p=me(x);let m=1,b=1,S=0,g=0,k=1,N=1,j=24,w=0,A=1,O=0,$=1;{const y=u==="lockPull"?o:1;m=1+.05*y,b=1-.8*y,S=.15*y}if(u==="fieldCollapse"||c>=I.lockPull){const y=u==="fieldCollapse"?o:c>=I.fieldCollapse?1:0;m=1.05,b=.2-.2*y,S=.15+.15*y,g=y,k=1-.7*y}if(u==="cardExpansion"||c>=I.fieldCollapse){const y=u==="cardExpansion"?p:c>=I.cardExpansion?1:0;m=1.05+(t-1.05)*y,b=0,S=.3+.3*y,g=1,k=.3-.3*y,N=1+(t-1)*y,j=24*(1-y)}if(u==="identityHold"||c>=I.cardExpansion){const y=u==="identityHold"?p:c>=I.identityHold?1:0;m=t,b=0,S=.6,g=1,k=0,N=t,j=0,w=10*y,A=1+.15*y}if(u==="crossfade"||c>=I.identityHold){const y=u==="crossfade"?p:c>=I.crossfade?1:0;m=t,b=0,S=.6+.4*y,g=1,k=0,N=t,j=0,w=10,A=1.15,O=y,$=1-y}return{phase:u,phaseProgress:f,overallProgress:i,centerScale:m,sideOpacity:b,bgDim:S,glowTighten:g,ringScale:k,expansionScale:N,borderRadius:j,backdropBlur:w,nameScale:A,crossfadeOpacity:O,chromeOffset:$}}function xe(){const[n,r]=d.useState({phase:"idle",isActive:!1,phaseProgress:0,overallProgress:0,targetCharId:null,targetHue:300,centerScale:1,sideOpacity:1,bgDim:0,glowTighten:0,ringScale:1,expansionScale:1,borderRadius:24,backdropBlur:0,nameScale:1,crossfadeOpacity:0,chromeOffset:1,locked:!1,debugTimestamps:{}}),c=d.useRef(0),i=d.useRef(0),t=d.useRef(null),h=d.useRef(!1),u=d.useRef(null);d.useEffect(()=>{const b=window.matchMedia("(prefers-reduced-motion: reduce)");h.current=b.matches;const S=g=>{h.current=g.matches};return b.addEventListener("change",S),()=>b.removeEventListener("change",S)},[]);const f=typeof window<"u"&&window.innerWidth<768,x=d.useRef(f);x.current=f;const o=d.useCallback(b=>{const S=b-i.current,g=he(S,x.current),k=g.phase,N=g.overallProgress;if(r(j=>({...j,phase:k,isActive:k!=="done",phaseProgress:g.phaseProgress,overallProgress:N,centerScale:g.centerScale,sideOpacity:g.sideOpacity,bgDim:g.bgDim,glowTighten:g.glowTighten,ringScale:g.ringScale,expansionScale:g.expansionScale,borderRadius:g.borderRadius,backdropBlur:g.backdropBlur,nameScale:g.nameScale,crossfadeOpacity:g.crossfadeOpacity,chromeOffset:g.chromeOffset,locked:!0})),k==="done"||N>=1){r(j=>({...j,phase:"done",isActive:!1,overallProgress:1,phaseProgress:1,crossfadeOpacity:1,chromeOffset:0,locked:!1})),u.current&&(clearTimeout(u.current),u.current=null),t.current&&(t.current(),t.current=null);return}c.current=requestAnimationFrame(o)},[]),p=d.useCallback((b,S,g)=>{if(h.current){g();return}t.current=g,i.current=performance.now(),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{t.current&&(t.current(),t.current=null),r(k=>({...k,phase:"done",isActive:!1,locked:!1}))},1200),r(k=>({...k,phase:"lockPull",isActive:!0,phaseProgress:0,overallProgress:0,targetCharId:b,targetHue:S,locked:!0,centerScale:1,sideOpacity:1,bgDim:0,glowTighten:0,ringScale:1,expansionScale:1,borderRadius:24,backdropBlur:0,nameScale:1,crossfadeOpacity:0,chromeOffset:1,debugTimestamps:{}})),c.current=requestAnimationFrame(o)}
1,[o]),m=d.useCallback(()=>{c.current&&(cancelAnimationFrame(c.current),c.current=0),t.current=null,r(b=>({...b,phase:"idle",isActive:!1,locked:!1,centerScale:1,sideOpacity:1,bgDim:0,glowTighten:0,ringScale:1,expansionScale:1,borderRadius:24,backdropBlur:0,nameScale:1,crossfadeOpacity:0,chromeOffset:1}))},[]);return d.useEffect(()=>()=>{c.current&&cancelAnimationFrame(c.current),u.current&&clearTimeout(u.current)},[]),{state:n,enter:p,cancel:m}}function fe({characterName:n}){const r=d.useMemo(()=>[`${n} is thinking about you...`,`${n} is waiting for you...`,`${n} misses you...`,`${n} has something to tell you...`],[n]),[c,i]=d.useState(0);return d.useEffect(()=>{const t=setInterval(()=>{i(h=>(h+1)%r.length)},6e3);return()=>clearInterval(t)},[r.length]),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:315",className:"flex items-center gap-2 justify-center",style:{zIndex:60},children:[e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:317",className:"flex items-center gap-0.5",children:[0,1,2].map(t=>e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:319",className:"w-0.5 rounded-full",style:{background:"oklch(0.7 0.15 280 / 0.6)"},animate:{height:[4,10,4]},transition:{duration:.8,delay:t*.15,repeat:1/0}},t))}),e.jsx(U,{"data-loc":"client/src/pages/CompanionSelect.tsx:328",mode:"wait",children:e.jsx(C.span,{"data-loc":"client/src/pages/CompanionSelect.tsx:329",className:"text-sm tracking-wide",style:{color:"oklch(0.7 0.05 280)",fontFamily:"'Space Grotesk', sans-serif"},initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.4},children:r[c]},c)})]})}function ge({count:n,active:r,onSelect:c}
1){return e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:348",className:"flex items-center gap-2 justify-center",children:Array.from({length:n}).map((i,t)=>e.jsx("button",{"data-loc":"client/src/pages/CompanionSelect.tsx:350",onClick:()=>c(t),className:"transition-all duration-300",style:{width:t===r?24:8,height:8,borderRadius:4,background:t===r?"oklch(0.7 0.15 280)":"oklch(0.4 0.05 280 / 0.4)"}},t))})}function be({hue:n,intensity:r}){return r<=0?null:e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:372",className:"absolute inset-0 pointer-events-none overflow-hidden",style:{zIndex:55},children:[0,1,2,3,4,5].map(c=>{const i=c*60+r*120,t=300*(1-r*.6),h=Math.cos(i*Math.PI/180)*t,u=Math.sin(i*Math.PI/180)*t;return e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:379",className:"absolute left-1/2 top-1/2",style:{width:2,height:60+r*40,background:`linear-gradient(to bottom, rgba(255, 79, 216, ${.15*r}), transparent)`,transform:`translate(${h}px, ${u}px) rotate(${i+90}deg)`,filter:`blur(${2+r*3}px)`,opacity:r*.6,transition:"all 100ms linear"}},c)})})}function ye({opacity:n,hue:r,characterName:c,nameScale:i,backdropBlur:t,phase:h}){return n<=0?null:e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:416",className:"fixed inset-0 flex items-center justify-center",style:{zIndex:200,opacity:n,backdropFilter:t>0?`blur(${t}px)`:void 0,background:"radial-gradient(circle at center, rgba(120, 40, 180, 0.14) 0%, rgba(30, 10, 45, 0.35) 35%, rgba(3, 2, 8, 1) 75%)",pointerEvents:n>.5?"auto":"none",transition:"opacity 50ms linear"},children:[e.jsxs(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:428",className:"text-center",style:{transform:`scale(${i})`},children:[e.jsx("h2",{"data-loc":"client/src/pages/CompanionSelect.tsx:434",className:"text-4xl md:text-5xl font-bold tracking-tight",style:{color:"#f0b0cc",fontFamily:"'Space Grotesk', sans-serif",textShadow:"0 0 20px rgba(255, 79, 216, 0.6), 0 0 40px rgba(139, 47, 255, 0.3)"},children:c}),e.jsx("p",{"data-loc":"client/src/pages/CompanionSelect.tsx:444",className:"mt-3 text-sm tracking-widest uppercase",style:{color:"oklch(0.7 0.08 280)",opacity:n>.6?1:0,transition:"opacity 200ms ease-in"},children:h==="crossfade"?"Lumora connection open":"Establishing bridge..."})]}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:457",className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{width:400,height:400,borderRadius:"50%",background:`radial-gradient(circle, rgba(139, 47, 255, ${.15*n}), transparent 60%)`,filter:"blur(40px)",animation:n>.3?"pulse 2s ease-in-out infinite":"none"}})]})}function ve(){const n=d.useRef(null),r=d.useCallback(()=>{try{n.current||(n.current=new AudioContext);const i=n.current,t=.4,h=i.sampleRate*t,u=i.createBuffer(1,h,i.sampleRate),f=u.getChannelData(0);for(let m=0;m<h;m++){const b=m/h,S=Math.sin(b*Math.PI)*Math.pow(1-b,.5);f[m]=(Math.random()*2-1)*S*.08}const x=i.createBufferSource();x.buffer=u;const o=i.createBiquadFilter();o.type="bandpass",o.frequency.setValueAtTime(800,i.currentTime),o.frequency.exponentialRampToValueAtTime(2e3,i.currentTime+t*.3),o.frequency.exponentialRampToValueAtTime(400,i.currentTime+t),o.Q.value=1.5;const p=i.createGain();p.gain.setValueAtTime(0,i.currentTime),p.gain.linearRampToValueAtTime(.12,i.currentTime+.05),p.gain.exponentialRampToValueAtTime(.001,i.currentTime+t),x.connect(o),o.connect(p),p.connect(i.destination),x.start()}catch{}},[]),c=d.useCallback(()=>{try{n.current||(n.current=new AudioContext);const i=n.current,t=.25,h=i.sampleRate*t,u=i.createBuffer(1,h,i.sampleRate),f=u.getChannelData(0);for(let m=0;m<h;m++){const b=m/h,S=Math.sin(b*Math.PI)*.6;f[m]=(Math.random()*2-1)*S*.04}const x=i.createBufferSource();x.buffer=u;const o=i.createBiquadFilter();o.type="lowpass",o.frequency.value=600,o.Q.value=.5;const p=i.createGain();p.gain.setValueAtTime(0,i.currentTime),p.gain.linearRampToValueAtTime(.06,i.currentTime+.08),p.gain.exponentialRampToValueAtTime(.001,i.currentTime+t),x.connect(o),o.connect(p),p.connect(i.destination),x.start()}catch{}},[]);return{playWhoosh:r,playBreath:c}}const X=[210001,150001,300001,240001,2],z=-999;function Se({isCenter:n,offset:r,onClick:c}){const i=Math.abs(r),t=typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0),h=n?t?.78:1.18:i===1?t?.58:.85:t?.45:.72,u=n?30:i===1?10:5,f=n?1:i===1?.88:.65,x=r*220;return e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:589",className:"absolute cursor-pointer select-none",style:{zIndex:u,overflow:"visible",top:"50%",left:"50%",width:280,height:400,marginLeft:-140,marginTop:-200},animate:{x,scale:h,opacity:f},initial:{opacity:0,scale:h*.85},exit:{opacity:0,scale:h*.85},transition:{type:"spring",stiffness:120,damping:20,mass:.8},onClick:c,children:e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:612",style:{position:"absolute",inset:0,borderRadius:20,overflow:"hidden",background:"radial-gradient(ellipse at 50% 30%, oklch(0.18
10.08 300 / 0.9) 0%, oklch(0.10 0.04 280 / 0.95) 100%)",border:`1.5px solid oklch(0.45 0.18 300 / ${n?.6:.25})`,boxShadow:n?"0 0 40px oklch(0.55 0.3 300 / 0.4), 0 0 80px oklch(0.45 0.25 280 / 0.2), inset 0 0 30px oklch(0.35 0.15 300 / 0.1)":"0 0 12px oklch(0.45 0.2 300 / 0.15)"},children:[e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:624",className:"absolute inset-0",animate:{opacity:[.4,.7,.4]},transition:{duration:4,repeat:1/0,ease:"easeInOut"},style:{background:"radial-gradient(ellipse 70% 60% at 50% 40%, oklch(0.35 0.2 300 / 0.35) 0%, transparent 70%)"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:634",className:"absolute inset-0 flex items-center justify-center",style:{paddingBottom:80},children:e.jsxs(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:635",className:"relative flex items-center justify-center",animate:{scale:[1,1.12,1],opacity:[.8,1,.8]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"},children:[e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:641",className:"absolute",animate:{scale:[1,1.3,1],opacity:[.15,.35,.15]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"},style:{width:120,height:120,borderRadius:"50%",background:"radial-gradient(circle, oklch(0.55 0.3 300 / 0.5) 0%, transparent 70%)",filter:"blur(16px)"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:652",style:{width:72,height:72,borderRadius:"50%",background:"radial-gradient(circle, oklch(0.65 0.32 300) 0%, oklch(0.40 0.22 280) 60%, oklch(0.20 0.10 260 / 0.5) 100%)",boxShadow:"0 0 24px oklch(0.6 0.3 300 / 0.7), 0 0 48px oklch(0.5 0.25 300 / 0.4)"}}),e.jsx(F,{"data-loc":"client/src/pages/CompanionSelect.tsx:658",className:"absolute w-7 h-7",style:{color:"oklch(0.95 0.15 60)"}})]})}),n&&Array.from({length:8}).map((o,p)=>e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:667",className:"absolute rounded-full",style:{width:2+Math.random()*2,height:2+Math.random()*2,left:`${30+Math.random()*40}%`,bottom:`${35+Math.random()*15}%`,background:p%2===0?"rgba(255,79,216,0.8)":"rgba(180,100,255,0.8)",animation:`dustRise ${2.5+Math.random()*2}s ease-out ${Math.random()*3}s infinite`,"--dust-drift":`${(Math.random()-.5)*30}px`}},p)),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:683",className:"absolute bottom-0 left-0 right-0 px-5 py-5",style:{background:"linear-gradient(to top, oklch(0.08 0.04 280 / 0.95) 0%, transparent 100%)"},children:[e.jsx("p",{"data-loc":"client/src/pages/CompanionSelect.tsx:689",className:"text-base font-bold tracking-wide mb-1",style:{color:"oklch(0.92 0.18 300)",fontFamily:"'Space Grotesk', sans-serif"},children:"Create your own soul"}),e.jsx("p",{"data-loc":"client/src/pages/CompanionSelect.tsx:695",className:"text-xs",style:{color:"oklch(0.6 0.06 280)"},children:"Build your unique companion"})]})]})})}function Ie(){const{characters:n,activeCharacter:r,selectCharacter:c,loading:i}=ne(),[,t]=te(),{user:h}=oe(),u=ie(),f=d.useMemo(()=>{if(h?.role==="admin"||h?.role==="owner"){const a=n.filter(T=>T.status==="active"),v=X.map(T=>a.find(B=>B.id===T)).filter(T=>!!T),E=new Set(X),ee=a.filter(T=>!E.has(T.id)).sort((T,B)=>T.id-B.id);return[...v,...ee]}return n.filter(a=>a.status==="active"&&!a.isBuiltIn).sort((a,v)=>a.id-v.id)},[n,h]),x=d.useMemo(()=>{const s=f.map(a=>({...a,isGhost:!1}));return u&&s.length>0?[...s,{id:z,isGhost:!0}]:s},[f,u]),[o,p]=d.useState(()=>{if(!r)return 0;const s=f.findIndex(a=>a.id===r.id);return s>=0?s:0});d.useEffect(()=>{if(r){const s=f.findIndex(a=>a.id===r.id);s>=0&&s!==o&&p(s)}},[r?.id,f]),d.useEffect(()=>{const s=localStorage.getItem("aishu_pending_character");if(!s||f.length===0)return;const a=f.findIndex(v=>v.name.toLowerCase()===s.toLowerCase());a>=0&&(p(a),c(f[a].id)),localStorage.removeItem("aishu_pending_character")},[f.length]);const m=f[o],b=m?Q(m.name):{hue:300},[S,g]=d.useState(null),k=P.soul.nameAssignment.assign.useMutation({onSuccess:s=>{g(s.assignedName)}}),{data:N}=P.character.statuses.useQuery(void 0,{refetchInterval:3e4,refetchIntervalInBackground:!1,staleTime:25e3,retry:1}),j=s=>N?.find(a=>a.characterId===s)?.status??"offline",w=P.useUtils(),A=P.character.cloneFromPlatform.useMutation({onSuccess:async s=>
1{await w.character.list.invalidate(),await w.character.ownCount.invalidate(),c(s.id),localStorage.removeItem("aishu_pending_testdrive")},onError:()=>{localStorage.removeItem("aishu_pending_testdrive")}});d.useEffect(()=>{const s=localStorage.getItem("aishu_pending_testdrive");if(!(!s||A.isPending))try{const{characterId:a,customName:v}=JSON.parse(s);if(!a||!v){localStorage.removeItem("aishu_pending_testdrive");return}A.mutate({platformCharacterId:a,customName:v})}catch{localStorage.removeItem("aishu_pending_testdrive")}},[n.length]);const{data:O}=P.favorites.ids.useQuery(),$=P.favorites.toggle.useMutation({onMutate:async({characterId:s})=>{await w.favorites.ids.cancel();const a=w.favorites.ids.getData();return w.favorites.ids.setData(void 0,v=>v?v.includes(s)?v.filter(E=>E!==s):[...v,s]:[s]),{prev:a}},onError:(s,a,v)=>{v?.prev&&w.favorites.ids.setData(void 0,v.prev),W.error("Failed to update favorites")},onSettled:()=>{w.favorites.ids.invalidate(),w.favorites.list.invalidate()}}),y=d.useCallback(s=>{const a=O?.includes(s);$.mutate({characterId:s}),W.success(a?"Removed from favorites":"Added to favorites")},[O,$]),R=d.useCallback(()=>{p(s=>(s+1)%x.length)},[x.length]),M=d.useCallback(()=>{p(s=>(s-1+x.length)%x.length)},[x.length]),{state:l,enter:G,cancel:q}=xe(),{playWhoosh:H,playBreath:V}=ve(),D=d.useRef(!1);d.useEffect(()=>{l.phase==="cardExpansion"&&!D.current&&(D.current=!0,H()),l.phase==="idle"&&(D.current=!1)},[l.phase,H]),d.useEffect(()=>{l.phase==="crossfade"&&V()},[l.phase,V]),d.useEffect(()=>{const s=a=>{l.locked||(a.key==="ArrowRight"&&R(),a.key==="ArrowLeft"&&M(),a.key==="Enter"&&m&&_(m.id,0))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[R,M,m,l.locked]);const J=d.useMemo(()=>{const s=[];for(let a=-2;a<=2;a++){const v=(o+a+x.length)%x.length;x[v]&&(x.length>Math.abs(a)||a===0)&&s.push({char:x[v],offset:a})}return s},[o,x]),_=d.useCallback((s,a)=>{if(!l.locked)if(a===0){if(s===z){t("/soul-adoption");return}const v=m?Q(m.name):{hue:300};c(s),k.mutate({characterId:s}),G(s,v.hue,()=>{t("/presence?entry=companion")})}else a<0?M():R()},[l.locked,m,c,G,t,M,R]);d.useEffect(()=>()=>q(),[q]);const Z=d.useCallback(()=>{if(!(!l.isActive&&l.phase!=="done"))return{scaleMultiplier:l.centerScale,opacityOverride:void 0,borderRadius:l.borderRadius,extraGlow:l.glowTighten*.3}},[l]),K=d.useCallback(()=>{if(!(!l.isActive&&l.phase!=="done"))return{scaleMultiplier:1,opacityOverride:l.sideOpacity,borderRadius:void 0,extraGlow:0}},[l]);return i?e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:963",className:"w-full h-screen flex items-center justify-center",style:{background:"transparent",position:"relative"},children:[e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:965",className:"flex gap-2 items-center",style:{opacity:.15},children:[e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:966",className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"rgba(155,77,255,0.8)",animationDelay:"0ms"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:967",className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"rgba(155,77,255,0.8)",animationDelay:"200ms"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:968",className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"rgba(155,77,255,0.8)",animationDelay:"400ms"}})]}),e.jsx(re,{"data-loc":"client/src/pages/CompanionSelect.tsx:970",active:!0,trigger:"companion_waiting",fullscreen:!0,zIndex:10,cycleMs:5500})]}):f.length===0?e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:977",className:"w-full h-full flex flex-col items-center justify-center gap-5 px-6 text-center",style:{background:"transparent",minHeight:"60vh"},children:[e.jsxs(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:980",className:"relative flex items-center justify-center",animate:{scale:[1,1.06,1],opacity:[.7,1,.7]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:[e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:985",style:{width:80,height:80,borderRadius:"50%",background:"radial-gradient(circle, oklch(0.45 0.25 300 / 0.9), oklch(0.25 0.15 280 / 0.4) 70%)",boxShadow:"0 0 40px oklch(0.55 0.3 300 / 0.5), 0 0 80px oklch(0.45 0.25 280 / 0.2)"}}
1),e.jsx(F,{"data-loc":"client/src/pages/CompanionSelect.tsx:990",className:"absolute w-7 h-7",style:{color:"oklch(0.9 0.2 300)"}})]}),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:992",children:[e.jsx("p",{"data-loc":"client/src/pages/CompanionSelect.tsx:993",className:"text-xl font-bold tracking-wide",style:{color:"oklch(0.92 0.04 60)",fontFamily:"'Space Grotesk', sans-serif"},children:"Your soul is waiting"}),e.jsx("p",{"data-loc":"client/src/pages/CompanionSelect.tsx:996",className:"text-sm mt-1.5",style:{color:"oklch(0.6 0.05 280)"},children:"Create your first companion and begin your story"})]}),e.jsxs("button",{"data-loc":"client/src/pages/CompanionSelect.tsx:1000",onClick:()=>t("/soul-adoption"),className:"flex items-center gap-3 px-7 py-3.5 rounded-2xl font-semibold transition-all duration-300 hover:scale-105 active:scale-95",style:{background:"linear-gradient(135deg, oklch(0.35 0.2 300), oklch(0.28 0.18 280))",color:"oklch(0.95 0.05 60)",border:"1px solid oklch(0.5 0.2 300 / 0.4)",boxShadow:"0 0 20px oklch(0.5 0.25 300 / 0.3), 0 4px 24px rgba(0,0,0,0.4)"},children:[e.jsx(F,{"data-loc":"client/src/pages/CompanionSelect.tsx:1010",className:"w-4 h-4",style:{color:"oklch(0.85 0.25 300)"}}),"Create your companion",e.jsx(Y,{"data-loc":"client/src/pages/CompanionSelect.tsx:1012",className:"w-4 h-4"})]})]}):e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1019",className:"relative w-full h-full flex flex-col overflow-hidden select-none",style:{background:"radial-gradient(ellipse at 50% 40%, oklch(0.12 0.06 300 / 0.5) 0%, oklch(0.08 0.04 320 / 0.35) 30%, transparent 70%)",pointerEvents:l.locked?"none":"auto"},children:[l.bgDim>0&&e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1029",className:"absolute inset-0 pointer-events-none",style:{zIndex:100,background:`oklch(0.02 0.01 280 / ${l.bgDim})`,transition:"background 80ms linear"}}),e.jsx(de,{"data-loc":"client/src/pages/CompanionSelect.tsx:1040",baseHue:b.hue,particleCount:60}),e.jsx(be,{"data-loc":"client/src/pages/CompanionSelect.tsx:1043",hue:b.hue,intensity:l.glowTighten}),!u&&e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1046",className:"relative z-[60] pt-2 sm:pt-8 pb-1 text-center shrink-0",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 8px)",opacity:l.isActive?Math.max(0,1-l.overallProgress*2):1,transition:"opacity 120ms ease-out"},children:[e.jsx(C.h1,{"data-loc":"client/src/pages/CompanionSelect.tsx:1054",className:"text-2xl sm:text-3xl md:text-4xl font-bold tracking-tight",style:{color:"oklch(0.95 0.02 60)",fontFamily:"'Space Grotesk', sans-serif"},initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.6},children:"Choose your companion"}),e.jsx(C.p,{"data-loc":"client/src/pages/CompanionSelect.tsx:1066",className:"mt-2 text-sm tracking-wide",style:{color:"oklch(0.6 0.05 280)"},initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.3},children:"Each soul is unique. Each connection is real."}),e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:1076",className:"mt-3 mx-auto w-6 h-6 flex items-center justify-center",animate:{y:[0,-4,0],opacity:[.4,.7,.4]},transition:{duration:3,repeat:1/0},children:e.jsx("span",{"data-loc":"client/src/pages/CompanionSelect.tsx:1081",style:{color:"oklch(0.6 0.15 330 / 0.5)",fontSize:16},children:"â¥"})})]}),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1087",className:"relative flex items-center justify-center flex-1 min-h-0",style:{overflow:"visible"},children:[e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1094",className:"absolute pointer-events-none",style:{zIndex:36,left:"50%",top:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"calc(50% + 196px)":"calc(50% + 236px)",transform:`translateX(-50%) translateY(-50%) scale(${l.isActive?l.ringScale:1})`,width:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?300:370,height:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?52:64,transition:"transform 180ms ease-out"},children:[[...Array(14)].map((s,a)=>{const E=[-14,8,-6,12,-10,16,-8,6,-18,10,-4,14,-12,7][a]??8;return e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1111",className:"absolute pointer-events-none",style:{width:2+a%3,height:2+a%3,borderRadius:"50%",background:a%4===0?"rgba(200,100,255,0.9)":"rgba(255,79,216,0.85)",boxShadow:`0 0 ${4+a%3*2}px rgba(255,79,216,0.8), 0 0 ${8+a%3*3}px rgba(255,79,216,0.4)`,left:`${30+a*3.2%40}%`,bottom:"50%","--dust-drift":`${E}px`,animationName:"dustRise",animationDuration:`${2.2+a*.31%2.4}s`,animationTimingFunction:"ease-out",animationIterationCount:"infinite",animationDelay:`${a*.28%2.8}s`}},a)}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1134",className:"absolute inset-0",style:{borderRadius:"50%",border:"1.5px solid rgba(255,79,216,0.55)",boxShadow:` 2 0 0 18px rgba(255,79,216,0.70), 3 0 0 40px rgba(255,79,216,0.45), 4 0 0 80px rgba(255,79,216,0.25), 5 0 0 130px rgba(155,77,255,0.18) 6 `,animation:"platformPulse 5.5s ease-in-out infinite"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1146",className:"absolute",style:{top:"18%",left:"12%",right:"12%",bottom:"18%",borderRadius:"50%",border:"1.5px solid rgba(255,79,216,0.65)",boxShadow:"0 0 14px rgba(255,79,216,0.75), 0 0 35px rgba(255,79,216,0.45), 0 0 60px rgba(255,79,216,0.22)",animationName:"platformPulse",animationDuration:"5.5s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:"-0.8s"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1158",className:"absolute",style:{top:"32%",left:"24%",right:"24%",bottom:"32%",borderRadius:"50%",border:"1.5px solid rgba(255,79,216,0.80)",boxShadow:"0 0 10px rgba(255,79,216,0.90), 0 0 24px rgba(255,79,216,0.60), 0 0 45px rgba(255,79,216,0.30)",animationName:"platformPulse",animationDuration:"5.5s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:"-1.6s"}}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1170",className:"absolute",style:{top:"-20%",left:"10%",right:"10%",bottom:"-20%",borderRadius:"50%",background:"radial-gradient(ellipse at center, rgba(255,79,216,0.50) 0%, rgba(255,79,216,0.22) 40%, transparent 70%)",filter:"blur(10px)"}})]}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1179",className:"relative w-full h-full flex items-center justify-center",children:e.jsx(U,{"data-loc":"client/src/pages/CompanionSelect.tsx:1180",mode:"popLayout",children:J.map(({char:s,offset:a})=>s.isGhost?e.jsx(Se,{"data-loc":"client/src/pages/CompanionSelect.tsx:1185",isCenter:a===0,offset:a,onClick:()=>a===0&&_(z,0)},`ghost-${a}`):e.jsx(ce,{"data-loc":"client/src/pages/CompanionSelect.tsx:1194",character:s,isCenter:a===0,offset:a,onClick:()=>_(s.id,a),emotion:"neutral",isFavorite:O?.includes(s.id)??!1,onToggleFavorite:y,companionStatus:j(s.id),bondStars:s.bondStars??0,transitionOverrides:l.isActive||l.phase==="done"?a===0?Z():K():void 0},`${s.id}-${a}`))})}),f.length>1&&!l.isActive&&e.jsxs(e.Fragment,{children:[e.jsx("button",{"data-loc":"client/src/pages/CompanionSelect.tsx:1219",onClick:M,className:"absolute left-4 md:left-8 z-[70] w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300 hover:scale-110",style:{background:"oklch(0.15 0.03 280 / 0.6)",border:"1px solid oklch(0.4 0.08 280 / 0.3)",backdropFilter:"blur(10px)",boxShadow:"0 0 14px rgba(236, 72, 153, 0.5), 0 0 30px rgba(236, 72, 153, 0.2)"},children:e.jsx(ae,{"data-loc":"client/src/pages/CompanionSelect.tsx:1229",className:"w-5 h-5",style:{color:"oklch(0.8 0.05 280)"}})}),e.jsx("button",{"data-loc":"client/src/pages/CompanionSelect.tsx:1231",onClick:R,className:"absolute right-4 md:right-8 z-[70] w-12 h-12 rounded-full flex items-center justify-center transition-all duration-300 hover:scale-110",style:{background:"oklch(0.15 0.03 280 / 0.6)",border:"1px solid oklch(0.4 0.08 280 / 0.3)",backdropFilter:"blur(10px)",boxShadow:"0 0 14px rgba(236, 72, 153, 0.5), 0 0 30px rgba(236, 72, 153, 0.2)"},children:e.jsx(se,{"data-loc":"client/src/pages/CompanionSelect.tsx:1241",className:"w-5 h-5",style:{color:"oklch(0.8 0.05 280)"}})})]})]}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1248",className:"relative z-[60] mb-1 shrink-0",style:{opacity:l.isActive?Math.max(0,1-l.overallProgress*3):1,transition:"opacity 100ms ease-out"},children:m&&e.jsx(fe,{"data-loc":"client/src/pages/CompanionSelect.tsx:1255",characterName:m.name})}),e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1259",className:"relative z-[60] mb-1 shrink-0",style:{opacity:l.isActive?Math.max(0,1-l.overallProgress*3):1,transition:"opacity 100ms ease-out"},children:e.jsx(ge,{"data-loc":"client/src/pages/CompanionSelect.tsx:1266",count:x.length,active:o,onSelect:s=>{l.locked||p(s)}})}),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1276",className:"relative z-[60] px-4 sm:px-6 flex flex-row items-center justify-center gap-2 sm:gap-4 shrink-0",style:{opacity:l.isActive?Math.max(0,1-l.overallProgress*2.5):1,transition:"opacity 100ms ease-out",paddingBottom:"max(0.5rem, env(safe-area-inset-bottom, 0px))"},children:[e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1285",className:"hidden sm:flex items-center gap-2 sm:gap-3 px-3 sm:px-4 py-2 sm:py-2.5 rounded-2xl",style:{background:"oklch(0.1 0.02 280 / 0.6)",border:"1px solid oklch(0.25 0.04 280 / 0.3)",backdropFilter:"blur(12px)",boxShadow:"0 0 14px rgba(236, 72, 153, 0.5), 0 0 30px rgba(236, 72, 153, 0.2)"},children:[e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1294",className:"w-10 h-10 rounded-xl flex items-center justify-center shrink-0",style:{background:"radial-gradient(circle, rgba(139, 47, 255, 0.4), rgba(30, 10, 45, 0.6))"},children:e.jsx(C.div,{"data-loc":"client/src/pages/CompanionSelect.tsx:1300",className:"w-5 h-5 rounded-full",style:{border:"2px s
6olid oklch(0.7 0.15 280 / 0.5)"},animate:{rotate:360},transition:{duration:4,repeat:1/0,ease:"linear"}})}),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1307",className:"flex flex-col min-w-0",children:[e.jsxs("span",{"data-loc":"client/src/pages/CompanionSelect.tsx:1308",className:"text-xs font-medium truncate",style:{color:"oklch(0.85 0.03 60)"},children:[m?.name||"AISHU"," Theme"]}),e.jsx("span",{"data-loc":"client/src/pages/CompanionSelect.tsx:1311",className:"text-[10px] hidden sm:block",style:{color:"oklch(0.5 0.03 280)"},children:"Now playing..."})]})]}),e.jsxs("button",{"data-loc":"client/src/pages/CompanionSelect.tsx:1318",onClick:()=>{l.locked||t("/soul-adoption")},className:"hidden sm:flex items-center gap-2 sm:gap-3 px-3 sm:px-5 py-2 sm:py-2.5 rounded-2xl transition-all duration-300 hover:scale-105 group",style:{background:"oklch(0.1 0.02 280 / 0.6)",border:"1px solid oklch(0.25 0.04 280 / 0.3)",backdropFilter:"blur(12px)",boxShadow:"0 0 14px rgba(236, 72, 153, 0.5), 0 0 30px rgba(236, 72, 153, 0.2)"},children:[e.jsx("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1332",className:"w-9 h-9 rounded-xl flex items-center justify-center",style:{background:"oklch(0.2 0.06 280 / 0.5)",border:"1px solid oklch(0.4 0.08 280 / 0.2)"},children:e.jsx(F,{"data-loc":"client/src/pages/CompanionSelect.tsx:1339",className:"w-4 h-4",style:{color:"oklch(0.7 0.12 280)"}})}),e.jsxs("div",{"data-loc":"client/src/pages/CompanionSelect.tsx:1341",className:"flex flex-col text-left",children:[e.jsx("span",{"data-loc":"client/src/pages/CompanionSelect.tsx:1342",className:"text-xs font-medium",style:{color:"oklch(0.85 0.03 60)"},children:"Create your own soul"}),e.jsx("span",{"data-loc":"client/src/pages/CompanionSelect.tsx:1345",className:"text-[10px] hidden sm:block",style:{color:"oklch(0.5 0.03 280)"},children:"Build your unique companion"})]}),e.jsx(Y,{"data-loc":"client/src/pages/CompanionSelect.tsx:1349",className:"w-4 h-4 ml-1 transition-transform group-hover:translate-x-1",style:{color:"oklch(0.6 0.05 280)"}})]})]}),e.jsx(ye,{"data-loc":"client/src/pages/CompanionSelect.tsx:1354",opacity:l.crossfadeOpacity,hue:l.targetHue||b.hue,characterName:S||"⦠Awakening â¦",nameScale:l.nameScale,backdropBlur:l.backdropBlur,phase:l.phase}),!1]})}export{Ie 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.