module.exports=[68869,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131);function e(){let[a,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(!0),[h,i]=(0,d.useState)(!1);async function j(){i(!0);try{let a=await fetch("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"New Bot"})}),b=await a.json();a.ok?e(a=>[b,...a]):alert(b.error)}catch(a){console.error(a)}i(!1)}return(0,d.useEffect)(()=>{fetch("/api/bots").then(a=>a.json()).then(e).catch(console.error).finally(()=>g(!1))},[]),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Bots"}),(0,b.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Your bots"}),(0,b.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Manage status, widget snippets, and knowledge bases."})]}),(0,b.jsx)("button",{onClick:j,disabled:h,className:"inline-flex items-center rounded-xl bg-[var(--color-bg-brand)] px-5 py-3 text-sm font-semibold text-white shadow-sm transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:h?"Creating...":"Create bot"})]}),f?(0,b.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading bots..."}):0===a.length?(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-12 text-center shadow-sm",children:[(0,b.jsx)("p",{className:"text-lg font-semibold",children:"No bots yet"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Create your first chatbot to get started."}),(0,b.jsx)("button",{onClick:j,className:"mt-4 inline-flex items-center rounded-xl bg-[var(--color-bg-brand)] px-5 py-3 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)]",children:"Create your first bot"})]}):(0,b.jsx)("div",{className:"overflow-hidden rounded-2xl border border-[var(--color-border-light)] bg-white shadow-sm",children:(0,b.jsxs)("table",{className:"min-w-full",children:[(0,b.jsx)("thead",{className:"bg-[var(--color-bg-soft)] text-left text-sm text-[var(--color-text-secondary)]",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Name"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Goal"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Status"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Updated"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Actions"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-[var(--color-border-light)] text-sm",children:a.map(a=>(0,b.jsxs)("tr",{className:"hover:bg-[var(--color-bg-soft)]",children:[(0,b.jsx)("td",{className:"px-4 py-3 font-semibold",children:a.name}),(0,b.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-secondary)]",children:a.config?.goal||"Not set"}),(0,b.jsx)("td",{className:"px-4 py-3",children:(0,b.jsx)("span",{className:`rounded-full px-2 py-1 text-xs font-semibold text-white ${"active"===a.status?"bg-[var(--color-accent-green)]":"bg-slate-400"}`,children:a.status})}),(0,b.jsx)("td",{className:"px-4 py-3 text-[var(--color-text-secondary)]",children:new Date(a.updatedAt).toLocaleDateString()}),(0,b.jsx)("td",{className:"px-4 py-3",children:(0,b.jsx)(c.default,{href:`/dashboard/bots/${a._id}`,className:"text-sm font-semibold text-[var(--color-bg-brand)]",children:"Open"})})]},a._id))})]})})]})}a.s(["default",()=>e])}];

//# sourceMappingURL=src_app_%28app%29_dashboard_bots_page_tsx_96dcfcf5._.js.map