import{d as k,ey as y,H as b,b as h,c as g,u as _}from"./outputWidgets.1cf78234.js";import{e as w,a as H,b as C}from"./icons.ba4d43de.js";import{a as I}from"./asyncComputed.513601fc.js";import{H as p}from"./hooks.632b946b.js";import{C as x}from"./CrudView.9f0a1020.js";import{a as D}from"./ant-design.b7f18845.js";import"./activeRecord.1ee4e98a.js";import"./pubsub.a66a61fd.js";import"./index.a7df5fa7.js";import"./Title.a8b8fdd6.js";import"./Form.5fb25f40.js";import"./router.4077f51e.js";import"./index.748edabf.js";import"./url.18ee0e18.js";import"./index.427c7dc5.js";import"./index.4f30f3fe.js";import"./index.960f4655.js";import"./index.7a53699a.js";import"./index.67188546.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]="d4e3806a-5afb-4ec7-a982-545b0d26bc33",a._sentryDebugIdIdentifier="sentry-dbid-d4e3806a-5afb-4ec7-a982-545b0d26bc33")}catch{}})();const K=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>p.list()),l=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),d=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 p.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:d},{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.393f9fdf.js.map
