@dcl/wearable-preview 2.10.0 → 2.10.2-22931365632.commit-accd8e4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/assets/{Preview-CJJl-SU6.js → Preview-COOIY_e7.js} +3 -3
  2. package/assets/UnityPreview-dUUhVAMC.js +1 -0
  3. package/assets/{babylon.inspector.bundle.max-BrQpwPpL.js → babylon.inspector.bundle.max-rkZvcb6W.js} +1 -1
  4. package/assets/{index-jQKeLokJ.js → index-B-zvrSa6.js} +3 -3
  5. package/assets/{useController-Df-0C_1l.js → useController-BMlq20pQ.js} +1 -1
  6. package/index.html +3 -3
  7. package/package.json +3 -3
  8. package/static-local/assets/{Preview-I1NXkGcJ.js → Preview-kQ1b4Ick.js} +3 -3
  9. package/static-local/assets/UnityPreview-Bv8im4mb.js +1 -0
  10. package/static-local/assets/{babylon.inspector.bundle.max-CT-Rq-CJ.js → babylon.inspector.bundle.max-C-uJj2QM.js} +1 -1
  11. package/static-local/assets/{index-GXzKRMEE.js → index-C9dRmbD1.js} +2 -2
  12. package/static-local/assets/{useController-C6YDfS-G.js → useController-BForzO16.js} +1 -1
  13. package/static-local/index.html +1 -1
  14. package/static-local/package.json +1 -1
  15. package/static-local/unity/Build/aang-renderer.data.br +0 -0
  16. package/static-local/unity/Build/aang-renderer.framework.js.br +0 -0
  17. package/static-local/unity/Build/aang-renderer.loader.js +1 -1
  18. package/static-local/unity/Build/aang-renderer.symbols.json.br +0 -0
  19. package/static-local/unity/Build/aang-renderer.wasm.br +0 -0
  20. package/unity/Build/aang-renderer.data.br +0 -0
  21. package/unity/Build/aang-renderer.framework.js.br +0 -0
  22. package/unity/Build/aang-renderer.loader.js +1 -1
  23. package/unity/Build/aang-renderer.symbols.json.br +0 -0
  24. package/unity/Build/aang-renderer.wasm.br +0 -0
  25. package/assets/UnityPreview-DexrBcxx.js +0 -1
  26. package/static-local/assets/UnityPreview-CMssK4TV.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/babylon.inspector.bundle.max-BrQpwPpL.js","assets/index-jQKeLokJ.js","assets/index-xcSM2Xhy.css"])))=>i.map(i=>d[i]);
