import{d as k,ex as y,F as h,b,u as g,bu as _}from"./registerWidgets.59747b32.js";import{e as H,f as w,g as C}from"./icons.8e518be5.js";import{a as x}from"./asyncComputed.1d4b957f.js";import{H as d}from"./hooks.ca54ed0b.js";import{R as I}from"./RuntimeList.6cf7bf5b.js";import"./activeRecord.e2c0e940.js";import"./pubsub.cfb8c19f.js";import"./DropdownMenu.7b5d814a.js";import"./CircularLoading.eebf6e84.js";import"./lottie.15d20c75.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]="1c48f1c7-4401-4c02-8a40-2677ce51be42",a._sentryDebugIdIdentifier="sentry-dbid-1c48f1c7-4401-4c02-8a40-2677ce51be42")}catch{}})();const $=k({__name:"Hooks",setup(a){const n=y(),{loading:r,result:s,refetch:c}=x(()=>d.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(i=>i.path===e))==null?void 0:t.duplicate()),c()},p=async()=>{const e=await d.create();l({key:e.path})},m=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(i=>i.path===e))==null?void 0:t.delete()),c())},f=h(()=>{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:m,dangerous:!0},{icon:w,label:"Edit Hook",onClick:l},{icon:C,label:"Duplicate",onClick:u}]}]})))!=null?o:[]}});return(e,o)=>(b(),g(I,{loading:_(r),title:"Python Hooks",description:"Trigger your Python scripts with a request.","create-button-text":"Create Hook","empty-title":"No hooks here yet",table:f.value,onCreate:p},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Hooks.79b82bdb.js.map
