import{l as r}from"./fetch.2c48c3fe.js";import{K as t}from"./vue-router.6b399b0b.js";import{w as i}from"./metadata.961ac5fc.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[e]="7f76aa57-34e6-4f21-8c30-fc740ed6b5c4",o._sentryDebugIdIdentifier="sentry-dbid-7f76aa57-34e6-4f21-8c30-fc740ed6b5c4")}catch{}})();const c=i.stages.flatMap(o=>o.transitions.flatMap(e=>e.typeName)),l=t.object({type:t.enum(["forms","hooks","jobs","scripts","conditions","iterators"]),id:t.string(),title:t.string(),position:t.object({x:t.number(),y:t.number()}),props:t.object({path:t.string().nullable(),filename:t.string().nullable(),variableName:t.string().nullable(),itemName:t.string().nullable()})}),d=t.object({id:t.string(),type:t.enum(c),sourceStageId:t.string(),targetStageId:t.string(),props:t.object({conditionValue:t.string().nullable()})}),s=t.object({stages:t.array(l),transitions:t.array(d)}),f={"Content-Type":"application/json"},h="abstra-run-id";class b{async load(){const e=await fetch("/_editor/api/workflows");if(e.ok){const a=await e.json();return s.parse(a)}else throw new Error("Failed to fetch initial data")}async update(e){const a=await fetch("/_editor/api/workflows",{method:"PUT",headers:f,body:JSON.stringify(e)});if(a.ok){const n=await a.json();return s.parse(n)}else throw new Error("Failed to update workflow")}}class y{constructor(e,a=r){this.authHeaders=e,this.fetch=a}get headers(){return{"Content-Type":"application/json",...this.authHeaders}}async load(){const e=await this.fetch("/_workflows",{headers:this.headers});if(e.ok){const a=await e.json();return s.parse(a)}else throw new Error("Failed to fetch initial data")}async update(e){const a=await this.fetch("/_workflows",{body:JSON.stringify(e),headers:this.headers,method:"PUT"});if(a.ok){const n=await a.json();return s.parse(n)}else throw new Error("Failed to update workflow")}}export{h as A,b as E,y as P};
//# sourceMappingURL=api.821769a1.js.map
