import{r as i,c as B,P as l,M as s}from"./index-ChhimAZ-.js";function c(u,e,n){return new Promise((r,a)=>{u.forwardEvent(new CustomEvent("wf-builtin-run",{detail:{callback:r,handler:n?`$runBlueprintTriggerBranchById_${n}`:`$runBlueprintById_${e}`}}),null,!0).catch(a)})}function p(u,e){const n=i(!1);async function r(a){if(!n.value){n.value=!0;try{await c(u,s(e),a)}finally{n.value=!1}}}return{isRunning:l(n),run:r}}function g(u,e){const n=i([]);async function r({blueprintId:t,branchId:o}){if(!n.value.includes(t))try{n.value=[t,...n.value],await c(u,t,o)}finally{n.value=n.value.filter(v=>v!==t)}}async function a(){await Promise.all(s(e).map(r))}const f=B(()=>n.value.length>0);return{run:a,isRunning:f,runningBlueprintIds:l(n)}}export{g as a,p as u};
