import{d as f,ez as k,J as y,b as h,c as g,u as _}from"./outputWidgets.cf5b7366.js";import{e as w,a as C,b as H}from"./icons.c510a141.js";import{a as I}from"./asyncComputed.2caa7fe6.js";import{H as p}from"./hooks.8d5e93d9.js";import{C as x}from"./CrudView.ca1846b4.js";import{a as D}from"./ant-design.55c856ad.js";import"./activeRecord.f30e02c2.js";import"./pubsub.664a70af.js";import"./index.7622dd54.js";import"./Title.adce1298.js";import"./Form.c8affe88.js";import"./router.565b4739.js";import"./index.3d2fbf9e.js";import"./url.fb40e08c.js";import"./index.47f17eed.js";import"./index.aee8b5d5.js";import"./index.9583d9e9.js";import"./index.10cdfb2c.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]="6a5be5b2-ab31-4985-bc44-b346e4933e18",a._sentryDebugIdIdentifier="sentry-dbid-6a5be5b2-ab31-4985-bc44-b346e4933e18")}catch{}})();const G=f({__name:"Hooks",setup(a){const n=k(),{loading:s,result:i,refetch:l}=I(()=>p.list()),c=({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()),l()},u=async()=>{const e=await p.create();c({key:e.path})},m=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()),l())},b=y(()=>{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:c},{icon:C,label:"Duplicate",onClick:d},{icon:H,label:"Delete",onClick:m,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:b.value,"entity-name":"Hook",onCreate:u},null,8,["loading","table"]))}});export{G as default};
//# sourceMappingURL=Hooks.4705d803.js.map
