import{d as k,eA as y,G as b,b as h,c as g,u as _}from"./outputWidgets.562826ac.js";import{e as w,a as C,b as H}from"./icons.63405824.js";import{a as I}from"./asyncComputed.df2d9552.js";import{H as p}from"./hooks.df04f598.js";import{C as x}from"./CrudView.6f7097f4.js";import{a as D}from"./ant-design.1ee2ab2c.js";import"./activeRecord.6bb1bd7f.js";import"./pubsub.7185b91b.js";import"./Text.712cfc26.js";import"./Base.bf8dc0b1.js";import"./FormItem.fc4e7da8.js";import"./transButton.17480f27.js";import"./router.e5ce2c0b.js";import"./Title.f7aaa881.js";import"./index.82606edc.js";import"./url.5a1383d2.js";import"./index.01bf1f2c.js";import"./index.583cd440.js";import"./index.9cdd1b35.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]="c4c58e20-9977-43c1-9114-a4586f9b0ccb",a._sentryDebugIdIdentifier="sentry-dbid-c4c58e20-9977-43c1-9114-a4586f9b0ccb")}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:C,label:"Duplicate",onClick:d},{icon:H,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),g(x,{loading:_(s),title:"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.2a234053.js.map
