import{d as k,ex as y,H as h,b,c as _,u as g}from"./registerWidgets.ca9618c6.js";import{e as H,a as w,b as C}from"./icons.71da0300.js";import{a as x}from"./asyncComputed.f26ab310.js";import{H as d}from"./hooks.9e493a50.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.0535df40.js";import{a as D}from"./ant-design.c8da8814.js";import"./activeRecord.fa727ba5.js";import"./pubsub.197ceb4e.js";import"./index.6cc8ffe0.js";import"./Title.f740cc19.js";import"./Form.fac64e0c.js";import"./index.11818713.js";import"./index.b013a4c0.js";import"./index.c0bd1022.js";import"./index.7c566b28.js";import"./index.6a4df70c.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]="4f089248-7f27-4b37-ad30-ae775c7d2648",a._sentryDebugIdIdentifier="sentry-dbid-4f089248-7f27-4b37-ad30-ae775c7d2648")}catch{}})();const G=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=x(()=>d.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()),c()},u=async()=>{const e=await d.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()),c())},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:H,label:"Edit Hook",onClick:l},{icon:w,label:"Duplicate",onClick:p},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(b(),_(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.30799453.js.map
