apteva 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App.vsvrc987.js → App.dc0hb2q1.js} +2 -2
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/routes/api.ts +5 -2
- package/src/routes/static.ts +2 -2
- package/src/server.ts +10 -2
- package/src/web/components/onboarding/OnboardingWizard.tsx +2 -2
- package/src/web/components/settings/SettingsPage.tsx +2 -2
- package/src/web/index.html +1 -1
|
@@ -172,7 +172,7 @@ Check the top-level render call using <`+c+">."}return V}}function p4(L,V){{if(!
|
|
|
172
172
|
<%s {...props} />
|
|
173
173
|
React keys must be passed directly to JSX without using spread:
|
|
174
174
|
let props = %s;
|
|
175
|
-
<%s key={someKey} {...props} />`,e0,u4,a5,u4),k1[u4+e0]=!0}}if(L===B)J1(Y1);else J5(Y1);return Y1}}function B1(L,V,c){return u1(L,V,c,!0)}function W(L,V,c){return u1(L,V,c,!1)}var m=W,l=B1;JM.Fragment=B,JM.jsx=m,JM.jsxs=l})()});var W7=z0(X6(),1),xB=z0(qB(),1);var Sv=z0(X6(),1);function SG(Y){let[U,B]=Sv.useState([]),[_,G]=Sv.useState(!0),P=Sv.useCallback(async()=>{let w=await(await fetch("/api/agents")).json();B(w.agents||[]),G(!1)},[]);Sv.useEffect(()=>{if(Y)P()},[Y,P]);let F=async(R)=>{await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)}),await P()},N=async(R)=>{await fetch(`/api/agents/${R}`,{method:"DELETE"}),await P()},T=async(R)=>{let w=R.status==="running"?"stop":"start",E=await fetch(`/api/agents/${R.id}/${w}`,{method:"POST"}),i=await E.json();if(await P(),!E.ok&&i.error)return{error:i.error};return{}},f=U.filter((R)=>R.status==="running").length;return{agents:U,loading:_,runningCount:f,fetchAgents:P,createAgent:F,deleteAgent:N,toggleAgent:T}}var db=z0(X6(),1);function hG(Y){let[U,B]=db.useState([]),_=db.useCallback(async()=>{let T=await(await fetch("/api/providers")).json();B(T.providers||[])},[]);db.useEffect(()=>{if(Y)_()},[Y,_]);let G=U.filter((N)=>N.hasKey);return{providers:U,configuredProviders:G,fetchProviders:_,saveKey:async(N,T)=>{let R=await(await fetch(`/api/keys/${N}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:T})})).json();if(!R.valid)return{success:!1,error:R.error||"API key is invalid"};let w=await fetch(`/api/keys/${N}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:T})});if(!w.ok)return{success:!1,error:(await w.json()).error||"Failed to save key"};return await _(),{success:!0}},deleteKey:async(N)=>{await fetch(`/api/keys/${N}`,{method:"DELETE"}),await _()}}}var jb=z0(X6(),1);function gG(){let[Y,U]=jb.useState(null);jb.useEffect(()=>{fetch("/api/onboarding/status").then((_)=>_.json()).then((_)=>{U(_.completed||_.has_any_keys)}).catch(()=>U(!0))},[]);let B=jb.useCallback(async()=>{await fetch("/api/onboarding/complete",{method:"POST"}),U(!0)},[]);return{isComplete:Y,setIsComplete:U,complete:B}}var p7=z0(V1(),1);function yb({message:Y="Loading...",fullScreen:U=!1}){let B=p7.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[p7.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[p7.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),p7.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p7.jsxDEV("span",{children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(U)return p7.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:B},void 0,!1,void 0,this);return p7.jsxDEV("div",{className:"flex items-center justify-center py-20",children:B},void 0,!1,void 0,this)}var mG=z0(V1(),1);function $Z({children:Y,onClose:U}){return mG.jsxDEV("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",children:mG.jsxDEV("div",{className:"bg-[#111] rounded p-6 w-full max-w-md border border-[#1a1a1a]",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var cb=z0(X6(),1),Z4=z0(V1(),1);function jz({value:Y,options:U,onChange:B,placeholder:_="Select..."}){let[G,P]=cb.useState(!1),F=cb.useRef(null),N=U.find((T)=>T.value===Y);return cb.useEffect(()=>{function T(f){if(F.current&&!F.current.contains(f.target))P(!1)}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),Z4.jsxDEV("div",{ref:F,className:"relative",children:[Z4.jsxDEV("button",{type:"button",onClick:()=>P(!G),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition",children:[Z4.jsxDEV("span",{className:N?"text-[#e0e0e0]":"text-[#666]",children:N?Z4.jsxDEV(Z4.Fragment,{children:[N.label,N.recommended&&Z4.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):_},void 0,!1,void 0,this),Z4.jsxDEV(AR,{isOpen:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&Z4.jsxDEV("div",{className:"absolute z-50 w-full mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-auto",children:U.map((T)=>Z4.jsxDEV("button",{type:"button",onClick:()=>{B(T.value),P(!1)},className:`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${T.value===Y?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[Z4.jsxDEV("span",{children:[T.label,T.recommended&&Z4.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.value===Y&&Z4.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Z4.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},T.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AR({isOpen:Y}){return Z4.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${Y?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Z4.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Q5=z0(V1(),1);function r7({className:Y="w-4 h-4"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function hv({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function KZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function UZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function qZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"},void 0,!1,void 0,this),Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gv=z0(V1(),1);function BZ({onNewAgent:Y,canCreateAgent:U}){return gv.jsxDEV("header",{className:"border-b border-[#1a1a1a] px-6 py-4 flex-shrink-0",children:gv.jsxDEV("div",{className:"flex items-center justify-between",children:[gv.jsxDEV("div",{className:"flex items-center gap-2",children:[gv.jsxDEV("span",{className:"text-[#f97316]",children:">_"},void 0,!1,void 0,this),gv.jsxDEV("span",{className:"text-xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gv.jsxDEV("button",{onClick:Y,disabled:!U,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var P5=z0(V1(),1);function OZ({route:Y,agentCount:U,onNavigate:B}){return P5.jsxDEV("aside",{className:"w-56 border-r border-[#1a1a1a] flex-shrink-0 p-4",children:P5.jsxDEV("nav",{className:"space-y-1",children:[P5.jsxDEV(dG,{icon:P5.jsxDEV(KZ,{},void 0,!1,void 0,this),label:"Dashboard",active:Y==="dashboard",onClick:()=>B("dashboard")},void 0,!1,void 0,this),P5.jsxDEV(dG,{icon:P5.jsxDEV(UZ,{},void 0,!1,void 0,this),label:"Agents",active:Y==="agents",onClick:()=>B("agents"),badge:U>0?String(U):void 0},void 0,!1,void 0,this),P5.jsxDEV(dG,{icon:P5.jsxDEV(qZ,{},void 0,!1,void 0,this),label:"Settings",active:Y==="settings",onClick:()=>B("settings")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function dG({icon:Y,label:U,active:B,onClick:_,badge:G}){return P5.jsxDEV("button",{onClick:_,className:`w-full flex items-center gap-3 px-3 py-2 rounded font-medium transition ${B?"bg-[#111] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:[Y,U,G&&P5.jsxDEV("span",{className:"ml-auto bg-[#333] text-[#888] text-xs px-2 py-0.5 rounded-full",children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var yz=z0(V1(),1);function LZ({message:Y,onDismiss:U}){return yz.jsxDEV("div",{className:"bg-red-500/10 border-b border-red-500/30 px-6 py-3 text-red-400 text-sm flex items-center justify-between",children:[yz.jsxDEV("span",{children:Y},void 0,!1,void 0,this),yz.jsxDEV("button",{onClick:U,className:"hover:text-red-300",children:yz.jsxDEV(hv,{className:"w-4 h-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F5=z0(X6(),1);var I0=z0(V1(),1);function _Z({onComplete:Y}){let[U,B]=F5.useState(1),[_,G]=F5.useState([]),[P,F]=F5.useState(null),[N,T]=F5.useState(""),[f,R]=F5.useState(!1),[w,E]=F5.useState(!1),[i,s]=F5.useState(null),[Q0,n]=F5.useState(null);F5.useEffect(()=>{fetch("/api/providers").then((p)=>p.json()).then((p)=>G(p.providers||[]))},[]);let j=_.filter((p)=>p.hasKey),K0=async()=>{if(!P||!N)return;R(!0),s(null),n(null);try{E(!0);let X0=await(await fetch(`/api/keys/${P}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N})})).json();if(E(!1),!X0.valid){s(X0.error||"API key is invalid"),R(!1);return}let N0=await fetch(`/api/keys/${P}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N})}),n0=await N0.json();if(!N0.ok)s(n0.error||"Failed to save key");else{n("API key saved successfully!"),T("");let y0=await(await fetch("/api/providers")).json();G(y0.providers||[]),F(null)}}catch(p){s("Failed to save key")}R(!1)},a=async()=>{await fetch("/api/onboarding/complete",{method:"POST"}),Y()};return I0.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:I0.jsxDEV("div",{className:"w-full max-w-2xl",children:[I0.jsxDEV("div",{className:"text-center mb-8",children:[I0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[I0.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),I0.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-8",children:[I0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${U>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),I0.jsxDEV("div",{className:`w-16 h-0.5 ${U>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),I0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${U>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[U===1&&I0.jsxDEV(PR,{providers:_,configuredProviders:j,selectedProvider:P,apiKey:N,saving:f,testing:w,error:i,success:Q0,onSelectProvider:F,onApiKeyChange:T,onSaveKey:K0,onContinue:()=>B(2)},void 0,!1,void 0,this),U===2&&I0.jsxDEV(RR,{configuredProviders:j,onAddMore:()=>B(1),onComplete:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function PR({providers:Y,configuredProviders:U,selectedProvider:B,apiKey:_,saving:G,testing:P,error:F,success:N,onSelectProvider:T,onApiKeyChange:f,onSaveKey:R,onContinue:w}){let E=Y.find((i)=>i.id===B);if(B&&E)return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:["Add ",E.name," Key"]},void 0,!0,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:"Enter your API key below. It will be encrypted and stored locally."},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"mb-6",children:[I0.jsxDEV("div",{className:"p-4 rounded border border-[#f97316] bg-[#f97316]/5 mb-4",children:I0.jsxDEV("div",{className:"flex items-center justify-between",children:[I0.jsxDEV("div",{children:[I0.jsxDEV("p",{className:"font-medium",children:E.name},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-sm text-[#666]",children:[E.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("a",{href:E.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"space-y-3",children:[I0.jsxDEV("input",{type:"password",value:_,onChange:(i)=>f(i.target.value),placeholder:"Enter your API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316] text-lg"},void 0,!1,void 0,this),F&&I0.jsxDEV("p",{className:"text-red-400 text-sm",children:F},void 0,!1,void 0,this),N&&I0.jsxDEV("p",{className:"text-green-400 text-sm",children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"flex gap-3",children:[I0.jsxDEV("button",{onClick:()=>{T(null),f("")},className:"flex-1 border border-[#333] hover:border-[#666] px-4 py-3 rounded font-medium transition",children:"Back"},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:R,disabled:!_||G,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:P?"Testing...":G?"Saving...":"Save API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome to Apteva"},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:"To get started, you'll need to add at least one AI provider API key. Your keys are encrypted and stored locally."},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"space-y-3 mb-6",children:Y.map((i)=>I0.jsxDEV(FR,{provider:i,selected:!1,onSelect:()=>!i.hasKey&&T(i.id)},i.id,!1,void 0,this))},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:w,disabled:U.length===0,className:"w-full bg-[#222] hover:bg-[#333] disabled:opacity-50 disabled:cursor-not-allowed px-4 py-3 rounded font-medium transition",children:U.length===0?"Add at least one API key to continue":`Continue with ${U.length} provider${U.length>1?"s":""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FR({provider:Y,selected:U,onSelect:B}){return I0.jsxDEV("div",{onClick:B,className:`p-4 rounded border transition cursor-pointer ${Y.hasKey?"border-green-500/30 bg-green-500/5":U?"border-[#f97316] bg-[#f97316]/5":"border-[#222] hover:border-[#333]"}`,children:I0.jsxDEV("div",{className:"flex items-center justify-between",children:[I0.jsxDEV("div",{children:[I0.jsxDEV("p",{className:"font-medium",children:Y.name},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?I0.jsxDEV("span",{className:"text-green-400 text-sm flex items-center gap-1",children:[I0.jsxDEV(r7,{},void 0,!1,void 0,this),"Configured (",Y.keyHint,")"]},void 0,!0,void 0,this):I0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",onClick:(_)=>_.stopPropagation(),className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function RR({configuredProviders:Y,onAddMore:U,onComplete:B}){return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"You're all set!"},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:["You've configured ",Y.length," provider",Y.length>1?"s":"",". You can add more providers later in Settings."]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"space-y-2 mb-6",children:Y.map((_)=>I0.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] rounded",children:[I0.jsxDEV(r7,{className:"w-5 h-5 text-green-400"},void 0,!1,void 0,this),I0.jsxDEV("span",{children:_.name},void 0,!1,void 0,this),I0.jsxDEV("span",{className:"text-[#666] text-sm",children:["(",_.keyHint,")"]},void 0,!0,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"flex gap-3",children:[I0.jsxDEV("button",{onClick:U,className:"flex-1 border border-[#333] hover:border-[#f97316] px-4 py-3 rounded font-medium transition",children:"Add More"},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:B,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-3 rounded font-medium transition",children:"Start Using Apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var L4=z0(X6(),1);var F0=z0(V1(),1);function WZ(){let[Y,U]=L4.useState("providers");return F0.jsxDEV("div",{className:"flex-1 flex overflow-hidden",children:[F0.jsxDEV("div",{className:"w-48 border-r border-[#1a1a1a] p-4",children:[F0.jsxDEV("h2",{className:"text-sm font-medium text-[#666] uppercase tracking-wider mb-3",children:"Settings"},void 0,!1,void 0,this),F0.jsxDEV("nav",{className:"space-y-1",children:[F0.jsxDEV(BB,{label:"Providers",active:Y==="providers",onClick:()=>U("providers")},void 0,!1,void 0,this),F0.jsxDEV(BB,{label:"Updates",active:Y==="updates",onClick:()=>U("updates")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[Y==="providers"&&F0.jsxDEV(MR,{},void 0,!1,void 0,this),Y==="updates"&&F0.jsxDEV(kR,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function BB({label:Y,active:U,onClick:B}){return F0.jsxDEV("button",{onClick:B,className:`w-full text-left px-3 py-2 rounded text-sm transition ${U?"bg-[#1a1a1a] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:Y},void 0,!1,void 0,this)}function MR(){let[Y,U]=L4.useState([]),[B,_]=L4.useState(null),[G,P]=L4.useState(""),[F,N]=L4.useState(!1),[T,f]=L4.useState(!1),[R,w]=L4.useState(null),[E,i]=L4.useState(null),s=async()=>{let a=await(await fetch("/api/providers")).json();U(a.providers||[])};L4.useEffect(()=>{s()},[]);let Q0=async()=>{if(!B||!G)return;N(!0),w(null),i(null);try{f(!0);let a=await(await fetch(`/api/keys/${B}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:G})})).json();if(f(!1),!a.valid){w(a.error||"API key is invalid"),N(!1);return}let p=await fetch(`/api/keys/${B}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:G})});if(!p.ok){let X0=await p.json();w(X0.error||"Failed to save key")}else i("API key saved!"),P(""),_(null),s()}catch(K0){w("Failed to save key")}N(!1)},n=async(K0)=>{if(!confirm("Are you sure you want to remove this API key?"))return;await fetch(`/api/keys/${K0}`,{method:"DELETE"}),s()},j=Y.filter((K0)=>K0.hasKey).length;return F0.jsxDEV("div",{className:"max-w-4xl",children:[F0.jsxDEV("div",{className:"mb-6",children:[F0.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"AI Providers"},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-[#666]",children:["Manage your API keys for AI providers. ",j," of ",Y.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:Y.map((K0)=>F0.jsxDEV(wR,{provider:K0,isEditing:B===K0.id,apiKey:G,saving:F,testing:T,error:B===K0.id?R:null,success:B===K0.id?E:null,onStartEdit:()=>{_(K0.id),w(null),i(null)},onCancelEdit:()=>{_(null),P(""),w(null)},onApiKeyChange:P,onSave:Q0,onDelete:()=>n(K0.id)},K0.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kR(){let[Y,U]=L4.useState(null),[B,_]=L4.useState(!1),[G,P]=L4.useState(null),[F,N]=L4.useState(!1),T=async()=>{_(!0),P(null);try{let R=await fetch("/api/version");if(!R.ok)throw Error("Failed to check for updates");let w=await R.json();U(w)}catch(R){P("Failed to check for updates")}_(!1)};L4.useEffect(()=>{T()},[]);let f=()=>{if(Y?.updateCommand)navigator.clipboard.writeText(Y.updateCommand),N(!0),setTimeout(()=>N(!1),2000)};return F0.jsxDEV("div",{className:"max-w-2xl",children:[F0.jsxDEV("div",{className:"mb-6",children:[F0.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Updates"},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-[#666]",children:"Check for new versions of Apteva."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6",children:B&&!Y?F0.jsxDEV("div",{className:"text-[#666]",children:"Checking for updates..."},void 0,!1,void 0,this):G?F0.jsxDEV("div",{className:"text-red-400",children:G},void 0,!1,void 0,this):Y?F0.jsxDEV("div",{className:"space-y-4",children:[F0.jsxDEV("div",{className:"flex items-center justify-between",children:[F0.jsxDEV("div",{children:[F0.jsxDEV("div",{className:"text-sm text-[#666]",children:"Current version"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"text-xl font-mono",children:["v",Y.current]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"text-right",children:[F0.jsxDEV("div",{className:"text-sm text-[#666]",children:"Latest version"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"text-xl font-mono",children:["v",Y.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.updateAvailable?F0.jsxDEV("div",{className:"bg-[#f97316]/10 border border-[#f97316]/30 rounded-lg p-4",children:[F0.jsxDEV("div",{className:"flex items-center gap-2 text-[#f97316] font-medium mb-2",children:[F0.jsxDEV("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:F0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Update available!"]},void 0,!0,void 0,this),F0.jsxDEV("p",{className:"text-sm text-[#888] mb-3",children:"A new version of Apteva is available. Run this command to update:"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"flex items-center gap-2",children:[F0.jsxDEV("code",{className:"flex-1 bg-[#0a0a0a] px-3 py-2 rounded font-mono text-sm",children:Y.updateCommand},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:f,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:F?"Copied!":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 flex items-center gap-2 text-green-400",children:[F0.jsxDEV(r7,{className:"w-5 h-5"},void 0,!1,void 0,this),"You're running the latest version!"]},void 0,!0,void 0,this),F0.jsxDEV("button",{onClick:T,disabled:B,className:"text-sm text-[#666] hover:text-[#888] disabled:opacity-50",children:B?"Checking...":"Check again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wR({provider:Y,isEditing:U,apiKey:B,saving:_,testing:G,error:P,success:F,onStartEdit:N,onCancelEdit:T,onApiKeyChange:f,onSave:R,onDelete:w}){return F0.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 ${Y.hasKey?"border-green-500/20":"border-[#1a1a1a]"}`,children:[F0.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[F0.jsxDEV("div",{children:[F0.jsxDEV("h3",{className:"font-medium",children:Y.name},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.models.length," models"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?F0.jsxDEV("span",{className:"text-green-400 text-xs flex items-center gap-1 bg-green-500/10 px-2 py-1 rounded",children:[F0.jsxDEV(r7,{className:"w-3 h-3"},void 0,!1,void 0,this),Y.keyHint]},void 0,!0,void 0,this):F0.jsxDEV("span",{className:"text-[#666] text-xs bg-[#1a1a1a] px-2 py-1 rounded",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?F0.jsxDEV("div",{className:"flex items-center justify-between mt-3 pt-3 border-t border-[#1a1a1a]",children:[F0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"View docs"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:w,className:"text-red-400 hover:text-red-300 text-sm",children:"Remove key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"mt-3 pt-3 border-t border-[#1a1a1a]",children:U?F0.jsxDEV("div",{className:"space-y-3",children:[F0.jsxDEV("input",{type:"password",value:B,onChange:(E)=>f(E.target.value),placeholder:"Enter API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),P&&F0.jsxDEV("p",{className:"text-red-400 text-sm",children:P},void 0,!1,void 0,this),F&&F0.jsxDEV("p",{className:"text-green-400 text-sm",children:F},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"flex gap-2",children:[F0.jsxDEV("button",{onClick:T,className:"flex-1 px-3 py-1.5 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:R,disabled:!B||_,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:G?"Validating...":_?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"flex items-center justify-between",children:[F0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API key"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:N,className:"text-sm text-[#f97316] hover:text-[#fb923c]",children:"+ Add key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var i4=z0(V1(),1);function NZ({agent:Y,selected:U,onSelect:B,onToggle:_,onDelete:G}){return i4.jsxDEV("div",{onClick:B,className:`bg-[#111] rounded p-5 border transition cursor-pointer ${U?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,children:[i4.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[i4.jsxDEV("div",{children:[i4.jsxDEV("h3",{className:"font-semibold text-lg",children:Y.name},void 0,!1,void 0,this),i4.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.provider," / ",Y.model,Y.port&&i4.jsxDEV("span",{className:"text-[#444]",children:[" · :",Y.port]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),i4.jsxDEV(VR,{status:Y.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i4.jsxDEV("p",{className:"text-sm text-[#666] line-clamp-2 mb-4",children:Y.systemPrompt},void 0,!1,void 0,this),i4.jsxDEV("div",{className:"flex gap-2",children:[i4.jsxDEV("button",{onClick:_,className:`flex-1 px-3 py-1.5 rounded text-sm font-medium transition ${Y.status==="running"?"bg-[#f97316]/20 text-[#f97316] hover:bg-[#f97316]/30":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:Y.status==="running"?"Stop":"Start"},void 0,!1,void 0,this),i4.jsxDEV("button",{onClick:G,className:"px-3 py-1.5 rounded text-sm font-medium bg-red-500/20 text-red-400 hover:bg-red-500/30 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VR({status:Y}){return i4.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${Y==="running"?"bg-[#3b82f6]/20 text-[#3b82f6]":"bg-[#333] text-[#666]"}`,children:Y},void 0,!1,void 0,this)}var H6=z0(V1(),1);function PZ({form:Y,providers:U,configuredProviders:B,onFormChange:_,onProviderChange:G,onCreate:P,onClose:F,onGoToSettings:N}){let T=U.find((w)=>w.id===Y.provider),f=B.map((w)=>({value:w.id,label:w.name})),R=T?.models.map((w)=>({value:w.value,label:w.label,recommended:w.recommended}))||[];return H6.jsxDEV($Z,{children:[H6.jsxDEV("h2",{className:"text-xl font-semibold mb-4",children:"Create New Agent"},void 0,!1,void 0,this),B.length===0?H6.jsxDEV(DR,{onGoToSettings:N},void 0,!1,void 0,this):H6.jsxDEV(H6.Fragment,{children:[H6.jsxDEV("div",{className:"space-y-4",children:[H6.jsxDEV(AZ,{label:"Name",children:H6.jsxDEV("input",{type:"text",value:Y.name,onChange:(w)=>_({...Y,name:w.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]",placeholder:"My Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"Provider",children:H6.jsxDEV(jz,{value:Y.provider,options:f,onChange:G,placeholder:"Select provider..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"Model",children:H6.jsxDEV(jz,{value:Y.model,options:R,onChange:(w)=>_({...Y,model:w}),placeholder:"Select model..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"System Prompt",children:H6.jsxDEV("textarea",{value:Y.systemPrompt,onChange:(w)=>_({...Y,systemPrompt:w.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H6.jsxDEV("div",{className:"flex gap-3 mt-6",children:[H6.jsxDEV("button",{onClick:F,className:"flex-1 border border-[#333] hover:border-[#f97316] hover:text-[#f97316] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),H6.jsxDEV("button",{onClick:P,disabled:!Y.name,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function AZ({label:Y,children:U}){return H6.jsxDEV("div",{children:[H6.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:Y},void 0,!1,void 0,this),U]},void 0,!0,void 0,this)}function DR({onGoToSettings:Y}){return H6.jsxDEV("div",{className:"text-center py-6",children:[H6.jsxDEV("p",{className:"text-[#666] mb-4",children:"No API keys configured. Add a provider key first."},void 0,!1,void 0,this),H6.jsxDEV("button",{onClick:Y,className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Go to Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F1=z0(X6(),1),ob=z0(X6(),1),mv=z0(X6(),1);function OB(Y){var U,B,_="";if(typeof Y=="string"||typeof Y=="number")_+=Y;else if(typeof Y=="object")if(Array.isArray(Y)){var G=Y.length;for(U=0;U<G;U++)Y[U]&&(B=OB(Y[U]))&&(_&&(_+=" "),_+=B)}else for(B in Y)Y[B]&&(_&&(_+=" "),_+=B);return _}function LB(){for(var Y,U,B=0,_="",G=arguments.length;B<G;B++)(Y=arguments[B])&&(U=OB(Y))&&(_&&(_+=" "),_+=U);return _}var IR=(Y)=>{let U=ER(Y),{conflictingClassGroups:B,conflictingClassGroupModifiers:_}=Y;return{getClassGroupId:(F)=>{let N=F.split("-");if(N[0]===""&&N.length!==1)N.shift();return NB(N,U)||fR(F)},getConflictingClassGroupIds:(F,N)=>{let T=B[F]||[];if(N&&_[F])return[...T,..._[F]];return T}}},NB=(Y,U)=>{if(Y.length===0)return U.classGroupId;let B=Y[0],_=U.nextPart.get(B),G=_?NB(Y.slice(1),_):void 0;if(G)return G;if(U.validators.length===0)return;let P=Y.join("-");return U.validators.find(({validator:F})=>F(P))?.classGroupId},_B=/^\[(.+)\]$/,fR=(Y)=>{if(_B.test(Y)){let U=_B.exec(Y)[1],B=U?.substring(0,U.indexOf(":"));if(B)return"arbitrary.."+B}},ER=(Y)=>{let{theme:U,prefix:B}=Y,_={nextPart:new Map,validators:[]};return CR(Object.entries(Y.classGroups),B).forEach(([P,F])=>{yG(F,_,P,U)}),_},yG=(Y,U,B,_)=>{Y.forEach((G)=>{if(typeof G==="string"){let P=G===""?U:WB(U,G);P.classGroupId=B;return}if(typeof G==="function"){if(TR(G)){yG(G(_),U,B,_);return}U.validators.push({validator:G,classGroupId:B});return}Object.entries(G).forEach(([P,F])=>{yG(F,WB(U,P),B,_)})})},WB=(Y,U)=>{let B=Y;return U.split("-").forEach((_)=>{if(!B.nextPart.has(_))B.nextPart.set(_,{nextPart:new Map,validators:[]});B=B.nextPart.get(_)}),B},TR=(Y)=>Y.isThemeGetter,CR=(Y,U)=>{if(!U)return Y;return Y.map(([B,_])=>{let G=_.map((P)=>{if(typeof P==="string")return U+P;if(typeof P==="object")return Object.fromEntries(Object.entries(P).map(([F,N])=>[U+F,N]));return P});return[B,G]})},SR=(Y)=>{if(Y<1)return{get:()=>{return},set:()=>{}};let U=0,B=new Map,_=new Map,G=(P,F)=>{if(B.set(P,F),U++,U>Y)U=0,_=B,B=new Map};return{get(P){let F=B.get(P);if(F!==void 0)return F;if((F=_.get(P))!==void 0)return G(P,F),F},set(P,F){if(B.has(P))B.set(P,F);else G(P,F)}}};var hR=(Y)=>{let{separator:U,experimentalParseClassName:B}=Y,_=U.length===1,G=U[0],P=U.length,F=(N)=>{let T=[],f=0,R=0,w;for(let n=0;n<N.length;n++){let j=N[n];if(f===0){if(j===G&&(_||N.slice(n,n+P)===U)){T.push(N.slice(R,n)),R=n+P;continue}if(j==="/"){w=n;continue}}if(j==="[")f++;else if(j==="]")f--}let E=T.length===0?N:N.substring(R),i=E.startsWith("!"),s=i?E.substring(1):E,Q0=w&&w>R?w-R:void 0;return{modifiers:T,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:Q0}};if(B)return(N)=>B({className:N,parseClassName:F});return F},gR=(Y)=>{if(Y.length<=1)return Y;let U=[],B=[];return Y.forEach((_)=>{if(_[0]==="[")U.push(...B.sort(),_),B=[];else B.push(_)}),U.push(...B.sort()),U},uR=(Y)=>({cache:SR(Y.cacheSize),parseClassName:hR(Y),...IR(Y)}),mR=/\s+/,dR=(Y,U)=>{let{parseClassName:B,getClassGroupId:_,getConflictingClassGroupIds:G}=U,P=[],F=Y.trim().split(mR),N="";for(let T=F.length-1;T>=0;T-=1){let f=F[T],{modifiers:R,hasImportantModifier:w,baseClassName:E,maybePostfixModifierPosition:i}=B(f),s=Boolean(i),Q0=_(s?E.substring(0,i):E);if(!Q0){if(!s){N=f+(N.length>0?" "+N:N);continue}if(Q0=_(E),!Q0){N=f+(N.length>0?" "+N:N);continue}s=!1}let n=gR(R).join(":"),j=w?n+"!":n,K0=j+Q0;if(P.includes(K0))continue;P.push(K0);let a=G(Q0,s);for(let p=0;p<a.length;++p){let X0=a[p];P.push(j+X0)}N=f+(N.length>0?" "+N:N)}return N};function jR(){let Y=0,U,B,_="";while(Y<arguments.length)if(U=arguments[Y++]){if(B=AB(U))_&&(_+=" "),_+=B}return _}var AB=(Y)=>{if(typeof Y==="string")return Y;let U,B="";for(let _=0;_<Y.length;_++)if(Y[_]){if(U=AB(Y[_]))B&&(B+=" "),B+=U}return B};function yR(Y,...U){let B,_,G,P=F;function F(T){let f=U.reduce((R,w)=>w(R),Y());return B=uR(f),_=B.cache.get,G=B.cache.set,P=N,N(T)}function N(T){let f=_(T);if(f)return f;let R=dR(T,B);return G(T,R),R}return function(){return P(jR.apply(null,arguments))}}var Z6=(Y)=>{let U=(B)=>B[Y]||[];return U.isThemeGetter=!0,U},PB=/^\[(?:([a-z-]+):)?(.+)\]$/i,cR=/^\d+\/\d+$/,xR=new Set(["px","full","screen"]),aR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,iR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,O7=(Y)=>xb(Y)||xR.has(Y)||cR.test(Y),n7=(Y)=>ab(Y,"length",zM),xb=(Y)=>Boolean(Y)&&!Number.isNaN(Number(Y)),jG=(Y)=>ab(Y,"number",xb),cz=(Y)=>Boolean(Y)&&Number.isInteger(Number(Y)),rR=(Y)=>Y.endsWith("%")&&xb(Y.slice(0,-1)),b1=(Y)=>PB.test(Y),t7=(Y)=>aR.test(Y),nR=new Set(["length","size","percentage"]),tR=(Y)=>ab(Y,nR,FB),sR=(Y)=>ab(Y,"position",FB),eR=new Set(["image","url"]),vM=(Y)=>ab(Y,eR,XM),bM=(Y)=>ab(Y,"",QM),xz=()=>!0,ab=(Y,U,B)=>{let _=PB.exec(Y);if(_){if(_[1])return typeof U==="string"?_[1]===U:U.has(_[1]);return B(_[2])}return!1},zM=(Y)=>lR.test(Y)&&!oR.test(Y),FB=()=>!1,QM=(Y)=>iR.test(Y),XM=(Y)=>pR.test(Y);var ZM=()=>{let Y=Z6("colors"),U=Z6("spacing"),B=Z6("blur"),_=Z6("brightness"),G=Z6("borderColor"),P=Z6("borderRadius"),F=Z6("borderSpacing"),N=Z6("borderWidth"),T=Z6("contrast"),f=Z6("grayscale"),R=Z6("hueRotate"),w=Z6("invert"),E=Z6("gap"),i=Z6("gradientColorStops"),s=Z6("gradientColorStopPositions"),Q0=Z6("inset"),n=Z6("margin"),j=Z6("opacity"),K0=Z6("padding"),a=Z6("saturate"),p=Z6("scale"),X0=Z6("sepia"),N0=Z6("skew"),n0=Z6("space"),z1=Z6("translate"),y0=()=>["auto","contain","none"],A0=()=>["auto","hidden","clip","visible","scroll"],h0=()=>["auto",b1,U],e=()=>[b1,U],Z0=()=>["",O7,n7],k0=()=>["auto",xb,b1],L0=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v1=()=>["solid","dashed","dotted","double","none"],F6=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],t1=()=>["start","end","center","between","around","evenly","stretch"],d1=()=>["","0",b1],u0=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q1=()=>[xb,b1];return{cacheSize:500,separator:":",theme:{colors:[xz],spacing:[O7,n7],blur:["none","",t7,b1],brightness:Q1(),borderColor:[Y],borderRadius:["none","","full",t7,b1],borderSpacing:e(),borderWidth:Z0(),contrast:Q1(),grayscale:d1(),hueRotate:Q1(),invert:d1(),gap:e(),gradientColorStops:[Y],gradientColorStopPositions:[rR,n7],inset:h0(),margin:h0(),opacity:Q1(),padding:e(),saturate:Q1(),scale:Q1(),sepia:d1(),skew:Q1(),space:e(),translate:e()},classGroups:{aspect:[{aspect:["auto","square","video",b1]}],container:["container"],columns:[{columns:[t7]}],"break-after":[{"break-after":u0()}],"break-before":[{"break-before":u0()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L0(),b1]}],overflow:[{overflow:A0()}],"overflow-x":[{"overflow-x":A0()}],"overflow-y":[{"overflow-y":A0()}],overscroll:[{overscroll:y0()}],"overscroll-x":[{"overscroll-x":y0()}],"overscroll-y":[{"overscroll-y":y0()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[Q0]}],"inset-x":[{"inset-x":[Q0]}],"inset-y":[{"inset-y":[Q0]}],start:[{start:[Q0]}],end:[{end:[Q0]}],top:[{top:[Q0]}],right:[{right:[Q0]}],bottom:[{bottom:[Q0]}],left:[{left:[Q0]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",cz,b1]}],basis:[{basis:h0()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",b1]}],grow:[{grow:d1()}],shrink:[{shrink:d1()}],order:[{order:["first","last","none",cz,b1]}],"grid-cols":[{"grid-cols":[xz]}],"col-start-end":[{col:["auto",{span:["full",cz,b1]},b1]}],"col-start":[{"col-start":k0()}],"col-end":[{"col-end":k0()}],"grid-rows":[{"grid-rows":[xz]}],"row-start-end":[{row:["auto",{span:[cz,b1]},b1]}],"row-start":[{"row-start":k0()}],"row-end":[{"row-end":k0()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",b1]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",b1]}],gap:[{gap:[E]}],"gap-x":[{"gap-x":[E]}],"gap-y":[{"gap-y":[E]}],"justify-content":[{justify:["normal",...t1()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...t1(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...t1(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[K0]}],px:[{px:[K0]}],py:[{py:[K0]}],ps:[{ps:[K0]}],pe:[{pe:[K0]}],pt:[{pt:[K0]}],pr:[{pr:[K0]}],pb:[{pb:[K0]}],pl:[{pl:[K0]}],m:[{m:[n]}],mx:[{mx:[n]}],my:[{my:[n]}],ms:[{ms:[n]}],me:[{me:[n]}],mt:[{mt:[n]}],mr:[{mr:[n]}],mb:[{mb:[n]}],ml:[{ml:[n]}],"space-x":[{"space-x":[n0]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[n0]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",b1,U]}],"min-w":[{"min-w":[b1,U,"min","max","fit"]}],"max-w":[{"max-w":[b1,U,"none","full","min","max","fit","prose",{screen:[t7]},t7]}],h:[{h:[b1,U,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[b1,U,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[b1,U,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[b1,U,"auto","min","max","fit"]}],"font-size":[{text:["base",t7,n7]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",jG]}],"font-family":[{font:[xz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",b1]}],"line-clamp":[{"line-clamp":["none",xb,jG]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",O7,b1]}],"list-image":[{"list-image":["none",b1]}],"list-style-type":[{list:["none","disc","decimal",b1]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[Y]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[Y]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v1(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",O7,n7]}],"underline-offset":[{"underline-offset":["auto",O7,b1]}],"text-decoration-color":[{decoration:[Y]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:e()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",b1]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",b1]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L0(),sR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vM]}],"bg-color":[{bg:[Y]}],"gradient-from-pos":[{from:[s]}],"gradient-via-pos":[{via:[s]}],"gradient-to-pos":[{to:[s]}],"gradient-from":[{from:[i]}],"gradient-via":[{via:[i]}],"gradient-to":[{to:[i]}],rounded:[{rounded:[P]}],"rounded-s":[{"rounded-s":[P]}],"rounded-e":[{"rounded-e":[P]}],"rounded-t":[{"rounded-t":[P]}],"rounded-r":[{"rounded-r":[P]}],"rounded-b":[{"rounded-b":[P]}],"rounded-l":[{"rounded-l":[P]}],"rounded-ss":[{"rounded-ss":[P]}],"rounded-se":[{"rounded-se":[P]}],"rounded-ee":[{"rounded-ee":[P]}],"rounded-es":[{"rounded-es":[P]}],"rounded-tl":[{"rounded-tl":[P]}],"rounded-tr":[{"rounded-tr":[P]}],"rounded-br":[{"rounded-br":[P]}],"rounded-bl":[{"rounded-bl":[P]}],"border-w":[{border:[N]}],"border-w-x":[{"border-x":[N]}],"border-w-y":[{"border-y":[N]}],"border-w-s":[{"border-s":[N]}],"border-w-e":[{"border-e":[N]}],"border-w-t":[{"border-t":[N]}],"border-w-r":[{"border-r":[N]}],"border-w-b":[{"border-b":[N]}],"border-w-l":[{"border-l":[N]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...v1(),"hidden"]}],"divide-x":[{"divide-x":[N]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[N]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:v1()}],"border-color":[{border:[G]}],"border-color-x":[{"border-x":[G]}],"border-color-y":[{"border-y":[G]}],"border-color-s":[{"border-s":[G]}],"border-color-e":[{"border-e":[G]}],"border-color-t":[{"border-t":[G]}],"border-color-r":[{"border-r":[G]}],"border-color-b":[{"border-b":[G]}],"border-color-l":[{"border-l":[G]}],"divide-color":[{divide:[G]}],"outline-style":[{outline:["",...v1()]}],"outline-offset":[{"outline-offset":[O7,b1]}],"outline-w":[{outline:[O7,n7]}],"outline-color":[{outline:[Y]}],"ring-w":[{ring:Z0()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[Y]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[O7,n7]}],"ring-offset-color":[{"ring-offset":[Y]}],shadow:[{shadow:["","inner","none",t7,bM]}],"shadow-color":[{shadow:[xz]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...F6(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F6()}],filter:[{filter:["","none"]}],blur:[{blur:[B]}],brightness:[{brightness:[_]}],contrast:[{contrast:[T]}],"drop-shadow":[{"drop-shadow":["","none",t7,b1]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[R]}],invert:[{invert:[w]}],saturate:[{saturate:[a]}],sepia:[{sepia:[X0]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[B]}],"backdrop-brightness":[{"backdrop-brightness":[_]}],"backdrop-contrast":[{"backdrop-contrast":[T]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[R]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[a]}],"backdrop-sepia":[{"backdrop-sepia":[X0]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[F]}],"border-spacing-x":[{"border-spacing-x":[F]}],"border-spacing-y":[{"border-spacing-y":[F]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",b1]}],duration:[{duration:Q1()}],ease:[{ease:["linear","in","out","in-out",b1]}],delay:[{delay:Q1()}],animate:[{animate:["none","spin","ping","pulse","bounce",b1]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[p]}],"scale-x":[{"scale-x":[p]}],"scale-y":[{"scale-y":[p]}],rotate:[{rotate:[cz,b1]}],"translate-x":[{"translate-x":[z1]}],"translate-y":[{"translate-y":[z1]}],"skew-x":[{"skew-x":[N0]}],"skew-y":[{"skew-y":[N0]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",b1]}],accent:[{accent:["auto",Y]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",b1]}],"caret-color":[{caret:[Y]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":e()}],"scroll-mx":[{"scroll-mx":e()}],"scroll-my":[{"scroll-my":e()}],"scroll-ms":[{"scroll-ms":e()}],"scroll-me":[{"scroll-me":e()}],"scroll-mt":[{"scroll-mt":e()}],"scroll-mr":[{"scroll-mr":e()}],"scroll-mb":[{"scroll-mb":e()}],"scroll-ml":[{"scroll-ml":e()}],"scroll-p":[{"scroll-p":e()}],"scroll-px":[{"scroll-px":e()}],"scroll-py":[{"scroll-py":e()}],"scroll-ps":[{"scroll-ps":e()}],"scroll-pe":[{"scroll-pe":e()}],"scroll-pt":[{"scroll-pt":e()}],"scroll-pr":[{"scroll-pr":e()}],"scroll-pb":[{"scroll-pb":e()}],"scroll-pl":[{"scroll-pl":e()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",b1]}],fill:[{fill:[Y,"none"]}],"stroke-w":[{stroke:[O7,n7,jG]}],stroke:[{stroke:[Y,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var RB=yR(ZM);var EB=z0(X6(),1),M5=z0(l1(),1),ib=z0(X6(),1),J4=z0(l1(),1),TB=z0(l1(),1),iG=z0(l1(),1),pb=z0(X6(),1),W6=z0(l1(),1),CB=z0(X6(),1),d6=z0(l1(),1),lz=z0(l1(),1),Y0=z0(l1(),1),h4=z0(l1(),1),rG=z0(l1(),1),E0=z0(l1(),1),G6=z0(l1(),1),N1=z0(l1(),1),_0=z0(l1(),1),l0=z0(l1(),1),az=z0(l1(),1),x5=z0(X6(),1),j0=z0(l1(),1),_7=z0(X6(),1),M0=z0(l1(),1),V4=z0(l1(),1),pM=z0(X6(),1),hB=z0(l1(),1),nG=z0(X6(),1),tG=z0(l1(),1),rM=z0(X6(),1),gB=z0(l1(),1),uB=z0(X6(),1),mB=z0(l1(),1),nM=z0(X6(),1),dB=z0(l1(),1),jB=z0(l1(),1),yB=z0(l1(),1),YM=Object.defineProperty,HM=(Y,U,B)=>(U in Y)?YM(Y,U,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[U]=B,GM=(Y,U,B)=>HM(Y,typeof U!=="symbol"?U+"":U,B);function m1(...Y){return RB(LB(Y))}var Fw=[{id:"msg-1",role:"assistant",content:"Hello! I'm your AI assistant. How can I help you today?",timestamp:new Date(Date.now()-3600000)},{id:"msg-2",role:"user",content:"I want to plan a trip to Europe",timestamp:new Date(Date.now()-3500000)},{id:"msg-3",role:"assistant",content:"Great choice! Europe has amazing destinations. What's your budget and how many days do you have?",timestamp:new Date(Date.now()-3400000)},{id:"msg-4",role:"user",content:"Around $2000 for 5 days",timestamp:new Date(Date.now()-3300000)},{id:"msg-5",role:"assistant",content:"Perfect! I found some great destinations that fit your budget:",widgets:[{type:"list",id:"destinations-1",props:{items:[{id:"paris",title:"Paris, France",subtitle:"5 days • $1,850",description:"The City of Light with iconic landmarks",metadata:{city:"Paris",country:"France",lat:48.8566,lng:2.3522,price:1850,days:5}},{id:"rome",title:"Rome, Italy",subtitle:"5 days • $1,650",description:"Ancient history meets modern culture",metadata:{city:"Rome",country:"Italy",lat:41.9028,lng:12.4964,price:1650,days:5}},{id:"barcelona",title:"Barcelona, Spain",subtitle:"5 days • $1,450",description:"Beautiful beaches and Gaudí architecture",metadata:{city:"Barcelona",country:"Spain",lat:41.3851,lng:2.1734,price:1450,days:5}}]},actions:[{type:"select_destination",label:"Select",handler:"client",payload:{}},{type:"view_details",label:"Details",handler:"server",payload:{}}]}],timestamp:new Date(Date.now()-3200000)}],Rw=[{id:"thread-1",title:"Trip to Europe",preview:"Planning a 5-day trip...",createdAt:new Date(Date.now()-86400000),updatedAt:new Date(Date.now()-3600000),messageCount:12},{id:"thread-2",title:"Restaurant Recommendations",preview:"Looking for good places...",createdAt:new Date(Date.now()-172800000),updatedAt:new Date(Date.now()-86400000),messageCount:8},{id:"thread-3",title:"Budget Planning",preview:"Help with monthly budget",createdAt:new Date(Date.now()-259200000),updatedAt:new Date(Date.now()-172800000),messageCount:15}];function $M(Y=1000){return new Promise((U)=>{setTimeout(()=>{U({id:`msg-${Date.now()}`,role:"assistant",content:"This is a mock response. In production, this would come from your AI agent API.",timestamp:new Date})},Y)})}function KM(Y){let U=Y.toLowerCase();if(U.includes("analyze")||U.includes("analysis"))return`Analysis complete for "${Y}". Found 247 records with an average value of $1,234. The data shows a 23% increase compared to last quarter. Key insights: Revenue is up, customer satisfaction improved by 15%, and operational costs decreased by 8%.`;if(U.includes("sales")||U.includes("revenue"))return"Sales data processed: Q4 2024 revenue reached $2.4M, representing 18% growth year-over-year. Top performing products: Enterprise Plan (+45%), Pro Plan (+32%), Basic Plan (+12%). Regional breakdown: North America (52%), Europe (31%), APAC (17%).";if(U.includes("report")||U.includes("summary"))return"Report generated successfully. Executive Summary: Overall performance exceeded targets by 12%. Marketing ROI improved to 3.2x, customer acquisition cost reduced by 18%, and lifetime value increased by 24%. Detailed breakdown available in attached widgets.";if(U.includes("data")||U.includes("metrics"))return"Data metrics retrieved: 1,847 active users, 12,394 sessions this month, 94.2% uptime, average response time 127ms. Performance is within acceptable parameters. No critical issues detected.";if(U.includes("customer")||U.includes("user"))return"Customer analysis complete: 523 new customers this month, 89% retention rate, average satisfaction score 4.6/5. Top feedback themes: excellent support (87%), easy to use (72%), good value (68%). 3 support tickets pending review.";return"This is a mock response showing how your agent would process and respond to commands. The actual response would be generated by your AI agent based on real data and context."}function UM(Y){let U=KM(Y),B=Y.toLowerCase(),_=[],G;if(B.includes("sales")||B.includes("revenue")||B.includes("analyze"))_.push({type:"card",id:`widget-${Date.now()}-1`,props:{title:"Q4 2024 Performance",description:"Revenue: $2.4M (+18% YoY)",footer:"Updated: "+new Date().toLocaleDateString()},actions:[{type:"view_details",label:"View Details",handler:"client",payload:{reportId:"q4-2024"}}]});if(B.includes("customer")||B.includes("user"))_.push({type:"list",id:`widget-${Date.now()}-2`,props:{items:[{id:"metric-1",title:"Active Users",subtitle:"1,847 users",description:"+12% from last month"},{id:"metric-2",title:"Retention Rate",subtitle:"89%",description:"Above industry average"},{id:"metric-3",title:"Satisfaction Score",subtitle:"4.6/5",description:"Based on 234 reviews"}]}});if(B.includes("task")||B.includes("todo")||B.includes("work")||B.includes("completed"))_.push({type:"list",id:`widget-${Date.now()}-tasks`,props:{items:[{id:"task-1",title:"Implement user authentication",subtitle:"Created just now",description:"Added OAuth 2.0 support with Google and GitHub providers",backgroundColor:"rgba(59, 130, 246, 0.15)",metadata:{status:"created",priority:"high",tags:["backend","security"]}},{id:"task-2",title:"Update API documentation",subtitle:"Modified 2 minutes ago",description:"Changed endpoint descriptions and added new examples",backgroundColor:"rgba(234, 179, 8, 0.15)",metadata:{status:"modified",priority:"medium",tags:["docs"]}},{id:"task-3",title:"Fix login redirect bug",subtitle:"Completed 5 minutes ago",description:"Users now properly redirected after successful login",backgroundColor:"rgba(34, 197, 94, 0.15)",metadata:{status:"completed",priority:"urgent",tags:["bugfix","auth"]}}]},actions:[{type:"view_task",label:"View",handler:"client",payload:{}},{type:"undo",label:"Undo",handler:"server",payload:{}}]}),G={type:"update_database",payload:{table:"tasks",operation:"mark_as_viewed",taskIds:["task-1","task-2","task-3"],timestamp:new Date().toISOString()}};if(B.includes("analyze")||B.includes("analysis"))G={type:"send_notification",payload:{recipient:"team@company.com",subject:"Analysis Complete",message:"Your requested analysis has been completed and is ready for review."}};return{message:U,widgets:_,action:G}}function qM(Y,U,B,_,G=30){let{message:P,widgets:F}=UM(Y),N=P.split(" "),T=0,f=setInterval(()=>{try{if(T<N.length)U({type:"token",content:N[T]+" "}),T++;else{clearInterval(f),F.forEach((w)=>{U({type:"widget",widget:w})});let R=`mock_thread_${Date.now()}`;U({type:"complete"}),B(R)}}catch(R){clearInterval(f),_(R instanceof Error?R:Error("Mock streaming error"))}},G)}function BM(Y){return new Promise((U,B)=>{let _=new FileReader;_.onload=()=>{let P=_.result.split(",")[1];U(P)},_.onerror=()=>B(Error("Failed to read file")),_.readAsDataURL(Y)})}function OM(Y){if(Y.startsWith("image/"))return"image";return"document"}function LM(Y){return["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(Y.type)}async function _M(Y){let U=await BM(Y);return{type:OM(Y.type),source:{type:"base64",media_type:Y.type,data:U}}}async function WM(Y){let U=Array.from(Y);return await Promise.all(U.map((_)=>_M(_)))}async function MB(Y,U){if(!U||U.length===0)return Y;let B=[];if(Y.trim())B.push({type:"text",text:Y.trim()});let _=await WM(U);return B.push(..._),B}function RZ(Y){if(Y<1024)return`${Y} B`;if(Y<1048576)return`${(Y/1024).toFixed(1)} KB`;return`${(Y/1048576).toFixed(1)} MB`}var kB=10485760;function DB(Y){if(!LM(Y))return{valid:!1,error:`Unsupported file type: ${Y.type}`};if(Y.size>kB)return{valid:!1,error:`File too large: ${RZ(Y.size)} (max ${RZ(kB)})`};return{valid:!0}}var NM=["list","table"];function AM(Y){let U=[],B=!1,_=Y.match(/"items"\s*:\s*\[/);if(!_)return{items:U,isStreaming:!1};let G=Y.indexOf("[",_.index);if(G===-1)return{items:U,isStreaming:!0};let P=0,F=!1,N=!1,T=-1;for(let w=G+1;w<Y.length;w++){let E=Y[w];if(N){N=!1;continue}if(E==="\\"&&F){N=!0;continue}if(E==='"'){F=!F;continue}if(F)continue;if(E==="{"){if(P===0)T=w;P++}else if(E==="}"){if(P--,P===0&&T!==-1){let i=Y.slice(T,w+1);try{let s=JSON.parse(i);if(!s.id)s.id=`item-${U.length}-${lG(i)}`;U.push(s)}catch(s){}T=-1}}else if(E==="]"&&P===0){B=!1;break}}if(P>0||T!==-1)B=!0;let f=Y.slice(G);if(oG(f,0)===-1)B=!0;return{items:U,isStreaming:B}}function lG(Y){let U=0;for(let B=0;B<Y.length;B++){let _=Y.charCodeAt(B);U=(U<<5)-U+_,U=U&U}return Math.abs(U).toString(36)}function oG(Y,U){let B=0,_=!1,G=!1;for(let P=U;P<Y.length;P++){let F=Y[P];if(G){G=!1;continue}if(F==="\\"&&_){G=!0;continue}if(F==='"'){_=!_;continue}if(_)continue;if(F==="["||F==="{")B++;else if(F==="]"||F==="}"){if(B--,B===0)return P}}return-1}function FZ(Y){let U=[],B=!1,_=!1,G=0,P=null,F=Y,N=Y.lastIndexOf("@ui:");if(N!==-1){let R=Y.slice(N),w=R.match(/^@ui:(\w+)/);if(w){let E=w[1],i=R.indexOf("[");if(i===-1)F=Y.slice(0,N),P=E,_=!0;else{let s=N+i;if(oG(Y,s)===-1)if(NM.includes(E)){let n=Y.slice(s+1),{items:j,isStreaming:K0}=AM(n);if(j.length>0){F=Y.slice(0,N);let a=`widget-${E}-streaming-${lG(n)}`,p=F.replace(/[\s:;\-–—\.]+$/g,"").trim();if(p)U.push({type:"text",content:p});U.push({type:"widget",widget:{type:E,id:a,props:E==="table"?{rows:j,columns:[]}:{items:j},isStreaming:K0}}),B=!0,_=!1,F=""}else F=Y.slice(0,N),P=E,_=!0}else F=Y.slice(0,N),P=E,_=!0}}}if(_)F=F.replace(/[\s:;\-–—\.]+$/g,"");let T=/@ui:(\w+)\[/g,f;while((f=T.exec(F))!==null){let R=f[1],w=f.index+f[0].length-1,E=oG(F,w);if(E===-1)continue;let i=F.slice(w+1,E);if(f.index>G){let s=F.slice(G,f.index).trim();if(s)U.push({type:"text",content:s})}try{let s=i.trim(),Q0=JSON.parse(s),n=`widget-${R}-${lG(s)}`,{metadata:j,actions:K0,...a}=Q0;U.push({type:"widget",widget:{type:R,id:n,props:a,...K0&&{actions:K0},...j&&{metadata:j}}}),B=!0}catch(s){}G=E+1,T.lastIndex=G}if(G<F.length){let R=F.slice(G).trim();if(R)U.push({type:"text",content:R})}if(U.length===0&&F.trim())U.push({type:"text",content:F.trim()});if(P)U.push({type:"widget_pending",pendingType:P});return{segments:U,hasWidgets:B,hasPendingWidget:_}}var IB={card:{schema:"title, description?, image?, footer?, actions?: [{type, label}]",example:'@ui:card[{"title": "Summary", "description": "Details here"}]'},list:{schema:"items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked",example:'@ui:list[{"items": [{"id": "1", "title": "Item", "subtitle": "Info", "metadata": {"key": "value"}}]}]'},button_group:{schema:"buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits",example:'@ui:button_group[{"buttons": [{"id": "ok", "label": "OK"}]}]'},form:{schema:"title?, fields: [{name, type: text|password|number|select|checkbox|textarea|date, label, required?, placeholder?, options?}], actions: [{type, label}] - Button is built-in via actions, do NOT add separate button",example:'@ui:form[{"title": "Settings", "fields": [{"name": "apiKey", "type": "password", "label": "API Key", "required": true}], "actions": [{"type": "save", "label": "Save"}]}]'},table:{schema:"columns: [{key, label}], rows: [...], striped?, compact?",example:'@ui:table[{"columns": [{"key": "name", "label": "Name"}], "rows": [{"name": "A"}]}]'},image:{schema:"src, alt, caption?",example:'@ui:image[{"src": "url", "alt": "desc"}]'},chart:{schema:"chartType: line|bar|pie, data: {labels, datasets}",example:'@ui:chart[{"chartType": "bar", "data": {"labels": ["A"], "datasets": [{"label": "X", "data": [10]}]}}]'},flow:{schema:"title, subtitle?, icon?: research|schedule|analyze|deploy|recurring|automation|data, steps: [{id, label, type?, color?: blue|purple|cyan|amber|emerald|rose|indigo|orange, status?: pending|active|completed|error|skipped}] - Horizontal pipeline. Use @label for agents. Types auto-detected from label.",example:'@ui:flow[{"title": "Deploy Pipeline", "icon": "deploy", "steps": [{"id": "1", "label": "Test", "color": "cyan"}, {"id": "2", "label": "Build", "color": "amber"}, {"id": "3", "label": "Deploy", "color": "rose"}]}]'}},PM=Object.keys(IB),FM=["flow"],fB=PM.filter((Y)=>!FM.includes(Y));function RM(Y){let U=Y||fB,B=`
|
|
175
|
+
<%s key={someKey} {...props} />`,e0,u4,a5,u4),k1[u4+e0]=!0}}if(L===B)J1(Y1);else J5(Y1);return Y1}}function B1(L,V,c){return u1(L,V,c,!0)}function W(L,V,c){return u1(L,V,c,!1)}var m=W,l=B1;JM.Fragment=B,JM.jsx=m,JM.jsxs=l})()});var W7=z0(X6(),1),xB=z0(qB(),1);var Sv=z0(X6(),1);function SG(Y){let[U,B]=Sv.useState([]),[_,G]=Sv.useState(!0),P=Sv.useCallback(async()=>{let w=await(await fetch("/api/agents")).json();B(w.agents||[]),G(!1)},[]);Sv.useEffect(()=>{if(Y)P()},[Y,P]);let F=async(R)=>{await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)}),await P()},N=async(R)=>{await fetch(`/api/agents/${R}`,{method:"DELETE"}),await P()},T=async(R)=>{let w=R.status==="running"?"stop":"start",E=await fetch(`/api/agents/${R.id}/${w}`,{method:"POST"}),i=await E.json();if(await P(),!E.ok&&i.error)return{error:i.error};return{}},f=U.filter((R)=>R.status==="running").length;return{agents:U,loading:_,runningCount:f,fetchAgents:P,createAgent:F,deleteAgent:N,toggleAgent:T}}var db=z0(X6(),1);function hG(Y){let[U,B]=db.useState([]),_=db.useCallback(async()=>{let T=await(await fetch("/api/providers")).json();B(T.providers||[])},[]);db.useEffect(()=>{if(Y)_()},[Y,_]);let G=U.filter((N)=>N.hasKey);return{providers:U,configuredProviders:G,fetchProviders:_,saveKey:async(N,T)=>{let R=await(await fetch(`/api/keys/${N}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:T})})).json();if(!R.valid)return{success:!1,error:R.error||"API key is invalid"};let w=await fetch(`/api/keys/${N}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:T})});if(!w.ok)return{success:!1,error:(await w.json()).error||"Failed to save key"};return await _(),{success:!0}},deleteKey:async(N)=>{await fetch(`/api/keys/${N}`,{method:"DELETE"}),await _()}}}var jb=z0(X6(),1);function gG(){let[Y,U]=jb.useState(null);jb.useEffect(()=>{fetch("/api/onboarding/status").then((_)=>_.json()).then((_)=>{U(_.completed||_.has_any_keys)}).catch(()=>U(!0))},[]);let B=jb.useCallback(async()=>{await fetch("/api/onboarding/complete",{method:"POST"}),U(!0)},[]);return{isComplete:Y,setIsComplete:U,complete:B}}var p7=z0(V1(),1);function yb({message:Y="Loading...",fullScreen:U=!1}){let B=p7.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[p7.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[p7.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),p7.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p7.jsxDEV("span",{children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(U)return p7.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:B},void 0,!1,void 0,this);return p7.jsxDEV("div",{className:"flex items-center justify-center py-20",children:B},void 0,!1,void 0,this)}var mG=z0(V1(),1);function $Z({children:Y,onClose:U}){return mG.jsxDEV("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50",children:mG.jsxDEV("div",{className:"bg-[#111] rounded p-6 w-full max-w-md border border-[#1a1a1a]",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var cb=z0(X6(),1),Z4=z0(V1(),1);function jz({value:Y,options:U,onChange:B,placeholder:_="Select..."}){let[G,P]=cb.useState(!1),F=cb.useRef(null),N=U.find((T)=>T.value===Y);return cb.useEffect(()=>{function T(f){if(F.current&&!F.current.contains(f.target))P(!1)}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),Z4.jsxDEV("div",{ref:F,className:"relative",children:[Z4.jsxDEV("button",{type:"button",onClick:()=>P(!G),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition",children:[Z4.jsxDEV("span",{className:N?"text-[#e0e0e0]":"text-[#666]",children:N?Z4.jsxDEV(Z4.Fragment,{children:[N.label,N.recommended&&Z4.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):_},void 0,!1,void 0,this),Z4.jsxDEV(AR,{isOpen:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&Z4.jsxDEV("div",{className:"absolute z-50 w-full mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-auto",children:U.map((T)=>Z4.jsxDEV("button",{type:"button",onClick:()=>{B(T.value),P(!1)},className:`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${T.value===Y?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[Z4.jsxDEV("span",{children:[T.label,T.recommended&&Z4.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.value===Y&&Z4.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Z4.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},T.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AR({isOpen:Y}){return Z4.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${Y?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Z4.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Q5=z0(V1(),1);function r7({className:Y="w-4 h-4"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function hv({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function KZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function UZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function qZ({className:Y="w-5 h-5"}){return Q5.jsxDEV("svg",{className:Y,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"},void 0,!1,void 0,this),Q5.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gv=z0(V1(),1);function BZ({onNewAgent:Y,canCreateAgent:U}){return gv.jsxDEV("header",{className:"border-b border-[#1a1a1a] px-6 py-4 flex-shrink-0",children:gv.jsxDEV("div",{className:"flex items-center justify-between",children:[gv.jsxDEV("div",{className:"flex items-center gap-2",children:[gv.jsxDEV("span",{className:"text-[#f97316]",children:">_"},void 0,!1,void 0,this),gv.jsxDEV("span",{className:"text-xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gv.jsxDEV("button",{onClick:Y,disabled:!U,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:"+ New Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var P5=z0(V1(),1);function OZ({route:Y,agentCount:U,onNavigate:B}){return P5.jsxDEV("aside",{className:"w-56 border-r border-[#1a1a1a] flex-shrink-0 p-4",children:P5.jsxDEV("nav",{className:"space-y-1",children:[P5.jsxDEV(dG,{icon:P5.jsxDEV(KZ,{},void 0,!1,void 0,this),label:"Dashboard",active:Y==="dashboard",onClick:()=>B("dashboard")},void 0,!1,void 0,this),P5.jsxDEV(dG,{icon:P5.jsxDEV(UZ,{},void 0,!1,void 0,this),label:"Agents",active:Y==="agents",onClick:()=>B("agents"),badge:U>0?String(U):void 0},void 0,!1,void 0,this),P5.jsxDEV(dG,{icon:P5.jsxDEV(qZ,{},void 0,!1,void 0,this),label:"Settings",active:Y==="settings",onClick:()=>B("settings")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function dG({icon:Y,label:U,active:B,onClick:_,badge:G}){return P5.jsxDEV("button",{onClick:_,className:`w-full flex items-center gap-3 px-3 py-2 rounded font-medium transition ${B?"bg-[#111] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:[Y,U,G&&P5.jsxDEV("span",{className:"ml-auto bg-[#333] text-[#888] text-xs px-2 py-0.5 rounded-full",children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var yz=z0(V1(),1);function LZ({message:Y,onDismiss:U}){return yz.jsxDEV("div",{className:"bg-red-500/10 border-b border-red-500/30 px-6 py-3 text-red-400 text-sm flex items-center justify-between",children:[yz.jsxDEV("span",{children:Y},void 0,!1,void 0,this),yz.jsxDEV("button",{onClick:U,className:"hover:text-red-300",children:yz.jsxDEV(hv,{className:"w-4 h-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F5=z0(X6(),1);var I0=z0(V1(),1);function _Z({onComplete:Y}){let[U,B]=F5.useState(1),[_,G]=F5.useState([]),[P,F]=F5.useState(null),[N,T]=F5.useState(""),[f,R]=F5.useState(!1),[w,E]=F5.useState(!1),[i,s]=F5.useState(null),[Q0,n]=F5.useState(null);F5.useEffect(()=>{fetch("/api/providers").then((p)=>p.json()).then((p)=>G(p.providers||[]))},[]);let j=_.filter((p)=>p.hasKey),K0=async()=>{if(!P||!N)return;R(!0),s(null),n(null);try{E(!0);let X0=await(await fetch(`/api/keys/${P}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N})})).json();if(E(!1),!X0.valid){s(X0.error||"API key is invalid"),R(!1);return}let N0=await fetch(`/api/keys/${P}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N})}),n0=await N0.json();if(!N0.ok)s(n0.error||"Failed to save key");else{n("API key saved successfully!"),T("");let y0=await(await fetch("/api/providers")).json();G(y0.providers||[]),F(null)}}catch(p){s("Failed to save key")}R(!1)},a=async()=>{await fetch("/api/onboarding/complete",{method:"POST"}),Y()};return I0.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center p-8",children:I0.jsxDEV("div",{className:"w-full max-w-2xl",children:[I0.jsxDEV("div",{className:"text-center mb-8",children:[I0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-2",children:[I0.jsxDEV("span",{className:"text-[#f97316] text-3xl",children:">_"},void 0,!1,void 0,this),I0.jsxDEV("span",{className:"text-3xl tracking-wider",children:"apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("p",{className:"text-[#666]",children:"Run AI agents locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"flex items-center justify-center gap-2 mb-8",children:[I0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${U>=1?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),I0.jsxDEV("div",{className:`w-16 h-0.5 ${U>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this),I0.jsxDEV("div",{className:`w-3 h-3 rounded-full ${U>=2?"bg-[#f97316]":"bg-[#333]"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"bg-[#111] rounded-lg border border-[#1a1a1a] p-8",children:[U===1&&I0.jsxDEV(PR,{providers:_,configuredProviders:j,selectedProvider:P,apiKey:N,saving:f,testing:w,error:i,success:Q0,onSelectProvider:F,onApiKeyChange:T,onSaveKey:K0,onContinue:()=>B(2)},void 0,!1,void 0,this),U===2&&I0.jsxDEV(RR,{configuredProviders:j,onAddMore:()=>B(1),onComplete:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function PR({providers:Y,configuredProviders:U,selectedProvider:B,apiKey:_,saving:G,testing:P,error:F,success:N,onSelectProvider:T,onApiKeyChange:f,onSaveKey:R,onContinue:w}){let E=Y.find((i)=>i.id===B);if(B&&E)return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:["Add ",E.name," Key"]},void 0,!0,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:"Enter your API key below. It will be encrypted and stored locally."},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"mb-6",children:[I0.jsxDEV("div",{className:"p-4 rounded border border-[#f97316] bg-[#f97316]/5 mb-4",children:I0.jsxDEV("div",{className:"flex items-center justify-between",children:[I0.jsxDEV("div",{children:[I0.jsxDEV("p",{className:"font-medium",children:E.name},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-sm text-[#666]",children:[E.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("a",{href:E.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"space-y-3",children:[I0.jsxDEV("input",{type:"password",value:_,onChange:(i)=>f(i.target.value),placeholder:"Enter your API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-4 py-3 focus:outline-none focus:border-[#f97316] text-lg"},void 0,!1,void 0,this),F&&I0.jsxDEV("p",{className:"text-red-400 text-sm",children:F},void 0,!1,void 0,this),N&&I0.jsxDEV("p",{className:"text-green-400 text-sm",children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"flex gap-3",children:[I0.jsxDEV("button",{onClick:()=>{T(null),f("")},className:"flex-1 border border-[#333] hover:border-[#666] px-4 py-3 rounded font-medium transition",children:"Back"},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:R,disabled:!_||G,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-3 rounded font-medium transition",children:P?"Testing...":G?"Saving...":"Save API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome to apteva"},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:"To get started, you'll need to add at least one AI provider API key. Your keys are encrypted and stored locally."},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"space-y-3 mb-6",children:Y.map((i)=>I0.jsxDEV(FR,{provider:i,selected:!1,onSelect:()=>!i.hasKey&&T(i.id)},i.id,!1,void 0,this))},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:w,disabled:U.length===0,className:"w-full bg-[#222] hover:bg-[#333] disabled:opacity-50 disabled:cursor-not-allowed px-4 py-3 rounded font-medium transition",children:U.length===0?"Add at least one API key to continue":`Continue with ${U.length} provider${U.length>1?"s":""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FR({provider:Y,selected:U,onSelect:B}){return I0.jsxDEV("div",{onClick:B,className:`p-4 rounded border transition cursor-pointer ${Y.hasKey?"border-green-500/30 bg-green-500/5":U?"border-[#f97316] bg-[#f97316]/5":"border-[#222] hover:border-[#333]"}`,children:I0.jsxDEV("div",{className:"flex items-center justify-between",children:[I0.jsxDEV("div",{children:[I0.jsxDEV("p",{className:"font-medium",children:Y.name},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.models.length," models available"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?I0.jsxDEV("span",{className:"text-green-400 text-sm flex items-center gap-1",children:[I0.jsxDEV(r7,{},void 0,!1,void 0,this),"Configured (",Y.keyHint,")"]},void 0,!0,void 0,this):I0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",onClick:(_)=>_.stopPropagation(),className:"text-sm text-[#3b82f6] hover:underline",children:"Get API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function RR({configuredProviders:Y,onAddMore:U,onComplete:B}){return I0.jsxDEV(I0.Fragment,{children:[I0.jsxDEV("h2",{className:"text-2xl font-semibold mb-2",children:"You're all set!"},void 0,!1,void 0,this),I0.jsxDEV("p",{className:"text-[#666] mb-6",children:["You've configured ",Y.length," provider",Y.length>1?"s":"",". You can add more providers later in Settings."]},void 0,!0,void 0,this),I0.jsxDEV("div",{className:"space-y-2 mb-6",children:Y.map((_)=>I0.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] rounded",children:[I0.jsxDEV(r7,{className:"w-5 h-5 text-green-400"},void 0,!1,void 0,this),I0.jsxDEV("span",{children:_.name},void 0,!1,void 0,this),I0.jsxDEV("span",{className:"text-[#666] text-sm",children:["(",_.keyHint,")"]},void 0,!0,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this),I0.jsxDEV("div",{className:"flex gap-3",children:[I0.jsxDEV("button",{onClick:U,className:"flex-1 border border-[#333] hover:border-[#f97316] px-4 py-3 rounded font-medium transition",children:"Add More"},void 0,!1,void 0,this),I0.jsxDEV("button",{onClick:B,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-3 rounded font-medium transition",children:"Start Using apteva"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var L4=z0(X6(),1);var F0=z0(V1(),1);function WZ(){let[Y,U]=L4.useState("providers");return F0.jsxDEV("div",{className:"flex-1 flex overflow-hidden",children:[F0.jsxDEV("div",{className:"w-48 border-r border-[#1a1a1a] p-4",children:[F0.jsxDEV("h2",{className:"text-sm font-medium text-[#666] uppercase tracking-wider mb-3",children:"Settings"},void 0,!1,void 0,this),F0.jsxDEV("nav",{className:"space-y-1",children:[F0.jsxDEV(BB,{label:"Providers",active:Y==="providers",onClick:()=>U("providers")},void 0,!1,void 0,this),F0.jsxDEV(BB,{label:"Updates",active:Y==="updates",onClick:()=>U("updates")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[Y==="providers"&&F0.jsxDEV(MR,{},void 0,!1,void 0,this),Y==="updates"&&F0.jsxDEV(kR,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function BB({label:Y,active:U,onClick:B}){return F0.jsxDEV("button",{onClick:B,className:`w-full text-left px-3 py-2 rounded text-sm transition ${U?"bg-[#1a1a1a] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:Y},void 0,!1,void 0,this)}function MR(){let[Y,U]=L4.useState([]),[B,_]=L4.useState(null),[G,P]=L4.useState(""),[F,N]=L4.useState(!1),[T,f]=L4.useState(!1),[R,w]=L4.useState(null),[E,i]=L4.useState(null),s=async()=>{let a=await(await fetch("/api/providers")).json();U(a.providers||[])};L4.useEffect(()=>{s()},[]);let Q0=async()=>{if(!B||!G)return;N(!0),w(null),i(null);try{f(!0);let a=await(await fetch(`/api/keys/${B}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:G})})).json();if(f(!1),!a.valid){w(a.error||"API key is invalid"),N(!1);return}let p=await fetch(`/api/keys/${B}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:G})});if(!p.ok){let X0=await p.json();w(X0.error||"Failed to save key")}else i("API key saved!"),P(""),_(null),s()}catch(K0){w("Failed to save key")}N(!1)},n=async(K0)=>{if(!confirm("Are you sure you want to remove this API key?"))return;await fetch(`/api/keys/${K0}`,{method:"DELETE"}),s()},j=Y.filter((K0)=>K0.hasKey).length;return F0.jsxDEV("div",{className:"max-w-4xl",children:[F0.jsxDEV("div",{className:"mb-6",children:[F0.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"AI Providers"},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-[#666]",children:["Manage your API keys for AI providers. ",j," of ",Y.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:Y.map((K0)=>F0.jsxDEV(wR,{provider:K0,isEditing:B===K0.id,apiKey:G,saving:F,testing:T,error:B===K0.id?R:null,success:B===K0.id?E:null,onStartEdit:()=>{_(K0.id),w(null),i(null)},onCancelEdit:()=>{_(null),P(""),w(null)},onApiKeyChange:P,onSave:Q0,onDelete:()=>n(K0.id)},K0.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kR(){let[Y,U]=L4.useState(null),[B,_]=L4.useState(!1),[G,P]=L4.useState(null),[F,N]=L4.useState(!1),T=async()=>{_(!0),P(null);try{let R=await fetch("/api/version");if(!R.ok)throw Error("Failed to check for updates");let w=await R.json();U(w)}catch(R){P("Failed to check for updates")}_(!1)};L4.useEffect(()=>{T()},[]);let f=()=>{if(Y?.updateCommand)navigator.clipboard.writeText(Y.updateCommand),N(!0),setTimeout(()=>N(!1),2000)};return F0.jsxDEV("div",{className:"max-w-2xl",children:[F0.jsxDEV("div",{className:"mb-6",children:[F0.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Updates"},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-[#666]",children:"Check for new versions of apteva."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6",children:B&&!Y?F0.jsxDEV("div",{className:"text-[#666]",children:"Checking for updates..."},void 0,!1,void 0,this):G?F0.jsxDEV("div",{className:"text-red-400",children:G},void 0,!1,void 0,this):Y?F0.jsxDEV("div",{className:"space-y-4",children:[F0.jsxDEV("div",{className:"flex items-center justify-between",children:[F0.jsxDEV("div",{children:[F0.jsxDEV("div",{className:"text-sm text-[#666]",children:"Current version"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"text-xl font-mono",children:["v",Y.current]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F0.jsxDEV("div",{className:"text-right",children:[F0.jsxDEV("div",{className:"text-sm text-[#666]",children:"Latest version"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"text-xl font-mono",children:["v",Y.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.updateAvailable?F0.jsxDEV("div",{className:"bg-[#f97316]/10 border border-[#f97316]/30 rounded-lg p-4",children:[F0.jsxDEV("div",{className:"flex items-center gap-2 text-[#f97316] font-medium mb-2",children:[F0.jsxDEV("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:F0.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Update available!"]},void 0,!0,void 0,this),F0.jsxDEV("p",{className:"text-sm text-[#888] mb-3",children:"A new version of apteva is available. Run this command to update:"},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"flex items-center gap-2",children:[F0.jsxDEV("code",{className:"flex-1 bg-[#0a0a0a] px-3 py-2 rounded font-mono text-sm",children:Y.updateCommand},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:f,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:F?"Copied!":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 flex items-center gap-2 text-green-400",children:[F0.jsxDEV(r7,{className:"w-5 h-5"},void 0,!1,void 0,this),"You're running the latest version!"]},void 0,!0,void 0,this),F0.jsxDEV("button",{onClick:T,disabled:B,className:"text-sm text-[#666] hover:text-[#888] disabled:opacity-50",children:B?"Checking...":"Check again"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wR({provider:Y,isEditing:U,apiKey:B,saving:_,testing:G,error:P,success:F,onStartEdit:N,onCancelEdit:T,onApiKeyChange:f,onSave:R,onDelete:w}){return F0.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 ${Y.hasKey?"border-green-500/20":"border-[#1a1a1a]"}`,children:[F0.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[F0.jsxDEV("div",{children:[F0.jsxDEV("h3",{className:"font-medium",children:Y.name},void 0,!1,void 0,this),F0.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.models.length," models"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?F0.jsxDEV("span",{className:"text-green-400 text-xs flex items-center gap-1 bg-green-500/10 px-2 py-1 rounded",children:[F0.jsxDEV(r7,{className:"w-3 h-3"},void 0,!1,void 0,this),Y.keyHint]},void 0,!0,void 0,this):F0.jsxDEV("span",{className:"text-[#666] text-xs bg-[#1a1a1a] px-2 py-1 rounded",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.hasKey?F0.jsxDEV("div",{className:"flex items-center justify-between mt-3 pt-3 border-t border-[#1a1a1a]",children:[F0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"View docs"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:w,className:"text-red-400 hover:text-red-300 text-sm",children:"Remove key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"mt-3 pt-3 border-t border-[#1a1a1a]",children:U?F0.jsxDEV("div",{className:"space-y-3",children:[F0.jsxDEV("input",{type:"password",value:B,onChange:(E)=>f(E.target.value),placeholder:"Enter API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),P&&F0.jsxDEV("p",{className:"text-red-400 text-sm",children:P},void 0,!1,void 0,this),F&&F0.jsxDEV("p",{className:"text-green-400 text-sm",children:F},void 0,!1,void 0,this),F0.jsxDEV("div",{className:"flex gap-2",children:[F0.jsxDEV("button",{onClick:T,className:"flex-1 px-3 py-1.5 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:R,disabled:!B||_,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:G?"Validating...":_?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):F0.jsxDEV("div",{className:"flex items-center justify-between",children:[F0.jsxDEV("a",{href:Y.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API key"},void 0,!1,void 0,this),F0.jsxDEV("button",{onClick:N,className:"text-sm text-[#f97316] hover:text-[#fb923c]",children:"+ Add key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var i4=z0(V1(),1);function NZ({agent:Y,selected:U,onSelect:B,onToggle:_,onDelete:G}){return i4.jsxDEV("div",{onClick:B,className:`bg-[#111] rounded p-5 border transition cursor-pointer ${U?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,children:[i4.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[i4.jsxDEV("div",{children:[i4.jsxDEV("h3",{className:"font-semibold text-lg",children:Y.name},void 0,!1,void 0,this),i4.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.provider," / ",Y.model,Y.port&&i4.jsxDEV("span",{className:"text-[#444]",children:[" · :",Y.port]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),i4.jsxDEV(VR,{status:Y.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i4.jsxDEV("p",{className:"text-sm text-[#666] line-clamp-2 mb-4",children:Y.systemPrompt},void 0,!1,void 0,this),i4.jsxDEV("div",{className:"flex gap-2",children:[i4.jsxDEV("button",{onClick:_,className:`flex-1 px-3 py-1.5 rounded text-sm font-medium transition ${Y.status==="running"?"bg-[#f97316]/20 text-[#f97316] hover:bg-[#f97316]/30":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:Y.status==="running"?"Stop":"Start"},void 0,!1,void 0,this),i4.jsxDEV("button",{onClick:G,className:"px-3 py-1.5 rounded text-sm font-medium bg-red-500/20 text-red-400 hover:bg-red-500/30 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VR({status:Y}){return i4.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${Y==="running"?"bg-[#3b82f6]/20 text-[#3b82f6]":"bg-[#333] text-[#666]"}`,children:Y},void 0,!1,void 0,this)}var H6=z0(V1(),1);function PZ({form:Y,providers:U,configuredProviders:B,onFormChange:_,onProviderChange:G,onCreate:P,onClose:F,onGoToSettings:N}){let T=U.find((w)=>w.id===Y.provider),f=B.map((w)=>({value:w.id,label:w.name})),R=T?.models.map((w)=>({value:w.value,label:w.label,recommended:w.recommended}))||[];return H6.jsxDEV($Z,{children:[H6.jsxDEV("h2",{className:"text-xl font-semibold mb-4",children:"Create New Agent"},void 0,!1,void 0,this),B.length===0?H6.jsxDEV(DR,{onGoToSettings:N},void 0,!1,void 0,this):H6.jsxDEV(H6.Fragment,{children:[H6.jsxDEV("div",{className:"space-y-4",children:[H6.jsxDEV(AZ,{label:"Name",children:H6.jsxDEV("input",{type:"text",value:Y.name,onChange:(w)=>_({...Y,name:w.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] text-[#e0e0e0]",placeholder:"My Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"Provider",children:H6.jsxDEV(jz,{value:Y.provider,options:f,onChange:G,placeholder:"Select provider..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"Model",children:H6.jsxDEV(jz,{value:Y.model,options:R,onChange:(w)=>_({...Y,model:w}),placeholder:"Select model..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H6.jsxDEV(AZ,{label:"System Prompt",children:H6.jsxDEV("textarea",{value:Y.systemPrompt,onChange:(w)=>_({...Y,systemPrompt:w.target.value}),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 h-24 resize-none focus:outline-none focus:border-[#f97316] text-[#e0e0e0]"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H6.jsxDEV("div",{className:"flex gap-3 mt-6",children:[H6.jsxDEV("button",{onClick:F,className:"flex-1 border border-[#333] hover:border-[#f97316] hover:text-[#f97316] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),H6.jsxDEV("button",{onClick:P,disabled:!Y.name,className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function AZ({label:Y,children:U}){return H6.jsxDEV("div",{children:[H6.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:Y},void 0,!1,void 0,this),U]},void 0,!0,void 0,this)}function DR({onGoToSettings:Y}){return H6.jsxDEV("div",{className:"text-center py-6",children:[H6.jsxDEV("p",{className:"text-[#666] mb-4",children:"No API keys configured. Add a provider key first."},void 0,!1,void 0,this),H6.jsxDEV("button",{onClick:Y,className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Go to Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F1=z0(X6(),1),ob=z0(X6(),1),mv=z0(X6(),1);function OB(Y){var U,B,_="";if(typeof Y=="string"||typeof Y=="number")_+=Y;else if(typeof Y=="object")if(Array.isArray(Y)){var G=Y.length;for(U=0;U<G;U++)Y[U]&&(B=OB(Y[U]))&&(_&&(_+=" "),_+=B)}else for(B in Y)Y[B]&&(_&&(_+=" "),_+=B);return _}function LB(){for(var Y,U,B=0,_="",G=arguments.length;B<G;B++)(Y=arguments[B])&&(U=OB(Y))&&(_&&(_+=" "),_+=U);return _}var IR=(Y)=>{let U=ER(Y),{conflictingClassGroups:B,conflictingClassGroupModifiers:_}=Y;return{getClassGroupId:(F)=>{let N=F.split("-");if(N[0]===""&&N.length!==1)N.shift();return NB(N,U)||fR(F)},getConflictingClassGroupIds:(F,N)=>{let T=B[F]||[];if(N&&_[F])return[...T,..._[F]];return T}}},NB=(Y,U)=>{if(Y.length===0)return U.classGroupId;let B=Y[0],_=U.nextPart.get(B),G=_?NB(Y.slice(1),_):void 0;if(G)return G;if(U.validators.length===0)return;let P=Y.join("-");return U.validators.find(({validator:F})=>F(P))?.classGroupId},_B=/^\[(.+)\]$/,fR=(Y)=>{if(_B.test(Y)){let U=_B.exec(Y)[1],B=U?.substring(0,U.indexOf(":"));if(B)return"arbitrary.."+B}},ER=(Y)=>{let{theme:U,prefix:B}=Y,_={nextPart:new Map,validators:[]};return CR(Object.entries(Y.classGroups),B).forEach(([P,F])=>{yG(F,_,P,U)}),_},yG=(Y,U,B,_)=>{Y.forEach((G)=>{if(typeof G==="string"){let P=G===""?U:WB(U,G);P.classGroupId=B;return}if(typeof G==="function"){if(TR(G)){yG(G(_),U,B,_);return}U.validators.push({validator:G,classGroupId:B});return}Object.entries(G).forEach(([P,F])=>{yG(F,WB(U,P),B,_)})})},WB=(Y,U)=>{let B=Y;return U.split("-").forEach((_)=>{if(!B.nextPart.has(_))B.nextPart.set(_,{nextPart:new Map,validators:[]});B=B.nextPart.get(_)}),B},TR=(Y)=>Y.isThemeGetter,CR=(Y,U)=>{if(!U)return Y;return Y.map(([B,_])=>{let G=_.map((P)=>{if(typeof P==="string")return U+P;if(typeof P==="object")return Object.fromEntries(Object.entries(P).map(([F,N])=>[U+F,N]));return P});return[B,G]})},SR=(Y)=>{if(Y<1)return{get:()=>{return},set:()=>{}};let U=0,B=new Map,_=new Map,G=(P,F)=>{if(B.set(P,F),U++,U>Y)U=0,_=B,B=new Map};return{get(P){let F=B.get(P);if(F!==void 0)return F;if((F=_.get(P))!==void 0)return G(P,F),F},set(P,F){if(B.has(P))B.set(P,F);else G(P,F)}}};var hR=(Y)=>{let{separator:U,experimentalParseClassName:B}=Y,_=U.length===1,G=U[0],P=U.length,F=(N)=>{let T=[],f=0,R=0,w;for(let n=0;n<N.length;n++){let j=N[n];if(f===0){if(j===G&&(_||N.slice(n,n+P)===U)){T.push(N.slice(R,n)),R=n+P;continue}if(j==="/"){w=n;continue}}if(j==="[")f++;else if(j==="]")f--}let E=T.length===0?N:N.substring(R),i=E.startsWith("!"),s=i?E.substring(1):E,Q0=w&&w>R?w-R:void 0;return{modifiers:T,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:Q0}};if(B)return(N)=>B({className:N,parseClassName:F});return F},gR=(Y)=>{if(Y.length<=1)return Y;let U=[],B=[];return Y.forEach((_)=>{if(_[0]==="[")U.push(...B.sort(),_),B=[];else B.push(_)}),U.push(...B.sort()),U},uR=(Y)=>({cache:SR(Y.cacheSize),parseClassName:hR(Y),...IR(Y)}),mR=/\s+/,dR=(Y,U)=>{let{parseClassName:B,getClassGroupId:_,getConflictingClassGroupIds:G}=U,P=[],F=Y.trim().split(mR),N="";for(let T=F.length-1;T>=0;T-=1){let f=F[T],{modifiers:R,hasImportantModifier:w,baseClassName:E,maybePostfixModifierPosition:i}=B(f),s=Boolean(i),Q0=_(s?E.substring(0,i):E);if(!Q0){if(!s){N=f+(N.length>0?" "+N:N);continue}if(Q0=_(E),!Q0){N=f+(N.length>0?" "+N:N);continue}s=!1}let n=gR(R).join(":"),j=w?n+"!":n,K0=j+Q0;if(P.includes(K0))continue;P.push(K0);let a=G(Q0,s);for(let p=0;p<a.length;++p){let X0=a[p];P.push(j+X0)}N=f+(N.length>0?" "+N:N)}return N};function jR(){let Y=0,U,B,_="";while(Y<arguments.length)if(U=arguments[Y++]){if(B=AB(U))_&&(_+=" "),_+=B}return _}var AB=(Y)=>{if(typeof Y==="string")return Y;let U,B="";for(let _=0;_<Y.length;_++)if(Y[_]){if(U=AB(Y[_]))B&&(B+=" "),B+=U}return B};function yR(Y,...U){let B,_,G,P=F;function F(T){let f=U.reduce((R,w)=>w(R),Y());return B=uR(f),_=B.cache.get,G=B.cache.set,P=N,N(T)}function N(T){let f=_(T);if(f)return f;let R=dR(T,B);return G(T,R),R}return function(){return P(jR.apply(null,arguments))}}var Z6=(Y)=>{let U=(B)=>B[Y]||[];return U.isThemeGetter=!0,U},PB=/^\[(?:([a-z-]+):)?(.+)\]$/i,cR=/^\d+\/\d+$/,xR=new Set(["px","full","screen"]),aR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,iR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,O7=(Y)=>xb(Y)||xR.has(Y)||cR.test(Y),n7=(Y)=>ab(Y,"length",zM),xb=(Y)=>Boolean(Y)&&!Number.isNaN(Number(Y)),jG=(Y)=>ab(Y,"number",xb),cz=(Y)=>Boolean(Y)&&Number.isInteger(Number(Y)),rR=(Y)=>Y.endsWith("%")&&xb(Y.slice(0,-1)),b1=(Y)=>PB.test(Y),t7=(Y)=>aR.test(Y),nR=new Set(["length","size","percentage"]),tR=(Y)=>ab(Y,nR,FB),sR=(Y)=>ab(Y,"position",FB),eR=new Set(["image","url"]),vM=(Y)=>ab(Y,eR,XM),bM=(Y)=>ab(Y,"",QM),xz=()=>!0,ab=(Y,U,B)=>{let _=PB.exec(Y);if(_){if(_[1])return typeof U==="string"?_[1]===U:U.has(_[1]);return B(_[2])}return!1},zM=(Y)=>lR.test(Y)&&!oR.test(Y),FB=()=>!1,QM=(Y)=>iR.test(Y),XM=(Y)=>pR.test(Y);var ZM=()=>{let Y=Z6("colors"),U=Z6("spacing"),B=Z6("blur"),_=Z6("brightness"),G=Z6("borderColor"),P=Z6("borderRadius"),F=Z6("borderSpacing"),N=Z6("borderWidth"),T=Z6("contrast"),f=Z6("grayscale"),R=Z6("hueRotate"),w=Z6("invert"),E=Z6("gap"),i=Z6("gradientColorStops"),s=Z6("gradientColorStopPositions"),Q0=Z6("inset"),n=Z6("margin"),j=Z6("opacity"),K0=Z6("padding"),a=Z6("saturate"),p=Z6("scale"),X0=Z6("sepia"),N0=Z6("skew"),n0=Z6("space"),z1=Z6("translate"),y0=()=>["auto","contain","none"],A0=()=>["auto","hidden","clip","visible","scroll"],h0=()=>["auto",b1,U],e=()=>[b1,U],Z0=()=>["",O7,n7],k0=()=>["auto",xb,b1],L0=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],v1=()=>["solid","dashed","dotted","double","none"],F6=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],t1=()=>["start","end","center","between","around","evenly","stretch"],d1=()=>["","0",b1],u0=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q1=()=>[xb,b1];return{cacheSize:500,separator:":",theme:{colors:[xz],spacing:[O7,n7],blur:["none","",t7,b1],brightness:Q1(),borderColor:[Y],borderRadius:["none","","full",t7,b1],borderSpacing:e(),borderWidth:Z0(),contrast:Q1(),grayscale:d1(),hueRotate:Q1(),invert:d1(),gap:e(),gradientColorStops:[Y],gradientColorStopPositions:[rR,n7],inset:h0(),margin:h0(),opacity:Q1(),padding:e(),saturate:Q1(),scale:Q1(),sepia:d1(),skew:Q1(),space:e(),translate:e()},classGroups:{aspect:[{aspect:["auto","square","video",b1]}],container:["container"],columns:[{columns:[t7]}],"break-after":[{"break-after":u0()}],"break-before":[{"break-before":u0()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L0(),b1]}],overflow:[{overflow:A0()}],"overflow-x":[{"overflow-x":A0()}],"overflow-y":[{"overflow-y":A0()}],overscroll:[{overscroll:y0()}],"overscroll-x":[{"overscroll-x":y0()}],"overscroll-y":[{"overscroll-y":y0()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[Q0]}],"inset-x":[{"inset-x":[Q0]}],"inset-y":[{"inset-y":[Q0]}],start:[{start:[Q0]}],end:[{end:[Q0]}],top:[{top:[Q0]}],right:[{right:[Q0]}],bottom:[{bottom:[Q0]}],left:[{left:[Q0]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",cz,b1]}],basis:[{basis:h0()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",b1]}],grow:[{grow:d1()}],shrink:[{shrink:d1()}],order:[{order:["first","last","none",cz,b1]}],"grid-cols":[{"grid-cols":[xz]}],"col-start-end":[{col:["auto",{span:["full",cz,b1]},b1]}],"col-start":[{"col-start":k0()}],"col-end":[{"col-end":k0()}],"grid-rows":[{"grid-rows":[xz]}],"row-start-end":[{row:["auto",{span:[cz,b1]},b1]}],"row-start":[{"row-start":k0()}],"row-end":[{"row-end":k0()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",b1]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",b1]}],gap:[{gap:[E]}],"gap-x":[{"gap-x":[E]}],"gap-y":[{"gap-y":[E]}],"justify-content":[{justify:["normal",...t1()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...t1(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...t1(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[K0]}],px:[{px:[K0]}],py:[{py:[K0]}],ps:[{ps:[K0]}],pe:[{pe:[K0]}],pt:[{pt:[K0]}],pr:[{pr:[K0]}],pb:[{pb:[K0]}],pl:[{pl:[K0]}],m:[{m:[n]}],mx:[{mx:[n]}],my:[{my:[n]}],ms:[{ms:[n]}],me:[{me:[n]}],mt:[{mt:[n]}],mr:[{mr:[n]}],mb:[{mb:[n]}],ml:[{ml:[n]}],"space-x":[{"space-x":[n0]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[n0]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",b1,U]}],"min-w":[{"min-w":[b1,U,"min","max","fit"]}],"max-w":[{"max-w":[b1,U,"none","full","min","max","fit","prose",{screen:[t7]},t7]}],h:[{h:[b1,U,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[b1,U,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[b1,U,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[b1,U,"auto","min","max","fit"]}],"font-size":[{text:["base",t7,n7]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",jG]}],"font-family":[{font:[xz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",b1]}],"line-clamp":[{"line-clamp":["none",xb,jG]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",O7,b1]}],"list-image":[{"list-image":["none",b1]}],"list-style-type":[{list:["none","disc","decimal",b1]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[Y]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[Y]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...v1(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",O7,n7]}],"underline-offset":[{"underline-offset":["auto",O7,b1]}],"text-decoration-color":[{decoration:[Y]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:e()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",b1]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",b1]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L0(),sR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vM]}],"bg-color":[{bg:[Y]}],"gradient-from-pos":[{from:[s]}],"gradient-via-pos":[{via:[s]}],"gradient-to-pos":[{to:[s]}],"gradient-from":[{from:[i]}],"gradient-via":[{via:[i]}],"gradient-to":[{to:[i]}],rounded:[{rounded:[P]}],"rounded-s":[{"rounded-s":[P]}],"rounded-e":[{"rounded-e":[P]}],"rounded-t":[{"rounded-t":[P]}],"rounded-r":[{"rounded-r":[P]}],"rounded-b":[{"rounded-b":[P]}],"rounded-l":[{"rounded-l":[P]}],"rounded-ss":[{"rounded-ss":[P]}],"rounded-se":[{"rounded-se":[P]}],"rounded-ee":[{"rounded-ee":[P]}],"rounded-es":[{"rounded-es":[P]}],"rounded-tl":[{"rounded-tl":[P]}],"rounded-tr":[{"rounded-tr":[P]}],"rounded-br":[{"rounded-br":[P]}],"rounded-bl":[{"rounded-bl":[P]}],"border-w":[{border:[N]}],"border-w-x":[{"border-x":[N]}],"border-w-y":[{"border-y":[N]}],"border-w-s":[{"border-s":[N]}],"border-w-e":[{"border-e":[N]}],"border-w-t":[{"border-t":[N]}],"border-w-r":[{"border-r":[N]}],"border-w-b":[{"border-b":[N]}],"border-w-l":[{"border-l":[N]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...v1(),"hidden"]}],"divide-x":[{"divide-x":[N]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[N]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:v1()}],"border-color":[{border:[G]}],"border-color-x":[{"border-x":[G]}],"border-color-y":[{"border-y":[G]}],"border-color-s":[{"border-s":[G]}],"border-color-e":[{"border-e":[G]}],"border-color-t":[{"border-t":[G]}],"border-color-r":[{"border-r":[G]}],"border-color-b":[{"border-b":[G]}],"border-color-l":[{"border-l":[G]}],"divide-color":[{divide:[G]}],"outline-style":[{outline:["",...v1()]}],"outline-offset":[{"outline-offset":[O7,b1]}],"outline-w":[{outline:[O7,n7]}],"outline-color":[{outline:[Y]}],"ring-w":[{ring:Z0()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[Y]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[O7,n7]}],"ring-offset-color":[{"ring-offset":[Y]}],shadow:[{shadow:["","inner","none",t7,bM]}],"shadow-color":[{shadow:[xz]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...F6(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F6()}],filter:[{filter:["","none"]}],blur:[{blur:[B]}],brightness:[{brightness:[_]}],contrast:[{contrast:[T]}],"drop-shadow":[{"drop-shadow":["","none",t7,b1]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[R]}],invert:[{invert:[w]}],saturate:[{saturate:[a]}],sepia:[{sepia:[X0]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[B]}],"backdrop-brightness":[{"backdrop-brightness":[_]}],"backdrop-contrast":[{"backdrop-contrast":[T]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[R]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[a]}],"backdrop-sepia":[{"backdrop-sepia":[X0]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[F]}],"border-spacing-x":[{"border-spacing-x":[F]}],"border-spacing-y":[{"border-spacing-y":[F]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",b1]}],duration:[{duration:Q1()}],ease:[{ease:["linear","in","out","in-out",b1]}],delay:[{delay:Q1()}],animate:[{animate:["none","spin","ping","pulse","bounce",b1]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[p]}],"scale-x":[{"scale-x":[p]}],"scale-y":[{"scale-y":[p]}],rotate:[{rotate:[cz,b1]}],"translate-x":[{"translate-x":[z1]}],"translate-y":[{"translate-y":[z1]}],"skew-x":[{"skew-x":[N0]}],"skew-y":[{"skew-y":[N0]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",b1]}],accent:[{accent:["auto",Y]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",b1]}],"caret-color":[{caret:[Y]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":e()}],"scroll-mx":[{"scroll-mx":e()}],"scroll-my":[{"scroll-my":e()}],"scroll-ms":[{"scroll-ms":e()}],"scroll-me":[{"scroll-me":e()}],"scroll-mt":[{"scroll-mt":e()}],"scroll-mr":[{"scroll-mr":e()}],"scroll-mb":[{"scroll-mb":e()}],"scroll-ml":[{"scroll-ml":e()}],"scroll-p":[{"scroll-p":e()}],"scroll-px":[{"scroll-px":e()}],"scroll-py":[{"scroll-py":e()}],"scroll-ps":[{"scroll-ps":e()}],"scroll-pe":[{"scroll-pe":e()}],"scroll-pt":[{"scroll-pt":e()}],"scroll-pr":[{"scroll-pr":e()}],"scroll-pb":[{"scroll-pb":e()}],"scroll-pl":[{"scroll-pl":e()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",b1]}],fill:[{fill:[Y,"none"]}],"stroke-w":[{stroke:[O7,n7,jG]}],stroke:[{stroke:[Y,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var RB=yR(ZM);var EB=z0(X6(),1),M5=z0(l1(),1),ib=z0(X6(),1),J4=z0(l1(),1),TB=z0(l1(),1),iG=z0(l1(),1),pb=z0(X6(),1),W6=z0(l1(),1),CB=z0(X6(),1),d6=z0(l1(),1),lz=z0(l1(),1),Y0=z0(l1(),1),h4=z0(l1(),1),rG=z0(l1(),1),E0=z0(l1(),1),G6=z0(l1(),1),N1=z0(l1(),1),_0=z0(l1(),1),l0=z0(l1(),1),az=z0(l1(),1),x5=z0(X6(),1),j0=z0(l1(),1),_7=z0(X6(),1),M0=z0(l1(),1),V4=z0(l1(),1),pM=z0(X6(),1),hB=z0(l1(),1),nG=z0(X6(),1),tG=z0(l1(),1),rM=z0(X6(),1),gB=z0(l1(),1),uB=z0(X6(),1),mB=z0(l1(),1),nM=z0(X6(),1),dB=z0(l1(),1),jB=z0(l1(),1),yB=z0(l1(),1),YM=Object.defineProperty,HM=(Y,U,B)=>(U in Y)?YM(Y,U,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[U]=B,GM=(Y,U,B)=>HM(Y,typeof U!=="symbol"?U+"":U,B);function m1(...Y){return RB(LB(Y))}var Fw=[{id:"msg-1",role:"assistant",content:"Hello! I'm your AI assistant. How can I help you today?",timestamp:new Date(Date.now()-3600000)},{id:"msg-2",role:"user",content:"I want to plan a trip to Europe",timestamp:new Date(Date.now()-3500000)},{id:"msg-3",role:"assistant",content:"Great choice! Europe has amazing destinations. What's your budget and how many days do you have?",timestamp:new Date(Date.now()-3400000)},{id:"msg-4",role:"user",content:"Around $2000 for 5 days",timestamp:new Date(Date.now()-3300000)},{id:"msg-5",role:"assistant",content:"Perfect! I found some great destinations that fit your budget:",widgets:[{type:"list",id:"destinations-1",props:{items:[{id:"paris",title:"Paris, France",subtitle:"5 days • $1,850",description:"The City of Light with iconic landmarks",metadata:{city:"Paris",country:"France",lat:48.8566,lng:2.3522,price:1850,days:5}},{id:"rome",title:"Rome, Italy",subtitle:"5 days • $1,650",description:"Ancient history meets modern culture",metadata:{city:"Rome",country:"Italy",lat:41.9028,lng:12.4964,price:1650,days:5}},{id:"barcelona",title:"Barcelona, Spain",subtitle:"5 days • $1,450",description:"Beautiful beaches and Gaudí architecture",metadata:{city:"Barcelona",country:"Spain",lat:41.3851,lng:2.1734,price:1450,days:5}}]},actions:[{type:"select_destination",label:"Select",handler:"client",payload:{}},{type:"view_details",label:"Details",handler:"server",payload:{}}]}],timestamp:new Date(Date.now()-3200000)}],Rw=[{id:"thread-1",title:"Trip to Europe",preview:"Planning a 5-day trip...",createdAt:new Date(Date.now()-86400000),updatedAt:new Date(Date.now()-3600000),messageCount:12},{id:"thread-2",title:"Restaurant Recommendations",preview:"Looking for good places...",createdAt:new Date(Date.now()-172800000),updatedAt:new Date(Date.now()-86400000),messageCount:8},{id:"thread-3",title:"Budget Planning",preview:"Help with monthly budget",createdAt:new Date(Date.now()-259200000),updatedAt:new Date(Date.now()-172800000),messageCount:15}];function $M(Y=1000){return new Promise((U)=>{setTimeout(()=>{U({id:`msg-${Date.now()}`,role:"assistant",content:"This is a mock response. In production, this would come from your AI agent API.",timestamp:new Date})},Y)})}function KM(Y){let U=Y.toLowerCase();if(U.includes("analyze")||U.includes("analysis"))return`Analysis complete for "${Y}". Found 247 records with an average value of $1,234. The data shows a 23% increase compared to last quarter. Key insights: Revenue is up, customer satisfaction improved by 15%, and operational costs decreased by 8%.`;if(U.includes("sales")||U.includes("revenue"))return"Sales data processed: Q4 2024 revenue reached $2.4M, representing 18% growth year-over-year. Top performing products: Enterprise Plan (+45%), Pro Plan (+32%), Basic Plan (+12%). Regional breakdown: North America (52%), Europe (31%), APAC (17%).";if(U.includes("report")||U.includes("summary"))return"Report generated successfully. Executive Summary: Overall performance exceeded targets by 12%. Marketing ROI improved to 3.2x, customer acquisition cost reduced by 18%, and lifetime value increased by 24%. Detailed breakdown available in attached widgets.";if(U.includes("data")||U.includes("metrics"))return"Data metrics retrieved: 1,847 active users, 12,394 sessions this month, 94.2% uptime, average response time 127ms. Performance is within acceptable parameters. No critical issues detected.";if(U.includes("customer")||U.includes("user"))return"Customer analysis complete: 523 new customers this month, 89% retention rate, average satisfaction score 4.6/5. Top feedback themes: excellent support (87%), easy to use (72%), good value (68%). 3 support tickets pending review.";return"This is a mock response showing how your agent would process and respond to commands. The actual response would be generated by your AI agent based on real data and context."}function UM(Y){let U=KM(Y),B=Y.toLowerCase(),_=[],G;if(B.includes("sales")||B.includes("revenue")||B.includes("analyze"))_.push({type:"card",id:`widget-${Date.now()}-1`,props:{title:"Q4 2024 Performance",description:"Revenue: $2.4M (+18% YoY)",footer:"Updated: "+new Date().toLocaleDateString()},actions:[{type:"view_details",label:"View Details",handler:"client",payload:{reportId:"q4-2024"}}]});if(B.includes("customer")||B.includes("user"))_.push({type:"list",id:`widget-${Date.now()}-2`,props:{items:[{id:"metric-1",title:"Active Users",subtitle:"1,847 users",description:"+12% from last month"},{id:"metric-2",title:"Retention Rate",subtitle:"89%",description:"Above industry average"},{id:"metric-3",title:"Satisfaction Score",subtitle:"4.6/5",description:"Based on 234 reviews"}]}});if(B.includes("task")||B.includes("todo")||B.includes("work")||B.includes("completed"))_.push({type:"list",id:`widget-${Date.now()}-tasks`,props:{items:[{id:"task-1",title:"Implement user authentication",subtitle:"Created just now",description:"Added OAuth 2.0 support with Google and GitHub providers",backgroundColor:"rgba(59, 130, 246, 0.15)",metadata:{status:"created",priority:"high",tags:["backend","security"]}},{id:"task-2",title:"Update API documentation",subtitle:"Modified 2 minutes ago",description:"Changed endpoint descriptions and added new examples",backgroundColor:"rgba(234, 179, 8, 0.15)",metadata:{status:"modified",priority:"medium",tags:["docs"]}},{id:"task-3",title:"Fix login redirect bug",subtitle:"Completed 5 minutes ago",description:"Users now properly redirected after successful login",backgroundColor:"rgba(34, 197, 94, 0.15)",metadata:{status:"completed",priority:"urgent",tags:["bugfix","auth"]}}]},actions:[{type:"view_task",label:"View",handler:"client",payload:{}},{type:"undo",label:"Undo",handler:"server",payload:{}}]}),G={type:"update_database",payload:{table:"tasks",operation:"mark_as_viewed",taskIds:["task-1","task-2","task-3"],timestamp:new Date().toISOString()}};if(B.includes("analyze")||B.includes("analysis"))G={type:"send_notification",payload:{recipient:"team@company.com",subject:"Analysis Complete",message:"Your requested analysis has been completed and is ready for review."}};return{message:U,widgets:_,action:G}}function qM(Y,U,B,_,G=30){let{message:P,widgets:F}=UM(Y),N=P.split(" "),T=0,f=setInterval(()=>{try{if(T<N.length)U({type:"token",content:N[T]+" "}),T++;else{clearInterval(f),F.forEach((w)=>{U({type:"widget",widget:w})});let R=`mock_thread_${Date.now()}`;U({type:"complete"}),B(R)}}catch(R){clearInterval(f),_(R instanceof Error?R:Error("Mock streaming error"))}},G)}function BM(Y){return new Promise((U,B)=>{let _=new FileReader;_.onload=()=>{let P=_.result.split(",")[1];U(P)},_.onerror=()=>B(Error("Failed to read file")),_.readAsDataURL(Y)})}function OM(Y){if(Y.startsWith("image/"))return"image";return"document"}function LM(Y){return["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(Y.type)}async function _M(Y){let U=await BM(Y);return{type:OM(Y.type),source:{type:"base64",media_type:Y.type,data:U}}}async function WM(Y){let U=Array.from(Y);return await Promise.all(U.map((_)=>_M(_)))}async function MB(Y,U){if(!U||U.length===0)return Y;let B=[];if(Y.trim())B.push({type:"text",text:Y.trim()});let _=await WM(U);return B.push(..._),B}function RZ(Y){if(Y<1024)return`${Y} B`;if(Y<1048576)return`${(Y/1024).toFixed(1)} KB`;return`${(Y/1048576).toFixed(1)} MB`}var kB=10485760;function DB(Y){if(!LM(Y))return{valid:!1,error:`Unsupported file type: ${Y.type}`};if(Y.size>kB)return{valid:!1,error:`File too large: ${RZ(Y.size)} (max ${RZ(kB)})`};return{valid:!0}}var NM=["list","table"];function AM(Y){let U=[],B=!1,_=Y.match(/"items"\s*:\s*\[/);if(!_)return{items:U,isStreaming:!1};let G=Y.indexOf("[",_.index);if(G===-1)return{items:U,isStreaming:!0};let P=0,F=!1,N=!1,T=-1;for(let w=G+1;w<Y.length;w++){let E=Y[w];if(N){N=!1;continue}if(E==="\\"&&F){N=!0;continue}if(E==='"'){F=!F;continue}if(F)continue;if(E==="{"){if(P===0)T=w;P++}else if(E==="}"){if(P--,P===0&&T!==-1){let i=Y.slice(T,w+1);try{let s=JSON.parse(i);if(!s.id)s.id=`item-${U.length}-${lG(i)}`;U.push(s)}catch(s){}T=-1}}else if(E==="]"&&P===0){B=!1;break}}if(P>0||T!==-1)B=!0;let f=Y.slice(G);if(oG(f,0)===-1)B=!0;return{items:U,isStreaming:B}}function lG(Y){let U=0;for(let B=0;B<Y.length;B++){let _=Y.charCodeAt(B);U=(U<<5)-U+_,U=U&U}return Math.abs(U).toString(36)}function oG(Y,U){let B=0,_=!1,G=!1;for(let P=U;P<Y.length;P++){let F=Y[P];if(G){G=!1;continue}if(F==="\\"&&_){G=!0;continue}if(F==='"'){_=!_;continue}if(_)continue;if(F==="["||F==="{")B++;else if(F==="]"||F==="}"){if(B--,B===0)return P}}return-1}function FZ(Y){let U=[],B=!1,_=!1,G=0,P=null,F=Y,N=Y.lastIndexOf("@ui:");if(N!==-1){let R=Y.slice(N),w=R.match(/^@ui:(\w+)/);if(w){let E=w[1],i=R.indexOf("[");if(i===-1)F=Y.slice(0,N),P=E,_=!0;else{let s=N+i;if(oG(Y,s)===-1)if(NM.includes(E)){let n=Y.slice(s+1),{items:j,isStreaming:K0}=AM(n);if(j.length>0){F=Y.slice(0,N);let a=`widget-${E}-streaming-${lG(n)}`,p=F.replace(/[\s:;\-–—\.]+$/g,"").trim();if(p)U.push({type:"text",content:p});U.push({type:"widget",widget:{type:E,id:a,props:E==="table"?{rows:j,columns:[]}:{items:j},isStreaming:K0}}),B=!0,_=!1,F=""}else F=Y.slice(0,N),P=E,_=!0}else F=Y.slice(0,N),P=E,_=!0}}}if(_)F=F.replace(/[\s:;\-–—\.]+$/g,"");let T=/@ui:(\w+)\[/g,f;while((f=T.exec(F))!==null){let R=f[1],w=f.index+f[0].length-1,E=oG(F,w);if(E===-1)continue;let i=F.slice(w+1,E);if(f.index>G){let s=F.slice(G,f.index).trim();if(s)U.push({type:"text",content:s})}try{let s=i.trim(),Q0=JSON.parse(s),n=`widget-${R}-${lG(s)}`,{metadata:j,actions:K0,...a}=Q0;U.push({type:"widget",widget:{type:R,id:n,props:a,...K0&&{actions:K0},...j&&{metadata:j}}}),B=!0}catch(s){}G=E+1,T.lastIndex=G}if(G<F.length){let R=F.slice(G).trim();if(R)U.push({type:"text",content:R})}if(U.length===0&&F.trim())U.push({type:"text",content:F.trim()});if(P)U.push({type:"widget_pending",pendingType:P});return{segments:U,hasWidgets:B,hasPendingWidget:_}}var IB={card:{schema:"title, description?, image?, footer?, actions?: [{type, label}]",example:'@ui:card[{"title": "Summary", "description": "Details here"}]'},list:{schema:"items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked",example:'@ui:list[{"items": [{"id": "1", "title": "Item", "subtitle": "Info", "metadata": {"key": "value"}}]}]'},button_group:{schema:"buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits",example:'@ui:button_group[{"buttons": [{"id": "ok", "label": "OK"}]}]'},form:{schema:"title?, fields: [{name, type: text|password|number|select|checkbox|textarea|date, label, required?, placeholder?, options?}], actions: [{type, label}] - Button is built-in via actions, do NOT add separate button",example:'@ui:form[{"title": "Settings", "fields": [{"name": "apiKey", "type": "password", "label": "API Key", "required": true}], "actions": [{"type": "save", "label": "Save"}]}]'},table:{schema:"columns: [{key, label}], rows: [...], striped?, compact?",example:'@ui:table[{"columns": [{"key": "name", "label": "Name"}], "rows": [{"name": "A"}]}]'},image:{schema:"src, alt, caption?",example:'@ui:image[{"src": "url", "alt": "desc"}]'},chart:{schema:"chartType: line|bar|pie, data: {labels, datasets}",example:'@ui:chart[{"chartType": "bar", "data": {"labels": ["A"], "datasets": [{"label": "X", "data": [10]}]}}]'},flow:{schema:"title, subtitle?, icon?: research|schedule|analyze|deploy|recurring|automation|data, steps: [{id, label, type?, color?: blue|purple|cyan|amber|emerald|rose|indigo|orange, status?: pending|active|completed|error|skipped}] - Horizontal pipeline. Use @label for agents. Types auto-detected from label.",example:'@ui:flow[{"title": "Deploy Pipeline", "icon": "deploy", "steps": [{"id": "1", "label": "Test", "color": "cyan"}, {"id": "2", "label": "Build", "color": "amber"}, {"id": "3", "label": "Deploy", "color": "rose"}]}]'}},PM=Object.keys(IB),FM=["flow"],fB=PM.filter((Y)=>!FM.includes(Y));function RM(Y){let U=Y||fB,B=`
|
|
176
176
|
## UI Widgets
|
|
177
177
|
SYNTAX: @ui:type[{json}] - MUST use SQUARE BRACKETS [] around the JSON object.
|
|
178
178
|
CORRECT: @ui:list[{"items": [...]}]
|
|
@@ -210,4 +210,4 @@ ${J1}`;w5(k1)},p4=()=>{y1(f0),J0(""),C0(""),o0("idle")},G4=async()=>{if(H4&&U)tr
|
|
|
210
210
|
}
|
|
211
211
|
`}})]})});var Y4=z0(V1(),1);function MZ({agent:Y,onClose:U,onStartAgent:B}){if(Y.status==="running"&&Y.port)return Y4.jsxDEV("div",{className:"w-1/2 flex flex-col overflow-hidden",children:Y4.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden relative",children:[Y4.jsxDEV("button",{onClick:U,className:"absolute top-3 right-3 z-10 text-[#666] hover:text-[#e0e0e0] transition",children:Y4.jsxDEV(hv,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y4.jsxDEV(SB,{agentId:"default",apiUrl:`/api/agents/${Y.id}`,placeholder:"Message this agent...",context:Y.systemPrompt,variant:"terminal",headerTitle:Y.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return Y4.jsxDEV("div",{className:"w-1/2 flex flex-col overflow-hidden",children:[Y4.jsxDEV("div",{className:"border-b border-[#1a1a1a] p-4 flex items-center justify-between",children:[Y4.jsxDEV("div",{children:[Y4.jsxDEV("h2",{className:"font-semibold",children:Y.name},void 0,!1,void 0,this),Y4.jsxDEV("p",{className:"text-sm text-[#666]",children:[Y.provider," / ",Y.model]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y4.jsxDEV("button",{onClick:U,className:"text-[#666] hover:text-[#e0e0e0] transition",children:Y4.jsxDEV(hv,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y4.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:Y4.jsxDEV("div",{className:"text-center",children:[Y4.jsxDEV("p",{className:"text-lg mb-2",children:"Agent is not running"},void 0,!1,void 0,this),Y4.jsxDEV("button",{onClick:B,className:"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30 px-4 py-2 rounded font-medium transition",children:"Start Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var k5=z0(V1(),1);function kZ({agents:Y,loading:U,selectedAgent:B,onSelectAgent:_,onCloseAgent:G,onToggleAgent:P,onDeleteAgent:F}){return k5.jsxDEV("div",{className:"flex-1 flex overflow-hidden",children:[k5.jsxDEV("div",{className:`${B?"w-1/2 border-r border-[#1a1a1a]":"flex-1"} overflow-auto p-6 transition-all`,children:U?k5.jsxDEV(yb,{message:"Loading agents..."},void 0,!1,void 0,this):Y.length===0?k5.jsxDEV(tM,{},void 0,!1,void 0,this):k5.jsxDEV("div",{className:`grid gap-4 ${B?"grid-cols-1 xl:grid-cols-2":"md:grid-cols-2 xl:grid-cols-3"}`,children:Y.map((N)=>k5.jsxDEV(NZ,{agent:N,selected:B?.id===N.id,onSelect:()=>_(N),onToggle:(T)=>P(N,T),onDelete:(T)=>F(N.id,T)},N.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),B&&k5.jsxDEV(MZ,{agent:B,onClose:G,onStartAgent:(N)=>P(B,N)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function tM(){return k5.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[k5.jsxDEV("p",{className:"text-lg",children:"No agents yet"},void 0,!1,void 0,this),k5.jsxDEV("p",{className:"text-sm mt-1",children:"Create your first agent to get started"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var A1=z0(V1(),1);function wZ({agents:Y,loading:U,runningCount:B,configuredProviders:_,onNavigate:G,onSelectAgent:P}){return A1.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[A1.jsxDEV("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[A1.jsxDEV(sG,{label:"Total Agents",value:Y.length},void 0,!1,void 0,this),A1.jsxDEV(sG,{label:"Running",value:B,color:"text-[#3b82f6]"},void 0,!1,void 0,this),A1.jsxDEV(sG,{label:"Providers",value:_.length,color:"text-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("div",{className:"grid grid-cols-2 gap-6",children:[A1.jsxDEV(cB,{title:"Agents",actionLabel:"View All",onAction:()=>G("agents"),children:U?A1.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this):Y.length===0?A1.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:"No agents yet"},void 0,!1,void 0,this):A1.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:Y.slice(0,5).map((F)=>A1.jsxDEV("div",{onClick:()=>P(F),className:"px-4 py-3 hover:bg-[#1a1a1a] cursor-pointer flex items-center justify-between",children:[A1.jsxDEV("div",{children:[A1.jsxDEV("p",{className:"font-medium",children:F.name},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-sm text-[#666]",children:F.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("span",{className:`w-2 h-2 rounded-full ${F.status==="running"?"bg-[#3b82f6]":"bg-[#444]"}`},void 0,!1,void 0,this)]},F.id,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),A1.jsxDEV(cB,{title:"Providers",actionLabel:"Manage",onAction:()=>G("settings"),children:_.length===0?A1.jsxDEV("div",{className:"p-4 text-center text-[#666]",children:[A1.jsxDEV("p",{children:"No providers configured"},void 0,!1,void 0,this),A1.jsxDEV("button",{onClick:()=>G("settings"),className:"text-[#f97316] hover:underline mt-1",children:"Add API Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):A1.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:_.map((F)=>A1.jsxDEV("div",{className:"px-4 py-3 flex items-center justify-between",children:[A1.jsxDEV("div",{children:[A1.jsxDEV("p",{className:"font-medium",children:F.name},void 0,!1,void 0,this),A1.jsxDEV("p",{className:"text-sm text-[#666]",children:[F.models.length," models"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A1.jsxDEV("span",{className:"text-green-400 text-sm",children:F.keyHint},void 0,!1,void 0,this)]},F.id,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sG({label:Y,value:U,color:B}){return A1.jsxDEV("div",{className:"bg-[#111] rounded p-4 border border-[#1a1a1a]",children:[A1.jsxDEV("p",{className:"text-sm text-[#666] mb-1",children:Y},void 0,!1,void 0,this),A1.jsxDEV("p",{className:`text-2xl font-semibold ${B||""}`,children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cB({title:Y,actionLabel:U,onAction:B,children:_}){return A1.jsxDEV("div",{className:"bg-[#111] rounded border border-[#1a1a1a] overflow-hidden",children:[A1.jsxDEV("div",{className:"px-4 py-3 border-b border-[#1a1a1a] flex items-center justify-between",children:[A1.jsxDEV("h3",{className:"font-semibold",children:Y},void 0,!1,void 0,this),A1.jsxDEV("button",{onClick:B,className:"text-sm text-[#3b82f6] hover:text-[#60a5fa]",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_]},void 0,!0,void 0,this)}var g4=z0(V1(),1);function sM(){let{isComplete:Y,setIsComplete:U}=gG(),{agents:B,loading:_,runningCount:G,fetchAgents:P,createAgent:F,deleteAgent:N,toggleAgent:T}=SG(Y===!0),{providers:f,configuredProviders:R,fetchProviders:w}=hG(Y===!0),[E,i]=W7.useState(!1),[s,Q0]=W7.useState(null),[n,j]=W7.useState("dashboard"),[K0,a]=W7.useState(null),[p,X0]=W7.useState({name:"",model:"",provider:"",systemPrompt:"You are a helpful assistant."});W7.useEffect(()=>{if(R.length>0&&!p.provider){let Z0=R[0],k0=Z0.models.find((L0)=>L0.recommended)?.value||Z0.models[0]?.value||"";X0((L0)=>({...L0,provider:Z0.id,model:k0}))}},[R,p.provider]),W7.useEffect(()=>{if(s){let Z0=B.find((k0)=>k0.id===s.id);if(Z0)Q0(Z0);else Q0(null)}},[B,s]);let N0=(Z0)=>{let k0=f.find((v1)=>v1.id===Z0),L0=k0?.models.find((v1)=>v1.recommended)?.value||k0?.models[0]?.value||"";X0((v1)=>({...v1,provider:Z0,model:L0}))},n0=async()=>{if(!p.name)return;await F(p);let Z0=R[0],k0=Z0?.models.find((L0)=>L0.recommended)?.value||Z0?.models[0]?.value||"";X0({name:"",model:k0,provider:Z0?.id||"",systemPrompt:"You are a helpful assistant."}),i(!1)},z1=async(Z0,k0)=>{k0?.stopPropagation(),a(null);let L0=await T(Z0);if(L0.error)a(L0.error)},y0=async(Z0,k0)=>{if(k0?.stopPropagation(),s?.id===Z0)Q0(null);await N(Z0)},A0=(Z0)=>{Q0(Z0),a(null),j("agents")},h0=(Z0)=>{j(Z0),Q0(null)},e=()=>{U(!0),w()};if(Y===null)return g4.jsxDEV(yb,{fullScreen:!0},void 0,!1,void 0,this);if(!Y)return g4.jsxDEV(_Z,{onComplete:e},void 0,!1,void 0,this);return g4.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex flex-col",children:[g4.jsxDEV(BZ,{onNewAgent:()=>i(!0),canCreateAgent:R.length>0},void 0,!1,void 0,this),K0&&g4.jsxDEV(LZ,{message:K0,onDismiss:()=>a(null)},void 0,!1,void 0,this),g4.jsxDEV("div",{className:"flex flex-1 overflow-hidden",children:[g4.jsxDEV(OZ,{route:n,agentCount:B.length,onNavigate:h0},void 0,!1,void 0,this),g4.jsxDEV("main",{className:"flex-1 overflow-hidden flex",children:[n==="settings"&&g4.jsxDEV(WZ,{},void 0,!1,void 0,this),n==="agents"&&g4.jsxDEV(kZ,{agents:B,loading:_,selectedAgent:s,onSelectAgent:A0,onCloseAgent:()=>Q0(null),onToggleAgent:z1,onDeleteAgent:y0},void 0,!1,void 0,this),n==="dashboard"&&g4.jsxDEV(wZ,{agents:B,loading:_,runningCount:G,configuredProviders:R,onNavigate:h0,onSelectAgent:A0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),E&&g4.jsxDEV(PZ,{form:p,providers:f,configuredProviders:R,onFormChange:X0,onProviderChange:N0,onCreate:n0,onClose:()=>i(!1),onGoToSettings:()=>{i(!1),j("settings")}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var eM=xB.createRoot(document.getElementById("root"));eM.render(g4.jsxDEV(sM,{},void 0,!1,void 0,this));
|
|
212
212
|
|
|
213
|
-
//# debugId=
|
|
213
|
+
//# debugId=6FA6DEF4C551984064756E2164756E21
|
package/dist/index.html
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
6
|
+
<title>apteva</title>
|
|
7
7
|
<link rel="stylesheet" href="/styles.css">
|
|
8
8
|
<link rel="stylesheet" href="/apteva-kit.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
12
|
-
<script type="module" src="/App.
|
|
12
|
+
<script type="module" src="/App.dc0hb2q1.js"></script>
|
|
13
13
|
</body>
|
|
14
14
|
</html>
|
package/package.json
CHANGED
package/src/routes/api.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { spawn } from "bun";
|
|
2
2
|
import { join } from "path";
|
|
3
|
+
import { homedir } from "os";
|
|
3
4
|
import { mkdirSync, existsSync } from "fs";
|
|
4
5
|
import { agentProcesses, BINARY_PATH, getNextPort, getBinaryStatus, BIN_DIR } from "../server";
|
|
5
6
|
import { AgentDB, generateId, type Agent } from "../db";
|
|
6
7
|
import { ProviderKeys, Onboarding, getProvidersWithStatus, PROVIDERS, type ProviderId } from "../providers";
|
|
7
8
|
import { binaryExists } from "../binary";
|
|
8
9
|
|
|
9
|
-
// Data directory for agent instances
|
|
10
|
-
const AGENTS_DATA_DIR =
|
|
10
|
+
// Data directory for agent instances (in ~/.apteva/agents/)
|
|
11
|
+
const AGENTS_DATA_DIR = process.env.DATA_DIR
|
|
12
|
+
? join(process.env.DATA_DIR, "agents")
|
|
13
|
+
: join(homedir(), ".apteva", "agents");
|
|
11
14
|
|
|
12
15
|
function json(data: unknown, status = 200): Response {
|
|
13
16
|
return new Response(JSON.stringify(data), {
|
package/src/routes/static.ts
CHANGED
|
@@ -94,7 +94,7 @@ export async function serveStatic(req: Request, path: string): Promise<Response>
|
|
|
94
94
|
`<!DOCTYPE html>
|
|
95
95
|
<html>
|
|
96
96
|
<head>
|
|
97
|
-
<title>
|
|
97
|
+
<title>apteva</title>
|
|
98
98
|
<style>
|
|
99
99
|
body { font-family: system-ui; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #0f172a; color: #e2e8f0; }
|
|
100
100
|
.container { text-align: center; }
|
|
@@ -103,7 +103,7 @@ export async function serveStatic(req: Request, path: string): Promise<Response>
|
|
|
103
103
|
</head>
|
|
104
104
|
<body>
|
|
105
105
|
<div class="container">
|
|
106
|
-
<h1>
|
|
106
|
+
<h1>apteva</h1>
|
|
107
107
|
<p>Run <code>bun run build</code> to build the frontend</p>
|
|
108
108
|
<p>API available at <a href="/api/health" style="color: #60a5fa">/api/health</a></p>
|
|
109
109
|
</div>
|
package/src/server.ts
CHANGED
|
@@ -2,11 +2,19 @@ import { type Server, type Subprocess } from "bun";
|
|
|
2
2
|
import { handleApiRequest } from "./routes/api";
|
|
3
3
|
import { serveStatic } from "./routes/static";
|
|
4
4
|
import { join } from "path";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
import { mkdirSync, existsSync } from "fs";
|
|
5
7
|
import { initDatabase, AgentDB, ProviderKeysDB } from "./db";
|
|
6
8
|
import { ensureBinary, getBinaryPath, getBinaryStatus, getActualBinaryPath } from "./binary";
|
|
7
9
|
|
|
8
10
|
const PORT = parseInt(process.env.PORT || "4280");
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
// Use ~/.apteva for persistent data (survives npm updates)
|
|
13
|
+
const HOME_DATA_DIR = join(homedir(), ".apteva");
|
|
14
|
+
if (!existsSync(HOME_DATA_DIR)) {
|
|
15
|
+
mkdirSync(HOME_DATA_DIR, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
const DATA_DIR = process.env.DATA_DIR || HOME_DATA_DIR;
|
|
10
18
|
const BIN_DIR = join(import.meta.dir, "../bin");
|
|
11
19
|
|
|
12
20
|
// Load .env file (silently)
|
|
@@ -79,7 +87,7 @@ function link(url: string, text?: string): string {
|
|
|
79
87
|
|
|
80
88
|
// Startup banner
|
|
81
89
|
console.log(`
|
|
82
|
-
${c.orange}${c.bold}>_
|
|
90
|
+
${c.orange}${c.bold}>_ apteva${c.reset}
|
|
83
91
|
${c.gray}Run AI agents locally${c.reset}
|
|
84
92
|
`);
|
|
85
93
|
|
|
@@ -223,7 +223,7 @@ function Step1AddKeys({
|
|
|
223
223
|
// Default view: show all providers
|
|
224
224
|
return (
|
|
225
225
|
<>
|
|
226
|
-
<h2 className="text-2xl font-semibold mb-2">Welcome to
|
|
226
|
+
<h2 className="text-2xl font-semibold mb-2">Welcome to apteva</h2>
|
|
227
227
|
<p className="text-[#666] mb-6">
|
|
228
228
|
To get started, you'll need to add at least one AI provider API key.
|
|
229
229
|
Your keys are encrypted and stored locally.
|
|
@@ -336,7 +336,7 @@ function Step2Complete({ configuredProviders, onAddMore, onComplete }: Step2Prop
|
|
|
336
336
|
onClick={onComplete}
|
|
337
337
|
className="flex-1 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-3 rounded font-medium transition"
|
|
338
338
|
>
|
|
339
|
-
Start Using
|
|
339
|
+
Start Using apteva
|
|
340
340
|
</button>
|
|
341
341
|
</div>
|
|
342
342
|
</>
|
|
@@ -227,7 +227,7 @@ function UpdatesSettings() {
|
|
|
227
227
|
<div className="mb-6">
|
|
228
228
|
<h1 className="text-2xl font-semibold mb-1">Updates</h1>
|
|
229
229
|
<p className="text-[#666]">
|
|
230
|
-
Check for new versions of
|
|
230
|
+
Check for new versions of apteva.
|
|
231
231
|
</p>
|
|
232
232
|
</div>
|
|
233
233
|
|
|
@@ -258,7 +258,7 @@ function UpdatesSettings() {
|
|
|
258
258
|
Update available!
|
|
259
259
|
</div>
|
|
260
260
|
<p className="text-sm text-[#888] mb-3">
|
|
261
|
-
A new version of
|
|
261
|
+
A new version of apteva is available. Run this command to update:
|
|
262
262
|
</p>
|
|
263
263
|
<div className="flex items-center gap-2">
|
|
264
264
|
<code className="flex-1 bg-[#0a0a0a] px-3 py-2 rounded font-mono text-sm">
|
package/src/web/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
6
|
+
<title>apteva</title>
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
|