import{d as k,ez as y,J as h,b,c as _,u as g}from"./outputWidgets.b43a489b.js";import{e as w,a as H,b as C}from"./icons.de9af46a.js";import{a as I}from"./asyncComputed.a42e75bb.js";import{H as c}from"./hooks.18db1931.js";import{_ as x}from"./CrudView.vue_vue_type_script_setup_true_lang.85d5e2a7.js";import{a as D}from"./ant-design.dc7acb1e.js";import"./activeRecord.2bc5cc59.js";import"./pubsub.6fd47a9d.js";import"./index.85f24c29.js";import"./Title.47040052.js";import"./Form.1797df89.js";import"./index.0279b5ff.js";import"./index.e641ddba.js";import"./index.8a60ee51.js";import"./index.9367a16c.js";import"./index.65dea612.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]="d037d5ef-8a64-4120-90b7-a9ad19dd8722",a._sentryDebugIdIdentifier="sentry-dbid-d037d5ef-8a64-4120-90b7-a9ad19dd8722")}catch{}})();const j=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:d}=I(()=>c.list()),l=({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 c.create();l({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=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:H,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(b(),_(x,{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{j as default};
//# sourceMappingURL=Hooks.0e4398c0.js.map
