1import{r,u as R,Y as T,al as Y,b as G,j as e,d as o,B as d,_ as v,M as O,x as k,aH as B,ai as h,aA as F,aX as H,O as L}from"./index-fv-DcFj2.js";const V=[{icon:"ð§",text:"Günlük meditasyon rutini oluÅtur"},{icon:"ð¡",text:"Motivasyonumu artırmak için önerilerin neler?"},{icon:"ð",text:"KiÅisel geliÅim için kitap önerir misin?"},{icon:"ð",text:"Stresle baÅa çıkma yöntemleri"}];function D(){var N;const[l,x]=r.useState([]),[i,u]=r.useState(""),[f,m]=r.useState(!1),[y,S]=r.useState([]),[C,p]=r.useState(null),j=r.useRef(null),n=r.useRef(null),{toast:E}=R(),{user:s,isAuthenticated:M}=T(),[,z]=Y(),P=()=>{var t;(t=j.current)==null||t.scrollIntoView({behavior:"smooth"})};r.useEffect(()=>{P()},[l]),r.useEffect(()=>{n.current&&(n.current.style.height="auto",n.current.style.height=Math.min(n.current.scrollHeight,200)+"px")},[i]);const c=G({mutationFn:async t=>(await L("POST","/api/ai-consultant/chat",{message:t,category:"genel",context:s!=null&&s.fullName?`Kullanıcı: ${s.fullName}`:void 0})).data,onSuccess:t=>{const a={id:Date.now().toString()+"_ai",role:"assistant",content:(t==null?void 0:t.response)||(t==null?void 0:t.message)||"Yanıt alınamadı",timestamp:new Date};x(g=>[...g,a])},onError:t=>{E({title:"Hata",description:t.message||"Bir hata oluÅtu. Lütfen tekrar deneyin.",variant:"destructive"})}}),b=()=>{if(!i.trim()||c.isPending)return;const t={id:Date.now().toString()+"_user",role:"user",content:i.trim(),timestamp:new Date};x(a=>[...a,t]),c.mutate(i.trim()),u(""),n.current&&(n.current.style.height="auto")},A=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),b())},I=t=>{var a;u(t),(a=n.current)==null||a.focus()},w=()=>{var t;if(l.length>0){const a={id:Date.now().toString(),title:((t=l[0])==null?void 0:t.content.slice(0,30))+"..."||"Yeni Sohbet",createdAt:new Date,messages:[...l]};S(g=>[a,...g])}x([]),p(null),m(!1)},K=t=>{x(t.messages),p(t.id),m(!1)};return e.jsxs("div",{className:"flex h-screen bg-gray-900 text-white overflow-hidden",children:[f&&e.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:()=>m(!1)}),e.jsxs("aside",{className:o("fixed lg:static inset-y-0 left-0 z-50 w-[280px] bg-gray-950 border-r border-gray-800 flex flex-col transition-transform duration-300",f?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"p-3 border-b border-gray-800",children:e.jsxs(d,{onClick:w,className:"w-full justify-start gap-3 bg-transparent hover:bg-gray-800 text-white border border-gray-700 h-11",children:[e.jsx(v,{className:"w-4 h-4"}),"Yeni Sohbet"]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:y.length===0?e.jsx("div",{className:"p-4 text-center text-gray-500 text-sm",children:"Henüz sohbet yok"}):y.map(t=>e.jsxs("button",{onClick:()=>K(t),className:o("w-full text-left p-3 rounded-lg text-sm transition-colors flex items-center gap-3 group",C===t.id?"bg-gray-800 text-white":"text-gray-400 hover:bg-gray-800/50 hover:text-white"),children:[e.jsx(O,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{className:"truncate flex-1",children:t.title})]},t.id))}),e.jsx("div",{className:"p-3 border-t border-gray-800 space-y-1",children:M?e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-gray-800/50",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center text-white text-sm font-medium",children:((N=s==null?void 0:s.fullName)==null?void 0:N.charAt(0))||"U"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:(s==null?void 0:s.fullName)||"Kullanıcı"}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:s==null?void 0:s.email})]})]}):e.jsxs(d,{onClick:()=>z("/auth"),className:"w-full justify-start gap-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white h-11",children:[e.jsx(k,{className:"w-4 h-4"}),"GiriÅ Yap"]})})]}),e.jsxs("main",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("header",{className:"h-14 border-b border-gray-800 flex items-center justify-between px-4 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{variant:"ghost",size:"icon",className:"lg:hidden text-gray-400 hover:text-white hover:bg-gray-800",onClick:()=>m(!0),children:e.jsx(B,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-400 to-cyan-500 flex items-center justify-center",children:e.jsx(h,{className:"w-4 h-4 text-white"})}),e.jsx("span",{className:"font-semibold text-lg",children:"NEFES21 AI"})]})]}),e.jsxs(d,{variant:"ghost",size:"sm",onClick:w,className:"text-gray-400 hover:text-white hover:bg-gray-800 gap-2",children:[e.jsx(v,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Yeni Sohbet"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 max-w-3xl mx-auto",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-emerald-400 to-cyan-500 flex items-center justify-center mb-6 shadow-lg shadow-emerald-500/20",children:e.jsx(h,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-center mb-2",children:"NEFES21 AI DanıÅman"}),e.jsx("p",{className:"text-gray-400 text-center mb-8 max-w-md",children:"KiÅisel geliÅim, farkındalık ve meditasyon konularında size yardımcı olmak için buradayım."}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-xl",children:V.map((t,a)=>e.jsxs("button",{onClick:()=>I(t.text),className:"p-4 rounded-xl border border-gray-700 hover:border-gray-600 hover:bg-gray-800/50 text-left transition-all group",children:[e.jsx("span",{className:"text-2xl mb-2 block",children:t.icon}),e.jsx("span",{className:"text-sm text-gray-300 group-hover:text-white transition-colors",children:t.text})]},a))})]}):e.jsxs("div",{className:"max-w-3xl mx-auto py-6 px-4 space-y-6",children:[l.map(t=>e.jsxs("div",{className:o("flex gap-4",t.role==="user"?"justify-end":"justify-start"),children:[t.role==="assistant"&&e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-400 to-cyan-500 flex items-center justify-center shrink-0",children:e.jsx(h,{className:"w-4 h-4 text-white"})}),e.jsx("div",{className:o("max-w-[85%] rounded-2xl px-4 py-3",t.role==="user"?"bg-blue-600 text-white":"bg-gray-800 text-gray-100"),children:e.jsx("p",{className:"whitespace-pre-wrap leading-relaxed text-[15px]",children:t.content})}),t.role==="user"&&e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center shrink-0",children:e.jsx(k,{className:"w-4 h-4 text-white"})})]},t.id)),c.isPending&&e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-400 to-cyan-500 flex items-center justify-center shrink-0",children:e.jsx(h,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"bg-gray-800 rounded-2xl px-4 py-3 flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4 animate-spin text-emerald-400"}),e.jsx("span",{className:"text-gray-400 text-sm",children:"DüÅünüyor..."})]})]}),e.jsx("div",{ref:j})]})}),e.jsx("div",{className:"border-t border-gray-800 p-4 shrink-0",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"relative flex items-end gap-2 bg-gray-800 rounded-2xl border border-gray-700 focus-within:border-gray-600 transition-colors",children:[e.jsx("textarea",{ref:n,value:i,onChange:t=>u(t.target.value),onKeyDown:A,placeholder:"Mesajınızı yazın...",rows:1,className:"flex-1 bg-transparent text-white placeholder-gray-500 px-4 py-3 resize-none focus:outline-none text-[15px] max-h-[200px]",disabled:c.isPending}),e.jsx(d,{onClick:b,disabled:!i.trim()||c.isPending,size:"icon",className:o("m-2 roun
1ded-xl h-9 w-9 transition-all",i.trim()?"bg-white text-gray-900 hover:bg-gray-200":"bg-gray-700 text-gray-500 cursor-not-allowed"),children:e.jsx(H,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-center text-xs text-gray-600 mt-3",children:"NEFES21 AI kiÅisel geliÅim konularında yardımcı olur. VerdiÄi bilgiler profesyonel danıÅmanlık yerine geçmez."})]})})]})]})}export{D 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.