import{d as k,ez as y,J as h,b,c as g,u as _}from"./outputWidgets.f120b477.js";import{e as w,a as C,b as H}from"./icons.c367c256.js";import{a as I}from"./asyncComputed.5ccd4614.js";import{H as p}from"./hooks.a815f30a.js";import{C as x}from"./CrudView.87b341af.js";import{a as D}from"./ant-design.13a5e655.js";import"./activeRecord.d87d7ef2.js";import"./pubsub.4681462f.js";import"./index.3ab4f365.js";import"./Title.3dc4e32d.js";import"./Form.ec892c10.js";import"./router.e3ecb487.js";import"./index.5818bfb2.js";import"./url.8af07297.js";import"./index.b96fbbd8.js";import"./index.3801d49d.js";import"./index.de46e6db.js";import"./index.54e8798a.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]="48488b0f-cae4-4c35-8b4f-f6fa145199f9",a._sentryDebugIdIdentifier="sentry-dbid-48488b0f-cae4-4c35-8b4f-f6fa145199f9")}catch{}})();const G=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=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:d},{icon:H,label:"Delete",onClick:m,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:u},null,8,["loading","table"]))}});export{G as default};
//# sourceMappingURL=Hooks.7704418f.js.map
