import{d as y,K as _,b as g,t as T,z as d,H as w}from"./registerWidgets.726232df.js";import{f as C,g as h,h as k}from"./icons.f7969917.js";import{a as D}from"./asyncComputed.638ec138.js";import{T as b}from"./tables.9db6ffb1.js";import{R as I}from"./RuntimeList.0ea6da76.js";import"./activeRecord.acbdb8bc.js";import"./DropdownMenu.3ede6951.js";import"./CircularLoading.4a9d4906.js";import"./lottie.1c3b7cde.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]="b8be4d97-2bc8-41f3-983b-44bf60efa0d5",n._sentryDebugIdIdentifier="sentry-dbid-b8be4d97-2bc8-41f3-983b-44bf60efa0d5")}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.75191b3e.js.map
