import{d as k,eA as y,G as h,b,c as g,u as _}from"./outputWidgets.f8f8676d.js";import{e as w,a as C,b as H}from"./icons.c3170cf4.js";import{a as I}from"./asyncComputed.9c91cdf6.js";import{H as d}from"./hooks.96151980.js";import{C as x}from"./CrudView.fe3c74bf.js";import{a as D}from"./ant-design.8ffd5ed0.js";import"./activeRecord.913921b5.js";import"./pubsub.8eddc628.js";import"./Text.7ab5366c.js";import"./Title.53d37289.js";import"./transButton.ca7603a2.js";import"./router.b4a342b4.js";import"./Form.2b1bb5d1.js";import"./index.878fa14a.js";import"./url.46c79102.js";import"./index.4c4e9bdd.js";import"./index.97771f01.js";import"./index.2ab0079e.js";import"./index.e041bc2d.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]="5220de75-e51d-4409-8f00-3b04462ed3e2",a._sentryDebugIdIdentifier="sentry-dbid-5220de75-e51d-4409-8f00-3b04462ed3e2")}catch{}})();const K=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:l}=I(()=>d.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()),l()},m=async()=>{const e=await d.create();c({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()),l())},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:c},{icon:C,label:"Duplicate",onClick:p},{icon:H,label:"Delete",onClick:u,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(b(),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:f.value,"entity-name":"Hook",onCreate:m},null,8,["loading","table"]))}});export{K as default};
//# sourceMappingURL=Hooks.ac9237fd.js.map