2
- import{r as Ri,a as fo,_ as nd,R as od,j as oa}from"./index-jQKeLokJ.js";import{u as ad,q as sd,g as ld,c as Yf,r as ud,d as Te,i as Kf,t as fd,v as Ba,w as Gl,x as zl,m as hd,y as cd,z as dd,A as vu,p as Sn,j as pd,k as _d,n as gd,o as ts}from"./useController-Df-0C_1l.js";const pa={};function is(n,t){return t===pa[n]}function vd(n,t,e=[]){const[i,r]=Ri.useState(!1),[o,a]=Ri.useState(null),[s,l]=Ri.useState("");return typeof pa[n]>"u"&&(pa[n]=0),Ri.useEffect(()=>{const u=++pa[n];r(!0),t().then(f=>{is(n,u)&&a(f)}).catch(f=>{fo(f,{phase:"useAsync",id:n}),is(n,u)&&l(f.message)}).finally(()=>{is(n,u)&&r(!1)})},e),[o,i,s]}function md(){const{options:n}=ad(),[t,e,i]=vd("useConfig",()=>sd(n),[n]);return[t,e,i]}var Yt=function(){function n(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}return n.AddParser=function(t,e){this._BabylonFileParsers[t]=e},n.GetParser=function(t){return this._BabylonFileParsers[t]?this._BabylonFileParsers[t]:null},n.AddIndividualParser=function(t,e){this._IndividualBabylonFileParsers[t]=e},n.GetIndividualParser=function(t){return this._IndividualBabylonFileParsers[t]?this._IndividualBabylonFileParsers[t]:null},n.Parse=function(t,e,i,r){for(var o in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(o)&&this._BabylonFileParsers[o](t,e,i,r)},Object.defineProperty(n.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(t){this._environmentTexture=t},enumerable:!1,configurable:!0}),n.prototype.getNodes=function(){var t=new Array;return t=t.concat(this.meshes),t=t.concat(this.lights),t=t.concat(this.cameras),t=t.concat(this.transformNodes),this.skeletons.forEach(function(e){return t=t.concat(e.bones)}),t},n._BabylonFileParsers={},n._IndividualBabylonFileParsers={},n}(),Yn=function(){function n(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(n,"HasTriggers",{get:function(){for(var t in n.Triggers)if(n.Triggers.hasOwnProperty(t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(n,"HasPickTriggers",{get:function(){for(var t in n.Triggers)if(n.Triggers.hasOwnProperty(t)){var e=parseInt(t);if(e>=1&&e<=7)return!0}return!1},enumerable:!1,configurable:!0}),n.HasSpecificTrigger=function(t){for(var e in n.Triggers)if(n.Triggers.hasOwnProperty(e)){var i=parseInt(e);if(i===t)return!0}return!1},n.Triggers={},n}(),yd=function(){function n(t,e,i,r){e===void 0&&(e=!1),this.initalize(t,e,i,r)}return n.prototype.initalize=function(t,e,i,r){return e===void 0&&(e=!1),this.mask=t,this.skipNextObservers=e,this.target=i,this.currentTarget=r,this},n}(),bd=function(){function n(t,e,i){i===void 0&&(i=null),this.callback=t,this.mask=e,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}return n}(),Mx=function(){function n(){}return n.prototype.dispose=function(){if(this._observers&&this._observables)for(var t=0;t<this._observers.length;t++)this._observables[t].remove(this._observers[t]);this._observers=null,this._observables=null},n.Watch=function(t,e,i,r){i===void 0&&(i=-1),r===void 0&&(r=null);var o=new n;o._observers=new Array,o._observables=t;for(var a=0,s=t;a<s.length;a++){var l=s[a],u=l.add(e,i,!1,r);u&&o._observers.push(u)}return o},n}(),F=function(){function n(t){this._observers=new Array,this._eventState=new yd(0),t&&(this._onObserverAdded=t)}return Object.defineProperty(n.prototype,"observers",{get:function(){return this._observers},enumerable:!1,configurable:!0}),n.prototype.add=function(t,e,i,r,o){if(e===void 0&&(e=-1),i===void 0&&(i=!1),r===void 0&&(r=null),o===void 0&&(o=!1),!t)return null;var a=new bd(t,e,r);return a.unregisterOnNextCall=o,i?this._observers.unshift(a):this._observers.push(a),this._onObserverAdded&&this._onObserverAdded(a),a},n.prototype.addOnce=function(t){return this.add(t,void 0,void 0,void 0,!0)},n.prototype.remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._deferUnregister(t),!0):!1},n.prototype.removeCallback=function(t,e){for(var i=0;i<this._observers.length;i++){var r=this._observers[i];if(!r._willBeUnregistered&&r.callback===t&&(!e||e===r.scope))return this._deferUnregister(r),!0}return!1},n.prototype._deferUnregister=function(t){var e=this;t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,setTimeout(function(){e._remove(t)},0)},n.prototype._remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._observers.splice(e,1),!0):!1},n.prototype.makeObserverTopPriority=function(t){this._remove(t),this._observers.unshift(t)},n.prototype.makeObserverBottomPriority=function(t){this._remove(t),this._observers.push(t)},n.prototype.notifyObservers=function(t,e,i,r,o){if(e===void 0&&(e=-1),!this._observers.length)return!0;var a=this._eventState;a.mask=e,a.target=i,a.currentTarget=r,a.skipNextObservers=!1,a.lastReturnValue=t,a.userInfo=o;for(var s=0,l=this._observers;s<l.length;s++){var u=l[s];if(!u._willBeUnregistered&&(u.mask&e&&(u.scope?a.lastReturnValue=u.callback.apply(u.scope,[t,a]):a.lastReturnValue=u.callback(t,a),u.unregisterOnNextCall&&this._deferUnregister(u)),a.skipNextObservers))return!1}return!0},n.prototype.notifyObserversWithPromise=function(t,e,i,r,o){var a=this;e===void 0&&(e=-1);var s=Promise.resolve(t);if(!this._observers.length)return s;var l=this._eventState;return l.mask=e,l.target=i,l.currentTarget=r,l.skipNextObservers=!1,l.userInfo=o,this._observers.forEach(function(u){l.skipNextObservers||u._willBeUnregistered||u.mask&e&&(u.scope?s=s.then(function(f){return l.lastReturnValue=f,u.callback.apply(u.scope,[t,l])}):s=s.then(function(f){return l.lastReturnValue=f,u.callback(t,l)}),u.unregisterOnNextCall&&a._deferUnregister(u))}),s.then(function(){return t})},n.prototype.notifyObserver=function(t,e,i){i===void 0&&(i=-1);var r=this._eventState;r.mask=i,r.skipNextObservers=!1,t.callback(e,r)},n.prototype.hasObservers=function(){return this._observers.length>0},n.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},n.prototype.clone=function(){var t=new n;return t._observers=this._observers.slice(0),t},n.prototype.hasSpecificMask=function(t){t===void 0&&(t=-1);for(var e=0,i=this._observers;e<i.length;e++){var r=i[e];if(r.mask&t||r.mask===t)return!0}return!1},n}(),de=function(){function n(){}return n.WithinEpsilon=function(t,e,i){i===void 0&&(i=1401298e-51);var r=t-e;return-i<=r&&r<=i},n.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},n.Sign=function(t){return t=+t,t===0||isNaN(t)?t:t>0?1:-1},n.Clamp=function(t,e,i){return e===void 0&&(e=0),i===void 0&&(i=1),Math.min(i,Math.max(e,t))},n.Log2=function(t){return Math.log(t)*Math.LOG2E},n.Repeat=function(t,e){return t-Math.floor(t/e)*e},n.Normalize=function(t,e,i){return(t-e)/(i-e)},n.Denormalize=function(t,e,i){return t*(i-e)+e},n.DeltaAngle=function(t,e){var i=n.Repeat(e-t,360);return i>180&&(i-=360),i},n.PingPong=function(t,e){var i=n.Repeat(t,e*2);return e-Math.abs(i-e)},n.SmoothStep=function(t,e,i){var r=n.Clamp(i);return r=-2*r*r*r+3*r*r,e*r+t*(1-r)},n.MoveTowards=function(t,e,i){var r=0;return Math.abs(e-t)<=i?r=e:r=t+n.Sign(e-t)*i,r},n.MoveTowardsAngle=function(t,e,i){var r=n.DeltaAngle(t,e),o=0;return-i<r&&r<i?o=e:(e=t+r,o=n.MoveTowards(t,e,i)),o},n.Lerp=function(t,e,i){return t+(e-t)*i},n.LerpAngle=function(t,e,i){var r=n.Repeat(e-t,360);return r>180&&(r-=360),t+r*n.Clamp(i)},n.InverseLerp=function(t,e,i){var r=0;return t!=e?r=n.Clamp((i-t)/(e-t)):r=0,r},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a;return t*l+i*u+e*f+r*h},n.RandomRange=function(t,e){return t===e?t:Math.random()*(e-t)+t},n.RangeToPercent=function(t,e,i){return(t-e)/(i-e)},n.PercentToRange=function(t,e,i){return(i-e)*t+e},n.NormalizeRadians=function(t){return t-=n.TwoPi*Math.floor((t+Math.PI)/n.TwoPi),t},n.TwoPi=Math.PI*2,n}(),wr=1/2.2,nn=2.2,ft=.001,Zt=function(){function n(){}return n.BuildArray=function(t,e){for(var i=[],r=0;r<t;++r)i.push(e());return i},n}(),oe=function(){function n(){}return n.GetClass=function(t){return this.RegisteredTypes&&this.RegisteredTypes[t]?this.RegisteredTypes[t]:null},n.RegisteredTypes={},n}(),hn=function(){function n(){}return n.SetMatrixPrecision=function(t){if(n.MatrixTrackPrecisionChange=!1,t&&!n.MatrixUse64Bits&&n.MatrixTrackedMatrices)for(var e=0;e<n.MatrixTrackedMatrices.length;++e){var i=n.MatrixTrackedMatrices[e],r=i._m;i._m=new Array(16);for(var o=0;o<16;++o)i._m[o]=r[o]}n.MatrixUse64Bits=t,n.MatrixCurrentType=n.MatrixUse64Bits?Array:Float32Array,n.MatrixTrackedMatrices=null},n.MatrixUse64Bits=!1,n.MatrixTrackPrecisionChange=!0,n.MatrixCurrentType=Float32Array,n.MatrixTrackedMatrices=[],n}(),le=function(){function n(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=t,this.y=e}return n.prototype.toString=function(){return"{X: "+this.x+" Y: "+this.y+"}"},n.prototype.getClassName=function(){return"Vector2"},n.prototype.getHashCode=function(){var t=this.x|0;return t=t*397^(this.y|0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.copyFromFloats=function(t,e){return this.x=t,this.y=e,this},n.prototype.set=function(t,e){return this.copyFromFloats(t,e)},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.addToRef=function(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,this},n.prototype.addInPlace=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addVector3=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y)},n.prototype.subtractToRef=function(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,this},n.prototype.subtractInPlace=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.multiplyInPlace=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiply=function(t){return new n(this.x*t.x,this.y*t.y)},n.prototype.multiplyToRef=function(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,this},n.prototype.multiplyByFloats=function(t,e){return new n(this.x*t,this.y*e)},n.prototype.divide=function(t){return new n(this.x/t.x,this.y/t.y)},n.prototype.divideToRef=function(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,this},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.negate=function(){return new n(-this.x,-this.y)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this.x*-1,this.y*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this},n.prototype.scale=function(t){var e=new n(0,0);return this.scaleToRef(t,e),e},n.prototype.scaleToRef=function(t,e){return e.x=this.x*t,e.y=this.y*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this.x*t,e.y+=this.y*t,this},n.prototype.equals=function(t){return t&&this.x===t.x&&this.y===t.y},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this.x,t.x,e)&&de.WithinEpsilon(this.y,t.y,e)},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y))},n.prototype.fract=function(){return new n(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},n.prototype.normalize=function(){var t=this.length();return t===0?this:(this.x/=t,this.y/=t,this)},n.prototype.clone=function(){return new n(this.x,this.y)},n.Zero=function(){return new n(0,0)},n.One=function(){return new n(1,1)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1]},n.CatmullRom=function(t,e,i,r,o){var a=o*o,s=o*a,l=.5*(2*e.x+(-t.x+i.x)*o+(2*t.x-5*e.x+4*i.x-r.x)*a+(-t.x+3*e.x-3*i.x+r.x)*s),u=.5*(2*e.y+(-t.y+i.y)*o+(2*t.y-5*e.y+4*i.y-r.y)*a+(-t.y+3*e.y-3*i.y+r.y)*s);return new n(l,u)},n.Clamp=function(t,e,i){var r=t.x;r=r>i.x?i.x:r,r=r<e.x?e.x:r;var o=t.y;return o=o>i.y?i.y:o,o=o<e.y?e.y:o,new n(r,o)},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t.x*l+i.x*u+e.x*f+r.x*h,d=t.y*l+i.y*u+e.y*f+r.y*h;return new n(c,d)},n.Lerp=function(t,e,i){var r=t.x+(e.x-t.x)*i,o=t.y+(e.y-t.y)*i;return new n(r,o)},n.Dot=function(t,e){return t.x*e.x+t.y*e.y},n.Normalize=function(t){var e=t.clone();return e.normalize(),e},n.Minimize=function(t,e){var i=t.x<e.x?t.x:e.x,r=t.y<e.y?t.y:e.y;return new n(i,r)},n.Maximize=function(t,e){var i=t.x>e.x?t.x:e.x,r=t.y>e.y?t.y:e.y;return new n(i,r)},n.Transform=function(t,e){var i=n.Zero();return n.TransformToRef(t,e,i),i},n.TransformToRef=function(t,e,i){var r=e.m,o=t.x*r[0]+t.y*r[4]+r[12],a=t.x*r[1]+t.y*r[5]+r[13];i.x=o,i.y=a},n.PointInTriangle=function(t,e,i,r){var o=.5*(-i.y*r.x+e.y*(-i.x+r.x)+e.x*(i.y-r.y)+i.x*r.y),a=o<0?-1:1,s=(e.y*r.x-e.x*r.y+(r.y-e.y)*t.x+(e.x-r.x)*t.y)*a,l=(e.x*i.y-e.y*i.x+(e.y-i.y)*t.x+(i.x-e.x)*t.y)*a;return s>0&&l>0&&s+l<2*o*a},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t.x-e.x,r=t.y-e.y;return i*i+r*r},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.DistanceOfPointFromSegment=function(t,e,i){var r=n.DistanceSquared(e,i);if(r===0)return n.Distance(t,e);var o=i.subtract(e),a=Math.max(0,Math.min(1,n.Dot(t.subtract(e),o)/r)),s=e.add(o.multiplyByFloats(a,a));return n.Distance(t,s)},n}(),g=function(){function n(t,e,i){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),this._isDirty=!0,this._x=t,this._y=e,this._z=i}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._isDirty=!0},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+"}"},n.prototype.getClassName=function(){return"Vector3"},n.prototype.getHashCode=function(){var t=this._x|0;return t=t*397^(this._y|0),t=t*397^(this._z|0),t},n.prototype.asArray=function(){var t=[];return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.toQuaternion=function(){return ae.RotationYawPitchRoll(this._y,this._x,this._z)},n.prototype.addInPlace=function(t){return this.addInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.addInPlaceFromFloats=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},n.prototype.add=function(t){return new n(this._x+t._x,this._y+t._y,this._z+t._z)},n.prototype.addToRef=function(t,e){return e.copyFromFloats(this._x+t._x,this._y+t._y,this._z+t._z)},n.prototype.subtractInPlace=function(t){return this.x-=t._x,this.y-=t._y,this.z-=t._z,this},n.prototype.subtract=function(t){return new n(this._x-t._x,this._y-t._y,this._z-t._z)},n.prototype.subtractToRef=function(t,e){return this.subtractFromFloatsToRef(t._x,t._y,t._z,e)},n.prototype.subtractFromFloats=function(t,e,i){return new n(this._x-t,this._y-e,this._z-i)},n.prototype.subtractFromFloatsToRef=function(t,e,i,r){return r.copyFromFloats(this._x-t,this._y-e,this._z-i)},n.prototype.negate=function(){return new n(-this._x,-this._y,-this._z)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this._x*-1,this._y*-1,this._z*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.scale=function(t){return new n(this._x*t,this._y*t,this._z*t)},n.prototype.scaleToRef=function(t,e){return e.copyFromFloats(this._x*t,this._y*t,this._z*t)},n.prototype.scaleAndAddToRef=function(t,e){return e.addInPlaceFromFloats(this._x*t,this._y*t,this._z*t)},n.prototype.projectOnPlane=function(t,e){var i=n.Zero();return this.projectOnPlaneToRef(t,e,i),i},n.prototype.projectOnPlaneToRef=function(t,e,i){var r=t.normal,o=t.d,a=lt.Vector3[0];this.subtractToRef(e,a),a.normalize();var s=n.Dot(a,r),l=-(n.Dot(e,r)+o)/s,u=a.scaleInPlace(l);e.addToRef(u,i)},n.prototype.equals=function(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this._x,t._x,e)&&de.WithinEpsilon(this._y,t._y,e)&&de.WithinEpsilon(this._z,t._z,e)},n.prototype.equalsToFloats=function(t,e,i){return this._x===t&&this._y===e&&this._z===i},n.prototype.multiplyInPlace=function(t){return this.x*=t._x,this.y*=t._y,this.z*=t._z,this},n.prototype.multiply=function(t){return this.multiplyByFloats(t._x,t._y,t._z)},n.prototype.multiplyToRef=function(t,e){return e.copyFromFloats(this._x*t._x,this._y*t._y,this._z*t._z)},n.prototype.multiplyByFloats=function(t,e,i){return new n(this._x*t,this._y*e,this._z*i)},n.prototype.divide=function(t){return new n(this._x/t._x,this._y/t._y,this._z/t._z)},n.prototype.divideToRef=function(t,e){return e.copyFromFloats(this._x/t._x,this._y/t._y,this._z/t._z)},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.minimizeInPlace=function(t){return this.minimizeInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.maximizeInPlace=function(t){return this.maximizeInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.minimizeInPlaceFromFloats=function(t,e,i){return t<this._x&&(this.x=t),e<this._y&&(this.y=e),i<this._z&&(this.z=i),this},n.prototype.maximizeInPlaceFromFloats=function(t,e,i){return t>this._x&&(this.x=t),e>this._y&&(this.y=e),i>this._z&&(this.z=i),this},n.prototype.isNonUniformWithinEpsilon=function(t){var e=Math.abs(this._x),i=Math.abs(this._y);if(!de.WithinEpsilon(e,i,t))return!0;var r=Math.abs(this._z);return!de.WithinEpsilon(e,r,t)||!de.WithinEpsilon(i,r,t)},Object.defineProperty(n.prototype,"isNonUniform",{get:function(){var t=Math.abs(this._x),e=Math.abs(this._y);if(t!==e)return!0;var i=Math.abs(this._z);return t!==i},enumerable:!1,configurable:!0}),n.prototype.floor=function(){return new n(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},n.prototype.fract=function(){return new n(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},n.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},n.prototype.normalize=function(){return this.normalizeFromLength(this.length())},n.prototype.reorderInPlace=function(t){var e=this;return t=t.toLowerCase(),t==="xyz"?this:(lt.Vector3[0].copyFrom(this),["x","y","z"].forEach(function(i,r){e[i]=lt.Vector3[0][t[r]]}),this)},n.prototype.rotateByQuaternionToRef=function(t,e){return t.toRotationMatrix(lt.Matrix[0]),n.TransformCoordinatesToRef(this,lt.Matrix[0],e),e},n.prototype.rotateByQuaternionAroundPointToRef=function(t,e,i){return this.subtractToRef(e,lt.Vector3[0]),lt.Vector3[0].rotateByQuaternionToRef(t,lt.Vector3[0]),e.addToRef(lt.Vector3[0],i),i},n.prototype.cross=function(t){return n.Cross(this,t)},n.prototype.normalizeFromLength=function(t){return t===0||t===1?this:this.scaleInPlace(1/t)},n.prototype.normalizeToNew=function(){var t=new n(0,0,0);return this.normalizeToRef(t),t},n.prototype.normalizeToRef=function(t){var e=this.length();return e===0||e===1?t.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/e,t)},n.prototype.clone=function(){return new n(this._x,this._y,this._z)},n.prototype.copyFrom=function(t){return this.copyFromFloats(t._x,t._y,t._z)},n.prototype.copyFromFloats=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},n.prototype.set=function(t,e,i){return this.copyFromFloats(t,e,i)},n.prototype.setAll=function(t){return this.x=this.y=this.z=t,this},n.GetClipFactor=function(t,e,i,r){var o=n.Dot(t,i)-r,a=n.Dot(e,i)-r,s=o/(o-a);return s},n.GetAngleBetweenVectors=function(t,e,i){var r=t.normalizeToRef(lt.Vector3[1]),o=e.normalizeToRef(lt.Vector3[2]),a=n.Dot(r,o),s=lt.Vector3[3];return n.CrossToRef(r,o,s),n.Dot(s,i)>0?Math.acos(a):-Math.acos(a)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2])},n.FromFloatArray=function(t,e){return n.FromArray(t,e)},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2]},n.FromFloatArrayToRef=function(t,e,i){return n.FromArrayToRef(t,e,i)},n.FromFloatsToRef=function(t,e,i,r){r.copyFromFloats(t,e,i)},n.Zero=function(){return new n(0,0,0)},n.One=function(){return new n(1,1,1)},n.Up=function(){return new n(0,1,0)},Object.defineProperty(n,"UpReadOnly",{get:function(){return n._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(n,"ZeroReadOnly",{get:function(){return n._ZeroReadOnly},enumerable:!1,configurable:!0}),n.Down=function(){return new n(0,-1,0)},n.Forward=function(t){return t===void 0&&(t=!1),new n(0,0,t?-1:1)},n.Backward=function(t){return t===void 0&&(t=!1),new n(0,0,t?1:-1)},n.Right=function(){return new n(1,0,0)},n.Left=function(){return new n(-1,0,0)},n.TransformCoordinates=function(t,e){var i=n.Zero();return n.TransformCoordinatesToRef(t,e,i),i},n.TransformCoordinatesToRef=function(t,e,i){n.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,e,i)},n.TransformCoordinatesFromFloatsToRef=function(t,e,i,r,o){var a=r.m,s=t*a[0]+e*a[4]+i*a[8]+a[12],l=t*a[1]+e*a[5]+i*a[9]+a[13],u=t*a[2]+e*a[6]+i*a[10]+a[14],f=1/(t*a[3]+e*a[7]+i*a[11]+a[15]);o.x=s*f,o.y=l*f,o.z=u*f},n.TransformNormal=function(t,e){var i=n.Zero();return n.TransformNormalToRef(t,e,i),i},n.TransformNormalToRef=function(t,e,i){this.TransformNormalFromFloatsToRef(t._x,t._y,t._z,e,i)},n.TransformNormalFromFloatsToRef=function(t,e,i,r,o){var a=r.m;o.x=t*a[0]+e*a[4]+i*a[8],o.y=t*a[1]+e*a[5]+i*a[9],o.z=t*a[2]+e*a[6]+i*a[10]},n.CatmullRom=function(t,e,i,r,o){var a=o*o,s=o*a,l=.5*(2*e._x+(-t._x+i._x)*o+(2*t._x-5*e._x+4*i._x-r._x)*a+(-t._x+3*e._x-3*i._x+r._x)*s),u=.5*(2*e._y+(-t._y+i._y)*o+(2*t._y-5*e._y+4*i._y-r._y)*a+(-t._y+3*e._y-3*i._y+r._y)*s),f=.5*(2*e._z+(-t._z+i._z)*o+(2*t._z-5*e._z+4*i._z-r._z)*a+(-t._z+3*e._z-3*i._z+r._z)*s);return new n(l,u,f)},n.Clamp=function(t,e,i){var r=new n;return n.ClampToRef(t,e,i,r),r},n.ClampToRef=function(t,e,i,r){var o=t._x;o=o>i._x?i._x:o,o=o<e._x?e._x:o;var a=t._y;a=a>i._y?i._y:a,a=a<e._y?e._y:a;var s=t._z;s=s>i._z?i._z:s,s=s<e._z?e._z:s,r.copyFromFloats(o,a,s)},n.CheckExtends=function(t,e,i){e.minimizeInPlace(t),i.maximizeInPlace(t)},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t._x*l+i._x*u+e._x*f+r._x*h,d=t._y*l+i._y*u+e._y*f+r._y*h,p=t._z*l+i._z*u+e._z*f+r._z*h;return new n(c,d,p)},n.Lerp=function(t,e,i){var r=new n(0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.x=t._x+(e._x-t._x)*i,r.y=t._y+(e._y-t._y)*i,r.z=t._z+(e._z-t._z)*i},n.Dot=function(t,e){return t._x*e._x+t._y*e._y+t._z*e._z},n.Cross=function(t,e){var i=n.Zero();return n.CrossToRef(t,e,i),i},n.CrossToRef=function(t,e,i){var r=t._y*e._z-t._z*e._y,o=t._z*e._x-t._x*e._z,a=t._x*e._y-t._y*e._x;i.copyFromFloats(r,o,a)},n.Normalize=function(t){var e=n.Zero();return n.NormalizeToRef(t,e),e},n.NormalizeToRef=function(t,e){t.normalizeToRef(e)},n.Project=function(t,e,i,r){var o=new n;return n.ProjectToRef(t,e,i,r,o),o},n.ProjectToRef=function(t,e,i,r,o){var a=r.width,s=r.height,l=r.x,u=r.y,f=lt.Matrix[1];N.FromValuesToRef(a/2,0,0,0,0,-s/2,0,0,0,0,.5,0,l+a/2,s/2+u,.5,1,f);var h=lt.Matrix[0];return e.multiplyToRef(i,h),h.multiplyToRef(f,h),n.TransformCoordinatesToRef(t,h,o),o},n._UnprojectFromInvertedMatrixToRef=function(t,e,i){n.TransformCoordinatesToRef(t,e,i);var r=e.m,o=t._x*r[3]+t._y*r[7]+t._z*r[11]+r[15];de.WithinEpsilon(o,1)&&i.scaleInPlace(1/o)},n.UnprojectFromTransform=function(t,e,i,r,o){var a=lt.Matrix[0];r.multiplyToRef(o,a),a.invert(),t.x=t._x/e*2-1,t.y=-(t._y/i*2-1);var s=new n;return n._UnprojectFromInvertedMatrixToRef(t,a,s),s},n.Unproject=function(t,e,i,r,o,a){var s=n.Zero();return n.UnprojectToRef(t,e,i,r,o,a,s),s},n.UnprojectToRef=function(t,e,i,r,o,a,s){n.UnprojectFloatsToRef(t._x,t._y,t._z,e,i,r,o,a,s)},n.UnprojectFloatsToRef=function(t,e,i,r,o,a,s,l,u){var f=lt.Matrix[0];a.multiplyToRef(s,f),f.multiplyToRef(l,f),f.invert();var h=lt.Vector3[0];h.x=t/r*2-1,h.y=-(e/o*2-1),h.z=2*i-1,n._UnprojectFromInvertedMatrixToRef(h,f,u)},n.Minimize=function(t,e){var i=t.clone();return i.minimizeInPlace(e),i},n.Maximize=function(t,e){var i=t.clone();return i.maximizeInPlace(e),i},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t._x-e._x,r=t._y-e._y,o=t._z-e._z;return i*i+r*r+o*o},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.RotationFromAxis=function(t,e,i){var r=n.Zero();return n.RotationFromAxisToRef(t,e,i,r),r},n.RotationFromAxisToRef=function(t,e,i,r){var o=lt.Quaternion[0];ae.RotationQuaternionFromAxisToRef(t,e,i,o),o.toEulerAnglesToRef(r)},n._UpReadOnly=n.Up(),n._ZeroReadOnly=n.Zero(),n}(),gt=function(){function n(t,e,i,r){this.x=t,this.y=e,this.z=i,this.w=r}return n.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},n.prototype.getClassName=function(){return"Vector4"},n.prototype.getHashCode=function(){var t=this.x|0;return t=t*397^(this.y|0),t=t*397^(this.z|0),t=t*397^(this.w|0),t},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.addInPlace=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)},n.prototype.addToRef=function(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e.w=this.w+t.w,this},n.prototype.subtractInPlace=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)},n.prototype.subtractToRef=function(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z,e.w=this.w-t.w,this},n.prototype.subtractFromFloats=function(t,e,i,r){return new n(this.x-t,this.y-e,this.z-i,this.w-r)},n.prototype.subtractFromFloatsToRef=function(t,e,i,r,o){return o.x=this.x-t,o.y=this.y-e,o.z=this.z-i,o.w=this.w-r,this},n.prototype.negate=function(){return new n(-this.x,-this.y,-this.z,-this.w)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this.x*-1,this.y*-1,this.z*-1,this.w*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},n.prototype.scale=function(t){return new n(this.x*t,this.y*t,this.z*t,this.w*t)},n.prototype.scaleToRef=function(t,e){return e.x=this.x*t,e.y=this.y*t,e.z=this.z*t,e.w=this.w*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this.x*t,e.y+=this.y*t,e.z+=this.z*t,e.w+=this.w*t,this},n.prototype.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this.x,t.x,e)&&de.WithinEpsilon(this.y,t.y,e)&&de.WithinEpsilon(this.z,t.z,e)&&de.WithinEpsilon(this.w,t.w,e)},n.prototype.equalsToFloats=function(t,e,i,r){return this.x===t&&this.y===e&&this.z===i&&this.w===r},n.prototype.multiplyInPlace=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},n.prototype.multiply=function(t){return new n(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w)},n.prototype.multiplyToRef=function(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,e.z=this.z*t.z,e.w=this.w*t.w,this},n.prototype.multiplyByFloats=function(t,e,i,r){return new n(this.x*t,this.y*e,this.z*i,this.w*r)},n.prototype.divide=function(t){return new n(this.x/t.x,this.y/t.y,this.z/t.z,this.w/t.w)},n.prototype.divideToRef=function(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,e.z=this.z/t.z,e.w=this.w/t.w,this},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.minimizeInPlace=function(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),t.w<this.w&&(this.w=t.w),this},n.prototype.maximizeInPlace=function(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},n.prototype.fract=function(){return new n(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},n.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},n.prototype.normalize=function(){var t=this.length();return t===0?this:this.scaleInPlace(1/t)},n.prototype.toVector3=function(){return new g(this.x,this.y,this.z)},n.prototype.clone=function(){return new n(this.x,this.y,this.z,this.w)},n.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.setAll=function(t){return this.x=this.y=this.z=this.w=t,this},n.FromArray=function(t,e){return e||(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2],i.w=t[e+3]},n.FromFloatArrayToRef=function(t,e,i){n.FromArrayToRef(t,e,i)},n.FromFloatsToRef=function(t,e,i,r,o){o.x=t,o.y=e,o.z=i,o.w=r},n.Zero=function(){return new n(0,0,0,0)},n.One=function(){return new n(1,1,1,1)},n.Normalize=function(t){var e=n.Zero();return n.NormalizeToRef(t,e),e},n.NormalizeToRef=function(t,e){e.copyFrom(t),e.normalize()},n.Minimize=function(t,e){var i=t.clone();return i.minimizeInPlace(e),i},n.Maximize=function(t,e){var i=t.clone();return i.maximizeInPlace(e),i},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t.x-e.x,r=t.y-e.y,o=t.z-e.z,a=t.w-e.w;return i*i+r*r+o*o+a*a},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.TransformNormal=function(t,e){var i=n.Zero();return n.TransformNormalToRef(t,e,i),i},n.TransformNormalToRef=function(t,e,i){var r=e.m,o=t.x*r[0]+t.y*r[4]+t.z*r[8],a=t.x*r[1]+t.y*r[5]+t.z*r[9],s=t.x*r[2]+t.y*r[6]+t.z*r[10];i.x=o,i.y=a,i.z=s,i.w=t.w},n.TransformNormalFromFloatsToRef=function(t,e,i,r,o,a){var s=o.m;a.x=t*s[0]+e*s[4]+i*s[8],a.y=t*s[1]+e*s[5]+i*s[9],a.z=t*s[2]+e*s[6]+i*s[10],a.w=r},n.FromVector3=function(t,e){return e===void 0&&(e=0),new n(t._x,t._y,t._z,e)},n}(),ae=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._isDirty=!0,this._x=t,this._y=e,this._z=i,this._w=r}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._isDirty=!0},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+" W:"+this._w+"}"},n.prototype.getClassName=function(){return"Quaternion"},n.prototype.getHashCode=function(){var t=this._x|0;return t=t*397^(this._y|0),t=t*397^(this._z|0),t=t*397^(this._w|0),t},n.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},n.prototype.equals=function(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z&&this._w===t._w},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this._x,t._x,e)&&de.WithinEpsilon(this._y,t._y,e)&&de.WithinEpsilon(this._z,t._z,e)&&de.WithinEpsilon(this._w,t._w,e)},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copyFrom=function(t){return this.x=t._x,this.y=t._y,this.z=t._z,this.w=t._w,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.add=function(t){return new n(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},n.prototype.addInPlace=function(t){return this._x+=t._x,this._y+=t._y,this._z+=t._z,this._w+=t._w,this},n.prototype.subtract=function(t){return new n(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},n.prototype.scale=function(t){return new n(this._x*t,this._y*t,this._z*t,this._w*t)},n.prototype.scaleToRef=function(t,e){return e.x=this._x*t,e.y=this._y*t,e.z=this._z*t,e.w=this._w*t,this},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this._x*t,e.y+=this._y*t,e.z+=this._z*t,e.w+=this._w*t,this},n.prototype.multiply=function(t){var e=new n(0,0,0,1);return this.multiplyToRef(t,e),e},n.prototype.multiplyToRef=function(t,e){var i=this._x*t._w+this._y*t._z-this._z*t._y+this._w*t._x,r=-this._x*t._z+this._y*t._w+this._z*t._x+this._w*t._y,o=this._x*t._y-this._y*t._x+this._z*t._w+this._w*t._z,a=-this._x*t._x-this._y*t._y-this._z*t._z+this._w*t._w;return e.copyFromFloats(i,r,o,a),this},n.prototype.multiplyInPlace=function(t){return this.multiplyToRef(t,this),this},n.prototype.conjugateToRef=function(t){return t.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},n.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},n.prototype.conjugate=function(){var t=new n(-this._x,-this._y,-this._z,this._w);return t},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var t=this.length();if(t===0)return this;var e=1/t;return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},n.prototype.toEulerAngles=function(t){var e=g.Zero();return this.toEulerAnglesToRef(e),e},n.prototype.toEulerAnglesToRef=function(t){var e=this._z,i=this._x,r=this._y,o=this._w,a=o*o,s=e*e,l=i*i,u=r*r,f=r*e-i*o,h=.4999999;return f<-h?(t.y=2*Math.atan2(r,o),t.x=Math.PI/2,t.z=0):f>h?(t.y=2*Math.atan2(r,o),t.x=-Math.PI/2,t.z=0):(t.z=Math.atan2(2*(i*r+e*o),-s-l+u+a),t.x=Math.asin(-2*(e*r-i*o)),t.y=Math.atan2(2*(e*i+r*o),s-l-u+a)),this},n.prototype.toRotationMatrix=function(t){return N.FromQuaternionToRef(this,t),this},n.prototype.fromRotationMatrix=function(t){return n.FromRotationMatrixToRef(t,this),this},n.FromRotationMatrix=function(t){var e=new n;return n.FromRotationMatrixToRef(t,e),e},n.FromRotationMatrixToRef=function(t,e){var i=t.m,r=i[0],o=i[4],a=i[8],s=i[1],l=i[5],u=i[9],f=i[2],h=i[6],c=i[10],d=r+l+c,p;d>0?(p=.5/Math.sqrt(d+1),e.w=.25/p,e.x=(h-u)*p,e.y=(a-f)*p,e.z=(s-o)*p):r>l&&r>c?(p=2*Math.sqrt(1+r-l-c),e.w=(h-u)/p,e.x=.25*p,e.y=(o+s)/p,e.z=(a+f)/p):l>c?(p=2*Math.sqrt(1+l-r-c),e.w=(a-f)/p,e.x=(o+s)/p,e.y=.25*p,e.z=(u+h)/p):(p=2*Math.sqrt(1+c-r-l),e.w=(s-o)/p,e.x=(a+f)/p,e.y=(u+h)/p,e.z=.25*p)},n.Dot=function(t,e){return t._x*e._x+t._y*e._y+t._z*e._z+t._w*e._w},n.AreClose=function(t,e){var i=n.Dot(t,e);return i>=0},n.Zero=function(){return new n(0,0,0,0)},n.Inverse=function(t){return new n(-t._x,-t._y,-t._z,t._w)},n.InverseToRef=function(t,e){return e.set(-t._x,-t._y,-t._z,t._w),e},n.Identity=function(){return new n(0,0,0,1)},n.IsIdentity=function(t){return t&&t._x===0&&t._y===0&&t._z===0&&t._w===1},n.RotationAxis=function(t,e){return n.RotationAxisToRef(t,e,new n)},n.RotationAxisToRef=function(t,e,i){var r=Math.sin(e/2);return t.normalize(),i.w=Math.cos(e/2),i.x=t._x*r,i.y=t._y*r,i.z=t._z*r,i},n.FromArray=function(t,e){return e||(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2],i.w=t[e+3]},n.FromEulerAngles=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(e,t,i,r),r},n.FromEulerAnglesToRef=function(t,e,i,r){return n.RotationYawPitchRollToRef(e,t,i,r),r},n.FromEulerVector=function(t){var e=new n;return n.RotationYawPitchRollToRef(t._y,t._x,t._z,e),e},n.FromEulerVectorToRef=function(t,e){return n.RotationYawPitchRollToRef(t._y,t._x,t._z,e),e},n.RotationYawPitchRoll=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(t,e,i,r),r},n.RotationYawPitchRollToRef=function(t,e,i,r){var o=i*.5,a=e*.5,s=t*.5,l=Math.sin(o),u=Math.cos(o),f=Math.sin(a),h=Math.cos(a),c=Math.sin(s),d=Math.cos(s);r.x=d*f*u+c*h*l,r.y=c*h*u-d*f*l,r.z=d*h*l-c*f*u,r.w=d*h*u+c*f*l},n.RotationAlphaBetaGamma=function(t,e,i){var r=new n;return n.RotationAlphaBetaGammaToRef(t,e,i,r),r},n.RotationAlphaBetaGammaToRef=function(t,e,i,r){var o=(i+t)*.5,a=(i-t)*.5,s=e*.5;r.x=Math.cos(a)*Math.sin(s),r.y=Math.sin(a)*Math.sin(s),r.z=Math.sin(o)*Math.cos(s),r.w=Math.cos(o)*Math.cos(s)},n.RotationQuaternionFromAxis=function(t,e,i){var r=new n(0,0,0,0);return n.RotationQuaternionFromAxisToRef(t,e,i,r),r},n.RotationQuaternionFromAxisToRef=function(t,e,i,r){var o=lt.Matrix[0];N.FromXYZAxesToRef(t.normalize(),e.normalize(),i.normalize(),o),n.FromRotationMatrixToRef(o,r)},n.Slerp=function(t,e,i){var r=n.Identity();return n.SlerpToRef(t,e,i,r),r},n.SlerpToRef=function(t,e,i,r){var o,a,s=t._x*e._x+t._y*e._y+t._z*e._z+t._w*e._w,l=!1;if(s<0&&(l=!0,s=-s),s>.999999)a=1-i,o=l?-i:i;else{var u=Math.acos(s),f=1/Math.sin(u);a=Math.sin((1-i)*u)*f,o=l?-Math.sin(i*u)*f:Math.sin(i*u)*f}r.x=a*t._x+o*e._x,r.y=a*t._y+o*e._y,r.z=a*t._z+o*e._z,r.w=a*t._w+o*e._w},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t._x*l+i._x*u+e._x*f+r._x*h,d=t._y*l+i._y*u+e._y*f+r._y*h,p=t._z*l+i._z*u+e._z*f+r._z*h,_=t._w*l+i._w*u+e._w*f+r._w*h;return new n(c,d,p,_)},n}(),N=function(){function n(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,hn.MatrixTrackPrecisionChange&&hn.MatrixTrackedMatrices.push(this),this._m=new hn.MatrixCurrentType(16),this._updateIdentityStatus(!1)}return Object.defineProperty(n,"Use64Bits",{get:function(){return hn.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),n.prototype._markAsUpdated=function(){this.updateFlag=n._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},n.prototype._updateIdentityStatus=function(t,e,i,r){e===void 0&&(e=!1),i===void 0&&(i=!1),r===void 0&&(r=!0),this.updateFlag=n._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||i,this._isIdentityDirty=this._isIdentity?!1:e,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:r},n.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var t=this._m;this._isIdentity=t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1}return this._isIdentity},n.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},n.prototype.determinant=function(){if(this._isIdentity===!0)return 1;var t=this._m,e=t[0],i=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],f=t[8],h=t[9],c=t[10],d=t[11],p=t[12],_=t[13],v=t[14],m=t[15],y=c*m-v*d,T=h*m-_*d,E=h*v-_*c,C=f*m-p*d,A=f*v-c*p,R=f*_-p*h,O=+(s*y-l*T+u*E),D=-(a*y-l*C+u*A),I=+(a*T-s*C+u*R),x=-(a*E-s*A+l*R);return e*O+i*D+r*I+o*x},n.prototype.toArray=function(){return this._m},n.prototype.asArray=function(){return this._m},n.prototype.invert=function(){return this.invertToRef(this),this},n.prototype.reset=function(){return n.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},n.prototype.add=function(t){var e=new n;return this.addToRef(t,e),e},n.prototype.addToRef=function(t,e){for(var i=this._m,r=e._m,o=t.m,a=0;a<16;a++)r[a]=i[a]+o[a];return e._markAsUpdated(),this},n.prototype.addToSelf=function(t){for(var e=this._m,i=t.m,r=0;r<16;r++)e[r]+=i[r];return this._markAsUpdated(),this},n.prototype.invertToRef=function(t){if(this._isIdentity===!0)return n.IdentityToRef(t),this;var e=this._m,i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],f=e[7],h=e[8],c=e[9],d=e[10],p=e[11],_=e[12],v=e[13],m=e[14],y=e[15],T=d*y-m*p,E=c*y-v*p,C=c*m-v*d,A=h*y-_*p,R=h*m-d*_,O=h*v-_*c,D=+(l*T-u*E+f*C),I=-(s*T-u*A+f*R),x=+(s*E-l*A+f*O),L=-(s*C-l*R+u*O),Y=i*D+r*I+o*x+a*L;if(Y===0)return t.copyFrom(this),this;var B=1/Y,z=u*y-m*f,q=l*y-v*f,J=l*m-v*u,k=s*y-_*f,j=s*m-_*u,ie=s*v-_*l,Z=u*p-d*f,fe=l*p-c*f,ve=l*d-c*u,ee=s*p-h*f,ue=s*d-h*u,re=s*c-h*l,$=-(r*T-o*E+a*C),ce=+(i*T-o*A+a*R),be=-(i*E-r*A+a*O),me=+(i*C-r*R+o*O),Re=+(r*z-o*q+a*J),we=-(i*z-o*k+a*j),Ce=+(i*q-r*k+a*ie),je=-(i*J-r*j+o*ie),Ne=-(r*Z-o*fe+a*ve),De=+(i*Z-o*ee+a*ue),Ye=-(i*fe-r*ee+a*re),_e=+(i*ve-r*ue+o*re);return n.FromValuesToRef(D*B,$*B,Re*B,Ne*B,I*B,ce*B,we*B,De*B,x*B,be*B,Ce*B,Ye*B,L*B,me*B,je*B,_e*B,t),this},n.prototype.addAtIndex=function(t,e){return this._m[t]+=e,this._markAsUpdated(),this},n.prototype.multiplyAtIndex=function(t,e){return this._m[t]*=e,this._markAsUpdated(),this},n.prototype.setTranslationFromFloats=function(t,e,i){return this._m[12]=t,this._m[13]=e,this._m[14]=i,this._markAsUpdated(),this},n.prototype.addTranslationFromFloats=function(t,e,i){return this._m[12]+=t,this._m[13]+=e,this._m[14]+=i,this._markAsUpdated(),this},n.prototype.setTranslation=function(t){return this.setTranslationFromFloats(t._x,t._y,t._z)},n.prototype.getTranslation=function(){return new g(this._m[12],this._m[13],this._m[14])},n.prototype.getTranslationToRef=function(t){return t.x=this._m[12],t.y=this._m[13],t.z=this._m[14],this},n.prototype.removeRotationAndScaling=function(){var t=this.m;return n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1),this},n.prototype.multiply=function(t){var e=new n;return this.multiplyToRef(t,e),e},n.prototype.copyFrom=function(t){t.copyToArray(this._m);var e=t;return this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this},n.prototype.copyToArray=function(t,e){e===void 0&&(e=0);var i=this._m;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],this},n.prototype.multiplyToRef=function(t,e){return this._isIdentity?(e.copyFrom(t),this):t._isIdentity?(e.copyFrom(this),this):(this.multiplyToArray(t,e._m,0),e._markAsUpdated(),this)},n.prototype.multiplyToArray=function(t,e,i){var r=this._m,o=t.m,a=r[0],s=r[1],l=r[2],u=r[3],f=r[4],h=r[5],c=r[6],d=r[7],p=r[8],_=r[9],v=r[10],m=r[11],y=r[12],T=r[13],E=r[14],C=r[15],A=o[0],R=o[1],O=o[2],D=o[3],I=o[4],x=o[5],L=o[6],Y=o[7],B=o[8],z=o[9],q=o[10],J=o[11],k=o[12],j=o[13],ie=o[14],Z=o[15];return e[i]=a*A+s*I+l*B+u*k,e[i+1]=a*R+s*x+l*z+u*j,e[i+2]=a*O+s*L+l*q+u*ie,e[i+3]=a*D+s*Y+l*J+u*Z,e[i+4]=f*A+h*I+c*B+d*k,e[i+5]=f*R+h*x+c*z+d*j,e[i+6]=f*O+h*L+c*q+d*ie,e[i+7]=f*D+h*Y+c*J+d*Z,e[i+8]=p*A+_*I+v*B+m*k,e[i+9]=p*R+_*x+v*z+m*j,e[i+10]=p*O+_*L+v*q+m*ie,e[i+11]=p*D+_*Y+v*J+m*Z,e[i+12]=y*A+T*I+E*B+C*k,e[i+13]=y*R+T*x+E*z+C*j,e[i+14]=y*O+T*L+E*q+C*ie,e[i+15]=y*D+T*Y+E*J+C*Z,this},n.prototype.equals=function(t){var e=t;if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;var i=this.m,r=e.m;return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]&&i[4]===r[4]&&i[5]===r[5]&&i[6]===r[6]&&i[7]===r[7]&&i[8]===r[8]&&i[9]===r[9]&&i[10]===r[10]&&i[11]===r[11]&&i[12]===r[12]&&i[13]===r[13]&&i[14]===r[14]&&i[15]===r[15]},n.prototype.clone=function(){var t=new n;return t.copyFrom(this),t},n.prototype.getClassName=function(){return"Matrix"},n.prototype.getHashCode=function(){for(var t=this._m[0]|0,e=1;e<16;e++)t=t*397^(this._m[e]|0);return t},n.prototype.decompose=function(t,e,i){if(this._isIdentity)return i&&i.setAll(0),t&&t.setAll(1),e&&e.copyFromFloats(0,0,0,1),!0;var r=this._m;if(i&&i.copyFromFloats(r[12],r[13],r[14]),t=t||lt.Vector3[0],t.x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),t.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),t.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(t.y*=-1),t._x===0||t._y===0||t._z===0)return e&&e.copyFromFloats(0,0,0,1),!1;if(e){var o=1/t._x,a=1/t._y,s=1/t._z;n.FromValuesToRef(r[0]*o,r[1]*o,r[2]*o,0,r[4]*a,r[5]*a,r[6]*a,0,r[8]*s,r[9]*s,r[10]*s,0,0,0,0,1,lt.Matrix[0]),ae.FromRotationMatrixToRef(lt.Matrix[0],e)}return!0},n.prototype.getRow=function(t){if(t<0||t>3)return null;var e=t*4;return new gt(this._m[e+0],this._m[e+1],this._m[e+2],this._m[e+3])},n.prototype.setRow=function(t,e){return this.setRowFromFloats(t,e.x,e.y,e.z,e.w)},n.prototype.transpose=function(){return n.Transpose(this)},n.prototype.transposeToRef=function(t){return n.TransposeToRef(this,t),this},n.prototype.setRowFromFloats=function(t,e,i,r,o){if(t<0||t>3)return this;var a=t*4;return this._m[a+0]=e,this._m[a+1]=i,this._m[a+2]=r,this._m[a+3]=o,this._markAsUpdated(),this},n.prototype.scale=function(t){var e=new n;return this.scaleToRef(t,e),e},n.prototype.scaleToRef=function(t,e){for(var i=0;i<16;i++)e._m[i]=this._m[i]*t;return e._markAsUpdated(),this},n.prototype.scaleAndAddToRef=function(t,e){for(var i=0;i<16;i++)e._m[i]+=this._m[i]*t;return e._markAsUpdated(),this},n.prototype.toNormalMatrix=function(t){var e=lt.Matrix[0];this.invertToRef(e),e.transposeToRef(t);var i=t._m;n.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,t)},n.prototype.getRotationMatrix=function(){var t=new n;return this.getRotationMatrixToRef(t),t},n.prototype.getRotationMatrixToRef=function(t){var e=lt.Vector3[0];if(!this.decompose(e))return n.IdentityToRef(t),this;var i=this._m,r=1/e._x,o=1/e._y,a=1/e._z;return n.FromValuesToRef(i[0]*r,i[1]*r,i[2]*r,0,i[4]*o,i[5]*o,i[6]*o,0,i[8]*a,i[9]*a,i[10]*a,0,0,0,0,1,t),this},n.prototype.toggleModelMatrixHandInPlace=function(){var t=this._m;t[2]*=-1,t[6]*=-1,t[8]*=-1,t[9]*=-1,t[14]*=-1,this._markAsUpdated()},n.prototype.toggleProjectionMatrixHandInPlace=function(){var t=this._m;t[8]*=-1,t[9]*=-1,t[10]*=-1,t[11]*=-1,this._markAsUpdated()},n.FromArray=function(t,e){e===void 0&&(e=0);var i=new n;return n.FromArrayToRef(t,e,i),i},n.FromArrayToRef=function(t,e,i){for(var r=0;r<16;r++)i._m[r]=t[r+e];i._markAsUpdated()},n.FromFloat32ArrayToRefScaled=function(t,e,i,r){for(var o=0;o<16;o++)r._m[o]=t[o+e]*i;r._markAsUpdated()},Object.defineProperty(n,"IdentityReadOnly",{get:function(){return n._identityReadOnly},enumerable:!1,configurable:!0}),n.FromValuesToRef=function(t,e,i,r,o,a,s,l,u,f,h,c,d,p,_,v,m){var y=m._m;y[0]=t,y[1]=e,y[2]=i,y[3]=r,y[4]=o,y[5]=a,y[6]=s,y[7]=l,y[8]=u,y[9]=f,y[10]=h,y[11]=c,y[12]=d,y[13]=p,y[14]=_,y[15]=v,m._markAsUpdated()},n.FromValues=function(t,e,i,r,o,a,s,l,u,f,h,c,d,p,_,v){var m=new n,y=m._m;return y[0]=t,y[1]=e,y[2]=i,y[3]=r,y[4]=o,y[5]=a,y[6]=s,y[7]=l,y[8]=u,y[9]=f,y[10]=h,y[11]=c,y[12]=d,y[13]=p,y[14]=_,y[15]=v,m._markAsUpdated(),m},n.Compose=function(t,e,i){var r=new n;return n.ComposeToRef(t,e,i,r),r},n.ComposeToRef=function(t,e,i,r){var o=r._m,a=e._x,s=e._y,l=e._z,u=e._w,f=a+a,h=s+s,c=l+l,d=a*f,p=a*h,_=a*c,v=s*h,m=s*c,y=l*c,T=u*f,E=u*h,C=u*c,A=t._x,R=t._y,O=t._z;o[0]=(1-(v+y))*A,o[1]=(p+C)*A,o[2]=(_-E)*A,o[3]=0,o[4]=(p-C)*R,o[5]=(1-(d+y))*R,o[6]=(m+T)*R,o[7]=0,o[8]=(_+E)*O,o[9]=(m-T)*O,o[10]=(1-(d+v))*O,o[11]=0,o[12]=i._x,o[13]=i._y,o[14]=i._z,o[15]=1,r._markAsUpdated()},n.Identity=function(){var t=n.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},n.IdentityToRef=function(t){n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},n.Zero=function(){var t=n.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},n.RotationX=function(t){var e=new n;return n.RotationXToRef(t,e),e},n.Invert=function(t){var e=new n;return t.invertToRef(e),e},n.RotationXToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(1,0,0,0,0,r,i,0,0,-i,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationY=function(t){var e=new n;return n.RotationYToRef(t,e),e},n.RotationYToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(r,0,-i,0,0,1,0,0,i,0,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationZ=function(t){var e=new n;return n.RotationZToRef(t,e),e},n.RotationZToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationAxis=function(t,e){var i=new n;return n.RotationAxisToRef(t,e,i),i},n.RotationAxisToRef=function(t,e,i){var r=Math.sin(-e),o=Math.cos(-e),a=1-o;t.normalize();var s=i._m;s[0]=t._x*t._x*a+o,s[1]=t._x*t._y*a-t._z*r,s[2]=t._x*t._z*a+t._y*r,s[3]=0,s[4]=t._y*t._x*a+t._z*r,s[5]=t._y*t._y*a+o,s[6]=t._y*t._z*a-t._x*r,s[7]=0,s[8]=t._z*t._x*a-t._y*r,s[9]=t._z*t._y*a+t._x*r,s[10]=t._z*t._z*a+o,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},n.RotationAlignToRef=function(t,e,i){var r=g.Cross(e,t),o=g.Dot(e,t),a=1/(1+o),s=i._m;s[0]=r._x*r._x*a+o,s[1]=r._y*r._x*a-r._z,s[2]=r._z*r._x*a+r._y,s[3]=0,s[4]=r._x*r._y*a+r._z,s[5]=r._y*r._y*a+o,s[6]=r._z*r._y*a-r._x,s[7]=0,s[8]=r._x*r._z*a-r._y,s[9]=r._y*r._z*a+r._x,s[10]=r._z*r._z*a+o,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},n.RotationYawPitchRoll=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(t,e,i,r),r},n.RotationYawPitchRollToRef=function(t,e,i,r){ae.RotationYawPitchRollToRef(t,e,i,lt.Quaternion[0]),lt.Quaternion[0].toRotationMatrix(r)},n.Scaling=function(t,e,i){var r=new n;return n.ScalingToRef(t,e,i,r),r},n.ScalingToRef=function(t,e,i,r){n.FromValuesToRef(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1,r),r._updateIdentityStatus(t===1&&e===1&&i===1)},n.Translation=function(t,e,i){var r=new n;return n.TranslationToRef(t,e,i,r),r},n.TranslationToRef=function(t,e,i,r){n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1,r),r._updateIdentityStatus(t===0&&e===0&&i===0)},n.Lerp=function(t,e,i){var r=new n;return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){for(var o=r._m,a=t.m,s=e.m,l=0;l<16;l++)o[l]=a[l]*(1-i)+s[l]*i;r._markAsUpdated()},n.DecomposeLerp=function(t,e,i){var r=new n;return n.DecomposeLerpToRef(t,e,i,r),r},n.DecomposeLerpToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Quaternion[0],s=lt.Vector3[1];t.decompose(o,a,s);var l=lt.Vector3[2],u=lt.Quaternion[1],f=lt.Vector3[3];e.decompose(l,u,f);var h=lt.Vector3[4];g.LerpToRef(o,l,i,h);var c=lt.Quaternion[2];ae.SlerpToRef(a,u,i,c);var d=lt.Vector3[5];g.LerpToRef(s,f,i,d),n.ComposeToRef(h,c,d,r)},n.LookAtLH=function(t,e,i){var r=new n;return n.LookAtLHToRef(t,e,i,r),r},n.LookAtLHToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Vector3[1],s=lt.Vector3[2];e.subtractToRef(t,s),s.normalize(),g.CrossToRef(i,s,o);var l=o.lengthSquared();l===0?o.x=1:o.normalizeFromLength(Math.sqrt(l)),g.CrossToRef(s,o,a),a.normalize();var u=-g.Dot(o,t),f=-g.Dot(a,t),h=-g.Dot(s,t);n.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,u,f,h,1,r)},n.LookAtRH=function(t,e,i){var r=new n;return n.LookAtRHToRef(t,e,i,r),r},n.LookAtRHToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Vector3[1],s=lt.Vector3[2];t.subtractToRef(e,s),s.normalize(),g.CrossToRef(i,s,o);var l=o.lengthSquared();l===0?o.x=1:o.normalizeFromLength(Math.sqrt(l)),g.CrossToRef(s,o,a),a.normalize();var u=-g.Dot(o,t),f=-g.Dot(a,t),h=-g.Dot(s,t);n.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,u,f,h,1,r)},n.OrthoLH=function(t,e,i,r){var o=new n;return n.OrthoLHToRef(t,e,i,r,o),o},n.OrthoLHToRef=function(t,e,i,r,o){var a=i,s=r,l=2/t,u=2/e,f=2/(s-a),h=-(s+a)/(s-a);n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,f,0,0,0,h,1,o),o._updateIdentityStatus(l===1&&u===1&&f===1&&h===0)},n.OrthoOffCenterLH=function(t,e,i,r,o,a){var s=new n;return n.OrthoOffCenterLHToRef(t,e,i,r,o,a,s),s},n.OrthoOffCenterLHToRef=function(t,e,i,r,o,a,s){var l=o,u=a,f=2/(e-t),h=2/(r-i),c=2/(u-l),d=-(u+l)/(u-l),p=(t+e)/(t-e),_=(r+i)/(i-r);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,0,p,_,d,1,s),s._markAsUpdated()},n.OrthoOffCenterRH=function(t,e,i,r,o,a){var s=new n;return n.OrthoOffCenterRHToRef(t,e,i,r,o,a,s),s},n.OrthoOffCenterRHToRef=function(t,e,i,r,o,a,s){n.OrthoOffCenterLHToRef(t,e,i,r,o,a,s),s._m[10]*=-1},n.PerspectiveLH=function(t,e,i,r){var o=new n,a=i,s=r,l=2*a/t,u=2*a/e,f=(s+a)/(s-a),h=-2*s*a/(s-a);return n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,f,1,0,0,h,0,o),o._updateIdentityStatus(!1),o},n.PerspectiveFovLH=function(t,e,i,r){var o=new n;return n.PerspectiveFovLHToRef(t,e,i,r,o),o},n.PerspectiveFovLHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=i,l=r,u=1/Math.tan(t*.5),f=a?u/e:u,h=a?u:u*e,c=(l+s)/(l-s),d=-2*l*s/(l-s);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,1,0,0,d,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovReverseLHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=1/Math.tan(t*.5),l=a?s/e:s,u=a?s:s*e;n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,-i,1,0,0,1,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovRH=function(t,e,i,r){var o=new n;return n.PerspectiveFovRHToRef(t,e,i,r,o),o},n.PerspectiveFovRHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=i,l=r,u=1/Math.tan(t*.5),f=a?u/e:u,h=a?u:u*e,c=-(l+s)/(l-s),d=-2*l*s/(l-s);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,-1,0,0,d,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovReverseRHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=1/Math.tan(t*.5),l=a?s/e:s,u=a?s:s*e;n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,-i,-1,0,0,-1,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovWebVRToRef=function(t,e,i,r,o){o===void 0&&(o=!1);var a=o?-1:1,s=Math.tan(t.upDegrees*Math.PI/180),l=Math.tan(t.downDegrees*Math.PI/180),u=Math.tan(t.leftDegrees*Math.PI/180),f=Math.tan(t.rightDegrees*Math.PI/180),h=2/(u+f),c=2/(s+l),d=r._m;d[0]=h,d[1]=d[2]=d[3]=d[4]=0,d[5]=c,d[6]=d[7]=0,d[8]=(u-f)*h*.5,d[9]=-((s-l)*c*.5),d[10]=-i/(e-i),d[11]=1*a,d[12]=d[13]=d[15]=0,d[14]=-(2*i*e)/(i-e),r._markAsUpdated()},n.GetFinalMatrix=function(t,e,i,r,o,a){var s=t.width,l=t.height,u=t.x,f=t.y,h=n.FromValues(s/2,0,0,0,0,-l/2,0,0,0,0,a-o,0,u+s/2,l/2+f,o,1),c=lt.Matrix[0];return e.multiplyToRef(i,c),c.multiplyToRef(r,c),c.multiply(h)},n.GetAsMatrix2x2=function(t){var e=t.m,i=[e[0],e[1],e[4],e[5]];return hn.MatrixUse64Bits?i:new Float32Array(i)},n.GetAsMatrix3x3=function(t){var e=t.m,i=[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]];return hn.MatrixUse64Bits?i:new Float32Array(i)},n.Transpose=function(t){var e=new n;return n.TransposeToRef(t,e),e},n.TransposeToRef=function(t,e){var i=e._m,r=t.m;i[0]=r[0],i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=r[1],i[5]=r[5],i[6]=r[9],i[7]=r[13],i[8]=r[2],i[9]=r[6],i[10]=r[10],i[11]=r[14],i[12]=r[3],i[13]=r[7],i[14]=r[11],i[15]=r[15],e._updateIdentityStatus(t._isIdentity,t._isIdentityDirty)},n.Reflection=function(t){var e=new n;return n.ReflectionToRef(t,e),e},n.ReflectionToRef=function(t,e){t.normalize();var i=t.normal.x,r=t.normal.y,o=t.normal.z,a=-2*i,s=-2*r,l=-2*o;n.FromValuesToRef(a*i+1,s*i,l*i,0,a*r,s*r+1,l*r,0,a*o,s*o,l*o+1,0,a*t.d,s*t.d,l*t.d,1,e)},n.FromXYZAxesToRef=function(t,e,i,r){n.FromValuesToRef(t._x,t._y,t._z,0,e._x,e._y,e._z,0,i._x,i._y,i._z,0,0,0,0,1,r)},n.FromQuaternionToRef=function(t,e){var i=t._x*t._x,r=t._y*t._y,o=t._z*t._z,a=t._x*t._y,s=t._z*t._w,l=t._z*t._x,u=t._y*t._w,f=t._y*t._z,h=t._x*t._w;e._m[0]=1-2*(r+o),e._m[1]=2*(a+s),e._m[2]=2*(l-u),e._m[3]=0,e._m[4]=2*(a-s),e._m[5]=1-2*(o+i),e._m[6]=2*(f+h),e._m[7]=0,e._m[8]=2*(l+u),e._m[9]=2*(f-h),e._m[10]=1-2*(r+i),e._m[11]=0,e._m[12]=0,e._m[13]=0,e._m[14]=0,e._m[15]=1,e._markAsUpdated()},n._updateFlagSeed=0,n._identityReadOnly=n.Identity(),n}(),lt=function(){function n(){}return n.Vector3=Zt.BuildArray(6,g.Zero),n.Matrix=Zt.BuildArray(2,N.Identity),n.Quaternion=Zt.BuildArray(3,ae.Zero),n}(),Q=function(){function n(){}return n.Vector2=Zt.BuildArray(3,le.Zero),n.Vector3=Zt.BuildArray(13,g.Zero),n.Vector4=Zt.BuildArray(3,gt.Zero),n.Quaternion=Zt.BuildArray(2,ae.Zero),n.Matrix=Zt.BuildArray(8,N.Identity),n}();oe.RegisteredTypes["BABYLON.Vector2"]=le;oe.RegisteredTypes["BABYLON.Vector3"]=g;oe.RegisteredTypes["BABYLON.Vector4"]=gt;oe.RegisteredTypes["BABYLON.Matrix"]=N;var K=function(){function n(t,e,i){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),this.r=t,this.g=e,this.b=i}return n.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},n.prototype.getClassName=function(){return"Color3"},n.prototype.getHashCode=function(){var t=this.r*255|0;return t=t*397^(this.g*255|0),t=t*397^(this.b*255|0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.toColor4=function(t){return t===void 0&&(t=1),new Se(this.r,this.g,this.b,t)},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toLuminance=function(){return this.r*.3+this.g*.59+this.b*.11},n.prototype.multiply=function(t){return new n(this.r*t.r,this.g*t.g,this.b*t.b)},n.prototype.multiplyToRef=function(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,this},n.prototype.equals=function(t){return t&&this.r===t.r&&this.g===t.g&&this.b===t.b},n.prototype.equalsFloats=function(t,e,i){return this.r===t&&this.g===e&&this.b===i},n.prototype.scale=function(t){return new n(this.r*t,this.g*t,this.b*t)},n.prototype.scaleToRef=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,this},n.prototype.clampToRef=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=1),i.r=de.Clamp(this.r,t,e),i.g=de.Clamp(this.g,t,e),i.b=de.Clamp(this.b,t,e),this},n.prototype.add=function(t){return new n(this.r+t.r,this.g+t.g,this.b+t.b)},n.prototype.addToRef=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,this},n.prototype.subtract=function(t){return new n(this.r-t.r,this.g-t.g,this.b-t.b)},n.prototype.subtractToRef=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,this},n.prototype.clone=function(){return new n(this.r,this.g,this.b)},n.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},n.prototype.copyFromFloats=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},n.prototype.set=function(t,e,i){return this.copyFromFloats(t,e,i)},n.prototype.toHexString=function(){var t=this.r*255|0,e=this.g*255|0,i=this.b*255|0;return"#"+de.ToHex(t)+de.ToHex(e)+de.ToHex(i)},n.prototype.toLinearSpace=function(){var t=new n;return this.toLinearSpaceToRef(t),t},n.prototype.toHSV=function(){var t=new n;return this.toHSVToRef(t),t},n.prototype.toHSVToRef=function(t){var e=this.r,i=this.g,r=this.b,o=Math.max(e,i,r),a=Math.min(e,i,r),s=0,l=0,u=o,f=o-a;o!==0&&(l=f/o),o!=a&&(o==e?(s=(i-r)/f,i<r&&(s+=6)):o==i?s=(r-e)/f+2:o==r&&(s=(e-i)/f+4),s*=60),t.r=s,t.g=l,t.b=u},n.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,nn),t.g=Math.pow(this.g,nn),t.b=Math.pow(this.b,nn),this},n.prototype.toGammaSpace=function(){var t=new n;return this.toGammaSpaceToRef(t),t},n.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,wr),t.g=Math.pow(this.g,wr),t.b=Math.pow(this.b,wr),this},n.HSVtoRGBToRef=function(t,e,i,r){var o=i*e,a=t/60,s=o*(1-Math.abs(a%2-1)),l=0,u=0,f=0;a>=0&&a<=1?(l=o,u=s):a>=1&&a<=2?(l=s,u=o):a>=2&&a<=3?(u=o,f=s):a>=3&&a<=4?(u=s,f=o):a>=4&&a<=5?(l=s,f=o):a>=5&&a<=6&&(l=o,f=s);var h=i-o;r.set(l+h,u+h,f+h)},n.FromHexString=function(t){if(t.substring(0,1)!=="#"||t.length!==7)return new n(0,0,0);var e=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return n.FromInts(e,i,r)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2])},n.FromArrayToRef=function(t,e,i){e===void 0&&(e=0),i.r=t[e],i.g=t[e+1],i.b=t[e+2]},n.FromInts=function(t,e,i){return new n(t/255,e/255,i/255)},n.Lerp=function(t,e,i){var r=new n(0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i},n.Red=function(){return new n(1,0,0)},n.Green=function(){return new n(0,1,0)},n.Blue=function(){return new n(0,0,1)},n.Black=function(){return new n(0,0,0)},Object.defineProperty(n,"BlackReadOnly",{get:function(){return n._BlackReadOnly},enumerable:!1,configurable:!0}),n.White=function(){return new n(1,1,1)},n.Purple=function(){return new n(.5,0,.5)},n.Magenta=function(){return new n(1,0,1)},n.Yellow=function(){return new n(1,1,0)},n.Gray=function(){return new n(.5,.5,.5)},n.Teal=function(){return new n(0,1,1)},n.Random=function(){return new n(Math.random(),Math.random(),Math.random())},n._BlackReadOnly=n.Black(),n}(),Se=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this.r=t,this.g=e,this.b=i,this.a=r}return n.prototype.addInPlace=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.equals=function(t){return t&&this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},n.prototype.add=function(t){return new n(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},n.prototype.subtract=function(t){return new n(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},n.prototype.subtractToRef=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,this},n.prototype.scale=function(t){return new n(this.r*t,this.g*t,this.b*t,this.a*t)},n.prototype.scaleToRef=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,e.a+=this.a*t,this},n.prototype.clampToRef=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=1),i.r=de.Clamp(this.r,t,e),i.g=de.Clamp(this.g,t,e),i.b=de.Clamp(this.b,t,e),i.a=de.Clamp(this.a,t,e),this},n.prototype.multiply=function(t){return new n(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},n.prototype.multiplyToRef=function(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,e.a=this.a*t.a,e},n.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},n.prototype.getClassName=function(){return"Color4"},n.prototype.getHashCode=function(){var t=this.r*255|0;return t=t*397^(this.g*255|0),t=t*397^(this.b*255|0),t=t*397^(this.a*255|0),t},n.prototype.clone=function(){return new n(this.r,this.g,this.b,this.a)},n.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.toHexString=function(t){t===void 0&&(t=!1);var e=this.r*255|0,i=this.g*255|0,r=this.b*255|0;if(t)return"#"+de.ToHex(e)+de.ToHex(i)+de.ToHex(r);var o=this.a*255|0;return"#"+de.ToHex(e)+de.ToHex(i)+de.ToHex(r)+de.ToHex(o)},n.prototype.toLinearSpace=function(){var t=new n;return this.toLinearSpaceToRef(t),t},n.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,nn),t.g=Math.pow(this.g,nn),t.b=Math.pow(this.b,nn),t.a=this.a,this},n.prototype.toGammaSpace=function(){var t=new n;return this.toGammaSpaceToRef(t),t},n.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,wr),t.g=Math.pow(this.g,wr),t.b=Math.pow(this.b,wr),t.a=this.a,this},n.FromHexString=function(t){if(t.substring(0,1)!=="#"||t.length!==9)return new n(0,0,0,0);var e=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return n.FromInts(e,i,r,o)},n.Lerp=function(t,e,i){var r=new n(0,0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},n.FromColor3=function(t,e){return e===void 0&&(e=1),new n(t.r,t.g,t.b,e)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){e===void 0&&(e=0),i.r=t[e],i.g=t[e+1],i.b=t[e+2],i.a=t[e+3]},n.FromInts=function(t,e,i,r){return new n(t/255,e/255,i/255,r/255)},n.CheckColors4=function(t,e){if(t.length===e*3){for(var i=[],r=0;r<t.length;r+=3){var o=r/3*4;i[o]=t[r],i[o+1]=t[r+1],i[o+2]=t[r+2],i[o+3]=1}return i}return t},n}(),st=function(){function n(){}return n.Color3=Zt.BuildArray(3,K.Black),n.Color4=Zt.BuildArray(3,function(){return new Se(0,0,0,0)}),n}();oe.RegisteredTypes["BABYLON.Color3"]=K;oe.RegisteredTypes["BABYLON.Color4"]=Se;var Tt=function(){function n(t,e){this.triggerOptions=t,this.onBeforeExecuteObservable=new F,t.parameter?(this.trigger=t.trigger,this._triggerParameter=t.parameter):t.trigger?this.trigger=t.trigger:this.trigger=t,this._nextActiveAction=this,this._condition=e}return n.prototype._prepare=function(){},n.prototype.getTriggerParameter=function(){return this._triggerParameter},n.prototype._executeCurrent=function(t){if(this._nextActiveAction._condition){var e=this._nextActiveAction._condition,i=this._actionManager.getScene().getRenderId();if(e._evaluationId===i){if(!e._currentResult)return}else{if(e._evaluationId=i,!e.isValid()){e._currentResult=!1;return}e._currentResult=!0}}this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(t),this.skipToNextActiveAction()},n.prototype.execute=function(t){},n.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},n.prototype.then=function(t){return this._child=t,t._actionManager=this._actionManager,t._prepare(),t},n.prototype._getProperty=function(t){return this._actionManager._getProperty(t)},n.prototype._getEffectiveTarget=function(t,e){return this._actionManager._getEffectiveTarget(t,e)},n.prototype.serialize=function(t){},n.prototype._serialize=function(t,e){var i={type:1,children:[],name:t.name,properties:t.properties||[]};if(this._child&&this._child.serialize(i),this._condition){var r=this._condition.serialize();return r.children.push(i),e&&e.children.push(r),r}return e&&e.children.push(i),i},n._SerializeValueAsString=function(t){return typeof t=="number"?t.toString():typeof t=="boolean"?t?"true":"false":t instanceof le?t.x+", "+t.y:t instanceof g?t.x+", "+t.y+", "+t.z:t instanceof K?t.r+", "+t.g+", "+t.b:t instanceof Se?t.r+", "+t.g+", "+t.b+", "+t.a:t},n._GetTargetProperty=function(t){return{name:"target",targetType:t._isMesh?"MeshProperties":t._isLight?"LightProperties":t._isCamera?"CameraProperties":"SceneProperties",value:t._isScene?"Scene":t.name}},n}();oe.RegisteredTypes["BABYLON.Action"]=Tt;var Ut=function(){function n(t,e,i,r,o,a){this.source=t,this.pointerX=e,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=o,this.additionalData=a}return n.CreateNew=function(t,e,i){var r=t.getScene();return new n(t,r.pointerX,r.pointerY,r.meshUnderPointer||t,e,i)},n.CreateNewFromSprite=function(t,e,i,r){return new n(t,e.pointerX,e.pointerY,e.meshUnderPointer,i,r)},n.CreateNewFromScene=function(t,e){return new n(null,t.pointerX,t.pointerY,t.meshUnderPointer,e)},n.CreateNewFromPrimitive=function(t,e,i,r){return new n(t,e.x,e.y,null,i,r)},n}();/*! *****************************************************************************
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/babylon.inspector.bundle.max-rkZvcb6W.js","assets/index-B-zvrSa6.js","assets/index-xcSM2Xhy.css"])))=>i.map(i=>d[i]);
2
+ import{r as Ri,a as fo,_ as nd,R as od,j as oa}from"./index-B-zvrSa6.js";import{u as ad,q as sd,g as ld,c as Yf,r as ud,d as Te,i as Kf,t as fd,v as Ba,w as Gl,x as zl,m as hd,y as cd,z as dd,A as vu,p as Sn,j as pd,k as _d,n as gd,o as ts}from"./useController-BMlq20pQ.js";const pa={};function is(n,t){return t===pa[n]}function vd(n,t,e=[]){const[i,r]=Ri.useState(!1),[o,a]=Ri.useState(null),[s,l]=Ri.useState("");return typeof pa[n]>"u"&&(pa[n]=0),Ri.useEffect(()=>{const u=++pa[n];r(!0),t().then(f=>{is(n,u)&&a(f)}).catch(f=>{fo(f,{phase:"useAsync",id:n}),is(n,u)&&l(f.message)}).finally(()=>{is(n,u)&&r(!1)})},e),[o,i,s]}function md(){const{options:n}=ad(),[t,e,i]=vd("useConfig",()=>sd(n),[n]);return[t,e,i]}var Yt=function(){function n(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}return n.AddParser=function(t,e){this._BabylonFileParsers[t]=e},n.GetParser=function(t){return this._BabylonFileParsers[t]?this._BabylonFileParsers[t]:null},n.AddIndividualParser=function(t,e){this._IndividualBabylonFileParsers[t]=e},n.GetIndividualParser=function(t){return this._IndividualBabylonFileParsers[t]?this._IndividualBabylonFileParsers[t]:null},n.Parse=function(t,e,i,r){for(var o in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(o)&&this._BabylonFileParsers[o](t,e,i,r)},Object.defineProperty(n.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(t){this._environmentTexture=t},enumerable:!1,configurable:!0}),n.prototype.getNodes=function(){var t=new Array;return t=t.concat(this.meshes),t=t.concat(this.lights),t=t.concat(this.cameras),t=t.concat(this.transformNodes),this.skeletons.forEach(function(e){return t=t.concat(e.bones)}),t},n._BabylonFileParsers={},n._IndividualBabylonFileParsers={},n}(),Yn=function(){function n(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(n,"HasTriggers",{get:function(){for(var t in n.Triggers)if(n.Triggers.hasOwnProperty(t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(n,"HasPickTriggers",{get:function(){for(var t in n.Triggers)if(n.Triggers.hasOwnProperty(t)){var e=parseInt(t);if(e>=1&&e<=7)return!0}return!1},enumerable:!1,configurable:!0}),n.HasSpecificTrigger=function(t){for(var e in n.Triggers)if(n.Triggers.hasOwnProperty(e)){var i=parseInt(e);if(i===t)return!0}return!1},n.Triggers={},n}(),yd=function(){function n(t,e,i,r){e===void 0&&(e=!1),this.initalize(t,e,i,r)}return n.prototype.initalize=function(t,e,i,r){return e===void 0&&(e=!1),this.mask=t,this.skipNextObservers=e,this.target=i,this.currentTarget=r,this},n}(),bd=function(){function n(t,e,i){i===void 0&&(i=null),this.callback=t,this.mask=e,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}return n}(),Mx=function(){function n(){}return n.prototype.dispose=function(){if(this._observers&&this._observables)for(var t=0;t<this._observers.length;t++)this._observables[t].remove(this._observers[t]);this._observers=null,this._observables=null},n.Watch=function(t,e,i,r){i===void 0&&(i=-1),r===void 0&&(r=null);var o=new n;o._observers=new Array,o._observables=t;for(var a=0,s=t;a<s.length;a++){var l=s[a],u=l.add(e,i,!1,r);u&&o._observers.push(u)}return o},n}(),F=function(){function n(t){this._observers=new Array,this._eventState=new yd(0),t&&(this._onObserverAdded=t)}return Object.defineProperty(n.prototype,"observers",{get:function(){return this._observers},enumerable:!1,configurable:!0}),n.prototype.add=function(t,e,i,r,o){if(e===void 0&&(e=-1),i===void 0&&(i=!1),r===void 0&&(r=null),o===void 0&&(o=!1),!t)return null;var a=new bd(t,e,r);return a.unregisterOnNextCall=o,i?this._observers.unshift(a):this._observers.push(a),this._onObserverAdded&&this._onObserverAdded(a),a},n.prototype.addOnce=function(t){return this.add(t,void 0,void 0,void 0,!0)},n.prototype.remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._deferUnregister(t),!0):!1},n.prototype.removeCallback=function(t,e){for(var i=0;i<this._observers.length;i++){var r=this._observers[i];if(!r._willBeUnregistered&&r.callback===t&&(!e||e===r.scope))return this._deferUnregister(r),!0}return!1},n.prototype._deferUnregister=function(t){var e=this;t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,setTimeout(function(){e._remove(t)},0)},n.prototype._remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._observers.splice(e,1),!0):!1},n.prototype.makeObserverTopPriority=function(t){this._remove(t),this._observers.unshift(t)},n.prototype.makeObserverBottomPriority=function(t){this._remove(t),this._observers.push(t)},n.prototype.notifyObservers=function(t,e,i,r,o){if(e===void 0&&(e=-1),!this._observers.length)return!0;var a=this._eventState;a.mask=e,a.target=i,a.currentTarget=r,a.skipNextObservers=!1,a.lastReturnValue=t,a.userInfo=o;for(var s=0,l=this._observers;s<l.length;s++){var u=l[s];if(!u._willBeUnregistered&&(u.mask&e&&(u.scope?a.lastReturnValue=u.callback.apply(u.scope,[t,a]):a.lastReturnValue=u.callback(t,a),u.unregisterOnNextCall&&this._deferUnregister(u)),a.skipNextObservers))return!1}return!0},n.prototype.notifyObserversWithPromise=function(t,e,i,r,o){var a=this;e===void 0&&(e=-1);var s=Promise.resolve(t);if(!this._observers.length)return s;var l=this._eventState;return l.mask=e,l.target=i,l.currentTarget=r,l.skipNextObservers=!1,l.userInfo=o,this._observers.forEach(function(u){l.skipNextObservers||u._willBeUnregistered||u.mask&e&&(u.scope?s=s.then(function(f){return l.lastReturnValue=f,u.callback.apply(u.scope,[t,l])}):s=s.then(function(f){return l.lastReturnValue=f,u.callback(t,l)}),u.unregisterOnNextCall&&a._deferUnregister(u))}),s.then(function(){return t})},n.prototype.notifyObserver=function(t,e,i){i===void 0&&(i=-1);var r=this._eventState;r.mask=i,r.skipNextObservers=!1,t.callback(e,r)},n.prototype.hasObservers=function(){return this._observers.length>0},n.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},n.prototype.clone=function(){var t=new n;return t._observers=this._observers.slice(0),t},n.prototype.hasSpecificMask=function(t){t===void 0&&(t=-1);for(var e=0,i=this._observers;e<i.length;e++){var r=i[e];if(r.mask&t||r.mask===t)return!0}return!1},n}(),de=function(){function n(){}return n.WithinEpsilon=function(t,e,i){i===void 0&&(i=1401298e-51);var r=t-e;return-i<=r&&r<=i},n.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},n.Sign=function(t){return t=+t,t===0||isNaN(t)?t:t>0?1:-1},n.Clamp=function(t,e,i){return e===void 0&&(e=0),i===void 0&&(i=1),Math.min(i,Math.max(e,t))},n.Log2=function(t){return Math.log(t)*Math.LOG2E},n.Repeat=function(t,e){return t-Math.floor(t/e)*e},n.Normalize=function(t,e,i){return(t-e)/(i-e)},n.Denormalize=function(t,e,i){return t*(i-e)+e},n.DeltaAngle=function(t,e){var i=n.Repeat(e-t,360);return i>180&&(i-=360),i},n.PingPong=function(t,e){var i=n.Repeat(t,e*2);return e-Math.abs(i-e)},n.SmoothStep=function(t,e,i){var r=n.Clamp(i);return r=-2*r*r*r+3*r*r,e*r+t*(1-r)},n.MoveTowards=function(t,e,i){var r=0;return Math.abs(e-t)<=i?r=e:r=t+n.Sign(e-t)*i,r},n.MoveTowardsAngle=function(t,e,i){var r=n.DeltaAngle(t,e),o=0;return-i<r&&r<i?o=e:(e=t+r,o=n.MoveTowards(t,e,i)),o},n.Lerp=function(t,e,i){return t+(e-t)*i},n.LerpAngle=function(t,e,i){var r=n.Repeat(e-t,360);return r>180&&(r-=360),t+r*n.Clamp(i)},n.InverseLerp=function(t,e,i){var r=0;return t!=e?r=n.Clamp((i-t)/(e-t)):r=0,r},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a;return t*l+i*u+e*f+r*h},n.RandomRange=function(t,e){return t===e?t:Math.random()*(e-t)+t},n.RangeToPercent=function(t,e,i){return(t-e)/(i-e)},n.PercentToRange=function(t,e,i){return(i-e)*t+e},n.NormalizeRadians=function(t){return t-=n.TwoPi*Math.floor((t+Math.PI)/n.TwoPi),t},n.TwoPi=Math.PI*2,n}(),wr=1/2.2,nn=2.2,ft=.001,Zt=function(){function n(){}return n.BuildArray=function(t,e){for(var i=[],r=0;r<t;++r)i.push(e());return i},n}(),oe=function(){function n(){}return n.GetClass=function(t){return this.RegisteredTypes&&this.RegisteredTypes[t]?this.RegisteredTypes[t]:null},n.RegisteredTypes={},n}(),hn=function(){function n(){}return n.SetMatrixPrecision=function(t){if(n.MatrixTrackPrecisionChange=!1,t&&!n.MatrixUse64Bits&&n.MatrixTrackedMatrices)for(var e=0;e<n.MatrixTrackedMatrices.length;++e){var i=n.MatrixTrackedMatrices[e],r=i._m;i._m=new Array(16);for(var o=0;o<16;++o)i._m[o]=r[o]}n.MatrixUse64Bits=t,n.MatrixCurrentType=n.MatrixUse64Bits?Array:Float32Array,n.MatrixTrackedMatrices=null},n.MatrixUse64Bits=!1,n.MatrixTrackPrecisionChange=!0,n.MatrixCurrentType=Float32Array,n.MatrixTrackedMatrices=[],n}(),le=function(){function n(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=t,this.y=e}return n.prototype.toString=function(){return"{X: "+this.x+" Y: "+this.y+"}"},n.prototype.getClassName=function(){return"Vector2"},n.prototype.getHashCode=function(){var t=this.x|0;return t=t*397^(this.y|0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.copyFromFloats=function(t,e){return this.x=t,this.y=e,this},n.prototype.set=function(t,e){return this.copyFromFloats(t,e)},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.addToRef=function(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,this},n.prototype.addInPlace=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addVector3=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y)},n.prototype.subtractToRef=function(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,this},n.prototype.subtractInPlace=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.multiplyInPlace=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiply=function(t){return new n(this.x*t.x,this.y*t.y)},n.prototype.multiplyToRef=function(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,this},n.prototype.multiplyByFloats=function(t,e){return new n(this.x*t,this.y*e)},n.prototype.divide=function(t){return new n(this.x/t.x,this.y/t.y)},n.prototype.divideToRef=function(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,this},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.negate=function(){return new n(-this.x,-this.y)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this.x*-1,this.y*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this},n.prototype.scale=function(t){var e=new n(0,0);return this.scaleToRef(t,e),e},n.prototype.scaleToRef=function(t,e){return e.x=this.x*t,e.y=this.y*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this.x*t,e.y+=this.y*t,this},n.prototype.equals=function(t){return t&&this.x===t.x&&this.y===t.y},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this.x,t.x,e)&&de.WithinEpsilon(this.y,t.y,e)},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y))},n.prototype.fract=function(){return new n(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},n.prototype.normalize=function(){var t=this.length();return t===0?this:(this.x/=t,this.y/=t,this)},n.prototype.clone=function(){return new n(this.x,this.y)},n.Zero=function(){return new n(0,0)},n.One=function(){return new n(1,1)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1]},n.CatmullRom=function(t,e,i,r,o){var a=o*o,s=o*a,l=.5*(2*e.x+(-t.x+i.x)*o+(2*t.x-5*e.x+4*i.x-r.x)*a+(-t.x+3*e.x-3*i.x+r.x)*s),u=.5*(2*e.y+(-t.y+i.y)*o+(2*t.y-5*e.y+4*i.y-r.y)*a+(-t.y+3*e.y-3*i.y+r.y)*s);return new n(l,u)},n.Clamp=function(t,e,i){var r=t.x;r=r>i.x?i.x:r,r=r<e.x?e.x:r;var o=t.y;return o=o>i.y?i.y:o,o=o<e.y?e.y:o,new n(r,o)},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t.x*l+i.x*u+e.x*f+r.x*h,d=t.y*l+i.y*u+e.y*f+r.y*h;return new n(c,d)},n.Lerp=function(t,e,i){var r=t.x+(e.x-t.x)*i,o=t.y+(e.y-t.y)*i;return new n(r,o)},n.Dot=function(t,e){return t.x*e.x+t.y*e.y},n.Normalize=function(t){var e=t.clone();return e.normalize(),e},n.Minimize=function(t,e){var i=t.x<e.x?t.x:e.x,r=t.y<e.y?t.y:e.y;return new n(i,r)},n.Maximize=function(t,e){var i=t.x>e.x?t.x:e.x,r=t.y>e.y?t.y:e.y;return new n(i,r)},n.Transform=function(t,e){var i=n.Zero();return n.TransformToRef(t,e,i),i},n.TransformToRef=function(t,e,i){var r=e.m,o=t.x*r[0]+t.y*r[4]+r[12],a=t.x*r[1]+t.y*r[5]+r[13];i.x=o,i.y=a},n.PointInTriangle=function(t,e,i,r){var o=.5*(-i.y*r.x+e.y*(-i.x+r.x)+e.x*(i.y-r.y)+i.x*r.y),a=o<0?-1:1,s=(e.y*r.x-e.x*r.y+(r.y-e.y)*t.x+(e.x-r.x)*t.y)*a,l=(e.x*i.y-e.y*i.x+(e.y-i.y)*t.x+(i.x-e.x)*t.y)*a;return s>0&&l>0&&s+l<2*o*a},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t.x-e.x,r=t.y-e.y;return i*i+r*r},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.DistanceOfPointFromSegment=function(t,e,i){var r=n.DistanceSquared(e,i);if(r===0)return n.Distance(t,e);var o=i.subtract(e),a=Math.max(0,Math.min(1,n.Dot(t.subtract(e),o)/r)),s=e.add(o.multiplyByFloats(a,a));return n.Distance(t,s)},n}(),g=function(){function n(t,e,i){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),this._isDirty=!0,this._x=t,this._y=e,this._z=i}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._isDirty=!0},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+"}"},n.prototype.getClassName=function(){return"Vector3"},n.prototype.getHashCode=function(){var t=this._x|0;return t=t*397^(this._y|0),t=t*397^(this._z|0),t},n.prototype.asArray=function(){var t=[];return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.toQuaternion=function(){return ae.RotationYawPitchRoll(this._y,this._x,this._z)},n.prototype.addInPlace=function(t){return this.addInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.addInPlaceFromFloats=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},n.prototype.add=function(t){return new n(this._x+t._x,this._y+t._y,this._z+t._z)},n.prototype.addToRef=function(t,e){return e.copyFromFloats(this._x+t._x,this._y+t._y,this._z+t._z)},n.prototype.subtractInPlace=function(t){return this.x-=t._x,this.y-=t._y,this.z-=t._z,this},n.prototype.subtract=function(t){return new n(this._x-t._x,this._y-t._y,this._z-t._z)},n.prototype.subtractToRef=function(t,e){return this.subtractFromFloatsToRef(t._x,t._y,t._z,e)},n.prototype.subtractFromFloats=function(t,e,i){return new n(this._x-t,this._y-e,this._z-i)},n.prototype.subtractFromFloatsToRef=function(t,e,i,r){return r.copyFromFloats(this._x-t,this._y-e,this._z-i)},n.prototype.negate=function(){return new n(-this._x,-this._y,-this._z)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this._x*-1,this._y*-1,this._z*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.scale=function(t){return new n(this._x*t,this._y*t,this._z*t)},n.prototype.scaleToRef=function(t,e){return e.copyFromFloats(this._x*t,this._y*t,this._z*t)},n.prototype.scaleAndAddToRef=function(t,e){return e.addInPlaceFromFloats(this._x*t,this._y*t,this._z*t)},n.prototype.projectOnPlane=function(t,e){var i=n.Zero();return this.projectOnPlaneToRef(t,e,i),i},n.prototype.projectOnPlaneToRef=function(t,e,i){var r=t.normal,o=t.d,a=lt.Vector3[0];this.subtractToRef(e,a),a.normalize();var s=n.Dot(a,r),l=-(n.Dot(e,r)+o)/s,u=a.scaleInPlace(l);e.addToRef(u,i)},n.prototype.equals=function(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this._x,t._x,e)&&de.WithinEpsilon(this._y,t._y,e)&&de.WithinEpsilon(this._z,t._z,e)},n.prototype.equalsToFloats=function(t,e,i){return this._x===t&&this._y===e&&this._z===i},n.prototype.multiplyInPlace=function(t){return this.x*=t._x,this.y*=t._y,this.z*=t._z,this},n.prototype.multiply=function(t){return this.multiplyByFloats(t._x,t._y,t._z)},n.prototype.multiplyToRef=function(t,e){return e.copyFromFloats(this._x*t._x,this._y*t._y,this._z*t._z)},n.prototype.multiplyByFloats=function(t,e,i){return new n(this._x*t,this._y*e,this._z*i)},n.prototype.divide=function(t){return new n(this._x/t._x,this._y/t._y,this._z/t._z)},n.prototype.divideToRef=function(t,e){return e.copyFromFloats(this._x/t._x,this._y/t._y,this._z/t._z)},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.minimizeInPlace=function(t){return this.minimizeInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.maximizeInPlace=function(t){return this.maximizeInPlaceFromFloats(t._x,t._y,t._z)},n.prototype.minimizeInPlaceFromFloats=function(t,e,i){return t<this._x&&(this.x=t),e<this._y&&(this.y=e),i<this._z&&(this.z=i),this},n.prototype.maximizeInPlaceFromFloats=function(t,e,i){return t>this._x&&(this.x=t),e>this._y&&(this.y=e),i>this._z&&(this.z=i),this},n.prototype.isNonUniformWithinEpsilon=function(t){var e=Math.abs(this._x),i=Math.abs(this._y);if(!de.WithinEpsilon(e,i,t))return!0;var r=Math.abs(this._z);return!de.WithinEpsilon(e,r,t)||!de.WithinEpsilon(i,r,t)},Object.defineProperty(n.prototype,"isNonUniform",{get:function(){var t=Math.abs(this._x),e=Math.abs(this._y);if(t!==e)return!0;var i=Math.abs(this._z);return t!==i},enumerable:!1,configurable:!0}),n.prototype.floor=function(){return new n(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},n.prototype.fract=function(){return new n(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},n.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},n.prototype.normalize=function(){return this.normalizeFromLength(this.length())},n.prototype.reorderInPlace=function(t){var e=this;return t=t.toLowerCase(),t==="xyz"?this:(lt.Vector3[0].copyFrom(this),["x","y","z"].forEach(function(i,r){e[i]=lt.Vector3[0][t[r]]}),this)},n.prototype.rotateByQuaternionToRef=function(t,e){return t.toRotationMatrix(lt.Matrix[0]),n.TransformCoordinatesToRef(this,lt.Matrix[0],e),e},n.prototype.rotateByQuaternionAroundPointToRef=function(t,e,i){return this.subtractToRef(e,lt.Vector3[0]),lt.Vector3[0].rotateByQuaternionToRef(t,lt.Vector3[0]),e.addToRef(lt.Vector3[0],i),i},n.prototype.cross=function(t){return n.Cross(this,t)},n.prototype.normalizeFromLength=function(t){return t===0||t===1?this:this.scaleInPlace(1/t)},n.prototype.normalizeToNew=function(){var t=new n(0,0,0);return this.normalizeToRef(t),t},n.prototype.normalizeToRef=function(t){var e=this.length();return e===0||e===1?t.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/e,t)},n.prototype.clone=function(){return new n(this._x,this._y,this._z)},n.prototype.copyFrom=function(t){return this.copyFromFloats(t._x,t._y,t._z)},n.prototype.copyFromFloats=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},n.prototype.set=function(t,e,i){return this.copyFromFloats(t,e,i)},n.prototype.setAll=function(t){return this.x=this.y=this.z=t,this},n.GetClipFactor=function(t,e,i,r){var o=n.Dot(t,i)-r,a=n.Dot(e,i)-r,s=o/(o-a);return s},n.GetAngleBetweenVectors=function(t,e,i){var r=t.normalizeToRef(lt.Vector3[1]),o=e.normalizeToRef(lt.Vector3[2]),a=n.Dot(r,o),s=lt.Vector3[3];return n.CrossToRef(r,o,s),n.Dot(s,i)>0?Math.acos(a):-Math.acos(a)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2])},n.FromFloatArray=function(t,e){return n.FromArray(t,e)},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2]},n.FromFloatArrayToRef=function(t,e,i){return n.FromArrayToRef(t,e,i)},n.FromFloatsToRef=function(t,e,i,r){r.copyFromFloats(t,e,i)},n.Zero=function(){return new n(0,0,0)},n.One=function(){return new n(1,1,1)},n.Up=function(){return new n(0,1,0)},Object.defineProperty(n,"UpReadOnly",{get:function(){return n._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(n,"ZeroReadOnly",{get:function(){return n._ZeroReadOnly},enumerable:!1,configurable:!0}),n.Down=function(){return new n(0,-1,0)},n.Forward=function(t){return t===void 0&&(t=!1),new n(0,0,t?-1:1)},n.Backward=function(t){return t===void 0&&(t=!1),new n(0,0,t?1:-1)},n.Right=function(){return new n(1,0,0)},n.Left=function(){return new n(-1,0,0)},n.TransformCoordinates=function(t,e){var i=n.Zero();return n.TransformCoordinatesToRef(t,e,i),i},n.TransformCoordinatesToRef=function(t,e,i){n.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,e,i)},n.TransformCoordinatesFromFloatsToRef=function(t,e,i,r,o){var a=r.m,s=t*a[0]+e*a[4]+i*a[8]+a[12],l=t*a[1]+e*a[5]+i*a[9]+a[13],u=t*a[2]+e*a[6]+i*a[10]+a[14],f=1/(t*a[3]+e*a[7]+i*a[11]+a[15]);o.x=s*f,o.y=l*f,o.z=u*f},n.TransformNormal=function(t,e){var i=n.Zero();return n.TransformNormalToRef(t,e,i),i},n.TransformNormalToRef=function(t,e,i){this.TransformNormalFromFloatsToRef(t._x,t._y,t._z,e,i)},n.TransformNormalFromFloatsToRef=function(t,e,i,r,o){var a=r.m;o.x=t*a[0]+e*a[4]+i*a[8],o.y=t*a[1]+e*a[5]+i*a[9],o.z=t*a[2]+e*a[6]+i*a[10]},n.CatmullRom=function(t,e,i,r,o){var a=o*o,s=o*a,l=.5*(2*e._x+(-t._x+i._x)*o+(2*t._x-5*e._x+4*i._x-r._x)*a+(-t._x+3*e._x-3*i._x+r._x)*s),u=.5*(2*e._y+(-t._y+i._y)*o+(2*t._y-5*e._y+4*i._y-r._y)*a+(-t._y+3*e._y-3*i._y+r._y)*s),f=.5*(2*e._z+(-t._z+i._z)*o+(2*t._z-5*e._z+4*i._z-r._z)*a+(-t._z+3*e._z-3*i._z+r._z)*s);return new n(l,u,f)},n.Clamp=function(t,e,i){var r=new n;return n.ClampToRef(t,e,i,r),r},n.ClampToRef=function(t,e,i,r){var o=t._x;o=o>i._x?i._x:o,o=o<e._x?e._x:o;var a=t._y;a=a>i._y?i._y:a,a=a<e._y?e._y:a;var s=t._z;s=s>i._z?i._z:s,s=s<e._z?e._z:s,r.copyFromFloats(o,a,s)},n.CheckExtends=function(t,e,i){e.minimizeInPlace(t),i.maximizeInPlace(t)},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t._x*l+i._x*u+e._x*f+r._x*h,d=t._y*l+i._y*u+e._y*f+r._y*h,p=t._z*l+i._z*u+e._z*f+r._z*h;return new n(c,d,p)},n.Lerp=function(t,e,i){var r=new n(0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.x=t._x+(e._x-t._x)*i,r.y=t._y+(e._y-t._y)*i,r.z=t._z+(e._z-t._z)*i},n.Dot=function(t,e){return t._x*e._x+t._y*e._y+t._z*e._z},n.Cross=function(t,e){var i=n.Zero();return n.CrossToRef(t,e,i),i},n.CrossToRef=function(t,e,i){var r=t._y*e._z-t._z*e._y,o=t._z*e._x-t._x*e._z,a=t._x*e._y-t._y*e._x;i.copyFromFloats(r,o,a)},n.Normalize=function(t){var e=n.Zero();return n.NormalizeToRef(t,e),e},n.NormalizeToRef=function(t,e){t.normalizeToRef(e)},n.Project=function(t,e,i,r){var o=new n;return n.ProjectToRef(t,e,i,r,o),o},n.ProjectToRef=function(t,e,i,r,o){var a=r.width,s=r.height,l=r.x,u=r.y,f=lt.Matrix[1];N.FromValuesToRef(a/2,0,0,0,0,-s/2,0,0,0,0,.5,0,l+a/2,s/2+u,.5,1,f);var h=lt.Matrix[0];return e.multiplyToRef(i,h),h.multiplyToRef(f,h),n.TransformCoordinatesToRef(t,h,o),o},n._UnprojectFromInvertedMatrixToRef=function(t,e,i){n.TransformCoordinatesToRef(t,e,i);var r=e.m,o=t._x*r[3]+t._y*r[7]+t._z*r[11]+r[15];de.WithinEpsilon(o,1)&&i.scaleInPlace(1/o)},n.UnprojectFromTransform=function(t,e,i,r,o){var a=lt.Matrix[0];r.multiplyToRef(o,a),a.invert(),t.x=t._x/e*2-1,t.y=-(t._y/i*2-1);var s=new n;return n._UnprojectFromInvertedMatrixToRef(t,a,s),s},n.Unproject=function(t,e,i,r,o,a){var s=n.Zero();return n.UnprojectToRef(t,e,i,r,o,a,s),s},n.UnprojectToRef=function(t,e,i,r,o,a,s){n.UnprojectFloatsToRef(t._x,t._y,t._z,e,i,r,o,a,s)},n.UnprojectFloatsToRef=function(t,e,i,r,o,a,s,l,u){var f=lt.Matrix[0];a.multiplyToRef(s,f),f.multiplyToRef(l,f),f.invert();var h=lt.Vector3[0];h.x=t/r*2-1,h.y=-(e/o*2-1),h.z=2*i-1,n._UnprojectFromInvertedMatrixToRef(h,f,u)},n.Minimize=function(t,e){var i=t.clone();return i.minimizeInPlace(e),i},n.Maximize=function(t,e){var i=t.clone();return i.maximizeInPlace(e),i},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t._x-e._x,r=t._y-e._y,o=t._z-e._z;return i*i+r*r+o*o},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.RotationFromAxis=function(t,e,i){var r=n.Zero();return n.RotationFromAxisToRef(t,e,i,r),r},n.RotationFromAxisToRef=function(t,e,i,r){var o=lt.Quaternion[0];ae.RotationQuaternionFromAxisToRef(t,e,i,o),o.toEulerAnglesToRef(r)},n._UpReadOnly=n.Up(),n._ZeroReadOnly=n.Zero(),n}(),gt=function(){function n(t,e,i,r){this.x=t,this.y=e,this.z=i,this.w=r}return n.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},n.prototype.getClassName=function(){return"Vector4"},n.prototype.getHashCode=function(){var t=this.x|0;return t=t*397^(this.y|0),t=t*397^(this.z|0),t=t*397^(this.w|0),t},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.addInPlace=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)},n.prototype.addToRef=function(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e.w=this.w+t.w,this},n.prototype.subtractInPlace=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)},n.prototype.subtractToRef=function(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z,e.w=this.w-t.w,this},n.prototype.subtractFromFloats=function(t,e,i,r){return new n(this.x-t,this.y-e,this.z-i,this.w-r)},n.prototype.subtractFromFloatsToRef=function(t,e,i,r,o){return o.x=this.x-t,o.y=this.y-e,o.z=this.z-i,o.w=this.w-r,this},n.prototype.negate=function(){return new n(-this.x,-this.y,-this.z,-this.w)},n.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this},n.prototype.negateToRef=function(t){return t.copyFromFloats(this.x*-1,this.y*-1,this.z*-1,this.w*-1)},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},n.prototype.scale=function(t){return new n(this.x*t,this.y*t,this.z*t,this.w*t)},n.prototype.scaleToRef=function(t,e){return e.x=this.x*t,e.y=this.y*t,e.z=this.z*t,e.w=this.w*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this.x*t,e.y+=this.y*t,e.z+=this.z*t,e.w+=this.w*t,this},n.prototype.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this.x,t.x,e)&&de.WithinEpsilon(this.y,t.y,e)&&de.WithinEpsilon(this.z,t.z,e)&&de.WithinEpsilon(this.w,t.w,e)},n.prototype.equalsToFloats=function(t,e,i,r){return this.x===t&&this.y===e&&this.z===i&&this.w===r},n.prototype.multiplyInPlace=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},n.prototype.multiply=function(t){return new n(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w)},n.prototype.multiplyToRef=function(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,e.z=this.z*t.z,e.w=this.w*t.w,this},n.prototype.multiplyByFloats=function(t,e,i,r){return new n(this.x*t,this.y*e,this.z*i,this.w*r)},n.prototype.divide=function(t){return new n(this.x/t.x,this.y/t.y,this.z/t.z,this.w/t.w)},n.prototype.divideToRef=function(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,e.z=this.z/t.z,e.w=this.w/t.w,this},n.prototype.divideInPlace=function(t){return this.divideToRef(t,this)},n.prototype.minimizeInPlace=function(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),t.w<this.w&&(this.w=t.w),this},n.prototype.maximizeInPlace=function(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},n.prototype.fract=function(){return new n(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},n.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},n.prototype.normalize=function(){var t=this.length();return t===0?this:this.scaleInPlace(1/t)},n.prototype.toVector3=function(){return new g(this.x,this.y,this.z)},n.prototype.clone=function(){return new n(this.x,this.y,this.z,this.w)},n.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.setAll=function(t){return this.x=this.y=this.z=this.w=t,this},n.FromArray=function(t,e){return e||(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2],i.w=t[e+3]},n.FromFloatArrayToRef=function(t,e,i){n.FromArrayToRef(t,e,i)},n.FromFloatsToRef=function(t,e,i,r,o){o.x=t,o.y=e,o.z=i,o.w=r},n.Zero=function(){return new n(0,0,0,0)},n.One=function(){return new n(1,1,1,1)},n.Normalize=function(t){var e=n.Zero();return n.NormalizeToRef(t,e),e},n.NormalizeToRef=function(t,e){e.copyFrom(t),e.normalize()},n.Minimize=function(t,e){var i=t.clone();return i.minimizeInPlace(e),i},n.Maximize=function(t,e){var i=t.clone();return i.maximizeInPlace(e),i},n.Distance=function(t,e){return Math.sqrt(n.DistanceSquared(t,e))},n.DistanceSquared=function(t,e){var i=t.x-e.x,r=t.y-e.y,o=t.z-e.z,a=t.w-e.w;return i*i+r*r+o*o+a*a},n.Center=function(t,e){var i=t.add(e);return i.scaleInPlace(.5),i},n.TransformNormal=function(t,e){var i=n.Zero();return n.TransformNormalToRef(t,e,i),i},n.TransformNormalToRef=function(t,e,i){var r=e.m,o=t.x*r[0]+t.y*r[4]+t.z*r[8],a=t.x*r[1]+t.y*r[5]+t.z*r[9],s=t.x*r[2]+t.y*r[6]+t.z*r[10];i.x=o,i.y=a,i.z=s,i.w=t.w},n.TransformNormalFromFloatsToRef=function(t,e,i,r,o,a){var s=o.m;a.x=t*s[0]+e*s[4]+i*s[8],a.y=t*s[1]+e*s[5]+i*s[9],a.z=t*s[2]+e*s[6]+i*s[10],a.w=r},n.FromVector3=function(t,e){return e===void 0&&(e=0),new n(t._x,t._y,t._z,e)},n}(),ae=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._isDirty=!0,this._x=t,this._y=e,this._z=i,this._w=r}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._isDirty=!0},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+" W:"+this._w+"}"},n.prototype.getClassName=function(){return"Quaternion"},n.prototype.getHashCode=function(){var t=this._x|0;return t=t*397^(this._y|0),t=t*397^(this._z|0),t=t*397^(this._w|0),t},n.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},n.prototype.equals=function(t){return t&&this._x===t._x&&this._y===t._y&&this._z===t._z&&this._w===t._w},n.prototype.equalsWithEpsilon=function(t,e){return e===void 0&&(e=ft),t&&de.WithinEpsilon(this._x,t._x,e)&&de.WithinEpsilon(this._y,t._y,e)&&de.WithinEpsilon(this._z,t._z,e)&&de.WithinEpsilon(this._w,t._w,e)},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copyFrom=function(t){return this.x=t._x,this.y=t._y,this.z=t._z,this.w=t._w,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.add=function(t){return new n(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},n.prototype.addInPlace=function(t){return this._x+=t._x,this._y+=t._y,this._z+=t._z,this._w+=t._w,this},n.prototype.subtract=function(t){return new n(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},n.prototype.scale=function(t){return new n(this._x*t,this._y*t,this._z*t,this._w*t)},n.prototype.scaleToRef=function(t,e){return e.x=this._x*t,e.y=this._y*t,e.z=this._z*t,e.w=this._w*t,this},n.prototype.scaleInPlace=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.x+=this._x*t,e.y+=this._y*t,e.z+=this._z*t,e.w+=this._w*t,this},n.prototype.multiply=function(t){var e=new n(0,0,0,1);return this.multiplyToRef(t,e),e},n.prototype.multiplyToRef=function(t,e){var i=this._x*t._w+this._y*t._z-this._z*t._y+this._w*t._x,r=-this._x*t._z+this._y*t._w+this._z*t._x+this._w*t._y,o=this._x*t._y-this._y*t._x+this._z*t._w+this._w*t._z,a=-this._x*t._x-this._y*t._y-this._z*t._z+this._w*t._w;return e.copyFromFloats(i,r,o,a),this},n.prototype.multiplyInPlace=function(t){return this.multiplyToRef(t,this),this},n.prototype.conjugateToRef=function(t){return t.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},n.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},n.prototype.conjugate=function(){var t=new n(-this._x,-this._y,-this._z,this._w);return t},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var t=this.length();if(t===0)return this;var e=1/t;return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},n.prototype.toEulerAngles=function(t){var e=g.Zero();return this.toEulerAnglesToRef(e),e},n.prototype.toEulerAnglesToRef=function(t){var e=this._z,i=this._x,r=this._y,o=this._w,a=o*o,s=e*e,l=i*i,u=r*r,f=r*e-i*o,h=.4999999;return f<-h?(t.y=2*Math.atan2(r,o),t.x=Math.PI/2,t.z=0):f>h?(t.y=2*Math.atan2(r,o),t.x=-Math.PI/2,t.z=0):(t.z=Math.atan2(2*(i*r+e*o),-s-l+u+a),t.x=Math.asin(-2*(e*r-i*o)),t.y=Math.atan2(2*(e*i+r*o),s-l-u+a)),this},n.prototype.toRotationMatrix=function(t){return N.FromQuaternionToRef(this,t),this},n.prototype.fromRotationMatrix=function(t){return n.FromRotationMatrixToRef(t,this),this},n.FromRotationMatrix=function(t){var e=new n;return n.FromRotationMatrixToRef(t,e),e},n.FromRotationMatrixToRef=function(t,e){var i=t.m,r=i[0],o=i[4],a=i[8],s=i[1],l=i[5],u=i[9],f=i[2],h=i[6],c=i[10],d=r+l+c,p;d>0?(p=.5/Math.sqrt(d+1),e.w=.25/p,e.x=(h-u)*p,e.y=(a-f)*p,e.z=(s-o)*p):r>l&&r>c?(p=2*Math.sqrt(1+r-l-c),e.w=(h-u)/p,e.x=.25*p,e.y=(o+s)/p,e.z=(a+f)/p):l>c?(p=2*Math.sqrt(1+l-r-c),e.w=(a-f)/p,e.x=(o+s)/p,e.y=.25*p,e.z=(u+h)/p):(p=2*Math.sqrt(1+c-r-l),e.w=(s-o)/p,e.x=(a+f)/p,e.y=(u+h)/p,e.z=.25*p)},n.Dot=function(t,e){return t._x*e._x+t._y*e._y+t._z*e._z+t._w*e._w},n.AreClose=function(t,e){var i=n.Dot(t,e);return i>=0},n.Zero=function(){return new n(0,0,0,0)},n.Inverse=function(t){return new n(-t._x,-t._y,-t._z,t._w)},n.InverseToRef=function(t,e){return e.set(-t._x,-t._y,-t._z,t._w),e},n.Identity=function(){return new n(0,0,0,1)},n.IsIdentity=function(t){return t&&t._x===0&&t._y===0&&t._z===0&&t._w===1},n.RotationAxis=function(t,e){return n.RotationAxisToRef(t,e,new n)},n.RotationAxisToRef=function(t,e,i){var r=Math.sin(e/2);return t.normalize(),i.w=Math.cos(e/2),i.x=t._x*r,i.y=t._y*r,i.z=t._z*r,i},n.FromArray=function(t,e){return e||(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){i.x=t[e],i.y=t[e+1],i.z=t[e+2],i.w=t[e+3]},n.FromEulerAngles=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(e,t,i,r),r},n.FromEulerAnglesToRef=function(t,e,i,r){return n.RotationYawPitchRollToRef(e,t,i,r),r},n.FromEulerVector=function(t){var e=new n;return n.RotationYawPitchRollToRef(t._y,t._x,t._z,e),e},n.FromEulerVectorToRef=function(t,e){return n.RotationYawPitchRollToRef(t._y,t._x,t._z,e),e},n.RotationYawPitchRoll=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(t,e,i,r),r},n.RotationYawPitchRollToRef=function(t,e,i,r){var o=i*.5,a=e*.5,s=t*.5,l=Math.sin(o),u=Math.cos(o),f=Math.sin(a),h=Math.cos(a),c=Math.sin(s),d=Math.cos(s);r.x=d*f*u+c*h*l,r.y=c*h*u-d*f*l,r.z=d*h*l-c*f*u,r.w=d*h*u+c*f*l},n.RotationAlphaBetaGamma=function(t,e,i){var r=new n;return n.RotationAlphaBetaGammaToRef(t,e,i,r),r},n.RotationAlphaBetaGammaToRef=function(t,e,i,r){var o=(i+t)*.5,a=(i-t)*.5,s=e*.5;r.x=Math.cos(a)*Math.sin(s),r.y=Math.sin(a)*Math.sin(s),r.z=Math.sin(o)*Math.cos(s),r.w=Math.cos(o)*Math.cos(s)},n.RotationQuaternionFromAxis=function(t,e,i){var r=new n(0,0,0,0);return n.RotationQuaternionFromAxisToRef(t,e,i,r),r},n.RotationQuaternionFromAxisToRef=function(t,e,i,r){var o=lt.Matrix[0];N.FromXYZAxesToRef(t.normalize(),e.normalize(),i.normalize(),o),n.FromRotationMatrixToRef(o,r)},n.Slerp=function(t,e,i){var r=n.Identity();return n.SlerpToRef(t,e,i,r),r},n.SlerpToRef=function(t,e,i,r){var o,a,s=t._x*e._x+t._y*e._y+t._z*e._z+t._w*e._w,l=!1;if(s<0&&(l=!0,s=-s),s>.999999)a=1-i,o=l?-i:i;else{var u=Math.acos(s),f=1/Math.sin(u);a=Math.sin((1-i)*u)*f,o=l?-Math.sin(i*u)*f:Math.sin(i*u)*f}r.x=a*t._x+o*e._x,r.y=a*t._y+o*e._y,r.z=a*t._z+o*e._z,r.w=a*t._w+o*e._w},n.Hermite=function(t,e,i,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,u=-2*s+3*a,f=s-2*a+o,h=s-a,c=t._x*l+i._x*u+e._x*f+r._x*h,d=t._y*l+i._y*u+e._y*f+r._y*h,p=t._z*l+i._z*u+e._z*f+r._z*h,_=t._w*l+i._w*u+e._w*f+r._w*h;return new n(c,d,p,_)},n}(),N=function(){function n(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,hn.MatrixTrackPrecisionChange&&hn.MatrixTrackedMatrices.push(this),this._m=new hn.MatrixCurrentType(16),this._updateIdentityStatus(!1)}return Object.defineProperty(n,"Use64Bits",{get:function(){return hn.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),n.prototype._markAsUpdated=function(){this.updateFlag=n._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},n.prototype._updateIdentityStatus=function(t,e,i,r){e===void 0&&(e=!1),i===void 0&&(i=!1),r===void 0&&(r=!0),this.updateFlag=n._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||i,this._isIdentityDirty=this._isIdentity?!1:e,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:r},n.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var t=this._m;this._isIdentity=t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1}return this._isIdentity},n.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},n.prototype.determinant=function(){if(this._isIdentity===!0)return 1;var t=this._m,e=t[0],i=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],f=t[8],h=t[9],c=t[10],d=t[11],p=t[12],_=t[13],v=t[14],m=t[15],y=c*m-v*d,T=h*m-_*d,E=h*v-_*c,C=f*m-p*d,A=f*v-c*p,R=f*_-p*h,O=+(s*y-l*T+u*E),D=-(a*y-l*C+u*A),I=+(a*T-s*C+u*R),x=-(a*E-s*A+l*R);return e*O+i*D+r*I+o*x},n.prototype.toArray=function(){return this._m},n.prototype.asArray=function(){return this._m},n.prototype.invert=function(){return this.invertToRef(this),this},n.prototype.reset=function(){return n.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},n.prototype.add=function(t){var e=new n;return this.addToRef(t,e),e},n.prototype.addToRef=function(t,e){for(var i=this._m,r=e._m,o=t.m,a=0;a<16;a++)r[a]=i[a]+o[a];return e._markAsUpdated(),this},n.prototype.addToSelf=function(t){for(var e=this._m,i=t.m,r=0;r<16;r++)e[r]+=i[r];return this._markAsUpdated(),this},n.prototype.invertToRef=function(t){if(this._isIdentity===!0)return n.IdentityToRef(t),this;var e=this._m,i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],f=e[7],h=e[8],c=e[9],d=e[10],p=e[11],_=e[12],v=e[13],m=e[14],y=e[15],T=d*y-m*p,E=c*y-v*p,C=c*m-v*d,A=h*y-_*p,R=h*m-d*_,O=h*v-_*c,D=+(l*T-u*E+f*C),I=-(s*T-u*A+f*R),x=+(s*E-l*A+f*O),L=-(s*C-l*R+u*O),Y=i*D+r*I+o*x+a*L;if(Y===0)return t.copyFrom(this),this;var B=1/Y,z=u*y-m*f,q=l*y-v*f,J=l*m-v*u,k=s*y-_*f,j=s*m-_*u,ie=s*v-_*l,Z=u*p-d*f,fe=l*p-c*f,ve=l*d-c*u,ee=s*p-h*f,ue=s*d-h*u,re=s*c-h*l,$=-(r*T-o*E+a*C),ce=+(i*T-o*A+a*R),be=-(i*E-r*A+a*O),me=+(i*C-r*R+o*O),Re=+(r*z-o*q+a*J),we=-(i*z-o*k+a*j),Ce=+(i*q-r*k+a*ie),je=-(i*J-r*j+o*ie),Ne=-(r*Z-o*fe+a*ve),De=+(i*Z-o*ee+a*ue),Ye=-(i*fe-r*ee+a*re),_e=+(i*ve-r*ue+o*re);return n.FromValuesToRef(D*B,$*B,Re*B,Ne*B,I*B,ce*B,we*B,De*B,x*B,be*B,Ce*B,Ye*B,L*B,me*B,je*B,_e*B,t),this},n.prototype.addAtIndex=function(t,e){return this._m[t]+=e,this._markAsUpdated(),this},n.prototype.multiplyAtIndex=function(t,e){return this._m[t]*=e,this._markAsUpdated(),this},n.prototype.setTranslationFromFloats=function(t,e,i){return this._m[12]=t,this._m[13]=e,this._m[14]=i,this._markAsUpdated(),this},n.prototype.addTranslationFromFloats=function(t,e,i){return this._m[12]+=t,this._m[13]+=e,this._m[14]+=i,this._markAsUpdated(),this},n.prototype.setTranslation=function(t){return this.setTranslationFromFloats(t._x,t._y,t._z)},n.prototype.getTranslation=function(){return new g(this._m[12],this._m[13],this._m[14])},n.prototype.getTranslationToRef=function(t){return t.x=this._m[12],t.y=this._m[13],t.z=this._m[14],this},n.prototype.removeRotationAndScaling=function(){var t=this.m;return n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1),this},n.prototype.multiply=function(t){var e=new n;return this.multiplyToRef(t,e),e},n.prototype.copyFrom=function(t){t.copyToArray(this._m);var e=t;return this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this},n.prototype.copyToArray=function(t,e){e===void 0&&(e=0);var i=this._m;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],this},n.prototype.multiplyToRef=function(t,e){return this._isIdentity?(e.copyFrom(t),this):t._isIdentity?(e.copyFrom(this),this):(this.multiplyToArray(t,e._m,0),e._markAsUpdated(),this)},n.prototype.multiplyToArray=function(t,e,i){var r=this._m,o=t.m,a=r[0],s=r[1],l=r[2],u=r[3],f=r[4],h=r[5],c=r[6],d=r[7],p=r[8],_=r[9],v=r[10],m=r[11],y=r[12],T=r[13],E=r[14],C=r[15],A=o[0],R=o[1],O=o[2],D=o[3],I=o[4],x=o[5],L=o[6],Y=o[7],B=o[8],z=o[9],q=o[10],J=o[11],k=o[12],j=o[13],ie=o[14],Z=o[15];return e[i]=a*A+s*I+l*B+u*k,e[i+1]=a*R+s*x+l*z+u*j,e[i+2]=a*O+s*L+l*q+u*ie,e[i+3]=a*D+s*Y+l*J+u*Z,e[i+4]=f*A+h*I+c*B+d*k,e[i+5]=f*R+h*x+c*z+d*j,e[i+6]=f*O+h*L+c*q+d*ie,e[i+7]=f*D+h*Y+c*J+d*Z,e[i+8]=p*A+_*I+v*B+m*k,e[i+9]=p*R+_*x+v*z+m*j,e[i+10]=p*O+_*L+v*q+m*ie,e[i+11]=p*D+_*Y+v*J+m*Z,e[i+12]=y*A+T*I+E*B+C*k,e[i+13]=y*R+T*x+E*z+C*j,e[i+14]=y*O+T*L+E*q+C*ie,e[i+15]=y*D+T*Y+E*J+C*Z,this},n.prototype.equals=function(t){var e=t;if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;var i=this.m,r=e.m;return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]&&i[4]===r[4]&&i[5]===r[5]&&i[6]===r[6]&&i[7]===r[7]&&i[8]===r[8]&&i[9]===r[9]&&i[10]===r[10]&&i[11]===r[11]&&i[12]===r[12]&&i[13]===r[13]&&i[14]===r[14]&&i[15]===r[15]},n.prototype.clone=function(){var t=new n;return t.copyFrom(this),t},n.prototype.getClassName=function(){return"Matrix"},n.prototype.getHashCode=function(){for(var t=this._m[0]|0,e=1;e<16;e++)t=t*397^(this._m[e]|0);return t},n.prototype.decompose=function(t,e,i){if(this._isIdentity)return i&&i.setAll(0),t&&t.setAll(1),e&&e.copyFromFloats(0,0,0,1),!0;var r=this._m;if(i&&i.copyFromFloats(r[12],r[13],r[14]),t=t||lt.Vector3[0],t.x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),t.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),t.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(t.y*=-1),t._x===0||t._y===0||t._z===0)return e&&e.copyFromFloats(0,0,0,1),!1;if(e){var o=1/t._x,a=1/t._y,s=1/t._z;n.FromValuesToRef(r[0]*o,r[1]*o,r[2]*o,0,r[4]*a,r[5]*a,r[6]*a,0,r[8]*s,r[9]*s,r[10]*s,0,0,0,0,1,lt.Matrix[0]),ae.FromRotationMatrixToRef(lt.Matrix[0],e)}return!0},n.prototype.getRow=function(t){if(t<0||t>3)return null;var e=t*4;return new gt(this._m[e+0],this._m[e+1],this._m[e+2],this._m[e+3])},n.prototype.setRow=function(t,e){return this.setRowFromFloats(t,e.x,e.y,e.z,e.w)},n.prototype.transpose=function(){return n.Transpose(this)},n.prototype.transposeToRef=function(t){return n.TransposeToRef(this,t),this},n.prototype.setRowFromFloats=function(t,e,i,r,o){if(t<0||t>3)return this;var a=t*4;return this._m[a+0]=e,this._m[a+1]=i,this._m[a+2]=r,this._m[a+3]=o,this._markAsUpdated(),this},n.prototype.scale=function(t){var e=new n;return this.scaleToRef(t,e),e},n.prototype.scaleToRef=function(t,e){for(var i=0;i<16;i++)e._m[i]=this._m[i]*t;return e._markAsUpdated(),this},n.prototype.scaleAndAddToRef=function(t,e){for(var i=0;i<16;i++)e._m[i]+=this._m[i]*t;return e._markAsUpdated(),this},n.prototype.toNormalMatrix=function(t){var e=lt.Matrix[0];this.invertToRef(e),e.transposeToRef(t);var i=t._m;n.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,t)},n.prototype.getRotationMatrix=function(){var t=new n;return this.getRotationMatrixToRef(t),t},n.prototype.getRotationMatrixToRef=function(t){var e=lt.Vector3[0];if(!this.decompose(e))return n.IdentityToRef(t),this;var i=this._m,r=1/e._x,o=1/e._y,a=1/e._z;return n.FromValuesToRef(i[0]*r,i[1]*r,i[2]*r,0,i[4]*o,i[5]*o,i[6]*o,0,i[8]*a,i[9]*a,i[10]*a,0,0,0,0,1,t),this},n.prototype.toggleModelMatrixHandInPlace=function(){var t=this._m;t[2]*=-1,t[6]*=-1,t[8]*=-1,t[9]*=-1,t[14]*=-1,this._markAsUpdated()},n.prototype.toggleProjectionMatrixHandInPlace=function(){var t=this._m;t[8]*=-1,t[9]*=-1,t[10]*=-1,t[11]*=-1,this._markAsUpdated()},n.FromArray=function(t,e){e===void 0&&(e=0);var i=new n;return n.FromArrayToRef(t,e,i),i},n.FromArrayToRef=function(t,e,i){for(var r=0;r<16;r++)i._m[r]=t[r+e];i._markAsUpdated()},n.FromFloat32ArrayToRefScaled=function(t,e,i,r){for(var o=0;o<16;o++)r._m[o]=t[o+e]*i;r._markAsUpdated()},Object.defineProperty(n,"IdentityReadOnly",{get:function(){return n._identityReadOnly},enumerable:!1,configurable:!0}),n.FromValuesToRef=function(t,e,i,r,o,a,s,l,u,f,h,c,d,p,_,v,m){var y=m._m;y[0]=t,y[1]=e,y[2]=i,y[3]=r,y[4]=o,y[5]=a,y[6]=s,y[7]=l,y[8]=u,y[9]=f,y[10]=h,y[11]=c,y[12]=d,y[13]=p,y[14]=_,y[15]=v,m._markAsUpdated()},n.FromValues=function(t,e,i,r,o,a,s,l,u,f,h,c,d,p,_,v){var m=new n,y=m._m;return y[0]=t,y[1]=e,y[2]=i,y[3]=r,y[4]=o,y[5]=a,y[6]=s,y[7]=l,y[8]=u,y[9]=f,y[10]=h,y[11]=c,y[12]=d,y[13]=p,y[14]=_,y[15]=v,m._markAsUpdated(),m},n.Compose=function(t,e,i){var r=new n;return n.ComposeToRef(t,e,i,r),r},n.ComposeToRef=function(t,e,i,r){var o=r._m,a=e._x,s=e._y,l=e._z,u=e._w,f=a+a,h=s+s,c=l+l,d=a*f,p=a*h,_=a*c,v=s*h,m=s*c,y=l*c,T=u*f,E=u*h,C=u*c,A=t._x,R=t._y,O=t._z;o[0]=(1-(v+y))*A,o[1]=(p+C)*A,o[2]=(_-E)*A,o[3]=0,o[4]=(p-C)*R,o[5]=(1-(d+y))*R,o[6]=(m+T)*R,o[7]=0,o[8]=(_+E)*O,o[9]=(m-T)*O,o[10]=(1-(d+v))*O,o[11]=0,o[12]=i._x,o[13]=i._y,o[14]=i._z,o[15]=1,r._markAsUpdated()},n.Identity=function(){var t=n.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},n.IdentityToRef=function(t){n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},n.Zero=function(){var t=n.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},n.RotationX=function(t){var e=new n;return n.RotationXToRef(t,e),e},n.Invert=function(t){var e=new n;return t.invertToRef(e),e},n.RotationXToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(1,0,0,0,0,r,i,0,0,-i,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationY=function(t){var e=new n;return n.RotationYToRef(t,e),e},n.RotationYToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(r,0,-i,0,0,1,0,0,i,0,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationZ=function(t){var e=new n;return n.RotationZToRef(t,e),e},n.RotationZToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);n.FromValuesToRef(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&i===0)},n.RotationAxis=function(t,e){var i=new n;return n.RotationAxisToRef(t,e,i),i},n.RotationAxisToRef=function(t,e,i){var r=Math.sin(-e),o=Math.cos(-e),a=1-o;t.normalize();var s=i._m;s[0]=t._x*t._x*a+o,s[1]=t._x*t._y*a-t._z*r,s[2]=t._x*t._z*a+t._y*r,s[3]=0,s[4]=t._y*t._x*a+t._z*r,s[5]=t._y*t._y*a+o,s[6]=t._y*t._z*a-t._x*r,s[7]=0,s[8]=t._z*t._x*a-t._y*r,s[9]=t._z*t._y*a+t._x*r,s[10]=t._z*t._z*a+o,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},n.RotationAlignToRef=function(t,e,i){var r=g.Cross(e,t),o=g.Dot(e,t),a=1/(1+o),s=i._m;s[0]=r._x*r._x*a+o,s[1]=r._y*r._x*a-r._z,s[2]=r._z*r._x*a+r._y,s[3]=0,s[4]=r._x*r._y*a+r._z,s[5]=r._y*r._y*a+o,s[6]=r._z*r._y*a-r._x,s[7]=0,s[8]=r._x*r._z*a-r._y,s[9]=r._y*r._z*a+r._x,s[10]=r._z*r._z*a+o,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},n.RotationYawPitchRoll=function(t,e,i){var r=new n;return n.RotationYawPitchRollToRef(t,e,i,r),r},n.RotationYawPitchRollToRef=function(t,e,i,r){ae.RotationYawPitchRollToRef(t,e,i,lt.Quaternion[0]),lt.Quaternion[0].toRotationMatrix(r)},n.Scaling=function(t,e,i){var r=new n;return n.ScalingToRef(t,e,i,r),r},n.ScalingToRef=function(t,e,i,r){n.FromValuesToRef(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1,r),r._updateIdentityStatus(t===1&&e===1&&i===1)},n.Translation=function(t,e,i){var r=new n;return n.TranslationToRef(t,e,i,r),r},n.TranslationToRef=function(t,e,i,r){n.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1,r),r._updateIdentityStatus(t===0&&e===0&&i===0)},n.Lerp=function(t,e,i){var r=new n;return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){for(var o=r._m,a=t.m,s=e.m,l=0;l<16;l++)o[l]=a[l]*(1-i)+s[l]*i;r._markAsUpdated()},n.DecomposeLerp=function(t,e,i){var r=new n;return n.DecomposeLerpToRef(t,e,i,r),r},n.DecomposeLerpToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Quaternion[0],s=lt.Vector3[1];t.decompose(o,a,s);var l=lt.Vector3[2],u=lt.Quaternion[1],f=lt.Vector3[3];e.decompose(l,u,f);var h=lt.Vector3[4];g.LerpToRef(o,l,i,h);var c=lt.Quaternion[2];ae.SlerpToRef(a,u,i,c);var d=lt.Vector3[5];g.LerpToRef(s,f,i,d),n.ComposeToRef(h,c,d,r)},n.LookAtLH=function(t,e,i){var r=new n;return n.LookAtLHToRef(t,e,i,r),r},n.LookAtLHToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Vector3[1],s=lt.Vector3[2];e.subtractToRef(t,s),s.normalize(),g.CrossToRef(i,s,o);var l=o.lengthSquared();l===0?o.x=1:o.normalizeFromLength(Math.sqrt(l)),g.CrossToRef(s,o,a),a.normalize();var u=-g.Dot(o,t),f=-g.Dot(a,t),h=-g.Dot(s,t);n.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,u,f,h,1,r)},n.LookAtRH=function(t,e,i){var r=new n;return n.LookAtRHToRef(t,e,i,r),r},n.LookAtRHToRef=function(t,e,i,r){var o=lt.Vector3[0],a=lt.Vector3[1],s=lt.Vector3[2];t.subtractToRef(e,s),s.normalize(),g.CrossToRef(i,s,o);var l=o.lengthSquared();l===0?o.x=1:o.normalizeFromLength(Math.sqrt(l)),g.CrossToRef(s,o,a),a.normalize();var u=-g.Dot(o,t),f=-g.Dot(a,t),h=-g.Dot(s,t);n.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,u,f,h,1,r)},n.OrthoLH=function(t,e,i,r){var o=new n;return n.OrthoLHToRef(t,e,i,r,o),o},n.OrthoLHToRef=function(t,e,i,r,o){var a=i,s=r,l=2/t,u=2/e,f=2/(s-a),h=-(s+a)/(s-a);n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,f,0,0,0,h,1,o),o._updateIdentityStatus(l===1&&u===1&&f===1&&h===0)},n.OrthoOffCenterLH=function(t,e,i,r,o,a){var s=new n;return n.OrthoOffCenterLHToRef(t,e,i,r,o,a,s),s},n.OrthoOffCenterLHToRef=function(t,e,i,r,o,a,s){var l=o,u=a,f=2/(e-t),h=2/(r-i),c=2/(u-l),d=-(u+l)/(u-l),p=(t+e)/(t-e),_=(r+i)/(i-r);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,0,p,_,d,1,s),s._markAsUpdated()},n.OrthoOffCenterRH=function(t,e,i,r,o,a){var s=new n;return n.OrthoOffCenterRHToRef(t,e,i,r,o,a,s),s},n.OrthoOffCenterRHToRef=function(t,e,i,r,o,a,s){n.OrthoOffCenterLHToRef(t,e,i,r,o,a,s),s._m[10]*=-1},n.PerspectiveLH=function(t,e,i,r){var o=new n,a=i,s=r,l=2*a/t,u=2*a/e,f=(s+a)/(s-a),h=-2*s*a/(s-a);return n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,f,1,0,0,h,0,o),o._updateIdentityStatus(!1),o},n.PerspectiveFovLH=function(t,e,i,r){var o=new n;return n.PerspectiveFovLHToRef(t,e,i,r,o),o},n.PerspectiveFovLHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=i,l=r,u=1/Math.tan(t*.5),f=a?u/e:u,h=a?u:u*e,c=(l+s)/(l-s),d=-2*l*s/(l-s);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,1,0,0,d,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovReverseLHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=1/Math.tan(t*.5),l=a?s/e:s,u=a?s:s*e;n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,-i,1,0,0,1,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovRH=function(t,e,i,r){var o=new n;return n.PerspectiveFovRHToRef(t,e,i,r,o),o},n.PerspectiveFovRHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=i,l=r,u=1/Math.tan(t*.5),f=a?u/e:u,h=a?u:u*e,c=-(l+s)/(l-s),d=-2*l*s/(l-s);n.FromValuesToRef(f,0,0,0,0,h,0,0,0,0,c,-1,0,0,d,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovReverseRHToRef=function(t,e,i,r,o,a){a===void 0&&(a=!0);var s=1/Math.tan(t*.5),l=a?s/e:s,u=a?s:s*e;n.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,-i,-1,0,0,-1,0,o),o._updateIdentityStatus(!1)},n.PerspectiveFovWebVRToRef=function(t,e,i,r,o){o===void 0&&(o=!1);var a=o?-1:1,s=Math.tan(t.upDegrees*Math.PI/180),l=Math.tan(t.downDegrees*Math.PI/180),u=Math.tan(t.leftDegrees*Math.PI/180),f=Math.tan(t.rightDegrees*Math.PI/180),h=2/(u+f),c=2/(s+l),d=r._m;d[0]=h,d[1]=d[2]=d[3]=d[4]=0,d[5]=c,d[6]=d[7]=0,d[8]=(u-f)*h*.5,d[9]=-((s-l)*c*.5),d[10]=-i/(e-i),d[11]=1*a,d[12]=d[13]=d[15]=0,d[14]=-(2*i*e)/(i-e),r._markAsUpdated()},n.GetFinalMatrix=function(t,e,i,r,o,a){var s=t.width,l=t.height,u=t.x,f=t.y,h=n.FromValues(s/2,0,0,0,0,-l/2,0,0,0,0,a-o,0,u+s/2,l/2+f,o,1),c=lt.Matrix[0];return e.multiplyToRef(i,c),c.multiplyToRef(r,c),c.multiply(h)},n.GetAsMatrix2x2=function(t){var e=t.m,i=[e[0],e[1],e[4],e[5]];return hn.MatrixUse64Bits?i:new Float32Array(i)},n.GetAsMatrix3x3=function(t){var e=t.m,i=[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]];return hn.MatrixUse64Bits?i:new Float32Array(i)},n.Transpose=function(t){var e=new n;return n.TransposeToRef(t,e),e},n.TransposeToRef=function(t,e){var i=e._m,r=t.m;i[0]=r[0],i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=r[1],i[5]=r[5],i[6]=r[9],i[7]=r[13],i[8]=r[2],i[9]=r[6],i[10]=r[10],i[11]=r[14],i[12]=r[3],i[13]=r[7],i[14]=r[11],i[15]=r[15],e._updateIdentityStatus(t._isIdentity,t._isIdentityDirty)},n.Reflection=function(t){var e=new n;return n.ReflectionToRef(t,e),e},n.ReflectionToRef=function(t,e){t.normalize();var i=t.normal.x,r=t.normal.y,o=t.normal.z,a=-2*i,s=-2*r,l=-2*o;n.FromValuesToRef(a*i+1,s*i,l*i,0,a*r,s*r+1,l*r,0,a*o,s*o,l*o+1,0,a*t.d,s*t.d,l*t.d,1,e)},n.FromXYZAxesToRef=function(t,e,i,r){n.FromValuesToRef(t._x,t._y,t._z,0,e._x,e._y,e._z,0,i._x,i._y,i._z,0,0,0,0,1,r)},n.FromQuaternionToRef=function(t,e){var i=t._x*t._x,r=t._y*t._y,o=t._z*t._z,a=t._x*t._y,s=t._z*t._w,l=t._z*t._x,u=t._y*t._w,f=t._y*t._z,h=t._x*t._w;e._m[0]=1-2*(r+o),e._m[1]=2*(a+s),e._m[2]=2*(l-u),e._m[3]=0,e._m[4]=2*(a-s),e._m[5]=1-2*(o+i),e._m[6]=2*(f+h),e._m[7]=0,e._m[8]=2*(l+u),e._m[9]=2*(f-h),e._m[10]=1-2*(r+i),e._m[11]=0,e._m[12]=0,e._m[13]=0,e._m[14]=0,e._m[15]=1,e._markAsUpdated()},n._updateFlagSeed=0,n._identityReadOnly=n.Identity(),n}(),lt=function(){function n(){}return n.Vector3=Zt.BuildArray(6,g.Zero),n.Matrix=Zt.BuildArray(2,N.Identity),n.Quaternion=Zt.BuildArray(3,ae.Zero),n}(),Q=function(){function n(){}return n.Vector2=Zt.BuildArray(3,le.Zero),n.Vector3=Zt.BuildArray(13,g.Zero),n.Vector4=Zt.BuildArray(3,gt.Zero),n.Quaternion=Zt.BuildArray(2,ae.Zero),n.Matrix=Zt.BuildArray(8,N.Identity),n}();oe.RegisteredTypes["BABYLON.Vector2"]=le;oe.RegisteredTypes["BABYLON.Vector3"]=g;oe.RegisteredTypes["BABYLON.Vector4"]=gt;oe.RegisteredTypes["BABYLON.Matrix"]=N;var K=function(){function n(t,e,i){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),this.r=t,this.g=e,this.b=i}return n.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},n.prototype.getClassName=function(){return"Color3"},n.prototype.getHashCode=function(){var t=this.r*255|0;return t=t*397^(this.g*255|0),t=t*397^(this.b*255|0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.toColor4=function(t){return t===void 0&&(t=1),new Se(this.r,this.g,this.b,t)},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toLuminance=function(){return this.r*.3+this.g*.59+this.b*.11},n.prototype.multiply=function(t){return new n(this.r*t.r,this.g*t.g,this.b*t.b)},n.prototype.multiplyToRef=function(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,this},n.prototype.equals=function(t){return t&&this.r===t.r&&this.g===t.g&&this.b===t.b},n.prototype.equalsFloats=function(t,e,i){return this.r===t&&this.g===e&&this.b===i},n.prototype.scale=function(t){return new n(this.r*t,this.g*t,this.b*t)},n.prototype.scaleToRef=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,this},n.prototype.clampToRef=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=1),i.r=de.Clamp(this.r,t,e),i.g=de.Clamp(this.g,t,e),i.b=de.Clamp(this.b,t,e),this},n.prototype.add=function(t){return new n(this.r+t.r,this.g+t.g,this.b+t.b)},n.prototype.addToRef=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,this},n.prototype.subtract=function(t){return new n(this.r-t.r,this.g-t.g,this.b-t.b)},n.prototype.subtractToRef=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,this},n.prototype.clone=function(){return new n(this.r,this.g,this.b)},n.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},n.prototype.copyFromFloats=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},n.prototype.set=function(t,e,i){return this.copyFromFloats(t,e,i)},n.prototype.toHexString=function(){var t=this.r*255|0,e=this.g*255|0,i=this.b*255|0;return"#"+de.ToHex(t)+de.ToHex(e)+de.ToHex(i)},n.prototype.toLinearSpace=function(){var t=new n;return this.toLinearSpaceToRef(t),t},n.prototype.toHSV=function(){var t=new n;return this.toHSVToRef(t),t},n.prototype.toHSVToRef=function(t){var e=this.r,i=this.g,r=this.b,o=Math.max(e,i,r),a=Math.min(e,i,r),s=0,l=0,u=o,f=o-a;o!==0&&(l=f/o),o!=a&&(o==e?(s=(i-r)/f,i<r&&(s+=6)):o==i?s=(r-e)/f+2:o==r&&(s=(e-i)/f+4),s*=60),t.r=s,t.g=l,t.b=u},n.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,nn),t.g=Math.pow(this.g,nn),t.b=Math.pow(this.b,nn),this},n.prototype.toGammaSpace=function(){var t=new n;return this.toGammaSpaceToRef(t),t},n.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,wr),t.g=Math.pow(this.g,wr),t.b=Math.pow(this.b,wr),this},n.HSVtoRGBToRef=function(t,e,i,r){var o=i*e,a=t/60,s=o*(1-Math.abs(a%2-1)),l=0,u=0,f=0;a>=0&&a<=1?(l=o,u=s):a>=1&&a<=2?(l=s,u=o):a>=2&&a<=3?(u=o,f=s):a>=3&&a<=4?(u=s,f=o):a>=4&&a<=5?(l=s,f=o):a>=5&&a<=6&&(l=o,f=s);var h=i-o;r.set(l+h,u+h,f+h)},n.FromHexString=function(t){if(t.substring(0,1)!=="#"||t.length!==7)return new n(0,0,0);var e=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return n.FromInts(e,i,r)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2])},n.FromArrayToRef=function(t,e,i){e===void 0&&(e=0),i.r=t[e],i.g=t[e+1],i.b=t[e+2]},n.FromInts=function(t,e,i){return new n(t/255,e/255,i/255)},n.Lerp=function(t,e,i){var r=new n(0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i},n.Red=function(){return new n(1,0,0)},n.Green=function(){return new n(0,1,0)},n.Blue=function(){return new n(0,0,1)},n.Black=function(){return new n(0,0,0)},Object.defineProperty(n,"BlackReadOnly",{get:function(){return n._BlackReadOnly},enumerable:!1,configurable:!0}),n.White=function(){return new n(1,1,1)},n.Purple=function(){return new n(.5,0,.5)},n.Magenta=function(){return new n(1,0,1)},n.Yellow=function(){return new n(1,1,0)},n.Gray=function(){return new n(.5,.5,.5)},n.Teal=function(){return new n(0,1,1)},n.Random=function(){return new n(Math.random(),Math.random(),Math.random())},n._BlackReadOnly=n.Black(),n}(),Se=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this.r=t,this.g=e,this.b=i,this.a=r}return n.prototype.addInPlace=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},n.prototype.asArray=function(){var t=new Array;return this.toArray(t,0),t},n.prototype.toArray=function(t,e){return e===void 0&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,this},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),n.FromArrayToRef(t,e,this),this},n.prototype.equals=function(t){return t&&this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},n.prototype.add=function(t){return new n(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},n.prototype.subtract=function(t){return new n(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},n.prototype.subtractToRef=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,this},n.prototype.scale=function(t){return new n(this.r*t,this.g*t,this.b*t,this.a*t)},n.prototype.scaleToRef=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,this},n.prototype.scaleAndAddToRef=function(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,e.a+=this.a*t,this},n.prototype.clampToRef=function(t,e,i){return t===void 0&&(t=0),e===void 0&&(e=1),i.r=de.Clamp(this.r,t,e),i.g=de.Clamp(this.g,t,e),i.b=de.Clamp(this.b,t,e),i.a=de.Clamp(this.a,t,e),this},n.prototype.multiply=function(t){return new n(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},n.prototype.multiplyToRef=function(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,e.a=this.a*t.a,e},n.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},n.prototype.getClassName=function(){return"Color4"},n.prototype.getHashCode=function(){var t=this.r*255|0;return t=t*397^(this.g*255|0),t=t*397^(this.b*255|0),t=t*397^(this.a*255|0),t},n.prototype.clone=function(){return new n(this.r,this.g,this.b,this.a)},n.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},n.prototype.copyFromFloats=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},n.prototype.set=function(t,e,i,r){return this.copyFromFloats(t,e,i,r)},n.prototype.toHexString=function(t){t===void 0&&(t=!1);var e=this.r*255|0,i=this.g*255|0,r=this.b*255|0;if(t)return"#"+de.ToHex(e)+de.ToHex(i)+de.ToHex(r);var o=this.a*255|0;return"#"+de.ToHex(e)+de.ToHex(i)+de.ToHex(r)+de.ToHex(o)},n.prototype.toLinearSpace=function(){var t=new n;return this.toLinearSpaceToRef(t),t},n.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,nn),t.g=Math.pow(this.g,nn),t.b=Math.pow(this.b,nn),t.a=this.a,this},n.prototype.toGammaSpace=function(){var t=new n;return this.toGammaSpaceToRef(t),t},n.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,wr),t.g=Math.pow(this.g,wr),t.b=Math.pow(this.b,wr),t.a=this.a,this},n.FromHexString=function(t){if(t.substring(0,1)!=="#"||t.length!==9)return new n(0,0,0,0);var e=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return n.FromInts(e,i,r,o)},n.Lerp=function(t,e,i){var r=new n(0,0,0,0);return n.LerpToRef(t,e,i,r),r},n.LerpToRef=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},n.FromColor3=function(t,e){return e===void 0&&(e=1),new n(t.r,t.g,t.b,e)},n.FromArray=function(t,e){return e===void 0&&(e=0),new n(t[e],t[e+1],t[e+2],t[e+3])},n.FromArrayToRef=function(t,e,i){e===void 0&&(e=0),i.r=t[e],i.g=t[e+1],i.b=t[e+2],i.a=t[e+3]},n.FromInts=function(t,e,i,r){return new n(t/255,e/255,i/255,r/255)},n.CheckColors4=function(t,e){if(t.length===e*3){for(var i=[],r=0;r<t.length;r+=3){var o=r/3*4;i[o]=t[r],i[o+1]=t[r+1],i[o+2]=t[r+2],i[o+3]=1}return i}return t},n}(),st=function(){function n(){}return n.Color3=Zt.BuildArray(3,K.Black),n.Color4=Zt.BuildArray(3,function(){return new Se(0,0,0,0)}),n}();oe.RegisteredTypes["BABYLON.Color3"]=K;oe.RegisteredTypes["BABYLON.Color4"]=Se;var Tt=function(){function n(t,e){this.triggerOptions=t,this.onBeforeExecuteObservable=new F,t.parameter?(this.trigger=t.trigger,this._triggerParameter=t.parameter):t.trigger?this.trigger=t.trigger:this.trigger=t,this._nextActiveAction=this,this._condition=e}return n.prototype._prepare=function(){},n.prototype.getTriggerParameter=function(){return this._triggerParameter},n.prototype._executeCurrent=function(t){if(this._nextActiveAction._condition){var e=this._nextActiveAction._condition,i=this._actionManager.getScene().getRenderId();if(e._evaluationId===i){if(!e._currentResult)return}else{if(e._evaluationId=i,!e.isValid()){e._currentResult=!1;return}e._currentResult=!0}}this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(t),this.skipToNextActiveAction()},n.prototype.execute=function(t){},n.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},n.prototype.then=function(t){return this._child=t,t._actionManager=this._actionManager,t._prepare(),t},n.prototype._getProperty=function(t){return this._actionManager._getProperty(t)},n.prototype._getEffectiveTarget=function(t,e){return this._actionManager._getEffectiveTarget(t,e)},n.prototype.serialize=function(t){},n.prototype._serialize=function(t,e){var i={type:1,children:[],name:t.name,properties:t.properties||[]};if(this._child&&this._child.serialize(i),this._condition){var r=this._condition.serialize();return r.children.push(i),e&&e.children.push(r),r}return e&&e.children.push(i),i},n._SerializeValueAsString=function(t){return typeof t=="number"?t.toString():typeof t=="boolean"?t?"true":"false":t instanceof le?t.x+", "+t.y:t instanceof g?t.x+", "+t.y+", "+t.z:t instanceof K?t.r+", "+t.g+", "+t.b:t instanceof Se?t.r+", "+t.g+", "+t.b+", "+t.a:t},n._GetTargetProperty=function(t){return{name:"target",targetType:t._isMesh?"MeshProperties":t._isLight?"LightProperties":t._isCamera?"CameraProperties":"SceneProperties",value:t._isScene?"Scene":t.name}},n}();oe.RegisteredTypes["BABYLON.Action"]=Tt;var Ut=function(){function n(t,e,i,r,o,a){this.source=t,this.pointerX=e,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=o,this.additionalData=a}return n.CreateNew=function(t,e,i){var r=t.getScene();return new n(t,r.pointerX,r.pointerY,r.meshUnderPointer||t,e,i)},n.CreateNewFromSprite=function(t,e,i,r){return new n(t,e.pointerX,e.pointerY,e.meshUnderPointer,i,r)},n.CreateNewFromScene=function(t,e){return new n(null,t.pointerX,t.pointerY,t.meshUnderPointer,e)},n.CreateNewFromPrimitive=function(t,e,i,r){return new n(t,e.x,e.y,null,i,r)},n}();/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -16014,7 +16014,7 @@ vReflectionMapTexCoord.z=worldPos.w;
16014
16014
  #endif
16015
16015
  #include<logDepthVertex>
16016
16016
  }
16017
- `;W.ShadersStore[KR]=QR;var ZR=function(n){w(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(oi),qR=function(n){w(t,n);function t(e,i,r){r===void 0&&(r=new le(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new K(1,1,1),o.specularColor=new K(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new le(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new K(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new K(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new ri(16),o._mesh=null,o._reflectionTransform=N.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new ZR);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&pe.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;pe.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(U.PrepareDefinesForFrameBoundValues(a,s,o,!!r),U.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=U.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(U.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new ai;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),U.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[S.PositionKind];o.NORMAL&&f.push(S.NormalKind),o.UV1&&f.push(S.UVKind),o.UV2&&f.push(S.UV2Kind),o.VERTEXCOLOR&&f.push(S.ColorKind),U.PrepareAttributesForBones(f,e,o,u),U.PrepareAttributesForInstances(f,o);var h="water",c=o.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],p=["normalSampler","refractionSampler","reflectionSampler"],_=new Array;kt&&(kt.PrepareUniforms(d,o),kt.PrepareSamplers(p,o)),U.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:_,samplers:p,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(h,{attributes:f,uniformsNames:d,uniformBuffersNames:_,samplers:p,defines:c,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),U.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&pe.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),U.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),U.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&U.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ee.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),U.BindFogParameters(o,i,this._activeEffect),U.BindLogDepth(a,this._activeEffect,o),pe.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new Gt(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new Gt(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=N.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Lr.FromPositionAndNormal(new g(0,u+.05,0),new g(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Lr.FromPositionAndNormal(new g(0,u-.05,0),new g(0,-1,0)),N.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=g.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return he.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=he.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=he.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=V.CreateGround(e,512,512,32,i,!1);return r},b([Me("bumpTexture")],t.prototype,"_bumpTexture",void 0),b([te("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),b([et()],t.prototype,"diffuseColor",void 0),b([et()],t.prototype,"specularColor",void 0),b([P()],t.prototype,"specularPower",void 0),b([P("disableLighting")],t.prototype,"_disableLighting",void 0),b([te("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),b([P("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),b([te("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),b([P()],t.prototype,"windForce",void 0),b([Wl()],t.prototype,"windDirection",void 0),b([P()],t.prototype,"waveHeight",void 0),b([P()],t.prototype,"bumpHeight",void 0),b([P("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),b([P("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),b([P("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),b([et()],t.prototype,"waterColor",void 0),b([P()],t.prototype,"colorBlendFactor",void 0),b([et()],t.prototype,"waterColor2",void 0),b([P()],t.prototype,"colorBlendFactor2",void 0),b([P()],t.prototype,"waveLength",void 0),b([P()],t.prototype,"waveSpeed",void 0),b([P()],t.prototype,"waveCount",void 0),b([P()],t.prototype,"disableClipPlane",void 0),b([P()],t.prototype,"useLogarithmicDepth",null),t}(_i);oe.RegisteredTypes["BABYLON.WaterMaterial"]=qR;function JR(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const $R=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function ex(n,t,e){async function i(u,f){return ne.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:h,z:c}=u;e.target.x=f||0,e.target.y=h||0,e.target.z=c||0}async function a(u){const{alpha:f,beta:h,radius:c}=u;f&&(e.alpha=e.alpha+f),h&&(e.beta=e.beta+h),c&&(e.radius=e.radius+c)}async function s(){const u=t.meshes.filter(d=>!d.name.toLowerCase().includes("collider")).reduce((d,p)=>d+Math.floor(p.getTotalIndices()/3),0),f=t.materials.length,h=t.meshes.length,c=t.textures.filter(d=>d.name&&!$R.includes(d.name)).length;return{triangles:u,materials:f,meshes:h,textures:c,bodies:h,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var tx={};const td=tx.VITE_REACT_APP_DEBUG;let jf=!1;const ix=async()=>{td&&!jf&&(await nd(()=>import("./babylon.inspector.bundle.max-BrQpwPpL.js").then(n=>n.b),__vite__mapDeps([0,1,2])),jf=!0)};function rx(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=g.Minimize(r,l),o=g.Maximize(o,u)}n.setBoundingInfo(new Jt(r,o))}}let Xn;async function nx(n,t){Xn&&Xn.dispose(),Xn=new se(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ee(Xn);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Se(0,0,0,0):pl(t.background.color).toColor4(),e.ambientColor=new K(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=Ts.CreateGround("ground",{width:6,height:6},e),l=Ts.CreateGround("ground",{width:6,height:6},e);l.rotate(It.Z,Math.PI),l.position.y=-.05;const u=new ed("groundMaterial",e);u.mainColor=new K(1,1,1),u.lineColor=new K(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=Ts.CreateCylinder("boundaries",{diameter:2,height:3}),h=new qe("boundariesMaterial",e);h.alpha=.3,h.diffuseColor=new K(1,45/255,85/255),f.material=h,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=du.CreateFullscreenUI("UI"),l=new _r;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Ln("camera",0,0,0,new g(0,0,0),e);switch(i.position=new g(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Te.PreviewProjection.PERSPECTIVE:{i.mode=Be.PERSPECTIVE_CAMERA;break}case Te.PreviewProjection.ORTHOGRAPHIC:{i.mode=Be.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Te.PreviewType.WEARABLE&&Hc(i,t),t.camera===Te.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new g(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Te.PreviewType.WEARABLE){const s=new mo("directional",new g(0,0,1),e);s.intensity=1;const l=new yo("spot",new g(-2,2,2),new g(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new Vr("top",new g(0,-1,0),e);o.intensity=1;const a=new Vr("bottom",new g(0,1,0),e);if(a.intensity=1,!JR()){const s=new Ya("glow",e);s.intensity=2}return Xn.runRenderLoop(()=>{e.render()}),td&&(await ix(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,ex(Xn,e,i)]}async function ox(n,t,e){const i=t.id,o=Ba(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new fu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function ax(n,t,e){const i=t.id,o=Ba(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new fu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function sx(n,t,e){return new Promise((i,r)=>{var u;const o=(u=t.contents.find(f=>e!==null?e?f.key.toLowerCase().endsWith(e.toLowerCase()):null:f.key.toLowerCase().endsWith(".mp3")||f.key.toLowerCase().endsWith("ogg")))==null?void 0:u.url;if(!o)return i(null);const a=new Uc("Sound task",o),s=()=>i(new ao("music",a.data,n,null,{spatialSound:!0})),l=f=>r(f);a.run(n,s,l)})}async function id(n,t){const e=async(i,r)=>ut.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function lx(n){const t=new V("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);rx(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new g(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var ux={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.10.0"};const fx=[Te.PreviewEmote.IDLE,Te.PreviewEmote.MONEY,Te.PreviewEmote.CLAP,Te.PreviewEmote.WALK,Te.PreviewEmote.RUN,Te.PreviewEmote.JUMP];let da;function hx(n){return fx.includes(n)}function cx(n){let t=ux.VITE_BASE_URL;t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function rd(n,t){const e=await id(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function dx(n,t,e){const i=zl(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return rd(n,r.url)}function px(n,t,e){const i=zl(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return sx(n,i,r)}async function _x(n,t,e,i){var u,f,h;let r,o=!!e.emote&&hx(e.emote),a=null;if(e.item&&Gl(e.item))try{r=await dx(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await px(n,e.item,e)}catch(c){console.warn(`Could not load emote=${e.item.id}`),fo(c,{phase:"loadEmoteFromWearable",emoteId:e.item.id})}if(!r&&e.emote){const c=cx(e.emote);r=await rd(n,c)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new jl("emote",n);function l(){if(e.camera!==Te.PreviewCamera.STATIC){const c=n.cameras[0];Hc(c,e)}}try{for(const d of t){const p=new Map,_=[...d.container.transformNodes,...d.container.meshes];for(const v of _){const m=v.name.replace(/\.\d+$/,""),y=p.get(m)||[];y.push(v),p.set(m,y)}if(r&&r.animationGroups.length>0){for(const v of r.animationGroups)if(!(e.socialEmote&&!iA(v,e.socialEmote)))for(const m of v.targetedAnimations){const y=m.animation.clone(),T=m.target,E=m.animation.getKeys();if(y.setKeys([...E]),e.socialEmote){const C=((u=e.socialEmote.Armature)==null?void 0:u.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature.animation.toLowerCase()),A=((f=e.socialEmote.Armature_Other)==null?void 0:f.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Other.animation.toLowerCase()),R=((h=e.socialEmote.Armature_Prop)==null?void 0:h.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Prop.animation.toLowerCase());if(C&&!A&&!R){const O=T.name.replace(/\.\d+$/,""),D=p.get(O)||[];if(D.length>0)for(const I of D){const x=y.clone();x.setKeys([...E]),s.addTargetedAnimation(x,I)}else console.warn("No matching bone found for",T.name)}else if(A){const O=T.name.replace(/\.\d+$/,""),D=p.get(O)||[];if(D.length>0)for(const I of D){const x=i==null?void 0:i.get(I);if(!x)continue;const L=y.clone();L.setKeys([...E]),s.addTargetedAnimation(L,x)}else console.warn("No matching bone found for",T.name)}else R&&s.addTargetedAnimation(y,T)}else if(r.animationGroups.length===1||v.name.toLowerCase().includes("avatar")||T.name.startsWith("Avatar_")){const A=T.name.replace(/\.\d+$/,""),R=p.get(A)||[];if(R.length>0)for(const O of R){const D=y.clone();D.setKeys([...E]),s.addTargetedAnimation(D,O)}else console.warn("No matching bone found for",T.name)}else s.addTargetedAnimation(y,T)}}}s.onAnimationGroupEndObservable.addOnce(l);const c=gx(s,o,a,e.item,e.socialEmote);return e.camera===Te.PreviewCamera.STATIC&&c.stop(),c}catch(c){console.warn(`Could not play emote=${e.emote}`,c),fo(c,{phase:"playEmote",emote:e.emote})}}function gx(n,t,e,i,r){se.audioEngine.useCustomUnlockedButton=!0,se.audioEngine.setGlobalVolume(1);let o,a=!1;async function s(){return Math.max(n.to,0)}async function l(){return n.isPlaying}async function u(){return!!e}async function f(A){a=!0;const R=await l();R&&n.pause(),n.stop(),n.start(!1,1,A,A,!1),o=A,a=!0,R&&h()}async function h(){await l()||(o?(n.start(t,1,o,await s(),!1),e&&(e.stop(),e._startOffset=o,e.play()),o=0):(n.play(t),e==null||e.play()))}async function c(){await l()&&(n.pause(),e==null||e.pause())}async function d(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function p(){e&&(se.audioEngine.unlock(),se.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function _(){e&&se.audioEngine.setGlobalVolume(0)}async function v(){return cd(i)}async function m(){return await v()?[{title:"Start Animation",...i.emoteDataADR74.startAnimation},...i.emoteDataADR74.outcomes.map(A=>({title:A.title,loop:A.loop,audio:A.audio,...A.clips}))]:null}async function y(){return r??null}const T=hd(),E=()=>(da&&clearInterval(da),window.setInterval(async()=>{var A;if(await l()&&n.animatables[0].masterFrame>0)return T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(A=n.animatables[0])==null?void 0:A.masterFrame})},10)),C=()=>{clearInterval(da),a||T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(da=E(),T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{T.emit(Te.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),a&&(d(),h(),a=!1),T.emit(Te.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(C(),t||(a=!1),T.emit(Te.PreviewEmoteEventType.ANIMATION_END))),{getLength:s,isPlaying:l,goTo:f,play:h,pause:c,stop:d,enableSound:p,disableSound:_,hasSound:u,events:T,emote:i,isSocialEmote:v,getSocialEmoteAnimations:m,getPlayingSocialEmoteAnimation:y}}function vx(n,t,e){return async i=>{const r=t.find(JS(i));return r?Promise.all([ax(n,r,e),ox(n,r,e)]):[null,null]}}async function mx(n,t,e){const i=vx(n,t,e),[r,o,a]=await Promise.all([i(Te.WearableCategory.EYES),i(Te.WearableCategory.EYEBROWS),i(Te.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function yx(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Ws(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Ws(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Ws(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Ws(n,t,e,i,r,o,a){const s=new qe(`${t}_standard_material`,n);s.alphaMode=Rt.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=K.Black(),i.hasAlpha=!0,s.sideOrientation=On.CW,s.diffuseTexture=i,s.diffuseColor=o?K.Black():pl(a),o&&(s.emissiveTexture=o,s.diffuseColor=pl(r)),e.material=s}function bx(n,t,e=Te.BodyShape.MALE){const i={};for(const r of n)try{const o=Ba(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=zl(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function Tx(n){const t=Kf(n.item)?[n.item,...n.wearables]:n.wearables,e=Gl(n.item)?n.item:void 0,i=bx(t,e,n.bodyShape);ut.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(h=>h.endsWith(l));return i[f]||a}}})}const Ex=`float angleY = 3.14 / 2.0;
16017
+ `;W.ShadersStore[KR]=QR;var ZR=function(n){w(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(oi),qR=function(n){w(t,n);function t(e,i,r){r===void 0&&(r=new le(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new K(1,1,1),o.specularColor=new K(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new le(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new K(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new K(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new ri(16),o._mesh=null,o._reflectionTransform=N.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new ZR);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&pe.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;pe.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(U.PrepareDefinesForFrameBoundValues(a,s,o,!!r),U.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=U.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(U.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new ai;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),U.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[S.PositionKind];o.NORMAL&&f.push(S.NormalKind),o.UV1&&f.push(S.UVKind),o.UV2&&f.push(S.UV2Kind),o.VERTEXCOLOR&&f.push(S.ColorKind),U.PrepareAttributesForBones(f,e,o,u),U.PrepareAttributesForInstances(f,o);var h="water",c=o.toString(),d=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],p=["normalSampler","refractionSampler","reflectionSampler"],_=new Array;kt&&(kt.PrepareUniforms(d,o),kt.PrepareSamplers(p,o)),U.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:_,samplers:p,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(h,{attributes:f,uniformsNames:d,uniformBuffersNames:_,samplers:p,defines:c,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),U.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&pe.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),U.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),U.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&U.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ee.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),U.BindFogParameters(o,i,this._activeEffect),U.BindLogDepth(a,this._activeEffect,o),pe.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new Gt(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new Gt(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=Tr.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=N.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Lr.FromPositionAndNormal(new g(0,u+.05,0),new g(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Lr.FromPositionAndNormal(new g(0,u-.05,0),new g(0,-1,0)),N.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=g.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return he.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=he.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=he.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=V.CreateGround(e,512,512,32,i,!1);return r},b([Me("bumpTexture")],t.prototype,"_bumpTexture",void 0),b([te("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),b([et()],t.prototype,"diffuseColor",void 0),b([et()],t.prototype,"specularColor",void 0),b([P()],t.prototype,"specularPower",void 0),b([P("disableLighting")],t.prototype,"_disableLighting",void 0),b([te("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),b([P("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),b([te("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),b([P()],t.prototype,"windForce",void 0),b([Wl()],t.prototype,"windDirection",void 0),b([P()],t.prototype,"waveHeight",void 0),b([P()],t.prototype,"bumpHeight",void 0),b([P("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),b([P("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),b([P("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),b([te("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),b([et()],t.prototype,"waterColor",void 0),b([P()],t.prototype,"colorBlendFactor",void 0),b([et()],t.prototype,"waterColor2",void 0),b([P()],t.prototype,"colorBlendFactor2",void 0),b([P()],t.prototype,"waveLength",void 0),b([P()],t.prototype,"waveSpeed",void 0),b([P()],t.prototype,"waveCount",void 0),b([P()],t.prototype,"disableClipPlane",void 0),b([P()],t.prototype,"useLogarithmicDepth",null),t}(_i);oe.RegisteredTypes["BABYLON.WaterMaterial"]=qR;function JR(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const $R=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function ex(n,t,e){async function i(u,f){return ne.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:h,z:c}=u;e.target.x=f||0,e.target.y=h||0,e.target.z=c||0}async function a(u){const{alpha:f,beta:h,radius:c}=u;f&&(e.alpha=e.alpha+f),h&&(e.beta=e.beta+h),c&&(e.radius=e.radius+c)}async function s(){const u=t.meshes.filter(d=>!d.name.toLowerCase().includes("collider")).reduce((d,p)=>d+Math.floor(p.getTotalIndices()/3),0),f=t.materials.length,h=t.meshes.length,c=t.textures.filter(d=>d.name&&!$R.includes(d.name)).length;return{triangles:u,materials:f,meshes:h,textures:c,bodies:h,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var tx={};const td=tx.VITE_REACT_APP_DEBUG;let jf=!1;const ix=async()=>{td&&!jf&&(await nd(()=>import("./babylon.inspector.bundle.max-rkZvcb6W.js").then(n=>n.b),__vite__mapDeps([0,1,2])),jf=!0)};function rx(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=g.Minimize(r,l),o=g.Maximize(o,u)}n.setBoundingInfo(new Jt(r,o))}}let Xn;async function nx(n,t){Xn&&Xn.dispose(),Xn=new se(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ee(Xn);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Se(0,0,0,0):pl(t.background.color).toColor4(),e.ambientColor=new K(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=Ts.CreateGround("ground",{width:6,height:6},e),l=Ts.CreateGround("ground",{width:6,height:6},e);l.rotate(It.Z,Math.PI),l.position.y=-.05;const u=new ed("groundMaterial",e);u.mainColor=new K(1,1,1),u.lineColor=new K(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=Ts.CreateCylinder("boundaries",{diameter:2,height:3}),h=new qe("boundariesMaterial",e);h.alpha=.3,h.diffuseColor=new K(1,45/255,85/255),f.material=h,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=du.CreateFullscreenUI("UI"),l=new _r;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Ln("camera",0,0,0,new g(0,0,0),e);switch(i.position=new g(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Te.PreviewProjection.PERSPECTIVE:{i.mode=Be.PERSPECTIVE_CAMERA;break}case Te.PreviewProjection.ORTHOGRAPHIC:{i.mode=Be.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Te.PreviewType.WEARABLE&&Hc(i,t),t.camera===Te.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new g(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Te.PreviewType.WEARABLE){const s=new mo("directional",new g(0,0,1),e);s.intensity=1;const l=new yo("spot",new g(-2,2,2),new g(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new Vr("top",new g(0,-1,0),e);o.intensity=1;const a=new Vr("bottom",new g(0,1,0),e);if(a.intensity=1,!JR()){const s=new Ya("glow",e);s.intensity=2}return Xn.runRenderLoop(()=>{e.render()}),td&&(await ix(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,ex(Xn,e,i)]}async function ox(n,t,e){const i=t.id,o=Ba(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new fu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function ax(n,t,e){const i=t.id,o=Ba(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new fu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function sx(n,t,e){return new Promise((i,r)=>{var u;const o=(u=t.contents.find(f=>e!==null?e?f.key.toLowerCase().endsWith(e.toLowerCase()):null:f.key.toLowerCase().endsWith(".mp3")||f.key.toLowerCase().endsWith("ogg")))==null?void 0:u.url;if(!o)return i(null);const a=new Uc("Sound task",o),s=()=>i(new ao("music",a.data,n,null,{spatialSound:!0})),l=f=>r(f);a.run(n,s,l)})}async function id(n,t){const e=async(i,r)=>ut.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function lx(n){const t=new V("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);rx(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new g(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var ux={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.10.2-22931365632.commit-accd8e4"};const fx=[Te.PreviewEmote.IDLE,Te.PreviewEmote.MONEY,Te.PreviewEmote.CLAP,Te.PreviewEmote.WALK,Te.PreviewEmote.RUN,Te.PreviewEmote.JUMP];let da;function hx(n){return fx.includes(n)}function cx(n){let t=ux.VITE_BASE_URL;t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function rd(n,t){const e=await id(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function dx(n,t,e){const i=zl(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return rd(n,r.url)}function px(n,t,e){const i=zl(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return sx(n,i,r)}async function _x(n,t,e,i){var u,f,h;let r,o=!!e.emote&&hx(e.emote),a=null;if(e.item&&Gl(e.item))try{r=await dx(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await px(n,e.item,e)}catch(c){console.warn(`Could not load emote=${e.item.id}`),fo(c,{phase:"loadEmoteFromWearable",emoteId:e.item.id})}if(!r&&e.emote){const c=cx(e.emote);r=await rd(n,c)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new jl("emote",n);function l(){if(e.camera!==Te.PreviewCamera.STATIC){const c=n.cameras[0];Hc(c,e)}}try{for(const d of t){const p=new Map,_=[...d.container.transformNodes,...d.container.meshes];for(const v of _){const m=v.name.replace(/\.\d+$/,""),y=p.get(m)||[];y.push(v),p.set(m,y)}if(r&&r.animationGroups.length>0){for(const v of r.animationGroups)if(!(e.socialEmote&&!iA(v,e.socialEmote)))for(const m of v.targetedAnimations){const y=m.animation.clone(),T=m.target,E=m.animation.getKeys();if(y.setKeys([...E]),e.socialEmote){const C=((u=e.socialEmote.Armature)==null?void 0:u.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature.animation.toLowerCase()),A=((f=e.socialEmote.Armature_Other)==null?void 0:f.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Other.animation.toLowerCase()),R=((h=e.socialEmote.Armature_Prop)==null?void 0:h.animation)&&v.name.toLowerCase().startsWith(e.socialEmote.Armature_Prop.animation.toLowerCase());if(C&&!A&&!R){const O=T.name.replace(/\.\d+$/,""),D=p.get(O)||[];if(D.length>0)for(const I of D){const x=y.clone();x.setKeys([...E]),s.addTargetedAnimation(x,I)}else console.warn("No matching bone found for",T.name)}else if(A){const O=T.name.replace(/\.\d+$/,""),D=p.get(O)||[];if(D.length>0)for(const I of D){const x=i==null?void 0:i.get(I);if(!x)continue;const L=y.clone();L.setKeys([...E]),s.addTargetedAnimation(L,x)}else console.warn("No matching bone found for",T.name)}else R&&s.addTargetedAnimation(y,T)}else if(r.animationGroups.length===1||v.name.toLowerCase().includes("avatar")||T.name.startsWith("Avatar_")){const A=T.name.replace(/\.\d+$/,""),R=p.get(A)||[];if(R.length>0)for(const O of R){const D=y.clone();D.setKeys([...E]),s.addTargetedAnimation(D,O)}else console.warn("No matching bone found for",T.name)}else s.addTargetedAnimation(y,T)}}}s.onAnimationGroupEndObservable.addOnce(l);const c=gx(s,o,a,e.item,e.socialEmote);return e.camera===Te.PreviewCamera.STATIC&&c.stop(),c}catch(c){console.warn(`Could not play emote=${e.emote}`,c),fo(c,{phase:"playEmote",emote:e.emote})}}function gx(n,t,e,i,r){se.audioEngine.useCustomUnlockedButton=!0,se.audioEngine.setGlobalVolume(1);let o,a=!1;async function s(){return Math.max(n.to,0)}async function l(){return n.isPlaying}async function u(){return!!e}async function f(A){a=!0;const R=await l();R&&n.pause(),n.stop(),n.start(!1,1,A,A,!1),o=A,a=!0,R&&h()}async function h(){await l()||(o?(n.start(t,1,o,await s(),!1),e&&(e.stop(),e._startOffset=o,e.play()),o=0):(n.play(t),e==null||e.play()))}async function c(){await l()&&(n.pause(),e==null||e.pause())}async function d(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function p(){e&&(se.audioEngine.unlock(),se.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function _(){e&&se.audioEngine.setGlobalVolume(0)}async function v(){return cd(i)}async function m(){return await v()?[{title:"Start Animation",...i.emoteDataADR74.startAnimation},...i.emoteDataADR74.outcomes.map(A=>({title:A.title,loop:A.loop,audio:A.audio,...A.clips}))]:null}async function y(){return r??null}const T=hd(),E=()=>(da&&clearInterval(da),window.setInterval(async()=>{var A;if(await l()&&n.animatables[0].masterFrame>0)return T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(A=n.animatables[0])==null?void 0:A.masterFrame})},10)),C=()=>{clearInterval(da),a||T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(da=E(),T.emit(Te.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{T.emit(Te.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),a&&(d(),h(),a=!1),T.emit(Te.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(C(),t||(a=!1),T.emit(Te.PreviewEmoteEventType.ANIMATION_END))),{getLength:s,isPlaying:l,goTo:f,play:h,pause:c,stop:d,enableSound:p,disableSound:_,hasSound:u,events:T,emote:i,isSocialEmote:v,getSocialEmoteAnimations:m,getPlayingSocialEmoteAnimation:y}}function vx(n,t,e){return async i=>{const r=t.find(JS(i));return r?Promise.all([ax(n,r,e),ox(n,r,e)]):[null,null]}}async function mx(n,t,e){const i=vx(n,t,e),[r,o,a]=await Promise.all([i(Te.WearableCategory.EYES),i(Te.WearableCategory.EYEBROWS),i(Te.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function yx(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Ws(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Ws(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Ws(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Ws(n,t,e,i,r,o,a){const s=new qe(`${t}_standard_material`,n);s.alphaMode=Rt.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=K.Black(),i.hasAlpha=!0,s.sideOrientation=On.CW,s.diffuseTexture=i,s.diffuseColor=o?K.Black():pl(a),o&&(s.emissiveTexture=o,s.diffuseColor=pl(r)),e.material=s}function bx(n,t,e=Te.BodyShape.MALE){const i={};for(const r of n)try{const o=Ba(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=zl(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function Tx(n){const t=Kf(n.item)?[n.item,...n.wearables]:n.wearables,e=Gl(n.item)?n.item:void 0,i=bx(t,e,n.bodyShape);ut.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(h=>h.endsWith(l));return i[f]||a}}})}const Ex=`float angleY = 3.14 / 2.0;
16018
16018
 
16019
16019
  mat3 rotateY = mat3(
16020
16020
  cos(angleY), 0, sin(angleY),
@@ -0,0 +1 @@
1
+ import{c as D,a as k,r as c,b as q,R as se,j as U}from"./index-B-zvrSa6.js";import{m as oe,d as i,u as ee,s as ie,f as de,a as ce,b as le,i as ue,g as ge,c as Se,e as z,h as $,j as me,k as Ee,l as fe,n as ye,o as F,p as v}from"./useController-BMlq20pQ.js";var G=(e=>(e.SET_MODE="SetMode",e.SET_PROFILE="SetProfile",e.SET_EMOTE="SetEmote",e.SET_URNS="SetUrns",e.SET_BACKGROUND="SetBackground",e.SET_SKIN_COLOR="SetSkinColor",e.SET_HAIR_COLOR="SetHairColor",e.SET_EYE_COLOR="SetEyeColor",e.SET_BODY_SHAPE="SetBodyShape",e.SET_SHOW_ANIMATION_REFERENCE="SetShowAnimationReference",e.SET_PROJECTION="SetProjection",e.ADD_BASE64="AddBase64",e.CLEAR_BASE64="ClearBase64",e.SET_CONTRACT="SetContract",e.SET_ITEM_ID="SetItemID",e.SET_TOKEN_ID="SetTokenID",e.SET_DISABLE_LOADER="SetDisableLoader",e.RELOAD="Reload",e.CLEANUP="Cleanup",e.GET_ELEMENT_BOUNDS="GetElementBounds",e))(G||{});const pe={unityMode:"SetMode",profile:"SetProfile",emote:"SetEmote",urns:"SetUrns",background:"SetBackground",skin:"SetSkinColor",hair:"SetHairColor",eyes:"SetEyeColor",bodyShape:"SetBodyShape",showAnimationReference:"SetShowAnimationReference",projection:"SetProjection",base64s:"AddBase64",contractAddress:"SetContract",itemId:"SetItemID",tokenId:"SetTokenID",disableLoader:"SetDisableLoader"},we={unityMode:e=>String(e),profile:e=>String(e),emote:e=>String(e),urns:e=>Array.isArray(e)?e.join(","):String(e),background:e=>typeof e=="string"?e.replace("#",""):String(e),skin:e=>typeof e=="string"?e.replace("#",""):String(e),hair:e=>typeof e=="string"?e.replace("#",""):String(e),eyes:e=>typeof e=="string"?e.replace("#",""):String(e),bodyShape:e=>String(e),showAnimationReference:e=>String(e),projection:e=>String(e),contractAddress:e=>String(e),itemId:e=>String(e),tokenId:e=>String(e),disableLoader:e=>String(e)},_=(e,r,n)=>{if(e)try{const t=String(r);Object.values(G).includes(t)||(console.warn(`Unknown Unity method: ${t}. Sending anyway...`),D(`Unknown Unity method: ${t}`,{method:t,value:n})),n!==void 0?e.SendMessage("JSBridge",t,n):e.SendMessage("JSBridge",t)}catch(t){console.error(`Failed to send Unity message ${r}:`,t),k(t,{method:String(r),value:n})}else console.warn(`Unity instance not ready, cannot send message: ${r}`),D(`Unity instance not ready, cannot send message: ${r}`,{method:String(r)})},he=(e,r,n)=>{if(!e){console.warn("Unity instance not available, cannot send override messages"),D("Unity instance not available, cannot send override messages");return}let t=0;r.base64s!==void 0&&n.base64s&&(_(e,"ClearBase64"),t++,Array.isArray(r.base64s)&&r.base64s.length>0&&r.base64s.forEach(a=>{_(e,"AddBase64",a),t++})),Object.entries(r).forEach(([a,s])=>{if(a!=="base64s"&&n[a]&&s!==void 0){const o=pe[a];if(o){const d=we[a],l=d?d(s):String(s);_(e,o,l),t++}else console.warn(`No Unity method mapping found for property: ${a}`),D(`No Unity method mapping found for property: ${a}`,{property:a,value:s})}}),t>0&&_(e,"Reload")};var Re={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.10.2-22931365632.commit-accd8e4"};const V=new Map,I=(e,r)=>{if(!r)return e;const n=e.replace(/\/$/,""),t=r.replace(/^\//,"");return`${n}/${t}`};function be(e){if(V.has(e))return V.get(e);const r=new Promise((n,t)=>{const a=document.querySelector(`script[src="${e}"]`);if(a){a.addEventListener("load",()=>n(a)),a.addEventListener("error",o=>t(o));return}const s=document.createElement("script");s.src=e,s.async=!0,s.onload=()=>n(s),s.onerror=o=>t(o),document.body.appendChild(s)});return V.set(e,r),r}const Pe=async(e,r,n,t,a,s,o,d,l,u,g,f)=>{try{const S=Re.VITE_BASE_URL||"";return await be(I(S,r)),await createUnityInstance(e,{dataUrl:I(S,n),frameworkUrl:I(S,t),codeUrl:I(S,a),streamingAssetsUrl:I(S,o),symbolUrl:I(S,s),companyName:d,productName:l,productVersion:u,matchWebGLToCanvasSize:g,arguments:f})}catch(S){throw console.error("❌ Failed to load Unity instance:",S),S}};function Te(e){return{getScreenshot:()=>new Promise(r=>{if(!e){r("");return}e.SendMessage("JSBridge","TakeScreenshot",""),window.addEventListener("message",function n(t){if(t.data.type==="unity-renderer"){const{type:a,payload:s}=t.data.payload;a==="screenshot"&&(window.removeEventListener("message",n),r(s))}})}),getMetrics:()=>new Promise(r=>{if(!e){r({triangles:0,materials:0,textures:0,meshes:0,bodies:0,entities:0});return}e.SendMessage("JSBridge","GetMetrics",""),window.addEventListener("message",function n(t){if(t.data.type==="unity-renderer"){const{type:a,payload:s}=t.data.payload;a==="metrics"&&(window.removeEventListener("message",n),r(s))}})}),changeZoom:async r=>{e&&e.SendMessage("JSBridge","SetZoom",r.toString())},panCamera:async r=>{if(!e)return;const n=r.x??0,t=r.y??0,a=r.z??0;e.SendMessage("JSBridge","SetOffset",`${n},${t},${a}`)},changeCameraPosition:async r=>{if(!e)return;const n=r.alpha??0,t=r.beta??0,a=r.radius??0;e.SendMessage("JSBridge","SetCameraPosition",`${n},${t},${a}`)},setUsername:async r=>{e&&e.SendMessage("JSBridge","SetUsername",r)},cleanup:async()=>{e&&e.SendMessage("JSBridge","Cleanup","")}}}function Le(e){const r=oe();return{getLength:async()=>new Promise(n=>{if(!e){n(0);return}e.SendMessage("JSBridge","GetEmoteLength",""),window.addEventListener("message",function t(a){if(a.data.type==="unity-renderer"){const{type:s,payload:o}=a.data.payload;s==="emoteLength"&&(window.removeEventListener("message",t),n(o))}})}),isPlaying:async()=>new Promise(n=>{if(!e){n(!1);return}e.SendMessage("JSBridge","IsEmotePlaying",""),window.addEventListener("message",function t(a){if(a.data.type==="unity-renderer"){const{type:s,payload:o}=a.data.payload;s==="isEmotePlaying"&&(window.removeEventListener("message",t),n(o))}})}),goTo:async n=>{e&&(e.SendMessage("JSBridge","GoToEmote",n.toString()),r.emit(i.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n}))},play:async()=>{e&&(e.SendMessage("JSBridge","PlayEmote",""),r.emit(i.PreviewEmoteEventType.ANIMATION_PLAY))},pause:async()=>{e&&(e.SendMessage("JSBridge","PauseEmote",""),r.emit(i.PreviewEmoteEventType.ANIMATION_PAUSE))},stop:async()=>{e&&(e.SendMessage("JSBridge","StopEmote",""),r.emit(i.PreviewEmoteEventType.ANIMATION_END))},enableSound:async()=>{e&&e.SendMessage("JSBridge","EnableSound","")},disableSound:async()=>{e&&e.SendMessage("JSBridge","DisableSound","")},hasSound:async()=>new Promise(n=>{if(!e){n(!1);return}e.SendMessage("JSBridge","HasSound",""),window.addEventListener("message",function t(a){if(a.data.type==="unity-renderer"){const{type:s,payload:o}=a.data.payload;s==="hasSound"&&(window.removeEventListener("message",t),n(o))}})}),events:r}}async function ve(e){let r=null;try{if(r=await Pe(e,"/unity/Build/aang-renderer.loader.js","/unity/Build/aang-renderer.data.br","/unity/Build/aang-renderer.framework.js.br","/unity/Build/aang-renderer.wasm.br","/unity/Build/aang-renderer.symbols.json.br","/emotes","Decentraland","AangRenderer","2.2.2",!0,[]),!r)throw new Error("Failed to load Unity instance");const n=Te(r),t=Le(r);return{scene:n,emote:t,unity:r}}catch(n){if(console.error("Unity render failed:",n),r!=null&&r.Quit)try{r.Quit()}catch(t){console.error("Error quitting Unity instance:",t),k(t,{phase:"unityQuit"})}throw n}}const Oe=()=>Math.floor(Math.random()*159)+1,re=()=>`default${Oe()}`,Ie=(e,r)=>{var n,t,a,s,o,d;return{eyes:z(r.eyes||((t=(n=e==null?void 0:e.avatar)==null?void 0:n.eyes)==null?void 0:t.color)&&$(e.avatar.eyes.color)||"#000000"),hair:z(r.hair||((s=(a=e==null?void 0:e.avatar)==null?void 0:a.hair)==null?void 0:s.color)&&$(e.avatar.hair.color)||"#000000"),skin:z(r.skin||((d=(o=e==null?void 0:e.avatar)==null?void 0:o.skin)==null?void 0:d.color)&&$(e.avatar.skin.color)||"#cc9b76")}},A=e=>e||"",K=e=>e||[],B=e=>e.replace("#","");function X(e){const r=new URL(window.location.href);Object.entries(e).forEach(([n,t])=>{r.searchParams.delete(n),Array.isArray(t)?t.forEach(a=>{a!==""&&r.searchParams.append(n,a)}):t!==""&&r.searchParams.set(n,t)}),window.history.replaceState({},"",r.toString())}function Ce(){const{options:e,overrideSources:r}=ee(),[n,t]=c.useState(null),[a,s]=c.useState(!0),[o,d]=c.useState(null),l=c.useRef(null),u=c.useRef(e),g=c.useRef(!0);return c.useEffect(()=>{const f=JSON.stringify(e),S=JSON.stringify(u.current);if(!g.current&&f===S)return;g.current=!1,u.current=e,(async()=>{var m,E;try{s(!0),d(null);const w=e.peerUrl||q.get("PEER_URL"),j=e.marketplaceServerUrl||e.nftServerUrl||q.get("MARKETPLACE_SERVER_URL");let C=i.PreviewType.WEARABLE,P={color:e.background||"#4b4852",transparent:e.disableBackground===!0};const T=ie(e.profile);let h=T==null?void 0:T.value;h==="default"&&(h=re());const y=h&&T?T.type==="address"?await de(h,w):await ce(h,w):null,R=e.bodyShape||((m=y==null?void 0:y.avatar)==null?void 0:m.bodyShape)||i.BodyShape.MALE;let p=null;if(e.contractAddress&&(p=await le({contractAddress:e.contractAddress,tokenId:e.tokenId,itemId:e.itemId,peerUrl:w,marketplaceServerUrl:j}),p&&ue(p))){P={...P,image:p.thumbnail};const M=ge(p);Se(M)&&(C=i.PreviewType.TEXTURE)}const{eyes:L,hair:H,skin:Y}=Ie(y,{eyes:e.eyes,hair:e.hair,skin:e.skin}),N=e.unityMode||null,te=e.camera&&Object.values(i.PreviewCamera).includes(e.camera)?e.camera:i.PreviewCamera.INTERACTIVE,Q=e.projection&&Object.values(i.PreviewProjection).includes(e.projection)?e.projection:i.PreviewProjection.PERSPECTIVE,O=e.disableDefaultEmotes?null:e.emote&&Object.values(i.PreviewEmote).includes(e.emote)?e.emote:i.PreviewEmote.IDLE,x={background:P,bodyShape:R,mode:N,projection:Q,type:C,base64:((E=e.base64s)==null?void 0:E[0])||null,contract:e.contractAddress||null,disableLoader:e.disableLoader||!1,emote:(O==null?void 0:O.toString())||null,eyeColor:L.replace("#",""),hairColor:H.replace("#",""),item:e.itemId||null,profile:h||null,skinColor:Y.replace("#",""),token:e.tokenId||null,urn:e.urns||null,showAnimationReference:null},ne=JSON.stringify(x),ae=JSON.stringify(l.current);if(ne!==ae){if(l.current=x,Object.keys(r).length===0){const M=K(e.urns),W=K(e.base64s);if(N===i.PreviewUnityMode.CONFIG){const J={mode:A(N||"")};X(J)}else{const J={background:P.transparent?"":B(P.color),disableLoader:e.disableLoader?"true":"",profile:A(h||""),bodyShape:A(R||""),eyeColor:B(L||""),hairColor:B(H||""),skinColor:B(Y||""),mode:A(N||""),camera:te,projection:Q,emote:A((O==null?void 0:O.toString())||""),urn:M.length>0?M:[""],base64:W.length>0?W:[""]};X(J)}}t(x)}s(!1)}catch(w){console.error("[useUnityConfig] Failed to load config:",w),d(w instanceof Error?w.message:"Failed to load config"),s(!1)}})()},[e,r]),[n,a,o]}const Ae="unity-renderer",_e="unity-canvas",Z=1,Ne="Failed to load Unity";var Me=(e=>(e.LOADED="loaded",e.ERROR="error",e.SCREENSHOT="screenshot",e.CUSTOMIZATION_DONE="customization-done",e.CUSTOMIZATION_STEP="avatar-customization-step",e.ELEMENT_BOUNDS="element-bounds",e))(Me||{});const Ue="get_element_bounds",Be="element_bounds_response",De=(e,r,n,t)=>{const[a,s]=c.useState({isLoaded:!1,isInitialized:!1,error:null}),o=c.useCallback(l=>{if(l.data.type===Ae){const{type:u,payload:g}=l.data.payload;u==="loaded"&&(g===!0||g==="true")?(s(f=>({...f,isLoaded:!0,isInitialized:!0})),i.sendMessage(v(),i.PreviewMessageType.LOAD,{renderer:i.PreviewRenderer.UNITY})):u==="customization-done"?i.sendMessage(v(),i.PreviewMessageType.CONTROLLER_RESPONSE,{id:"customization-done",ok:!0,result:JSON.parse(l.data.payload.payload)}):u==="avatar-customization-step"?i.sendMessage(v(),i.PreviewMessageType.CONTROLLER_RESPONSE,{id:"avatar-customization-step",ok:!0,result:{step:l.data.payload.payload}}):u==="element-bounds"?i.sendMessage(v(),Be,g):u==="error"&&(k(new Error(g),{component:"UnityPreview",phase:"unityMessage"}),s(f=>({...f,error:g})),i.sendMessage(v(),i.PreviewMessageType.ERROR,{message:"Error loading the wearable. Please try again."}))}},[]),d=c.useCallback(async()=>{if(!(!e.canvas.current||e.isInitializing.current||e.unityInstance.current)){e.isInitializing.current=!0,s(l=>({...l,isLoaded:!1,error:null}));try{const{unity:l,scene:u,emote:g}=await ve(e.canvas.current);e.unityInstance.current=l,r.current={scene:u,emote:g},s(f=>({...f,isLoaded:!0,isInitialized:!0})),i.sendMessage(v(),i.PreviewMessageType.LOAD,{renderer:i.PreviewRenderer.UNITY})}catch(l){const u=l instanceof Error?l.message:Ne;console.error("Unity init failed:",l),k(l,{component:"UnityPreview",phase:"initializeUnity"}),s(g=>({...g,error:u})),i.sendMessage(v(),i.PreviewMessageType.ERROR,{message:u})}finally{e.isInitializing.current=!1}}},[e,r]);return c.useEffect(()=>{a.isInitialized||t||!n||d()},[n,t,a.isInitialized,d]),c.useEffect(()=>{if(n)return window.addEventListener("message",o,!1),()=>{window.removeEventListener("message",o,!1)}},[n,o]),a},ke=e=>{const[r,n]=c.useState({pixelRatio:window.devicePixelRatio||Z,is3D:!0,backgroundImage:""});return c.useEffect(()=>{const t=()=>{n(s=>({...s,pixelRatio:window.devicePixelRatio||Z}))},a=window.matchMedia(`(resolution: ${r.pixelRatio}dppx)`);return a.addEventListener("change",t),()=>{a.removeEventListener("change",t)}},[r.pixelRatio]),c.useEffect(()=>{e&&n(t=>({...t,backgroundImage:e.background.image||"",is3D:e.type!==i.PreviewType.TEXTURE}))},[e]),r},je=(e,r,n,t,a)=>{const s=c.useMemo(()=>{const o={};for(const d of Object.keys(a))a[d]&&t[d]!==void 0&&(o[d]=t[d]);return o},[a,t]);c.useEffect(()=>{if(!(!n.isInitialized||!n.isLoaded||!e.current)){if(s.profile==="default"){const o=r.current.profile;s.profile=o!=null&&o.match(/^default\d+$/)?o:re()}Object.keys(s).length>0&&(he(e.current,s,a),r.current=s)}},[n.isInitialized,n.isLoaded,s,a,e,r])},xe=()=>{const{width:e=window.innerWidth,height:r=window.innerHeight}=me(),n=c.useRef(null),t=c.useRef(null),a=c.useRef(!1),s=c.useRef({}),o=Ee(),[d,l,u]=Ce(),{options:g,overrideSources:f}=ee(),S=c.useMemo(()=>({canvas:n,unityInstance:t,isInitializing:a,lastSentOverrides:s}),[]);fe(y=>{var R,p;if(((R=y.data)==null?void 0:R.type)===Ue&&t.current){const L=(p=y.data.payload)==null?void 0:p.elementName;L&&_(t.current,G.GET_ELEMENT_BOUNDS,L)}});const b=De(S,o,d,l),m=ke(d);je(S.unityInstance,S.lastSentOverrides,b,g,f),ye();const E=c.useMemo(()=>{const y=b.error||u,R=!b.isLoaded&&!y,p=!!m.backgroundImage&&!m.is3D&&!R,L=m.is3D&&!R;return{error:y,isLoading:R,showImage:p,showCanvas:L}},[b.error,b.isLoaded,u,m.backgroundImage,m.is3D]),w=c.useMemo(()=>({opacity:1,backgroundColor:!(d!=null&&d.background.transparent)&&(d==null?void 0:d.type)===i.PreviewType.TEXTURE?d.background.color:void 0}),[d]),j=c.useMemo(()=>({width:`${e}px`,height:`${r}px`}),[e,r]),C=c.useMemo(()=>({width:Math.round(e*m.pixelRatio),height:Math.round(r*m.pixelRatio)}),[e,r,m.pixelRatio]),P=c.useMemo(()=>F("Preview",{"is-loading":E.isLoading,"is-loaded":b.isLoaded,"is-3d":m.is3D,"has-error":!!E.error}),[E.isLoading,b.isLoaded,m.is3D,E.error]),T=c.useMemo(()=>F("thumbnail",{"is-visible":E.showImage}),[E.showImage]),h=c.useMemo(()=>F({"is-visible":E.showCanvas}),[E.showCanvas]);return U.jsxs("div",{className:P,style:w,children:[U.jsx("img",{src:m.backgroundImage,className:T,alt:"preview"}),U.jsx("canvas",{ref:S.canvas,id:_e,className:h,width:C.width,height:C.height,style:j}),E.error&&U.jsx("div",{className:"error",children:E.error})]})},$e=se.memo(xe);export{Me as UnityMessageType,$e as default};