import{z as d,w as p}from"./chunk-QMGIS6GS-CBZUm-7V.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{C as f}from"./Card-BHrMkZ_V.js";import{G as g}from"./Group-bnACpcuK.js";import{B as s}from"./Badge-CHFht4LR.js";import{T as c}from"./Text-CkpJSrnl.js";import{f as u}from"./api-tgDzxHzW.js";import{B as x}from"./polymorphic-factory-EW0USS3V.js";import{T as h}from"./Title-B0fFn55O.js";import{D as j}from"./Divider-BI4N1hoX.js";import{S as b}from"./SimpleGrid-DIRoZGR6.js";import"./Paper-k397c_lM.js";import"./create-safe-context-CzEsa9t0.js";import"./px-CiO0pVtX.js";import"./get-sorted-breakpoints-CWbmZd_q.js";const y="_root_tlzeu_1",v={root:y};function _({action:r}){var o,t,a;return e.jsxs(f,{withBorder:!0,padding:"lg",radius:"md",component:d,className:v.root,to:`/actions/${r.id}`,children:[e.jsxs(g,{justify:"space-between",children:[e.jsx(s,{size:"sm",color:"gray",variant:"outline",children:((o=r._package)==null?void 0:o.version)||"-"}),r.enabled?e.jsx(s,{size:"sm",variant:"dot",color:"teal",children:"Enabled"}):e.jsx(s,{size:"sm",color:"red",variant:"dot",children:"Disabled"})]}),e.jsx(c,{fz:"md",fw:500,mt:"md",children:((a=(t=r._package)==null?void 0:t.meta)==null?void 0:a.title)||r.label}),e.jsx(c,{fz:"sm",c:"gray.7",mt:5,lineClamp:3,children:r.description})]})}function O(){return[{title:"Actions | JIVAS Manager"}]}async function P({request:r}){const t=(await r.formData()).get("agentId");return localStorage.setItem("jivas-agent",t),{}}async function R({serverLoader:r}){const o=localStorage.getItem("jivas-host");try{return{actions:(await u(`${o}/walker/list_actions`,{method:"POST",body:JSON.stringify({agent_id:localStorage.getItem("jivas-agent")}),headers:{"Content-Type":"application/json"}}).then(a=>a.json())).reports[0]}}catch{return{actions:[]}}}const $=p(function({loaderData:o}){return e.jsxs(x,{px:"xl",py:"xl",children:[e.jsx(h,{order:3,children:"Actions"}),e.jsx(j,{mt:"xs",mb:"xl"}),e.jsx(b,{cols:{base:1,md:2,lg:4},children:o.actions.sort((t,a)=>{var i,n,l,m;return(((n=(i=t._package)==null?void 0:i.meta)==null?void 0:n.title)||t.label).localeCompare(((m=(l=a._package)==null?void 0:l.meta)==null?void 0:m.title)||a.label)}).filter(t=>t.label!=="ExitInteractAction").map(t=>e.jsx(_,{action:t},t.id))})]})});export{P as clientAction,R as clientLoader,$ as default,O as meta};
