import{z as t}from"./index.cf4c23b9.js";import{w as r}from"./metadata.1f8b8ac9.js";import"./outputWidgets.260a3c99.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="04db7a3a-aebf-4acc-a698-5e5f72a5482c",a._sentryDebugIdIdentifier="sentry-dbid-04db7a3a-aebf-4acc-a698-5e5f72a5482c")}catch{}})();const i=r.stages.flatMap(a=>a.transitions.flatMap(e=>e.typeName)),c=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()})}),l=t.object({id:t.string(),type:t.enum(i),sourceStageId:t.string(),targetStageId:t.string(),props:t.object({conditionValue:t.string().nullable()})}),n=t.object({stages:t.array(c),transitions:t.array(l)}),d={"Content-Type":"application/json"},u="abstra-run-id";class w{async load(){const e=await fetch("/_editor/api/workflows");if(e.ok){const o=await e.json();return n.parse(o)}else throw new Error("Failed to fetch initial data")}async update(e){const o=await fetch("/_editor/api/workflows",{method:"PUT",headers:d,body:JSON.stringify(e)});if(o.ok){const s=await o.json();return n.parse(s)}else throw new Error("Failed to update workflow")}}export{u as A,w as W};
//# sourceMappingURL=api.24a1a6cb.js.map
