import{l as r}from"./fetch.04be8a9e.js";import{O as t}from"./index.0f630b70.js";import{w as i}from"./metadata.cfd15460.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]="8e57a91b-83b4-4ada-a742-46d00f8e44e8",o._sentryDebugIdIdentifier="sentry-dbid-8e57a91b-83b4-4ada-a742-46d00f8e44e8")}catch{}})();const l=i.stages.flatMap(o=>o.transitions.flatMap(e=>e.typeName)),d=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()})}),c=t.object({id:t.string(),type:t.enum(["forms:finished",...l]),sourceStageId:t.string(),targetStageId:t.string(),props:t.object({conditionValue:t.string().nullable()})}),s=t.object({stages:t.array(d),transitions:t.array(c)}),p={"Content-Type":"application/json"},b="abstra-run-id";class f{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:p,body:JSON.stringify(e)});if(a.ok){const n=await a.json();return s.parse(n)}else throw new Error("Failed to update workflow")}}const y=new f;class g{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){throw new Error("not implemented")}}export{b as A,f as E,g as P,y as w};
//# sourceMappingURL=api.a9b631fd.js.map
