import{d as b,ey as k,H as y,b as h,c as g,u as _}from"./outputWidgets.7bdcec0a.js";import{e as w,a as H,b as C}from"./icons.6934ad19.js";import{a as I}from"./asyncComputed.cfb98789.js";import{H as c}from"./hooks.23cddd97.js";import{C as x}from"./CrudView.82a1bc5a.js";import{a as D}from"./ant-design.b9d9c398.js";import"./activeRecord.84d52553.js";import"./pubsub.c455bec9.js";import"./Text.94a8ea41.js";import"./Title.9c0d0c5f.js";import"./Form.f84b91b7.js";import"./router.3986149f.js";import"./index.15e46fc6.js";import"./url.5caacc63.js";import"./index.fa2fc691.js";import"./index.125aa6b3.js";import"./index.d2a75d88.js";import"./index.a9a6d5a2.js";import"./index.a2310446.js";import"./index.23129d61.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]="3be322af-5f21-48e8-b47d-5b42e2b97d6d",a._sentryDebugIdIdentifier="sentry-dbid-3be322af-5f21-48e8-b47d-5b42e2b97d6d")}catch{}})();const L=b({__name:"Hooks",setup(a){const n=k(),{loading:s,result:i,refetch:l}=I(()=>c.list()),p=({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 c.create();p({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=y(()=>{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:p},{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.7c33a74f.js.map
