import{d as h,G as y,b,t as F,y as c,K as w}from"./registerWidgets.fff064a1.js";import{e as C,f as _,g}from"./icons.5214a3f5.js";import{a as k}from"./CircularLoading.59d7fd3d.js";import{F as i}from"./forms.7bc6baea.js";import{R as x}from"./RuntimeList.106b52b7.js";import"./utils.3371dfe5.js";const G=h({__name:"Forms",setup(R){const l=w(),{loading:m,result:a,refetch:r}=k(()=>i.list()),s=({key:e})=>l.push({path:`/_editor/form/${encodeURIComponent(e)}`}),d=async({key:e})=>{var o,t;await((t=(o=a.value)==null?void 0:o.find(n=>n.path===e))==null?void 0:t.duplicate()),r()},u=async()=>{const e=await i.create();s({key:e.path})},p=async({key:e})=>{var o,t;confirm("Are you sure you want to delete this form?")&&(await((t=(o=a.value)==null?void 0:o.find(n=>n.path===e))==null?void 0:t.delete()),r())},f=y(()=>{var e,o;return{columns:[{name:"Form Name"},{name:"Path"},{name:"Form Actions"}],rows:(o=(e=a.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/form/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:C,label:"Delete",onClick:p,dangerous:!0},{icon:_,label:"Edit Form",onClick:s},{icon:g,label:"Duplicate",onClick:d}]}]})))!=null?o:[]}});return(e,o)=>(b(),F(x,{loading:c(m),title:"Dynamic Python forms",description:"Create forms with advanced logic, easy integrations and custom branding.","create-button-text":"Create Form","empty-title":"No forms here yet","video-url":"https://www.youtube.com/embed/tN7SRGmVPwc",table:c(f),onCreate:u},null,8,["loading","table"]))}});export{G as default};
//# sourceMappingURL=Forms.084081fd.js.map
