@dcl/wearable-preview 2.13.1-24086313373.commit-94ac427 → 2.13.1-24096673885.commit-cf09103

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/babylon.inspector.bundle.max-BshTwI20.js","assets/index-VRKZM3V3.js","assets/index-xcSM2Xhy.css"])))=>i.map(i=>d[i]);
2
- import{r as Ri,a as uo,_ as nd,R as od,j as na}from"./index-VRKZM3V3.js";import{u as ad,v as sd,g as ld,e as Yf,w as ud,d as Oe,c as Kf,x as fd,y as Na,r as kl,z as Gl,m as hd,i as cd,A as dd,B as gu,k as pd,l as _d,t as gd,q as vu,o as vd,p as es}from"./emote-events-B-dYr8DT.js";const da={};function ts(n,t){return t===da[n]}function md(n,t,e=[]){const[i,r]=Ri.useState(!1),[o,a]=Ri.useState(null),[s,l]=Ri.useState("");return typeof da[n]>"u"&&(da[n]=0),Ri.useEffect(()=>{const u=++da[n];r(!0),t().then(f=>{ts(n,u)&&a(f)}).catch(f=>{uo(f,{phase:"useAsync",id:n}),ts(n,u)&&l(f.message)}).finally(()=>{ts(n,u)&&r(!1)})},e),[o,i,s]}function yd(){const{options:n}=ad(),[t,e,i]=md("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}(),Xn=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}(),bd=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}(),Td=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}(),N=function(){function n(t){this._observers=new Array,this._eventState=new bd(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 Td(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];F.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 F.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];F.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}(),F=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),Pe=+(r*z-o*q+a*J),we=-(i*z-o*k+a*j),Ee=+(i*q-r*k+a*ie),je=-(i*J-r*j+o*ie),Fe=-(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,Pe*B,Fe*B,I*B,ce*B,we*B,De*B,x*B,be*B,Ee*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,F.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,F.Identity),n}();oe.RegisteredTypes["BABYLON.Vector2"]=le;oe.RegisteredTypes["BABYLON.Vector3"]=g;oe.RegisteredTypes["BABYLON.Vector4"]=gt;oe.RegisteredTypes["BABYLON.Matrix"]=F;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 Ce(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}(),Ce=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 Ce(0,0,0,0)}),n}();oe.RegisteredTypes["BABYLON.Color3"]=K;oe.RegisteredTypes["BABYLON.Color4"]=Ce;var Tt=function(){function n(t,e){this.triggerOptions=t,this.onBeforeExecuteObservable=new N,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 Ce?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-DGZCBG-7.js","assets/index-KYuRa154.js","assets/index-xcSM2Xhy.css"])))=>i.map(i=>d[i]);
2
+ import{r as Ri,a as uo,_ as nd,R as od,j as na}from"./index-KYuRa154.js";import{u as ad,v as sd,g as ld,e as Yf,w as ud,d as Oe,c as Kf,x as fd,y as Na,r as kl,z as Gl,m as hd,i as cd,A as dd,B as gu,k as pd,l as _d,t as gd,q as vu,o as vd,p as es}from"./emote-events-R7O4OQgI.js";const da={};function ts(n,t){return t===da[n]}function md(n,t,e=[]){const[i,r]=Ri.useState(!1),[o,a]=Ri.useState(null),[s,l]=Ri.useState("");return typeof da[n]>"u"&&(da[n]=0),Ri.useEffect(()=>{const u=++da[n];r(!0),t().then(f=>{ts(n,u)&&a(f)}).catch(f=>{uo(f,{phase:"useAsync",id:n}),ts(n,u)&&l(f.message)}).finally(()=>{ts(n,u)&&r(!1)})},e),[o,i,s]}function yd(){const{options:n}=ad(),[t,e,i]=md("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}(),Xn=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}(),bd=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}(),Td=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}(),N=function(){function n(t){this._observers=new Array,this._eventState=new bd(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 Td(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];F.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 F.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];F.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}(),F=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),Pe=+(r*z-o*q+a*J),we=-(i*z-o*k+a*j),Ee=+(i*q-r*k+a*ie),je=-(i*J-r*j+o*ie),Fe=-(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,Pe*B,Fe*B,I*B,ce*B,we*B,De*B,x*B,be*B,Ee*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,F.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,F.Identity),n}();oe.RegisteredTypes["BABYLON.Vector2"]=le;oe.RegisteredTypes["BABYLON.Vector3"]=g;oe.RegisteredTypes["BABYLON.Vector4"]=gt;oe.RegisteredTypes["BABYLON.Matrix"]=F;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 Ce(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}(),Ce=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 Ce(0,0,0,0)}),n}();oe.RegisteredTypes["BABYLON.Color3"]=K;oe.RegisteredTypes["BABYLON.Color4"]=Ce;var Tt=function(){function n(t,e){this.triggerOptions=t,this.onBeforeExecuteObservable=new N,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 Ce?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[QR]=ZR;var qR=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),JR=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=F.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 qR);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!==Te.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=F.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)),F.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([xe("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([zl()],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"]=JR;function $R(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const ex=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function tx(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&&!ex.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 ix={};const td=ix.VITE_REACT_APP_DEBUG;let jf=!1;const rx=async()=>{td&&!jf&&(await nd(()=>import("./babylon.inspector.bundle.max-BshTwI20.js").then(n=>n.b),__vite__mapDeps([0,1,2])),jf=!0)};function nx(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 jn;async function ox(n,t){jn&&jn.dispose(),jn=new se(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Te(jn);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Ce(0,0,0,0):dl(t.background.color).toColor4(),e.ambientColor=new K(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=bs.CreateGround("ground",{width:6,height:6},e),l=bs.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=bs.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=cu.CreateFullscreenUI("UI"),l=new _r;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new wn("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 Oe.PreviewProjection.PERSPECTIVE:{i.mode=Be.PERSPECTIVE_CAMERA;break}case Oe.PreviewProjection.ORTHOGRAPHIC:{i.mode=Be.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Oe.PreviewType.WEARABLE&&Hc(i,t),t.camera===Oe.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===Oe.PreviewType.WEARABLE){const s=new vo("directional",new g(0,0,1),e);s.intensity=1;const l=new mo("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,!$R()){const s=new Xa("glow",e);s.intensity=2}return jn.runRenderLoop(()=>{e.render()}),td&&(await rx(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,tx(jn,e,i)]}async function ax(n,t,e){const i=t.id,o=Na(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new uu(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 sx(n,t,e){const i=t.id,o=Na(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 uu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function lx(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 oo("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 ux(n){const t=new V("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);nx(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 fx={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.13.1-24086313373.commit-94ac427"};const hx=[Oe.PreviewEmote.IDLE,Oe.PreviewEmote.MONEY,Oe.PreviewEmote.CLAP,Oe.PreviewEmote.WALK,Oe.PreviewEmote.RUN,Oe.PreviewEmote.JUMP];let ca;function cx(n){return hx.includes(n)}function dx(n){let t=fx.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 px(n,t,e){const i=Gl(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 _x(n,t,e){const i=Gl(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return lx(n,i,r)}async function gx(n,t,e,i){var u,f,h;let r,o=!!e.emote&&cx(e.emote),a=null;if(e.item&&kl(e.item))try{r=await px(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await _x(n,e.item,e)}catch(c){console.warn(`Could not load emote=${e.item.id}`),uo(c,{phase:"loadEmoteFromWearable",emoteId:e.item.id})}if(!r&&e.emote){const c=dx(e.emote);r=await rd(n,c)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new Hl("emote",n);function l(){if(e.camera!==Oe.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&&!rA(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=vx(s,o,a,e.item,e.socialEmote);return e.camera===Oe.PreviewCamera.STATIC&&c.stop(),c}catch(c){console.warn(`Could not play emote=${e.emote}`,c),uo(c,{phase:"playEmote",emote:e.emote})}}function vx(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=()=>(ca&&clearInterval(ca),window.setInterval(async()=>{var A;if(await l()&&n.animatables[0].masterFrame>0)return T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(A=n.animatables[0])==null?void 0:A.masterFrame})},10)),C=()=>{clearInterval(ca),a||T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(ca=E(),T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{T.emit(Oe.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),a&&(d(),h(),a=!1),T.emit(Oe.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(C(),t||(a=!1),T.emit(Oe.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 mx(n,t,e){return async i=>{const r=t.find($S(i));return r?Promise.all([sx(n,r,e),ax(n,r,e)]):[null,null]}}async function yx(n,t,e){const i=mx(n,t,e),[r,o,a]=await Promise.all([i(Oe.WearableCategory.EYES),i(Oe.WearableCategory.EYEBROWS),i(Oe.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function bx(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?zs(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?zs(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?zs(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function zs(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=Mn.CW,s.diffuseTexture=i,s.diffuseColor=o?K.Black():dl(a),o&&(s.emissiveTexture=o,s.diffuseColor=dl(r)),e.material=s}function Tx(n,t,e=Oe.BodyShape.MALE){const i={};for(const r of n)try{const o=Na(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=Gl(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function Ex(n){const t=Kf(n.item)?[n.item,...n.wearables]:n.wearables,e=kl(n.item)?n.item:void 0,i=Tx(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 Cx=`float angleY = 3.14 / 2.0;
16017
+ `;W.ShadersStore[QR]=ZR;var qR=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),JR=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=F.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 qR);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!==Te.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=F.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)),F.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([xe("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([zl()],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"]=JR;function $R(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const ex=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function tx(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&&!ex.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 ix={};const td=ix.VITE_REACT_APP_DEBUG;let jf=!1;const rx=async()=>{td&&!jf&&(await nd(()=>import("./babylon.inspector.bundle.max-DGZCBG-7.js").then(n=>n.b),__vite__mapDeps([0,1,2])),jf=!0)};function nx(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 jn;async function ox(n,t){jn&&jn.dispose(),jn=new se(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Te(jn);if(e.autoClear=!0,e.clearColor=t.background.transparent?new Ce(0,0,0,0):dl(t.background.color).toColor4(),e.ambientColor=new K(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=bs.CreateGround("ground",{width:6,height:6},e),l=bs.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=bs.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=cu.CreateFullscreenUI("UI"),l=new _r;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new wn("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 Oe.PreviewProjection.PERSPECTIVE:{i.mode=Be.PERSPECTIVE_CAMERA;break}case Oe.PreviewProjection.ORTHOGRAPHIC:{i.mode=Be.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Oe.PreviewType.WEARABLE&&Hc(i,t),t.camera===Oe.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===Oe.PreviewType.WEARABLE){const s=new vo("directional",new g(0,0,1),e);s.intensity=1;const l=new mo("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,!$R()){const s=new Xa("glow",e);s.intensity=2}return jn.runRenderLoop(()=>{e.render()}),td&&(await rx(),e.debugLayer.show({showExplorer:!0,embedMode:!0})),[e,tx(jn,e,i)]}async function ax(n,t,e){const i=t.id,o=Na(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new uu(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 sx(n,t,e){const i=t.id,o=Na(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 uu(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function lx(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 oo("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 ux(n){const t=new V("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);nx(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 fx={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.13.1-24096673885.commit-cf09103"};const hx=[Oe.PreviewEmote.IDLE,Oe.PreviewEmote.MONEY,Oe.PreviewEmote.CLAP,Oe.PreviewEmote.WALK,Oe.PreviewEmote.RUN,Oe.PreviewEmote.JUMP];let ca;function cx(n){return hx.includes(n)}function dx(n){let t=fx.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 px(n,t,e){const i=Gl(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 _x(n,t,e){const i=Gl(t,e.bodyShape),r=e.socialEmote?e.socialEmote.audio:null;return lx(n,i,r)}async function gx(n,t,e,i){var u,f,h;let r,o=!!e.emote&&cx(e.emote),a=null;if(e.item&&kl(e.item))try{r=await px(n,e.item,e),o=e.socialEmote?e.socialEmote.loop:e.item.emoteDataADR74.loop,a=await _x(n,e.item,e)}catch(c){console.warn(`Could not load emote=${e.item.id}`),uo(c,{phase:"loadEmoteFromWearable",emoteId:e.item.id})}if(!r&&e.emote){const c=dx(e.emote);r=await rd(n,c)}r&&r.animationGroups.length>1&&(r.addAllToScene(),n.stopAllAnimations());const s=new Hl("emote",n);function l(){if(e.camera!==Oe.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&&!rA(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=vx(s,o,a,e.item,e.socialEmote);return e.camera===Oe.PreviewCamera.STATIC&&c.stop(),c}catch(c){console.warn(`Could not play emote=${e.emote}`,c),uo(c,{phase:"playEmote",emote:e.emote})}}function vx(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=()=>(ca&&clearInterval(ca),window.setInterval(async()=>{var A;if(await l()&&n.animatables[0].masterFrame>0)return T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(A=n.animatables[0])==null?void 0:A.masterFrame})},10)),C=()=>{clearInterval(ca),a||T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(ca=E(),T.emit(Oe.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{T.emit(Oe.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),a&&(d(),h(),a=!1),T.emit(Oe.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(C(),t||(a=!1),T.emit(Oe.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 mx(n,t,e){return async i=>{const r=t.find($S(i));return r?Promise.all([sx(n,r,e),ax(n,r,e)]):[null,null]}}async function yx(n,t,e){const i=mx(n,t,e),[r,o,a]=await Promise.all([i(Oe.WearableCategory.EYES),i(Oe.WearableCategory.EYEBROWS),i(Oe.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function bx(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?zs(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?zs(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?zs(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function zs(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=Mn.CW,s.diffuseTexture=i,s.diffuseColor=o?K.Black():dl(a),o&&(s.emissiveTexture=o,s.diffuseColor=dl(r)),e.material=s}function Tx(n,t,e=Oe.BodyShape.MALE){const i={};for(const r of n)try{const o=Na(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=Gl(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function Ex(n){const t=Kf(n.item)?[n.item,...n.wearables]:n.wearables,e=kl(n.item)?n.item:void 0,i=Tx(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 Cx=`float angleY = 3.14 / 2.0;
16018
16018
 
16019
16019
  mat3 rotateY = mat3(
16020
16020
  cos(angleY), 0, sin(angleY),
@@ -16056,4 +16056,4 @@ else
16056
16056
  }
16057
16057
  `,Ws="#include<pbrBlockFinalColorComposition>",Xf="#include<customToonShading>";if(W.ShadersStore.pbrPixelShader.includes(Ws))W.ShadersStore.pbrPixelShader.includes(Xf)||(W.ShadersStore.pbrPixelShader=W.ShadersStore.pbrPixelShader.replace(Ws,Ws+`
16058
16058
  `+Xf+`
16059
- `));else throw new Error("could not patch the pbrPixelShader");W.IncludesShadersStore.customToonShading=Cx;async function Hs(n,t,e=Oe.BodyShape.MALE,i,r){const o=Na(t,e);if(Yf(o))throw new Error(`The wearable="${t.id}" is a texture`);const a=dd(o),s=await id(n,a);for(const l of s.meshes)l.name.toLowerCase().includes("collider")&&(l.isVisible=!1,n.removeMesh(l));for(const l of s.materials)if(l instanceof Rt){const u=l;u.specularIntensity=0,u.metallic&&(u.metallic=0,u.metallicF0Factor=0),u.name.toLowerCase().includes("hair")&&(r?(u.albedoColor=K.FromHexString(r).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u))),u.name.toLowerCase().includes("skin")&&(i?(u.albedoColor=K.FromHexString(i).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u)))}for(const l of s.animationGroups)l.stop(),l.reset(),l.dispose();return{container:s,wearable:t}}async function Sx(n,t){const[e,i]=await ox(n,t);try{Ex(t);let r;const o=[];if(t.type===Oe.PreviewType.AVATAR){const s=fA(t),l=Array.from(s.values());for(const d of l.filter(zc)){const p=Hs(e,d,t.bodyShape,t.skin,t.hair).catch(_=>{console.warn(_.message),uo(_,{phase:"loadWearable",bodyShape:t.bodyShape})});o.push(p)}let u=null;t.socialEmote&&t.socialEmote.Armature_Other&&(u=new V("parent_other",e));const f=new Map,h=(await Promise.all(o)).filter(tA);for(const d of h)if(d.container.addAllToScene(),u){const p=d.container.instantiateModelsToScene(T=>`${T}_Other`),v=K.FromHexString("#c9c9c9").toLinearSpace(),m=p.rootNodes;for(const T of m)T.setParent(u);aA(m,v);const y=oA(d.container,m);for(const[T,E]of y)f.set(T,E)}const c=sA(h);if(c){const d=l.filter(iA),{eyes:p,eyebrows:_,mouth:v}=await yx(e,d,t.bodyShape);bx(e,c,p,_,v,t)}r=await gx(e,h,t,f)||gu()}else{const s=t.item;if(s&&!kl(s))try{(await Hs(e,s,t.bodyShape,t.skin,t.hair)).container.addAllToScene()}catch{(await Hs(e,s,t.bodyShape===Oe.BodyShape.MALE?Oe.BodyShape.FEMALE:Oe.BodyShape.MALE,t.skin,t.hair)).container.addAllToScene()}r=gu()}return t.centerBoundingBox&&ux(e),{scene:i,emote:r}}catch(r){throw e.clearColor=new Ce(0,0,0,0),r}}const Ax=()=>{const[n,t]=Ri.useState(""),{width:e,height:i}=pd(),[r,o]=Ri.useState({}),[a,s]=Ri.useState(!1),[l,u]=Ri.useState(!0),[f,h]=Ri.useState(!1),c=Ri.useRef(null),d=_d(),[p,_,v]=yd(),[m,y]=Ri.useState(""),[T,E]=Ri.useState(!0),[C,A]=Ri.useState(!1),R=n||v,O=(l||_)&&!R,D=!!m&&!T&&!O,I=T&&!O;return Ri.useEffect(()=>{let x=()=>{};if(c.current&&p){let L={opacity:1};p.background.image&&(y(p.background.image),L.opacity=1,!p.background.transparent&&p.type===Oe.PreviewType.TEXTURE&&(L.backgroundColor=p.background.color)),o(L),p.type===Oe.PreviewType.TEXTURE?(E(!1),u(!1),h(!0)):Sx(c.current,p).then(Y=>{d.current=Y,x=gd(d.current)}).catch(Y=>{uo(Y,{component:"Preview",phase:"render"}),t(Y.message)}).finally(()=>{u(!1),h(!0)})}return()=>{x()}},[c.current,p]),Ri.useEffect(()=>{var x;C||(f?(Oe.sendMessage(vu(),Oe.PreviewMessageType.LOAD,{renderer:Oe.PreviewRenderer.BABYLON}),A(!0),((p==null?void 0:p.type)===Oe.PreviewType.AVATAR||p!=null&&p.emote&&p.emote!==Oe.PreviewEmote.IDLE)&&((x=d.current)==null||x.emote.play())):R&&(uo(new Error(R),{component:"Preview",phase:"sendErrorToParent"}),Oe.sendMessage(vu(),Oe.PreviewMessageType.ERROR,{message:R}),A(!0)))},[f,R,C,d,p==null?void 0:p.type,p==null?void 0:p.emote]),Ri.useEffect(()=>{if(_){let x=!1;l||(u(!0),x=!0),C&&(A(!1),x=!0),x&&f&&h(!1)}},[_,l,C,f]),vd(),na.jsxs("div",{className:es("Preview",{"is-dragging":a,"is-loading":O,"is-loaded":f,"is-3d":T&&(p==null?void 0:p.camera)===Oe.PreviewCamera.INTERACTIVE,"has-error":!!R,"no-fade-effect":p&&!p.fadeEffect}),style:r,children:[na.jsx("img",{src:m,className:es("thumbnail",{"is-visible":D}),alt:"preview"}),na.jsx("canvas",{id:"wearable-preview",className:es({"is-visible":I}),width:e,height:i,ref:c,onMouseDown:()=>s(T&&!R),onMouseUp:()=>s(!1)}),R&&na.jsx("div",{className:"error",children:R})]})},Px=od.memo(Ax),AO=Object.freeze(Object.defineProperty({__proto__:null,default:Px},Symbol.toStringTag,{value:"Module"}));export{Oa as $,Ie as A,Tp as B,Qp as C,wn as D,ph as E,jl as F,_h as G,gh as H,mh as I,yh as J,gT as K,Ga as L,tn as M,qM as N,FS as O,Zr as P,Hx as Q,Lp as R,Nr as S,Bp as T,dv as U,It as V,$r as W,la as X,eu as Y,_s as Z,Sp as _,Xn as a,kr as a$,Ia as a0,rr as a1,ua as a2,AM as a3,bp as a4,zx as a5,Uc as a6,SE as a7,Pf as a8,Mc as a9,Cp as aA,Ic as aB,J0 as aC,sl as aD,an as aE,ss as aF,vE as aG,fv as aH,K as aI,qT as aJ,Ce as aK,FE as aL,ga as aM,Sc as aN,b0 as aO,iT as aP,uc as aQ,Ix as aR,Fo as aS,nc as aT,Tr as aU,NS as aV,VE as aW,An as aX,Wp as aY,$0 as aZ,Jl as a_,mi as aa,Tn as ab,Jx as ac,Xx as ad,Yx as ae,F0 as af,Fx as ag,Vp as ah,Sa as ai,wv as aj,JC as ak,Jt as al,Zs as am,Ur as an,Do as ao,ir as ap,wM as aq,Be as ar,pM as as,di as at,za as au,Qh as av,xn as aw,Ec as ax,pf as ay,Oc as az,un as b,s0 as b$,kS as b0,Nx as b1,$h as b2,Ep as b3,WS as b4,So as b5,RM as b6,nr as b7,oc as b8,nu as b9,yv as bA,Xl as bB,bv as bC,oM as bD,Mt as bE,vo as bF,lu as bG,G0 as bH,HE as bI,hT as bJ,$x as bK,oT as bL,qf as bM,eT as bN,Tf as bO,cr as bP,Qn as bQ,Iu as bR,qp as bS,Cr as bT,Ti as bU,Nc as bV,W as bW,ai as bX,ja as bY,ub as bZ,a0 as b_,Cn as ba,Oo as bb,ha as bc,rO as bd,ZT as be,Bu as bf,pv as bg,xu as bh,Tc as bi,Di as bj,hv as bk,n0 as bl,yC as bm,xo as bn,Jd as bo,hl as bp,Rf as bq,so as br,GE as bs,zM as bt,t0 as bu,tu as bv,$C as bw,_E as bx,W0 as by,OT as bz,rt as c,Gi as c$,Bx as c0,se as c1,TM as c2,Ve as c3,lM as c4,Gu as c5,bn as c6,ft as c7,T0 as c8,zS as c9,Wa as cA,Ah as cB,Ph as cC,Rh as cD,xh as cE,Ih as cF,lT as cG,v0 as cH,z0 as cI,Vo as cJ,Qa as cK,eo as cL,ci as cM,Yl as cN,Jp as cO,$p as cP,Vu as cQ,el as cR,Hp as cS,ji as cT,Dr as cU,uC as cV,Zi as cW,hM as cX,Xa as cY,ET as cZ,ms as c_,bd as ca,Md as cb,Ap as cc,xc as cd,Ac as ce,kp as cf,Xt as cg,$M as ch,Yn as ci,YE as cj,Qx as ck,Xp as cl,bh as cm,Th as cn,X0 as co,Kp as cp,Yp as cq,Eh as cr,Ch as cs,Sh as ct,H0 as cu,Ro as cv,Up as cw,Yi as cx,Mh as cy,Oh as cz,Yt as d,pe as d$,Dc as d0,On as d1,$s as d2,iu as d3,GS as d4,c0 as d5,o0 as d6,xf as d7,il as d8,Vr as d9,Dp as dA,In as dB,Js as dC,Eu as dD,ps as dE,af as dF,mc as dG,Tb as dH,gb as dI,cT as dJ,Eb as dK,Xh as dL,Rb as dM,Ps as dN,HM as dO,nT as dP,yi as dQ,Y0 as dR,cM as dS,V0 as dT,oS as dU,Ft as dV,xa as dW,Ks as dX,X as dY,ze as dZ,oi as d_,ac as da,jh as db,WM as dc,tM as dd,eM as de,SM as df,sO as dg,bc as dh,US as di,U0 as dj,kt as dk,_p as dl,Zl as dm,Pd as dn,it as dp,Df as dq,zh as dr,Gh as ds,N0 as dt,wp as du,zt as dv,ot as dw,Vd as dx,qs as dy,Kt as dz,Tt as e,y0 as e$,U as e0,F as e1,uT as e2,xs as e3,V as e4,BS as e5,bs as e6,JM as e7,Rp as e8,L0 as e9,Oi as eA,fa as eB,Hi as eC,IM as eD,Qe as eE,O0 as eF,PT as eG,tT as eH,aM as eI,Tv as eJ,N as eK,Td as eL,Ra as eM,cv as eN,Uh as eO,Uu as eP,d0 as eQ,qx as eR,hc as eS,Mn as eT,yS as eU,ui as eV,qh as eW,Rt as eX,zu as eY,DT as eZ,m0 as e_,fT as ea,e0 as eb,Wh as ec,wT as ed,Sf as ee,Kh as ef,Ya as eg,B0 as eh,wc as ei,kh as ej,Fr as ek,Mx as el,jx as em,Jh as en,al as eo,CT as ep,uM as eq,dT as er,vt as es,au as et,Le as eu,vi as ev,M as ew,G as ex,nl as ey,br as ez,Ut as f,mC as f$,Yh as f0,JT as f1,ic as f2,VM as f3,tc as f4,ii as f5,Ts as f6,ec as f7,Rs as f8,Zx as f9,Dx as fA,Pi as fB,ea as fC,sc as fD,on as fE,ye as fF,pn as fG,nh as fH,mp as fI,Ou as fJ,kM as fK,Es as fL,FM as fM,Da as fN,GT as fO,Ma as fP,ko as fQ,Ln as fR,Br as fS,Fv as fT,dM as fU,ku as fV,Ue as fW,Aa as fX,ct as fY,ta as fZ,vC as f_,Fn as fa,sh as fb,lh as fc,fi as fd,hn as fe,up as ff,k0 as fg,_M as fh,Wo as fi,mE as fj,GM as fk,Je as fl,wt as fm,wo as fn,La as fo,Pc as fp,jo as fq,iM as fr,Rc as fs,Ui as ft,xi as fu,Lr as fv,Uo as fw,us as fx,ls as fy,Rd as fz,yu as g,fn as g$,As as g0,bT as g1,pT as g2,Vx as g3,Bc as g4,aS as g5,gr as g6,Ed as g7,Ka as g8,A0 as g9,pC as gA,OM as gB,rc as gC,Gt as gD,Mf as gE,gp as gF,vp as gG,Pa as gH,yT as gI,np as gJ,jd as gK,co as gL,fp as gM,RT as gN,Lv as gO,Hd as gP,MC as gQ,jM as gR,de as gS,q0 as gT,Nv as gU,Te as gV,Ae as gW,EM as gX,ut as gY,cn as gZ,Or as g_,lp as ga,_t as gb,_i as gc,Ux as gd,YT as ge,kx as gf,ae as gg,Gx as gh,lm as gi,_T as gj,I0 as gk,Ir as gl,xM as gm,MM as gn,At as go,rM as gp,op as gq,QT as gr,BM as gs,mT as gt,xT as gu,_c as gv,_0 as gw,Q0 as gx,MT as gy,gc as gz,Z0 as h,XM as h$,eO as h0,Of as h1,nO as h2,If as h3,j0 as h4,qC as h5,Fc as h6,Za as h7,he as h8,Jf as h9,UM as hA,gE as hB,oo as hC,Fp as hD,He as hE,Ii as hF,lc as hG,ou as hH,ql as hI,Jo as hJ,mo as hK,TS as hL,OS as hM,QM as hN,ZM as hO,ES as hP,qt as hQ,qe as hR,rv as hS,BC as hT,Cd as hU,$d as hV,sT as hW,c_ as hX,d_ as hY,p_ as hZ,YM as h_,Sd as ha,Ad as hb,Lu as hc,sn as hd,DM as he,$i as hf,r0 as hg,$l as hh,Ss as hi,po as hj,Lc as hk,dc as hl,AT as hm,KT as hn,WT as ho,NM as hp,wa as hq,uh as hr,Gp as hs,fo as ht,go as hu,nM as hv,ri as hw,Sn as hx,vT as hy,Cf as hz,vM as i,g as i$,__ as i0,Kx as i1,xd as i2,$f as i3,Qs as i4,Ot as i5,Ta as i6,Ho as i7,tr as i8,ll as i9,nn as iA,KM as iB,to as iC,ne as iD,Go as iE,vc as iF,Dh as iG,LM as iH,oO as iI,aO as iJ,ol as iK,Qt as iL,fc as iM,jt as iN,yc as iO,ka as iP,Zo as iQ,pi as iR,qo as iS,T_ as iT,Kl as iU,E_ as iV,Au as iW,lv as iX,Lh as iY,Zf as iZ,le as i_,pS as ia,aT as ib,Ox as ic,wu as id,rl as ie,Et as ig,Dn as ih,yp as ii,VS as ij,H as ik,uu as il,K0 as im,Cs as io,PM as ip,vf as iq,tO as ir,Ke as is,Fh as it,UT as iu,zT as iv,Pn as iw,st as ix,Q as iy,wr as iz,ep as j,fM as j$,gt as j0,ba as j1,rT as j2,S as j3,ge as j4,ya as j5,bM as j6,iO as j7,nb as j8,cc as j9,Qy as jA,Gr as jB,Fs as jC,Sr as jD,sf as jE,qS as jF,YS as jG,Ns as jH,Ls as jI,Ms as jJ,eb as jK,$y as jL,av as jM,Nh as jN,KS as jO,er as jP,ma as jQ,Gc as jR,Is as jS,qy as jT,Bh as jU,hi as jV,Zn as jW,Np as jX,tl as jY,Hh as jZ,ST as j_,Qi as ja,Su as jb,g_ as jc,Iv as jd,KC as je,TT as jf,$n as jg,ih as jh,No as ji,ip as jj,bi as jk,Nn as jl,Ql as jm,zr as jn,$o as jo,Os as jp,Ds as jq,Ky as jr,zo as js,ws as jt,va as ju,rb as jv,mM as jw,ib as jx,tb as jy,gM as jz,p0 as k,Jr as k$,Wi as k0,Kn as k1,Zp as k2,Du as k3,CM as k4,S0 as k5,fh as k6,Hy as k7,jy as k8,wx as k9,$t as kA,lf as kB,EA as kC,cu as kD,pO as kE,qa as kF,qr as kG,Qc as kH,jc as kI,lO as kJ,hA as kK,pr as kL,ni as kM,Re as kN,Kc as kO,gO as kP,yA as kQ,cA as kR,_l as kS,RA as kT,CO as kU,Bi as kV,vO as kW,dn as kX,bA as kY,Bf as kZ,dA as k_,Mp as ka,Yy as kb,hp as kc,Cv as kd,E0 as ke,Ev as kf,oe as kg,yM as kh,sM as ki,Lx as kj,bt as kk,te as kl,rh as km,cp as kn,P as ko,Nd as kp,et as kq,Va as kr,Ld as ks,To as kt,eh as ku,th as kv,Ba as kw,Fd as kx,xe as ky,zl as kz,l_ as l,fP as l$,cO as l0,pA as l1,Vs as l2,Mi as l3,mO as l4,_A as l5,Ff as l6,yO as l7,Xc as l8,uO as l9,vl as lA,Er as lB,Vf as lC,Lo as lD,YA as lE,Ko as lF,en as lG,rn as lH,KA as lI,Ki as lJ,We as lK,QA as lL,ZA as lM,qA as lN,vP as lO,$e as lP,JA as lQ,$A as lR,iP as lS,oP as lT,eP as lU,rP as lV,nP as lW,uP as lX,lP as lY,tP as lZ,aP as l_,_r as la,bO as lb,Nf as lc,vA as ld,hO as le,hu as lf,Yc as lg,fO as lh,TO as li,ln as lj,EO as lk,TA as ll,Xi as lm,pl as ln,io as lo,tt as lp,Bs as lq,Us as lr,mA as ls,Ja as lt,_O as lu,dO as lv,Dt as lw,mn as lx,ml as ly,Vi as lz,u_ as m,hP as m0,cP as m1,dP as m2,pP as m3,_P as m4,gP as m5,vn as m6,lo as m7,Xo as m8,zi as m9,MA as ma,Gs as mb,mP as mc,yP as md,AP as me,RP as mf,SO as mg,FP as mh,GP as mi,YP as mj,ed as mk,nR as ml,fR as mm,gR as mn,MP as mo,xP as mp,PP as mq,ER as mr,xR as ms,LR as mt,kR as mu,XR as mv,JR as mw,Qf as mx,AO as my,f_ as n,wh as o,h_ as p,Wx as q,Id as r,sa as s,ah as t,Rn as u,Pp as v,Hl as w,Ea as x,Ca as y,pc as z};
16059
+ `));else throw new Error("could not patch the pbrPixelShader");W.IncludesShadersStore.customToonShading=Cx;async function Hs(n,t,e=Oe.BodyShape.MALE,i,r){const o=Na(t,e);if(Yf(o))throw new Error(`The wearable="${t.id}" is a texture`);const a=dd(o),s=await id(n,a);for(const l of s.meshes)l.name.toLowerCase().includes("collider")&&(l.isVisible=!1,n.removeMesh(l));for(const l of s.materials)if(l instanceof Rt){const u=l;u.specularIntensity=0,u.metallic&&(u.metallic=0,u.metallicF0Factor=0),u.name.toLowerCase().includes("hair")&&(r?(u.albedoColor=K.FromHexString(r).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u))),u.name.toLowerCase().includes("skin")&&(i?(u.albedoColor=K.FromHexString(i).toLinearSpace(),u.specularIntensity=0,u.alpha=1):(u.alpha=0,n.removeMaterial(u)))}for(const l of s.animationGroups)l.stop(),l.reset(),l.dispose();return{container:s,wearable:t}}async function Sx(n,t){const[e,i]=await ox(n,t);try{Ex(t);let r;const o={setSpringBonesParams(l,u){return Promise.resolve()}},a=[];if(t.type===Oe.PreviewType.AVATAR){const l=fA(t),u=Array.from(l.values());for(const p of u.filter(zc)){const _=Hs(e,p,t.bodyShape,t.skin,t.hair).catch(v=>{console.warn(v.message),uo(v,{phase:"loadWearable",bodyShape:t.bodyShape})});a.push(_)}let f=null;t.socialEmote&&t.socialEmote.Armature_Other&&(f=new V("parent_other",e));const h=new Map,c=(await Promise.all(a)).filter(tA);for(const p of c)if(p.container.addAllToScene(),f){const _=p.container.instantiateModelsToScene(E=>`${E}_Other`),m=K.FromHexString("#c9c9c9").toLinearSpace(),y=_.rootNodes;for(const E of y)E.setParent(f);aA(y,m);const T=oA(p.container,y);for(const[E,C]of T)h.set(E,C)}const d=sA(c);if(d){const p=u.filter(iA),{eyes:_,eyebrows:v,mouth:m}=await yx(e,p,t.bodyShape);bx(e,d,_,v,m,t)}r=await gx(e,c,t,h)||gu()}else{const l=t.item;if(l&&!kl(l))try{(await Hs(e,l,t.bodyShape,t.skin,t.hair)).container.addAllToScene()}catch{(await Hs(e,l,t.bodyShape===Oe.BodyShape.MALE?Oe.BodyShape.FEMALE:Oe.BodyShape.MALE,t.skin,t.hair)).container.addAllToScene()}r=gu()}return t.centerBoundingBox&&ux(e),{scene:i,emote:r,physics:o}}catch(r){throw e.clearColor=new Ce(0,0,0,0),r}}const Ax=()=>{const[n,t]=Ri.useState(""),{width:e,height:i}=pd(),[r,o]=Ri.useState({}),[a,s]=Ri.useState(!1),[l,u]=Ri.useState(!0),[f,h]=Ri.useState(!1),c=Ri.useRef(null),d=_d(),[p,_,v]=yd(),[m,y]=Ri.useState(""),[T,E]=Ri.useState(!0),[C,A]=Ri.useState(!1),R=n||v,O=(l||_)&&!R,D=!!m&&!T&&!O,I=T&&!O;return Ri.useEffect(()=>{let x=()=>{};if(c.current&&p){let L={opacity:1};p.background.image&&(y(p.background.image),L.opacity=1,!p.background.transparent&&p.type===Oe.PreviewType.TEXTURE&&(L.backgroundColor=p.background.color)),o(L),p.type===Oe.PreviewType.TEXTURE?(E(!1),u(!1),h(!0)):Sx(c.current,p).then(Y=>{d.current=Y,x=gd(d.current)}).catch(Y=>{uo(Y,{component:"Preview",phase:"render"}),t(Y.message)}).finally(()=>{u(!1),h(!0)})}return()=>{x()}},[c.current,p]),Ri.useEffect(()=>{var x;C||(f?(Oe.sendMessage(vu(),Oe.PreviewMessageType.LOAD,{renderer:Oe.PreviewRenderer.BABYLON}),A(!0),((p==null?void 0:p.type)===Oe.PreviewType.AVATAR||p!=null&&p.emote&&p.emote!==Oe.PreviewEmote.IDLE)&&((x=d.current)==null||x.emote.play())):R&&(uo(new Error(R),{component:"Preview",phase:"sendErrorToParent"}),Oe.sendMessage(vu(),Oe.PreviewMessageType.ERROR,{message:R}),A(!0)))},[f,R,C,d,p==null?void 0:p.type,p==null?void 0:p.emote]),Ri.useEffect(()=>{if(_){let x=!1;l||(u(!0),x=!0),C&&(A(!1),x=!0),x&&f&&h(!1)}},[_,l,C,f]),vd(),na.jsxs("div",{className:es("Preview",{"is-dragging":a,"is-loading":O,"is-loaded":f,"is-3d":T&&(p==null?void 0:p.camera)===Oe.PreviewCamera.INTERACTIVE,"has-error":!!R,"no-fade-effect":p&&!p.fadeEffect}),style:r,children:[na.jsx("img",{src:m,className:es("thumbnail",{"is-visible":D}),alt:"preview"}),na.jsx("canvas",{id:"wearable-preview",className:es({"is-visible":I}),width:e,height:i,ref:c,onMouseDown:()=>s(T&&!R),onMouseUp:()=>s(!1)}),R&&na.jsx("div",{className:"error",children:R})]})},Px=od.memo(Ax),AO=Object.freeze(Object.defineProperty({__proto__:null,default:Px},Symbol.toStringTag,{value:"Module"}));export{Oa as $,Ie as A,Tp as B,Qp as C,wn as D,ph as E,jl as F,_h as G,gh as H,mh as I,yh as J,gT as K,Ga as L,tn as M,qM as N,FS as O,Zr as P,Hx as Q,Lp as R,Nr as S,Bp as T,dv as U,It as V,$r as W,la as X,eu as Y,_s as Z,Sp as _,Xn as a,kr as a$,Ia as a0,rr as a1,ua as a2,AM as a3,bp as a4,zx as a5,Uc as a6,SE as a7,Pf as a8,Mc as a9,Cp as aA,Ic as aB,J0 as aC,sl as aD,an as aE,ss as aF,vE as aG,fv as aH,K as aI,qT as aJ,Ce as aK,FE as aL,ga as aM,Sc as aN,b0 as aO,iT as aP,uc as aQ,Ix as aR,Fo as aS,nc as aT,Tr as aU,NS as aV,VE as aW,An as aX,Wp as aY,$0 as aZ,Jl as a_,mi as aa,Tn as ab,Jx as ac,Xx as ad,Yx as ae,F0 as af,Fx as ag,Vp as ah,Sa as ai,wv as aj,JC as ak,Jt as al,Zs as am,Ur as an,Do as ao,ir as ap,wM as aq,Be as ar,pM as as,di as at,za as au,Qh as av,xn as aw,Ec as ax,pf as ay,Oc as az,un as b,s0 as b$,kS as b0,Nx as b1,$h as b2,Ep as b3,WS as b4,So as b5,RM as b6,nr as b7,oc as b8,nu as b9,yv as bA,Xl as bB,bv as bC,oM as bD,Mt as bE,vo as bF,lu as bG,G0 as bH,HE as bI,hT as bJ,$x as bK,oT as bL,qf as bM,eT as bN,Tf as bO,cr as bP,Qn as bQ,Iu as bR,qp as bS,Cr as bT,Ti as bU,Nc as bV,W as bW,ai as bX,ja as bY,ub as bZ,a0 as b_,Cn as ba,Oo as bb,ha as bc,rO as bd,ZT as be,Bu as bf,pv as bg,xu as bh,Tc as bi,Di as bj,hv as bk,n0 as bl,yC as bm,xo as bn,Jd as bo,hl as bp,Rf as bq,so as br,GE as bs,zM as bt,t0 as bu,tu as bv,$C as bw,_E as bx,W0 as by,OT as bz,rt as c,Gi as c$,Bx as c0,se as c1,TM as c2,Ve as c3,lM as c4,Gu as c5,bn as c6,ft as c7,T0 as c8,zS as c9,Wa as cA,Ah as cB,Ph as cC,Rh as cD,xh as cE,Ih as cF,lT as cG,v0 as cH,z0 as cI,Vo as cJ,Qa as cK,eo as cL,ci as cM,Yl as cN,Jp as cO,$p as cP,Vu as cQ,el as cR,Hp as cS,ji as cT,Dr as cU,uC as cV,Zi as cW,hM as cX,Xa as cY,ET as cZ,ms as c_,bd as ca,Md as cb,Ap as cc,xc as cd,Ac as ce,kp as cf,Xt as cg,$M as ch,Yn as ci,YE as cj,Qx as ck,Xp as cl,bh as cm,Th as cn,X0 as co,Kp as cp,Yp as cq,Eh as cr,Ch as cs,Sh as ct,H0 as cu,Ro as cv,Up as cw,Yi as cx,Mh as cy,Oh as cz,Yt as d,pe as d$,Dc as d0,On as d1,$s as d2,iu as d3,GS as d4,c0 as d5,o0 as d6,xf as d7,il as d8,Vr as d9,Dp as dA,In as dB,Js as dC,Eu as dD,ps as dE,af as dF,mc as dG,Tb as dH,gb as dI,cT as dJ,Eb as dK,Xh as dL,Rb as dM,Ps as dN,HM as dO,nT as dP,yi as dQ,Y0 as dR,cM as dS,V0 as dT,oS as dU,Ft as dV,xa as dW,Ks as dX,X as dY,ze as dZ,oi as d_,ac as da,jh as db,WM as dc,tM as dd,eM as de,SM as df,sO as dg,bc as dh,US as di,U0 as dj,kt as dk,_p as dl,Zl as dm,Pd as dn,it as dp,Df as dq,zh as dr,Gh as ds,N0 as dt,wp as du,zt as dv,ot as dw,Vd as dx,qs as dy,Kt as dz,Tt as e,y0 as e$,U as e0,F as e1,uT as e2,xs as e3,V as e4,BS as e5,bs as e6,JM as e7,Rp as e8,L0 as e9,Oi as eA,fa as eB,Hi as eC,IM as eD,Qe as eE,O0 as eF,PT as eG,tT as eH,aM as eI,Tv as eJ,N as eK,Td as eL,Ra as eM,cv as eN,Uh as eO,Uu as eP,d0 as eQ,qx as eR,hc as eS,Mn as eT,yS as eU,ui as eV,qh as eW,Rt as eX,zu as eY,DT as eZ,m0 as e_,fT as ea,e0 as eb,Wh as ec,wT as ed,Sf as ee,Kh as ef,Ya as eg,B0 as eh,wc as ei,kh as ej,Fr as ek,Mx as el,jx as em,Jh as en,al as eo,CT as ep,uM as eq,dT as er,vt as es,au as et,Le as eu,vi as ev,M as ew,G as ex,nl as ey,br as ez,Ut as f,mC as f$,Yh as f0,JT as f1,ic as f2,VM as f3,tc as f4,ii as f5,Ts as f6,ec as f7,Rs as f8,Zx as f9,Dx as fA,Pi as fB,ea as fC,sc as fD,on as fE,ye as fF,pn as fG,nh as fH,mp as fI,Ou as fJ,kM as fK,Es as fL,FM as fM,Da as fN,GT as fO,Ma as fP,ko as fQ,Ln as fR,Br as fS,Fv as fT,dM as fU,ku as fV,Ue as fW,Aa as fX,ct as fY,ta as fZ,vC as f_,Fn as fa,sh as fb,lh as fc,fi as fd,hn as fe,up as ff,k0 as fg,_M as fh,Wo as fi,mE as fj,GM as fk,Je as fl,wt as fm,wo as fn,La as fo,Pc as fp,jo as fq,iM as fr,Rc as fs,Ui as ft,xi as fu,Lr as fv,Uo as fw,us as fx,ls as fy,Rd as fz,yu as g,fn as g$,As as g0,bT as g1,pT as g2,Vx as g3,Bc as g4,aS as g5,gr as g6,Ed as g7,Ka as g8,A0 as g9,pC as gA,OM as gB,rc as gC,Gt as gD,Mf as gE,gp as gF,vp as gG,Pa as gH,yT as gI,np as gJ,jd as gK,co as gL,fp as gM,RT as gN,Lv as gO,Hd as gP,MC as gQ,jM as gR,de as gS,q0 as gT,Nv as gU,Te as gV,Ae as gW,EM as gX,ut as gY,cn as gZ,Or as g_,lp as ga,_t as gb,_i as gc,Ux as gd,YT as ge,kx as gf,ae as gg,Gx as gh,lm as gi,_T as gj,I0 as gk,Ir as gl,xM as gm,MM as gn,At as go,rM as gp,op as gq,QT as gr,BM as gs,mT as gt,xT as gu,_c as gv,_0 as gw,Q0 as gx,MT as gy,gc as gz,Z0 as h,XM as h$,eO as h0,Of as h1,nO as h2,If as h3,j0 as h4,qC as h5,Fc as h6,Za as h7,he as h8,Jf as h9,UM as hA,gE as hB,oo as hC,Fp as hD,He as hE,Ii as hF,lc as hG,ou as hH,ql as hI,Jo as hJ,mo as hK,TS as hL,OS as hM,QM as hN,ZM as hO,ES as hP,qt as hQ,qe as hR,rv as hS,BC as hT,Cd as hU,$d as hV,sT as hW,c_ as hX,d_ as hY,p_ as hZ,YM as h_,Sd as ha,Ad as hb,Lu as hc,sn as hd,DM as he,$i as hf,r0 as hg,$l as hh,Ss as hi,po as hj,Lc as hk,dc as hl,AT as hm,KT as hn,WT as ho,NM as hp,wa as hq,uh as hr,Gp as hs,fo as ht,go as hu,nM as hv,ri as hw,Sn as hx,vT as hy,Cf as hz,vM as i,g as i$,__ as i0,Kx as i1,xd as i2,$f as i3,Qs as i4,Ot as i5,Ta as i6,Ho as i7,tr as i8,ll as i9,nn as iA,KM as iB,to as iC,ne as iD,Go as iE,vc as iF,Dh as iG,LM as iH,oO as iI,aO as iJ,ol as iK,Qt as iL,fc as iM,jt as iN,yc as iO,ka as iP,Zo as iQ,pi as iR,qo as iS,T_ as iT,Kl as iU,E_ as iV,Au as iW,lv as iX,Lh as iY,Zf as iZ,le as i_,pS as ia,aT as ib,Ox as ic,wu as id,rl as ie,Et as ig,Dn as ih,yp as ii,VS as ij,H as ik,uu as il,K0 as im,Cs as io,PM as ip,vf as iq,tO as ir,Ke as is,Fh as it,UT as iu,zT as iv,Pn as iw,st as ix,Q as iy,wr as iz,ep as j,fM as j$,gt as j0,ba as j1,rT as j2,S as j3,ge as j4,ya as j5,bM as j6,iO as j7,nb as j8,cc as j9,Qy as jA,Gr as jB,Fs as jC,Sr as jD,sf as jE,qS as jF,YS as jG,Ns as jH,Ls as jI,Ms as jJ,eb as jK,$y as jL,av as jM,Nh as jN,KS as jO,er as jP,ma as jQ,Gc as jR,Is as jS,qy as jT,Bh as jU,hi as jV,Zn as jW,Np as jX,tl as jY,Hh as jZ,ST as j_,Qi as ja,Su as jb,g_ as jc,Iv as jd,KC as je,TT as jf,$n as jg,ih as jh,No as ji,ip as jj,bi as jk,Nn as jl,Ql as jm,zr as jn,$o as jo,Os as jp,Ds as jq,Ky as jr,zo as js,ws as jt,va as ju,rb as jv,mM as jw,ib as jx,tb as jy,gM as jz,p0 as k,Jr as k$,Wi as k0,Kn as k1,Zp as k2,Du as k3,CM as k4,S0 as k5,fh as k6,Hy as k7,jy as k8,wx as k9,$t as kA,lf as kB,EA as kC,cu as kD,pO as kE,qa as kF,qr as kG,Qc as kH,jc as kI,lO as kJ,hA as kK,pr as kL,ni as kM,Re as kN,Kc as kO,gO as kP,yA as kQ,cA as kR,_l as kS,RA as kT,CO as kU,Bi as kV,vO as kW,dn as kX,bA as kY,Bf as kZ,dA as k_,Mp as ka,Yy as kb,hp as kc,Cv as kd,E0 as ke,Ev as kf,oe as kg,yM as kh,sM as ki,Lx as kj,bt as kk,te as kl,rh as km,cp as kn,P as ko,Nd as kp,et as kq,Va as kr,Ld as ks,To as kt,eh as ku,th as kv,Ba as kw,Fd as kx,xe as ky,zl as kz,l_ as l,fP as l$,cO as l0,pA as l1,Vs as l2,Mi as l3,mO as l4,_A as l5,Ff as l6,yO as l7,Xc as l8,uO as l9,vl as lA,Er as lB,Vf as lC,Lo as lD,YA as lE,Ko as lF,en as lG,rn as lH,KA as lI,Ki as lJ,We as lK,QA as lL,ZA as lM,qA as lN,vP as lO,$e as lP,JA as lQ,$A as lR,iP as lS,oP as lT,eP as lU,rP as lV,nP as lW,uP as lX,lP as lY,tP as lZ,aP as l_,_r as la,bO as lb,Nf as lc,vA as ld,hO as le,hu as lf,Yc as lg,fO as lh,TO as li,ln as lj,EO as lk,TA as ll,Xi as lm,pl as ln,io as lo,tt as lp,Bs as lq,Us as lr,mA as ls,Ja as lt,_O as lu,dO as lv,Dt as lw,mn as lx,ml as ly,Vi as lz,u_ as m,hP as m0,cP as m1,dP as m2,pP as m3,_P as m4,gP as m5,vn as m6,lo as m7,Xo as m8,zi as m9,MA as ma,Gs as mb,mP as mc,yP as md,AP as me,RP as mf,SO as mg,FP as mh,GP as mi,YP as mj,ed as mk,nR as ml,fR as mm,gR as mn,MP as mo,xP as mp,PP as mq,ER as mr,xR as ms,LR as mt,kR as mu,XR as mv,JR as mw,Qf as mx,AO as my,f_ as n,wh as o,h_ as p,Wx as q,Id as r,sa as s,ah as t,Rn as u,Pp as v,Hl as w,Ea as x,Ca as y,pc as z};
@@ -0,0 +1 @@
1
+ import{c as k,a as j,r as d,b as W,R as oe,j as U}from"./index-KYuRa154.js";import{m as ie,i as K,d as c,u as te,s as le,f as ce,a as de,b as ue,c as Se,g as me,e as ge,h as $,j as G,k as Ee,l as ye,n as fe,o as pe,p as F,q as L,r as we,t as he}from"./emote-events-R7O4OQgI.js";var x=(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.SET_SPRING_BONES_PARAMS="SetSpringBonesParams",e))(x||{});const Re={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"},Pe={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)},C=(e,t,s)=>{if(e)try{const r=String(t);Object.values(x).includes(r)||(console.warn(`Unknown Unity method: ${r}. Sending anyway...`),k(`Unknown Unity method: ${r}`,{method:r,value:s})),s!==void 0?e.SendMessage("JSBridge",r,s):e.SendMessage("JSBridge",r)}catch(r){console.error(`Failed to send Unity message ${t}:`,r),j(r,{method:String(t),value:s})}else console.warn(`Unity instance not ready, cannot send message: ${t}`),k(`Unity instance not ready, cannot send message: ${t}`,{method:String(t)})},Ae=(e,t,s)=>{if(!e){console.warn("Unity instance not available, cannot send override messages"),k("Unity instance not available, cannot send override messages");return}let r=0;t.base64s!==void 0&&s.base64s&&(C(e,"ClearBase64"),r++,Array.isArray(t.base64s)&&t.base64s.length>0&&t.base64s.forEach(n=>{C(e,"AddBase64",n),r++})),Object.entries(t).forEach(([n,a])=>{if(n!=="base64s"&&s[n]&&a!==void 0){const i=Re[n];if(i){const l=Pe[n],y=l?l(a):String(a);C(e,i,y),r++}else console.warn(`No Unity method mapping found for property: ${n}`),k(`No Unity method mapping found for property: ${n}`,{property:n,value:a})}}),r>0&&C(e,"Reload")};var Ie={VITE_BASE_URL:"https://cdn.decentraland.org/@dcl/wearable-preview/2.13.1-24096673885.commit-cf09103"};const V=new Map,_=(e,t)=>{if(!t)return e;const s=e.replace(/\/$/,""),r=t.replace(/^\//,"");return`${s}/${r}`};function Te(e){if(V.has(e))return V.get(e);const t=new Promise((s,r)=>{const n=document.querySelector(`script[src="${e}"]`);if(n){n.addEventListener("load",()=>s(n)),n.addEventListener("error",i=>r(i));return}const a=document.createElement("script");a.src=e,a.async=!0,a.onload=()=>s(a),a.onerror=i=>r(i),document.body.appendChild(a)});return V.set(e,t),t}const ve=async(e,t,s,r,n,a,i,l,y,S,u,m)=>{try{const o=Ie.VITE_BASE_URL||"";return await Te(_(o,t)),await createUnityInstance(e,{dataUrl:_(o,s),frameworkUrl:_(o,r),codeUrl:_(o,n),streamingAssetsUrl:_(o,i),symbolUrl:_(o,a),companyName:l,productName:y,productVersion:S,matchWebGLToCanvasSize:u,arguments:m})}catch(o){throw console.error("❌ Failed to load Unity instance:",o),o}},be="data:image/png;base64,";function Oe(e){return{getScreenshot:()=>new Promise(t=>{if(!e){t("");return}e.SendMessage("JSBridge","TakeScreenshot",""),window.addEventListener("message",function s(r){if(r.data.type==="unity-renderer"){const{type:n,payload:a}=r.data.payload;n==="screenshot"&&(window.removeEventListener("message",s),t(be+a))}})}),getMetrics:()=>new Promise(t=>{if(!e){t({triangles:0,materials:0,textures:0,meshes:0,bodies:0,entities:0});return}e.SendMessage("JSBridge","GetMetrics",""),window.addEventListener("message",function s(r){if(r.data.type==="unity-renderer"){const{type:n,payload:a}=r.data.payload;n==="metrics"&&(window.removeEventListener("message",s),t(a))}})}),changeZoom:async t=>{e&&e.SendMessage("JSBridge","SetZoom",t.toString())},panCamera:async t=>{if(!e)return;const s=t.x??0,r=t.y??0,n=t.z??0;e.SendMessage("JSBridge","SetOffset",`${s},${r},${n}`)},changeCameraPosition:async t=>{if(!e)return;const s=t.alpha??0,r=t.beta??0,n=t.radius??0;e.SendMessage("JSBridge","SetCameraPosition",`${s},${r},${n}`)},setUsername:async t=>{e&&e.SendMessage("JSBridge","SetUsername",t)},cleanup:async()=>{e&&e.SendMessage("JSBridge","Cleanup","")}}}function Le(e,t,s){const r=ie();let n=0,a=0,i="stopped",l=null,y=0;const S=()=>{u(),y=Date.now(),l=setInterval(()=>{var g;if(i!=="playing")return;const o=Date.now(),f=(o-y)/1e3;if(y=o,a+=f,n>0&&a>=n)if((g=t==null?void 0:t.emoteDataADR74)!=null&&g.loop)a=a%n,r.emit(c.PreviewEmoteEventType.ANIMATION_LOOP);else{a=n,u(),i="stopped",r.emit(c.PreviewEmoteEventType.ANIMATION_PLAYING,{length:a}),r.emit(c.PreviewEmoteEventType.ANIMATION_END);return}r.emit(c.PreviewEmoteEventType.ANIMATION_PLAYING,{length:a})},15)},u=()=>{l!==null&&(clearInterval(l),l=null)},m=(o,f,g)=>new Promise(E=>{if(!e){E(g);return}const p=b=>{if(b.data.type==="unity-renderer"){const{type:I,payload:R}=b.data.payload;I===f&&(window.removeEventListener("message",p),E(R))}};window.addEventListener("message",p),o()});return{getLength:async()=>await m(()=>e.SendMessage("JSBridge","GetEmoteLength",""),"emoteLength",0)??0,isPlaying:async()=>m(()=>e.SendMessage("JSBridge","IsEmotePlaying",""),"isEmotePlaying",!1),goTo:async o=>{e&&(a=o,e.SendMessage("JSBridge","GoToEmote",o.toString()),r.emit(c.PreviewEmoteEventType.ANIMATION_PLAYING,{length:o}))},play:async()=>{e&&(n<=0&&(n=await m(()=>e.SendMessage("JSBridge","GetEmoteLength",""),"emoteLength",0)),i==="stopped"&&(a=0),i="playing",e.SendMessage("JSBridge","PlayEmote",""),S(),r.emit(c.PreviewEmoteEventType.ANIMATION_PLAY))},pause:async()=>{e&&(i="paused",u(),e.SendMessage("JSBridge","PauseEmote",""),r.emit(c.PreviewEmoteEventType.ANIMATION_PAUSE))},stop:async()=>{e&&(i="stopped",a=0,u(),e.SendMessage("JSBridge","StopEmote",""),r.emit(c.PreviewEmoteEventType.ANIMATION_END))},enableSound:async()=>{e&&e.SendMessage("JSBridge","EnableSound","")},disableSound:async()=>{e&&e.SendMessage("JSBridge","DisableSound","")},hasSound:async()=>m(()=>e.SendMessage("JSBridge","HasSound",""),"hasSound",!1),isSocialEmote:async()=>K(t),getSocialEmoteAnimations:async()=>!t||!K(t)?null:[{title:"Start Animation",...t.emoteDataADR74.startAnimation},...t.emoteDataADR74.outcomes.map(o=>({title:o.title,loop:o.loop,audio:o.audio,...o.clips}))],getPlayingSocialEmoteAnimation:async()=>s??null,emote:t,events:r}}function _e(e){return{setSpringBonesParams:async(t,s)=>{e&&e.SendMessage("JSBridge",x.SET_SPRING_BONES_PARAMS,JSON.stringify({itemHash:t,params:s}))}}}const Ne={dataUrl:"/unity/Build/aang-renderer.data.br",frameworkUrl:"/unity/Build/aang-renderer.framework.js.br",codeUrl:"/unity/Build/aang-renderer.wasm.br",symbolUrl:"/unity/Build/aang-renderer.symbols.json.br"};function Ce(){return Ne}async function Me(e,t,s){let r=null;try{const n=Ce();if(r=await ve(e,"/unity/Build/aang-renderer.loader.js",n.dataUrl,n.frameworkUrl,n.codeUrl,n.symbolUrl,"/emotes","Decentraland","AangRenderer","2.2.2",!0,[]),!r)throw new Error("Failed to load Unity instance");const a=Oe(r),i=Le(r,t,s),l=_e(r);return{scene:a,emote:i,physics:l,unity:r}}catch(n){if(console.error("Unity render failed:",n),r!=null&&r.Quit)try{r.Quit()}catch(a){console.error("Error quitting Unity instance:",a),j(a,{phase:"unityQuit"})}throw n}}const De=()=>Math.floor(Math.random()*159)+1,re=()=>`default${De()}`,Ue=(e,t)=>{var s,r,n,a,i,l;return{eyes:$(t.eyes||((r=(s=e==null?void 0:e.avatar)==null?void 0:s.eyes)==null?void 0:r.color)&&G(e.avatar.eyes.color)||"#000000"),hair:$(t.hair||((a=(n=e==null?void 0:e.avatar)==null?void 0:n.hair)==null?void 0:a.color)&&G(e.avatar.hair.color)||"#000000"),skin:$(t.skin||((l=(i=e==null?void 0:e.avatar)==null?void 0:i.skin)==null?void 0:l.color)&&G(e.avatar.skin.color)||"#cc9b76")}},N=e=>e||"",X=e=>e||[],B=e=>e.replace("#","");function Z(e){const t=new URL(window.location.href);Object.entries(e).forEach(([s,r])=>{t.searchParams.delete(s),Array.isArray(r)?r.forEach(n=>{n!==""&&t.searchParams.append(s,n)}):r!==""&&t.searchParams.set(s,r)}),window.history.replaceState({},"",t.toString())}function Be(){const{options:e,overrideSources:t}=te(),[s,r]=d.useState(null),[n,a]=d.useState(!0),[i,l]=d.useState(null),y=d.useRef(null),S=d.useRef(e),u=d.useRef(!0);return d.useEffect(()=>{const m=JSON.stringify(e),o=JSON.stringify(S.current);if(!u.current&&m===o)return;u.current=!1,S.current=e,(async()=>{var g,E;try{a(!0),l(null);const p=e.peerUrl||W.get("PEER_URL"),b=e.marketplaceServerUrl||e.nftServerUrl||W.get("MARKETPLACE_SERVER_URL");let I=c.PreviewType.WEARABLE,R={color:e.background||"#4b4852",transparent:e.disableBackground===!0};const T=le(e.profile);let P=T==null?void 0:T.value;P==="default"&&(P=re());const h=P&&T?T.type==="address"?await ce(P,p):await de(P,p):null,A=e.bodyShape||((g=h==null?void 0:h.avatar)==null?void 0:g.bodyShape)||c.BodyShape.MALE;let w=null;if(e.contractAddress&&(w=await ue({contractAddress:e.contractAddress,tokenId:e.tokenId,itemId:e.itemId,peerUrl:p,marketplaceServerUrl:b}),w&&Se(w))){R={...R,image:w.thumbnail};const D=me(w);ge(D)&&(I=c.PreviewType.TEXTURE)}const{eyes:v,hair:H,skin:Y}=Ue(h,{eyes:e.eyes,hair:e.hair,skin:e.skin}),M=e.unityMode||null,ne=e.camera&&Object.values(c.PreviewCamera).includes(e.camera)?e.camera:c.PreviewCamera.INTERACTIVE,Q=e.projection&&Object.values(c.PreviewProjection).includes(e.projection)?e.projection:c.PreviewProjection.PERSPECTIVE,O=e.disableDefaultEmotes?null:e.emote&&Object.values(c.PreviewEmote).includes(e.emote)?e.emote:c.PreviewEmote.IDLE,J={background:R,bodyShape:A,mode:M,projection:Q,type:I,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:v.replace("#",""),hairColor:H.replace("#",""),item:e.itemId||null,profile:P||null,skinColor:Y.replace("#",""),token:e.tokenId||null,urn:e.urns||null,showAnimationReference:null,itemDefinition:w,socialEmote:e.socialEmote||null},ae=JSON.stringify(J),se=JSON.stringify(y.current);if(ae!==se){if(y.current=J,Object.keys(t).length===0){const D=X(e.urns),q=X(e.base64s);if(M===c.PreviewUnityMode.CONFIG){const z={mode:N(M||"")};Z(z)}else{const z={background:R.transparent?"":B(R.color),disableLoader:e.disableLoader?"true":"",profile:N(P||""),bodyShape:N(A||""),eyeColor:B(v||""),hairColor:B(H||""),skinColor:B(Y||""),mode:N(M||""),camera:ne,projection:Q,emote:N((O==null?void 0:O.toString())||""),urn:D.length>0?D:[""],base64:q.length>0?q:[""]};Z(z)}}r(J)}a(!1)}catch(p){console.error("[useUnityConfig] Failed to load config:",p),l(p instanceof Error?p.message:"Failed to load config"),a(!1)}})()},[e,t]),[s,n,i]}const ke="unity-renderer",je="unity-canvas",ee=1,xe="Failed to load Unity";var Je=(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))(Je||{});const ze="get_element_bounds",$e="element_bounds_response",Ge=(e,t,s,r)=>{const[n,a]=d.useState({isLoaded:!1,isInitialized:!1,error:null}),i=d.useRef(null),l=d.useCallback(S=>{if(S.data.type===ke){const{type:u,payload:m}=S.data.payload;u==="loaded"&&(m===!0||m==="true")?(a(o=>({...o,isLoaded:!0,isInitialized:!0})),c.sendMessage(L(),c.PreviewMessageType.LOAD,{renderer:c.PreviewRenderer.UNITY}),t.current&&t.current.emote.play()):u==="customization-done"?c.sendMessage(L(),c.PreviewMessageType.CONTROLLER_RESPONSE,{id:"customization-done",ok:!0,result:JSON.parse(S.data.payload.payload)}):u==="avatar-customization-step"?c.sendMessage(L(),c.PreviewMessageType.CONTROLLER_RESPONSE,{id:"avatar-customization-step",ok:!0,result:{step:S.data.payload.payload}}):u==="element-bounds"?c.sendMessage(L(),$e,m):u==="error"&&(j(new Error(m),{component:"UnityPreview",phase:"unityMessage"}),a(o=>({...o,error:m})),c.sendMessage(L(),c.PreviewMessageType.ERROR,{message:"Error loading the wearable. Please try again."}))}},[]),y=d.useCallback(async S=>{if(!(!e.canvas.current||e.isInitializing.current||e.unityInstance.current)){e.isInitializing.current=!0,a(u=>({...u,isLoaded:!1,error:null}));try{const u=S!=null&&S.itemDefinition&&we(S.itemDefinition)?S.itemDefinition:null,{unity:m,...o}=await Me(e.canvas.current,u,(S==null?void 0:S.socialEmote)||void 0);e.unityInstance.current=m,t.current=o,i.current&&i.current(),i.current=he(t.current),a(f=>({...f,isInitialized:!0}))}catch(u){const m=u instanceof Error?u.message:xe;console.error("Unity init failed:",u),j(u,{component:"UnityPreview",phase:"initializeUnity"}),a(o=>({...o,error:m})),c.sendMessage(L(),c.PreviewMessageType.ERROR,{message:m})}finally{e.isInitializing.current=!1}}},[e,t]);return d.useEffect(()=>{n.isInitialized||r||!s||y(s)},[s,r,n.isInitialized,y]),d.useEffect(()=>()=>{i.current&&i.current()},[]),d.useEffect(()=>{if(s)return window.addEventListener("message",l,!1),()=>{window.removeEventListener("message",l,!1)}},[s,l]),n},Fe=e=>{const[t,s]=d.useState({pixelRatio:window.devicePixelRatio||ee,is3D:!0,backgroundImage:""});return d.useEffect(()=>{const r=()=>{s(a=>({...a,pixelRatio:window.devicePixelRatio||ee}))},n=window.matchMedia(`(resolution: ${t.pixelRatio}dppx)`);return n.addEventListener("change",r),()=>{n.removeEventListener("change",r)}},[t.pixelRatio]),d.useEffect(()=>{e&&s(r=>({...r,backgroundImage:e.background.image||"",is3D:e.type!==c.PreviewType.TEXTURE}))},[e]),t},Ve=(e,t,s,r,n)=>{const a=d.useMemo(()=>{const i={};for(const l of Object.keys(n))n[l]&&r[l]!==void 0&&(i[l]=r[l]);return i},[n,r]);d.useEffect(()=>{if(!(!s.isInitialized||!s.isLoaded||!e.current)){if(a.profile==="default"){const i=t.current.profile;a.profile=i!=null&&i.match(/^default\d+$/)?i:re()}Object.keys(a).length>0&&(Ae(e.current,a,n),t.current=a)}},[s.isInitialized,s.isLoaded,a,n,e,t])},He=()=>{const{width:e=window.innerWidth,height:t=window.innerHeight}=Ee(),s=d.useRef(null),r=d.useRef(null),n=d.useRef(!1),a=d.useRef({}),i=ye(),[l,y,S]=Be(),{options:u,overrideSources:m}=te(),o=d.useMemo(()=>({canvas:s,unityInstance:r,isInitializing:n,lastSentOverrides:a}),[]);fe(h=>{var A,w;if(((A=h.data)==null?void 0:A.type)===ze&&r.current){const v=(w=h.data.payload)==null?void 0:w.elementName;v&&C(r.current,x.GET_ELEMENT_BOUNDS,v)}});const f=Ge(o,i,l,y),g=Fe(l);Ve(o.unityInstance,o.lastSentOverrides,f,u,m),pe();const E=d.useMemo(()=>{const h=f.error||S,A=!f.isLoaded&&!h,w=!!g.backgroundImage&&!g.is3D&&!A,v=g.is3D&&!A;return{error:h,isLoading:A,showImage:w,showCanvas:v}},[f.error,f.isLoaded,S,g.backgroundImage,g.is3D]),p=d.useMemo(()=>({opacity:1,backgroundColor:!(l!=null&&l.background.transparent)&&(l==null?void 0:l.type)===c.PreviewType.TEXTURE?l.background.color:void 0}),[l]),b=d.useMemo(()=>({width:`${e}px`,height:`${t}px`}),[e,t]),I=d.useMemo(()=>({width:Math.round(e*g.pixelRatio),height:Math.round(t*g.pixelRatio)}),[e,t,g.pixelRatio]),R=d.useMemo(()=>F("Preview",{"is-loading":E.isLoading,"is-loaded":f.isLoaded,"is-3d":g.is3D,"has-error":!!E.error}),[E.isLoading,f.isLoaded,g.is3D,E.error]),T=d.useMemo(()=>F("thumbnail",{"is-visible":E.showImage}),[E.showImage]),P=d.useMemo(()=>F({"is-visible":E.showCanvas}),[E.showCanvas]);return U.jsxs("div",{className:R,style:p,children:[U.jsx("img",{src:g.backgroundImage,className:T,alt:"preview"}),U.jsx("canvas",{ref:o.canvas,id:je,className:P,width:I.width,height:I.height,style:b}),E.error&&U.jsx("div",{className:"error",children:E.error})]})},qe=oe.memo(He);export{Je as UnityMessageType,qe as default};