import{d as b,ex as k,H as y,b as h,c as _,u as H}from"./registerWidgets.7c26f935.js";import{e as g,a as w,b as C}from"./icons.d315d375.js";import{a as x}from"./asyncComputed.cfc29dee.js";import{H as p}from"./hooks.3d13470e.js";import{_ as I}from"./CrudView.vue_vue_type_script_setup_true_lang.7813a1ae.js";import"./activeRecord.d07557d8.js";import"./pubsub.c3a63076.js";import"./index.315bc9f8.js";import"./index.01e54af7.js";import"./Title.9a021125.js";import"./Form.ac091445.js";import"./index.611607c8.js";import"./index.9a7a96c9.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]="321ec5fa-a35e-4fb9-833e-b8c1b61eb621",a._sentryDebugIdIdentifier="sentry-dbid-321ec5fa-a35e-4fb9-833e-b8c1b61eb621")}catch{}})();const O=b({__name:"Hooks",setup(a){const n=k(),{loading:s,result:i,refetch:c}=x(()=>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;confirm("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=y(()=>{var e,o;return{columns:[{name:"Hook Name"},{name:"Path"},{name:"Hook Actions"}],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:g,label:"Edit Hook",onClick:l},{icon:w,label:"Duplicate",onClick:d},{icon:C,label:"Delete",onClick:m,dangerous:!0}]}]})))!=null?o:[]}});return(e,o)=>(h(),_(I,{loading:H(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{O as default};
//# sourceMappingURL=Hooks.0f6b708f.js.map
