import{d as y,K as _,b as g,t as T,z as d,H as w}from"./registerWidgets.dc0b6768.js";import{f as C,g as h,h as k}from"./icons.79ac4c38.js";import{a as D}from"./asyncComputed.1ef6bcd7.js";import{T as b}from"./tables.a7ddd683.js";import{R as I}from"./RuntimeList.f151e03d.js";import"./activeRecord.81c73286.js";import"./DropdownMenu.f0c8b270.js";import"./CircularLoading.8d483ca6.js";import"./lottie.eb38a9e8.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="8d4dd988-60b4-4c7f-8fa4-b84fab31eca7",n._sentryDebugIdIdentifier="sentry-dbid-8d4dd988-60b4-4c7f-8fa4-b84fab31eca7")}catch{}})();const z=y({__name:"Tables",setup(n){const o=w(),{loading:r,result:l,refetch:i}=D(()=>b.list()),c=({key:e})=>o.push({path:`/_editor/table/${encodeURIComponent(e)}`}),u=async({key:e})=>{var t,a;await((a=(t=l.value)==null?void 0:t.find(s=>s.name===e))==null?void 0:a.duplicate()),i()},m=async()=>{const e=await b.create();c({key:e.name})},f=async({key:e})=>{var t,a;confirm("Are you sure you want to delete this table?")&&(await((a=(t=l.value)==null?void 0:t.find(s=>s.name===e))==null?void 0:a.delete()),i())},p=_(()=>{var e,t;return{columns:[{name:"Table Name"},{name:"Table Actions"}],rows:(t=(e=l.value)==null?void 0:e.map(a=>({key:a.name,cells:[{text:a.name,classes:["title","centered"],link:`/_editor/table/${encodeURIComponent(a.name)}`},{text:"",classes:["centered"],actions:[{icon:C,label:"Delete",onClick:f,dangerous:!0},{icon:h,label:"Edit Table",onClick:c},{icon:k,label:"Duplicate",onClick:u}]}]})))!=null?t:[]}});return(e,t)=>(g(),T(I,{loading:d(r),title:"Database Tables",description:"Create and manage your database tables here.","create-button-text":"Create Table","empty-title":"No tables here yet",table:d(p),onCreate:m},null,8,["loading","table"]))}});export{z as default};
//# sourceMappingURL=Tables.f9718b77.js.map
