import{d as k,ey as y,H as b,b as h,c as g,u as _}from"./outputWidgets.8be138ba.js";import{e as w,a as H,b as C}from"./icons.35976e57.js";import{a as I}from"./asyncComputed.96c9ad3b.js";import{H as p}from"./hooks.f815923f.js";import{C as x}from"./CrudView.cfa43f1a.js";import{a as D}from"./ant-design.e9f581dc.js";import"./activeRecord.f6cce158.js";import"./pubsub.e324f67c.js";import"./index.98827a3d.js";import"./Title.12e8916a.js";import"./Form.7b75db7b.js";import"./router.bb47648a.js";import"./index.0df733bd.js";import"./url.ebe1e528.js";import"./index.3ef3e2d2.js";import"./index.bc7e7ec9.js";import"./index.d11a75f6.js";import"./index.568a8efe.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]="95b70e97-fccf-4bcf-aaa1-0c07752bfe97",a._sentryDebugIdIdentifier="sentry-dbid-95b70e97-fccf-4bcf-aaa1-0c07752bfe97")}catch{}})();const J=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>p.list()),l=({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()),c()},u=async()=>{const e=await p.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=b(()=>{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:d},{icon:C,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:f.value,"entity-name":"Hook",onCreate:u},null,8,["loading","table"]))}});export{J as default};
//# sourceMappingURL=Hooks.ced499a0.js.map
