1import{f as e}from"./math.scalar.functions-BWXNux-o.js";import{n as t,r as n}from"./scene.pure-DgZ5AJtD.js";import{n as r}from"./observable.pure-H-M_hi7F.js";import{i,n as a,o,t as s,u as c}from"./math.vector.pure-DflB6eDL.js";import{t as l}from"./engineStore-B_7KzytD.js";import{n as u}from"./devTools-Bh3wKyVb.js";import{c as d,d as f,i as p,l as m,o as h,r as g,s as _,t as v,u as y}from"./animation.pure-BYMh-NgL.js";import{r as b}from"./math.size-CUD0MKo0.js";import{t as x}from"./node-C_g7LpaF.js";import{t as S}from"./precisionDate-Uyb-ubD0.js";var C=class{get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}constructor(e,t,n,r){if(this._events=[],this._currentFrame=0,this._originalValue=[],this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath=``,this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._yoyoDirection=1,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._coreRuntimeAnimation=null,this._animation=t,this._target=e,this._scene=n,this._host=r,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===v.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=s.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minFrame!==0){let e={frame:0,value:this._keys[0].value};this._keys.splice(0,0,e)}if(this._target instanceof Array){let e=0;for(let t of this._target)this._preparePath(t,e),this._getOriginalValues(e),e++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];let i=t.getEvents();if(i&&i.length>0)for(let e of i)this._events.push(e._clone());this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}_preparePath(e,t=0){let n=this._animation.targetPropertyPath;if(n.length>1){let r=e;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r[t],r===void 0)throw Error(`Invalid property (${t}) in property path (${n.join(`.`)})`)}this._targetPath=n[n.length-1],this._activeTargets[t]=r}else this._targetPath=n[0],this._activeTargets[t]=e;if(this._activeTargets[t][this._targetPath]===void 0)throw Error(`Invalid property (${this._targetPath}) in property path (${n.join(`.`)})`)}get animation(){return this._animation}reset(e=!1){if(e){if(this._target instanceof Array){let e=0;for(let t of this._target)this._originalValue[e]!==void 0&&this._setValue(t,this._activeTargets[e],this._originalValue[e],-1,e),e++}else this._originalValue[0]!==void 0&&this._setValue(this._target,this._directTarget,this._originalValue[0],-1,0)}this._offsetsCache={},this._highLimitsCache={},this._currentFrame=0,this._blendingFactor=0;for(let e=0;e<this._events.length;e++)this._events[e].isDone=!1}isStopped(){return this._stopped}dispose(){let e=this._animation.runtimeAnimations.indexOf(this);e>-1&&this._animation.runtimeAnimations.splice(e,1)}setValue(e,t){if(this._targetIsArray){for(let n=0;n<this._target.length;n++){let r=this._target[n];this._setValue(r,this._activeTargets[n],e,t,n)}return}this._setValue(this._target,this._directTarget,e,t,0)}_getOriginalValues(e=0){let t,n=this._activeTargets[e];if(v.InheritOriginalValueFromActiveAnimations){let t=this._scene._activeAnimatables;for(let r=0;r<t.length;r++){let i=t[r]._runtimeAnimations;for(let t=0;t<i.length;t++){let r=i[t];if(r!==this&&r._targetPath===this._targetPath){for(let t=0;t<r._activeTargets.length;t++)if(r._activeTargets[t]===n&&r._originalValue[t]!==void 0){r._originalValue[t]&&r._originalValue[t].clone?this._originalValue[e]=r._originalValue[t].clone():this._originalValue[e]=r._originalValue[t];return}}}}}t=n.getLocalMatrix&&this._targetPath===`_matrix`?n.getLocalMatrix():n[this._targetPath],t&&t.clone?this._originalValue[e]=t.clone():this._originalValue[e]=t}_registerTargetForLateAnimationBinding(e,t){let n=e.target;this._scene._registeredForLateAnimationBindings.pushNoDuplicate(n),n._lateAnimationHolders||={},n._lateAnimationHolders[e.targetPath]||(n._lateAnimationHolders[e.targetPath]={totalWeight:0,totalAdditiveWeight:0,animations:[],additiveAnimations:[],originalValue:t}),e.isAdditive?(n._lateAnimationHolders[e.targetPath].additiveAnimations.push(e),n._lateAnimationHolders[e.targetPath].totalAdditiveWeight+=e.weight):(n._lateAnimationHolders[e.targetPath].animations.push(e),n._lateAnimationHolders[e.targetPath].totalWeight+=e.weight)}_setValue(e,t,n,r,i){if(this._currentActiveTarget=t,this._weight=r,this._enableBlending&&this._blendingFactor<=1){if(!this._originalBlendValue){let e=t[this._targetPath];this._originalBlendValue=e.clone?e.clone():e}this._originalBlendValue.m?v.AllowMatrixDecomposeForInterpolation?this._currentValue?s.DecomposeLerpToRef(this._originalBlendValue,n,this._blendingFactor,this._currentValue):this._currentValue=s.DecomposeLerp(this._originalBlendValue,n,this._blendingFactor):this._currentValue?s.LerpToRef(this._originalBlendValue,n,this._blendingFactor,this._currentValue):this._currentValue=s.Lerp(this._originalBlendValue,n,this._blendingFactor):this._currentValue=v._UniversalLerp(this._originalBlendValue,n,this._blendingFactor);let r=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.blendingSpeed:this._animation.blendingSpeed;this._blendingFactor+=r}else this._currentValue?this._currentValue.copyFrom?this._currentValue.copyFrom(n):this._currentValue=n:this._currentValue=n?.clone?n.clone():n;r===-1?this._animationState.loopMode===v.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT?this._currentValue.addToRef?this._currentValue.addToRef(this._originalValue[i],t[this._targetPath]):t[this._targetPath]=this._originalValue[i]+this._currentValue:t[this._targetPath]=this._currentValue:this._registerTargetForLateAnimationBinding(this,this._originalValue[i]),e.markAsDirty&&e.markAsDirty(this._animation.targetProperty)}
1_getCorrectLoopMode(){return this._target&&this._target.animationPropertiesOverride?this._target.getClassName?.()===`MorphTarget`&&this._target._animationPropertiesOverride==null?this._animation.loopMode:this._target.animationPropertiesOverride.loopMode:this._animation.loopMode}goToFrame(e,t=-1){let n=this._animation.getKeys();e<n[0].frame?e=n[0].frame:e>n[n.length-1].frame&&(e=n[n.length-1].frame);let r=this._events;if(r.length)for(let t=0;t<r.length;t++)r[t].onlyOnce||(r[t].isDone=r[t].frame<e);this._currentFrame=e;let i=this._animation._interpolate(e,this._animationState);this.setValue(i,t)}_prepareForSpeedRatioChange(e){let t=this._previousElapsedTime*(this._animation.framePerSecond*e)/1e3;this._absoluteFrameOffset=this._previousAbsoluteFrame-t}animate(e,t,n,r,i,a=-1){let o=this._animation,s=o.targetPropertyPath;if(!s||s.length<1)return this._stopped=!0,!1;let c=!0,l,u=this._events,p;if(this._coreRuntimeAnimation)p=n-t,l=this._coreRuntimeAnimation.currentFrame,this._currentFrame=l,this._animationState.repeatCount=this._coreRuntimeAnimation._animationState.repeatCount,this._animationState.highLimitValue=this._coreRuntimeAnimation._animationState.highLimitValue,this._animationState.offsetValue=this._coreRuntimeAnimation._animationState.offsetValue;else{(t<this._minFrame||t>this._maxFrame)&&(t=this._minFrame),(n<this._minFrame||n>this._maxFrame)&&(n=this._maxFrame),p=n-t;let a,s=e*(o.framePerSecond*i)/1e3+this._absoluteFrameOffset,g=0,b=!1,x=r&&this._animationState.loopMode===v.ANIMATIONLOOPMODE_YOYO;if(x){let e=(s-t)/p,n=Math.sin(e*Math.PI);s=Math.abs(n)*p+t;let r=n>=0?1:-1;this._yoyoDirection!==r&&(b=!0),this._yoyoDirection=r}if(this._previousElapsedTime=e,this._previousAbsoluteFrame=s,!r&&n>=t&&(s>=p&&i>0||s<=0&&i<0))c=!1,g=o.evaluate(n);else if(!r&&t>=n&&(s<=p&&i<0||s>=0&&i>0))c=!1,g=o.evaluate(t);else if(this._animationState.loopMode!==v.ANIMATIONLOOPMODE_CYCLE){let e=n.toString()+t.toString();if(!this._offsetsCache[e]){this._animationState.repeatCount=0,this._animationState.loopMode=v.ANIMATIONLOOPMODE_CYCLE;let r=o._interpolate(t,this._animationState),i=o._interpolate(n,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),o.dataType){case v.ANIMATIONTYPE_FLOAT:this._offsetsCache[e]=i-r;break;case v.ANIMATIONTYPE_QUATERNION:this._offsetsCache[e]=i.subtract(r);break;case v.ANIMATIONTYPE_VECTOR3:this._offsetsCache[e]=i.subtract(r);break;case v.ANIMATIONTYPE_VECTOR2:this._offsetsCache[e]=i.subtract(r);break;case v.ANIMATIONTYPE_SIZE:this._offsetsCache[e]=i.subtract(r);break;case v.ANIMATIONTYPE_COLOR3:this._offsetsCache[e]=i.subtract(r);break;case v.ANIMATIONTYPE_COLOR4:this._offsetsCache[e]=i.subtract(r)}this._highLimitsCache[e]=i}g=this._highLimitsCache[e],a=this._offsetsCache[e]}if(a===void 0)switch(o.dataType){case v.ANIMATIONTYPE_FLOAT:a=0;break;case v.ANIMATIONTYPE_QUATERNION:a=d;break;case v.ANIMATIONTYPE_VECTOR3:a=f;break;case v.ANIMATIONTYPE_VECTOR2:a=y;break;case v.ANIMATIONTYPE_SIZE:a=m;break;case v.ANIMATIONTYPE_COLOR3:a=h;break;case v.ANIMATIONTYPE_COLOR4:a=_}if(this._host&&this._host.syncRoot){let e=this._host.syncRoot,n=(e.masterFrame-e.fromFrame)/(e.toFrame-e.fromFrame);l=t+p*n}else l=s>0&&t>n||s<0&&t<n?c&&p!==0?n+s%p:t:c&&p!==0?t+s%p:n;if(!x&&(i>0&&this.currentFrame>l||i<0&&this.currentFrame<l)||x&&b){this._onLoop();for(let e=0;e<u.length;e++)u[e].onlyOnce||(u[e].isDone=!1);this._animationState.key=i>0?0:o.getKeys().length-1}this._currentFrame=l,this._animationState.repeatCount=p===0?0:s/p>>0,this._animationState.highLimitValue=g,this._animationState.offsetValue=a}let g=o._interpolate(l,this._animationState);if(this.setValue(g,a),u.length){for(let e=0;e<u.length;e++)if(p>=0&&l>=u[e].frame&&u[e].frame>=t||p<0&&l<=u[e].frame&&u[e].frame<=t){let t=u[e];t.isDone||(t.onlyOnce&&(u.splice(e,1),e--),t.isDone=!0,t.action(l))}}return c||(this._stopped=!0),c}},w=class e{get syncRoot(){return this._syncRoot}get masterFrame(){return this._runtimeAnimations.length===0?0:this._runtimeAnimations[0].currentFrame}get weight(){return this._weight}set weight(e){if(e===-1){this._weight=-1;return}this._weight=Math.min(Math.max(e,0),1)}get speedRatio(){return this._speedRatio}set speedRatio(e){for(let t=0;t<this._runtimeAnimations.length;t++)this._runtimeAnimations[t]._prepareForSpeedRatioChange(e);this._speedRatio=e,this._goToFrame!==null&&this.goToFrame(this._goToFrame)}get elapsedTime(){return this._localDelayOffset===null?0:this._scene._animationTime-this._localDelayOffset}constructor(e,t,n=0,i=100,a=!1,o=1,s,c,l,u=!1,d=0){this.target=t,this.fromFrame=n,this.toFrame=i,this.loopAnimation=a,this.onAnimationEnd=s,this.onAnimationLoop=l,this.isAdditive=u,this.playOrder=d,this._localDelayOffset=null,this._pausedDelay=null,this._manualJumpDelay=null,this._runtimeAnimations=[],this._paused=!1,this._speedRatio=1,this._weight=-1,this._previousWeight=-1,this._syncRoot=null,this._frameToSyncFromJump=null,this._goToFrame=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new r,this.onAnimationLoopObservable=new r,this._scene=e,c&&this.appendAnimations(t,c),this._speedRatio=o,e._activeAnimatables.push(this)}syncWith(e){if(this._syncRoot=e,e){let e=this._scene._activeAnimatables.indexOf(this);e>-1&&(this._scene._activeAnimatables.splice(e,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=new C(e,r,this._scene,this);i._onLoop=()=>{this.onAnimationLoopObservable.notifyObservers(this),this.onAnimationLoop&&this.onAnimationLoop()},this._runtimeAnimations.push(i)}}getAnimationByTargetProperty(e){let t=this._runtimeAnimations;for(let n=0;n<t.length;n++)if(t[n].animation.targetProperty===e)return t[n].animation;return null}getRuntimeAnimationByTargetProperty(e){let t=this._runtimeAnimations;for(let n=0;n<t.length;n++)if(t[n].animation.targetProperty===e)return t[n];return null}reset(){let e=this._runtimeAnimations;for(let t=0;t<e.length;t++)e[t].reset(!0);this._localDelayOffset=null,this._pausedDelay=null}enableBlending(e){let t=this._runtimeAnimations;for(let n=0;n<t.length;n++)t[n].animation.enableBlending=!0,t[n].animation.blendingSpeed=e}disableBlending(){let e=this._runtimeAnimations;for(let t=0;t<e.length;t++)e[t].animation.enableBlending=!1}
1goToFrame(e,t=!1){let n=this._runtimeAnimations;if(n[0]){let t=n[0].animation.framePerSecond;this._frameToSyncFromJump=this._frameToSyncFromJump??n[0].currentFrame;let r=this.speedRatio===0?0:(e-this._frameToSyncFromJump)/t*1e3/this.speedRatio;this._manualJumpDelay=-r}for(let r=0;r<n.length;r++)n[r].goToFrame(e,t?this._weight:-1);this._goToFrame=e}get paused(){return this._paused}pause(){this._paused||=!0}restart(){this._paused=!1}_raiseOnAnimationEnd(){this.onAnimationEnd&&this.onAnimationEnd(),this.onAnimationEndObservable.notifyObservers(this)}stop(e,t,n=!1,r=!1){if(e||t){let i=this._scene._activeAnimatables.indexOf(this);if(i>-1){let a=this._runtimeAnimations;for(let n=a.length-1;n>=0;n--){let r=a[n];e&&r.animation.name!=e||(!t||t(r.target))&&(r.dispose(),a.splice(n,1))}a.length==0&&(n||this._scene._activeAnimatables.splice(i,1),r||this._raiseOnAnimationEnd())}}else{let e=this._scene._activeAnimatables.indexOf(this);if(e>-1){n||this._scene._activeAnimatables.splice(e,1);let t=this._runtimeAnimations;for(let e=0;e<t.length;e++)t[e].dispose();this._runtimeAnimations.length=0,r||this._raiseOnAnimationEnd()}}}async waitAsync(){return await new Promise(e=>{this.onAnimationEndObservable.add(()=>{e(this)},void 0,void 0,this,!0)})}_animate(t){if(this._paused)return this.animationStarted=!1,this._pausedDelay===null&&(this._pausedDelay=t),!0;if(this._localDelayOffset===null?(this._localDelayOffset=t,this._pausedDelay=null):this._pausedDelay!==null&&(this._localDelayOffset+=t-this._pausedDelay,this._pausedDelay=null),this._manualJumpDelay!==null&&(this._localDelayOffset+=this.speedRatio<0?-this._manualJumpDelay:this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),this._goToFrame=null,!e.ProcessPausedAnimatables&&this._weight===0&&this._previousWeight===0)return!0;this._previousWeight=this._weight;let n=!1,r=this._runtimeAnimations,i=0;for(;i<r.length;i++){let e=r[i].animate(t-this._localDelayOffset,this.fromFrame,this.toFrame,this.loopAnimation,this._speedRatio,this._weight);n||=e}if(this.animationStarted=n,!n){if(this.disposeOnEnd)for(i=this._scene._activeAnimatables.indexOf(this),this._scene._activeAnimatables.splice(i,1),i=0;i<r.length;i++)r[i].dispose();this._raiseOnAnimationEnd(),this.disposeOnEnd&&(this.onAnimationEnd=null,this.onAnimationLoop=null,this.onAnimationLoopObservable.clear(),this.onAnimationEndObservable.clear())}return n}};w.ProcessPausedAnimatables=!1;function T(e){if(e.totalWeight===0&&e.totalAdditiveWeight===0)return e.originalValue;let t=1,n=i.Vector3[0],r=i.Vector3[1],c=i.Quaternion[0],l=0,u=e.animations[0],d=e.originalValue,f,p=!1;if(e.totalWeight<1)f=1-e.totalWeight,d.decompose(r,c,n);else{if(l=1,t=e.totalWeight,f=u.weight/t,f==1){if(e.totalAdditiveWeight)p=!0;else return u.currentValue}u.currentValue.decompose(r,c,n)}if(!p){r.scaleInPlace(f),n.scaleInPlace(f),c.scaleInPlace(f);for(let o=l;o<e.animations.length;o++){let s=e.animations[o];if(s.weight===0)continue;f=s.weight/t;let l=i.Vector3[2],u=i.Vector3[3],d=i.Quaternion[1];s.currentValue.decompose(u,d,l),u.scaleAndAddToRef(f,r),d.scaleAndAddToRef(a.Dot(c,d)>0?f:-f,c),l.scaleAndAddToRef(f,n)}c.normalize()}for(let t=0;t<e.additiveAnimations.length;t++){let s=e.additiveAnimations[t];if(s.weight===0)continue;let l=i.Vector3[2],u=i.Vector3[3],d=i.Quaternion[1];s.currentValue.decompose(u,d,l),u.multiplyToRef(r,u),o.LerpToRef(r,u,s.weight,r),c.multiplyToRef(d,d),a.SlerpToRef(c,d,s.weight,c),l.scaleAndAddToRef(s.weight,n)}let m=u?u._animationState.workValue:i.Matrix[0].clone();return s.ComposeToRef(r,c,n,m),m}function E(e,t){if(e.totalWeight===0&&e.totalAdditiveWeight===0)return t;let n=e.animations[0],r=e.originalValue,o=t;if(e.totalWeight===0&&e.totalAdditiveWeight>0)o.copyFrom(r);else if(e.animations.length===1){if(a.SlerpToRef(r,n.currentValue,Math.min(1,e.totalWeight),o),e.totalAdditiveWeight===0)return o}else if(e.animations.length>1){let n=1,i,s;if(e.totalWeight<1){let t=1-e.totalWeight;i=[],s=[],i.push(r),s.push(t)}else{if(e.animations.length===2&&(a.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),e.totalAdditiveWeight===0))return t;i=[],s=[],n=e.totalWeight}for(let t=0;t<e.animations.length;t++){let r=e.animations[t];i.push(r.currentValue),s.push(r.weight/n)}let c=0;for(let e=0;e<i.length;){if(!e){a.SlerpToRef(i[e],i[e+1],s[e+1]/(s[e]+s[e+1]),t),o=t,c=s[e]+s[e+1],e+=2;continue}c+=s[e],a.SlerpToRef(o,i[e],s[e]/c,o),e++}}for(let t=0;t<e.additiveAnimations.length;t++){let n=e.additiveAnimations[t];n.weight!==0&&(o.multiplyToRef(n.currentValue,i.Quaternion[0]),a.SlerpToRef(o,i.Quaternion[0],n.weight,o))}return o}function D(e){if(e._registeredForLateAnimationBindings.length){for(let t=0;t<e._registeredForLateAnimationBindings.length;t++){let n=e._registeredForLateAnimationBindings.data[t];for(let e in n._lateAnimationHolders){let t=n._lateAnimationHolders[e],r=t.animations[0],i=t.originalValue;if(i==null)continue;let o=v.AllowMatrixDecomposeForInterpolation&&i.m,s=n[e];if(o)s=T(t);else if(i.w!==void 0)s=E(t,s||a.Identity());else{let e=0,n=1,a=r&&r._animationState.loopMode===v.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT;if(t.totalWeight<1)s=a?i.clone?i.clone():i:r&&i.scale?i.scale(1-t.totalWeight):r?i*(1-t.totalWeight):i.clone?i.clone():i;else if(r){n=t.totalWeight;let o=r.weight/n;s=o===1?r.currentValue:r.currentValue.scale?r.currentValue.scale(o):r.currentValue*o,a&&(s.addToRef?s.addToRef(i,s):s+=i),e=1}for(let r=e;r<t.animations.length;r++){let e=t.animations[r],i=e.weight/n;if(i)e.currentValue.scaleAndAddToRef?e.currentValue.scaleAndAddToRef(i,s):s+=e.currentValue*i;else continue}for(let e=0;e<t.additiveAnimations.length;e++){let n=t.additiveAnimations[e],r=n.weight;if(r)n.currentValue.scaleAndAddToRef?n.currentValue.scaleAndAddToRef(r,s):s+=n.currentValue*r;else continue}}n[e]=s}n._lateAnimationHolders={}}e._registeredForLateAnimationBindings.reset()}}function O(e,t){t&&(t.prototype.copyAnimationRange=function(e,t,n,r=!1,i=null){this.animations.length===0&&(this.animations.push(new v(this.name,`_matrix`,e.animations[0].framePerSecond,v.ANIMATIONTYPE_MATRIX,0)),this.animations[0].setKeys([]));let a=e.animations[0].getRange(t);if(!a)return!1;let o=a.from,s=a.to,c=e.animations[0].getKeys(),l=e.length,u=e.getParent(),d=this.getParent(),f=r&&u&&l&&this.length&&l!==this.length,p=f&&d&&u?d.length/u.length:1,m=r&&!d&&i&&(i.x!==1||i.y!==1||i.z!==1),h=this.animations[0].getKeys(),g,_,y;for(let e=0,t=c.length;e<t;e++)g=c[e],g.frame>=o&&g.frame<=s&&(r?(y=g.value.clone(),f?(_=y.getTranslation(),y.setTranslation(_.scaleInPlace(p))):m&&i?(_=y.getTranslation(),y.setTranslation(_.multiplyInPlace(i))):y=g.value):y=g.value,h.push({frame:g.frame+n,value:y}));return this.animations[0].createRange(t,o+n,s+n),!0}),e&&(e.prototype._animate=function(e){if(!this.animationsEnabled)return;let t=S.Now;
1if(!this._animationTimeLast){if(this._pendingData.length>0)return;this._animationTimeLast=t}this.deltaTime=e===void 0?this.useConstantAnimationDeltaTime?16:(t-this._animationTimeLast)*this.animationTimeScale:e,this._animationTimeLast=t;let n=this._activeAnimatables;if(n.length===0)return;this._animationTime+=this.deltaTime;let r=this._animationTime;for(let e=0;e<n.length;e++){let t=n[e];!t._animate(r)&&t.disposeOnEnd&&e--}D(this)},e.prototype.sortActiveAnimatables=function(){this._activeAnimatables.sort((e,t)=>e.playOrder-t.playOrder)},e.prototype.beginWeightedAnimation=function(e,t,n,r=1,i,a=1,o,s,c,l,u=!1){let d=this.beginAnimation(e,t,n,i,a,o,s,!1,c,l,u);return d.weight=r,d},e.prototype.beginAnimation=function(e,t,n,r,i=1,a,o,s=!0,c,l,u=!1){if(i<0){let e=t;t=n,n=e,i=-i}t>n&&(i=-i),s&&this.stopAnimation(e,void 0,c),o||=new w(this,e,t,n,r,i,a,void 0,l,u);let d=!c||c(e);if(e.animations&&d&&o.appendAnimations(e,e.animations),e.getAnimatables){let u=e.getAnimatables();for(let e=0;e<u.length;e++)this.beginAnimation(u[e],t,n,r,i,a,o,s,c,l)}return o.reset(),o},e.prototype.beginHierarchyAnimation=function(e,t,n,r,i,a=1,o,s,c=!0,l,u,d=!1){let f=e.getDescendants(t),p=[];p.push(this.beginAnimation(e,n,r,i,a,o,s,c,l,void 0,d));for(let e of f)p.push(this.beginAnimation(e,n,r,i,a,o,s,c,l,void 0,d));return p},e.prototype.beginDirectAnimation=function(e,t,n,r,i,a=1,o,s,c=!1){if(a<0){let e=n;n=r,r=e,a=-a}return n>r&&(a=-a),new w(this,e,n,r,i,a,o,t,s,c)},e.prototype.beginDirectHierarchyAnimation=function(e,t,n,r,i,a,o,s,c,l=!1){let u=e.getDescendants(t),d=[];d.push(this.beginDirectAnimation(e,n,r,i,a,o,s,c,l));for(let e of u)d.push(this.beginDirectAnimation(e,n,r,i,a,o,s,c,l));return d},e.prototype.getAnimatableByTarget=function(e){for(let t=0;t<this._activeAnimatables.length;t++)if(this._activeAnimatables[t].target===e)return this._activeAnimatables[t];return null},e.prototype.getAllAnimatablesByTarget=function(e){let t=[];for(let n=0;n<this._activeAnimatables.length;n++)this._activeAnimatables[n].target===e&&t.push(this._activeAnimatables[n]);return t},e.prototype.stopAnimation=function(e,t,n){let r=this.getAllAnimatablesByTarget(e);for(let e of r)e.stop(t,n)},e.prototype.stopAllAnimations=function(){if(this._activeAnimatables){for(let e=0;e<this._activeAnimatables.length;e++)this._activeAnimatables[e].stop(void 0,void 0,!0);this._activeAnimatables.length=0}for(let e of this.animationGroups)e.stop()})}var k,A=class e extends x{get _matrix(){return this._compose(),this._localMatrix}set _matrix(e){(e.updateFlag!==this._localMatrix.updateFlag||this._needToCompose)&&(this._needToCompose=!1,this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose())}constructor(e,t,n=null,r=null,i=null,a=null,o=null){super(e,t.getScene(),!1),this.name=e,this.children=[],this.animations=[],this._index=null,this._scalingDeterminant=1,this._needToDecompose=!0,this._needToCompose=!1,this._linkedTransformNode=null,this._waitingTransformNodeId=null,this._waitingTransformNodeUniqueId=null,this._skeleton=t,this._localMatrix=r?.clone()??s.Identity(),this._restMatrix=i??this._localMatrix.clone(),this._bindMatrix=a??this._localMatrix.clone(),this._index=o,this._absoluteMatrix=new s,this._absoluteBindMatrix=new s,this._absoluteInverseBindMatrix=new s,this._finalMatrix=new s,t.bones.push(this),this.setParent(n,!1),this._updateAbsoluteBindMatrices()}getClassName(){return`Bone`}getSkeleton(){return this._skeleton}get parent(){return this._parentNode}getParent(){return this.parent}getChildren(){return this.children}getIndex(){return this._index===null?this.getSkeleton().bones.indexOf(this):this._index}set parent(e){this.setParent(e)}setParent(e,t=!0){if(this.parent!==e){if(this.parent){let e=this.parent.children.indexOf(this);e!==-1&&this.parent.children.splice(e,1)}this._parentNode=e,this.parent&&this.parent.children.push(this),t&&this._updateAbsoluteBindMatrices(),this.markAsDirty()}}getLocalMatrix(){return this._compose(),this._localMatrix}getBindMatrix(){return this._bindMatrix}getBaseMatrix(){return this.getBindMatrix()}getRestMatrix(){return this._restMatrix}getRestPose(){return this.getRestMatrix()}setRestMatrix(e){this._restMatrix.copyFrom(e)}setRestPose(e){this.setRestMatrix(e)}getBindPose(){return this.getBindMatrix()}setBindMatrix(e){this.updateMatrix(e)}setBindPose(e){this.setBindMatrix(e)}getFinalMatrix(){return this._finalMatrix}getWorldMatrix(){return this.getFinalMatrix()}returnToRest(){if(this._linkedTransformNode){let e=i.Vector3[0],t=i.Quaternion[0],n=i.Vector3[1];this.getRestMatrix().decompose(e,t,n),this._linkedTransformNode.position.copyFrom(n),this._linkedTransformNode.rotationQuaternion=this._linkedTransformNode.rotationQuaternion??a.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(t),this._linkedTransformNode.scaling.copyFrom(e)}else this._matrix=this._restMatrix}getAbsoluteInverseBindMatrix(){return this._absoluteInverseBindMatrix}getInvertedAbsoluteTransform(){return this.getAbsoluteInverseBindMatrix()}getAbsoluteMatrix(){return this._skeleton.computeAbsoluteMatrices(),this._absoluteMatrix}getAbsoluteTransform(){return this.getAbsoluteMatrix()}linkTransformNode(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++}getTransformNode(){return this._linkedTransformNode}get position(){return this._decompose(),this._localPosition}set position(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()}get rotation(){return this.getRotation()}set rotation(e){this.setRotation(e)}get rotationQuaternion(){return this._decompose(),this._localRotation}set rotationQuaternion(e){this.setRotationQuaternion(e)}
1get scaling(){return this.getScale()}set scaling(e){this.setScale(e)}get animationPropertiesOverride(){return this._skeleton.animationPropertiesOverride}_decompose(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=o.Zero(),this._localRotation=a.Zero(),this._localPosition=o.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))}_compose(){if(this._needToCompose){if(!this._localScaling){this._needToCompose=!1;return}this._needToCompose=!1,s.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)}}updateMatrix(e,t=!0,n=!0){this._bindMatrix.copyFrom(e),t&&this._updateAbsoluteBindMatrices(),n?this._matrix=e:this.markAsDirty()}_updateAbsoluteBindMatrices(e,t=!0){if(e||=this._bindMatrix,this.parent?e.multiplyToRef(this.parent._absoluteBindMatrix,this._absoluteBindMatrix):this._absoluteBindMatrix.copyFrom(e),this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix),t)for(let e=0;e<this.children.length;e++)this.children[e]._updateAbsoluteBindMatrices();this._scalingDeterminant=this._absoluteBindMatrix.determinant()<0?-1:1}markAsDirty(){return this._currentRenderId++,this._childUpdateId++,this._skeleton._markAsDirty(),this}_markAsDirtyAndCompose(){this.markAsDirty(),this._needToCompose=!0}_markAsDirtyAndDecompose(){this.markAsDirty(),this._needToDecompose=!0}_updatePosition(t,n=0,r,i=!0){let a=this.getLocalMatrix();if(n==0)i?(a.addAtIndex(12,t.x),a.addAtIndex(13,t.y),a.addAtIndex(14,t.z)):a.setTranslationFromFloats(t.x,t.y,t.z);else{let n=e._TmpMats[0],c=e._TmpVecs[0];this.parent?(n.copyFrom(this.parent.getAbsoluteMatrix()),r&&n.multiplyToRef(r.getWorldMatrix(),n)):s.IdentityToRef(n),i&&n.setTranslationFromFloats(0,0,0),n.invert(),o.TransformCoordinatesToRef(t,n,c),i?(a.addAtIndex(12,c.x),a.addAtIndex(13,c.y),a.addAtIndex(14,c.z)):a.setTranslationFromFloats(c.x,c.y,c.z)}this._markAsDirtyAndDecompose()}translate(e,t=0,n){this._updatePosition(e,t,n,!0)}setPosition(e,t=0,n){this._updatePosition(e,t,n,!1)}setAbsolutePosition(e,t){this.setPosition(e,1,t)}scale(t,n,r,i=!1){let a=this.getLocalMatrix(),o=e._TmpMats[0];s.ScalingToRef(t,n,r,o),o.multiplyToRef(a,a),o.invert();for(let e of this.children){let i=e.getLocalMatrix();i.multiplyToRef(o,i),i.multiplyAtIndex(12,t),i.multiplyAtIndex(13,n),i.multiplyAtIndex(14,r),e._markAsDirtyAndDecompose()}if(this._markAsDirtyAndDecompose(),i)for(let e of this.children)e.scale(t,n,r,i)}setScale(e){this._decompose(),this._localScaling.copyFrom(e),this._markAsDirtyAndCompose()}getScale(){return this._decompose(),this._localScaling}getScaleToRef(e){this._decompose(),e.copyFrom(this._localScaling)}setYawPitchRoll(t,n,r,i=0,o){if(i===0){let s=e._TmpQuat;a.RotationYawPitchRollToRef(t,n,r,s),this.setRotationQuaternion(s,i,o);return}let c=e._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(c,o))return;let l=e._TmpMats[1];s.RotationYawPitchRollToRef(t,n,r,l),c.multiplyToRef(l,l),this._rotateWithMatrix(l,i,o)}rotate(t,n,r=0,i){let a=e._TmpMats[0];a.setTranslationFromFloats(0,0,0),s.RotationAxisToRef(t,n,a),this._rotateWithMatrix(a,r,i)}setAxisAngle(t,n,r=0,i){if(r===0){let o=e._TmpQuat;a.RotationAxisToRef(t,n,o),this.setRotationQuaternion(o,r,i);return}let o=e._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(o,i))return;let c=e._TmpMats[1];s.RotationAxisToRef(t,n,c),o.multiplyToRef(c,c),this._rotateWithMatrix(c,r,i)}setRotation(e,t=0,n){this.setYawPitchRoll(e.y,e.x,e.z,t,n)}setRotationQuaternion(t,n=0,r){if(n===0){this._decompose(),this._localRotation.copyFrom(t),this._markAsDirtyAndCompose();return}let i=e._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(i,r))return;let a=e._TmpMats[1];s.FromQuaternionToRef(t,a),i.multiplyToRef(a,a),this._rotateWithMatrix(a,n,r)}setRotationMatrix(t,n=0,r){if(n===0){let i=e._TmpQuat;a.FromRotationMatrixToRef(t,i),this.setRotationQuaternion(i,n,r);return}let i=e._TmpMats[0];if(!this._getAbsoluteInverseMatrixUnscaledToRef(i,r))return;let o=e._TmpMats[1];o.copyFrom(t),i.multiplyToRef(t,o),this._rotateWithMatrix(o,n,r)}_rotateWithMatrix(t,n=0,r){let i=this.getLocalMatrix(),a=i.m[12],o=i.m[13],s=i.m[14],c=this.getParent(),l=e._TmpMats[3],u=e._TmpMats[4];c&&n==1?(r?(l.copyFrom(r.getWorldMatrix()),c.getAbsoluteMatrix().multiplyToRef(l,l)):l.copyFrom(c.getAbsoluteMatrix()),u.copyFrom(l),u.invert(),i.multiplyToRef(l,i),i.multiplyToRef(t,i),i.multiplyToRef(u,i)):n==1&&r?(l.copyFrom(r.getWorldMatrix()),u.copyFrom(l),u.invert(),i.multiplyToRef(l,i),i.multiplyToRef(t,i),i.multiplyToRef(u,i)):i.multiplyToRef(t,i),i.setTranslationFromFloats(a,o,s),this._markAsDirtyAndDecompose()}_getAbsoluteInverseMatrixUnscaledToRef(t,n){let r=e._TmpMats[2];return t.copyFrom(this.getAbsoluteMatrix()),n?(t.multiplyToRef(n.getWorldMatrix(),t),s.ScalingToRef(n.scaling.x,n.scaling.y,n.scaling.z,r)):s.IdentityToRef(r),t.invert(),!isNaN(t.m[0])&&(r.multiplyAtIndex(0,this._scalingDeterminant),t.multiplyToRef(r,t),!0)}getPosition(e=0,t=null){let n=o.Zero();return this.getPositionToRef(e,t,n),n}getPositionToRef(t=0,n,r){if(t==0){let e=this.getLocalMatrix();r.x=e.m[12],r.y=e.m[13],r.z=e.m[14]}else{let t=e._TmpMats[0].copyFrom(this.getAbsoluteMatrix());n&&t.multiplyToRef(n.getWorldMatrix(),t),r.x=t.m[12],r.y=t.m[13],r.z=t.m[14]}}getAbsolutePosition(e=null){let t=o.Zero();return this.getPositionToRef(1,e,t),t}getAbsolutePositionToRef(e,t){this.getPositionToRef(1,e,t)}
1computeAbsoluteMatrices(){if(this._compose(),this.parent)this._localMatrix.multiplyToRef(this.parent._absoluteMatrix,this._absoluteMatrix);else{this._absoluteMatrix.copyFrom(this._localMatrix);let e=this._skeleton.getPoseMatrix();e&&this._absoluteMatrix.multiplyToRef(e,this._absoluteMatrix)}let e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].computeAbsoluteMatrices()}computeAbsoluteTransforms(){this.computeAbsoluteMatrices()}getDirection(e,t=null){let n=o.Zero();return this.getDirectionToRef(e,t,n),n}getDirectionToRef(t,n=null,r){let i=e._TmpMats[0].copyFrom(this.getAbsoluteMatrix());n&&i.multiplyToRef(n.getWorldMatrix(),i),o.TransformNormalToRef(t,i,r),r.normalize()}getRotation(e=0,t=null){let n=o.Zero();return this.getRotationToRef(e,t,n),n}getRotationToRef(t=0,n=null,r){let i=e._TmpQuat;this.getRotationQuaternionToRef(t,n,i),i.toEulerAnglesToRef(r)}getRotationQuaternion(e=0,t=null){let n=a.Identity();return this.getRotationQuaternionToRef(e,t,n),n}getRotationQuaternionToRef(t=0,n=null,r){if(t==0)this._decompose(),r.copyFrom(this._localRotation);else{let t=e._TmpMats[0],i=this.getAbsoluteMatrix();n?i.multiplyToRef(n.getWorldMatrix(),t):t.copyFrom(i),t.multiplyAtIndex(0,this._scalingDeterminant),t.multiplyAtIndex(1,this._scalingDeterminant),t.multiplyAtIndex(2,this._scalingDeterminant),t.decompose(void 0,r,void 0)}}getRotationMatrix(e=0,t){let n=s.Identity();return this.getRotationMatrixToRef(e,t,n),n}getRotationMatrixToRef(t=0,n,r){if(t==0)this.getLocalMatrix().getRotationMatrixToRef(r);else{let t=e._TmpMats[0],i=this.getAbsoluteMatrix();n?i.multiplyToRef(n.getWorldMatrix(),t):t.copyFrom(i),t.multiplyAtIndex(0,this._scalingDeterminant),t.multiplyAtIndex(1,this._scalingDeterminant),t.multiplyAtIndex(2,this._scalingDeterminant),t.getRotationMatrixToRef(r)}}getAbsolutePositionFromLocal(e,t=null){let n=o.Zero();return this.getAbsolutePositionFromLocalToRef(e,t,n),n}getAbsolutePositionFromLocalToRef(t,n=null,r){let i=e._TmpMats[0].copyFrom(this.getAbsoluteMatrix());n&&i.multiplyToRef(n.getWorldMatrix(),i),o.TransformCoordinatesToRef(t,i,r)}getLocalPositionFromAbsolute(e,t=null){let n=o.Zero();return this.getLocalPositionFromAbsoluteToRef(e,t,n),n}getLocalPositionFromAbsoluteToRef(t,n=null,r){let i=e._TmpMats[0].copyFrom(this.getAbsoluteMatrix());n&&i.multiplyToRef(n.getWorldMatrix(),i),i.invert(),o.TransformCoordinatesToRef(t,i,r)}setCurrentPoseAsRest(){this.setRestMatrix(this.getLocalMatrix())}dispose(){this._linkedTransformNode=null;let e=this._skeleton.bones.indexOf(this);if(e!==-1&&this._skeleton.bones.splice(e,1),this._parentNode&&this._parentNode.children){let e=this._parentNode.children,t=e.indexOf(this);t!==-1&&e.splice(t,1)}super.dispose()}};A._TmpVecs=c(2,o.Zero),A._TmpQuat=a.Identity(),A._TmpMats=c(5,s.Identity),(k=A.prototype).copyAnimationRange??(k.copyAnimationRange=u(`Bone`,`copyAnimationRange`));var j=!1;function M(){j||(j=!0,O(t,A))}var N=e({AnimationGroup:()=>F,AnimationGroupClipFrames:()=>V,AnimationGroupClipFramesInPlace:()=>H,AnimationGroupClipInPlace:()=>U,AnimationGroupClipKeys:()=>z,AnimationGroupClipKeysInPlace:()=>B,AnimationGroupMakeAnimationAdditive:()=>R,AnimationGroupMergeAnimationGroups:()=>I,AnimationGroupParse:()=>L,RegisterAnimationGroup:()=>G,TargetedAnimation:()=>P}),P=class{getClassName(){return`TargetedAnimation`}constructor(e){this.parent=e,this.uniqueId=n.UniqueId}serialize(){let e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e.targetUniqueId=this.target.uniqueId,e}},F=class e{get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this.syncWithMask(!0))}syncWithMask(e=!1){if(!this.mask&&!e){this._numActiveAnimatables=this._targetedAnimations.length;return}this._numActiveAnimatables=0;for(let e=0;e<this._animatables.length;++e){let t=this._animatables[e];!this.mask||this.mask.disabled||this.mask.retainsTarget(t.target.name)?(this._numActiveAnimatables++,t.paused&&t.restart()):t.paused||t.pause()}}removeUnmaskedAnimations(){if(this.mask&&!this.mask.disabled){for(let e=0;e<this._animatables.length;++e){let t=this._animatables[e];this.mask.retainsTarget(t.target.name)||(t.stop(),this._animatables.splice(e,1),--e)}for(let e=0;e<this._targetedAnimations.length;e++){let t=this._targetedAnimations[e];this.mask.retainsTarget(t.target.name)||(this._targetedAnimations.splice(e,1),--e)}}}get from(){return this._from}set from(e){if(this._from!==e){this._from=e;for(let e=0;e<this._animatables.length;e++){let t=this._animatables[e];t.fromFrame=this._from}}}get to(){return this._to}set to(e){if(this._to!==e){this._to=e;for(let e=0;e<this._animatables.length;e++){let t=this._animatables[e];t.toFrame=this._to}}}get isStarted(){return this._isStarted}get isPlaying(){return this._isStarted&&!this._isPaused}get speedRatio(){return this._speedRatio}set speedRatio(e){if(this._speedRatio!==e){this._speedRatio=e;for(let e=0;e<this._animatables.length;e++){let t=this._animatables[e];t.speedRatio=this._speedRatio}}}get loopAnimation(){return this._loopAnimation}set loopAnimation(e){if(this._loopAnimation!==e){this._loopAnimation=e;for(let e=0;e<this._animatables.length;e++){let t=this._animatables[e];t.loopAnimation=this._loopAnimation}}}get isAdditive(){return this._isAdditive}set isAdditive(e){if(this._isAdditive!==e){this._isAdditive=e;for(let e=0;e<this._animatables.length;e++){let t=this._animatables[e];t.isAdditive=this._isAdditive}}}get weight(){return this._weight}set weight(e){this._weight!==e&&(this._weight=e,this.setWeightForAllAnimatables(this._weight))}get targetedAnimations(){return this._targetedAnimations}get animatables(){return this._animatables}get children(){return this._targetedAnimations}get playOrder(){return this._playOrder}set playOrder(e){if(this._playOrder!==e&&(this._playOrder=e,this._animatables.length>0)){for(let e=0;e<this._animatables.length;e++)this._animatables[e].playOrder=this._playOrder;this._scene.sortActiveAnimatables()}}get enableBlending(){return this._enableBlending}set enableBlending(e){if(this._enableBlending!==e&&(this._enableBlending=e,e!==null))for(let t=0;t<this._targetedAnimations.length;++t)this._targetedAnimations[t].animation.enableBlending=e}get blendingSpeed(){return this._blendingSpeed}set blendingSpeed(e){if(this._blendingSpeed!==e&&(this._blendingSpeed=e,e!==null))for(let t=0;t<this._targetedAnimations.length;++t)this._targetedAnimations[t].animation.blendingSpeed=e}getLength(e,t){e??=this._from,t??=this._to;let n=this.targetedAnimations[0].animation.framePerSecond*this._speedRatio;return(t-e)/n}getScene(){return this._scene}constructor(e,t=null,n=-1,i=0){this.name=e,this._targetedAnimations=[],this._animatables=[],this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._weight=-1,this._playOrder=0,this._enableBlending=null,this._blendingSpeed=null,this._numActiveAnimatables=0,this._shouldStart=!0,this._parentContainer=null,this.onAnimationEndObservable=new r,this.onAnimationLoopObservable=new r,this.onAnimationGroupLoopObservable=new r,this.onAnimationGroupEndObservable=new r,this.onAnimationGroupPauseObservable=new r,this.onAnimationGroupPlayObservable=new r,this.metadata=null,this._mask=null,this._animationLoopFlags=[],this._scene=t||l.LastCreatedScene,this._weight=n,this._playOrder=i,this.uniqueId=this._scene.getUniqueId(),M(),this._scene.addAnimationGroup(this)}addTargetedAnimation(e,t){let n=new P(this);n.animation=e,n.target=t;let r=e.getKeys();return this._from>r[0].frame&&(this._from=r[0].frame),this._to<r[r.length-1].frame&&(this._to=r[r.length-1].frame),this._enableBlending!==null&&(e.enableBlending=this._enableBlending),this._blendingSpeed!==null&&(e.blendingSpeed=this._blendingSpeed),this._targetedAnimations.push(n),this._shouldStart=!0,n}removeTargetedAnimation(e){for(let t=this._targetedAnimations.length-1;t>-1;t--)this._targetedAnimations[t].animation===e&&this._targetedAnimations.splice(t,1)}normalize(e=null,t=null){e??=this._from,t??=this._to;for(let n=0;n<this._targetedAnimations.length;n++){let r=this._targetedAnimations[n].animation.getKeys(),i=r[0],a=r[r.length-1];if(i.frame>e){let t={frame:e,value:i.value,inTangent:i.inTangent,outTangent:i.outTangent,interpolation:i.interpolation};r.splice(0,0,t)}if(a.frame<t){let e={frame:t,value:a.value,inTangent:a.inTangent,outTangent:a.outTangent,interpolation:a.interpolation};r.push(e)}}return this._from=e,this._to=t,this}
1_processLoop(e,t,n){e.onAnimationLoop=()=>{this.onAnimationLoopObservable.notifyObservers(t),!this._animationLoopFlags[n]&&(this._animationLoopFlags[n]=!0,this._animationLoopCount++,this._animationLoopCount===this._numActiveAnimatables&&(this.onAnimationGroupLoopObservable.notifyObservers(this),this._animationLoopCount=0,this._animationLoopFlags.length=0))}}start(e=!1,t=1,n,r,i){if(this._isStarted||this._targetedAnimations.length===0)return this;this._loopAnimation=e,this._shouldStart=!1,this._animationLoopCount=0,this._animationLoopFlags.length=0;for(let a=0;a<this._targetedAnimations.length;a++){let o=this._targetedAnimations[a],s=this._scene.beginDirectAnimation(o.target,[o.animation],n===void 0?this._from:n,r===void 0?this._to:r,e,t,void 0,void 0,i===void 0?this._isAdditive:i);s.weight=this._weight,s.playOrder=this._playOrder,s.onAnimationEnd=()=>{this.onAnimationEndObservable.notifyObservers(o),this._checkAnimationGroupEnded(s)},this._processLoop(s,o,a),this._animatables.push(s)}return this.syncWithMask(),this._scene.sortActiveAnimatables(),this._speedRatio=t,this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this}pause(){if(!this._isStarted)return this;this._isPaused=!0;for(let e=0;e<this._animatables.length;e++)this._animatables[e].pause();return this.onAnimationGroupPauseObservable.notifyObservers(this),this}play(e){return this.isStarted&&this._animatables.length&&!this._shouldStart?(e!==void 0&&(this.loopAnimation=e),this.restart()):(this.stop(),this.start(e,this._speedRatio)),this}reset(){if(!this._isStarted)return this.play(),this.goToFrame(0),this.stop(!0),this;for(let e=0;e<this._animatables.length;e++)this._animatables[e].reset();return this}restart(){if(!this._isStarted)return this;for(let e=0;e<this._animatables.length;e++)this._animatables[e].restart();return this.syncWithMask(),this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this}stop(e=!1){if(!this._isStarted)return this;let t=this._animatables.slice();for(let n=0;n<t.length;n++)t[n].stop(void 0,void 0,!0,e);let n=0;for(let t=0;t<this._scene._activeAnimatables.length;t++){let r=this._scene._activeAnimatables[t];r._runtimeAnimations.length>0?this._scene._activeAnimatables[n++]=r:e&&this._checkAnimationGroupEnded(r,e)}return this._scene._activeAnimatables.length=n,this._isStarted=!1,this}setWeightForAllAnimatables(e){for(let t=0;t<this._animatables.length;t++){let n=this._animatables[t];n.weight=e}return this}syncAllAnimationsWith(e){for(let t=0;t<this._animatables.length;t++)this._animatables[t].syncWith(e);return this}
1goToFrame(e,t=!1){if(!this._isStarted)return this;for(let n=0;n<this._animatables.length;n++)this._animatables[n].goToFrame(e,t);return this}getCurrentFrame(){return this.animatables[0]?.masterFrame||0}dispose(){if(this.isStarted&&this.stop(),this._targetedAnimations.length=0,this._animatables.length=0,this._scene.removeAnimationGroup(this),this._parentContainer){let e=this._parentContainer.animationGroups.indexOf(this);e>-1&&this._parentContainer.animationGroups.splice(e,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()}_checkAnimationGroupEnded(e,t=!1){let n=this._animatables.indexOf(e);n>-1&&this._animatables.splice(n,1),this._animatables.length===this._targetedAnimations.length-this._numActiveAnimatables&&(this._isStarted=!1,t||this.onAnimationGroupEndObservable.notifyObservers(this),this._animatables.length=0)}clone(t,n,r=!1,i=!1){let a=new e(t||this.name,this._scene,this._weight,this._playOrder);a._from=this.from,a._to=this.to,a._speedRatio=this.speedRatio,a._loopAnimation=this.loopAnimation,a._isAdditive=this.isAdditive,a._enableBlending=this.enableBlending,a._blendingSpeed=this.blendingSpeed,a.metadata=this.metadata,a.mask=this.mask;for(let e of this._targetedAnimations)a.addTargetedAnimation(r?e.animation.clone(i):e.animation,n?n(e.target):e.target);return a}serialize(){let e={};e.name=this.name,e.from=this.from,e.to=this.to,e.speedRatio=this.speedRatio,e.loopAnimation=this.loopAnimation,e.isAdditive=this.isAdditive,e.weight=this.weight,e.playOrder=this.playOrder,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,e.targetedAnimations=[];for(let t=0;t<this.targetedAnimations.length;t++){let n=this.targetedAnimations[t];e.targetedAnimations[t]=n.serialize()}return b&&b.HasTags(this)&&(e.tags=b.GetTags(this)),this.metadata&&(e.metadata=this.metadata),e}getClassName(){return`AnimationGroup`}toString(e){let t=`Name: `+this.name;return t+=`, type: `+this.getClassName(),e&&(t+=`, from: `+this._from,t+=`, to: `+this._to,t+=`, isStarted: `+this._isStarted,t+=`, speedRatio: `+this._speedRatio,t+=`, targetedAnimations length: `+this._targetedAnimations.length,t+=`, animatables length: `+this._animatables.length),t}};function I(e,t=!0,n=!1,r){if(e.length===0)return null;r??=e[0].weight;let i=Number.MAX_VALUE,a=-Number.MAX_VALUE;if(n)for(let t of e)t.from<i&&(i=t.from),t.to>a&&(a=t.to);let o=new F(e[0].name+`_merged`,e[0].getScene(),r);for(let r of e){n&&r.normalize(i,a);for(let e of r.targetedAnimations)o.addTargetedAnimation(e.animation,e.target);t&&r.dispose()}return o}function L(e,t,n){let r=new F(e.name,t,e.weight,e.playOrder),i=r;for(let i=0;i<e.targetedAnimations.length;i++){let a=e.targetedAnimations[i],o=p(a.animation),s=n?n(a):a.animation.property===`influence`?t.getMorphTargetById(a.targetId):t.getNodeById(a.targetId);s&&r.addTargetedAnimation(o,s)}return b&&b.AddTagsTo(r,e.tags),e.from!==null&&e.to!==null&&r.normalize(e.from,e.to),e.speedRatio!==void 0&&(i._speedRatio=e.speedRatio),e.loopAnimation!==void 0&&(i._loopAnimation=e.loopAnimation),e.isAdditive!==void 0&&(i._isAdditive=e.isAdditive),e.weight!==void 0&&(i._weight=e.weight),e.playOrder!==void 0&&(i._playOrder=e.playOrder),e.enableBlending!==void 0&&(i._enableBlending=e.enableBlending),e.blendingSpeed!==void 0&&(i._blendingSpeed=e.blendingSpeed),e.metadata!==void 0&&(r.metadata=e.metadata),r}function R(e,t,n,r=!1,i){let a;a=typeof t==`object`?t:{referenceFrame:t,range:n,cloneOriginalAnimationGroup:r,clonedAnimationName:i};let o=e;a.cloneOriginalAnimationGroup&&(o=e.clone(a.clonedAnimationGroupName||o.name));let s=o.targetedAnimations;for(let e=0;e<s.length;e++){let t=s[e];t.animation=g(t.animation,a)}if(o.isAdditive=!0,a.clipKeys){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=o.targetedAnimations;for(let r=0;r<n.length;r++){let i=n[r].animation.getKeys();e>i[0].frame&&(e=i[0].frame),t<i[i.length-1].frame&&(t=i[i.length-1].frame)}let r=o;r._from=e,r._to=t}return o}function z(e,t,n,r,i){return B(e.clone(r||e.name),t,n,i)}function B(e,t,n,r){return U(e,t,n,r,!1)}function V(e,t,n,r,i){return H(e.clone(r||e.name),t,n,i)}function H(e,t,n,r){return U(e,t,n,r,!0)}function U(e,t,n,r,i=!1){let a=Number.MAX_VALUE,o=-Number.MAX_VALUE,s=e.targetedAnimations;for(let e=0;e<s.length;e++){let c=s[e],l=r?c.animation:c.animation.clone();i&&(l.createKeyForFrame(t),l.createKeyForFrame(n));let u=l.getKeys(),d=[],f=Number.MAX_VALUE;for(let e=0;e<u.length;e++){let r=u[e];if(!i&&e>=t&&e<=n||i&&r.frame>=t&&r.frame<=n){let e={frame:r.frame,value:r.value.clone?r.value.clone():r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation,lockedTangent:r.lockedTangent};f===Number.MAX_VALUE&&(f=e.frame),e.frame-=f,d.push(e)}}if(d.length===0){s.splice(e,1),e--;continue}a>d[0].frame&&(a=d[0].frame),o<d[d.length-1].frame&&(o=d[d.length-1].frame),l.setKeys(d,!0),c.animation=l}let c=e;return c._from=a,c._to=o,e}var W=!1;function G(){W||(W=!0,F.MergeAnimationGroups=I,F.Parse=L,F.MakeAnimationAdditive=R,F.ClipKeys=z,F.ClipKeysInPlace=B,F.ClipFrames=V,F.ClipFramesInPlace=H,F.ClipInPlace=U)}export{M as a,N as i,L as n,A as o,G as r,F as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.