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