import{d as k,ey as y,H as b,b as h,c as g,u as _}from"./outputWidgets.1739e6b5.js";import{e as w,a as H,b as C}from"./icons.1c3e2bde.js";import{a as I}from"./asyncComputed.b4d87a94.js";import{H as p}from"./hooks.877c6925.js";import{C as x}from"./CrudView.245e4133.js";import{a as D}from"./ant-design.6ecbca2a.js";import"./activeRecord.55a23e4a.js";import"./pubsub.e4395938.js";import"./Text.f4c0ef3e.js";import"./Title.1261c75a.js";import"./Form.6a4829ad.js";import"./router.95125983.js";import"./index.92715e30.js";import"./url.8bddfe76.js";import"./index.aaa812ca.js";import"./index.663f575e.js";import"./index.366cf7e1.js";import"./index.8b3d4030.js";import"./index.55ff2de5.js";import"./index.fbff59b3.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]="3e67e960-8058-430e-b320-b0b303a0fdc4",a._sentryDebugIdIdentifier="sentry-dbid-3e67e960-8058-430e-b320-b0b303a0fdc4")}catch{}})();const L=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:l}=I(()=>p.list()),c=({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()),l()},m=async()=>{const e=await p.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=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:c},{icon:H,label:"Duplicate",onClick:d},{icon:C,label:"Delete",onClick:u,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:m},null,8,["loading","table"]))}});export{L as default};
//# sourceMappingURL=Hooks.05d68167.js.map
