import{d as k,ey as y,H as h,b,c as g,u as _}from"./outputWidgets.a4629ff8.js";import{e as w,a as H,b as C}from"./icons.73bff2ab.js";import{a as I}from"./asyncComputed.fb8b9ba6.js";import{H as l}from"./hooks.ce0d720c.js";import{C as x}from"./CrudView.a5b1a4eb.js";import{a as D}from"./ant-design.523e8417.js";import"./activeRecord.a2b7d343.js";import"./pubsub.25dc8c41.js";import"./Text.eb216708.js";import"./Title.cf2a531e.js";import"./Form.ab59726f.js";import"./router.ab2ac3ba.js";import"./index.339c7421.js";import"./url.d6a620b9.js";import"./index.874565bb.js";import"./index.48817ebe.js";import"./index.0f6dde5f.js";import"./index.46db6cb2.js";import"./index.56cfba6d.js";import"./index.fda4c602.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]="4fa5d3c6-75bd-4fd9-8f1d-f7d708c9040a",a._sentryDebugIdIdentifier="sentry-dbid-4fa5d3c6-75bd-4fd9-8f1d-f7d708c9040a")}catch{}})();const L=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>l.list()),d=({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 l.create();d({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=h(()=>{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:d},{icon:H,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(t,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.b1d80a95.js.map
