"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../render/utils/resolve-dynamic-variants.mjs.js"),t=require("../utils/calc-child-stagger.mjs.js"),i=require("./visual-element-target.mjs.js");function n(r,o){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const l=e.resolveVariant(r,o,"exit"===a.type?r.presenceContext?.custom:void 0);let{transition:s=r.getDefaultTransition()||{}}=l||{};a.transitionOverride&&(s=a.transitionOverride);const d=l?()=>Promise.all(i.animateTarget(r,l,a)):()=>Promise.resolve(),v=r.variantChildren&&r.variantChildren.size?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{delayChildren:i=0,staggerChildren:l,staggerDirection:d}=s;return function(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0;const d=[];for(const v of e.variantChildren)v.notify("AnimationStart",i),d.push(n(v,i,{...s,delay:r+("function"==typeof o?0:o)+t.calcChildStagger(e.variantChildren,v,o,a,l)}).then((()=>v.notify("AnimationComplete",i))));return Promise.all(d)}(r,o,e,i,l,d,a)}:()=>Promise.resolve(),{when:c}=s;if(c){const[e,t]="beforeChildren"===c?[d,v]:[v,d];return e().then((()=>t()))}return Promise.all([d(),v(a.delay)])}exports.animateVariant=n;
//# sourceMappingURL=visual-element-variant.mjs.js.map
