import{d as k,ey as y,H as h,b,c as g,u as _}from"./outputWidgets.9a4dffd5.js";import{e as w,a as H,b as C}from"./icons.d935dec9.js";import{a as I}from"./asyncComputed.947a021a.js";import{H as p}from"./hooks.350ac392.js";import{C as x}from"./CrudView.32e9e362.js";import{a as D}from"./ant-design.edc4db28.js";import"./activeRecord.6b2e89dc.js";import"./pubsub.25596209.js";import"./index.0d204717.js";import"./Title.72e90637.js";import"./Form.0ea0ca53.js";import"./router.e9c58c63.js";import"./index.a351ac5c.js";import"./url.152c5826.js";import"./index.c64df437.js";import"./index.c4327f7e.js";import"./index.d0b58c73.js";import"./index.3ecad98a.js";import"./index.0e22fd42.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]="3d44f8c9-4bcc-4c57-9ef6-6699082c8dca",a._sentryDebugIdIdentifier="sentry-dbid-3d44f8c9-4bcc-4c57-9ef6-6699082c8dca")}catch{}})();const K=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()},m=async()=>{const e=await p.create();l({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()),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:w,label:"Edit Hook",onClick:l},{icon:H,label:"Duplicate",onClick:d},{icon:C,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.7a34dd23.js.map
