import{d as k,ey as y,H as b,b as h,c as g,u as _}from"./outputWidgets.4420c31f.js";import{e as w,a as H,b as C}from"./icons.2ee60219.js";import{a as I}from"./asyncComputed.937eb3b8.js";import{H as d}from"./hooks.123166fc.js";import{C as x}from"./CrudView.4a9e50e2.js";import{a as D}from"./ant-design.4ad26ba4.js";import"./activeRecord.a89b1253.js";import"./pubsub.1ac087cf.js";import"./index.6f566923.js";import"./Title.f4c9dd29.js";import"./Form.6825d217.js";import"./router.141c8be7.js";import"./index.1ba1c343.js";import"./url.14f2bdd6.js";import"./index.32966139.js";import"./index.f4ff3772.js";import"./index.afb0f92e.js";import"./index.f792c329.js";import"./index.adf86569.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]="6c98b6b0-0f6b-41d4-a9fd-f8dce83af9fd",a._sentryDebugIdIdentifier="sentry-dbid-6c98b6b0-0f6b-41d4-a9fd-f8dce83af9fd")}catch{}})();const K=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>d.list()),l=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),p=async({key:e})=>{var o,t;await((t=(o=i.value)==null?void 0:o.find(r=>r.path===e))==null?void 0:t.duplicate()),c()},m=async()=>{const e=await d.create();l({key:e.path})},u=async({key:e})=>{var o,t;await D("Are you sure you want to delete this hook?")&&(await((t=(o=i.value)==null?void 0:o.find(r=>r.path===e))==null?void 0:t.delete()),c())},f=b(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Actions",align:"right"}],rows:(o=(e=i.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,link:`/_editor/hook/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",actions:[{icon:w,label:"Edit Hook",onClick:l},{icon:H,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),g(x,{loading:_(s),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,"entity-name":"Hook",onCreate:m},null,8,["loading","table"]))}});export{K as default};
//# sourceMappingURL=Hooks.441c61f0.js.map
