(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,412608,e=>{"use strict";var s=e.i(804690),t=e.i(753930),i=e.i(427846),r=e.i(524667),n=e.i(670214),o=e.i(363712),l=e.i(677607),a=e.i(605278),c=e.i(120109),d=e.i(618528),u=e.i(499023),p=e.i(895628),x=e.i(45007);let m=x.EXECUTOR_ICON_MAP.local,h=[{type:"local",label:"Local",description:"Run agents directly in the repository folder."},{type:"worktree",label:"Worktree",description:"Create git worktrees for isolated agent sessions."},{type:"local_docker",label:"Docker",description:"Run Docker containers on this machine."},{type:"sprites",label:"Sprites.dev",description:"Run agents in Sprites.dev cloud sandboxes."}];function g({type:e}){let t=x.EXECUTOR_ICON_MAP[e]??m;return(0,s.jsx)("div",{className:"rounded-md bg-muted p-2",children:(0,s.jsx)(t,{className:"h-4 w-4"})})}function f({profile:e,onDelete:t}){let r=(0,i.useRouter)();return(0,s.jsx)(a.Card,{className:"group cursor-pointer transition-colors hover:bg-muted/50",onClick:()=>r.push(`/settings/executors/${e.id}`),children:(0,s.jsxs)(a.CardContent,{className:"flex items-center gap-3 p-4",children:[(0,s.jsx)(g,{type:e.executor_type}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:(0,s.jsx)("p",{className:"truncate font-medium",children:e.name})}),(0,s.jsx)(o.Badge,{variant:"outline",className:"shrink-0 text-xs",children:(0,x.getExecutorLabel)(e.executor_type)}),(0,s.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 cursor-pointer opacity-0 group-hover:opacity-100",onClick:s=>{s.stopPropagation(),t(e.id)},children:(0,s.jsx)(n.IconTrash,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})})}function j({execType:e,onClick:t}){return(0,s.jsx)(a.Card,{className:"cursor-pointer ring-primary/40 transition-colors hover:bg-muted/50",onClick:t,children:(0,s.jsxs)(a.CardContent,{className:"flex items-center gap-3 p-4",children:[(0,s.jsx)(g,{type:e.type}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.label}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.description})]}),(0,s.jsx)(r.IconPlus,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})})}function N({profileName:e,open:t,onOpenChange:i,onDelete:r,deleting:n}){return(0,s.jsx)(d.Dialog,{open:t,onOpenChange:i,children:(0,s.jsxs)(d.DialogContent,{children:[(0,s.jsxs)(d.DialogHeader,{children:[(0,s.jsx)(d.DialogTitle,{children:"Delete Profile"}),(0,s.jsxs)(d.DialogDescription,{children:['Are you sure you want to delete "',e,'"? This action cannot be undone.']})]}),(0,s.jsxs)(d.DialogFooter,{children:[(0,s.jsx)(l.Button,{variant:"outline",onClick:()=>i(!1),className:"cursor-pointer",children:"Cancel"}),(0,s.jsx)(l.Button,{variant:"destructive",onClick:r,disabled:n,className:"cursor-pointer",children:n?"Deleting...":"Delete"})]})]})})}function y(){let e,r=(0,i.useRouter)(),n=(e=(0,u.useAppStore)(e=>e.executors.items),(0,t.useMemo)(()=>e.flatMap(e=>(e.profiles??[]).map(s=>({...s,executor_type:e.type,executor_name:e.name,parent_executor_id:e.id}))),[e])),o=(0,u.useAppStore)(e=>e.executors.items),l=(0,u.useAppStore)(e=>e.setExecutors),[a,d]=(0,t.useState)(null),[x,m]=(0,t.useState)(!1),g=a?n.find(e=>e.id===a):null,y=async()=>{if(g){m(!0);try{await (0,p.deleteExecutorProfile)(g.parent_executor_id,g.id),l(o.map(e=>e.id===g.parent_executor_id?{...e,profiles:(e.profiles??[]).filter(e=>e.id!==g.id)}:e)),d(null)}finally{m(!1)}}};return(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-2xl font-bold",children:"Executors"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Executor profiles define how and where agents run. Each profile configures an execution environment with scripts, environment variables, and MCP policies."})]}),(0,s.jsx)(c.Separator,{}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Create New Profile"}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:h.map(e=>(0,s.jsx)(j,{execType:e,onClick:()=>r.push(`/settings/executors/new/${e.type}`)},e.type))})]}),n.length>0&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Profiles"}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n.map(e=>(0,s.jsx)(f,{profile:e,onDelete:d},e.id))})]}),(0,s.jsx)(N,{profileName:g?.name,open:!!a,onOpenChange:()=>d(null),onDelete:y,deleting:x})]})}e.s(["default",()=>y])}]);