"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../motion-utils/dist/es/errors.mjs.js"),t=require("../../../../../motion-dom/dist/es/animation/interfaces/visual-element.mjs.js"),r=require("../../../../../motion-dom/dist/es/render/utils/setters.mjs.js");function s(e,t){[...t].reverse().forEach((o=>{const n=e.getVariant(o);n&&r.setTarget(e,n),e.variantChildren&&e.variantChildren.forEach((e=>{s(e,t)}))}))}function o(e,t){return Array.isArray(t)?s(e,t):"string"==typeof t?s(e,[t]):void r.setTarget(e,t)}exports.animationControls=function(){let r=!1;const s=new Set,n={subscribe:e=>(s.add(e),()=>{s.delete(e)}),start(o,n){e.invariant(r,"controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.");const a=[];return s.forEach((e=>{a.push(t.animateVisualElement(e,o,{transitionOverride:n}))})),Promise.all(a)},set:t=>(e.invariant(r,"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook."),s.forEach((e=>{o(e,t)}))),stop(){s.forEach((e=>{!function(e){e.values.forEach((e=>e.stop()))}(e)}))},mount:()=>(r=!0,()=>{r=!1,n.stop()})};return n},exports.setValues=o;
//# sourceMappingURL=animation-controls.mjs.js.map
