import{d as k,ey as y,G as h,b,c as g,u as _}from"./outputWidgets.24bc53e6.js";import{e as w,a as C,b as H}from"./icons.346b8028.js";import{a as I}from"./asyncComputed.e4b96939.js";import{H as d}from"./hooks.e39e9595.js";import{C as x}from"./CrudView.acebed42.js";import{a as D}from"./ant-design.3bddf1a0.js";import"./activeRecord.7f48ce0d.js";import"./pubsub.6b8c4d65.js";import"./Text.9efc0467.js";import"./Title.d959e45a.js";import"./transButton.082aab94.js";import"./router.5678fba5.js";import"./Form.026abd8d.js";import"./index.bf56aca1.js";import"./url.12ca99c5.js";import"./index.0ec384bd.js";import"./index.3a0ced65.js";import"./index.b19c9d88.js";import"./index.4b05c792.js";import"./index.d2b2175c.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]="4dedcc5a-ad82-4111-8e40-2fe068d6e9f4",a._sentryDebugIdIdentifier="sentry-dbid-4dedcc5a-ad82-4111-8e40-2fe068d6e9f4")}catch{}})();const L=k({__name:"Hooks",setup(a){const n=y(),{loading:s,result:i,refetch:c}=I(()=>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()},m=async()=>{const e=await d.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: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{L as default};
//# sourceMappingURL=Hooks.dd5aff03.js.map
