import{d as x,i as y,U as h,J as w,c as B,k as s,l as T,u as b,o as k,m as r,n,E as P,G as i,B as K,K as N,M as m,Y as U}from"./index-CKtbewUP.js";import{_ as V}from"./AutomationWizard.vue_vue_type_script_setup_true_lang-CCXbQs6j.js";import{u as Y}from"./usePageTitle-BJBko9bD.js";import{u as v}from"./usePrefectApi-80PqJ8bJ.js";const O=x({__name:"AutomationCreate",async setup(D){let e,u;Y("Create Automation");const _=v(),c=y(),l=b(),f=[{text:"Automations",to:c.automations()},{text:"Create"}],{getActions:p,getTrigger:d}=h(),g=([e,u]=w(()=>A()),e=await e,u(),e);async function A(){const t={},[o,a]=await Promise.all([d(),p()]);return o&&(t.trigger=o),a&&(t.actions=a),t}async function C(t){try{await _.automations.createAutomation(t),m(i.success.automationCreate),l.push(c.automations())}catch(o){console.error(o);const a=U(o,i.error.automationCreate);m(a,"error",{timeout:!1})}}return(t,o)=>{const a=T("p-layout-default");return k(),B(a,{class:"automation-create"},{header:s(()=>[r(n(N),{crumbs:f},{actions:s(()=>[r(n(P),{to:n(i).docs.automations},{default:s(()=>[K(" Documentation ")]),_:1},8,["to"])]),_:1})]),default:s(()=>[r(V,{automation:n(g),onSubmit:C},null,8,["automation"])]),_:1})}}});export{O as default};
//# sourceMappingURL=AutomationCreate-C40ydLvr.js.map
