import{d as k,ey as y,H as b,b as h,c as g,u as _}from"./outputWidgets.942e04a7.js";import{e as w,a as H,b as C}from"./icons.c37bd5be.js";import{a as I}from"./asyncComputed.581a6d32.js";import{H as d}from"./hooks.0db879f8.js";import{C as x}from"./CrudView.ef33eac6.js";import{a as D}from"./ant-design.683e844e.js";import"./activeRecord.c49c8827.js";import"./pubsub.c4874b0f.js";import"./index.a0056785.js";import"./Title.02f374d5.js";import"./Form.fa989528.js";import"./router.88ac172f.js";import"./index.6d3b437a.js";import"./url.c27b4b3f.js";import"./index.afbbab9c.js";import"./index.a1c695e0.js";import"./index.f7b7cb5d.js";import"./index.182b7916.js";import"./index.90e879e1.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]="fa330129-13b4-48ac-9b4b-53d69dd844cf",a._sentryDebugIdIdentifier="sentry-dbid-fa330129-13b4-48ac-9b4b-53d69dd844cf")}catch{}})();const K=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>d.list()),l=({key:t})=>n.push({path:`/_editor/hook/${encodeURIComponent(t)}`}),p=async({key:t})=>{var o,e;await((e=(o=i.value)==null?void 0:o.find(r=>r.path===t))==null?void 0:e.duplicate()),c()},m=async()=>{const t=await d.create();l({key:t.path})},u=async({key:t})=>{var o,e;await D("Are you sure you want to delete this hook?")&&(await((e=(o=i.value)==null?void 0:o.find(r=>r.path===t))==null?void 0:e.delete()),c())},f=b(()=>{var t,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Actions",align:"right"}],rows:(o=(t=i.value)==null?void 0:t.map(e=>({key:e.path,cells:[{text:e.title,link:`/_editor/hook/${encodeURIComponent(e.path)}`},{text:e.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(t,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.e81413d8.js.map
