import{d as k,ey as y,G as h,b,c as g,u as _}from"./outputWidgets.0fb707c7.js";import{e as w,a as C,b as H}from"./icons.24a85994.js";import{a as I}from"./asyncComputed.a0ca296c.js";import{H as p}from"./hooks.050c60fa.js";import{C as x}from"./CrudView.e365e55f.js";import{a as D}from"./ant-design.c18e1d39.js";import"./activeRecord.204186f3.js";import"./pubsub.7d8bce56.js";import"./Text.3ec0a64d.js";import"./Title.f00a58f9.js";import"./transButton.220177fb.js";import"./router.81de177d.js";import"./Form.0dcb97c0.js";import"./index.140c5bc8.js";import"./url.d43b75f5.js";import"./index.85d2f01b.js";import"./index.8dbf2994.js";import"./index.0d3d2205.js";import"./index.e8ef1073.js";import"./index.a2e845fd.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]="7e50c7c1-2ffe-432b-934c-7a60efc0413d",a._sentryDebugIdIdentifier="sentry-dbid-7e50c7c1-2ffe-432b-934c-7a60efc0413d")}catch{}})();const L=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=h(()=>{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:C,label:"Duplicate",onClick:d},{icon:H,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(b(),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{L as default};
//# sourceMappingURL=Hooks.066f3ffa.js.map
