import{d as k,K as y,b as h,t as g,z as d,H as _}from"./registerWidgets.787b786f.js";import{f as H,g as w,h as C}from"./icons.e9d866c3.js";import{a as I}from"./asyncComputed.3103aa62.js";import{H as p}from"./hooks.bc9b1b05.js";import{R as x}from"./RuntimeList.73bb2195.js";import"./activeRecord.f8b90405.js";import"./pubsub.dd86dbcf.js";import"./DropdownMenu.d6704c7d.js";import"./CircularLoading.738c357f.js";import"./lottie.221bef6b.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="c7d1e47f-47cb-4b4b-be8c-188acbb8c9d6",a._sentryDebugIdIdentifier="sentry-dbid-c7d1e47f-47cb-4b4b-be8c-188acbb8c9d6")}catch{}})();const $=k({__name:"Hooks",setup(a){const n=_(),{loading:i,result:s,refetch:r}=I(()=>p.list()),l=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),u=async({key:e})=>{var o,t;await((t=(o=s.value)==null?void 0:o.find(c=>c.path===e))==null?void 0:t.duplicate()),r()},m=async()=>{const e=await p.create();l({key:e.path})},b=async({key:e})=>{var o,t;confirm("Are you sure you want to delete this hook?")&&(await((t=(o=s.value)==null?void 0:o.find(c=>c.path===e))==null?void 0:t.delete()),r())},f=y(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Hook Actions"}],rows:(o=(e=s.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/hook/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:H,label:"Delete",onClick:b,dangerous:!0},{icon:w,label:"Edit Hook",onClick:l},{icon:C,label:"Duplicate",onClick:u}]}]})))!=null?o:[]}});return(e,o)=>(h(),g(x,{loading:d(i),title:"Python Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:d(f),onCreate:m},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Hooks.c1e2fa96.js.map
