import{d as b,ex as k,H as y,b as h,c as _,u as g}from"./registerWidgets.9fce82a0.js";import{e as H,a as w,b as C}from"./icons.1992e13b.js";import{a as x}from"./asyncComputed.a4b709a3.js";import{H as l}from"./hooks.31ddb50a.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.ac5a77d6.js";import{a as D}from"./ant-design.cd2520f8.js";import"./activeRecord.872f4269.js";import"./pubsub.025cc397.js";import"./index.2c964e80.js";import"./Title.26974edb.js";import"./Form.413853c0.js";import"./index.eed9c711.js";import"./index.30c35b37.js";import"./index.c9f7f8f0.js";import"./index.db5cf0e6.js";import"./index.e8158c16.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]="dbdd3163-a409-4ff6-b7ad-74bd4d0cfb88",a._sentryDebugIdIdentifier="sentry-dbid-dbdd3163-a409-4ff6-b7ad-74bd4d0cfb88")}catch{}})();const G=b({__name:"Hooks",setup(a){const n=k(),{loading:s,result:i,refetch:d}=x(()=>l.list()),c=({key:e})=>n.push({path:`/_editor/hook/${encodeURIComponent(e)}`}),p=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()),d()},u=async()=>{const e=await l.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()),d())},f=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:H,label:"Edit Hook",onClick:c},{icon:w,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),_(I,{loading:g(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:u},null,8,["loading","table"]))}});export{G as default};
//# sourceMappingURL=Hooks.c6b3d3ca.js.map
